Browse Source

Merge branch 'master' of https://github.com/mengshukeji/Luckysheet into master

master
wbfsa 5 years ago
parent
commit
66a83dd135
  1. 18
      README-zh.md
  2. 19
      README.md
  3. 1
      docs/guide/FAQ.md
  4. 79
      docs/guide/api.md
  5. 936
      docs/guide/config.md
  6. 283
      docs/guide/operate.md
  7. 44
      docs/guide/sheet.md
  8. 1
      docs/zh/guide/FAQ.md
  9. 77
      docs/zh/guide/api.md
  10. 103
      docs/zh/guide/config.md
  11. 6
      docs/zh/guide/sheet.md
  12. 7
      gulpfile.js
  13. 2
      package.json
  14. 92
      src/assets/iconfont/demo_index.html
  15. 28
      src/assets/iconfont/iconfont.css
  16. BIN
      src/assets/iconfont/iconfont.eot
  17. 2
      src/assets/iconfont/iconfont.js
  18. 28
      src/assets/iconfont/iconfont.json
  19. 12
      src/assets/iconfont/iconfont.svg
  20. BIN
      src/assets/iconfont/iconfont.ttf
  21. BIN
      src/assets/iconfont/iconfont.woff
  22. BIN
      src/assets/iconfont/iconfont.woff2
  23. 13
      src/controllers/constant.js
  24. 4
      src/controllers/dataVerificationCtrl.js
  25. 9
      src/controllers/formulaBar.js
  26. 14
      src/controllers/inlineString.js
  27. 2
      src/controllers/keyboard.js
  28. 31
      src/controllers/menuButton.js
  29. 9
      src/controllers/print.js
  30. 17
      src/controllers/select.js
  31. 13
      src/controllers/sheetmanage.js
  32. 3
      src/controllers/updateCell.js
  33. 4
      src/css/iconCustom.css
  34. 13
      src/css/luckysheet-core.css
  35. 17859
      src/function/functionlist.js
  36. 4
      src/global/createdom.js
  37. 4
      src/global/getRowlen.js
  38. 103
      src/global/method.js
  39. 6
      src/index.html
  40. 8894
      src/locale/en.js
  41. 9981
      src/locale/es.js
  42. 4
      src/locale/locale.js
  43. 9039
      src/locale/zh.js
  44. 2
      src/store/index.js

18
README-zh.md

@ -21,10 +21,6 @@
- excel导入导出库: [Luckyexcel](https://github.com/mengshukeji/Luckyexcel)
- 图表插件: [chartMix](https://github.com/mengshukeji/chartMix)
## 支持
Luckysheet是MIT许可的开源项目,其持续的开发完全有赖于许多出色支持者的支持。如果您想加入他们,请考虑:
- [kickstarter](https://www.kickstarter.com/projects/luckysheet/luckysheet)
## 特性
### 🛠️格式设置
@ -160,6 +156,7 @@ npm run build
## 合作项目
- [鲁班h5](https://github.com/ly525/luban-h5)
- [excelize](https://github.com/360EntSecGroup-Skylar/excelize)
## 加入共建
@ -194,15 +191,26 @@ npm run build
### 团队成员
- [@wbfsa](https://github.com/wbfsa)
- [@wpxp123456](https://github.com/wpxp123456)
- [@swen-xiong](https://github.com/swen-xiong)
- [@tonytonychopper123](https://github.com/tonytonychopper123)
- [@Dushusir](https://github.com/Dushusir)
- [@c19c19i](https://weibo.com/u/3884623955)
### 活跃成员
- [@danielcai1987](https://github.com/danielcai1987)
- [@qq6690876](https://github.com/qq6690876)
- [@javahuang](https://github.com/javahuang)
- [@gsw945](https://github.com/gsw945)
- [@swen-xiong](https://github.com/swen-xiong)
## 捐赠
如果你感觉这个项目对你有用或者有所启发,可以请作者喝杯果汁:
| 微信 | 支付宝 |
|---|---|
| <img src="https://minio.cnbabylon.com/public/luckysheet/wechat.jpg" width="140" />| <img src="https://minio.cnbabylon.com/public/luckysheet/alipay.jpg" width="130" /> |
[Paypal Me](https://www.paypal.me/wbfsa)
## 版权信息
[MIT](http://opensource.org/licenses/MIT)

19
README.md

@ -27,10 +27,6 @@ English| [简体中文](./README-zh.md)
- Excel import and export library: [Luckyexcel](https://github.com/mengshukeji/Luckyexcel)
- Chart plugin: [chartMix](https://github.com/mengshukeji/chartMix)
## Support
Luckysheet is an MIT-licensed open source project with its ongoing development made possible entirely by the support of many awesome backers. If you'd like to join them, please consider:
- [kickstarter](https://www.kickstarter.com/projects/luckysheet/luckysheet)
## Features
### 🛠️Formatting
@ -165,6 +161,7 @@ Create a table
## Partner project
- [luban-h5](https://github.com/ly525/luban-h5)
- [excelize](https://github.com/360EntSecGroup-Skylar/excelize)
## Co-construction
@ -191,15 +188,27 @@ Create a table
### Team
- [@wbfsa](https://github.com/wbfsa)
- [@wpxp123456](https://github.com/wpxp123456)
- [@swen-xiong](https://github.com/swen-xiong)
- [@tonytonychopper123](https://github.com/tonytonychopper123)
- [@Dushusir](https://github.com/Dushusir)
- [@c19c19i](https://weibo.com/u/3884623955)
### Active participants
- [@danielcai1987](https://github.com/danielcai1987)
- [@qq6690876](https://github.com/qq6690876)
- [@javahuang](https://github.com/javahuang)
- [@gsw945](https://github.com/gsw945)
- [@swen-xiong](https://github.com/swen-xiong)
## Donate
If you find this project useful, you can buy author a glass of juice:
| WeChat | Alipay |
|---|---|
| <img src="https://minio.cnbabylon.com/public/luckysheet/wechat.jpg" width="140" />| <img src="https://minio.cnbabylon.com/public/luckysheet/alipay.jpg" width="130" /> |
[Paypal Me](https://www.paypal.me/wbfsa)
## License
[MIT](http://opensource.org/licenses/MIT)

1
docs/guide/FAQ.md

@ -42,6 +42,7 @@ luckysheet.buildGridData(luckysheetfile)
## **<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.
Note: Initial data needs to be configured with loadUrl and loadSheetUrl parameters, while for collaborative editing, in addition to the configuration of loadUrl and loadSheetUrl, updateUrl and allowUpdate must be configured to take effect.
------------

79
docs/guide/api.md

@ -212,6 +212,25 @@ Use note:
------------
### exitEditMode([,setting])
- **Parameter**
- {PlainObject} [setting]: optional parameters
+ {Function} [success]: callback function for the end of the operation
- **Explanation**
Exit edit mode. After double-clicking the cell with the mouse, it will enter the cell editing mode. After the editing is completed, when the mouse clicks on the input box elsewhere to lose focus, the editing mode will be exited, and the value of the cell will be saved. This Api is the operation of automatically exiting the editing mode, mainly to trigger the automatic saving of cells.
- **Usage**:
- Manually trigger to exit edit mode
`luckysheet.exitEditMode()`
------------
## Row and column operations
### setHorizontalFrozen(isRange [,setting])
@ -1994,6 +2013,48 @@ Use note:
------------
### showGridLines([setting])
- **Parameter**
- {PlainObject} [setting]: optional parameters
+ {Number} [order]: The subscript of the worksheet that needs to show the grid lines; the default value is the subscript of the current worksheet
+ {Function} [success]: callback function for the end of the operation
- **Explanation**
Show the grid lines of the specified subscript worksheet, and return the worksheet object of the operation
- **Usage**:
- Show the grid lines of the current worksheet
`luckysheet.showGridLines()`
- Show the grid lines of the third worksheet
`luckysheet.showGridLines({order:2})`
------------
### hideGridLines([setting])
- **Parameter**
- {PlainObject} [setting]: optional parameters
+ {Number} [order]: The subscript of the worksheet that needs to hdie the grid lines; the default value is the subscript of the current worksheet
+ {Function} [success]: callback function for the end of the operation
- **Explanation**
Hide the grid lines of the specified subscript worksheet, and return the worksheet object of the operation
- **Usage**:
- Hide grid lines of current worksheet
`luckysheet.hideGridLines()`
- Hide the grid lines of the third worksheet
`luckysheet.hideGridLines({order:2})`
------------
## Workbook operations
### create(options [,setting])
@ -2136,7 +2197,23 @@ Use note:
------------
## chart
### refreshFormula([setting])
[todo]
- **Parameter**
- {PlainObject} [setting]: optional parameters
+ {Object | String} [range]: Set the target selection range of the parameter. The supported selection format is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1], column:[0,1]}`, allows an array of multiple selections; the default is the current selection ;The default is the entire current worksheet
+ {Function} [success]: callback function for the end of the operation
- **Explanation**
Force refresh formula. When you directly modify the values of multiple cells without triggering a refresh, and these cells are associated with formulas, you can use this API to force a formula refresh to be triggered at the end. It is generally recommended to specify the affected cell range to prevent For performance issues, if you can't determine it, leave it blank to keep the entire worksheet traversed and refreshed.
------------
## Chart
### insertChart([setting])

936
docs/guide/config.md

File diff suppressed because it is too large

283
docs/guide/operate.md

@ -1,16 +1,28 @@
# Table Operation
`luckysheet` stores all operations in the history to `undo` and `redo`. If `allowupdate` is set to true and `updateURL` is available in initial, operations will be updated on the backend in real-time via webSocket. And every one can edit same sheet on the same time.
## Cell refresh
>Source code [`src/controllers/server.js`] (https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/server.js) The module shows us the function of background saving.
In general, shared editing(or collaborative editing) is controled by the account system created by developers to control permissions.
The following are all types of operations that support transferring to the background. In this case, I use mongodb as a storage example to explain how front-end and back-end interacts with eachother.
Pay attention, `i` in the object is the `index` of the sheet rather than `order`.
## Cell refresh
### single cell refresh
- **Format**
```json
{
"t": "v",
"i": 3,
"v": "asdf",
"r": 5,
"c": 7
"i": "Sheet_0554kKiKl4M7_1597974810804",
"v": {
"v": 233,
"ct": { "fa": "General", "t": "n" },
"m": "233"
},
"r": 0,
"c": 1
}
```
@ -20,7 +32,7 @@
| ------------ | ------------ |
|t|Operation type symbol|
|i|The index value of the current sheet|
|v|Cell value|
|v|Cell value, refer to [单元格属性表](/zh/guide/cell.html#基本单元格)|
|r|Row number of cell|
|c|The column number of the cell|
@ -515,6 +527,43 @@
Delete the sheet whose index is the value corresponding to `deleIndex`.
### restore from a deleted sheet
- **format**
```json
{
"t": "shre",
"i": null,
"v": {
"reIndex": "0"
}
}
```
- **Explanation**
<table>
<tr>
<td colspan="2">Parameter</td>
<td>Explanation</td>
</tr>
<tr>
<td colspan="2">t</td>
<td>Operation type symbol</td>
</tr>
<tr>
<td rowspan="2">v</td>
<td>deleIndex</td>
<td>需要恢复的sheet索引</td>
</tr>
</table>
- **Backend update**
restore the sheet whose index is the number of `reIndex`.
### Position
- **Format**
@ -522,8 +571,17 @@
```json
{
"t": "shr",
"i": null,
"v": {
"index": "positon"
"0": 1,
"1": 0,
"2": 2,
"3": 3,
"4": 4,
"5": 5,
"6": 6,
"7": 7,
"Sheet_6az6nei65t1i_1596209937084": 8
}
}
```
@ -543,6 +601,31 @@
`luckysheetfile[key2].order = value2`
`luckysheetfile[key3].order = value3`
### switch to the specified sheet
- **format**
```json
{
"t": "shs",
"i": null,
"v": 1
}
```
- **Explanation**
|Parameter|Explanation|
| ------------ | ------------ |
|t|Operation type symbol|
|v|index of the specified sheet|
- **Backend update**
setting the `status` = `1`, when the `index` of a sheet is eaqul to `v`
`luckysheetfile[v].status = 1`
## Sheet attributes (hide or show)
- **Format**
@ -618,4 +701,188 @@
- **Backend update**
According to gridkey, update the thumbnail field of the table in mysql to the img value, and update the status field of the sheet whose index is the curindex value to 1, and set the status value of other sheets to 0.
According to gridkey, update the thumbnail field of the table in mysql to the img value, and update the status field of the sheet whose index is the curindex value to 1, and set the status value of other sheets to 0.
## Chart(TODO)
There are four types of chart operations: add new chart -"add", move chart position-"xy", zoom chart-"wh", and update chart configuration-"update".
### new chart
- **format**
```json
{
"t": "c",
"i": 0,
"op":"add",
"v": {
"chart_id": "chart_p145W6i73otw_1596209943446",
"width": 400,
"height": 250,
"left": 20,
"top": 120,
"sheetIndex": "Sheet_6az6nei65t1i_1596209937084",
"needRangeShow": true,
"chartOptions": {
"chart_id": "chart_p145W6i73otw_1596209943446",
"chartAllType": "echarts|line|default",
"rangeArray": [ { "row": [ 0, 4 ], "column": [ 0, 7 ] } ],
"rangeColCheck": { "exits": true, "range": [ 0, 0 ] },
"rangeRowCheck": { "exits": true, "range": [ 0, 0 ] },
"rangeConfigCheck": false,
"defaultOption": {
"title": {
"show": true,
"text": "default title"
}
}
},
"isShow": true
}
}
```
- **Explanation**
|Parameter|Explanation|
| ------------ | ------------ |
|t|Operation type symbol|
|i|The index value of the current sheet|
|op|Operation options include hide and show|
|v|configuration information of charts|
- **Backend update**
update the chart settings in the current sheet,if`luckysheetfile[i].chart` is null,the array should be `[]` on initial.
```json
luckysheetfile[0].chart.push(v)
```
### move chart position
- **format**
```json
{
"t": "c",
"i": 0,
"op":"xy",
"v": {
"chart_id": "chart_p145W6i73otw_1596209943446",
"left": 20,
"top": 120
}
}
```
- **Explanation**
|Parameter|Explanation|
| ------------ | ------------ |
|t|Operation type symbol|
|i|The index value of the current sheet|
|op|Operation options include hide and show|
|v|configuration information of charts|
- **Backend update**
update the chart settings in the current sheet
```js
luckysheetfile[0].chart[v.chart_id].left = v.left;
luckysheetfile[0].chart[v.chart_id].top = v.top;
```
### zoom chart
- **format**
```json
{
"t": "c",
"i": 0,
"op":"wh",
"v": {
"chart_id": "chart_p145W6i73otw_1596209943446",
"width": 400,
"height": 250,
"left": 20,
"top": 120
}
}
```
- **Explanation**
|Parameter|Explanation|
| ------------ | ------------ |
|t|Operation type symbol|
|i|The index value of the current sheet|
|op|Operation options include hide and show|
|v|configuration information of charts|
- **Backend update**
update the chart settings in the current sheet
```js
luckysheetfile[0].chart[v.chart_id].left = v.left;
luckysheetfile[0].chart[v.chart_id].top = v.top;
luckysheetfile[0].chart[v.chart_id].width = v.width;
luckysheetfile[0].chart[v.chart_id].height = v.height;
```
### change the configuration of charts
- **format**
```json
{
"t": "c",
"i": 0,
"op":"update",
"v": {
"chart_id": "chart_p145W6i73otw_1596209943446",
"width": 400,
"height": 250,
"left": 20,
"top": 120,
"sheetIndex": "Sheet_6az6nei65t1i_1596209937084",
"needRangeShow": true,
"chartOptions": {
"chart_id": "chart_p145W6i73otw_1596209943446",
"chartAllType": "echarts|line|default",
"rangeArray": [ { "row": [ 0, 4 ], "column": [ 0, 7 ] } ],
"rangeColCheck": { "exits": true, "range": [ 0, 0 ] },
"rangeRowCheck": { "exits": true, "range": [ 0, 0 ] },
"rangeConfigCheck": false,
"defaultOption": {
"title": {
"show": true,
"text": "default title"
}
}
},
"isShow": true
}
}
```
- **Explanation**
|Parameter|Explanation|
| ------------ | ------------ |
|t|Operation type symbol|
|i|The index value of the current sheet|
|op|Operation options include hide and show|
|v|configuration information of charts|
- **Backend update**
update the chart settings in the current sheet
```js
luckysheetfile[0].chart[v.chart_id] = v;
```

44
docs/guide/sheet.md

@ -43,6 +43,8 @@ eg: options.data:
"chart": [], //Chart configuration
"allowEdit": true, //is editable
"zoomRatio":1, // zoom ratio
"image":[], //image
"showGridLines": 1, //Whether to show grid lines
},
{
"name": "Sheet2",
@ -1219,6 +1221,48 @@ eg: options.data:
- default:1
- usage: the zoom ratio of a sheet, which is a two decimal digit between 0~1, like `0.1`、`0.56`.
------------
### image
- type:Array
- default:[]
- usage: Insert the picture information in the table, including picture address, width and height, position, cropping and other information
- example:
The following is an example of `imageItem`, usually there may be multiple images in a worksheet, so the format of `image` is array `[imageItem,imageItem,...]`
```json
{
type: '3', //1 Move and resize the cell 2 Move and do not resize the cell 3 Don't move and resize the cell
src:'', //image url
originWidth: 1484, //The original width of the picture
originHeight: 834, //The original height of the picture
default: {
width: 293, //image width
height: 196, //image height
left: 409, //The position of the picture from the left of the table
top: 248, //The position of the picture from the top of the table
},
crop: {
width: 293, //The width of the picture after cropping
height: 196, //The height of the picture after cropping
offsetLeft: 0, //Displacement from the left of the picture after cropping
offsetTop: 0, //Displacement from the left of the picture after cropping
},
isFixedPos: false, //Fixed position
fixedLeft: 507, //Fixed position left displacement
fixedTop: 141, //fixed position right displacement
border: {
width: 0, //border width
radius: 0, //Border radius
style:'solid', //border type
color:'#000', //Border color
}
}
```
------------
### showGridLines
- Type: Number
- Default: 1
- Usage: Whether to show grid lines, `1` means show, `0` means hidden
------------
## debug information

1
docs/zh/guide/FAQ.md

@ -42,6 +42,7 @@ luckysheet.buildGridData(luckysheetfile)
## **<span style="font-size:20px;">Q</span>** 远端加载数据是loadUrl还是updateUrl?
**<span style="font-size:20px;">A</span>** : [loadUrl](/zh/guide/config.html#loadurl)。配置了loadUrl,Luckysheet会通过ajax请求整个表格数据,而updateUrl会作为协同编辑实时保存的接口地址。
注意:初始化数据需要配置loadUrl和loadSheetUrl参数,而协同编辑则在配置loadUrl和loadSheetUrl的基础上,还要配置updateUrl和allowUpdate才能生效。
------------

77
docs/zh/guide/api.md

@ -215,6 +215,25 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
------------
### exitEditMode([,setting])
- **参数**
- {PlainObject} [setting]: 可选参数
+ {Function} [success]: 操作结束的回调函数
- **说明**
退出编辑模式。鼠标双击单元格后,会进入单元格编辑模式,编辑完成后,当鼠标再次点击别的地方输入框失焦的时候,则会退出编辑模式,随即单元格的值会进行保存。此Api就是自动退出编辑模式的操作,主要是为了触发自动保存单元格。
- **示例**:
- 手动触发退出编辑模式
`luckysheet.exitEditMode()`
------------
## 行和列操作
### setHorizontalFrozen(isRange [,setting])
@ -1941,6 +1960,48 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
------------
### showGridLines([setting])
- **参数**
- {PlainObject} [setting]: 可选参数
+ {Number} [order]: 需要显示网格线的工作表下标;默认值为当前工作表下标
+ {Function} [success]: 操作结束的回调函数
- **说明**
显示指定下标工作表的网格线,返回操作的工作表对象
- **示例**:
- 显示当前工作表的网格线
`luckysheet.showGridLines()`
- 显示第三个工作表的网格线
`luckysheet.showGridLines({order:2})`
------------
### hideGridLines([setting])
- **参数**
- {PlainObject} [setting]: 可选参数
+ {Number} [order]: 需要隐藏网格线的工作表下标;默认值为当前工作表下标
+ {Function} [success]: 操作结束的回调函数
- **说明**
隐藏指定下标工作表的网格线,返回操作的工作表对象
- **示例**:
- 隐藏当前工作表的网格线
`luckysheet.hideGridLines()`
- 隐藏第三个工作表的网格线
`luckysheet.hideGridLines({order:2})`
------------
## 工作簿操作
### create(options [,setting])
@ -2083,6 +2144,22 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
------------
### refreshFormula([setting])
[todo]
- **参数**
- {PlainObject} [setting]: 可选参数
+ {Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为整个当前工作表
+ {Function} [success]: 操作结束的回调函数
- **说明**
强制刷新公式。当你直接修改了多个单元格的值,且没有触发刷新,且这些单元格跟公式相关联,则可以使用这个api最后强制触发一次公式刷新,一般是建议指定受影响的单元格范围便于防止性能问题,如果无法确定,则留空保持整个工作表遍历刷新。
------------
## 图表
### insertChart([setting])

103
docs/zh/guide/config.md

@ -22,7 +22,7 @@ luckysheet.create(options)
这里的`options`配置项会作用于整个表格,特别的,单个sheet的配置则需要在`options.data`数组中,分别设置对应更详细的参数,参考[工作表配置](/zh/guide/sheet.html)
针对个性化的需求,除了允许配置名称栏([showinfobar](#showinfobar))、工具栏([showtoolbar](#showtoolbar))、底部sheet页([showsheetbar](#showsheetbar))、底部计数栏([showstatisticBar](#showstatisticBar))之外,
针对个性化的需求,除了允许配置信息栏([showinfobar](#showinfobar))、工具栏([showtoolbar](#showtoolbar))、底部sheet页([showsheetbar](#showsheetbar))、底部计数栏([showstatisticBar](#showstatisticBar))之外,
Luckysheet开放了更细致的自定义配置选项,分别有
- 自定义工具栏([showtoolbarConfig](#showtoolbarConfig))
@ -30,7 +30,7 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 自定义计数栏([showstatisticBarConfig](#showstatisticBarConfig))
- 自定义添加行和回到顶部([sheetBottomConfig](#sheetBottomConfig))
- 自定义单元格右键菜单([cellRightClickConfig](#cellRightClickConfig))
- 自定义sheet页右击菜单([sheetRightClickConfig](#sheetRightClickConfig))
- 自定义底部sheet页右击菜单([sheetRightClickConfig](#sheetRightClickConfig))
## 配置项
@ -53,10 +53,9 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 亿万格式 [autoFormatw](#autoFormatw)
- 精度 [accuracy](#accuracy)
- 允许复制 [allowCopy](#allowCopy)
- 网格线 [showGridLines](#showGridLines)
- 工具栏 [showtoolbar](#showtoolbar)
- 自定义工具栏[showtoolbarConfig](#showtoolbarConfig)
- 名称栏 [showinfobar](#showinfobar)
- 信息栏 [showinfobar](#showinfobar)
- 底部sheet页 [showsheetbar](#showsheetbar)
- 自定义底部sheet页 [showsheetbarConfig](#showsheetbarConfig)
- 底部计数栏 [showstatisticBar](#showstatisticBar)
@ -75,6 +74,10 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 刷新公式 [forceCalculation](#forceCalculation)
- 自定义单元格右键菜单 [cellRightClickConfig](#cellRightClickConfig)
- 自定义sheet页右击菜单 [sheetRightClickConfig](#sheetRightClickConfig)
- 是否显示行号区域 [showRowBar](#showRowBar)
- 是否显示列号区域 [showColumnBar](#showColumnBar)
- 是否显示公式栏 [sheetFormulaBar](#sheetFormulaBar)
- 初始化默认字体大小 [defaultFontSize](#defaultFontSize)
### container
- 类型:String
@ -103,13 +106,15 @@ Luckysheet开放了更细致的自定义配置选项,分别有
### loadUrl
- 类型:String
- 默认值:""
- 作用:配置`loadUrl`的地址,Luckysheet会通过ajax请求整个表格数据,默认载入status为1的sheet数据中的所有`celldata`,其余的sheet载入除`celldata`字段外的所有字段。但是考虑到一些公式、图表及数据透视表会引用其他sheet的数据,所以前台会加一个判断,如果该当前sheet引用了其他sheet的数据则把引用到的sheet的数据一并补全。
- 作用:配置`loadUrl`的地址,与`loadSheetUrl`配合使用,一般用于大数据量的时候。也可以不用Luckysheet提供的接口参数,使用[data](#data)参数可以提前准备好所有表格数据用于初始化。
Luckysheet会通过ajax请求整个表格数据,默认载入status为1的sheet数据中的所有`celldata`,其余的sheet载入除`celldata`字段外的所有字段。但是考虑到一些公式、图表及数据透视表会引用其他sheet的数据,所以前台会加一个判断,如果该当前sheet引用了其他sheet的数据则会通过`loadSheetUrl`配置的接口地址请求数据,把引用到的sheet的数据一并补全。因为 `loadUrl`只负责当前页数据,所以还需要配置`loadSheetUrl`作为异步加载数据的接口。
------------
### loadSheetUrl
- 类型:String
- 默认值:""
- 作用:配置`loadSheetUrl`的地址,参数为`gridKey`(表格主键) 和 `index`(sheet主键合集,格式为`[1,2,3]`),返回的数据为sheet的`celldata`字段数据集合
- 作用:配置`loadSheetUrl`的地址,参数为`gridKey`(表格主键) 和 `index`(sheet主键合集,格式为`["sheet_01","sheet_02","sheet_0"]`),返回的数据为sheet的`celldata`字段数据集合。为了加载性能考虑,除了第一次加载当前页的`celldata`数据之外,其余sheet的数据,是在切换到那个sheet页的时候,才会请求那一页的数据。
------------
### allowUpdate
@ -121,7 +126,9 @@ Luckysheet开放了更细致的自定义配置选项,分别有
### updateUrl
- 类型:String
- 默认值:""
- 作用:操作表格后的后台更新地址,在`allowUpdate`为`true`时才会有效
- 作用:操作表格后的后台更新地址,在`allowUpdate`为`true`时才会有效,此接口也是共享编辑的接口地址。
注意,还需要配置`loadUrl`和`loadSheetUrl`才能生效
------------
### updateImageUrl
@ -171,17 +178,11 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 默认值:true
- 作用:是否允许拷贝
------------
### showGridLines
- 类型:Number
- 默认值:1
- 作用:是否显示网格线,`1`表示显示,`0`表示隐藏
------------
### showtoolbar
- 类型:Boolean
- 默认值:true
- 作用:是否第二列显示工具栏
- 作用:是否显示工具栏
------------
### showtoolbarConfig
@ -232,7 +233,7 @@ Luckysheet开放了更细致的自定义配置选项,分别有
### showinfobar
- 类型:Boolean
- 默认值:true
- 作用:是否显示顶部名称
- 作用:是否显示顶部信息
------------
### showsheetbar
@ -376,18 +377,18 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 格式:
```json
{
copy: false, // '复制'
copyAs: false, // '复制为'
paste: false, // '粘贴'
insert: false, // '插入'
delete: false, // '删除'
hide: false, // '隐藏'
deleteCell: false, // '删除单元格'
clear: false, // '清除内容'
matrix: false, // '矩阵操作选区'
sort: false, // '排序选区'
filter: false, //'筛选选区'
chart: false // '图表生成'
copy: false, // 复制
copyAs: false, // 复制为
paste: false, // 粘贴
insert: false, // 插入
delete: false, // 删除
hide: false, // 隐藏
deleteCell: false, // 删除单元格
clear: false, // 清除内容
matrix: false, // 矩阵操作选区
sort: false, // 排序选区
filter: false, // 筛选选区
chart: false // 图表生成
}
------------
@ -401,8 +402,8 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 格式:
```json
{
delete: false, // '删除'
copy: false, // '复制'
delete: false, // 删除
copy: false, // 复制
rename: false, //重命名
color: false, //更改颜色
hide: false, //隐藏
@ -411,6 +412,30 @@ Luckysheet开放了更细致的自定义配置选项,分别有
right: false //向右移
}
------------
### showRowBar
- 类型:Boolean
- 默认值:true
- 作用:是否显示行号区域
------------
### showColumnBar
- 类型:Boolean
- 默认值:true
- 作用:是否显示列号区域
------------
### sheetFormulaBar
- 类型:Boolean
- 默认值:true
- 作用:是否显示公示栏
------------
### defaultFontSize
- 类型:Number
- 默认值:11
- 作用:初始化默认字体大小
------------
## 钩子函数(TODO)
@ -652,8 +677,8 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 默认值:null
- 作用:sheet移动前
- 参数:
- {Number} [i]: 当前sheet页的index
- {Number} [order]: 当前sheet页order
- {Number} [i]: 当前sheet页的`index`
- {Number} [order]: 当前sheet页`order`
------------
### sheetMoveAfter
@ -661,9 +686,9 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 默认值:null
- 作用:sheet移动后
- 参数:
- {Number} [i]: 当前sheet页的index
- {Number} [oldOrder]: 修改前当前sheet页order
- {Number} [newOrder]: 修改后当前sheet页order
- {Number} [i]: 当前sheet页的`index`
- {Number} [oldOrder]: 修改前当前sheet页`order`
- {Number} [newOrder]: 修改后当前sheet页`order`
------------
### sheetDeleteBefore
@ -687,7 +712,7 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 默认值:null
- 作用:sheet修改名称前
- 参数:
- {Number} [i]: sheet页的index
- {Number} [i]: sheet页的`index`
- {String} [name]: 当前sheet页名称
------------
@ -706,7 +731,7 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 默认值:null
- 作用:sheet修改颜色前
- 参数:
- {Number} [i]: sheet页的index
- {Number} [i]: sheet页的`index`
- {String} [color]: 当前sheet页颜色
------------
@ -715,7 +740,7 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 默认值:null
- 作用:sheet修改颜色后
- 参数:
- {Number} [i]: sheet页的index
- {Number} [i]: sheet页的`index`
- {String} [oldColor]: 修改前当前sheet页颜色
- {String} [newColor]: 修改后当前sheet页颜色
@ -742,7 +767,7 @@ Luckysheet开放了更细致的自定义配置选项,分别有
### workbookDestroyBefore
- 类型:Function
- 默认值:null
- 作用:表格创建之后触发
- 作用:表格销毁之前触发
- 参数:
- {Object} [book]: 整个工作簿的配置(options)
@ -750,7 +775,7 @@ Luckysheet开放了更细致的自定义配置选项,分别有
### workbookDestroyAfter
- 类型:Function
- 默认值:null
- 作用:表格创建之后触发
- 作用:表格销毁之后触发
- 参数:
- {Object} [book]: 整个工作簿的配置(options)

6
docs/zh/guide/sheet.md

@ -44,6 +44,7 @@ options.data示例如下:
"allowEdit": true, //是否允许编辑
"zoomRatio":1, // 缩放比例
"image":[], //图片
"showGridLines": 1, //是否显示网格线
},
{
"name": "Sheet2",
@ -1260,7 +1261,12 @@ options.data示例如下:
}
```
------------
### showGridLines
- 类型:Number
- 默认值:1
- 作用:是否显示网格线,`1`表示显示,`0`表示隐藏
------------
## 调试信息
初始化所需要的参数,会从简洁的角度出发来考虑设计,但是本地存储的参数则不同。

7
gulpfile.js

@ -173,7 +173,9 @@ async function core() {
file: 'dist/luckysheet.umd.js',
format: 'umd',
name: 'luckysheet',
sourcemap: true
sourcemap: true,
inlineDynamicImports:true,
});
if(production){
@ -181,7 +183,8 @@ async function core() {
file: 'dist/luckysheet.esm.js',
format: 'esm',
name: 'luckysheet',
sourcemap: true
sourcemap: true,
inlineDynamicImports:true,
});
}

2
package.json

@ -1,6 +1,6 @@
{
"name": "luckysheet",
"version": "2.1.0",
"version": "2.1.2",
"main": "dist/luckysheet.cjs.js",
"module": "dist/luckysheet.esm.js",
"browser": "dist/luckysheet.umd.js",

92
src/assets/iconfont/demo_index.html

@ -30,6 +30,30 @@
<div class="content unicode" style="display: block;">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont">&#xe7f2;</span>
<div class="name">分页预览</div>
<div class="code-name">&amp;#xe7f2;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe7f3;</span>
<div class="name">普通</div>
<div class="code-name">&amp;#xe7f3;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe7f4;</span>
<div class="name">页面布局</div>
<div class="code-name">&amp;#xe7f4;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe7ee;</span>
<div class="name">表格锁定</div>
<div class="code-name">&amp;#xe7ee;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe7f1;</span>
<div class="name">转到</div>
@ -692,6 +716,42 @@
<div class="content font-class">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont icon-fenyeyulan"></span>
<div class="name">
分页预览
</div>
<div class="code-name">.icon-fenyeyulan
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-putong"></span>
<div class="name">
普通
</div>
<div class="code-name">.icon-putong
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-yemianbuju"></span>
<div class="name">
页面布局
</div>
<div class="code-name">.icon-yemianbuju
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-biaogesuoding"></span>
<div class="name">
表格锁定
</div>
<div class="code-name">.icon-biaogesuoding
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-zhuandao1"></span>
<div class="name">
@ -1639,6 +1699,38 @@
<div class="content symbol">
<ul class="icon_lists dib-box">
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-fenyeyulan"></use>
</svg>
<div class="name">分页预览</div>
<div class="code-name">#icon-fenyeyulan</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-putong"></use>
</svg>
<div class="name">普通</div>
<div class="code-name">#icon-putong</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-yemianbuju"></use>
</svg>
<div class="name">页面布局</div>
<div class="code-name">#icon-yemianbuju</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-biaogesuoding"></use>
</svg>
<div class="name">表格锁定</div>
<div class="code-name">#icon-biaogesuoding</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-zhuandao1"></use>

28
src/assets/iconfont/iconfont.css

File diff suppressed because one or more lines are too long

BIN
src/assets/iconfont/iconfont.eot

Binary file not shown.

2
src/assets/iconfont/iconfont.js

File diff suppressed because one or more lines are too long

28
src/assets/iconfont/iconfont.json

@ -5,6 +5,34 @@
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "17600443",
"name": "分页预览",
"font_class": "fenyeyulan",
"unicode": "e7f2",
"unicode_decimal": 59378
},
{
"icon_id": "17600444",
"name": "普通",
"font_class": "putong",
"unicode": "e7f3",
"unicode_decimal": 59379
},
{
"icon_id": "17600445",
"name": "页面布局",
"font_class": "yemianbuju",
"unicode": "e7f4",
"unicode_decimal": 59380
},
{
"icon_id": "17597312",
"name": "表格锁定",
"font_class": "biaogesuoding",
"unicode": "e7ee",
"unicode_decimal": 59374
},
{
"icon_id": "17444514",
"name": "转到",

12
src/assets/iconfont/iconfont.svg

@ -20,6 +20,18 @@ Created by iconfont
/>
<missing-glyph />
<glyph glyph-name="fenyeyulan" unicode="&#59378;" d="M810.666667 682.666667v-597.333334H213.333333V682.666667h597.333334z m-42.666667-42.666667H256v-512h512V640zM256 384h256v-42.666667H256zM554.666667 640v-298.666667h-42.666667V640zM405.333333 640v-298.666667h-42.666666V640z" horiz-adv-x="1024" />
<glyph glyph-name="putong" unicode="&#59379;" d="M256 640h554.666667v-42.666667H256zM298.666667 640v-554.666667H256V640zM810.666667 640v-554.666667h-42.666667V640zM469.333333 640v-554.666667h-42.666666V640zM640 640v-554.666667h-42.666667V640zM256 469.333333h554.666667v-42.666666H256zM256 298.666667h554.666667v-42.666667H256zM256 128h554.666667v-42.666667H256z" horiz-adv-x="1024" />
<glyph glyph-name="yemianbuju" unicode="&#59380;" d="M810.666667 682.666667v-42.666667h-170.709334L640 128h170.666667v-42.666667h-213.333334V682.666667h213.333334z m-384 0l-0.042667-554.666667H426.666667v-42.666667H213.333333v42.666667h170.624L384 640H213.333333V682.666667h213.333334z m106.666666-512v-85.333334h-42.666666v85.333334h42.666666z m0 170.666666v-85.333333h-42.666666v85.333333h42.666666z m0 170.666667v-85.333333h-42.666666V512h42.666666z m0 170.666667v-85.333334h-42.666666V682.666667h42.666666z" horiz-adv-x="1024" />
<glyph glyph-name="biaogesuoding" unicode="&#59374;" d="M810.666667 682.666667v-597.333334H213.333333V682.666667h597.333334zM341.333333 512.128H256V128h85.333333V512.128z m426.666667 0H383.872V128H768V512.128z m-149.333333-21.461333a64 64 0 0 0 63.701333-57.856L682.666667 426.666667v-64h42.666666v-213.333334h-298.666666v213.333334h42.666666V426.666667a64 64 0 0 0 57.856 63.701333L533.333333 490.666667h85.333334z m64-170.666667h-213.333334v-128h213.333334v128z m-106.666667-21.333333a21.333333 21.333333 0 0 0 21.333333-21.333334v-42.666666a21.333333 21.333333 0 1 0-42.666666 0v42.666666a21.333333 21.333333 0 0 0 21.333333 21.333334z m42.666667 149.333333h-85.333334a21.333333 21.333333 0 0 1-20.992-17.493333L512 426.666667v-64h128V426.666667a21.333333 21.333333 0 0 1-13.909333 20.010666l-3.584 0.981334-3.84 0.341333zM768 640H383.872v-85.290667L768 554.666667V640zM341.333333 640H256v-85.333333l85.333333 0.042666V640z" horiz-adv-x="1024" />
<glyph glyph-name="zhuandao1" unicode="&#59377;" d="M804.992 201.941333l-84.650667 84.224c-7.552 7.509333-21.930667 8.448-26.026666-1.365333-1.066667-2.602667-1.365333-10.026667-1.365334-10.026667v-56.874666H406.442667a69.034667 69.034667 0 0 0-69.205334 68.778666 69.034667 69.034667 0 0 0 69.205334 68.821334h259.84a128.341333 128.341333 0 0 1 128.597333 127.829333 128.384 128.384 0 0 1-128.554667 127.914667H411.946667A101.632 101.632 0 0 1 213.333333 581.674667a101.632 101.632 0 1 1 198.613334-29.525334h254.378666a69.034667 69.034667 0 0 0 69.162667-68.821333 69.034667 69.034667 0 0 0-69.162667-68.778667H406.442667a128.341333 128.341333 0 0 1-128.597334-127.872 128.341333 128.341333 0 0 1 128.597334-127.872h286.506666v-54.016s0-8.277333 1.408-11.52c4.053333-9.813333 18.432-10.24 25.984-2.730666l84.650667 84.181333a19.2 19.2 0 0 1 0 27.221333zM314.88 539.776a42.069333 42.069333 0 0 0-42.112 41.898667c0 23.082667 18.858667 41.856 42.112 41.856 23.210667 0 42.112-18.773333 42.112-41.856a42.069333 42.069333 0 0 0-42.112-41.898667z" horiz-adv-x="1024" />

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 80 KiB

BIN
src/assets/iconfont/iconfont.ttf

Binary file not shown.

BIN
src/assets/iconfont/iconfont.woff

Binary file not shown.

BIN
src/assets/iconfont/iconfont.woff2

Binary file not shown.

13
src/controllers/constant.js

@ -230,9 +230,9 @@ const gridHTML = function(){
<div class="luckysheet-zoom-ratioText" id="luckysheet-zoom-ratioText">100%</div>
</div>
<div class="luckysheet-print-viewList">
<div type="viewNormal" class="luckysheet-print-viewBtn luckysheet-print-viewNormal luckysheet-print-viewBtn-active" title="${locale_print.normalBtn}"><i class="icon iconfont icon-caidan1"></i></div>
<div type="viewLayout" class="luckysheet-print-viewBtn luckysheet-print-viewLayout" title="${locale_print.layoutBtn}"><i class="icon iconfont icon-caidan1"></i></div>
<div type="viewPage" class="luckysheet-print-viewBtn luckysheet-print-viewPage" title="${locale_print.pageBtn}"><i class="icon iconfont icon-caidan1"></i></div>
<div type="viewNormal" class="luckysheet-print-viewBtn luckysheet-print-viewNormal luckysheet-print-viewBtn-active" title="${locale_print.normalBtn}"><i class="icon iconfont icon-putong"></i></div>
<div type="viewLayout" class="luckysheet-print-viewBtn luckysheet-print-viewLayout" title="${locale_print.layoutBtn}"><i class="icon iconfont icon-yemianbuju"></i></div>
<div type="viewPage" class="luckysheet-print-viewBtn luckysheet-print-viewPage" title="${locale_print.pageBtn}"><i class="icon iconfont icon-fenyeyulan"></i></div>
</div>
<div class="luckysheet-sta-content" id="luckysheet-sta-content"></div>
<div class="luckysheet-bottom-content" id="luckysheet-bottom-content-show"></div>
@ -723,6 +723,7 @@ const luckysheetToolHTML = '<div id="luckysheet-tooltip-up" class="jfk-tooltip"
function menuToolBar (){
const toolbar = locale().toolbar;
const fontarray = locale().fontarray;
const defaultFmtArray = locale().defaultFmt;
// <!-- undo -->
return `<div class="luckysheet-toolbar-left-theme">
@ -839,7 +840,7 @@ function menuToolBar (){
style="user-select: none;">
<div class="luckysheet-toolbar-menu-button-caption luckysheet-inline-block"
style="user-select: none;">
123
${defaultFmtArray[0].text}
</div>
<div class="luckysheet-toolbar-menu-button-dropdown luckysheet-inline-block iconfont icon-xiayige"
style="user-select: none;">
@ -1415,7 +1416,7 @@ function menuToolBar (){
<div class="luckysheet-toolbar-menu-button-caption luckysheet-inline-block"
style="user-select: none;">
<div class="luckysheet-icon luckysheet-inline-block " style="user-select: none;">
<div aria-hidden="true" class="luckysheet-icon-img-container luckysheet-icon-img luckysheet-icon-rotation-none iconfont icon-quanping"
<div aria-hidden="true" class="luckysheet-icon-img-container luckysheet-icon-img luckysheet-icon-rotation-none iconfont icon-biaogesuoding"
style="user-select: none;">
</div>
</div>
@ -1431,7 +1432,7 @@ function menuToolBar (){
style="user-select: none;">
<div class="luckysheet-icon luckysheet-inline-block " style="user-select: none;">
<div aria-hidden="true" class="luckysheet-icon-img-container luckysheet-icon-img luckysheet-icon-autofilter iconfont icon-shezhi"
<div aria-hidden="true" class="luckysheet-icon-img-container luckysheet-icon-img luckysheet-icon-autofilter iconfont icon-dayin"
style="user-select: none;">
</div>
</div>

4
src/controllers/dataVerificationCtrl.js

@ -1,6 +1,6 @@
import { replaceHtml } from '../utils/util';
import formula from '../global/formula';
import { isRealNum } from '../global/validate';
import { isRealNum, isRealNull } from '../global/validate';
import { isdatetime, diff } from '../global/datecontroll';
import { luckysheetrefreshgrid } from '../global/refresh';
import tooltip from '../global/tooltip';
@ -1020,7 +1020,7 @@ const dataVerificationCtrl = {
//数据验证未通过
let cellValue = getcellvalue(r, c, null);
if(cellValue == null || cellValue == ""){
if(isRealNull(cellValue)){
return;
}

9
src/controllers/formulaBar.js

@ -59,13 +59,16 @@ export function formulaBarInitial(){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
Store.luckysheet_select_save = [{ "row": [Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[0]], "column": [Store.luckysheetCellUpdate[1], Store.luckysheetCellUpdate[1]], "row_focus": Store.luckysheetCellUpdate[0], "column_focus": Store.luckysheetCellUpdate[1] }];
luckysheetMoveHighlightCell("down", 1, "rangeOfSelect");
$("#luckysheet-functionbox-cell").blur();
//$("#luckysheet-functionbox-cell").blur();
$("#luckysheet-rich-text-editor").focus();
}
event.preventDefault();
}
else if (kcode == keycode.ESC && parseInt($inputbox.css("top")) > 0) {
formula.dontupdate();
luckysheetMoveHighlightCell("down", 0, "rangeOfSelect");
//$("#luckysheet-functionbox-cell").blur();
$("#luckysheet-rich-text-editor").focus();
event.preventDefault();
}
else if (kcode == keycode.F4 && parseInt($inputbox.css("top")) > 0) {
@ -224,11 +227,11 @@ export function formulaBarInitial(){
event.stopPropagation();
});
$("#luckysheet-formula-functionrange").on("mousedown", ".luckysheet-highlight", function (e) {
$("#luckysheet-formula-functionrange").on("mousedown", ".luckysheet-highlight", function (event) {
formula.rangeResize = $(this).data("type");//开始状态resize
formula.rangeResizeIndex = $(this).parent().attr("rangeindex");
let mouse = mouseposition(e.pageX, e.pageY),
let mouse = mouseposition(event.pageX, event.pageY),
scrollLeft = $("#luckysheet-cell-main").scrollLeft(),
scrollTop = $("#luckysheet-cell-main").scrollTop();
let x = mouse[0] + scrollLeft;

14
src/controllers/inlineString.js

@ -372,20 +372,20 @@ export function convertCssToStyleList(cssText){
return {};
}
let cssTextArray = cssText.split(";");
const _locale = locale();
const locale_fontarray = _locale.fontarray;
const locale_fontjson = _locale.fontjson;
let styleList = {
"ff":"Arial", //font family
"ff":locale_fontarray[0], //font family
"fc":"#000000",//font color
"fs":12,//font size
"fs":10,//font size
"cl":0,//strike
"un":0,//underline
"bl":0,//blod
"it":0,//italic
};
const _locale = locale();
const locale_fontarray = _locale.fontarray;
const locale_fontjson = _locale.fontjson;
cssTextArray.forEach(s => {
s = s.toLowerCase();
let key = textTrim(s.substr(0, s.indexOf(':')));

2
src/controllers/keyboard.js

@ -752,7 +752,7 @@ export function keyboardInitial(){
selectHightlightShow();
}
else if (kcode == keycode.DELETE) {
else if (kcode == keycode.DELETE || kcode == keycode.BACKSPACE) {
if(imageCtrl.currentImgId != null){
imageCtrl.removeImgItem();
}

31
src/controllers/menuButton.js

@ -430,13 +430,13 @@ const menuButton = {
//luckysheet-icon-fmt-other-menuButton_sub
$("body").append(menu+submenu);
$menuButton = $("#" + menuButtonId).width(250);
_this.focus($menuButton);
$menuButton.find(".luckysheet-cols-menuitem").click(function(){
$menuButton.hide();
luckysheetContainerFocus();
let $t = $(this), itemvalue = $t.attr("itemvalue");
let $t = $(this), itemvalue = $t.attr("itemvalue"),itemname = $t.attr("itemname");;
$("#luckysheet-icon-fmt-other").find(".luckysheet-toolbar-menu-button-caption").html(" "+ itemname +" ");
if(itemvalue == "fmtOtherSelf"){
return;
@ -459,6 +459,12 @@ const menuButton = {
luckysheetMoreFormat.createDialog(itemvalue);
luckysheetMoreFormat.init();
})
} else {
const text =$(this).find(".luckysheet-toolbar-menu-button-caption").text().trim();
const format = locale_defaultFmt.find(f => f.text === text);
if(format) {
_this.focus($menuButton, format.value);
}
}
let userlen = $(this).outerWidth();
@ -2809,7 +2815,7 @@ const menuButton = {
const locale_print = _locale.print;
if($menuButton.length == 0){
let itemdata = [
{"text": locale_print.menuItemPrint, "value": "print", "example": '<i class="iconfont icon-sousuo" aria-hidden="true"></i>'},
{"text": locale_print.menuItemPrint, "value": "print", "example": '<i class="iconfont icon-dayin" aria-hidden="true"></i>'},
{"text": "", "value": "split", "example": ""},
{"text": locale_print.menuItemAreas, "value": "areas", "example": '<i class="iconfont icon-tihuan" aria-hidden="true"></i>'},
{"text": locale_print.menuItemRows, "value": "rows", "example": '<i class="iconfont icon-zhuandao1" aria-hidden="true"></i>'},
@ -3520,6 +3526,23 @@ const menuButton = {
$icon.removeAttr("class").addClass("luckysheet-icon-img-container luckysheet-icon-img luckysheet-icon-rotation-" + itemvalue + iconfontObject[itemvalue]);
$menuButton.hide();
}
else if(attr == "ct") {
let $menuButton = $("#luckysheet-icon-fmt-other");
const _locale = locale();
const locale_defaultFmt = _locale.defaultFmt;
if(!foucsStatus) {
$menuButton.find(".luckysheet-toolbar-menu-button-caption").html(" "+ locale_defaultFmt[0].text +" ");
return;
}
const {fa} = foucsStatus;
const format = locale_defaultFmt.find(f => f.value === fa);
if(format) {
$menuButton.find(".luckysheet-toolbar-menu-button-caption").html(" "+ format.text +" ");
} else {
const otherFormat = locale_defaultFmt.find(f => f.value === "fmtOtherSelf");
$menuButton.find(".luckysheet-toolbar-menu-button-caption").html(" "+ otherFormat.text +" ");
}
}
},
inputMenuButtonFocus:function(focusTarget){
var w = window.getSelection();
@ -3537,7 +3560,7 @@ const menuButton = {
},
menuButtonFocus: function(d, r, c){
let _this = this;
let foucsList = ["bl", "it", "cl", "ff", "ht", "vt", "fs", "tb", "tr"];
let foucsList = ["bl", "it", "cl", "ff", "ht", "vt", "fs", "tb", "tr", "ct"];
const _locale = locale();
for(let i = 0; i < foucsList.length; i++){
let attr = foucsList[i];

9
src/controllers/print.js

@ -3,7 +3,7 @@ import {zoomChange} from './zoom';
import sheetmanage from './sheetmanage';
import server from './server';
import Store from '../store';
// import { jsPDF } from "jspdf";
import { jsPDF } from "jspdf";
let ExcelPlaceholder = {
"[tabName]":"&A",
@ -20,10 +20,11 @@ let ExcelPlaceholder = {
// Get the pixel value per millimeter
function getOneMmsPx (){
let div = document.createElement("div");
div.id = "mm";
div.style.width = "1mm";
document.querySelector("body").appendChild(div);
let mm1 = document.getElementById("mm").getBoundingClientRect();
let mm1 = div.getBoundingClientRect();
let w = mm1.width;
$(div).remove();
return mm1.width;
}
@ -71,6 +72,8 @@ export function viewChange(curType, preType){
// server.saveParam("all", Store.currentSheetIndex, curZoom, { "k": "zoomRatio" });
server.saveParam("cg", Store.currentSheetIndex, curType, { "k": "curentsheetView" });
Store.currentSheetView = curType;
zoomChange(curZoom);
}

17
src/controllers/select.js

@ -24,7 +24,7 @@ function seletedHighlistByindex(id, r1, r2, c1, c2) {
}
//Set selection highlight
function selectHightlightShow() {
function selectHightlightShow(isRestore=false) {
$("#luckysheet-cell-selected-boxs").show();
$("#luckysheet-cell-selected-boxs #luckysheet-cell-selected").siblings(".luckysheet-cell-selected").remove();
@ -170,7 +170,7 @@ function selectHightlightShow() {
}
//行列标题栏
selectTitlesShow(Store.luckysheet_select_save);
selectTitlesShow(Store.luckysheet_select_save,isRestore);
//左上角范围显示
selectHelpboxFill();
@ -185,13 +185,24 @@ function selectHightlightShow() {
}
//选区标题栏
function selectTitlesShow(rangeArr) {
function selectTitlesShow(rangeArr,isRestore=false) {
let s = $.extend(true, [], rangeArr);
let rowTitleMap = {}, columnTitleMap = {};
for(let i = 0; i < s.length; i++){
let r1 = s[i]["row"][0], r2 = s[i]["row"][1], c1 = s[i]["column"][0], c2 = s[i]["column"][1];
// if(isRestore){
// let margeset = menuButton.mergeborer(Store.flowdata, r1, c1);
// if(!!margeset){
// r1 = margeset.row[2];
// r2 = margeset.row[3];
// c1 = margeset.column[2];
// c2 = margeset.column[3];
// }
// }
//行、列标题栏
rowTitleMap = selectTitlesMap(rowTitleMap, r1, r2);
columnTitleMap = selectTitlesMap(columnTitleMap, c1, c2);

13
src/controllers/sheetmanage.js

@ -691,7 +691,7 @@ const sheetmanage = {
colwidth = c2 + 1;
}
Store.flowdata = data;
// Store.flowdata = data;
luckysheetcreatedom(colwidth, rowheight, data, menu, title);
@ -721,7 +721,8 @@ const sheetmanage = {
let execF = function(){
_this.mergeCalculation(file["index"]);
editor.webWorkerFlowDataCache(Store.flowdata);//worker存数据
_this.setSheetParam(false);
// editor.webWorkerFlowDataCache(Store.flowdata);//worker存数据
_this.storeSheetParam();
_this.restoreselect();
_this.CacheNotLoadControll = [];
@ -874,7 +875,7 @@ const sheetmanage = {
file["zoomRatio"] = Store.zoomRatio;
},
setSheetParam: function(isload) {
setSheetParam: function(isload=true) {
let index = this.getSheetIndex(Store.currentSheetIndex);
let file = Store.luckysheetfile[index];
@ -896,7 +897,9 @@ const sheetmanage = {
luckysheetFreezen.freezenverticaldata = file["freezen"].vertical == null ? null : file["freezen"].vertical.freezenverticaldata;
}
rhchInit(Store.flowdata.length, Store.flowdata[0].length);
if(isload){
rhchInit(Store.flowdata.length, Store.flowdata[0].length);
}
//批注
luckysheetPostil.buildAllPs(Store.flowdata);
@ -917,7 +920,7 @@ const sheetmanage = {
let file = Store.luckysheetfile[index];
//选区
selectHightlightShow();
selectHightlightShow(true);
//复制选区虚线框
selectionCopyShow();

3
src/controllers/updateCell.js

@ -151,6 +151,9 @@ export function luckysheetupdateCell(row_index1, col_index1, d, cover, isnotfocu
}
else{
value = valueShowEs(row_index, col_index, d);
if(cell.qp=="1"){
value = "'" + value;
}
}
}

4
src/css/iconCustom.css

@ -18,7 +18,9 @@
#luckysheet-icon-morebtn{
position: absolute;
right: 30px;
right: 15px;
transform: translate(0,-50%);
top: 50%;
}

13
src/css/luckysheet-core.css

@ -1,9 +1,9 @@
body {
/* body {
margin: 0px;
height: 100%;
overflow: hidden;
}
*/
::-webkit-scrollbar-track {
@ -573,6 +573,15 @@
top: -1660px;
} */
#luckysheet-icon-fmt-other .luckysheet-toolbar-menu-button-caption {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 55px;
margin-left: 1px;
text-align: center;
}
#luckysheet-icon-font-family .luckysheet-toolbar-menu-button-caption {
overflow: hidden;
text-overflow: ellipsis;

17859
src/function/functionlist.js

File diff suppressed because it is too large

4
src/global/createdom.js

@ -114,8 +114,8 @@ export default function luckysheetcreatedom(colwidth, rowheight, data, menu, tit
$("#luckysheet-cols-h-c").height((Store.columeHeaderHeight-1.5));
$("#luckysheet-left-top").css({width:Store.rowHeaderWidth-1.5, height:Store.columeHeaderHeight-1.5});
//批注
luckysheetPostil.buildAllPs(Store.flowdata);
// //批注
// luckysheetPostil.buildAllPs(Store.flowdata);
$("#luckysheet_info_detail_input").val(luckysheetConfigsetting.title);
}

4
src/global/getRowlen.js

@ -982,7 +982,7 @@ function getCellTextInfo(cell , ctx, option){
maxWordCount++;
}
lineHeight = sHeight/1.5;
lineHeight = sHeight/2;
oneLinemaxWordCount = Math.max(oneLinemaxWordCount, maxWordCount);
if(rt!=0){//rotate
sHeight+=lineHeight;
@ -1334,7 +1334,7 @@ function getCellTextInfo(cell , ctx, option){
textContent.textHeightAll = textHeightAll;
}
else{
textContent.textHeightAll = textHeightAll+textHeight/1.5-measureText.actualBoundingBoxDescent-space_height;
textContent.textHeightAll = textHeightAll+textHeight/2-measureText.actualBoundingBoxDescent-space_height;
}
textContent.textWidthAll = textWidthAll;

103
src/global/method.js

@ -2,6 +2,8 @@ import server from '../controllers/server';
import { luckysheetlodingHTML, luckyColor } from '../controllers/constant';
import sheetmanage from '../controllers/sheetmanage';
import luckysheetformula from './formula';
import imageCtrl from '../controllers/imageCtrl';
import dataVerificationCtrl from '../controllers/dataVerificationCtrl';
import pivotTable from '../controllers/pivotTable';
import luckysheetFreezen from '../controllers/freezen';
import { getSheetIndex } from '../methods/get';
@ -146,9 +148,11 @@ const defaultConfig = {
inlineStringEditRange:null,
fontList:[],
currentSheetView:"viewNormal",
},
defualtFormula:{
defaultFormula:{
searchFunctionCell: null,
functionlistPosition: {},
rangechangeindex: null,
@ -192,14 +196,14 @@ const defaultConfig = {
functionResizeTimeout: null,
data_parm_index: 0 //选择公式后参数索引标记
},
defualtSheet:{
defaultSheet:{
sheetMaxIndex: 0,
nulldata: null,
mergeCalculationSheet:{},
checkLoadSheetIndexToDataIndex:{},
CacheNotLoadControll:[],
},
defualtPivotTable:{
defaultPivotTable:{
pivotDatas: null,
pivotSheetIndex: 0,
pivotDataSheetIndex: 0,
@ -224,6 +228,64 @@ const defaultConfig = {
movesave: {},
drawPivotTable: true,
pivotTableBoundary: [12, 6],
},
defaultImage:{
imgItem: {
type: '3', //1移动并调整单元格大小 2移动并且不调整单元格的大小 3不要移动单元格并调整其大小
src: '', //图片url
originWidth: null, //图片原始宽度
originHeight: null, //图片原始高度
default: {
width: null, //图片 宽度
height: null, //图片 高度
left: null, //图片离表格左边的 位置
top: null, //图片离表格顶部的 位置
},
crop: {
width: null, //图片裁剪后 宽度
height: null, //图片裁剪后 高度
offsetLeft: 0, //图片裁剪后离未裁剪时 左边的位移
offsetTop: 0, //图片裁剪后离未裁剪时 顶部的位移
},
isFixedPos: false, //固定位置
fixedLeft: null, //固定位置 左位移
fixedTop: null, //固定位置 右位移
border: {
width: 0, //边框宽度
radius: 0, //边框半径
style: 'solid', //边框类型
color: '#000', //边框颜色
}
},
images: null,
currentImgId: null,
currentWinW: null,
currentWinH: null,
resize: null,
resizeXY: null,
move: false,
moveXY: null,
cropChange: null,
cropChangeXY: null,
cropChangeObj: null,
copyImgItemObj: null,
},
defaultDataVerification:{
defaultItem: {
type: 'dropdown', //类型
type2: null, //
value1: '', //
value2: '', //
checked: false,
remote: false, //自动远程获取选项
prohibitInput: false, //输入数据无效时禁止输入
hintShow: false, //选中单元格时显示提示语
hintText: '', //
},
curItem: null,
dataVerification: null,
selectRange: [],
selectStatus: false,
}
}
@ -396,26 +458,43 @@ const method = {
}
}
let defualtFormula = $.extend(true, {}, defaultConfig.defualtFormula);
for(let key in defualtFormula){
let defaultFormula = $.extend(true, {}, defaultConfig.defaultFormula);
for(let key in defaultFormula){
if(key in luckysheetformula){
luckysheetformula[key] = defualtFormula[key];
luckysheetformula[key] = defaultFormula[key];
}
}
let defualtSheet = $.extend(true, {}, defaultConfig.defualtSheet);
for(let key in defualtSheet){
let defaultSheet = $.extend(true, {}, defaultConfig.defaultSheet);
for(let key in defaultSheet){
if(key in sheetmanage){
sheetmanage[key] = defualtSheet[key];
sheetmanage[key] = defaultSheet[key];
}
}
let defualtPivotTable = $.extend(true, {}, defaultConfig.defualtPivotTable);
for(let key in defualtPivotTable){
let defaultPivotTable = $.extend(true, {}, defaultConfig.defaultPivotTable);
for(let key in defaultPivotTable){
if(key in pivotTable){
pivotTable[key] = defualtPivotTable[key];
pivotTable[key] = defaultPivotTable[key];
}
}
let defaultImage = $.extend(true, {}, defaultConfig.defaultImage);
for(let key in defaultImage){
if(key in imageCtrl){
imageCtrl[key] = defaultImage[key];
}
}
let defaultDataVerification = $.extend(true, {}, defaultConfig.defaultDataVerification);
for(let key in defaultDataVerification){
if(key in dataVerificationCtrl){
dataVerificationCtrl[key] = defaultDataVerification[key];
}
}
},
editorChart:function(c){
let chart_selection_color = luckyColor[0];

6
src/index.html

@ -54,7 +54,7 @@
}
],
data:
// [sheetCell,sheetFormula,sheetConditionFormat,sheetSparkline,sheetTable,sheetComment,sheetPivotTableData,sheetPivotTable,sheetChart,sheetPicture,sheetDataVerification]
[sheetCell,sheetFormula,sheetConditionFormat,sheetSparkline,sheetTable,sheetComment,sheetPivotTableData,sheetPivotTable,sheetChart,sheetPicture,sheetDataVerification]
/*[{"name":"Sheet1","config":{"columnlen":{"0":241},"rowlen":{"0":81}},"index":"1","status":"1","order":"0","luckysheet_select_save":[{"row":[0,0],"column":[4,4],"sheetIndex":1}],"zoomRatio":1,"showGridLines":"1","defaultColWidth":72,"defaultRowHeight":18,"celldata":[
{"r":0,"c":0,
"v":{
@ -96,7 +96,7 @@
{"r":17,"c":2,"v":{"v":"Luckysheet","ct":{"fa":"General","t":"g"},"bg":null,"bl":0,"it":0,"ff":0,"fs":"11","fc":"rgb(51, 51, 51)","ht":1,"vt":1,"m":"Luckysheet"}}
],"calcChain":[]}]*/
/*
[{
"name": "Cell",
"config": {
@ -1782,7 +1782,7 @@
],
"scrollLeft": 0,
"scrollTop": 0
}]
}]*/
})
})

8894
src/locale/en.js

File diff suppressed because it is too large

9981
src/locale/es.js

File diff suppressed because it is too large

4
src/locale/locale.js

@ -1,10 +1,12 @@
import en from './en'
import zh from './zh'
import es from './es'
import Store from '../store';
const localeObj = {
'en':en,
'zh':zh
'zh':zh,
'es':es
}
function locale(){

9039
src/locale/zh.js

File diff suppressed because it is too large

2
src/store/index.js

@ -133,6 +133,8 @@ const Store = {
fontList:[],
currentSheetView:"viewNormal",
}
export default Store;
Loading…
Cancel
Save