Browse Source

docs(docs): docs,api

docs api
master
lrz 5 years ago
parent
commit
100166cdcf
  1. 6
      README-zh.md
  2. 6
      README.md
  3. 4
      docs/.vuepress/config.js
  4. 13
      docs/guide/FAQ.md
  5. 7
      docs/guide/README.md
  6. 6
      docs/guide/api.md
  7. 14
      docs/guide/config.md
  8. 217
      docs/guide/data.md
  9. 4
      docs/guide/format.md
  10. 13
      docs/zh/guide/FAQ.md
  11. 5
      docs/zh/guide/README.md
  12. 6
      docs/zh/guide/api.md
  13. 14
      docs/zh/guide/config.md
  14. 258
      docs/zh/guide/data.md
  15. 357
      docs/zh/guide/format.md
  16. 12
      docs/zh/guide/operate.md
  17. 1
      src/controllers/menuButton.js
  18. 6
      src/demoData/sheetCell.js
  19. 2
      src/demoData/sheetChart.js
  20. 2
      src/demoData/sheetComment.js
  21. 2
      src/demoData/sheetConditionFormat.js
  22. 2
      src/demoData/sheetFormula.js
  23. 2
      src/demoData/sheetPivotTable.js
  24. 2
      src/demoData/sheetPivotTableData.js
  25. 2
      src/demoData/sheetSparkline.js
  26. 2
      src/demoData/sheetTable.js
  27. 2
      src/locale/en.js
  28. 4
      src/locale/zh.js

6
README-zh.md

@ -38,7 +38,7 @@ Luckysheet ,一款纯前端类似excel的在线表格,功能强大、配置
### 操作体验
+ **撤销/重做**
+ **复制/粘贴/剪切操作** (支持luckysheet到excel和excel到luckysheet带格式的互相拷贝)
+ **复制/粘贴/剪切操作** (支持Luckysheet到excel和excel到Luckysheet带格式的互相拷贝)
+ **快捷键支持** (快捷键操作保持与excel一致,如果有不同或者缺失请反馈给我们)
+ **格式刷** (与google sheet类似)
+ **任意选区拖拽** (选择单元格,输入公式,插入图表,会与选区相关,可以通过任意拖动和放大缩小选区来改变与之关联的参数)
@ -76,7 +76,7 @@ Luckysheet ,一款纯前端类似excel的在线表格,功能强大、配置
+ **评论** (评论的删除、添加、修改、隐藏)
+ **共享编辑** (支持多用户共享编辑,内置API)
### LuckySheet专有
### Luckysheet专有
+ **矩阵计算** (通过右键菜单进行支持:对选区内的数据进行转置、旋转、数值计算)
+ **截图** (把选区的内容进行截图展示)
+ **复制到其他格式** (右键菜单的"复制为", 支持复制为json、array、对角线数据、去重等)
@ -88,7 +88,7 @@ Luckysheet ,一款纯前端类似excel的在线表格,功能强大、配置
+ **单元格内多样式** (Alt+Enter单元格内换行、上标、下标、单元格内科定义每个文字的不同样式)
+ **树形菜单** (类似excel中的分级显示(分组))
+ **表格新功能** (类似excel中表格的筛选器和切片器)
+ **EXCEL,CSV,TXT 导入及导出** (专为luckysheet打造的导入导出插件,支持密码、水印、公式等的本地导入导出)
+ **EXCEL,CSV,TXT 导入及导出** (专为Luckysheet打造的导入导出插件,支持密码、水印、公式等的本地导入导出)
+ **文档** (完善文档和API)
+ **敬请期待...** (可以提出好的建议给我们)

6
README.md

@ -40,7 +40,7 @@ Luckysheet is an online spreadsheet like excel that is powerful, simple to confi
### Operation
+ **Undo/Redo**
+ **Copy/Paste/Cut** (Copy from excel to luckysheet with format, vice versa)
+ **Copy/Paste/Cut** (Copy from excel to Luckysheet with format, vice versa)
+ **Hot key** (The operating experience is consistent with excel, if there are differences or missing, please feedback to us)
+ **Format Painter** (Similar to google sheet)
+ **Selection by drag and dropping** (Change the parameters of formula and chart through selection)
@ -78,7 +78,7 @@ Luckysheet is an online spreadsheet like excel that is powerful, simple to confi
+ **Comments** (Add, delete, update)
+ **Collaborate** (Simultaneous editing by multiple users)
### LuckySheet
### Luckysheet
+ **Matrix operation** (Operate selection through the right-click menu: transpose, rotate, numerical calculation)
+ **Screenshot** (Take a screenshot with selection)
+ **Copy to** (In the right-click menu, copy selection to json, array etc.)
@ -90,7 +90,7 @@ Luckysheet is an online spreadsheet like excel that is powerful, simple to confi
+ **Cell segmentation style** (Alt+Enter line break, sub,super, in-cell style)
+ **Tree menu** (Just like the outline (group) function of excel)
+ **Table new Features** (filter, slicer)
+ **EXCEL,CSV,TXT import/export** (Specially adapted to luckysheet)
+ **EXCEL,CSV,TXT import/export** (Specially adapted to Luckysheet)
+ **Documentation** (Improve documentation and API)
+ **More...** (Please advise us)

4
docs/.vuepress/config.js

@ -49,7 +49,7 @@ module.exports = {
'/guide/': [
'',
'config',
'feature',
'api',
'data',
'operate',
'format',
@ -84,7 +84,7 @@ module.exports = {
'/zh/guide/': [
'',
'config',
'feature',
'api',
'data',
'operate',
'format',

13
docs/guide/FAQ.md

@ -17,8 +17,21 @@ luckysheet.buildGridData(luckysheetfile)
```
------------
## What are the cell types?
**<span style="font-size:20px;">A</span>**: Refer to [Cell Format List](https://mengshukeji.github.io/LuckysheetDocs/guide/format.html), with examples of available cell formats
------------
## How to use Luckysheet in vue project?
**<span style="font-size:20px;">A</span>** : Reference [Luckysheet-vue-demo](https://github.com/Dushusir/vue-demo)
------------
## Why will the formula in the table not be triggered after initialization?
**<span style="font-size:20px;">A</span>** : Refer to [Table data format](https://mengshukeji.github.io/LuckysheetDocs/zh/guide/data.html#calcchain) ,just set the calcChain corresponding to the cell data.
------------

7
docs/guide/README.md

@ -214,4 +214,9 @@ You can see the complete settings
| UP/DOWN/LEFT/RIGHT | Move cell selection box |
| ENTER | Edit cell |
| TAB | Move cell selection box to the right |
| DELETE | Clear cell data |
| DELETE | Clear cell data |
## warning
::: danger
The new API is being sorted out and may change at any time, please use it with caution!
:::

6
docs/guide/feature.md → docs/guide/api.md

@ -1,4 +1,8 @@
# Advanced Features
# API
::: danger
The new API is being sorted out, please use it with caution!
:::
## luckysheet.create(options)
- **Parameter**

14
docs/guide/config.md

@ -156,6 +156,12 @@
- Default: ""
- Usage: Form unique identifier
------------
## allowUpdate
- Type: Boolean
- Default: false
- Usage: Whether to allow back-end update after operating the table, used in conjunction with `updateUrl`
------------
## loadUrl
- Type: String
@ -172,7 +178,7 @@
## updateUrl
- Type: String
- Default: ""
- Usage: Update URL of table data
- Usage: The back-end update address after operating the table will only be effective when `allowUpdate` is `true`
------------
## updateImageUrl
@ -180,12 +186,6 @@
- Default: ""
- Usage: Update URL of thumbnail
------------
## allowUpdate
- Type: Boolean
- Default: false
- Usage: Whether to allow background updates after editing
------------
## functionButton
- Type: String

217
docs/guide/data.md

@ -15,19 +15,22 @@
{
"name": "Cell", //Worksheet name
"color": "", //Worksheet color
"config": {}, //Table row height, column width, merged cells, borders, hidden rows and other settings
"index": "0", //Worksheet index
"chart": [], //Chart configuration
"status": "1", //Activation status
"order": "0", //The order of the worksheet
"hide": 0,//whether to hide
"column": 18, //Number of columns
"row": 36, //number of rows
"celldata": [], //Original cell data set
"visibledatarow": [], //The position of all rows
"visibledatacolumn": [], //The position of all columns
"ch_width": 2322, //The width of the worksheet area
"rh_height": 949, //The height of the worksheet area
"column": 18, //Number of columns
"config": {
"merge":{}, //merged cells
"rowlen":{}, //Table row height
"columnlen":{}, //Table column width
"rowhidden":{}, //hidden rows
"columnhidden":{}, //hidden columns
"borderInfo":{}, //borders
},
"celldata": [], //initialize the cell data used
"data": [], //Update and store the cell data used
"scrollLeft": 0, //Left and right scroll bar position
"scrollTop": 315, //Up and down scroll bar position
"luckysheet_select_save": [], //selected area
@ -38,7 +41,12 @@
"filter_select": null,//Filter range
"filter": null,//Filter configuration
"luckysheet_alternateformat_save": [], //Alternate colors
"luckysheet_alternateformat_save_modelCustom": []//Customize alternate colors
"luckysheet_alternateformat_save_modelCustom": [], //Customize alternate colors
"chart": [], //Chart configuration
"visibledatarow": [], //The position of all rows
"visibledatacolumn": [], //The position of all columns
"ch_width": 2322, //The width of the worksheet area
"rh_height": 949, //The height of the worksheet area
},
{
"name": "Sheet2",
@ -62,7 +70,6 @@
```
- **Explanation**
------------
## name
- Type:String
- Default:"Sheet1"
@ -90,7 +97,7 @@
## order
- Type:Number
- Default:0
- Usage: The order of the worksheets, it will increase when a worksheet is added, starting from 0
- Usage: The index of the worksheets, it will increase when a worksheet is added, starting from 0
------------
## hide
@ -98,12 +105,6 @@
- Default:0
- Usage: Whether to hide, `0` means not to hide, `1` means to hide
------------
## column
- Type:Number
- Default:18
- Usage: Number of cell columns
------------
## row
- Type:Number
@ -111,28 +112,10 @@
- Usage: Number of cell rows
------------
## visibledatarow
- Type:Number
- Default:[]
- Usage: Position information of all rows, incremental row position data
------------
## visibledatacolumn
- Type:Number
- Default:[]
- Usage: Position information of all columns, incremental column position data
------------
## ch_width
- Type:Number
- Default:2322
- Usage:The width of the entire worksheet area (the gray area including the border)
------------
## rh_height
## column
- Type:Number
- Default:2322
- Usage:The height of the entire worksheet area (the gray area containing the border)
- Default:18
- Usage: Number of cell columns
------------
## scrollLeft
@ -155,61 +138,93 @@
### config.merge
- Type:Object
- Default:{}
- Usage:Merge cell settings, example:
```js
{
"13_5": {
"r": 13,
"c": 5,
"rs": 3,
"cs": 1
},
"13_7": {
"r": 13,
"c": 7,
"rs": 3,
"cs": 2
},
"14_2": {
"r": 14,
"c": 2,
"rs": 1,
"cs": 2
- Usage:Merge cell settings
- example:
```js
{
"13_5": {
"r": 13,
"c": 5,
"rs": 3,
"cs": 1
},
"13_7": {
"r": 13,
"c": 7,
"rs": 3,
"cs": 2
},
"14_2": {
"r": 14,
"c": 2,
"rs": 1,
"cs": 2
}
}
}
```
```
The `key` in the object is the spliced value of `r +'_' + c`, and the `value` is the cell information in the upper left corner: r: number of rows, c: number of columns, rs: number of merged rows, cs: merge Number of columns
### config.rowlen
- Type:Object
- Default:{}
- Usage:The row height of each cell, example:
```js
"rowlen": {
"0": 20,
"1": 20,
"2": 20
}
```
- Usage:The row height of each cell
- example:
```js
"rowlen": {
"0": 20,
"1": 20,
"2": 20
}
```
### config.columnlen
- Type:Object
- Default:{}
- Usage:The column width of each cell, example:
```js
"columnlen": {
"0": 97,
"1": 115,
"2": 128
}
```
- Usage:The column width of each cell
- example:
```js
"columnlen": {
"0": 97,
"1": 115,
"2": 128
}
```
### config.rowhidden
- Type:Object
- Default:{}
- Usage:Hidden row information, Rows:`rowhidden[Rows]: 0`,
`key` specify the number of rows,`value` is always `0`
- example:
```js
"rowhidden": {
"30": 0,
"31": 0
}
```
### config.columnhidden
- Type:Object
- Default:{}
- Usage:Hidden column information, Columns:`columnhidden[Columns]: 0`,
`key` specify the number of columns,`value` is always `0`
- example:
```js
"columnhidden": {
"30": 0,
"31": 0
}
```
### config.borderInfo
- Type:Object
- Default:{}
- Usage:The border information of the cell, example:
```js
"borderInfo": [{
- Usage:The border information of the cell
- example:
```js
"borderInfo": [{
"rangeType": "cell",
"value": {
"row_index": 3,
@ -251,7 +266,7 @@
"column": [8, 9]
}]
}]
```
```
There are two types of range: single cell and selection
1. selection `rangeType: "range"`
@ -308,18 +323,6 @@
```
Means to set the cell `"D4"`, the upper border/lower border/left border/right border are all border thicknesses `"MediumDashDot"`, color is `"rgb(255, 0, 0)"`
### config.rowhidden
- Type:Object
- Default:{}
- Usage:Hidden row information, example:
```js
"rowhidden": {
"30": 0,
"31": 0
}
```
- Rows:`rowhidden[Rows]: 0`,`key`Specify the number of rows,`value` is always `0`
------------
## celldata
- Type:Array
@ -735,6 +738,30 @@
- Usage: Chart configuration (under development)
------------
## visibledatarow
- Type:Number
- Default:[]
- Usage: Position information of all rows, incremental row position data, No need to set up for initialization
------------
## visibledatacolumn
- Type:Number
- Default:[]
- Usage: Position information of all columns, incremental column position data, No need to set up for initialization
------------
## ch_width
- Type:Number
- Default:2322
- Usage:The width of the entire worksheet area (the gray area including the border), No need to set up for initialization
------------
## rh_height
- Type:Number
- Default:2322
- Usage:The height of the entire worksheet area (the gray area containing the border), No need to set up for initialization
------------
## Get sheet data
@ -757,12 +784,6 @@
The data will only be loaded once, generally speaking, there is only one primary key, but considering that some formulas, charts and pivot tables will refer to the data of other sheets, the front desk will add a judgment, if the current sheet refers to the data of other sheets, then complete the data of the referenced sheet together.
## Get range data
- **Configuration**
Configure the address of `loadCellUrl`, the parameters are `gridKey` (table primary key), `index` (sheet primary key), start row, end row, start column, end column. The backend gets the specified celldata data according to the range and returns it.
## Update data
- **Configuration**

4
docs/guide/format.md

@ -28,7 +28,7 @@
<td>ff</td>
<td>fontfamily</td>
<td>Font</td>
<td>0 Microsoft Yahei, 1 Song, 2 ST Heiti, 3 ST Kaiti, 4 ST FangSong, 5 ST Song, 6 Chinese New Wei, 7 Chinese Xingkai, 8 Chinese Lishu, 9 Arial, 10 Times New Roman, 11 Tahoma, 12 Verdana</td>
<td>0 Times New Roman, 1 Arial, 2 Tahoma, 3 Verdana, 4 Microsoft Yahei, 5 Song, 6 ST Heiti, 7 ST Kaiti, 8 ST FangSong, 9 ST Song, 10 Chinese New Wei, 11 Chinese Xingkai, 12 Chinese Lishu</td>
<td>Style.Font object's Name property.</td>
</tr>
<tr>
@ -183,7 +183,7 @@ The format is set to:
The available settings are as follows:
| Format | ct.fa | ct.t | Example of m value | Remarks |
|----------|----------|-------------------------|------------------------- |------------------------- |
| Automatic | General | g | Luckysheet ||
| Automatic | General | g | Luckysheet |Automatic format, which is also the default format; When the cell content is a number, the value of `m` is `'n'`|
| Plain text | @ | s | Luckysheet ||
| <br><br><br>**Number Format** | | | | |
| Integer | 0 | n | 1235 | 0 decimal places |

13
docs/zh/guide/FAQ.md

@ -17,8 +17,21 @@ luckysheet.buildGridData(luckysheetfile)
```
------------
## 单元格的类型有哪些?
**<span style="font-size:20px;">A</span>** : 参考[单元格格式列表](https://mengshukeji.github.io/LuckysheetDocs/zh/guide/format.html#%E5%8D%95%E5%85%83%E6%A0%BC%E6%A0%BC%E5%BC%8F),例举了可用的单元格格式
------------
## 如何在vue项目中使用Luckysheet?
**<span style="font-size:20px;">A</span>** : 参考 [Luckysheet-vue-demo](https://github.com/Dushusir/vue-demo)
------------
## 为什么初始化后表格里面的公式不会被触发?
**<span style="font-size:20px;">A</span>** : 参考 [表格数据格式](https://mengshukeji.github.io/LuckysheetDocs/zh/guide/data.html#calcchain) ,设置单元格数据对应的calcChain即可。
------------

5
docs/zh/guide/README.md

@ -215,3 +215,8 @@ luckysheetfile[0] =
| ENTER | 编辑单元格 |
| TAB | 向右移动单元格选框 |
| DELETE | 清除单元格数据 |
## 警告
::: danger
新的API正在整理,可能随时变动,请谨慎使用!
:::

6
docs/zh/guide/feature.md → docs/zh/guide/api.md

@ -1,4 +1,8 @@
# 高级功能
# API
::: danger
新的API正在整理,请谨慎使用!
:::
## luckysheet.create(options)
- **参数**

14
docs/zh/guide/config.md

@ -156,6 +156,12 @@
- 默认值:""
- 作用:表格唯一标识符
------------
## allowUpdate
- 类型:Boolean
- 默认值:false
- 作用:是否允许操作表格后的后台更新,与`updateUrl`配合使用
------------
## loadUrl
- 类型:String
@ -172,7 +178,7 @@
## updateUrl
- 类型:String
- 默认值:""
- 作用:表格数据的更新地址
- 作用:操作表格后的后台更新地址,在`allowUpdate`为`true`时才会有效
------------
## updateImageUrl
@ -180,12 +186,6 @@
- 默认值:""
- 作用:缩略图的更新地址
------------
## allowUpdate
- 类型:Boolean
- 默认值:false
- 作用:是否允许编辑后的后台更新
------------
## functionButton
- 类型:String

258
docs/zh/guide/data.md

@ -15,19 +15,22 @@
{
"name": "Cell", //工作表名称
"color": "", //工作表颜色
"config": {}, //表格行高、列宽、合并单元格、边框、隐藏行等设置
"index": "0", //工作表索引
"chart": [], //图表配置
"status": "1", //激活状态
"order": "0", //工作表的顺序
"hide": 0,//是否隐藏
"column": 18, //列数
"row": 36, //行数
"celldata": [], //原始单元格数据集
"visibledatarow": [], //所有行的位置
"visibledatacolumn": [], //所有列的位置
"ch_width": 2322, //工作表区域的宽度
"rh_height": 949, //工作表区域的高度
"column": 18, //列数
"config": {
"merge":{}, //合并单元格
"rowlen":{}, //表格行高
"columnlen":{}, //表格列宽
"rowhidden":{}, //隐藏行
"columnhidden":{}, //隐藏列
"borderInfo":{}, //边框
},
"celldata": [], //初始化使用的单元格数据
"data": [], //更新和存储使用的单元格数据
"scrollLeft": 0, //左右滚动条位置
"scrollTop": 315, //上下滚动条位置
"luckysheet_select_save": [], //选中的区域
@ -38,7 +41,12 @@
"filter_select": null,//筛选范围
"filter": null,//筛选配置
"luckysheet_alternateformat_save": [], //交替颜色
"luckysheet_alternateformat_save_modelCustom": []//自定义交替颜色
"luckysheet_alternateformat_save_modelCustom": [], //自定义交替颜色
"chart": [], //图表配置
"visibledatarow": [], //所有行的位置
"visibledatacolumn": [], //所有列的位置
"ch_width": 2322, //工作表区域的宽度
"rh_height": 949, //工作表区域的高度
},
{
"name": "Sheet2",
@ -62,7 +70,6 @@
```
- **说明**
------------
## name
- 类型:String
- 默认值:"Sheet1"
@ -90,7 +97,7 @@
## order
- 类型:Number
- 默认值:0
- 作用: 工作表的顺序,新增工作表时会递增,从0开始
- 作用: 工作表的索引,新增工作表时会递增,从0开始
------------
## hide
@ -98,12 +105,6 @@
- 默认值:0
- 作用: 是否隐藏,`0`为不隐藏,`1`为隐藏
------------
## column
- 类型:Number
- 默认值:18
- 作用: 单元格列数
------------
## row
- 类型:Number
@ -111,28 +112,10 @@
- 作用: 单元格行数
------------
## visibledatarow
- 类型:Number
- 默认值:[]
- 作用: 所有行的位置信息,递增的行位置数据
------------
## visibledatacolumn
- 类型:Number
- 默认值:[]
- 作用: 所有列的位置信息,递增的列位置数据
------------
## ch_width
- 类型:Number
- 默认值:2322
- 作用: 整个工作表区域的宽度(包含边界的灰色区域)
------------
## rh_height
## column
- 类型:Number
- 默认值:2322
- 作用: 整个工作表区域的高度(包含边界的灰色区域)
- 默认值:18
- 作用: 单元格列数
------------
## scrollLeft
@ -155,61 +138,93 @@
### config.merge
- 类型:Object
- 默认值:{}
- 作用:合并单元格设置,示例:
```js
{
"13_5": {
"r": 13,
"c": 5,
"rs": 3,
"cs": 1
},
"13_7": {
"r": 13,
"c": 7,
"rs": 3,
"cs": 2
},
"14_2": {
"r": 14,
"c": 2,
"rs": 1,
"cs": 2
- 作用:合并单元格设置
- 示例:
```js
{
"13_5": {
"r": 13,
"c": 5,
"rs": 3,
"cs": 1
},
"13_7": {
"r": 13,
"c": 7,
"rs": 3,
"cs": 2
},
"14_2": {
"r": 14,
"c": 2,
"rs": 1,
"cs": 2
}
}
}
```
```
对象中的`key`为`r + '_' + c`的拼接值,`value`为左上角单元格信息: r:行数,c:列数,rs:合并的行数,cs:合并的列数
### config.rowlen
- 类型:Object
- 默认值:{}
- 作用:每个单元格的行高,示例:
```js
"rowlen": {
"0": 20,
"1": 20,
"2": 20
}
```
- 作用:每个单元格的行高
- 示例:
```js
"rowlen": {
"0": 20,
"1": 20,
"2": 20
}
```
### config.columnlen
- 类型:Object
- 默认值:{}
- 作用:每个单元格的列宽,示例:
```js
"columnlen": {
"0": 97,
"1": 115,
"2": 128
}
```
- 作用:每个单元格的列宽
- 示例:
```js
"columnlen": {
"0": 97,
"1": 115,
"2": 128
}
```
### config.rowhidden
- 类型:Object
- 默认值:{}
- 作用:隐藏行信息,格式为:`rowhidden[行数]: 0`,
`key`指定行数即可,`value`总是为`0`
- 示例:
```js
"rowhidden": {
"30": 0,
"31": 0
}
```
### config.columnhidden
- 类型:Object
- 默认值:{}
- 作用:隐藏列
格式为:`columnhidden[列数]: 0`,
`key`指定列数即可,`value`总是为`0`
- 示例:
```js
"columnhidden": {
"30": 0,
"31": 0
}
```
### config.borderInfo
- 类型:Object
- 默认值:{}
- 作用:单元格的边框信息,示例:
```js
"borderInfo": [{
```js
"borderInfo": [{
"rangeType": "cell",
"value": {
"row_index": 3,
@ -251,7 +266,7 @@
"column": [8, 9]
}]
}]
```
```
范围类型分单个单元格和选区两种情况
1. 选区 `rangeType: "range"`
@ -308,42 +323,31 @@
```
表示设置单元格`"D4"`,上边框/下边框/左边框/右边框都是边框粗细为`"MediumDashDot"`,颜色为`"rgb(255, 0, 0)"`
### config.rowhidden
- 类型:Object
- 默认值:{}
- 作用:隐藏行信息,示例:
```js
"rowhidden": {
"30": 0,
"31": 0
}
```
- 行数:`rowhidden[行数]: 0`,`key`指定行数即可,`value`总是为`0`
------------
## celldata
- 类型:Array
- 默认值:[]
- 作用: 原始单元格数据集,是一个包含`{r:0,c:0,v:{m:"value",v:"value",ct: {fa: "General", t: "g"}}}`格式单元格信息的一维数组,只在初始化的时候使用,使用celldata初始化完表格后,数据转换为luckysheetfile中的同级字段data,如`luckysheetfile[0].data`,后续操作表格的数据更新,会更新到这个data字段中,celldata不再使用。示例:
```js
[{
"r": 0,
"c": 0,
"v": {
ct: {fa: "General", t: "g"},
m:"value1",
v:"value1"
}
}, {
"r": 0,
"c": 1,
"v": {
ct: {fa: "General", t: "g"},
m:"value2",
v:"value2"
}
}]
```
- 作用: 原始单元格数据集,是一个包含`{r:0,c:0,v:{m:"value",v:"value",ct: {fa: "General", t: "g"}}}`格式单元格信息的一维数组,只在初始化的时候使用,使用celldata初始化完表格后,数据转换为luckysheetfile中的同级字段data,如`luckysheetfile[0].data`,后续操作表格的数据更新,会更新到这个data字段中,celldata不再使用。
- 示例:
```js
[{
"r": 0,
"c": 0,
"v": {
ct: {fa: "General", t: "g"},
m:"value1",
v:"value1"
}
}, {
"r": 0,
"c": 1,
"v": {
ct: {fa: "General", t: "g"},
m:"value2",
v:"value2"
}
}]
```
------------
## luckysheet_select_save
@ -735,6 +739,30 @@
- 作用: 图表配置(开发中)
------------
## visibledatarow
- 类型:Number
- 默认值:[]
- 作用: 所有行的位置信息,递增的行位置数据,初始化无需设置
------------
## visibledatacolumn
- 类型:Number
- 默认值:[]
- 作用: 所有列的位置信息,递增的列位置数据,初始化无需设置
------------
## ch_width
- 类型:Number
- 默认值:2322
- 作用: 整个工作表区域的宽度(包含边界的灰色区域),初始化无需设置
------------
## rh_height
- 类型:Number
- 默认值:2322
- 作用: 整个工作表区域的高度(包含边界的灰色区域),初始化无需设置
------------
## 获取sheet数据
@ -756,12 +784,6 @@
r代表行,c代表列,v代表该单元格的值,值可以是字符、数字或者json串。
数据只会载入一次,一般来说都只有一个主键,但是考虑到一些公式、图表及数据透视表会引用其他sheet的数据,所以前台会加一个判断,如果该当前sheet引用了其他sheet的数据则把引用到的sheet的数据一并补全。
## 获取range范围数据
- **配置**
配置 `loadCellUrl` 的地址,参数为`gridKey`(表格主键) 、 `index`(sheet主键)、开始行、结束行、开始列、结束列。后台根据范围获取指定的`celldata`数据并返回。
## 更新数据
- **配置**

357
docs/zh/guide/format.md

@ -1,4 +1,337 @@
# 格式属性
# 单元格格式
## 单元格介绍
### 基本单元格格式
单元格是Luckysheet中最基本的单位,每个单元格都会保存为一个对象,一个工作表的数据则会保存为一个由单元格对象组成的二维数组,并存入当前工作表的 `luckysheetfile[i].data`中。
一个规范的单元格格式如下:
```json
{
"ct": { //单元格值格式
"fa": "General", //格式名称为自动格式
"t": "n" //格式类型为数字类型
},
"v": 233, //内容的原始值为 233
"m": 233, //内容的显示值为 233
"bg": "#f6b26b", //背景为 "#f6b26b"
"ff": 1, // 字体为 "Arial"
"fc": "#990000", //字体颜色为 "#990000"
"bl": 1, //字体加粗
"it": 1, //字体斜体
"fs": 9, //字体大小为 9px
"cl": 1, //启用删除线
"ht": 0, //水平居中
"vt": 0, //垂直居中
"tr": 2, //文字旋转 -45°
"tb": 2, //文本自动换行
"ps": { //批注
"left": 92, //批注框左边距
"top": 10, //批注框上边距
"width": 91, //批注框宽度
"height": 48, //批注框高度
"value": "I am a comment", //批准内容
"isshow": true //批注框为显示状态
},
"f": "=SUM(233)" //公式
}
```
### 合并单元格配置
TODO
### 一个常规的表格数据
下面展示了稍微复杂点的,但是很常用的表格数据
::: details 点击查看代码
```js
[
[
{
"v": "地区",
"ct": {
"fa": "General",
"t": "g"
},
"m": "地区",
"bl": 1,
"bg": "#f6b26b",
"mc": {
"r": 0,
"c": 0,
"rs": 2,
"cs": 1
},
"ht": "0",
"vt": "0"
},
{
"v": "销售额",
"ct": {
"fa": "General",
"t": "g"
},
"m": "销售额",
"bl": 1,
"bg": "#f6b26b",
"mc": {
"r": 0,
"c": 1,
"rs": 1,
"cs": 2
},
"ht": "0"
},
{
"mc": {
"r": 0,
"c": 1
},
"ht": "0"
},
{
"v": "日期",
"ct": {
"fa": "General",
"t": "g"
},
"m": "日期",
"bl": 1,
"bg": "#f6b26b",
"mc": {
"r": 0,
"c": 3,
"rs": 2,
"cs": 1
},
"vt": "0",
"ht": "0"
},
{
"ct": {
"fa": "General",
"t": "g"
},
"m": "备注",
"v": "备注",
"bg": "#ffd966",
"cl": 1,
"mc": {
"r": 0,
"c": 4,
"rs": 2,
"cs": 1
},
"ht": "0",
"vt": "0"
}
],
[
{
"mc": {
"r": 0,
"c": 0
},
"ht": "0",
"vt": "0"
},
{
"m": "1月",
"ct": {
"fa": "General",
"t": "g"
},
"v": "1月",
"ht": "0"
},
{
"m": "2月",
"ct": {
"fa": "General",
"t": "g"
},
"v": "2月",
"ht": "0"
},
{
"mc": {
"r": 0,
"c": 3
},
"vt": "0",
"ht": "0"
},
{
"mc": {
"r": 0,
"c": 4
},
"ht": "0",
"vt": "0"
}
],
[
{
"v": "四川",
"ct": {
"fa": "General",
"t": "g"
},
"m": "四川"
},
{
"v": 234,
"ct": {
"fa": "General",
"t": "n"
},
"m": "234",
"it": 1,
"fc": "#660000",
"vt": "0"
},
{
"v": 234,
"ct": {
"fa": "General",
"t": "n"
},
"m": "234",
"it": 1,
"fc": "#660000",
"vt": "0"
},
{
"v": 44056,
"ct": {
"fa": "yyyy-MM-dd",
"t": "d"
},
"m": "2020-08-13",
"ht": "0"
},
{
"ct": {
"fa": "General",
"t": "g"
},
"m": "无",
"v": "无",
"ht": "1",
"tb": "0",
"tr": "0"
}
],
[
{
"v": "山东",
"ct": {
"fa": "General",
"t": "g"
},
"m": "山东"
},
{
"v": 345,
"ct": {
"fa": "General",
"t": "n"
},
"m": "345",
"it": 1,
"fc": "#660000",
"vt": "0"
},
{
"v": 345,
"ct": {
"fa": "General",
"t": "n"
},
"m": "345",
"it": 1,
"fc": "#660000",
"vt": "0"
},
{
"v": 44056,
"ct": {
"fa": "yyyy-MM-dd",
"t": "d"
},
"m": "2020-08-13",
"ht": "0"
},
{
"ct": {
"fa": "General",
"t": "g"
},
"m": "无",
"v": "无",
"ht": "1",
"tb": "0",
"tr": "0"
}
],
[
{
"v": "江苏",
"ct": {
"fa": "General",
"t": "g"
},
"m": "江苏"
},
{
"v": 543,
"ct": {
"fa": "General",
"t": "n"
},
"m": "543",
"it": 1,
"fc": "#660000",
"vt": "0"
},
{
"v": 543,
"ct": {
"fa": "General",
"t": "n"
},
"m": "543",
"it": 1,
"fc": "#660000",
"vt": "0"
},
{
"v": 44056,
"ct": {
"fa": "yyyy-MM-dd",
"t": "d"
},
"m": "2020-08-13",
"ht": "0"
},
{
"ct": {
"fa": "General",
"t": "g"
},
"m": "无",
"v": "无",
"ht": "1",
"tb": "0",
"tr": "0"
}
]
]
```
:::
## 单元格属性表
@ -28,7 +361,7 @@
<td>ff</td>
<td>fontfamily</td>
<td>字体</td>
<td>0 微软雅黑、1 宋体(Song)、2 黑体(ST Heiti)、3 楷体(ST Kaiti)、 4仿宋(ST FangSong)、 5 新宋体(ST Song)、 6 华文新魏、 7华文行楷、 8 华文隶书、 9 Arial、 10 Times New Roman 、11 Tahoma 、12 Verdana</td>
<td>0 Times New Roman、 1 Arial、2 Tahoma 、3 Verdana、4 微软雅黑、5 宋体(Song)、6 黑体(ST Heiti)、7 楷体(ST Kaiti)、 8 仿宋(ST FangSong)、9 新宋体(ST Song)、10 华文新魏、11 华文行楷、12 华文隶书</td>
<td>Style.Font object's Name property.</td>
</tr>
<tr>
@ -122,6 +455,24 @@
<td></td>
<td>setFormula <br> setArrayFormula <br> workbook.calculateFormula();</td>
</tr>
<tr>
<td>ps</td>
<td>comment</td>
<td>批注</td>
<td>
<code>
{<br>
height: 140,//批注框高度 <br>
width: 73,//批注框宽度 <br>
left: 75,//批注框距离左边工作表边缘位置 <br>
top: 22,//批注框距离上边工作表边缘位置 <br>
isshow: true,//是否显示批注<br>
value: "jhbk"//批注内容<br>
}
</code>
</td>
<td></td>
</tr>
</table>
@ -183,7 +534,7 @@
可选择的设置如下:
| 格式 | ct.fa | ct.t | m 值示例 |备注 |
|----------|----------|-------------------------|------------------------- |------------------------- |
| 自动 | General | g | Luckysheet ||
| 自动 | General | g/n | Luckysheet |自动格式,也是默认的格式;单元格内容为数字时,`m`的值为`'n'`|
| 纯文本 | @ | s | Luckysheet ||
| <br><br><br>**数字格式** | | | | |
| 整数 | 0 | n | 1235 | 0位小数 ||

12
docs/zh/guide/operate.md

@ -1,5 +1,13 @@
# 表格操作
每一次操作都会保存历史记录,用于撤销和重做,如果在表格初始化的时候设置了`allowUpdate`为`true`和`updateUrl`数据更新地址,则会通过websocket将操作实时更新到后台,并且支持共享编辑。
> 源码 [`src/controllers/server.js`](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/server.js) 模块实现了后台保存功能
通常,共享编辑(或者叫协同编辑)是需要和账户系统配合来控制权限的,开发者可以根据已有功能,配合自己的账户管理功能自行实现权限控制。
以下为所有的支持传输到后台的操作类型。
## 单元格刷新
- **格式**
@ -19,8 +27,8 @@
|参数|说明|
| ------------ | ------------ |
|t|操作类型表示符号|
|i|当前sheet的index值|
|v|单元格的值|
|i|当前sheet的索引值|
|v|单元格的值,参考 [单元格属性表](https://mengshukeji.github.io/LuckysheetDocs/zh/guide/format.html#%E5%8D%95%E5%85%83%E6%A0%BC%E5%B1%9E%E6%80%A7%E8%A1%A8)|
|r|单元格的行号|
|c|单元格的列号|

1
src/controllers/menuButton.js

@ -32,7 +32,6 @@ import { setluckysheetfile } from '../methods/set';
import { replaceHtml, getObjType, rgbTohex, mouseclickposition, luckysheetfontformat,luckysheetContainerFocus } from '../utils/util';
import Store from '../store';
import locale from '../locale/locale';
import { connect } from 'tls';
const menuButton = {
"menu": '<div class="luckysheet-cols-menu luckysheet-rightgclick-menu luckysheet-menuButton ${subclass} luckysheet-mousedown-cancel" id="luckysheet-icon-${id}-menuButton">${item}</div>',

6
src/demoData/sheetCell.js

@ -5563,8 +5563,6 @@ const sheetCell = {
"v": "hidden2"
}
}],
"visibledatarow": [21, 42, 63, 84, 105, 126, 147, 168, 189, 210, 231, 252, 273, 294, 315, 336, 357, 389, 410, 431, 452, 473, 494, 515, 536, 616, 637, 658, 739, 759, 759, 759, 779, 799, 819, 839],
"visibledatacolumn": [98, 172, 288, 417, 554, 677, 816, 948, 1077, 1218, 1363, 1437, 1511, 1585, 1659, 1733, 1807, 1881, 1955, 2029, 2103, 2177],
"ch_width": 2322,
"rh_height": 949,
"luckysheet_select_save": [{
@ -5582,7 +5580,7 @@ const sheetCell = {
"column_focus": 0
}],
"luckysheet_selection_range": [],
"scrollLeft": 0,
"scrollTop": 315
"scrollLeft": 300,
"scrollTop": 515
}
export default sheetCell

2
src/demoData/sheetChart.js

@ -1243,8 +1243,6 @@ const sheetChart = {
},
"pivotTable": null,
"isPivotTable": false,
"visibledatarow": [21, 42, 63, 84, 105, 125, 145, 165, 185, 205, 225, 245, 265, 285, 305, 325, 345, 365, 385, 405, 425, 445, 466, 487, 508, 529, 550, 571, 592, 613, 634, 655, 676, 697, 717, 737, 757, 777, 797, 817, 837, 857, 877, 897, 917, 937, 957, 977, 997, 1017, 1037, 1057, 1077, 1097, 1117, 1137, 1157, 1177, 1197, 1217, 1237, 1257, 1277, 1297, 1317, 1337, 1357, 1377, 1397, 1417, 1437, 1457, 1477, 1497, 1517, 1537, 1557, 1577, 1597, 1617, 1637, 1657, 1677, 1697],
"visibledatacolumn": [74, 148, 222, 296, 370, 444, 518, 592, 666, 740, 814, 888, 962, 1036, 1110, 1184, 1258, 1332, 1406, 1480, 1554, 1628, 1702, 1776, 1850, 1924, 1998, 2072, 2146, 2220, 2294, 2368, 2442, 2516, 2590, 2664, 2738, 2812, 2886, 2960, 3034, 3108, 3182, 3256, 3330, 3404, 3478, 3552, 3626, 3700, 3774, 3848, 3922, 3996, 4070, 4144, 4218, 4292, 4366, 4440],
"ch_width": 4560,
"rh_height": 1807,
"luckysheet_select_save": [{

2
src/demoData/sheetComment.js

@ -53,8 +53,6 @@ const sheetComment = {
}
}
}],
"visibledatarow": [],
"visibledatacolumn": [],
"ch_width": 4748,
"rh_height": 1790,
"luckysheet_select_save": [{

2
src/demoData/sheetConditionFormat.js

@ -6099,8 +6099,6 @@ const sheetConditionFormat = {
"vt": "0"
}
}],
"visibledatarow": [],
"visibledatacolumn": [],
"ch_width": 4748,
"rh_height": 1790,
"luckysheet_select_save": [{

2
src/demoData/sheetFormula.js

@ -6576,8 +6576,6 @@ const sheetFormula = {
"chidren": {},
"times": 0
}],
"visibledatarow": [20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320, 340, 360, 380, 400, 420, 440, 460, 480, 500, 520, 540, 560, 580, 600, 620, 640, 660, 680, 700, 720, 740, 760, 780, 800, 820, 840, 860, 880, 900],
"visibledatacolumn": [112, 186, 292, 375, 447, 532, 656, 705, 898, 955, 1012, 1086, 1160, 1234, 1308, 1382, 1456, 1530],
"ch_width": 1723,
"rh_height": 1010,
"luckysheet_select_save": [{

2
src/demoData/sheetPivotTable.js

@ -129,8 +129,6 @@ const sheetPivotTable = {
"c": 5,
"v": 12
}],
"visibledatarow": [],
"visibledatacolumn": [],
"ch_width": 4748,
"rh_height": 1790,
"luckysheet_select_save": [{

2
src/demoData/sheetPivotTableData.js

@ -727,8 +727,6 @@ const sheetPivotTableData = {
"m": "278"
}
}],
"visibledatarow": [],
"visibledatacolumn": [],
"ch_width": 4748,
"rh_height": 1790,
"luckysheet_select_save": [{

2
src/demoData/sheetSparkline.js

@ -6147,8 +6147,6 @@ const sheetSparkline = {
"vt": 1
}
}],
"visibledatarow": [30, 51, 72, 93, 114, 134, 164, 185, 206, 227, 248, 268, 298, 328, 349, 370, 397, 418, 439, 469, 499, 520, 541, 562, 583, 604, 624, 725, 746, 767, 788, 809, 830, 851, 878, 899, 920, 941, 962, 983, 1004, 1025, 1046, 1067, 1088, 1109, 1130, 1151, 1172, 1193, 1214, 1235, 1256, 1277, 1298, 1319, 1340, 1361, 1381, 1401, 1421, 1441, 1461],
"visibledatacolumn": [102, 176, 308, 339, 430, 504, 578, 652, 726, 800, 874, 948, 1022, 1096, 1170, 1244, 1318, 1392],
"ch_width": 1524,
"rh_height": 1571,
"luckysheet_select_save": [{

2
src/demoData/sheetTable.js

@ -871,8 +871,6 @@ const sheetTable = {
"m": "58"
}
}],
"visibledatarow": [],
"visibledatacolumn": [],
"ch_width": 4748,
"rh_height": 1790,
"luckysheet_select_save": [{

2
src/locale/en.js

@ -350,7 +350,7 @@ export default {
MicrosoftYaHei:"YaHei",
},
fontarray: ["Times New Roman","Arial","Tahoma","Verdana"],
fontjson: {"arial":1,"times new roman":0,"tahoma":2,"verdana":3},
fontjson: {"times new roman":0,"arial":1,"tahoma":2,"verdana":3},
border:{
borderTop:'borderTop',
borderBottom:'borderBottom',

4
src/locale/zh.js

@ -366,8 +366,8 @@ export default {
fontFamily:{
MicrosoftYaHei:"Microsoft YaHei",
},
fontarray: ["微软雅黑","宋体","黑体","楷体","仿宋","新宋体","华文新魏","华文行楷","华文隶书","Arial","Times New Roman","Tahoma","Verdana"],
fontjson: {"微软雅黑":0,"microsoft yahei":0,"宋体":1,"simsun":1,"黑":2,"simhei":2,"楷体":3,"kaiti":3,"仿宋":4,"fangsong":4,"新宋体":5,"nsimsun":5,"华文新魏":6,"stxinwei":6,"华文行楷":7,"stxingkai":7,"华文隶书":8,"stliti":8,"arial":9,"times new roman":10,"tahoma":11,"verdana":12},
fontarray: ["Times New Roman","Arial","Tahoma","Verdana","微软雅黑","宋体","黑体","楷体","仿宋","新宋体","华文新魏","华文行楷","华文隶书"],
fontjson: {"times new roman":0,"arial":1,"tahoma":2,"verdana":3,"微软雅黑":4,"microsoft yahei":4,"宋体":5,"simsun":5,"黑体":6,"simhei":6,"楷体":7,"kaiti":7,"仿宋":8,"fangsong":8,"新宋体":9,"nsimsun":9,"华文新魏":10,"stxinwei":10,"华文行楷":11,"stxingkai":11,"华文隶书":12,"stliti":12,},
border:{
borderTop:'上框线',
borderBottom:'下框线',

Loading…
Cancel
Save