Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
feat(tojson): api/docs
Browse files Browse the repository at this point in the history
1.Update FAQ:celldata to data 2.Support config:showtoolbarConfig 3.Add API:toJson 4.Add h5-Dooring
link to readme.md
  • Loading branch information
mengshukeji committed Oct 29, 2020
1 parent b11de26 commit 8e410f5
Show file tree
Hide file tree
Showing 12 changed files with 507 additions and 129 deletions.
1 change: 1 addition & 0 deletions README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ npm run build

- [鲁班h5](https://github.com/ly525/luban-h5)
- [excelize](https://github.com/360EntSecGroup-Skylar/excelize)
- [h5-Dooring](https://github.com/MrXujiang/h5-Dooring)

## 加入共建

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ Create a table

- [luban-h5](https://github.com/ly525/luban-h5)
- [excelize](https://github.com/360EntSecGroup-Skylar/excelize)
- [h5-Dooring](https://github.com/MrXujiang/h5-Dooring)

## Co-construction

Expand Down
24 changes: 14 additions & 10 deletions docs/guide/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

**<span style="font-size:20px;">A</span>**: Use one-dimensional array format [celldata](/zh/guide/sheet.html#celldata), after the initialization is completed, the data converted into a two-dimensional array format is used for storage and update, and celldata is no longer used.

If you need to take out data as initial data, you need to execute `luckysheet.getGridData(data)` to convert it to celldata data.
Among them, the celldata in `{ r, c, v }` format is converted to a two-dimensional array using `luckysheet.buildGridData(luckysheetfile)`, and the input parameter is the table data object `luckysheetfile`
If you need to take out `data` as initial data, you need to execute [transToCellData(data)](/guide/api.html#transtocelldata-data-setting) to convert it to celldata data.
Among them, the celldata in `{ r, c, v }` format is converted to a two-dimensional array using [transToData(celldata)](/guide/api.html#transtodata-celldata-setting)

Summarized as follows:
```js
// data => celldata two-dimensional array data is converted into {r, c, v} format one-dimensional array, the input parameter is two-dimensional data
luckysheet.getGridData(data)
// data => celldata two-dimensional array data into {r, c, v} format one-dimensional array
luckysheet.transToCellData(data)

// celldata => data The two-dimensional array required to generate the table, the input parameter is the table data object file
luckysheet.buildGridData(luckysheetfile)
// celldata => data to generate the two-dimensional array required for the table
luckysheet.transToData(celldata)
```

------------
Expand Down Expand Up @@ -63,14 +63,17 @@ Note: Initial data needs to be configured with loadUrl and loadSheetUrl paramete

## **<span style="font-size:20px;">Q</span>** How to import and export excel?

**<span style="font-size:20px;">A</span>**: The excel import and export library developed with Luckysheet-[Luckyexcel](https://github.com/mengshukeji/Luckyexcel) has realized the excel import function, and the export function is under development. You can refer to this blog post for excel export at this stage: https://www.cnblogs.com/recode-hyh/p/13168226.html.
**<span style="font-size:20px;">A</span>**: The excel import and export library developed with Luckysheet-[Luckyexcel](https://github.com/mengshukeji/Luckyexcel) has realized the excel import function, and the export function is under development.You can refer to these 2 blog posts for excel export at this stage:

- [Development of Excel download function based on LuckySheet online form](https://www.cnblogs.com/recode-hyh/p/13168226.html)
- [Use exceljs to export luckysheet form](https://blog.csdn.net/csdn_lsy/article/details/107179708)

------------

## **<span style="font-size:20px;">Q</span>** How to merge cells during initialization?

**<span style="font-size:20px;">A</span>**: Refer to the following case
- Luckysheet initializes data with merged cells: https://www.cnblogs.com/DuShuSir/p/13272397.html
**<span style="font-size:20px;">A</span>**: Refer to the following case:
- [How Luckysheet initializes the data with merged cells](https://www.cnblogs.com/DuShuSir/p/13272397.html)

------------

Expand All @@ -80,7 +83,8 @@ Note: Initial data needs to be configured with loadUrl and loadSheetUrl paramete

- 1. after the table operation is completed, you can use `luckysheet.getAllSheets()` to get all sheet data that stroed in the back-end.
- 2. enable the collaborative editing function to transmit data to the back-end in real-time.
refer this article:https://www.cnblogs.com/DuShuSir/p/13857874.html
refer this article:
[How Luckysheet saves the data in the table to the database](https://www.cnblogs.com/DuShuSir/p/13857874.html)

------------

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1928,7 +1928,7 @@ Use note:
- **Parameter**

- {PlainObject} [setting]: optional parameters
+ {Object} [sheetObject]: The data of the newly added worksheet; the default value is an empty object
+ {Object} [sheetObject]: The data of the newly added worksheet; the default value is an empty object.Worksheet data format reference [options.data](/guide/sheet.html#initial)
+ {Number} [order]: New worksheet subscript; the default value is the last subscript
+ {Function} [success]: callback function for the end of the operation

Expand Down
55 changes: 41 additions & 14 deletions docs/guide/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,9 @@ Note that you also need to configure `loadUrl` and `loadSheetUrl` to take effect
------------
### showtoolbarConfig

[todo]

- Type: Object
- Default: {}
- Usage: Custom configuration toolbar
- Usage: Custom configuration toolbar,can be used in conjunction with showtoolbar, `showtoolbarConfig` has a higher priority.
- Format:
```json
{
Expand All @@ -214,19 +212,48 @@ Note that you also need to configure `loadUrl` and `loadSheetUrl` to take effect
verticalAlignMode: false, //'Vertical alignment'
textWrapMode: false, //'Wrap mode'
textRotateMode: false, //'Text Rotation Mode'
frozenMode: false, //'freeze mode'
sort: false, //'sort'
filter: false, //'filter'
findAndReplace: false, //'Find and Replace'
function: false, //'formula'
conditionalFormat: false, //'Conditional Format'
postil: false, //'comment'
pivotTable: false, //'PivotTable'
chart: false, //'chart' (the icon is hidden, but if the chart plugin is configured, you can still create a new chart by right click)
screenshot: false, //'screenshot'
splitColumn: false, //'Split column'
image:false, // 'Insert picture'
chart: false, //'chart' (the icon is hidden, but if the chart plugin is configured, you can still create a new chart by right click)
postil: false, //'comment'
pivotTable: false, //'PivotTable'
function: false, //'formula'
frozenMode: false, //'freeze mode'
sortAndFilter: false, //'Sort and filter'
conditionalFormat: false, //'Conditional Format'
dataVerification: false, // 'Data Verification'
splitColumn: false, //'Split column'
screenshot: false, //'screenshot'
findAndReplace: false, //'Find and Replace'
protection:false, // 'Worksheet protection'
print:false, // 'print'
//link:false, // 'Insert link'(TODO)
}
```
- Example:
- Show only the `undo/redo` and `font` buttons:

```js
//options
{
showtoolbar: false,
showtoolbarConfig:{
undoRedo: true,
font: true,
}
}
```
- Hide only the `image` and `print` buttons:

```js
//options
{
showtoolbar: true, // 默认就是true,可以不设置
showtoolbarConfig:{
image: false,
print: false,
}
}
```

------------
### showinfobar
Expand Down
21 changes: 12 additions & 9 deletions docs/zh/guide/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@

**<span style="font-size:20px;">A</span>** : 表格初始化时使用一维数组格式的 [celldata](/zh/guide/sheet.html#celldata),初始化完成后转化为二维数组格式的data作为存储更新使用,celldata不再使用。

如果需要将data拿出来作为初始化数据,则需要执行 `luckysheet.getGridData(data)`转换为celldata数据。
其中`{ r, c, v }`格式的celldata转换为二维数组使用的是`luckysheet.buildGridData(luckysheetfile)`,传入参数为表格数据对象`luckysheetfile`
如果需要将`data`拿出来作为初始化数据,则需要执行 [transToCellData(data)](/zh/guide/api.html#transtocelldata-data-setting)转换为celldata数据。
其中`{ r, c, v }`格式的celldata转换为二维数组使用的是[transToData(celldata)](/zh/guide/api.html#transtodata-celldata-setting)

总结如下:
```js
// data => celldata 二维数组数据 转化成 {r, c, v}格式 一维数组,传入参数为二维数据data
luckysheet.getGridData(data)
// data => celldata 二维数组数据 转化成 {r, c, v}格式 一维数组
luckysheet.transToCellData(data)

// celldata => data 生成表格所需二维数组,传入参数为表格数据对象file
luckysheet.buildGridData(luckysheetfile)
// celldata => data 生成表格所需二维数组
luckysheet.transToData(celldata)
```

------------
Expand Down Expand Up @@ -65,14 +65,17 @@ luckysheet.buildGridData(luckysheetfile)

## **<span style="font-size:20px;">Q</span>** excel导入导出怎么做?

**<span style="font-size:20px;">A</span>** :配合Luckysheet开发的excel导入导出库-[Luckyexcel](https://github.com/mengshukeji/Luckyexcel)已经实现了excel导入功能,导出功能正在开发当中。现阶段excel导出可以参考这篇博文: https://www.cnblogs.com/recode-hyh/p/13168226.html。
**<span style="font-size:20px;">A</span>** :配合Luckysheet开发的excel导入导出库-[Luckyexcel](https://github.com/mengshukeji/Luckyexcel)已经实现了excel导入功能,导出功能正在开发当中。现阶段excel导出可以参考这2篇博文:

- [基于LuckySheet在线表格的Excel下载功能开发](https://www.cnblogs.com/recode-hyh/p/13168226.html)
- [使用exceljs导出luckysheet表格](https://blog.csdn.net/csdn_lsy/article/details/107179708)

------------

## **<span style="font-size:20px;">Q</span>** 初始化时合并单元格怎么做?

**<span style="font-size:20px;">A</span>** :参考以下案例
- Luckysheet初始化含合并单元格的数据: https://www.cnblogs.com/DuShuSir/p/13272397.html
- [Luckysheet如何初始化含合并单元格的数据](https://www.cnblogs.com/DuShuSir/p/13272397.html)

------------

Expand All @@ -82,7 +85,7 @@ luckysheet.buildGridData(luckysheetfile)

- 一是表格操作完成后,使用`luckysheet.getAllSheets()`方法获取到全部的工作表数据,全部发送到后台存储。
- 二是开启协同编辑功能,实时传输数据给后端。
具体的操作步骤参考这篇文章:https://www.cnblogs.com/DuShuSir/p/13857874.html
具体的操作步骤参考这篇文章:[Luckysheet如何把表格里的数据保存到数据库](https://www.cnblogs.com/DuShuSir/p/13857874.html)

------------

Expand Down
4 changes: 2 additions & 2 deletions docs/zh/guide/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1880,13 +1880,13 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
- **参数**

- {PlainObject} [setting]: 可选参数
+ {Object} [sheetObject]: 新增的工作表的数据;默认值为空对象
+ {Object} [sheetObject]: 新增的工作表的数据;默认值为空对象,工作表数据格式参考[options.data](/zh/guide/sheet.html#初始化配置)
+ {Number} [order]: 新增的工作表下标;默认值为最后一个下标位置
+ {Function} [success]: 操作结束的回调函数

- **说明**

新增一个sheet,返回新增的工作表对象,`setting`中可选设置数据为 `sheetObject`,不传`sheetObject`则会新增一个空白的工作表
新增一个sheet,返回新增的工作表对象,`setting`中可选设置数据为 `sheetObject`,不传`sheetObject`则会新增一个空白的工作表

- **示例**:

Expand Down
51 changes: 39 additions & 12 deletions docs/zh/guide/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,13 @@ Luckysheet开放了更细致的自定义配置选项,分别有
------------
### showtoolbarConfig

[todo]

- 类型:Object
- 默认值:{}
- 作用:自定义配置工具栏
- 作用:自定义配置工具栏,可以与showtoolbar配合使用,`showtoolbarConfig`拥有更高的优先级。
- 格式:
```json
{
undoRedo: false, //撤销重做
undoRedo: false, //撤销重做,注意撤消重做是两个按钮,由这一个配置决定显示还是隐藏
paintFormat: false, //格式刷
currencyFormat: false, //货币格式
percentageFormat: false, //百分比格式
Expand All @@ -302,19 +300,48 @@ Luckysheet开放了更细致的自定义配置选项,分别有
verticalAlignMode: false, // '垂直对齐方式'
textWrapMode: false, // '换行方式'
textRotateMode: false, // '文本旋转方式'
frozenMode: false, // '冻结方式'
sort: false, // '排序'
filter: false, // '筛选'
findAndReplace: false, // '查找替换'
function: false, // '公式'
conditionalFormat: false, // '条件格式'
image:false, // '插入图片'
chart: false, // '图表'(图标隐藏,但是如果配置了chart插件,右击仍然可以新建图表)
postil: false, //'批注'
pivotTable: false, //'数据透视表'
chart: false, // '图表'(图标隐藏,但是如果配置了chart插件,右击仍然可以新建图表)
function: false, // '公式'
frozenMode: false, // '冻结方式'
sortAndFilter: false, // '排序和筛选'
conditionalFormat: false, // '条件格式'
dataVerification: false, // '数据验证'
splitColumn: false, // '分列'
screenshot: false, // '截图'
splitColumn: false, // '分列'
findAndReplace: false, // '查找替换'
protection:false, // '工作表保护'
print:false, // '打印'
// link:false, // '插入链接'(TODO)
}
```
- 示例:
- 仅显示撤消重做和字体按钮:

```js
//options
{
showtoolbar: false,
showtoolbarConfig:{
undoRedo: true,
font: true,
}
}
```
- 仅隐藏图片和打印按钮:

```js
//options
{
showtoolbar: true, // 默认就是true,可以不设置
showtoolbarConfig:{
image: false,
print: false,
}
}
```

------------
### showinfobar
Expand Down
13 changes: 13 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,17 @@ export default {
defaultColWidth:73,
defaultRowHeight:19,
defaultFontSize:10,

showRowBar:true, //是否显示行号区域
showColumnBar:true, //是否显示列号区域
sheetFormulaBar:true, //是否显示公式栏
showtoolbarConfig:{}, //自定义工具栏
showsheetbarConfig:{}, //自定义底部sheet页
showstatisticBarConfig:{}, //自定义计数栏
sheetBottomConfig:{}, //自定义添加行和回到顶部
cellRightClickConfig:{}, //自定义单元格右键菜单
sheetRightClickConfig:{}, //自定义底部sheet页右击菜单



}
Loading

0 comments on commit 8e410f5

Please sign in to comment.