Browse Source

docs(doc): doc

sheet, config
master
lrz 5 years ago
parent
commit
1e33eff17a
  1. 3
      README-zh.md
  2. 5
      README.md
  3. 9
      docs/zh/guide/cell.md
  4. 221
      docs/zh/guide/config.md
  5. 12
      docs/zh/guide/sheet.md
  6. 2
      src/global/draw.js
  7. 2
      src/index.html

3
README-zh.md

@ -171,7 +171,10 @@ npm run build
[英文社群](./README.md) [英文社群](./README.md)
## 贡献者和感谢 ## 贡献者和感谢
- [@wbfsa](https://github.com/wbfsa)
- [@wpxp123456](https://github.com/wpxp123456) - [@wpxp123456](https://github.com/wpxp123456)
- [@swen-xiong](https://github.com/swen-xiong)
- [@tonytonychopper123](https://github.com/tonytonychopper123)
- [@Dushusir](https://github.com/Dushusir) - [@Dushusir](https://github.com/Dushusir)
## 版权信息 ## 版权信息

5
README.md

@ -154,7 +154,7 @@ Create a table
}) })
</script> </script>
``` ```
## Join the co-construction ## Co-construction
If you want to implement an important function for Luckysheet, you need to write an RFC document first, follow Luckysheet's [RFC](https://github.com/mengshukeji/Luckysheet-rfcs) to operate, and submit the code after community discussion and improvement. If you want to implement an important function for Luckysheet, you need to write an RFC document first, follow Luckysheet's [RFC](https://github.com/mengshukeji/Luckysheet-rfcs) to operate, and submit the code after community discussion and improvement.
@ -169,7 +169,10 @@ If you want to implement an important function for Luckysheet, you need to write
[Chinese community](./README-zh.md) [Chinese community](./README-zh.md)
## Authors and acknowledgment ## Authors and acknowledgment
- [@wbfsa](https://github.com/wbfsa)
- [@wpxp123456](https://github.com/wpxp123456) - [@wpxp123456](https://github.com/wpxp123456)
- [@swen-xiong](https://github.com/swen-xiong)
- [@tonytonychopper123](https://github.com/tonytonychopper123)
- [@Dushusir](https://github.com/Dushusir) - [@Dushusir](https://github.com/Dushusir)
## License ## License

9
docs/zh/guide/cell.md

@ -147,6 +147,15 @@
</td> </td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>ae</td>
<td>allowEdit</td>
<td>是否允许编辑</td>
<td>
0: 只读,不可编辑 1:可以编辑,默认为 1
</td>
<td></td>
</tr>
</table> </table>
一个规范的单元格对象如下: 一个规范的单元格对象如下:

221
docs/zh/guide/config.md

@ -22,48 +22,59 @@ luckysheet.create(options)
这里的`options`配置项会作用于整个表格,特别的,单个sheet的配置则需要在`options.data`数组中,分别设置对应更详细的参数,参考[工作表配置](/zh/guide/sheet.html) 这里的`options`配置项会作用于整个表格,特别的,单个sheet的配置则需要在`options.data`数组中,分别设置对应更详细的参数,参考[工作表配置](/zh/guide/sheet.html)
针对个性化的需求,除了允许配置名称栏([showinfobar](#showinfobar))、工具栏([showtoolbar](#showtoolbar))、底部sheet页([showsheetbar](#showsheetbar))、底部计数栏([showstatisticBar](#showstatisticBar))之外,
Luckysheet开放了更细致的自定义配置选项,分别有
- 自定义工具栏([showtoolbarConfig](#showtoolbarConfig))
- 自定义底部sheet页([showsheetbarConfig](#showsheetbarConfig))
- 自定义计数栏([showstatisticBarConfig](#showstatisticBarConfig))
- 自定义添加行和回到顶部([sheetBottomConfig](#sheetBottomConfig))
- 自定义单元格右键菜单([cellRightClickConfig](#cellRightClickConfig))
- 自定义sheet页右击菜单([sheetRightClickConfig](#sheetRightClickConfig))
## 配置项 ## 配置项
以下为所有支持的设置参数 以下为所有支持的设置参数
- [container](#container) - 容器ID [container](#container)
- [title](#title) - 工作簿名称 [title](#title)
- [lang](#lang) - 语言 [lang](#lang)
- [gridKey](#gridKey) - 唯一key [gridKey](#gridKey)
- [loadUrl](#loadUrl) - 加载整个工作簿 [loadUrl](#loadUrl)
- [loadSheetUrl](#loadSheetUrl) - 加载其它页celldata [loadSheetUrl](#loadSheetUrl)
- [allowUpdate](#allowUpdate) - 允许更新 [allowUpdate](#allowUpdate)
- [updateUrl](#updateUrl) - 更新地址 [updateUrl](#updateUrl)
- [updateImageUrl](#updateImageUrl) - 缩略图更新地址 [updateImageUrl](#updateImageUrl)
- [data](#data) - 工作表配置 [data](#data)
- [plugins](#plugins) - 插件 [plugins](#plugins)
- [column](#column) - 列数 [column](#column)
- [row](#row) - 行数 [row](#row)
- [autoFormatw](#autoFormatw) - 亿万格式 [autoFormatw](#autoFormatw)
- [accuracy](#accuracy) - 精度 [accuracy](#accuracy)
- [allowCopy](#allowCopy) - 允许复制 [allowCopy](#allowCopy)
- [showtoolbar](#showtoolbar) - 工具栏 [showtoolbar](#showtoolbar)
- [showtoolbarConfig](#showtoolbarConfig) - 自定义工具栏[showtoolbarConfig](#showtoolbarConfig)
- [showinfobar](#showinfobar) - 名称栏 [showinfobar](#showinfobar)
- [showsheetbar](#showsheetbar) - 底部sheet页 [showsheetbar](#showsheetbar)
- [showsheetbarConfig](#showsheetbarConfig) - 自定义底部sheet页 [showsheetbarConfig](#showsheetbarConfig)
- [showstatisticBar](#showstatisticBar) - 底部计数栏 [showstatisticBar](#showstatisticBar)
- [showstatisticBarConfig](#showstatisticBarConfig) - 自定义计数栏 [showstatisticBarConfig](#showstatisticBarConfig)
- [allowEdit](#allowEdit) - 自定义添加行和回到顶部 [sheetBottomConfig](#sheetBottomConfig)
- [enableAddRow](#enableAddRow) - 允许编辑 [allowEdit](#allowEdit)
- [enableAddCol](#enableAddCol) - 允许增加行 [enableAddRow](#enableAddRow)
- [userInfo](#userInfo) - 允许增加列 [enableAddCol](#enableAddCol)
- [userMenuItem](#userMenuItem) - 用户信息 [userInfo](#userInfo)
- [myFolderUrl](#myFolderUrl) - 用户信息菜单 [userMenuItem](#userMenuItem)
- [devicePixelRatio](#devicePixelRatio) - 返回按钮链接 [myFolderUrl](#myFolderUrl)
- [functionButton](#functionButton) - 比例 [devicePixelRatio](#devicePixelRatio)
- [showConfigWindowResize](#showConfigWindowResize) - 功能按钮 [functionButton](#functionButton)
- [enablePage](#enablePage) - 自动缩进界面 [showConfigWindowResize](#showConfigWindowResize)
- [fullscreenmode](#fullscreenmode) - 加载下一页 [enablePage](#enablePage)
- [beforeCreateDom](#beforeCreateDom) - 全屏模式 [fullscreenmode](#fullscreenmode)
- [fireMousedown](#fireMousedown) - 刷新公式 [forceCalculation](#forceCalculation)
- [forceCalculation](#forceCalculation) - 自定义单元格右键菜单 [cellRightClickConfig](#cellRightClickConfig)
- [rightClickConfig](#rightClickConfig) - 自定义sheet页右击菜单 [sheetRightClickConfig](#sheetRightClickConfig)
### container ### container
- 类型:String - 类型:String
@ -74,7 +85,7 @@ luckysheet.create(options)
### title ### title
- 类型:String - 类型:String
- 默认值:"Luckysheet Demo" - 默认值:"Luckysheet Demo"
- 作用:表格的名称 - 作用:工作簿名称
------------ ------------
### lang ### lang
@ -167,7 +178,7 @@ luckysheet.create(options)
- 作用:是否第二列显示工具栏 - 作用:是否第二列显示工具栏
------------ ------------
#### showtoolbarConfig ### showtoolbarConfig
- 类型:Object - 类型:Object
- 默认值:{} - 默认值:{}
- 作用:自定义配置工具栏 - 作用:自定义配置工具栏
@ -218,13 +229,13 @@ luckysheet.create(options)
### showsheetbar ### showsheetbar
- 类型:Boolean - 类型:Boolean
- 默认值:true - 默认值:true
- 作用:是否显示底部表格名称区域 - 作用:是否显示底部sheet页按钮
------------ ------------
### showsheetbarConfig ### showsheetbarConfig
- 类型:Object - 类型:Object
- 默认值:{} - 默认值:{}
- 作用:自定义配置底部表格名称区域 - 作用:自定义配置底部sheet页按钮
- 格式: - 格式:
```json ```json
{ {
@ -252,6 +263,18 @@ luckysheet.create(options)
zoom: false // 缩放 zoom: false // 缩放
} }
------------
### sheetBottomConfig
- 类型:Object
- 默认值:{}
- 作用:sheet页下方的添加行按钮和回到顶部按钮配置
- 格式:
```json
{
addRow: false, // 添加行按钮
backTop: false // 回到顶部
}
------------ ------------
### allowEdit ### allowEdit
- 类型:Boolean - 类型:Boolean
@ -318,18 +341,6 @@ luckysheet.create(options)
- 默认值:true - 默认值:true
- 作用:是否全屏模式。非全屏模式下,标记框不会强制选中 - 作用:是否全屏模式。非全屏模式下,标记框不会强制选中
------------
### beforeCreateDom
- 类型:Function
- 默认值:null
- 作用:表格创建之前自定义方法
------------
### fireMousedown
- 类型:Function
- 默认值:null
- 作用:单元格数据下钻自定义方法
------------ ------------
### forceCalculation ### forceCalculation
- 类型:Boolean - 类型:Boolean
@ -343,33 +354,54 @@ luckysheet.create(options)
⚠️提醒,公式较多时会有性能问题,慎用! ⚠️提醒,公式较多时会有性能问题,慎用!
------------ ------------
### rightClickConfig ### cellRightClickConfig
- 类型:Object - 类型:Object
- 默认值:{} - 默认值:{}
- 作用:自定义配置右击菜单 - 作用:自定义配置单元格右击菜单
- 格式: - 格式:
```json ```json
{ {
copy:false, // '复制' copy: false, // '复制'
copyAs:false, // '复制为' copyAs: false, // '复制为'
paste:false, // '粘贴', paste: false, // '粘贴'
insert:false, // '插入', insert: false, // '插入'
delete:false, // '删除', delete: false, // '删除'
hide:false, // '隐藏', hide: false, // '隐藏'
deleteCell:false, // '删除单元格', deleteCell: false, // '删除单元格'
clear:false, // '清除内容', clear: false, // '清除内容'
matrix:false, // '矩阵操作选区', matrix: false, // '矩阵操作选区'
sort:false, // '排序选区', sort: false, // '排序选区'
filter:false, //'筛选选区', filter: false, //'筛选选区'
chart:false, // '图表生成', chart: false // '图表生成'
} }
------------
### sheetRightClickConfig
- 类型:Object
- 默认值:{}
- 作用:自定义配置sheet页右击菜单
- 格式:
```json
{
delete: false, // '删除'
copy: false, // '复制'
rename: false, //重命名
color: false, //更改颜色
hide: false, //隐藏
show: false, //取消隐藏
left: false, //向左移
right: false //向右移
}
------------
## 钩子函数 ## 钩子函数
钩子函数应用于二次开发时,会在各个常用鼠标或者键盘操作时植入钩子,调用开发者传入的函数,起到扩展Luckysheet功能的作用。 钩子函数应用于二次开发时,会在各个常用鼠标或者键盘操作时植入钩子,调用开发者传入的函数,起到扩展Luckysheet功能的作用。
钩子函数统一配置在`options.hook`下,可以分别针对单元格、sheet页、表格创建配置hook 钩子函数统一配置在`options.hook`下,可以分别针对单元格、sheet页、表格创建配置hook
------------
### cellHover ### cellHover
- 类型:Function - 类型:Function
- 默认值:null - 默认值:null
@ -380,38 +412,75 @@ luckysheet.create(options)
- {Object} [v]: 单元格对象 - {Object} [v]: 单元格对象
------------ ------------
### cellClickBefore ### cellClickBefore
- 类型:Function - 类型:Function
- 默认值:null - 默认值:null
- 作用:点击单元格前触发,即在点击单元格的时候,最先触发这个方法 - 作用:点击单元格前触发,即在点击单元格的时候,最先触发这个方法
------------ ------------
### cellClicked
### cellClickAfter
- 类型:Function - 类型:Function
- 默认值:null - 默认值:null
- 作用:点击单元格后触发,即在点击单元格的时候,最后触发这个方法 - 作用:点击单元格后触发,即在点击单元格的时候,最后触发这个方法
------------ ------------
### cellEditBefore
- 类型:Function
- 默认值:null
- 作用:双击单元格后触发,即在双击单元格编辑内容的时候,最先触发这个方法
------------
### cellEdited
- 类型:Function
- 默认值:null
- 作用:双击单元格后触发,即在双击单元格编辑内容的时候,最后触发这个方法
------------
### sheetClickBefore ### sheetClickBefore
- 类型:Function - 类型:Function
- 默认值:null - 默认值:null
- 作用:点击sheet页前触发 - 作用:点击sheet页前触发
------------ ------------
### sheetClicked
### sheetClickAfter
- 类型:Function - 类型:Function
- 默认值:null - 默认值:null
- 作用:点击sheet页后触发 - 作用:点击sheet页后触发
------------ ------------
### workbookCreateBefore
- 类型:Function
- 默认值:null
- 作用:表格创建之前触发。旧的钩子函数叫做`beforeCreateDom`
### sheetClickAfter ------------
### workbookCreated
- 类型:Function - 类型:Function
- 默认值:null - 默认值:null
- 作用:点击sheet页后触发 - 作用:表格创建之后触发
------------ ------------
### workbookUpdated
- 类型:Function
- 默认值:null
- 作用:表格创建之后触发
------------
### workbookDestroyBefore
- 类型:Function
- 默认值:null
- 作用:表格创建之后触发
------------
### workbookDestroyed
- 类型:Function
- 默认值:null
- 作用:表格创建之后触发
------------
### fireMousedown
- 类型:Function
- 默认值:null
- 作用:单元格数据下钻自定义方法
------------

12
docs/zh/guide/sheet.md

@ -37,8 +37,9 @@ options.data示例如下:
"luckysheet_alternateformat_save": [], //交替颜色 "luckysheet_alternateformat_save": [], //交替颜色
"luckysheet_alternateformat_save_modelCustom": [], //自定义交替颜色 "luckysheet_alternateformat_save_modelCustom": [], //自定义交替颜色
"luckysheet_conditionformat_save": {},//条件格式 "luckysheet_conditionformat_save": {},//条件格式
"frozen": {}, //冻结行列 "frozen": {}, //冻结行列配置
"chart": [], //图表配置 "chart": [], //图表配置
"allowEdit": true, //是否允许编辑
}, },
{ {
"name": "Sheet2", "name": "Sheet2",
@ -723,6 +724,12 @@ options.data示例如下:
- 默认值:[] - 默认值:[]
- 作用: 图表配置 - 作用: 图表配置
------------
### allowEdit
- 类型:Boolean
- 默认值:true
- 作用: 此sheet页是否允许编辑
------------ ------------
## 调试信息 ## 调试信息
@ -765,7 +772,8 @@ Luckysheet在初始化完成之后进行的一系列操作,会将更多本地
"luckysheet_alternateformat_save": [], //交替颜色 "luckysheet_alternateformat_save": [], //交替颜色
"luckysheet_alternateformat_save_modelCustom": [], //自定义交替颜色 "luckysheet_alternateformat_save_modelCustom": [], //自定义交替颜色
"luckysheet_conditionformat_save": {},//条件格式 "luckysheet_conditionformat_save": {},//条件格式
"freezen": {}, //冻结行列 "frozen": {}, //冻结行列配置
"freezen": {}, //冻结行列的渲染数据存储
"chart": [], //图表配置 "chart": [], //图表配置
"visibledatarow": [], //所有行的位置 "visibledatarow": [], //所有行的位置

2
src/global/draw.js

@ -716,7 +716,7 @@ function luckysheetDrawMain(scrollWidth, scrollHeight, drawWidth, drawHeight, of
let end_c = Store.visibledatacolumn[c] - scrollWidth; let end_c = Store.visibledatacolumn[c] - scrollWidth;
//数据透视表\ //数据透视表
if (!!Store.luckysheetcurrentisPivotTable && pivotTable.drawPivotTable) { if (!!Store.luckysheetcurrentisPivotTable && pivotTable.drawPivotTable) {
if ((c == 0 || c == 5) && r <= 11) { if ((c == 0 || c == 5) && r <= 11) {
luckysheetTableContent.beginPath(); luckysheetTableContent.beginPath();

2
src/index.html

@ -33,7 +33,7 @@
luckysheet.create({ luckysheet.create({
container: 'luckysheet', container: 'luckysheet',
lang: 'zh', lang: 'en',
allowEdit:true, allowEdit:true,
forceCalculation:false, forceCalculation:false,
plugins: ['chart'], plugins: ['chart'],

Loading…
Cancel
Save