diff --git a/README-zh.md b/README-zh.md
index aa69400..8e7ce1c 100644
--- a/README-zh.md
+++ b/README-zh.md
@@ -1,4 +1,9 @@
-# Luckysheet
+
+
+
+
+
+
简体中文 | [English](./README.md)
## 介绍
@@ -9,7 +14,7 @@
[在线文档](https://mengshukeji.github.io/LuckysheetDocs/zh/)
-
+
## 特性
diff --git a/README.md b/README.md
index 818a696..d930a2a 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,12 @@
-# Luckysheet
+
+
+
+
[](https://gitter.im/mengshukeji/Luckysheet?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+
+
+
English| [简体中文](./README-zh.md)
## Introduction
@@ -11,7 +17,7 @@ English| [简体中文](./README-zh.md)
[Online documentation](https://mengshukeji.github.io/LuckysheetDocs/)
-
+
## Features
diff --git a/docs/.vuepress/public/img/LuckysheetDemo.gif b/docs/.vuepress/public/img/LuckysheetDemo.gif
new file mode 100644
index 0000000..d609b82
Binary files /dev/null and b/docs/.vuepress/public/img/LuckysheetDemo.gif differ
diff --git a/docs/.vuepress/public/img/favicon.ico b/docs/.vuepress/public/img/favicon.ico
new file mode 100644
index 0000000..4881785
Binary files /dev/null and b/docs/.vuepress/public/img/favicon.ico differ
diff --git a/docs/.vuepress/public/img/logo.png b/docs/.vuepress/public/img/logo.png
index 4f0a5e9..b01d0e5 100644
Binary files a/docs/.vuepress/public/img/logo.png and b/docs/.vuepress/public/img/logo.png differ
diff --git a/docs/.vuepress/public/img/logo_text.png b/docs/.vuepress/public/img/logo_text.png
new file mode 100644
index 0000000..db6978f
Binary files /dev/null and b/docs/.vuepress/public/img/logo_text.png differ
diff --git a/docs/guide/api.md b/docs/guide/api.md
index 51b8f9d..0048f9d 100644
--- a/docs/guide/api.md
+++ b/docs/guide/api.md
@@ -76,7 +76,7 @@ The new API is being sorted out, please use it with caution!
- {Object | String | Number} [v]:The value to be set; it can be an object, and the object is to conform to the cell object format.
- **Usage**:
- Set the value of a cell. Can be used with `luckysheet.luckysheetrefreshgrid()` to refresh and view cell value changes.
+ Set the value of a cell. Can be used with `luckysheet.jfrefreshgrid()` to refresh and view cell value changes.
```js
luckysheet.setcellvalue(0, 0, luckysheet.flowdata(), 'abc');
luckysheet.jfrefreshgrid();
diff --git a/docs/zh/guide/api.md b/docs/zh/guide/api.md
index fd392c1..a8ecf9d 100644
--- a/docs/zh/guide/api.md
+++ b/docs/zh/guide/api.md
@@ -3,10 +3,9 @@
Luckysheet针对常用的数据操作需求,开放了主要功能的API,开发者可以根据需要进行任意对接开发。
使用注意:
-1. 所有方法均挂载到window.luckysheet对象下面,可以在浏览器控制台打印看到
+1. script全局引入时,所有API均挂载到window.luckysheet对象下面,可以在浏览器控制台打印看到;npm引入时,API也全部挂载在luckysheet对象下
2. `success`回调函数第一个参数为API方法的返回值
3. 需要新的API请到github [Issues](https://github.com/mengshukeji/Luckysheet/issues/new/choose)中提交,根据点赞数决定是否开放新API
-3. ⚠️新的API正在整理,旧API可能随时变动,请谨慎使用并随时关注官网更新!
## 单元格操作
@@ -19,7 +18,6 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
- {PlainObject} [setting]: 可选参数
+ {String} [type]: 单元格的值,可以设置为"v":原始值 或者"m":显示值;默认值为'v',表示获取单元格的实际值
+ {Number} [order]: 工作表索引;默认值为当前工作表索引
- + {Function} [success]: 操作结束的回调函数
- **说明**:
@@ -363,6 +361,33 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
## 选区操作
+### getRange([setting])
+
+- **参数**:
+
+ - {PlainObject} [setting]: 可选参数
+ + {Number} [order]: 工作表索引;默认值为当前工作表索引
+
+- **说明**:
+
+ 返回当前选区对象的数组,可能存在多个选区。每个选区的格式为row/column信息组成的对象`{row:[0,1],column:[0,1]}`
+
+- **示例**:
+
+ - 当前选区为"A1:B2"和"B4:C5",执行
+
+ `luckysheet.getRange()`
+
+ 则返回结果为:
+ ```
+ [
+ { "row": [0,1], "column": [0,1] },
+ { "row": [3,4], "column": [1,2] }
+ ]
+ ```
+
+------------
+
### getRangeValue([setting])
- **参数**:
@@ -370,7 +395,6 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
- {PlainObject} [setting]: 可选参数
+ {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区
+ {Number} [order]: 工作表索引;默认值为当前工作表索引
- + {Function} [success]: 操作结束的回调函数
- **说明**:
@@ -387,7 +411,6 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
- {PlainObject} [setting]: 可选参数
+ {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,允许多个选区组成的数组;默认为当前选区
+ {Number} [order]: 工作表索引;默认值为当前工作表索引
- + {Function} [success]: 操作结束的回调函数
- **说明**:
@@ -410,7 +433,6 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
- {PlainObject} [setting]: 可选参数
+ {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区
+ {Number} [order]: 工作表索引;默认值为当前工作表索引
- + {Function} [success]: 操作结束的回调函数
- **说明**:
@@ -434,7 +456,6 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
+ {Number} [column]: `dimensional`为`custom`的时候设置,多维数组的列数
+ {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区
+ {Number} [order]: 工作表索引;默认值为当前工作表索引
- + {Function} [success]: 操作结束的回调函数
- **说明**:
@@ -458,7 +479,6 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
- {Number} [column]: `type`为`offset`的时候设置,对角偏移的列数
+ {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区
+ {Number} [order]: 工作表索引;默认值为当前工作表索引
- + {Function} [success]: 操作结束的回调函数
- **说明**:
@@ -475,7 +495,6 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
- {PlainObject} [setting]: 可选参数
+ {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区
+ {Number} [order]: 工作表索引;默认值为当前工作表索引
- + {Function} [success]: 操作结束的回调函数
- **说明**:
@@ -483,7 +502,7 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
------------
-### setRangeShow(range [,setting])
+### setRangeShow(range[,setting])
- **参数**:
@@ -1049,12 +1068,7 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
## 工作表操作
-### getAllSheets([setting])
-
-- **参数**:
-
- - {PlainObject} [setting]: 可选参数
- + {Function} [success]: 操作结束的回调函数
+### getAllSheets()
- **说明**:
@@ -1069,7 +1083,7 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
------------
-### getluckysheetfile()
+### getLuckysheetfile()
- **参数**:
@@ -1083,7 +1097,15 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
- **示例**:
- 取得第一个工作表的所有调试信息
- `luckysheet.getluckysheetfile()[0]`
+ `luckysheet.getLuckysheetfile()[0]`
+
+------------
+
+### getSheetData()
+
+- **说明**:
+
+ 快捷获取当前表格的数据,同 `luckysheetfile[i].data`
------------
@@ -1146,29 +1168,43 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
------------
-### setSheetHide(hide [,setting])
+### setSheetHide([setting])
- **参数**:
- - {Boolean} [hide]: 是否隐藏工作表
-
- `hide`可能的值有的:
- + `ture`: 隐藏指定索引的工作表,返回被隐藏的工作表对象
- + `false`: 取消隐藏指定索引的工作表,返回被显示的工作表对象
- {PlainObject} [setting]: 可选参数
+ {Number} [order]: 被隐藏的工作表索引;默认值为当前工作表索引
+ {Function} [success]: 操作结束的回调函数
- **说明**:
- 隐藏或取消隐藏指定索引的工作表,返回被隐藏或取消隐藏的工作表对象
+ 隐藏指定索引的工作表,返回被隐藏的工作表对象
- **示例**:
- 隐藏当前工作表
`luckysheet.setSheetHide(true)`
+ - 隐藏第三个工作表
+ `luckysheet.setSheetHide({order:2})`
+
+------------
+
+### setSheetShow([setting])
+
+- **参数**:
+
+ - {PlainObject} [setting]: 可选参数
+ + {Number} [order]: 被取消隐藏的工作表索引;默认值为当前工作表索引
+ + {Function} [success]: 操作结束的回调函数
+
+- **说明**:
+
+ 取消隐藏指定索引的工作表,返回被取消隐藏的工作表对象
+
+- **示例**:
+
- 取消隐藏第三个工作表
- `luckysheet.setSheetHide(false,{order:2})`
+ `luckysheet.setSheetShow({order:2})`
------------
@@ -1214,6 +1250,7 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
### setSheetColor(color [,setting])
- **参数**:
+
- {String} [color]: 工作表颜色
- {PlainObject} [setting]: 可选参数
+ {Number} [order]: 工作表索引;默认值为当前工作表索引
@@ -1260,6 +1297,33 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
## 工作簿操作
+### create(options [,setting])
+
+- **参数**:
+
+ - {Object} [options]:表格的所有配置信息
+ - {PlainObject} [setting]: 可选参数
+ + {Function} [success]: 表格创建成功后的回调函数
+
+- **说明**:
+
+ 初始化一个luckysheet,可包含多个工作表,参考 [配置列表](/zh/guide/config.html)
+
+------------
+
+### refresh([setting])
+
+- **参数**:
+
+ - {PlainObject} [setting]: 可选参数
+ + {Function} [success]: 表格刷新成功后的回调函数
+
+- **说明**:
+
+ 刷新canvas
+
+------------
+
### getScreenshot([setting])
- **参数**:
@@ -1267,7 +1331,6 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
- {PlainObject} [setting]: 可选参数
+ {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区
+ {Number} [order]: 工作表索引;默认值为当前工作表索引
- + {Function} [success]: 操作结束的回调函数
- **说明**:
@@ -1357,14 +1420,11 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
------------
-### getChart(chartId [,setting])
+### getChart(chartId)
- **参数**:
- {String} [chartId]: 指定要获取的图表id
-
- - {PlainObject} [setting]: 可选参数
- + {Function} [success]: 操作结束的回调函数
- **说明**:
@@ -1387,28 +1447,60 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
------------
-## luckysheet.create(options)
+## 公共方法
+
+
+### transToCellData(data[,setting])
+
- **参数**:
- - {Object} [options]:表格的所有配置信息
+
+ - {Array} [data]: data数据
+
+ - {PlainObject} [setting]: 可选参数
+ + {Function} [success]: 操作结束的回调函数
+
+- **说明**:
+
+ data => celldata ,data二维数组数据转化成 {r, c, v}格式一维数组
+
+------------
+
+### transToData(celldata[,setting])
+
+- **参数**:
+
+ - {Array} [celldata]: data数据
+
+ - {PlainObject} [setting]: 可选参数
+ + {Function} [success]: 操作结束的回调函数
+
- **说明**:
- 初始化一个luckysheet,可包含多个工作表,参考 [配置列表](https://mengshukeji.github.io/LuckysheetDocs/zh/guide/config.html#container)
+ celldata => data ,celldata一维数组数据转化成表格所需二维数组
------------
+## 旧版API
-## luckysheet.getconfig()
+::: warning
+为保持兼容性,仍然支持旧版API,但是已不推荐使用。
+:::
+
+### getconfig()
- **说明**:
快捷返回当前表格config配置,每个工作表的config信息仍然包含在luckysheetfile。
------------
-## luckysheet.getluckysheet_select_save()
+## getluckysheet_select_save()
- **说明**:
返回当前选区对象的数组,可能存在多个选区。
+ > 推荐使用新API: [getRange](#getRange([setting]))
+
------------
-## luckysheet.getdatabyselection([range] [,sheetOrder])
+
+## getdatabyselection([range] [,sheetOrder])
- **参数**:
- {Object} [range]:选区对象,`object: { row: [r1, r2], column: [c1, c2] }`;默认为当前第一个选区。
- {Number} [sheetOrder]:表格下标,从0开始的整数,0表示第一个表格;默认为当前表格下标。
@@ -1418,8 +1510,11 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
- `luckysheet.getdatabyselection()`: 返回当前工作表当前选区的数据
- `luckysheet.getdatabyselection(null,1)`: 返回第2个工作表的当前选区的数据
+ > 推荐使用新API: [getRangeValue](#getRangeValue([setting]))
+
------------
-## luckysheet.luckysheetrefreshgrid(scrollWidth, scrollHeight)
+
+## luckysheetrefreshgrid(scrollWidth, scrollHeight)
- **参数**:
- {Number} [scrollWidth]:横向滚动值。默认为当前横向滚动位置。
- {Number} [scrollHeight]:纵向滚动值。默认为当前纵向滚动位置。
@@ -1429,13 +1524,17 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
------------
-## luckysheet.jfrefreshgrid()
+## jfrefreshgrid()
- **说明**:
刷新canvas
+ > 推荐使用新API: [refresh](#refresh([setting]))
+
+
------------
-## luckysheet.setluckysheet_select_save(v)
+
+## setluckysheet_select_save(v)
- **参数**:
- {Array} [v]:要设置的选区值(数组)。符合选区格式规则,如`[{ row: [r1, r2], column: [c1, c2] }]`。
- **说明**:
@@ -1446,52 +1545,49 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
luckysheet.selectHightlightShow();
```
+ > 推荐使用新API: [setRangeShow](#setRangeShow(range[,setting]))
+
------------
-## luckysheet.selectHightlightShow()
+
+## selectHightlightShow()
- **说明**:
高亮当前选区
-------------
-## luckysheet.setSheetHide(order)
-- **参数**:
- - {Number} [order]:表格索引;从0开始的整数,0表示第一个表格;默认为当前表格索引。
-- **说明**:
-
- 隐藏某个表格。
+ > 推荐使用新API: [setRangeShow](#setRangeShow(range[,setting]))
------------
-## luckysheet.setSheetShow(order)
-- **参数**:
- - {Number} [order]:表格索引;从0开始的整数,0表示第一个表格;默认为当前表格索引。
-- **说明**:
-
- 显示某个表格。
-------------
-## luckysheet.flowdata()
+## flowdata()
- **说明**:
快捷获取当前表格的数据
+ > 推荐使用新API: [getSheetData](#getSheetData())
+
------------
-## luckysheet.buildGridData(file)
+
+## buildGridData(file)
- **参数**:
- {Object} [file]:[luckysheetfile](https://mengshukeji.github.io/LuckysheetDocs/zh/guide/data.html#%E8%8E%B7%E5%8F%96%E8%A1%A8%E6%A0%BC%E6%95%B0%E6%8D%AE)
- **说明**:
生成表格可以识别的二维数组
+ > 推荐使用新API: [transToData](#transToCellData([setting]))
+
------------
-## luckysheet.getGridData(data)
+## getGridData(data)
- **参数**:
- {Array} [data]:工作表的二维数组数据
- **说明**:
二维数组数据转化成 `{r, c, v}` 格式 一维数组
+ > 推荐使用新API: [transToCellData](#transToCellData([setting]))
+
------------
-## luckysheet.destroy()
+## destroy()
- **说明**:
删除并释放表格
\ No newline at end of file
diff --git a/docs/zh/guide/config.md b/docs/zh/guide/config.md
index dded6cd..a20a4ac 100644
--- a/docs/zh/guide/config.md
+++ b/docs/zh/guide/config.md
@@ -88,7 +88,7 @@ luckysheet.create(options)
### loadUrl
- 类型:String
- 默认值:""
-- 作用:配置`loadUrl`的地址,Luckysheet会通过ajax请求整个表格数据,默认载入status为1的sheet数据中的所有`celldata`,其余的sheet载入除`celldata`字段外的所有字段
+- 作用:配置`loadUrl`的地址,Luckysheet会通过ajax请求整个表格数据,默认载入status为1的sheet数据中的所有`celldata`,其余的sheet载入除`celldata`字段外的所有字段。但是考虑到一些公式、图表及数据透视表会引用其他sheet的数据,所以前台会加一个判断,如果该当前sheet引用了其他sheet的数据则把引用到的sheet的数据一并补全。
------------
### loadSheetUrl
diff --git a/docs/zh/guide/data.md b/docs/zh/guide/data.md
deleted file mode 100644
index edd2219..0000000
--- a/docs/zh/guide/data.md
+++ /dev/null
@@ -1,55 +0,0 @@
-# 表格数据
-
-存储了sheet中所有单元格中的值,Luckysheet在建立的时候会根据 `luckysheetfile[i].row` 和 `luckysheetfile[i].column` 的行列数量大小新建一个表格data,然后再使用 `data[r][c]=v` 的方式填充表格数据,空数据单元格以null表示。
-
-## 初始化表格数据
-
-- **配置**:
-
- 配置 `updateUrl` 的地址,Luckysheet会通过ajax请求表格数据,默认载入status为1的sheet数据中的所有`data`,其余的sheet载入除`data`字段外的所有字段。
-
-- **格式**:
-
-## 获取sheet数据
-
-- **配置**:
-
- 配置`loadSheetUrl`的地址,参数为`gridKey`(表格主键) 和 `index`(sheet主键合集,格式为`[1,2,3]`),返回的数据为sheet的`data`字段数据集合
-
-- **格式**:
-
- ```json
- {
- "1": [{r:0, c:1, v:"值1"},{r:10, c:11, v:"值2"}],
- "2": [data],
- "3": [data],
- }
- ```
-- **说明**:
-
- r代表行,c代表列,v代表该单元格的值,值可以是字符、数字或者json串。
- 数据只会载入一次,一般来说都只有一个主键,但是考虑到一些公式、图表及数据透视表会引用其他sheet的数据,所以前台会加一个判断,如果该当前sheet引用了其他sheet的数据则把引用到的sheet的数据一并补全。
-
-## 更新数据
-
-- **配置**:
-
- 配置 `updateUrl` 的地址,发送到后台的参数为json的字符串。
-
-- **格式**:
-
- ```json
- {
- compress: false,
- gridKey:10004,
- data: [更新数据]
- }
- ```
-
-- **说明**:
-
- | 参数 | 说明 | 举例 |
- | ------------ | ------------ | ------------ |
- | compress | Luckysheet采用客户端pako进行zlib参数压缩,如果浏览器支持压缩则为true,否则为false。后台可以根据此参数决定是否解压data中的内容 | 服务端获取参数过程:1. 序列化json字符串 2. 判断compress字段如果为TRUE则解压data字段 3. 解码data字符串URLDecoder.decode(utf-8) |
- | gridKey | Luckysheet文件的标识符 | 无 |
- | data | 一个包含更新数据的数组,数组中的参数格式请看下面的介绍。实例中:`t`表示更新类型、`i`为sheet的索引、`c`为行号、`r`为列号,`v`为值 | `data: [{ t : 'cell', i:0, c : 0, r : 0 , v: 2 }]` |
diff --git a/docs/zh/guide/operate.md b/docs/zh/guide/operate.md
index 966fad9..8489500 100644
--- a/docs/zh/guide/operate.md
+++ b/docs/zh/guide/operate.md
@@ -8,6 +8,30 @@
以下为所有的支持传输到后台的操作类型,并且以MongoDB做存储示例,讲解如何做前后端交互。
+## 格式
+- **配置**:
+
+ 配置 `updateUrl` 的地址,发送到后台的参数为json的字符串。
+
+- **格式**:
+
+ ```json
+ {
+ compress: false,
+ gridKey:10004,
+ data: [更新json数据]
+ }
+ ```
+
+- **说明**:
+
+ | 参数 | 说明 | 举例 |
+ | ------------ | ------------ | ------------ |
+ | compress | Luckysheet采用客户端pako进行zlib参数压缩,如果浏览器支持压缩则为true,否则为false。后台可以根据此参数决定是否解压data中的内容 | 服务端获取参数过程:1. 序列化json字符串 2. 判断compress字段如果为TRUE则解压data字段 3. 解码data字符串URLDecoder.decode(utf-8) |
+ | gridKey | Luckysheet文件的标识符 | 无 |
+ | data | 一个包含更新数据的数组,数组中的参数格式请看下面的介绍。实例中:`t`表示更新类型、`i`为sheet的索引、`c`为列号、`r`为行号,`v`为值 | `data: [{ t : 'v', i:0, c : 0, r : 0 , v: 2 }]` |
+
+
## 单元格刷新
- **格式**:
diff --git a/docs/zh/guide/sheet.md b/docs/zh/guide/sheet.md
index 867be74..7a4f3f3 100644
--- a/docs/zh/guide/sheet.md
+++ b/docs/zh/guide/sheet.md
@@ -1,21 +1,23 @@
# 工作表配置
+## 初始化配置
表格初始化配置`options`时,需要配置一个由每个工作表参数组成的一维数组,赋给`options.data`。
-> 表格初始化完成之后,通过全局方法[`luckysheet.getAllSheets()`](/zh/guide/api.html#getAllSheets([setting]))可以获取所有工作表的配置信息。
+> 表格初始化完成之后,通过方法[`luckysheet.getAllSheets()`](/zh/guide/api.html#getAllSheets([setting]))可以获取所有工作表的配置信息。
-luckysheetfile示例如下:
+options.data示例如下:
```json
[
{
"name": "Cell", //工作表名称
"color": "", //工作表颜色
- "index": "0", //工作表索引
- "status": "1", //激活状态
- "order": "0", //工作表的顺序
+ "index": 0, //工作表索引
+ "status": 1, //激活状态
+ "order": 0, //工作表的顺序
"hide": 0,//是否隐藏
"row": 36, //行数
"column": 18, //列数
+ "celldata": [], //初始化使用的单元格数据
"config": {
"merge":{}, //合并单元格
"rowlen":{}, //表格行高
@@ -24,12 +26,9 @@ luckysheetfile示例如下:
"columnhidden":{}, //隐藏列
"borderInfo":{}, //边框
},
- "celldata": [], //初始化使用的单元格数据
- "data": [], //更新和存储使用的单元格数据
"scrollLeft": 0, //左右滚动条位置
"scrollTop": 315, //上下滚动条位置
"luckysheet_select_save": [], //选中的区域
- "luckysheet_conditionformat_save": {},//条件格式
"calcChain": [],//公式链
"isPivotTable":false,//是否数据透视表
"pivotTable":{},//数据透视表设置
@@ -37,31 +36,27 @@ luckysheetfile示例如下:
"filter": null,//筛选配置
"luckysheet_alternateformat_save": [], //交替颜色
"luckysheet_alternateformat_save_modelCustom": [], //自定义交替颜色
+ "luckysheet_conditionformat_save": {},//条件格式
"freezen": {}, //冻结行列
"chart": [], //图表配置
- "visibledatarow": [], //所有行的位置
- "visibledatacolumn": [], //所有列的位置
- "ch_width": 2322, //工作表区域的宽度
- "rh_height": 949, //工作表区域的高度
- "load": "1", //已加载过此sheet的标识
},
{
"name": "Sheet2",
"color": "",
- "status": "0",
- "order": "1",
- "data": [],
- "config": {},
- "index": 1
+ "index": 1,
+ "status": 0,
+ "order": 1,
+ "celldata": [],
+ "config": {}
},
{
"name": "Sheet3",
"color": "",
- "status": "0",
- "order": "2",
- "data": [],
+ "index": 2,
+ "status": 0,
+ "order": 2,
+ "celldata": [],
"config": {},
- "index": 2
}
]
```
@@ -114,16 +109,38 @@ luckysheetfile示例如下:
- 作用: 单元格列数
------------
-### scrollLeft
-- 类型:Number
-- 默认值:0
-- 作用: 左右滚动条位置
+### celldata
+- 类型:Array
+- 默认值:[]
+- 作用: 原始单元格数据集,存储sheet中所有单元格中的值,是一个包含`{r:0,c:0,v:{m:"value",v:"value",ct: {fa: "General", t: "g"}}}`格式单元格信息的一维数组,只在初始化的时候使用。
-------------
-### scrollTop
-- 类型:Number
-- 默认值:0
-- 作用: 上下滚动条位置
+ r代表行,c代表列,v代表该单元格的值,值可以是字符、数字或者对象。
+
+ Luckysheet在建立的时候会根据 `options.data[i].row` 和 `options.data[i].column` 的行列数量大小新建一个表格data,然后再使用 `data[r][c]=v` 的方式填充表格数据,空数据单元格以null表示。
+
+ 使用celldata初始化完表格后,数据转换为luckysheetfile中的字段[data](#data),如`luckysheetfile[i].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"
+ }
+ }]
+ ```
+> 详细了解 [单元格格式](/zh/guide/cell.html)
------------
### config
@@ -158,7 +175,7 @@ luckysheetfile示例如下:
}
}
```
-对象中的`key`为`r + '_' + c`的拼接值,`value`为左上角单元格信息: r:行数,c:列数,rs:合并的行数,cs:合并的列数
+ 对象中的`key`为`r + '_' + c`的拼接值,`value`为左上角单元格信息: r:行数,c:列数,rs:合并的行数,cs:合并的列数
#### config.rowlen
- 类型:Object
@@ -218,82 +235,10 @@ luckysheetfile示例如下:
#### config.borderInfo
- 类型:Object
- 默认值:{}
-- 作用:单元格的边框信息,示例:
+- 作用:单元格的边框信息
+- 示例:
```js
"borderInfo": [{
- "rangeType": "cell",
- "value": {
- "row_index": 3,
- "col_index": 3,
- "l": {
- "style": 10,
- "color": "rgb(255, 0, 0)"
- },
- "r": {
- "style": 10,
- "color": "rgb(255, 0, 0)"
- },
- "t": {
- "style": 10,
- "color": "rgb(255, 0, 0)"
- },
- "b": {
- "style": 10,
- "color": "rgb(255, 0, 0)"
- }
- }
- },
- {
- "rangeType": "range",
- "borderType": "border-all",
- "style": "3",
- "color": "#0000ff",
- "range": [{
- "row": [7, 8],
- "column": [2, 3]
- }]
- }, {
- "rangeType": "range",
- "borderType": "border-inside",
- "style": "3",
- "color": "#0000ff",
- "range": [{
- "row": [7, 8],
- "column": [8, 9]
- }]
- }]
- ```
-范围类型分单个单元格和选区两种情况
-1. 选区 `rangeType: "range"`
-
- + 边框类型 `borderType:"border-left" | "border-right" | "border-top" | "border-bottom" | "border-all" | "border-outside" | "border-inside" | "border-horizontal" | "border-vertical" | "border-none"`,
- + 边框粗细 `style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick`
- + 边框颜色 `color: 16进制颜色值`
- + 选区范围 `range: 行列信息数组`
-
-2. 单个单元格 `rangeType:"cell"`
- + 单元格的行数和列数索引 `value.row_index: 数字,value.col_index: 数字`
- + 四个边框对象 `value.l:左边框,value.r:右边框,value.t:上边框,value.b:下边框`
- + 边框粗细 `value.l.style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick`
- + 边框颜色 `value.l.color: 16进制颜色值`
-
-- 示例
- + ```js
- {
- "rangeType": "range",
- "borderType": "border-all",
- "style": "3",
- "color": "#0000ff",
- "range": [{
- "row": [7, 8],
- "column": [2, 3]
- }]
- }
- ```
- 表示设置范围为`{"row": [7, 8],"column": [2, 3]}`的选区,类型为所有边框,边框粗细为`Dotted`,颜色为`"#0000ff"`
-
- + ```js
- {
"rangeType": "cell",
"value": {
"row_index": 3,
@@ -315,211 +260,146 @@ luckysheetfile示例如下:
"color": "rgb(255, 0, 0)"
}
}
+ },
+ {
+ "rangeType": "range",
+ "borderType": "border-all",
+ "style": "3",
+ "color": "#0000ff",
+ "range": [{
+ "row": [7, 8],
+ "column": [2, 3]
+ }]
+ }, {
+ "rangeType": "range",
+ "borderType": "border-inside",
+ "style": "3",
+ "color": "#0000ff",
+ "range": [{
+ "row": [7, 8],
+ "column": [8, 9]
+ }]
+ }]
+ ```
+ 范围类型分单个单元格和选区两种情况
+ 1. 选区 `rangeType: "range"`
+
+ + 边框类型 `borderType:"border-left" | "border-right" | "border-top" | "border-bottom" | "border-all" | "border-outside" | "border-inside" | "border-horizontal" | "border-vertical" | "border-none"`,
+ + 边框粗细 `style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick`
+ + 边框颜色 `color: 16进制颜色值`
+ + 选区范围 `range: 行列信息数组`
+
+ 2. 单个单元格 `rangeType:"cell"`
+ + 单元格的行数和列数索引 `value.row_index: 数字,value.col_index: 数字`
+ + 四个边框对象 `value.l:左边框,value.r:右边框,value.t:上边框,value.b:下边框`
+ + 边框粗细 `value.l.style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick`
+ + 边框颜色 `value.l.color: 16进制颜色值`
+
+ 更多模板:
+
+ + ```js
+ {
+ "rangeType": "range",
+ "borderType": "border-all",
+ "style": "3",
+ "color": "#0000ff",
+ "range": [{
+ "row": [7, 8],
+ "column": [2, 3]
+ }]
}
```
- 表示设置单元格`"D4"`,上边框/下边框/左边框/右边框都是边框粗细为`"MediumDashDot"`,颜色为`"rgb(255, 0, 0)"`
+ 表示设置范围为`{"row": [7, 8],"column": [2, 3]}`的选区,类型为所有边框,边框粗细为`Dotted`,颜色为`"#0000ff"`
+
+ + ```js
+ {
+ "rangeType": "cell",
+ "value": {
+ "row_index": 3,
+ "col_index": 3,
+ "l": {
+ "style": 10,
+ "color": "rgb(255, 0, 0)"
+ },
+ "r": {
+ "style": 10,
+ "color": "rgb(255, 0, 0)"
+ },
+ "t": {
+ "style": 10,
+ "color": "rgb(255, 0, 0)"
+ },
+ "b": {
+ "style": 10,
+ "color": "rgb(255, 0, 0)"
+ }
+ }
+ }
+ ```
+ 表示设置单元格`"D4"`,上边框/下边框/左边框/右边框都是边框粗细为`"MediumDashDot"`,颜色为`"rgb(255, 0, 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"
- }
- }]
- ```
+### scrollLeft
+- 类型:Number
+- 默认值:0
+- 作用: 左右滚动条位置
------------
-### luckysheet_select_save
-- 类型:Array
-- 默认值:[]
-- 作用: 选中的区域,支持多选,是一个包含多个选区对象的一维数组,示例:
-```js
-[
- {
- "left": 0,
- "width": 97,
- "top": 0,
- "height": 20,
- "left_move": 0,
- "width_move": 97,
- "top_move": 0,
- "height_move": 41,
- "row": [ 0, 1 ],
- "column": [ 0, 0 ],
- "row_focus": 0,
- "column_focus": 0
- },
- {
- "left": 98,
- "width": 73,
- "top": 63,
- "height": 20,
- "left_move": 98,
- "width_move": 189,
- "top_move": 63,
- "height_move": 41,
- "row": [ 3, 4 ],
- "column": [ 1, 2 ],
- "row_focus": 3,
- "column_focus": 1
- },
- {
- "left": 288,
- "width": 128,
- "top": 21,
- "height": 20,
- "left_move": 288,
- "width_move": 128,
- "top_move": 21,
- "height_move": 62,
- "row": [ 1, 3 ],
- "column": [ 3, 3 ],
- "row_focus": 1,
- "column_focus": 3
- }
-]
-```
+### scrollTop
+- 类型:Number
+- 默认值:0
+- 作用: 上下滚动条位置
------------
-### luckysheet_conditionformat_save
+### luckysheet_select_save
- 类型:Array
- 默认值:[]
-- 作用: 条件格式配置信息,包含多个条件格式配置对象的一维数组,
-
-type: "default": 突出显示单元格规则和项目选区规则,
-
-"dataBar":数据条,
-
-"icons":图标集,
-
-"colorGradation": 色阶
-
-示例:
-```js
-[
- {
- "type": "default",
- "cellrange": [
- {
- "row": [ 2, 7 ],
- "column": [ 2, 2 ]
- }
- ],
- "format": {
- "textColor": "#000000",
- "cellColor": "#ff0000"
+- 作用: 选中的区域,支持多选,是一个包含多个选区对象的一维数组
+- 示例:
+ ```js
+ [
+ {
+ "row": [ 0, 1 ],
+ "column": [ 0, 0 ]
},
- "conditionName": "betweenness",
- "conditionRange": [
- {
- "row": [ 4, 4 ],
- "column": [ 2, 2 ]
- },
- {
- "row": [ 6, 6 ],
- "column": [ 2, 2 ]
- }
- ],
- "conditionValue": [ 2, 4
- ]
- },
- {
- "type": "dataBar",
- "cellrange": [
- {
- "row": [ 10, 15 ],
- "column": [ 10, 11 ]
- }
- ],
- "format": [
- "#6aa84f",
- "#ffffff"
- ]
- },
- {
- "type": "icons",
- "cellrange": [
- {
- "row": [ 19, 23 ],
- "column": [ 2, 2 ]
- }
- ],
- "format": {
- "len": "3",
- "leftMin": "0",
- "top": "0"
+ {
+ "row": [ 3, 4 ],
+ "column": [ 1, 2 ]
+ },
+ {
+ "row": [ 1, 3 ],
+ "column": [ 3, 3 ]
}
- },
- {
- "type": "colorGradation",
- "cellrange": [
- {
- "left": 422,
- "width": 100,
- "top": 210,
- "height": 20,
- "left_move": 422,
- "width_move": 100,
- "top_move": 210,
- "height_move": 125,
- "row": [ 10, 15 ],
- "column": [ 6, 6 ],
- "row_focus": 10,
- "column_focus": 6
- }
- ],
- "format": [
- "rgb(99, 190, 123)",
- "rgb(255, 235, 132)",
- "rgb(248, 105, 107)"
- ]
- }
-]
-```
-
+ ]
+ ```
+
------------
### calcChain
- 类型:Array
- 默认值:[]
-- 作用: 公式链,用于公式所链接的单元格改变后,所有引用此单元格的公式都会联动刷新,示例:
-```js
-[{
- "r": 6,
- "c": 3,
- "index": 1,
- "func": [true, 23.75, "=AVERAGE(D3:D6)"],
- "color": "w",
- "parent": null,
- "chidren": {},
- "times": 0
-}, {
- "r": 7,
- "c": 3,
- "index": 1,
- "func": [true, 30, "=MAX(D3:D6)"],
- "color": "w",
- "parent": null,
- "chidren": {},
- "times": 0
-}]
-```
+- 作用: 公式链,用于公式所链接的单元格改变后,所有引用此单元格的公式都会联动刷新
+- 示例:
+ ```js
+ [{
+ "r": 6,
+ "c": 3,
+ "index": 1,
+ "func": [true, 23.75, "=AVERAGE(D3:D6)"],
+ "color": "w",
+ "parent": null,
+ "chidren": {},
+ "times": 0
+ }, {
+ "r": 7,
+ "c": 3,
+ "index": 1,
+ "func": [true, 30, "=MAX(D3:D6)"],
+ "color": "w",
+ "parent": null,
+ "chidren": {},
+ "times": 0
+ }]
+ ```
------------
### isPivotTable
@@ -531,133 +411,192 @@ type: "default": 突出显示单元格规则和项目选区规则,
### pivotTable
- 类型:Object
- 默认值:{}
-- 作用: 数据透视表设置,示例:
-```js
-{
- "pivot_select_save": {
- "left": 0,
- "width": 73,
- "top": 0,
- "height": 19,
- "left_move": 0,
- "width_move": 369,
- "top_move": 0,
- "height_move": 259,
- "row": [0, 12],
- "column": [0, 4],
- "row_focus": 0,
- "column_focus": 0
- },
- "pivotDataSheetIndex": 6, //The sheet index where the source data is located
- "column": [{
- "index": 3,
- "name": "subject",
- "fullname": "subject"
- }],
- "row": [{
- "index": 1,
- "name": "student",
- "fullname": "student"
- }],
- "filter": [],
- "values": [{
- "index": 4,
- "name": "score",
- "fullname": "count:score",
- "sumtype": "COUNTA",
- "nameindex": 0
- }],
- "showType": "column",
- "pivotDatas": [
- ["count:score", "science", "mathematics", "foreign language", "English", "total"],
- ["Alex", 1, 1, 1, 1, 4],
- ["Joy", 1, 1, 1, 1, 4],
- ["Tim", 1, 1, 1, 1, 4],
- ["total", 3, 3, 3, 3, 12]
- ],
- "drawPivotTable": false,
- "pivotTableBoundary": [5, 6]
-}
-```
+- 作用: 数据透视表设置
+- 示例:
+ ```js
+ {
+ "pivot_select_save": {
+ "left": 0,
+ "width": 73,
+ "top": 0,
+ "height": 19,
+ "left_move": 0,
+ "width_move": 369,
+ "top_move": 0,
+ "height_move": 259,
+ "row": [0, 12],
+ "column": [0, 4],
+ "row_focus": 0,
+ "column_focus": 0
+ },
+ "pivotDataSheetIndex": 6, //The sheet index where the source data is located
+ "column": [{
+ "index": 3,
+ "name": "subject",
+ "fullname": "subject"
+ }],
+ "row": [{
+ "index": 1,
+ "name": "student",
+ "fullname": "student"
+ }],
+ "filter": [],
+ "values": [{
+ "index": 4,
+ "name": "score",
+ "fullname": "count:score",
+ "sumtype": "COUNTA",
+ "nameindex": 0
+ }],
+ "showType": "column",
+ "pivotDatas": [
+ ["count:score", "science", "mathematics", "foreign language", "English", "total"],
+ ["Alex", 1, 1, 1, 1, 4],
+ ["Joy", 1, 1, 1, 1, 4],
+ ["Tim", 1, 1, 1, 1, 4],
+ ["total", 3, 3, 3, 3, 12]
+ ],
+ "drawPivotTable": false,
+ "pivotTableBoundary": [5, 6]
+ }
+ ```
------------
### filter_select
- 类型:Object
- 默认值:{}
-- 作用: 筛选范围,一个选区,一个sheet只有一个筛选范围,类似`luckysheet_select_save`示例:
-```js
-{
- "left": 74,
- "width": 73,
- "top": 40,
- "height": 19,
- "left_move": 74,
- "width_move": 221,
- "top_move": 40,
- "height_move": 99,
- "row": [
- 2,
- 6
- ],
- "column": [
- 1,
- 3
- ],
- "row_focus": 2,
- "column_focus": 1
-}
-```
+- 作用: 筛选范围,一个选区,一个sheet只有一个筛选范围,类似`luckysheet_select_save`
+- 示例:
+ ```js
+ {
+ "left": 74,
+ "width": 73,
+ "top": 40,
+ "height": 19,
+ "left_move": 74,
+ "width_move": 221,
+ "top_move": 40,
+ "height_move": 99,
+ "row": [
+ 2,
+ 6
+ ],
+ "column": [
+ 1,
+ 3
+ ],
+ "row_focus": 2,
+ "column_focus": 1
+ }
+ ```
------------
### filter
- 类型:Object
- 默认值:{}
-- 作用: 筛选的具体设置,示例:
-```js
-{
- "0": {
- "caljs": {},
- "rowhidden": {
- "3": 0,
- "4": 0
- },
- "optionstate": true,
- "str": 2,
- "edr": 6,
- "cindex": 1,
- "stc": 1,
- "edc": 3
- },
- "1": {
- "caljs": {},
- "rowhidden": {
- "6": 0
+- 作用: 筛选的具体设置
+- 示例:
+ ```js
+ {
+ "0": {
+ "caljs": {},
+ "rowhidden": {
+ "3": 0,
+ "4": 0
+ },
+ "optionstate": true,
+ "str": 2,
+ "edr": 6,
+ "cindex": 1,
+ "stc": 1,
+ "edc": 3
},
- "optionstate": true,
- "str": 2,
- "edr": 6,
- "cindex": 2,
- "stc": 1,
- "edc": 3
+ "1": {
+ "caljs": {},
+ "rowhidden": {
+ "6": 0
+ },
+ "optionstate": true,
+ "str": 2,
+ "edr": 6,
+ "cindex": 2,
+ "stc": 1,
+ "edc": 3
+ }
}
-}
-```
+ ```
------------
### luckysheet_alternateformat_save
- 类型:Array
- 默认值:[]
-- 作用: 交替颜色配置,示例:
-```js
-[{
- "cellrange": {
- "row": [1, 6],
- "column": [1, 5]
- },
- "format": {
+- 作用: 交替颜色配置
+- 示例:
+ ```js
+ [{
+ "cellrange": {
+ "row": [1, 6],
+ "column": [1, 5]
+ },
+ "format": {
+ "head": {
+ "fc": "#000",
+ "bc": "#5ed593"
+ },
+ "one": {
+ "fc": "#000",
+ "bc": "#ffffff"
+ },
+ "two": {
+ "fc": "#000",
+ "bc": "#e5fbee"
+ },
+ "foot": {
+ "fc": "#000",
+ "bc": "#a5efcc"
+ }
+ },
+ "hasRowHeader": false,
+ "hasRowFooter": false
+ }, {
+ "cellrange": {
+ "row": [1, 6],
+ "column": [8, 12]
+ },
+ "format": {
+ "head": {
+ "fc": "#000",
+ "bc": "#5599fc"
+ },
+ "one": {
+ "fc": "#000",
+ "bc": "#ffffff"
+ },
+ "two": {
+ "fc": "#000",
+ "bc": "#ecf2fe"
+ },
+ "foot": {
+ "fc": "#000",
+ "bc": "#afcbfa"
+ }
+ },
+ "hasRowHeader": false,
+ "hasRowFooter": false
+ }]
+ ```
+
+------------
+### luckysheet_alternateformat_save_modelCustom
+- 类型:Array
+- 默认值:[]
+- 作用:自定义交替颜色,包含多个自定义交替颜色的配置
+- 示例:
+ ```js
+ [{
"head": {
- "fc": "#000",
- "bc": "#5ed593"
+ "fc": "#6aa84f",
+ "bc": "#ffffff"
},
"one": {
"fc": "#000",
@@ -671,70 +610,220 @@ type: "default": 突出显示单元格规则和项目选区规则,
"fc": "#000",
"bc": "#a5efcc"
}
- },
- "hasRowHeader": false,
- "hasRowFooter": false
-}, {
- "cellrange": {
- "row": [1, 6],
- "column": [8, 12]
- },
- "format": {
- "head": {
- "fc": "#000",
- "bc": "#5599fc"
+ }]
+ ```
+
+------------
+### luckysheet_conditionformat_save
+- 类型:Array
+- 默认值:[]
+- 作用: 条件格式配置信息,包含多个条件格式配置对象的一维数组,
+
+type: "default": 突出显示单元格规则和项目选区规则,
+
+"dataBar":数据条,
+
+"icons":图标集,
+
+"colorGradation": 色阶
+
+- 示例:
+ ```js
+ [
+ {
+ "type": "default",
+ "cellrange": [
+ {
+ "row": [ 2, 7 ],
+ "column": [ 2, 2 ]
+ }
+ ],
+ "format": {
+ "textColor": "#000000",
+ "cellColor": "#ff0000"
+ },
+ "conditionName": "betweenness",
+ "conditionRange": [
+ {
+ "row": [ 4, 4 ],
+ "column": [ 2, 2 ]
+ },
+ {
+ "row": [ 6, 6 ],
+ "column": [ 2, 2 ]
+ }
+ ],
+ "conditionValue": [ 2, 4
+ ]
},
- "one": {
- "fc": "#000",
- "bc": "#ffffff"
+ {
+ "type": "dataBar",
+ "cellrange": [
+ {
+ "row": [ 10, 15 ],
+ "column": [ 10, 11 ]
+ }
+ ],
+ "format": [
+ "#6aa84f",
+ "#ffffff"
+ ]
},
- "two": {
- "fc": "#000",
- "bc": "#ecf2fe"
+ {
+ "type": "icons",
+ "cellrange": [
+ {
+ "row": [ 19, 23 ],
+ "column": [ 2, 2 ]
+ }
+ ],
+ "format": {
+ "len": "3",
+ "leftMin": "0",
+ "top": "0"
+ }
},
- "foot": {
- "fc": "#000",
- "bc": "#afcbfa"
+ {
+ "type": "colorGradation",
+ "cellrange": [
+ {
+ "left": 422,
+ "width": 100,
+ "top": 210,
+ "height": 20,
+ "left_move": 422,
+ "width_move": 100,
+ "top_move": 210,
+ "height_move": 125,
+ "row": [ 10, 15 ],
+ "column": [ 6, 6 ],
+ "row_focus": 10,
+ "column_focus": 6
+ }
+ ],
+ "format": [
+ "rgb(99, 190, 123)",
+ "rgb(255, 235, 132)",
+ "rgb(248, 105, 107)"
+ ]
}
- },
- "hasRowHeader": false,
- "hasRowFooter": false
-}]
-```
+ ]
+ ```
------------
-### luckysheet_alternateformat_save_modelCustom
+### frozen(TODO)
- 类型:Array
- 默认值:[]
-- 作用:自定义交替颜色,包含多个自定义交替颜色的配置,示例:
-```js
-[{
- "head": {
- "fc": "#6aa84f",
- "bc": "#ffffff"
- },
- "one": {
- "fc": "#000",
- "bc": "#ffffff"
- },
- "two": {
- "fc": "#000",
- "bc": "#e5fbee"
- },
- "foot": {
- "fc": "#000",
- "bc": "#a5efcc"
+- 作用: 冻结行列设置,分为6种类型
+ 1. "row": 冻结首行
+ 2. "column": 冻结首列
+ 3. "both": 冻结行列
+ 4. "rangeRow": 冻结行到选区
+ 5. "rangeColumn": 冻结列到选区
+ 6. "rangeBoth": 冻结行列到选区
+ 当设置冻结到选区的时候,需要设置选区范围`range`,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;如果已经设置了`luckysheet_select_save`,则直接取当前第一个选区,不用再设置选区。
+- 示例:
+ - 冻结首行
+ ```json
+ {
+ type: 'row'
}
-}]
-```
+ ```
+ - 冻结行到`'B2'`选区
+ ```json
+ {
+ type: 'rangeRow',
+ range: {row:[1,1],column:[1,1]}
+ }
+ ```
+ - 冻结行列到`'B3:D4'`选区
+ ```json
+ {
+ type: 'rangeBoth',
+ range: "B3:D4"
+ }
+ ```
------------
### chart
- 类型:Array
- 默认值:[]
-- 作用: 图表配置(开发中)
+- 作用: 图表配置
------------
+
+## 调试信息
+
+初始化所需要的参数,会从简洁的角度出发来考虑设计,但是本地存储的参数则不同。
+
+Luckysheet在初始化完成之后进行的一系列操作,会将更多本地参数存储在luckysheetfile中,作为本地使用的参数,实现一些类似Store数据中心的作用。
+
+此时的luckysheetfile包含很多非初始化使用的本地参数,可用于调试代码、本地状态分析。如下展示了更丰富luckysheetfile信息,可通过方法 `luckysheet.getluckysheetfile()`获得:
+
+::: details
+```json
+[
+ {
+ "name": "Cell", //工作表名称
+ "color": "", //工作表颜色
+ "index": 0, //工作表索引
+ "status": 1, //激活状态
+ "order": 0, //工作表的顺序
+ "hide": 0,//是否隐藏
+ "row": 36, //行数
+ "column": 18, //列数
+ "celldata": [], //初始化使用的单元格数据
+ "config": {
+ "merge":{}, //合并单元格
+ "rowlen":{}, //表格行高
+ "columnlen":{}, //表格列宽
+ "rowhidden":{}, //隐藏行
+ "columnhidden":{}, //隐藏列
+ "borderInfo":{}, //边框
+ },
+ "scrollLeft": 0, //左右滚动条位置
+ "scrollTop": 315, //上下滚动条位置
+ "luckysheet_select_save": [], //选中的区域
+ "calcChain": [],//公式链
+ "isPivotTable":false,//是否数据透视表
+ "pivotTable":{},//数据透视表设置
+ "filter_select": {},//筛选范围
+ "filter": null,//筛选配置
+ "luckysheet_alternateformat_save": [], //交替颜色
+ "luckysheet_alternateformat_save_modelCustom": [], //自定义交替颜色
+ "luckysheet_conditionformat_save": {},//条件格式
+ "freezen": {}, //冻结行列
+ "chart": [], //图表配置
+
+ "visibledatarow": [], //所有行的位置
+ "visibledatacolumn": [], //所有列的位置
+ "ch_width": 2322, //工作表区域的宽度
+ "rh_height": 949, //工作表区域的高度
+ "load": "1", //已加载过此sheet的标识
+ "data": [], //更新和存储使用的单元格数据
+ },
+ {
+ "name": "Sheet2",
+ "color": "",
+ "index": 1,
+ "status": 0,
+ "order": 1,
+ "celldata": [],
+ "config": {}
+ },
+ {
+ "name": "Sheet3",
+ "color": "",
+ "index": 2,
+ "status": 0,
+ "order": 2,
+ "celldata": [],
+ "config": {},
+ }
+]
+```
+:::
+
### visibledatarow
- 类型:Number
- 默认值:[]
@@ -759,6 +848,40 @@ type: "default": 突出显示单元格规则和项目选区规则,
- 作用: 整个工作表区域的高度(包含边界的灰色区域),初始化无需设置
------------
+### load
+- 类型:Number
+- 默认值:0
+- 作用: 当前sheet是否加载过,内部标识,初始化无需设置
+------------
+### data
+- 类型:Array
+- 默认值:[]
+- 作用: 初始化时从celldata转换而来,后续操作表格的数据更新,会更新到这个data字段中,初始化无需设置
+- 示例:
+ 以下是一个二行二列的数据
+ ```json
+ [
+ [{
+ ct: {fa: "General", t: "g"},
+ m:"value1",
+ v:"value1"
+ }, {
+ ct: {fa: "General", t: "g"},
+ m:"value2",
+ v:"value2"
+ }],
+ [{
+ ct: {fa: "General", t: "g"},
+ m:"value3",
+ v:"value3"
+ }, {
+ ct: {fa: "General", t: "g"},
+ m:"value4",
+ v:"value4"
+ }]
+ ]
+ ```
+------------