16 changed files with 2586 additions and 1351 deletions
File diff suppressed because it is too large
@ -1,225 +1,273 @@ |
|||
# 基本配置 |
|||
|
|||
## container |
|||
# 整体配置 |
|||
|
|||
## 基础结构 |
|||
|
|||
初始化表格时,可以设置一个对象配置串`options`来自定义配置Luckysheet表格。 |
|||
|
|||
如下是一个简洁的配置案例: |
|||
|
|||
```js |
|||
// 配置项 |
|||
const options = { |
|||
container: 'luckysheet', // 设定DOM容器的id |
|||
title: 'Luckysheet Demo', // 设定表格名称 |
|||
lang: 'zh' // 设定表格语言 |
|||
|
|||
// 更多其他设置... |
|||
} |
|||
|
|||
// 初始化表格 |
|||
luckysheet.create(options) |
|||
``` |
|||
|
|||
这里的`options`配置项会作用于整个表格,特别的,单个sheet的配置则需要在`options.data`数组中,分别设置对应更详细的参数,参考[工作表配置](/zh/guide/sheet.html) |
|||
|
|||
## 配置项 |
|||
|
|||
以下为所有支持的设置参数 |
|||
|
|||
- [container](#container) |
|||
- [title](#title) |
|||
- [lang](#lang) |
|||
- [gridKey](#gridKey) |
|||
- [loadUrl](#loadUrl) |
|||
- [loadSheetUrl](#loadSheetUrl) |
|||
- [allowUpdate](#allowUpdate) |
|||
- [updateUrl](#updateUrl) |
|||
- [updateImageUrl](#updateImageUrl) |
|||
- [data](#data) |
|||
- [plugins](#plugins) |
|||
- [column](#column) |
|||
- [row](#row) |
|||
- [autoFormatw](#autoFormatw) |
|||
- [accuracy](#accuracy) |
|||
- [allowCopy](#allowCopy) |
|||
- [showtoolbar](#showtoolbar) |
|||
- [showinfobar](#showinfobar) |
|||
- [showsheetbar](#showsheetbar) |
|||
- [showstatisticBar](#showstatisticBar) |
|||
- [allowEdit](#allowEdit) |
|||
- [enableAddRow](#enableAddRow) |
|||
- [enableAddCol](#enableAddCol) |
|||
- [userInfo](#userInfo) |
|||
- [userMenuItem](#userMenuItem) |
|||
- [myFolderUrl](#myFolderUrl) |
|||
- [devicePixelRatio](#devicePixelRatio) |
|||
- [functionButton](#functionButton) |
|||
- [showConfigWindowResize](#showConfigWindowResize) |
|||
- [enablePage](#enablePage) |
|||
- [fullscreenmode](#fullscreenmode) |
|||
- [beforeCreateDom](#beforeCreateDom) |
|||
- [fireMousedown](#fireMousedown) |
|||
- [forceCalculation](#forceCalculation) |
|||
|
|||
### container |
|||
- 类型:String |
|||
- 默认值:"luckysheet" |
|||
- 作用:容器的ID |
|||
|
|||
------------ |
|||
## title |
|||
### title |
|||
- 类型:String |
|||
- 默认值:"Luckysheet Demo" |
|||
- 作用:表格的名称 |
|||
|
|||
------------ |
|||
## lang |
|||
### lang |
|||
- 类型:String |
|||
- 默认值:"en" |
|||
- 作用:国际化设置,允许设置表格的语言,暂时支持中文("zh")和英文("en") |
|||
- 作用:国际化设置,允许设置表格的语言,支持中文("zh")和英文("en") |
|||
|
|||
------------ |
|||
## column |
|||
- 类型:Number |
|||
- 默认值:60 |
|||
- 作用:空表格默认的列数量 |
|||
### gridKey |
|||
- 类型:String |
|||
- 默认值:"" |
|||
- 作用:表格唯一标识符 |
|||
|
|||
------------ |
|||
## row |
|||
- 类型:Number |
|||
- 默认值:84 |
|||
- 作用:空表格默认的行数据量 |
|||
### loadUrl |
|||
- 类型:String |
|||
- 默认值:"" |
|||
- 作用:配置`loadUrl`的地址,Luckysheet会通过ajax请求整个表格数据,默认载入status为1的sheet数据中的所有`celldata`,其余的sheet载入除`celldata`字段外的所有字段 |
|||
|
|||
------------ |
|||
### loadSheetUrl |
|||
- 类型:String |
|||
- 默认值:"" |
|||
- 作用:配置`loadSheetUrl`的地址,参数为`gridKey`(表格主键) 和 `index`(sheet主键合集,格式为`[1,2,3]`),返回的数据为sheet的`celldata`字段数据集合 |
|||
|
|||
------------ |
|||
### allowUpdate |
|||
- 类型:Boolean |
|||
- 默认值:false |
|||
- 作用:是否允许操作表格后的后台更新,与`updateUrl`配合使用 |
|||
|
|||
------------ |
|||
### updateUrl |
|||
- 类型:String |
|||
- 默认值:"" |
|||
- 作用:操作表格后的后台更新地址,在`allowUpdate`为`true`时才会有效 |
|||
|
|||
------------ |
|||
### updateImageUrl |
|||
- 类型:String |
|||
- 默认值:"" |
|||
- 作用:缩略图的更新地址 |
|||
|
|||
------------ |
|||
## data |
|||
### data |
|||
- 类型:Array |
|||
- 默认值:[{ "name": "Sheet1", color: "", "status": "1", "order": "0", "data": [], "config": {}, "index":0 }, { "name": "Sheet2", color: "", "status": "0", "order": "1", "data": [], "config": {}, "index":1 }, { "name": "Sheet3", color: "", "status": "0", "order": "2", "data": [], "config": {}, "index":2 }] |
|||
- 作用:客户端sheet数据`[shee1, sheet2, sheet3]` |
|||
- 作用:当未配置`loadUrl`和`loadSheetUrl`的时候,需要手动配置传入整个客户端所有sheet数据`[shee1, sheet2, sheet3]`,详细参数设置参见[工作表配置](/zh/guide/sheet.html) |
|||
|
|||
------------ |
|||
## plugins |
|||
### plugins |
|||
- 类型:Array |
|||
- 默认值:[] |
|||
- 作用:配置插件,支持 图表:"chart" |
|||
- 作用:配置插件,支持图表:"chart" |
|||
|
|||
------------ |
|||
## fullscreenmode |
|||
- 类型:Boolean |
|||
- 默认值:true |
|||
- 作用:是否全屏模式。非全屏模式下,标记框不会强制选中 |
|||
### column |
|||
- 类型:Number |
|||
- 默认值:60 |
|||
- 作用:空表格默认的列数量 |
|||
|
|||
------------ |
|||
## autoFormatw |
|||
### row |
|||
- 类型:Number |
|||
- 默认值:84 |
|||
- 作用:空表格默认的行数据量 |
|||
|
|||
------------ |
|||
### autoFormatw |
|||
- 类型:Boolean |
|||
- 默认值:false |
|||
- 作用:自动格式化超过4位数的数字为‘亿万格式’,例:true or "true" or "TRUE" |
|||
|
|||
------------ |
|||
## accuracy |
|||
### accuracy |
|||
- 类型:Number |
|||
- 默认值:undefined |
|||
- 作用:设置精度,小数点后的位数。传参数为数字或数字字符串,例: "0" 或 0 |
|||
|
|||
------------ |
|||
## allowCopy |
|||
### allowCopy |
|||
- 类型:Boolean |
|||
- 默认值:true |
|||
- 作用:是否允许拷贝 |
|||
|
|||
------------ |
|||
## showtoolbar |
|||
### showtoolbar |
|||
- 类型:Boolean |
|||
- 默认值:true |
|||
- 作用:是否第二列显示工具栏 |
|||
|
|||
------------ |
|||
## showinfobar |
|||
### showinfobar |
|||
- 类型:Boolean |
|||
- 默认值:true |
|||
- 作用:是否显示顶部名称栏 |
|||
|
|||
------------ |
|||
## showsheetbar |
|||
### showsheetbar |
|||
- 类型:Boolean |
|||
- 默认值:true |
|||
- 作用:是否显示底部表格名称区域 |
|||
|
|||
------------ |
|||
|
|||
## showstatisticBar |
|||
### showstatisticBar |
|||
- 类型:Boolean |
|||
- 默认值:true |
|||
- 作用:是否显示底部计数栏 |
|||
|
|||
------------ |
|||
## allowEdit |
|||
### allowEdit |
|||
- 类型:Boolean |
|||
- 默认值:true |
|||
- 作用:是否允许前台编辑 |
|||
|
|||
------------ |
|||
## enableAddRow |
|||
### enableAddRow |
|||
- 类型:Boolean |
|||
- 默认值:true |
|||
- 作用:允许增加行 |
|||
|
|||
------------ |
|||
## enableAddCol |
|||
### enableAddCol |
|||
- 类型:Boolean |
|||
- 默认值:true |
|||
- 作用:允许增加列 |
|||
|
|||
------------ |
|||
## pointEdit |
|||
- 类型:Boolean |
|||
- 默认值:false |
|||
- 作用:是否是编辑器插入表格模式 |
|||
|
|||
------------ |
|||
## pointEditUpdate |
|||
- 类型:Function |
|||
- 默认值:null |
|||
- 作用:编辑器表格更新函数 |
|||
|
|||
------------ |
|||
## pointEditZoom |
|||
- 类型:Number |
|||
- 默认值:1 |
|||
- 作用:编辑器表格编辑时缩放比例 |
|||
|
|||
------------ |
|||
## userInfo |
|||
### userInfo |
|||
- 类型:String |
|||
- 默认值:`'<i style="font-size:16px;color:#ff6a00;" class="fa fa-taxi" aria-hidden="true"></i> rabbit'` |
|||
- 作用:右上角的用户信息展示样式 |
|||
|
|||
------------ |
|||
## userMenuItem |
|||
### userMenuItem |
|||
- 类型:Array |
|||
- 默认值:`[{url:"www.baidu.com", "icon":'<i class="fa fa-folder" aria-hidden="true"></i>', "name":"我的表格"}, {url:"www.baidu.com", "icon":'<i class="fa fa-sign-out" aria-hidden="true"></i>', "name":"退出登陆"}]` |
|||
- 作用:点击右上角的用户信息弹出的菜单 |
|||
|
|||
------------ |
|||
## myFolderUrl |
|||
### myFolderUrl |
|||
- 类型:String |
|||
- 默认值:"www.baidu.com" |
|||
- 作用:左上角<返回按钮的链接 |
|||
|
|||
------------ |
|||
## devicePixelRatio |
|||
### devicePixelRatio |
|||
- 类型:Number |
|||
- 默认值:window.devicePixelRatio |
|||
- 作用:设备比例,比例越大表格分辨率越高 |
|||
|
|||
------------ |
|||
## gridKey |
|||
- 类型:String |
|||
- 默认值:"" |
|||
- 作用:表格唯一标识符 |
|||
|
|||
------------ |
|||
## allowUpdate |
|||
- 类型:Boolean |
|||
- 默认值:false |
|||
- 作用:是否允许操作表格后的后台更新,与`updateUrl`配合使用 |
|||
|
|||
------------ |
|||
## loadUrl |
|||
- 类型:String |
|||
- 默认值:"" |
|||
- 作用:配置`loadUrl`的地址,Luckysheet会通过ajax请求表格数据,默认载入status为1的sheet数据中的所有`data`,其余的sheet载入除`data`字段外的所有字段 |
|||
|
|||
------------ |
|||
## loadSheetUrl |
|||
- 类型:String |
|||
- 默认值:"" |
|||
- 作用:配置`loadSheetUrl`的地址,参数为`gridKey`(表格主键) 和 `index`(sheet主键合集,格式为`[1,2,3]`),返回的数据为sheet的`data`字段数据集合 |
|||
|
|||
------------ |
|||
## updateUrl |
|||
- 类型:String |
|||
- 默认值:"" |
|||
- 作用:操作表格后的后台更新地址,在`allowUpdate`为`true`时才会有效 |
|||
|
|||
------------ |
|||
## updateImageUrl |
|||
- 类型:String |
|||
- 默认值:"" |
|||
- 作用:缩略图的更新地址 |
|||
|
|||
------------ |
|||
## functionButton |
|||
### functionButton |
|||
- 类型:String |
|||
- 默认值:"" |
|||
- 作用:右上角功能按钮,例如`'<button id="" class="btn btn-primary" style="padding:3px 6px;font-size: 12px;margin-right: 10px;">下载</button> <button id="" class="btn btn-primary btn-danger" style=" padding:3px 6px; font-size: 12px; margin-right: 10px;">分享</button> <button id="luckysheet-share-btn-title" class="btn btn-primary btn-danger" style=" padding:3px 6px; font-size: 12px; margin-right: 10px;">秀数据</button>'` |
|||
|
|||
------------ |
|||
## showConfigWindowResize |
|||
### showConfigWindowResize |
|||
- 类型:Boolean |
|||
- 默认值:true |
|||
- 作用:图表或数据透视表的配置会在右侧弹出,设置弹出后表格是否会自动缩进 |
|||
|
|||
------------ |
|||
## enablePage |
|||
### enablePage |
|||
- 类型:Boolean |
|||
- 默认值:false |
|||
- 作用:允许加载下一页 |
|||
|
|||
------------ |
|||
## chartConfigChange |
|||
- 类型:Function |
|||
- 默认值:null |
|||
- 作用:图表插件中图表更新触发的自定义方法 |
|||
### fullscreenmode |
|||
- 类型:Boolean |
|||
- 默认值:true |
|||
- 作用:是否全屏模式。非全屏模式下,标记框不会强制选中 |
|||
|
|||
------------ |
|||
## beforeCreateDom |
|||
### beforeCreateDom |
|||
- 类型:Function |
|||
- 默认值:null |
|||
- 作用:表格创建之前自定义方法 |
|||
|
|||
------------ |
|||
## fireMousedown |
|||
### fireMousedown |
|||
- 类型:Function |
|||
- 默认值:null |
|||
- 作用:单元格数据下钻自定义方法 |
|||
|
|||
------------ |
|||
### forceCalculation |
|||
- 类型:Boolean |
|||
- 默认值:false |
|||
- 作用:强制刷新公式。 |
|||
|
|||
默认情况下,为提高加载性能,表格初始化的时候,含有公式的单元格会默认直接取得`v`和`m`作为数据结果,而不做实时计算。 |
|||
|
|||
如果公式关联到的单元格数据已经变化,或者公式所在的单元格数据结果改变了,则会导致关联单元格应该计算得出的结果和实际显示结果不一致,这是就需要开启公式刷新,保证数据实时计算的准确性。 |
|||
|
|||
⚠️提醒,公式较多时会有性能问题,慎用! |
|||
|
|||
------------ |
@ -0,0 +1,764 @@ |
|||
# 工作表配置 |
|||
|
|||
表格初始化配置`options`时,需要配置一个由每个工作表参数组成的一维数组,赋给`options.data`。 |
|||
|
|||
> 表格初始化完成之后,通过全局方法[`luckysheet.getAllSheets()`](/zh/guide/api.html#getAllSheets([setting]))可以获取所有工作表的配置信息。 |
|||
|
|||
luckysheetfile示例如下: |
|||
```json |
|||
[ |
|||
{ |
|||
"name": "Cell", //工作表名称 |
|||
"color": "", //工作表颜色 |
|||
"index": "0", //工作表索引 |
|||
"status": "1", //激活状态 |
|||
"order": "0", //工作表的顺序 |
|||
"hide": 0,//是否隐藏 |
|||
"row": 36, //行数 |
|||
"column": 18, //列数 |
|||
"config": { |
|||
"merge":{}, //合并单元格 |
|||
"rowlen":{}, //表格行高 |
|||
"columnlen":{}, //表格列宽 |
|||
"rowhidden":{}, //隐藏行 |
|||
"columnhidden":{}, //隐藏列 |
|||
"borderInfo":{}, //边框 |
|||
}, |
|||
"celldata": [], //初始化使用的单元格数据 |
|||
"data": [], //更新和存储使用的单元格数据 |
|||
"scrollLeft": 0, //左右滚动条位置 |
|||
"scrollTop": 315, //上下滚动条位置 |
|||
"luckysheet_select_save": [], //选中的区域 |
|||
"luckysheet_conditionformat_save": {},//条件格式 |
|||
"calcChain": [],//公式链 |
|||
"isPivotTable":false,//是否数据透视表 |
|||
"pivotTable":{},//数据透视表设置 |
|||
"filter_select": {},//筛选范围 |
|||
"filter": null,//筛选配置 |
|||
"luckysheet_alternateformat_save": [], //交替颜色 |
|||
"luckysheet_alternateformat_save_modelCustom": [], //自定义交替颜色 |
|||
"freezen": {}, //冻结行列 |
|||
"chart": [], //图表配置 |
|||
"visibledatarow": [], //所有行的位置 |
|||
"visibledatacolumn": [], //所有列的位置 |
|||
"ch_width": 2322, //工作表区域的宽度 |
|||
"rh_height": 949, //工作表区域的高度 |
|||
"load": "1", //已加载过此sheet的标识 |
|||
}, |
|||
{ |
|||
"name": "Sheet2", |
|||
"color": "", |
|||
"status": "0", |
|||
"order": "1", |
|||
"data": [], |
|||
"config": {}, |
|||
"index": 1 |
|||
}, |
|||
{ |
|||
"name": "Sheet3", |
|||
"color": "", |
|||
"status": "0", |
|||
"order": "2", |
|||
"data": [], |
|||
"config": {}, |
|||
"index": 2 |
|||
} |
|||
] |
|||
``` |
|||
|
|||
### name |
|||
- 类型:String |
|||
- 默认值:"Sheet1" |
|||
- 作用:工作表名称 |
|||
|
|||
------------ |
|||
### color |
|||
- 类型:String |
|||
- 默认值:"##f20e0e" |
|||
- 作用:工作表颜色,工作表名称下方会有一条底部边框 |
|||
|
|||
------------ |
|||
### index |
|||
- 类型:Number |
|||
- 默认值:0 |
|||
- 作用:工作表索引,从0开始 |
|||
|
|||
------------ |
|||
### status |
|||
- 类型:Number |
|||
- 默认值:1 |
|||
- 作用: 激活状态,仅有一个激活状态的工作表,其他工作表为 0 |
|||
|
|||
------------ |
|||
### order |
|||
- 类型:Number |
|||
- 默认值:0 |
|||
- 作用: 工作表的索引,新增工作表时会递增,从0开始 |
|||
|
|||
------------ |
|||
### hide |
|||
- 类型:Number |
|||
- 默认值:0 |
|||
- 作用: 是否隐藏,`0`为不隐藏,`1`为隐藏 |
|||
|
|||
------------ |
|||
### row |
|||
- 类型:Number |
|||
- 默认值:36 |
|||
- 作用: 单元格行数 |
|||
|
|||
------------ |
|||
### column |
|||
- 类型:Number |
|||
- 默认值:18 |
|||
- 作用: 单元格列数 |
|||
|
|||
------------ |
|||
### scrollLeft |
|||
- 类型:Number |
|||
- 默认值:0 |
|||
- 作用: 左右滚动条位置 |
|||
|
|||
------------ |
|||
### scrollTop |
|||
- 类型:Number |
|||
- 默认值:0 |
|||
- 作用: 上下滚动条位置 |
|||
|
|||
------------ |
|||
### config |
|||
- 类型:Object |
|||
- 默认值:{} |
|||
- 作用:表格行高、列宽、合并单元格、边框、隐藏行等设置 |
|||
|
|||
#### 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 |
|||
} |
|||
} |
|||
``` |
|||
对象中的`key`为`r + '_' + c`的拼接值,`value`为左上角单元格信息: r:行数,c:列数,rs:合并的行数,cs:合并的列数 |
|||
|
|||
#### config.rowlen |
|||
- 类型:Object |
|||
- 默认值:{} |
|||
- 作用:每个单元格的行高 |
|||
- 示例: |
|||
```js |
|||
"rowlen": { |
|||
"0": 20, |
|||
"1": 20, |
|||
"2": 20 |
|||
} |
|||
``` |
|||
|
|||
#### config.columnlen |
|||
- 类型:Object |
|||
- 默认值:{} |
|||
- 作用:每个单元格的列宽 |
|||
- 示例: |
|||
```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": [{ |
|||
"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, |
|||
"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" |
|||
} |
|||
}] |
|||
``` |
|||
|
|||
------------ |
|||
### 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 |
|||
} |
|||
] |
|||
``` |
|||
|
|||
------------ |
|||
### 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 |
|||
] |
|||
}, |
|||
{ |
|||
"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" |
|||
} |
|||
}, |
|||
{ |
|||
"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 |
|||
}] |
|||
``` |
|||
|
|||
------------ |
|||
### isPivotTable |
|||
- 类型:Boolean |
|||
- 默认值:false |
|||
- 作用: 是否数据透视表 |
|||
|
|||
------------ |
|||
### 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] |
|||
} |
|||
``` |
|||
|
|||
------------ |
|||
### 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 |
|||
} |
|||
``` |
|||
|
|||
------------ |
|||
### 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 |
|||
}, |
|||
"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": { |
|||
"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": "#6aa84f", |
|||
"bc": "#ffffff" |
|||
}, |
|||
"one": { |
|||
"fc": "#000", |
|||
"bc": "#ffffff" |
|||
}, |
|||
"two": { |
|||
"fc": "#000", |
|||
"bc": "#e5fbee" |
|||
}, |
|||
"foot": { |
|||
"fc": "#000", |
|||
"bc": "#a5efcc" |
|||
} |
|||
}] |
|||
``` |
|||
|
|||
------------ |
|||
### chart |
|||
- 类型:Array |
|||
- 默认值:[] |
|||
- 作用: 图表配置(开发中) |
|||
|
|||
------------ |
|||
### visibledatarow |
|||
- 类型:Number |
|||
- 默认值:[] |
|||
- 作用: 所有行的位置信息,递增的行位置数据,初始化无需设置 |
|||
|
|||
------------ |
|||
### visibledatacolumn |
|||
- 类型:Number |
|||
- 默认值:[] |
|||
- 作用: 所有列的位置信息,递增的列位置数据,初始化无需设置 |
|||
|
|||
------------ |
|||
### ch_width |
|||
- 类型:Number |
|||
- 默认值:2322 |
|||
- 作用: 整个工作表区域的宽度(包含边界的灰色区域),初始化无需设置 |
|||
|
|||
------------ |
|||
### rh_height |
|||
- 类型:Number |
|||
- 默认值:2322 |
|||
- 作用: 整个工作表区域的高度(包含边界的灰色区域),初始化无需设置 |
|||
|
|||
------------ |
|||
|
|||
|
|||
|
Loading…
Reference in new issue