Browse Source

feat(config): custom menu button config

1. Configuration increase: (1). Hide back to top button enableAddBackTop
master
mengshukeji 5 years ago
parent
commit
14eb78e153
  1. 46
      docs/guide/FAQ.md
  2. 4
      docs/guide/api.md
  3. 111
      docs/guide/config.md
  4. 25
      docs/zh/guide/FAQ.md
  5. 3
      docs/zh/guide/api.md
  6. 98
      docs/zh/guide/config.md
  7. 7
      src/config.js
  8. 102
      src/controllers/constant.js
  9. 80
      src/controllers/handler.js
  10. 2
      src/controllers/luckysheetConfigsetting.js
  11. 10
      src/controllers/resize.js
  12. 99
      src/controllers/rowColumnOperation.js
  13. 5
      src/core.js
  14. 3
      src/css/luckysheet-core.css
  15. 2
      src/global/api.js
  16. 4
      src/global/createdom.js

46
docs/guide/FAQ.md

@ -2,7 +2,7 @@
## **<span style="font-size:20px;">Q</span>** What is the difference between data and celldata in luckysheetfile?
**<span style="font-size:20px;">A</span>**: Use one-dimensional array format [celldata](/zh/guide/sheet.html#celldata), after the initialization is completed, the data converted into a two-dimensional array format is used for storage and update, and celldata is no longer used.
**<span style="font-size:20px;">A</span>**: Use one-dimensional array format [celldata](/guide/sheet.html#celldata), after the initialization is completed, the data converted into a two-dimensional array format is used for storage and update, and celldata is no longer used.
If you need to take out `data` as initial data, you need to execute [transToCellData(data)](/guide/api.html#transtocelldata-data-setting) to convert it to celldata data.
Among them, the celldata in `{ r, c, v }` format is converted to a two-dimensional array using [transToData(celldata)](/guide/api.html#transtodata-celldata-setting)
@ -20,7 +20,7 @@ luckysheet.transToData(celldata)
## **<span style="font-size:20px;">Q</span>** What are the cell types?
**<span style="font-size:20px;">A</span>**: Refer to [Cell Format List](/zh/guide/cell.html), with examples of available cell formats
**<span style="font-size:20px;">A</span>**: Refer to [Cell Format List](/guide/cell.html), with examples of available cell formats
------------
@ -35,13 +35,13 @@ luckysheet.transToData(celldata)
## **<span style="font-size:20px;">Q</span>** Why will the formula in the table not be triggered after initialization?
**<span style="font-size:20px;">A</span>** : Refer to [Table data format](/zh/guide/sheet.html#calcchain) ,just set the calcChain corresponding to the cell data.
**<span style="font-size:20px;">A</span>** : Refer to [Table data format](/guide/sheet.html#calcchain) ,just set the calcChain corresponding to the cell data.
------------
## **<span style="font-size:20px;">Q</span>** Is the remote loading data loadUrl or updateUrl?
**<span style="font-size:20px;">A</span>**: [loadUrl](/zh/guide/config.html#loadurl). Configure loadUrl, Luckysheet will request the entire table data through ajax, and updateUrl will be used as the interface address for collaborative editing in real-time saving.
**<span style="font-size:20px;">A</span>**: [loadUrl](/guide/config.html#loadurl). Configure loadUrl, Luckysheet will request the entire table data through ajax, and updateUrl will be used as the interface address for collaborative editing in real-time saving.
Note: Initial data needs to be configured with loadUrl and loadSheetUrl parameters, while for collaborative editing, the four parameters of loadUrl, loadSheetUrl, updateUrl and allowUpdate can be configured to take effect.
------------
@ -90,14 +90,14 @@ refer this article:
## **<span style="font-size:20px;">Q</span>** How to monitor cell hover or click events? how to monitor `cellRenderAfter` in real-time?
**<span style="font-size:20px;">A</span>** :我们搜集到需要针对单元格事件的二次开发需求,规划了单元格相关的钩子函数,参考[单元格钩子函数](/zh/guide/config.html#cellrenderafter)(显示的TODO的暂未开放)
**<span style="font-size:20px;">A</span>** :我们搜集到需要针对单元格事件的二次开发需求,规划了单元格相关的钩子函数,参考[单元格钩子函数](/guide/config.html#cellrenderafter)(显示的TODO的暂未开放)
------------
## **<span style="font-size:20px;">Q</span>** How to customize the top toolbar?
**<span style="font-size:20px;">A</span>** :
reference: [options.showtoolbarconfig](/zh/guide/config.html#showtoolbarconfig)(TODO means waiting to developed)
reference: [options.showtoolbarconfig](/guide/config.html#showtoolbarconfig)(TODO means waiting to developed)
------------
@ -113,7 +113,7 @@ if you want to remove jQuery in `Luckysheet`, you can find `jQuery` in source co
## **<span style="font-size:20px;">Q</span>** How to add a field to a cell object?
**<span style="font-size:20px;">A</span>** reference [cell object format](/zh/guide/cell.html),then read this annotation[src/controllers/postil.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/postil.js)。the annotation is a configuration in a cell object.
**<span style="font-size:20px;">A</span>** reference [cell object format](/guide/cell.html),then read this annotation[src/controllers/postil.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/postil.js)。the annotation is a configuration in a cell object.
------------
@ -121,7 +121,7 @@ if you want to remove jQuery in `Luckysheet`, you can find `jQuery` in source co
**<span style="font-size:20px;">A</span>** The luckysheet use iconfont icon in this project, if any icon cannot be loaded ,plz check your iconfont.css. we are so sorry that we did not describe it clearly in the old version documents.
Now the documents have been updated.[official documents](/zh/guide/#使用步骤)
Now the documents have been updated.[official documents](/guide/#steps-for-usage)
------------
@ -140,7 +140,7 @@ more information:[Luckyexcel](https://github.com/mengshukeji/Luckyexcel/)
## **<span style="font-size:20px;">Q</span>** How to disable editing of cells?How to open sheet protection?
**<span style="font-size:20px;">A</span>** Sheet protection includes disable editing of cells that you need to make some configurations on each sheets. `config.authority`, the latest configurations[sheet protection](/zh/guide/sheet.html#config-authority)。
**<span style="font-size:20px;">A</span>** Sheet protection includes disable editing of cells that you need to make some configurations on each sheets. `config.authority`, the latest configurations[sheet protection](/guide/sheet.html#config-authority)。
In order to make it easier for you to understand the function of sheet protection, the following video shows how to make the whole sheet uneditable, but allow a column of cells to be edited:
@ -152,7 +152,7 @@ In you local browser, you can open the control pannel, use `luckysheet.getLuckys
## **<span style="font-size:20px;">Q</span>** How to configure data validation?
**<span style="font-size:20px;">A</span>** there is the configuration of data validation,[data validation](/zh/guide/sheet.html#dataVerification)。Also there is the API that you can use `data validation` in any time. [setDataVerification](/zh/guide/api.html#setdataverification-optionitem-setting).
**<span style="font-size:20px;">A</span>** there is the configuration of data validation,[data validation](/guide/sheet.html#dataVerification)。Also there is the API that you can use `data validation` in any time. [setDataVerification](/guide/api.html#setdataverification-optionitem-setting).
------------
@ -181,6 +181,30 @@ if you want to get the position of the picture, you can overlap the picture with
**<span style="font-size:20px;">A</span>** There are two ways to get it
- 1. use `luckysheet.getLuckysheetfile()` to get all configuration data, so you can get the `defaultRowHeight` and `defaultColWidth` in the sheet configuration data。
- 2. use API to get the default row height [getDefaultRowHeight](/zh/guide/api.html#getdefaultrowheight-setting) and column width.[getDefaultColWidth](/zh/guide/api.html#getdefaultcolwidth-setting)
- 2. use API to get the default row height [getDefaultRowHeight](/guide/api.html#getdefaultrowheight-setting) and column width.[getDefaultColWidth](/guide/api.html#getdefaultcolwidth-setting)
------------
## **<span style="font-size:20px;">Q</span>** How to hide the add row button and the back to top button below the worksheet?
**<span style="font-size:20px;">A</span>** Configuration is open
- Allow adding rows [enableAddRow](/guide/config.html#enableaddrow)
- Allow back to top [enableAddBackTop](/guide/config.html#enableAddBackTop)
------------
## **<span style="font-size:20px;">Q</span>** How to hide the row and column headings of the worksheet?
**<span style="font-size:20px;">A</span>** Configuration is open
- The width of the row header area [rowHeaderWidth](/guide/config.html#rowheaderwidth)
- The height of the column header area [columeHeaderHeight](/guide/config.html#columeheaderheight)
------------
## **<span style="font-size:20px;">Q</span>** What method can be called to set `config.merge`?
**<span style="font-size:20px;">A</span>** Three methods
- Interface operation
- Use API: [setRangeMerge](/guide/api.html#setrangemerge-type-setting)
- Manually assemble merge parameters
------------

4
docs/guide/api.md

@ -1828,7 +1828,7 @@ Use note:
Return all worksheet configurations, the format is the same as the worksheet configuration, and the results obtained can be used as options.data when the form is initialized.
Therefore, this API is suitable for manually operating and configuring a table, and then taking out all the worksheet information to save it, and then use it for table creation in other places. If you want to get all the workbook data including the workbook configuration, you can use [toJson](#toJson())
Therefore, this API is suitable for manually operating and configuring a table, and then taking out all the worksheet information to save it, and then use it for table creation in other places. If you want to get all the workbook data including the workbook configuration, it is recommended to use [toJson](#toJson()), and it can be directly used to initialize Luckysheet.
- **Usage**:
@ -2568,8 +2568,6 @@ Use note:
### toJson()
[todo]
- **Explanation**
The exported json string can be directly used as the parameter `options` when the workbook is initialized by `luckysheet.create(options)`. The usage scenario is to manually save all the parameters after the user manipulates the table, and then initialize the table elsewhere. Use, similar to the import and export of a luckysheet proprietary format.

111
docs/guide/config.md

@ -28,7 +28,6 @@ Luckysheet has opened more detailed custom configuration options, which are as f
- Customize the toolbar ([showtoolbarConfig](#showtoolbarConfig))
- Customize the bottom sheet bar ([showsheetbarConfig](#showsheetbarConfig))
- Customize the counting bar ([showstatisticBarConfig](#showstatisticBarConfig))
- Custom add row and back to the top ([sheetBottomConfig](#sheetBottomConfig))
- Custom cell right-click menu ([cellRightClickConfig](#cellRightClickConfig))
- Customize the right-click menu of the bottom sheet bar ([sheetRightClickConfig](#sheetRightClickConfig))
@ -59,10 +58,9 @@ The following are all supported setting parameters
- Customize the bottom sheet bar [showsheetbarConfig](#showsheetbarConfig)
- The bottom count bar [showstatisticBar](#showstatisticBar)
- Custom Count Bar [showstatisticBarConfig](#showstatisticBarConfig)
- Custom add row and back to top [sheetBottomConfig](#sheetBottomConfig)
- Allow editing [allowEdit](#allowEdit)
- Allow adding rows [enableAddRow](#enableAddRow)
- Allow adding columns [enableAddCol](#enableAddCol)
- Allow back to top [enableAddBackTop](#enableAddBackTop)
- User Info [userInfo](#userInfo)
- User Information Menu [userMenuItem](#userMenuItem)
- Back button link [myFolderUrl](#myFolderUrl)
@ -73,8 +71,8 @@ The following are all supported setting parameters
- Refresh formula [forceCalculation](#forceCalculation)
- Custom cell right-click menu [cellRightClickConfig](#cellRightClickConfig)
- Customize the right-click menu of the bottom sheet bar [sheetRightClickConfig](#sheetRightClickConfig)
- Whether to show the row number area [showRowBar](#showRowBar)
- Whether to show the column number area [showColumnBar](#showColumnBar)
- The width of the row header area [rowHeaderWidth](#rowHeaderWidth)
- The height of the column header area [columeHeaderHeight](#columeHeaderHeight)
- Whether to show the formula bar [sheetFormulaBar](#sheetFormulaBar)
- Initialize the default font size [defaultFontSize](#defaultFontSize)
@ -350,21 +348,6 @@ Note that you also need to configure `loadUrl` and `loadSheetUrl` to take effect
}
```
------------
### sheetBottomConfig
[todo]
- Type: Object
- Default: {}
- Usage: Add row button and back to top button configuration below the worksheet
- Format:
```json
{
addRow: false, // Add row button
backTop: false // Back to the top
}
------------
### allowEdit
- Type: Boolean
- Default: true
@ -377,10 +360,10 @@ Note that you also need to configure `loadUrl` and `loadSheetUrl` to take effect
- Usage: Allow additional rows
------------
### enableAddCol
### enableAddBackTop
- Type: Boolean
- Default: true
- Usage: Allow adding columns
- Usage: Allow back to top
------------
### userInfo
@ -439,27 +422,61 @@ Note that you also need to configure `loadUrl` and `loadSheetUrl` to take effect
------------
### cellRightClickConfig
[todo]
- Type: Object
- Default: {}
- Usage: Custom configuration cell right-click menu
- Format:
```json
- Format:
```json
{
copy: false, //Copy
copyAs: false, //Copy as
paste: false, //Paste
insert: false, //Insert
delete: false, //Delete
hide: false, //Hide
deleteCell: false, //Delete cell
clear: false, //Clear content
matrix: false, //Matrix operation selection
sort: false, //Sort selection
filter: false, //Filter selection
chart: false //Chart generation
}
copy: false, // copy
copyAs: false, // copy as
paste: false, // paste
insertRow: false, // insert row
insertColumn: false, // insert column
deleteRow: false, // delete the selected row
deleteColumn: false, // delete the selected column
deleteCell: false, // delete cell
hideRow: false, // hide the selected row and display the selected row
hideColumn: false, // hide the selected column and display the selected column
rowHeight: false, // row height
columnWidth: false, // column width
clear: false, // clear content
matrix: false, // matrix operation selection
sort: false, // sort selection
filter: false, // filter selection
chart: false, // chart generation
image: false, // insert picture
link: false, // insert link
data: false, // data verification
cellFormat: false // Set cell format
}
```
In addition to the cells, the configuration here also includes the row header right-click menu, the column header right-click menu, and the column header drop-down arrow menu. The specific configuration relationships are as follows:
|Right-click menu configuration|Cell|Row header|Column header|Column arrow|
| ------------ | ------------ | ------------ | ----------- | ------------ |
|copy|copy|copy|copy|copy|
|copyAs|copy as|copy as|copy as|copy as|
|paste|paste|paste|paste|paste|
|insertRow|Insert a row|Increase N rows upwards and N rows downwards|-|-|
|insertColumn|Insert Column|-|Add N columns to the left and N columns to the right|Add N columns to the left and N columns to the right|
|deleteRow|Delete selected row|Delete selected row|-|-|
|deleteColumn|Delete selected column|-|Delete selected column|Delete selected column|
|deleteCell|Delete cell|-|-|-|
|hideRow|Hide the selected row and show the selected row|Hide the selected row and show the selected row|-|-|
|hideColumn|Hide the selected column and show the selected column|-|Hide the selected column and show the selected column|Hide the selected column and show the selected column|
|rowHeight|-|row height|-|-|
|columnWidth|-|-|Column Width|Column Width|
|clear|clear content|clear content|clear content|-|
|matrix|Matrix Operation Selection|Matrix Operation Selection|Matrix Operation Selection|-|
|sort|Sort selection|Sort selection|Sort selection|A-Z sort and Z-A sort|
|filter|Filter selection|Filter selection|Filter selection|-|
|chart|chart generation|chart generation|chart generation|-|
|image|Insert Picture|Insert Picture|Insert Picture|-|
|link|Insert link|Insert link|Insert link|-|
|data|Data Verification|Data Verification|Data Verification|-|
|cellFormat|Set cell format|Set cell format|Set cell format|-|
------------
### sheetRightClickConfig
@ -483,16 +500,16 @@ Note that you also need to configure `loadUrl` and `loadSheetUrl` to take effect
}
------------
### showRowBar
- Type: Boolean
- Default: true
- Usage: Whether to show the row number area
### rowHeaderWidth
- Type: Number
- Default: 46
- Usage: The width of the row header area, if set to 0, it means to hide the row header
------------
### showColumnBar
- Type: Boolean
- Default: true
- Usage: Whether to show the column number area
### columeHeaderHeight
- Type: Number
- Default: 20
- Usage: The height of the column header area, if set to 0, it means hide the column header
------------
### sheetFormulaBar

25
docs/zh/guide/FAQ.md

@ -184,4 +184,29 @@ Luckyexcel是excel导入导出库,项目采用了gulp作为打包工具,旧
- 一是使用`luckysheet.getLuckysheetfile()`获取到所有工作表配置后,在各个工作表的配置中直接取得默认行高`defaultRowHeight`和默认列宽`defaultColWidth`。
- 二是开放了API可以获取到工作表默认的行高[getDefaultRowHeight](/zh/guide/api.html#getdefaultrowheight-setting)和列宽[getDefaultColWidth](/zh/guide/api.html#getdefaultcolwidth-setting)
------------
## **<span style="font-size:20px;">Q</span>** 如何隐藏工作表下方的添加行按钮和回到顶部按钮?
**<span style="font-size:20px;">A</span>** 已开放配置
- 允许添加行 [enableAddRow](/zh/guide/config.html#enableaddrow)
- 允许回到顶部 [enableAddBackTop](/zh/guide/config.html#enableAddBackTop)
------------
## **<span style="font-size:20px;">Q</span>** 如何隐藏工作表的行标题和列标题?
**<span style="font-size:20px;">A</span>** 已开放配置
- 行标题区域的宽度 [rowHeaderWidth](/zh/guide/config.html#rowheaderwidth)
- 列标题区域的高度 [columeHeaderHeight](/zh/guide/config.html#columeheaderheight)
------------
## **<span style="font-size:20px;">Q</span>** 调用什么方法能设置`config.merge`?
**<span style="font-size:20px;">A</span>** 三个方法
- 界面操作
- 用API:[setRangeMerge](/zh/guide/api.html#setrangemerge-type-setting)
- 手动组装merge参数
------------

3
docs/zh/guide/api.md

@ -1791,7 +1791,7 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
返回所有工作表配置,格式同工作表配置,得到的结果可用于表格初始化时作为options.data使用。
所以此API适用于,手动操作配置完一个表格后,将所有工作表信息取出来自行保存,再用于其他地方的表格创建。如果想得到包括工作簿配置在内的所有工作簿数据,可以使用 [toJson](#toJson())
所以此API适用于,手动操作配置完一个表格后,将所有工作表信息取出来自行保存,再用于其他地方的表格创建。如果想得到包括工作簿配置在内的所有工作簿数据,推荐使用 [toJson](#toJson()),并且可以直接用于初始化Luckysheet。
- **示例**:
@ -2474,7 +2474,6 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
### toJson()
[todo]
- **说明**

98
docs/zh/guide/config.md

@ -28,7 +28,6 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 自定义工具栏([showtoolbarConfig](#showtoolbarConfig))
- 自定义底部sheet页([showsheetbarConfig](#showsheetbarConfig))
- 自定义计数栏([showstatisticBarConfig](#showstatisticBarConfig))
- 自定义添加行和回到顶部([sheetBottomConfig](#sheetBottomConfig))
- 自定义单元格右键菜单([cellRightClickConfig](#cellRightClickConfig))
- 自定义底部sheet页右击菜单([sheetRightClickConfig](#sheetRightClickConfig))
@ -60,10 +59,9 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 自定义底部sheet页 [showsheetbarConfig](#showsheetbarConfig)
- 底部计数栏 [showstatisticBar](#showstatisticBar)
- 自定义计数栏 [showstatisticBarConfig](#showstatisticBarConfig)
- 自定义添加行和回到顶部 [sheetBottomConfig](#sheetBottomConfig)
- 允许编辑 [allowEdit](#allowEdit)
- 允许加行 [enableAddRow](#enableAddRow)
- 允许增加列 [enableAddCol](#enableAddCol)
- 允许加行 [enableAddRow](#enableAddRow)
- 允许回到顶部 [enableAddBackTop](#enableAddBackTop)
- 用户信息 [userInfo](#userInfo)
- 用户信息菜单 [userMenuItem](#userMenuItem)
- 返回按钮链接 [myFolderUrl](#myFolderUrl)
@ -74,8 +72,8 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 刷新公式 [forceCalculation](#forceCalculation)
- 自定义单元格右键菜单 [cellRightClickConfig](#cellRightClickConfig)
- 自定义sheet页右击菜单 [sheetRightClickConfig](#sheetRightClickConfig)
- 是否显示行号区域 [showRowBar](#showRowBar)
- 是否显示列号区域 [showColumnBar](#showColumnBar)
- 行标题区域的宽度 [rowHeaderWidth](#rowHeaderWidth)
- 列标题区域的高度 [columeHeaderHeight](#columeHeaderHeight)
- 是否显示公式栏 [sheetFormulaBar](#sheetFormulaBar)
- 初始化默认字体大小 [defaultFontSize](#defaultFontSize)
@ -438,21 +436,6 @@ Luckysheet开放了更细致的自定义配置选项,分别有
}
```
------------
### sheetBottomConfig
[todo]
- 类型:Object
- 默认值:{}
- 作用:sheet页下方的添加行按钮和回到顶部按钮配置
- 格式:
```json
{
addRow: false, // 添加行按钮
backTop: false // 回到顶部
}
------------
### allowEdit
- 类型:Boolean
@ -463,13 +446,13 @@ Luckysheet开放了更细致的自定义配置选项,分别有
### enableAddRow
- 类型:Boolean
- 默认值:true
- 作用:允许加行
- 作用:允许加行
------------
### enableAddCol
### enableAddBackTop
- 类型:Boolean
- 默认值:true
- 作用:允许增加列
- 作用:允许回到顶部
------------
### userInfo
@ -528,8 +511,6 @@ Luckysheet开放了更细致的自定义配置选项,分别有
------------
### cellRightClickConfig
[todo]
- 类型:Object
- 默认值:{}
- 作用:自定义配置单元格右击菜单
@ -539,16 +520,51 @@ Luckysheet开放了更细致的自定义配置选项,分别有
copy: false, // 复制
copyAs: false, // 复制为
paste: false, // 粘贴
insert: false, // 插入
delete: false, // 删除
hide: false, // 隐藏
insertRow: false, // 插入行
insertColumn: false, // 插入列
deleteRow: false, // 删除选中行
deleteColumn: false, // 删除选中列
deleteCell: false, // 删除单元格
hideRow: false, // 隐藏选中行和显示选中行
hideColumn: false, // 隐藏选中列和显示选中列
rowHeight: false, // 行高
columnWidth: false, // 列宽
clear: false, // 清除内容
matrix: false, // 矩阵操作选区
sort: false, // 排序选区
filter: false, // 筛选选区
chart: false // 图表生成
chart: false, // 图表生成
image: false, // 插入图片
link: false, // 插入链接
data: false, // 数据验证
cellFormat: false // 设置单元格格式
}
```
除了单元格,这里的配置还包括行标题右击菜单、列标题右击菜单和列标题下拉箭头的菜单,具体配置关系如下表格:
|右击菜单配置|单元格|行标题|列标题|列箭头|
| ------------ | ------------ | ------------ | ------------ | ------------ |
|copy|复制|复制|复制|复制|
|copyAs|复制为|复制为|复制为|复制为|
|paste|粘贴|粘贴|粘贴|粘贴|
|insertRow|插入行|向上增加N行,向下增加N行|-|-|
|insertColumn|插入列|-|向左增加N列,向右增加N列|向左增加N列,向右增加N列|
|deleteRow|删除选中行|删除选中行|-|-|
|deleteColumn|删除选中列|-|删除选中列|删除选中列|
|hideRow|隐藏选中行和显示选中行|隐藏选中行和显示选中行|-|-|
|hideColumn|隐藏选中列和显示选中列|-|隐藏选中列和显示选中列|隐藏选中列和显示选中列|
|rowHeight|-|行高|-|-|
|columnWidth|-|-|列宽|列宽|
|clear|清除内容|清除内容|清除内容|-|
|matrix|矩阵操作选区|矩阵操作选区|矩阵操作选区|-|
|sort|排序选区|排序选区|排序选区|A-Z排序和Z-A排序|
|filter|筛选选区|筛选选区|筛选选区|-|
|chart|图表生成|图表生成|图表生成|-|
|image|插入图片|插入图片|插入图片|-|
|link|插入链接|插入链接|插入链接|-|
|data|数据验证|数据验证|数据验证|-|
|cellFormat|设置单元格格式|设置单元格格式|设置单元格格式|-|
------------
### sheetRightClickConfig
@ -572,22 +588,22 @@ Luckysheet开放了更细致的自定义配置选项,分别有
}
------------
### showRowBar
[todo]
- 类型:Boolean
- 默认值:true
- 作用:是否显示行号区域
### rowHeaderWidth
- 类型:Number
- 默认值:46
- 作用:行标题区域的宽度,如果设置为0,则表示隐藏行标题
------------
### showColumnBar
[todo]
- 类型:Boolean
- 默认值:true
- 作用:是否显示列号区域
### columeHeaderHeight
- 类型:Number
- 默认值:20
- 作用:列标题区域的高度,如果设置为0,则表示隐藏列标题
------------
### sheetFormulaBar
[todo]
- 类型:Boolean
- 默认值:true
- 作用:是否显示公式栏

7
src/config.js

@ -31,8 +31,8 @@ export default {
allowUpdate: false, //是否允许编辑后的后台更新
functionButton: "", //右上角功能按钮,例如'<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: true, //图表和数据透视表的配置会在右侧弹出,设置弹出后表格是否会自动缩进
enableAddRow: true,//允许加行
enableAddCol: true,//允许增加列
enableAddRow: true,//允许加行
enableAddBackTop: true,//允许回到顶部
enablePage: false,//允许加载下一页
autoFormatw: false, //自动格式化超过4位数的数字为 亿万格式 例:true or "true" or "TRUE"
accuracy: undefined, //设置传输来的数值的精确位数,小数点后n位 传参数为数字或数字字符串,例: "0" 或 0
@ -58,13 +58,10 @@ export default {
defaultRowHeight:19,
defaultFontSize:10,
showRowBar:true, //是否显示行号区域
showColumnBar:true, //是否显示列号区域
sheetFormulaBar:true, //是否显示公式栏
showtoolbarConfig:{}, //自定义工具栏
showsheetbarConfig:{}, //自定义底部sheet页
showstatisticBarConfig:{}, //自定义计数栏
sheetBottomConfig:{}, //自定义添加行和回到顶部
cellRightClickConfig:{}, //自定义单元格右键菜单
sheetRightClickConfig:{}, //自定义底部sheet页右击菜单
}

102
src/controllers/constant.js

@ -1,5 +1,6 @@
import locale from '../locale/locale';
import Store from '../store';
import luckysheetConfigsetting from './luckysheetConfigsetting';
//dom variable
const gridHTML = function(){
@ -259,36 +260,51 @@ function rightclickHTML(){
const rightclick = _locale.rightclick;
const toolbar = _locale.toolbar;
return `<div id="luckysheet-rightclick-menu" class="luckysheet-cols-menu luckysheet-rightgclick-menu luckysheet-mousedown-cancel">
<div id="luckysheet-copy-btn" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel luckysheet-copy-btn" data-clipboard-action="copy" data-clipboard-target="#luckysheet-copy-content">
const config = customCellRightClickConfig();
// 当一个功能菜单块内所有的按钮都隐藏的时候,它顶部的分割线也需要隐藏掉
let handleincellMenuseparator = true;
if(!config.insertRow && !config.insertColumn && !config.deleteRow && !config.deleteColumn && !config.deleteCell ){
handleincellMenuseparator = false;
}
let dataMenuseparator = true;
if(!config.clear && !config.matrix && !config.sort && !config.filter && !config.chart && !config.image && !config.link && !config.data && !config.cellFormat){
dataMenuseparator = false;
}
const rightclickContainer = `<div id="luckysheet-rightclick-menu" class="luckysheet-cols-menu luckysheet-rightgclick-menu luckysheet-mousedown-cancel">
<div id="luckysheet-copy-btn" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel luckysheet-copy-btn" data-clipboard-action="copy" data-clipboard-target="#luckysheet-copy-content" style="display:${config.copy ? 'block' : 'none'};">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${rightclick.copy}</div>
</div>
<div id="luckysheetcopyfor" class="luckysheet-cols-menuitem luckysheet-cols-submenu luckysheet-mousedown-cancel">
<div id="luckysheetcopyfor" class="luckysheet-cols-menuitem luckysheet-cols-submenu luckysheet-mousedown-cancel" style="display:${config.copyAs ? 'block' : 'none'};">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">
${rightclick.copyAs}<span class="luckysheet-submenu-arrow iconfont icon-youjiantou" style="user-select: none;"></span>
</div>
</div>
<div id="luckysheet-copy-paste" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel">
<div id="luckysheet-copy-paste" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="display:${config.paste ? 'block' : 'none'};">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${rightclick.paste}</div>
</div>
<div id="luckysheet-cols-rows-handleincell">
<div class="luckysheet-menuseparator luckysheet-mousedown-cancel" role="separator"></div>
<div id="luckysheetColsRowsHandleAdd_row" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel">
<div class="luckysheet-menuseparator luckysheet-mousedown-cancel" role="separator" style="display:${handleincellMenuseparator ? 'block' : 'none'};"></div>
<div id="luckysheetColsRowsHandleAdd_row" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="display:${config.insertRow ? 'block' : 'none'};">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">
${rightclick.insert}${rightclick.row}<span class="luckysheet-submenu-arrow" style="user-select: none;"></span>
</div>
</div>
<div id="luckysheetColsRowsHandleAdd_column" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel">
<div id="luckysheetColsRowsHandleAdd_column" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="display:${config.insertColumn ? 'block' : 'none'};">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">
${rightclick.insert}${rightclick.column}<span class="luckysheet-submenu-arrow" style="user-select: none;"></span>
</div>
</div>
<div id="luckysheet-delRows" class="luckysheet-cols-menuitem luckysheet-cols-submenu luckysheet-mousedown-cancel">
<div id="luckysheet-delRows" class="luckysheet-cols-menuitem luckysheet-cols-submenu luckysheet-mousedown-cancel" style="display:${config.deleteRow ? 'block' : 'none'};">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">
${rightclick.deleteSelected}${rightclick.row}<span class="luckysheet-submenu-arrow" style="user-select: none;"></span>
</div>
</div>
<div id="luckysheet-delCols" class="luckysheet-cols-menuitem luckysheet-cols-submenu luckysheet-mousedown-cancel">
<div id="luckysheet-delCols" class="luckysheet-cols-menuitem luckysheet-cols-submenu luckysheet-mousedown-cancel" style="display:${config.deleteColumn ? 'block' : 'none'};">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">
${rightclick.deleteSelected}${rightclick.column}<span class="luckysheet-submenu-arrow" style="user-select: none;"></span>
</div>
@ -300,7 +316,7 @@ function rightclickHTML(){
</div>
</div>
-->
<div id="luckysheetCellsHandleDel" class="luckysheet-cols-menuitem luckysheet-cols-submenu luckysheet-mousedown-cancel">
<div id="luckysheetCellsHandleDel" class="luckysheet-cols-menuitem luckysheet-cols-submenu luckysheet-mousedown-cancel" style="display:${config.deleteCell ? 'block' : 'none'};">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">
${rightclick.deleteCell}<span class="luckysheet-submenu-arrow iconfont icon-youjiantou" style="user-select: none;"></span>
</div>
@ -354,43 +370,43 @@ function rightclickHTML(){
</div>
</div>
<div id="luckysheet-cols-rows-shift">
<div class="luckysheet-menuseparator luckysheet-mousedown-cancel" role="separator"></div>
<div id="luckysheetorderbyasc" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel">
<div class="luckysheet-menuseparator luckysheet-mousedown-cancel" role="separator" style="display:${config.sort ? 'block' : 'none'};"></div>
<div id="luckysheetorderbyasc" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="display:${config.sort ? 'block' : 'none'};">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${rightclick.orderAZ}</div>
</div>
<div id="luckysheetorderbydesc" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel">
<div id="luckysheetorderbydesc" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="display:${config.sort ? 'block' : 'none'};">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${rightclick.orderZA}</div>
</div>
</div>
<div id="luckysheet-cols-rows-data">
<div class="luckysheet-menuseparator luckysheet-mousedown-cancel" role="separator"></div>
<div id="luckysheet-delete-text" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel">
<div class="luckysheet-menuseparator luckysheet-mousedown-cancel" role="separator" style="display:${dataMenuseparator ? 'block' : 'none'};"></div>
<div id="luckysheet-delete-text" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="display:${config.clear ? 'block' : 'none'};">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${rightclick.clearContent}</div>
</div>
<div id="luckysheetmatrix" class="luckysheet-cols-menuitem luckysheet-cols-submenu luckysheet-mousedown-cancel">
<div id="luckysheetmatrix" class="luckysheet-cols-menuitem luckysheet-cols-submenu luckysheet-mousedown-cancel" style="display:${config.matrix ? 'block' : 'none'};">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">
${rightclick.matrix}<span class="luckysheet-submenu-arrow iconfont icon-youjiantou" style="user-select: none;"></span>
</div>
</div>
<div id="luckysheetorderby" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel">
<div id="luckysheetorderby" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="display:${config.sort ? 'block' : 'none'};">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${rightclick.sortSelection}</div>
</div>
<div id="luckysheetfilter" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel">
<div id="luckysheetfilter" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="display:${config.filter ? 'block' : 'none'};">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${rightclick.filterSelection}</div>
</div>
<div id="luckysheetdatavisual" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel">
<div id="luckysheetdatavisual" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="display:${config.chart ? 'block' : 'none'};">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${rightclick.chartGeneration}</div>
</div>
<div id="luckysheetInsertImage" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel">
<div id="luckysheetInsertImage" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="display:${config.image ? 'block' : 'none'};">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${toolbar.insertImage}</div>
</div>
<div id="luckysheetInsertLink" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel">
<div id="luckysheetInsertLink" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="display:${config.link ? 'block' : 'none'};">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${toolbar.insertLink}</div>
</div>
<div id="luckysheetDataVerification" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel">
<div id="luckysheetDataVerification" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="display:${config.data ? 'block' : 'none'};">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${toolbar.dataVerification}</div>
</div>
<div id="luckysheetCellFormatRightClickMenu" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel">
<div id="luckysheetCellFormatRightClickMenu" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="display:${config.cellFormat ? 'block' : 'none'};">
<div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel">${toolbar.cellFormat}</div>
</div>
</div>
@ -576,6 +592,8 @@ function rightclickHTML(){
</div>
</div>
</div>`;
return rightclickContainer;
}
const pivottableconfigHTML = function(){
@ -1647,6 +1665,44 @@ const iconfontObjects = {
}
}
/**
*单元格右击菜单配置
*
*/
function customCellRightClickConfig() {
const config = {
copy: true, // copy
copyAs: true, // copy as
paste: true, // paste
insertRow: true, // insert row
insertColumn: true, // insert column
deleteRow: true, // delete the selected row
deleteColumn: true, // delete the selected column
deleteCell: true, // delete cell
hideRow: true, // hide the selected row and display the selected row
hideColumn: true, // hide the selected column and display the selected column
rowHeight: true, // row height
columnWidth: true, // column width
clear: true, // clear content
matrix: true, // matrix operation selection
sort: true, // sort selection
filter: true, // filter selection
chart: true, // chart generation
image: true, // insert picture
link: true, // insert link
data: true, // data verification
cellFormat: true // Set cell format
}
// cellRightClickConfig determines the final result
if(JSON.stringify(luckysheetConfigsetting.cellRightClickConfig) !== '{}'){
Object.assign(config,luckysheetConfigsetting.cellRightClickConfig);
}
console.info('=======cellRightClickConfig======'),
luckysheetConfigsetting.cellRightClickConfig = config;
return config;
}
export {
gridHTML,
columeHeader_word,

80
src/controllers/handler.js

@ -36,6 +36,7 @@ import {
showrightclickmenu,
luckysheetactiveCell,
luckysheetContainerFocus,
$$
} from '../utils/util';
import { getSheetIndex, getRangetxt } from '../methods/get';
import {
@ -1154,10 +1155,15 @@ export default function luckysheetHandler() {
let obj_s = Store.luckysheet_select_save[0];
const cellRightClickConfig = luckysheetConfigsetting.cellRightClickConfig;
$("#luckysheet-cols-rows-data").show();
$("#luckysheet-cols-rows-handleincell").show();
$("#luckysheet-cols-rows-add, #luckysheet-cols-rows-shift").hide();
$$('#luckysheet-cols-rows-data .luckysheet-menuseparator').style.display = 'block';
$$('#luckysheet-cols-rows-handleincell .luckysheet-menuseparator').style.display = 'block';
if (obj_s["row"] != null && obj_s["row"][0] == 0 && obj_s["row"][1] == Store.flowdata.length - 1) {
Store.luckysheetRightHeadClickIs = "column";
@ -1167,11 +1173,36 @@ export default function luckysheetHandler() {
$("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-right").text(locale().rightclick.right);
$("#luckysheet-cols-rows-add").show();
$("#luckysheet-cols-rows-data").show();
// $("#luckysheet-cols-rows-data").show();
$("#luckysheet-cols-rows-shift").hide();
$("#luckysheet-cols-rows-handleincell").hide();
Store.luckysheet_cols_menu_status = true;
$$('#luckysheet-cols-rows-add .luckysheet-menuseparator').style.display = 'block';
// 自定义右键菜单:向左向右增加列,删除列,隐藏显示列,设置列宽
$$('#luckysheet-top-left-add-selected').style.display = cellRightClickConfig.insertColumn ? 'block' : 'none';
$$('#luckysheet-bottom-right-add-selected').style.display = cellRightClickConfig.insertColumn ? 'block' : 'none';
$$('#luckysheet-del-selected').style.display = cellRightClickConfig.deleteColumn ? 'block' : 'none';
$$('#luckysheet-hide-selected').style.display = cellRightClickConfig.hideColumn ? 'block' : 'none';
$$('#luckysheet-show-selected').style.display = cellRightClickConfig.hideColumn ? 'block' : 'none';
$$('#luckysheet-column-row-width-selected').style.display = cellRightClickConfig.columnWidth ? 'block' : 'none';
// 1. 当一个功能菜单块上方的功能块按钮都隐藏的时候,下方的功能块的顶部分割线也需要隐藏
if(!cellRightClickConfig.copy && !cellRightClickConfig.copyAs && !cellRightClickConfig.paste){
$$('#luckysheet-cols-rows-add .luckysheet-menuseparator').style.display = 'none';
if(!cellRightClickConfig.insertColumn && !cellRightClickConfig.deleteColumn && !cellRightClickConfig.hideColumn && !cellRightClickConfig.columnWidth){
$$('#luckysheet-cols-rows-data .luckysheet-menuseparator').style.display = 'none';
}
}
// 2.当一个功能菜单块内所有的按钮都隐藏的时候,它顶部的分割线也需要隐藏掉
if(!cellRightClickConfig.insertColumn && !cellRightClickConfig.deleteColumn && !cellRightClickConfig.hideColumn && !cellRightClickConfig.columnWidth){
$$('#luckysheet-cols-rows-add .luckysheet-menuseparator').style.display = 'none';
}
//列宽默认值
let cfg = $.extend(true, {}, Store.config);
if (cfg["columnlen"] == null) {
@ -1210,12 +1241,36 @@ export default function luckysheetHandler() {
$("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-left").text(locale().rightclick.top);
$("#luckysheet-rightclick-menu .luckysheet-cols-rows-shift-right").text(locale().rightclick.bottom);
$("#luckysheet-cols-rows-add").show();
$("#luckysheet-cols-rows-data").show();
// $("#luckysheet-cols-rows-data").show();
$("#luckysheet-cols-rows-shift").hide();
$("#luckysheet-cols-rows-handleincell").hide();
Store.luckysheet_cols_menu_status = true;
$$('#luckysheet-cols-rows-add .luckysheet-menuseparator').style.display = 'block';
// 自定义右键菜单:向上向下增加行,删除行,隐藏显示行,设置行高
$$('#luckysheet-top-left-add-selected').style.display = cellRightClickConfig.insertRow ? 'block' : 'none';
$$('#luckysheet-bottom-right-add-selected').style.display = cellRightClickConfig.insertRow ? 'block' : 'none';
$$('#luckysheet-del-selected').style.display = cellRightClickConfig.deleteRow ? 'block' : 'none';
$$('#luckysheet-hide-selected').style.display = cellRightClickConfig.hideRow ? 'block' : 'none';
$$('#luckysheet-show-selected').style.display = cellRightClickConfig.hideRow ? 'block' : 'none';
$$('#luckysheet-column-row-width-selected').style.display = cellRightClickConfig.rowHeight ? 'block' : 'none';
// 1. 当一个功能菜单块上方的功能块按钮都隐藏的时候,下方的功能块的顶部分割线也需要隐藏
if(!cellRightClickConfig.copy && !cellRightClickConfig.copyAs && !cellRightClickConfig.paste){
$$('#luckysheet-cols-rows-add .luckysheet-menuseparator').style.display = 'none';
if(!cellRightClickConfig.insertRow && !cellRightClickConfig.deleteRow && !cellRightClickConfig.hideRow && !cellRightClickConfig.rowHeight){
$$('#luckysheet-cols-rows-data .luckysheet-menuseparator').style.display = 'none';
}
}
// 2. 当一个功能菜单块内所有的按钮都隐藏的时候,它顶部的分割线也需要隐藏掉
if(!cellRightClickConfig.insertRow && !cellRightClickConfig.deleteRow && !cellRightClickConfig.hideRow && !cellRightClickConfig.rowHeight){
$$('#luckysheet-cols-rows-add .luckysheet-menuseparator').style.display = 'none';
}
//行高默认值
let cfg = $.extend(true, {}, Store.config);
if (cfg["rowlen"] == null) {
@ -1245,8 +1300,27 @@ export default function luckysheetHandler() {
else {
$("#luckysheet-cols-rows-add").find("input[type='number'].rcsize").val("");
}
}else{
// 当一个功能菜单块上方的功能块按钮都隐藏的时候,下方的功能块的顶部分割线也需要隐藏
if(!cellRightClickConfig.copy && !cellRightClickConfig.copyAs && !cellRightClickConfig.paste){
$$('#luckysheet-cols-rows-handleincell .luckysheet-menuseparator').style.display = 'none';
if(!cellRightClickConfig.insertRow && !cellRightClickConfig.insertColumn && !cellRightClickConfig.deleteRow && !cellRightClickConfig.deleteColumn && !cellRightClickConfig.deleteCell){
$$('#luckysheet-cols-rows-data .luckysheet-menuseparator').style.display = 'none';
}
}
if(!cellRightClickConfig.insertRow && !cellRightClickConfig.insertColumn && !cellRightClickConfig.deleteRow && !cellRightClickConfig.deleteColumn && !cellRightClickConfig.deleteCell){
$$('#luckysheet-cols-rows-handleincell .luckysheet-menuseparator').style.display = 'none';
}
}
// 当一个功能菜单块内所有的按钮都隐藏的时候,它顶部的分割线也需要隐藏掉
if(!cellRightClickConfig.clear && !cellRightClickConfig.matrix && !cellRightClickConfig.sort && !cellRightClickConfig.filter && !cellRightClickConfig.chart && !cellRightClickConfig.image && !cellRightClickConfig.link && !cellRightClickConfig.data && !cellRightClickConfig.cellFormat){
$$('#luckysheet-cols-rows-data .luckysheet-menuseparator').style.display = 'none';
}
showrightclickmenu($("#luckysheet-rightclick-menu"), x, y);
}
}).dblclick(function (event) {

2
src/controllers/luckysheetConfigsetting.js

@ -19,7 +19,7 @@ const luckysheetConfigsetting = {
showConfigWindowResize: true,
enableAddRow: true,
enableAddCol: true,
enableAddBackTop: true,
enablePage: true,
pageInfo: null,

10
src/controllers/resize.js

@ -54,7 +54,15 @@ export default function luckysheetsizeauto(isRefreshCanvas=true) {
customStatisticBarConfig();
// 公式栏
Store.calculatebarHeight = document.querySelector('#luckysheet-wa-calculate').offsetHeight;
const formulaEle = document.querySelector("#" + Store.container + ' .luckysheet-wa-calculate');
if (!luckysheetConfigsetting.sheetFormulaBar) {
formulaEle.style.display = 'none';
Store.calculatebarHeight = 0;
}
else {
formulaEle.style.display = 'block';
Store.calculatebarHeight = formulaEle.offsetHeight;
}
$("#" + Store.container).find(".luckysheet-grid-container").css("top", Store.toolbarHeight + Store.infobarHeight + Store.calculatebarHeight);

99
src/controllers/rowColumnOperation.js

@ -10,6 +10,7 @@ import {
showrightclickmenu,
luckysheetContainerFocus,
luckysheetfontformat,
$$
} from '../utils/util';
import { getSheetIndex, getRangetxt } from '../methods/get';
import {
@ -37,6 +38,7 @@ import { luckysheet_searcharray } from '../controllers/sheetSearch';
import {isInlineStringCell} from './inlineString';
import {checkProtectionLockedRangeList, checkProtectionAllSelected,checkProtectionAuthorityNormal } from './protection';
import Store from '../store';
import luckysheetConfigsetting from './luckysheetConfigsetting';
export function rowColumnOperationInitial(){
@ -394,6 +396,38 @@ export function rowColumnOperationInitial(){
$("#luckysheet-cols-rows-shift").hide();
$("#luckysheet-cols-rows-handleincell").hide();
$$('#luckysheet-cols-rows-add .luckysheet-menuseparator').style.display = 'block';
$$('#luckysheet-cols-rows-data .luckysheet-menuseparator').style.display = 'block';
// 自定义右键菜单:向上向下增加行,删除行,隐藏显示行,设置行高
const cellRightClickConfig = luckysheetConfigsetting.cellRightClickConfig;
$$('#luckysheet-top-left-add-selected').style.display = cellRightClickConfig.insertRow ? 'block' : 'none';
$$('#luckysheet-bottom-right-add-selected').style.display = cellRightClickConfig.insertRow ? 'block' : 'none';
$$('#luckysheet-del-selected').style.display = cellRightClickConfig.deleteRow ? 'block' : 'none';
$$('#luckysheet-hide-selected').style.display = cellRightClickConfig.hideRow ? 'block' : 'none';
$$('#luckysheet-show-selected').style.display = cellRightClickConfig.hideRow ? 'block' : 'none';
$$('#luckysheet-column-row-width-selected').style.display = cellRightClickConfig.rowHeight ? 'block' : 'none';
// 1. 当一个功能菜单块上方的功能块按钮都隐藏的时候,下方的功能块的顶部分割线也需要隐藏
if(!cellRightClickConfig.copy && !cellRightClickConfig.copyAs && !cellRightClickConfig.paste){
$$('#luckysheet-cols-rows-add .luckysheet-menuseparator').style.display = 'none';
if(!cellRightClickConfig.insertRow && !cellRightClickConfig.deleteRow && !cellRightClickConfig.hideRow && !cellRightClickConfig.rowHeight){
$$('#luckysheet-cols-rows-data .luckysheet-menuseparator').style.display = 'none';
}
}
// 2. 当一个功能菜单块内所有的按钮都隐藏的时候,它顶部的分割线也需要隐藏掉
if(!cellRightClickConfig.insertRow && !cellRightClickConfig.deleteRow && !cellRightClickConfig.hideRow && !cellRightClickConfig.rowHeight){
$$('#luckysheet-cols-rows-add .luckysheet-menuseparator').style.display = 'none';
}
if(!cellRightClickConfig.clear && !cellRightClickConfig.matrix && !cellRightClickConfig.sort && !cellRightClickConfig.filter && !cellRightClickConfig.chart && !cellRightClickConfig.image && !cellRightClickConfig.link && !cellRightClickConfig.data && !cellRightClickConfig.cellFormat){
$$('#luckysheet-cols-rows-data .luckysheet-menuseparator').style.display = 'none';
}
showrightclickmenu($("#luckysheet-rightclick-menu"), $(this).offset().left + 46, event.pageY);
Store.luckysheet_cols_menu_status = true;
@ -790,6 +824,38 @@ export function rowColumnOperationInitial(){
$("#luckysheet-cols-rows-shift").hide();
$("#luckysheet-cols-rows-handleincell").hide();
$$('#luckysheet-cols-rows-add .luckysheet-menuseparator').style.display = 'block';
$$('#luckysheet-cols-rows-data .luckysheet-menuseparator').style.display = 'block';
// 自定义右键菜单:向左向右增加列,删除列,隐藏显示列,设置列宽
const cellRightClickConfig = luckysheetConfigsetting.cellRightClickConfig;
$$('#luckysheet-top-left-add-selected').style.display = cellRightClickConfig.insertColumn ? 'block' : 'none';
$$('#luckysheet-bottom-right-add-selected').style.display = cellRightClickConfig.insertColumn ? 'block' : 'none';
$$('#luckysheet-del-selected').style.display = cellRightClickConfig.deleteColumn ? 'block' : 'none';
$$('#luckysheet-hide-selected').style.display = cellRightClickConfig.hideColumn ? 'block' : 'none';
$$('#luckysheet-show-selected').style.display = cellRightClickConfig.hideColumn ? 'block' : 'none';
$$('#luckysheet-column-row-width-selected').style.display = cellRightClickConfig.columnWidth ? 'block' : 'none';
// 1. 当一个功能菜单块上方的功能块按钮都隐藏的时候,下方的功能块的顶部分割线也需要隐藏
if(!cellRightClickConfig.copy && !cellRightClickConfig.copyAs && !cellRightClickConfig.paste){
$$('#luckysheet-cols-rows-add .luckysheet-menuseparator').style.display = 'none';
if(!cellRightClickConfig.insertColumn && !cellRightClickConfig.deleteColumn && !cellRightClickConfig.hideColumn && !cellRightClickConfig.columnWidth){
$$('#luckysheet-cols-rows-data .luckysheet-menuseparator').style.display = 'none';
}
}
// 2. 当一个功能菜单块内所有的按钮都隐藏的时候,它顶部的分割线也需要隐藏掉
if(!cellRightClickConfig.insertColumn && !cellRightClickConfig.deleteColumn && !cellRightClickConfig.hideColumn && !cellRightClickConfig.columnWidth){
$$('#luckysheet-cols-rows-add .luckysheet-menuseparator').style.display = 'none';
}
if(!cellRightClickConfig.clear && !cellRightClickConfig.matrix && !cellRightClickConfig.sort && !cellRightClickConfig.filter && !cellRightClickConfig.chart && !cellRightClickConfig.image && !cellRightClickConfig.link && !cellRightClickConfig.data && !cellRightClickConfig.cellFormat){
$$('#luckysheet-cols-rows-data .luckysheet-menuseparator').style.display = 'none';
}
showrightclickmenu($("#luckysheet-rightclick-menu"), event.pageX, $(this).offset().top + 18);
Store.luckysheet_cols_menu_status = true;
@ -917,6 +983,7 @@ export function rowColumnOperationInitial(){
luckysheetcolsdbclick();
});
// 列标题的下拉箭头
$("#luckysheet-cols-menu-btn").click(function (event) {
let $menu = $("#luckysheet-rightclick-menu");
let offset = $(this).offset();
@ -931,6 +998,38 @@ export function rowColumnOperationInitial(){
$("#luckysheet-cols-rows-shift").show();
$("#luckysheet-cols-rows-handleincell").hide();
$$('#luckysheet-cols-rows-add .luckysheet-menuseparator').style.display = 'block';
$$('#luckysheet-cols-rows-shift .luckysheet-menuseparator').style.display = 'block';
// 自定义右键菜单:向左向右增加列,删除列,隐藏显示列,设置列宽
const cellRightClickConfig = luckysheetConfigsetting.cellRightClickConfig;
$$('#luckysheet-top-left-add-selected').style.display = cellRightClickConfig.insertColumn ? 'block' : 'none';
$$('#luckysheet-bottom-right-add-selected').style.display = cellRightClickConfig.insertColumn ? 'block' : 'none';
$$('#luckysheet-del-selected').style.display = cellRightClickConfig.deleteColumn ? 'block' : 'none';
$$('#luckysheet-hide-selected').style.display = cellRightClickConfig.hideColumn ? 'block' : 'none';
$$('#luckysheet-show-selected').style.display = cellRightClickConfig.hideColumn ? 'block' : 'none';
$$('#luckysheet-column-row-width-selected').style.display = cellRightClickConfig.columnWidth ? 'block' : 'none';
// 1. 当一个功能菜单块上方的功能块按钮都隐藏的时候,下方的功能块的顶部分割线也需要隐藏
if(!cellRightClickConfig.copy && !cellRightClickConfig.copyAs && !cellRightClickConfig.paste){
$$('#luckysheet-cols-rows-add .luckysheet-menuseparator').style.display = 'none';
if(!cellRightClickConfig.insertColumn && !cellRightClickConfig.deleteColumn && !cellRightClickConfig.hideColumn && !cellRightClickConfig.columnWidth){
$$('#luckysheet-cols-rows-shift .luckysheet-menuseparator').style.display = 'none';
}
}
// 2. 当一个功能菜单块内所有的按钮都隐藏的时候,它顶部的分割线也需要隐藏掉
if(!cellRightClickConfig.insertColumn && !cellRightClickConfig.deleteColumn && !cellRightClickConfig.hideColumn && !cellRightClickConfig.columnWidth){
$$('#luckysheet-cols-rows-add .luckysheet-menuseparator').style.display = 'none';
}
if(!cellRightClickConfig.sort){
$$('#luckysheet-cols-rows-shift .luckysheet-menuseparator').style.display = 'none';
}
showrightclickmenu($menu, offset.left, offset.top + 18);
Store.luckysheet_cols_menu_status = true;
});

5
src/core.js

@ -91,7 +91,8 @@ luckysheet.create = function (setting) {
luckysheetConfigsetting.showsheetbarConfig = extendsetting.showsheetbarConfig;
luckysheetConfigsetting.showstatisticBar = extendsetting.showstatisticBar;
luckysheetConfigsetting.showstatisticBarConfig = extendsetting.showstatisticBarConfig;
luckysheetConfigsetting.sheetBottomConfig = extendsetting.sheetBottomConfig;
luckysheetConfigsetting.sheetFormulaBar = extendsetting.sheetFormulaBar;
luckysheetConfigsetting.cellRightClickConfig = extendsetting.cellRightClickConfig;
luckysheetConfigsetting.pointEdit = extendsetting.pointEdit;
luckysheetConfigsetting.pointEditUpdate = extendsetting.pointEditUpdate;
luckysheetConfigsetting.pointEditZoom = extendsetting.pointEditZoom;
@ -103,7 +104,7 @@ luckysheet.create = function (setting) {
luckysheetConfigsetting.showConfigWindowResize = extendsetting.showConfigWindowResize;
luckysheetConfigsetting.enableAddRow = extendsetting.enableAddRow;
luckysheetConfigsetting.enableAddCol = extendsetting.enableAddCol;
luckysheetConfigsetting.enableAddBackTop = extendsetting.enableAddBackTop;
luckysheetConfigsetting.enablePage = extendsetting.enablePage;
luckysheetConfigsetting.pageInfo = extendsetting.pageInfo;

3
src/css/luckysheet-core.css

@ -1055,7 +1055,8 @@ div.luckysheet-sheets-m:hover {
top: 0;
width: 6px;
height: 100%;
z-index: 1005;
/* z-index: 1005; */
z-index: 1;/*因为会覆盖右击菜单,改为1*/
}
.docs-sheet-fade div {

2
src/global/api.js

@ -5373,6 +5373,8 @@ export function getAllSheets() {
}
delete item.load;
delete item.freezen;
})
return data;

4
src/global/createdom.js

@ -86,7 +86,9 @@ export default function luckysheetcreatedom(colwidth, rowheight, data, menu, tit
}
}
bottomControll += backControll;
if(luckysheetConfigsetting.enableAddBackTop){
bottomControll += backControll;
}
let flowstr = replaceHtml('<div id="luckysheetcoltable_0" class="luckysheet-cell-flow-col"> <div id ="luckysheet-sheettable_0" class="luckysheet-cell-sheettable" style="height:${height}px;width:${width}px;"></div><div id="luckysheet-bottom-controll-row" class="luckysheet-bottom-controll-row"> '+ bottomControll +' </div> </div>', { "height": Store.rh_height, "width": Store.ch_width - 1 });

Loading…
Cancel
Save