Browse Source

Merge branch 'master' into master

master
mengshukeji 5 years ago
committed by GitHub
parent
commit
2edbef177f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      CHANGELOG.md
  2. 19
      README-zh.md
  3. 20
      README.md
  4. 4
      docs/about/sponsor.md
  5. 14
      docs/guide/README.md
  6. 19
      docs/guide/api.md
  7. 26
      docs/guide/config.md
  8. 6
      docs/zh/about/sponsor.md
  9. 14
      docs/zh/guide/README.md
  10. 21
      docs/zh/guide/api.md
  11. 36
      docs/zh/guide/config.md
  12. 1
      gulpfile.js
  13. 3
      package.json
  14. 1
      src/config.js
  15. 104
      src/controllers/constant.js
  16. 6
      src/controllers/controlHistory.js
  17. 13
      src/controllers/dropCell.js
  18. 10
      src/controllers/filter.js
  19. 11
      src/controllers/handler.js
  20. 6
      src/controllers/inlineString.js
  21. 83
      src/controllers/menuButton.js
  22. 16
      src/controllers/pivotTable.js
  23. 8
      src/controllers/rowColumnOperation.js
  24. 6
      src/controllers/select.js
  25. 6
      src/controllers/sheetmanage.js
  26. 5
      src/core.js
  27. 86
      src/css/luckysheet-core.css
  28. 93
      src/global/api.js
  29. 4
      src/global/format.js
  30. 4
      src/global/getRowlen.js
  31. 4
      src/global/method.js
  32. 17
      src/global/refresh.js
  33. 37
      src/global/setdata.js
  34. 61
      src/index.html
  35. 2
      src/locale/en.js
  36. 2
      src/locale/es.js
  37. 2
      src/locale/zh.js
  38. 2
      src/locale/zh_tw.js
  39. 1
      src/store/index.js
  40. 11586
      yarn.lock

24
CHANGELOG.md

@ -2,6 +2,30 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [2.1.13](https://github.com/mengshukeji/Luckysheet/compare/v2.1.12...v2.1.13) (2021-01-19)
### Bug Fixes
* **bug:** bug ([025823b](https://github.com/mengshukeji/Luckysheet/commit/025823b9f386c8048aa44b62f076a739eaa980c0)), closes [#435](https://github.com/mengshukeji/Luckysheet/issues/435)
* **bug:** bug ([a8ff967](https://github.com/mengshukeji/Luckysheet/commit/a8ff967be9cdcf3bbcb0045888951a26a852500a)), closes [#398](https://github.com/mengshukeji/Luckysheet/issues/398)
* **bug:** bug ([deb3a96](https://github.com/mengshukeji/Luckysheet/commit/deb3a965b881d747f9a2171f7d9c9f967d671901))
* **bug:** bug ([5ce1f4a](https://github.com/mengshukeji/Luckysheet/commit/5ce1f4a0b753b7a95569b5285d749389e4d8b943)), closes [#433](https://github.com/mengshukeji/Luckysheet/issues/433)
* **bug:** bug ([932e821](https://github.com/mengshukeji/Luckysheet/commit/932e8215563248f97547ad21a429ef3f8ed0682b)), closes [#423](https://github.com/mengshukeji/Luckysheet/issues/423) [#424](https://github.com/mengshukeji/Luckysheet/issues/424)
* **bug:** bug ([06636f6](https://github.com/mengshukeji/Luckysheet/commit/06636f6a3c08128fe50aa880baabc9420fce4092)), closes [#154](https://github.com/mengshukeji/Luckysheet/issues/154) [#410](https://github.com/mengshukeji/Luckysheet/issues/410) [#416](https://github.com/mengshukeji/Luckysheet/issues/416)
* **bug:** history bug ([973eec8](https://github.com/mengshukeji/Luckysheet/commit/973eec8b71ea963bb23c9fe35c985e86c85ef019))
* **bug:** setRangeFormat history ([065148b](https://github.com/mengshukeji/Luckysheet/commit/065148b5a97e9090479f401463c548c3346757ec))
* **bug:** setRangeShow api ([5bbc45b](https://github.com/mengshukeji/Luckysheet/commit/5bbc45b68e807a2c58c328d93fe8079f3e56fa9f))
* bug ([7412c5b](https://github.com/mengshukeji/Luckysheet/commit/7412c5b4f5aa0afd93f3e0210d3f3fe182c67273))
* **bug:** 文本自动换行bug ([bc926e5](https://github.com/mengshukeji/Luckysheet/commit/bc926e5c49f008c14b4b5e1fdf13713fd6e995b5))
* 换行 ([94022a4](https://github.com/mengshukeji/Luckysheet/commit/94022a48b6407523c5924e94c86fb2ada0fab301))
* **bug:** 渲染换行空行 ([4162b7a](https://github.com/mengshukeji/Luckysheet/commit/4162b7a049f109715a9246ce610d05882d5a5f12))
* **hook:** cellrender ([d444980](https://github.com/mengshukeji/Luckysheet/commit/d44498086fcd3b1b2bf75e95c6a236bc79a1df13))
* **let:** let declar ([71ade32](https://github.com/mengshukeji/Luckysheet/commit/71ade32abd3989230db609ec37f92e931a4473f0))
* **pivottable:** fix ([7cecb12](https://github.com/mengshukeji/Luckysheet/commit/7cecb12ae3a1a0bd0d5bdce803429d4464388e31)), closes [#439](https://github.com/mengshukeji/Luckysheet/issues/439) [#447](https://github.com/mengshukeji/Luckysheet/issues/447)
* **pivottable:** init ([5b19e8b](https://github.com/mengshukeji/Luckysheet/commit/5b19e8b06bdd95c2b799d2cc1d6ae677b96617cd))
* **pivottable:** refresh ([78330c9](https://github.com/mengshukeji/Luckysheet/commit/78330c95db2735c8139b0320c2e81ee6f438adea))
### [2.1.12](https://github.com/mengshukeji/Luckysheet/compare/v2.1.11...v2.1.12) (2020-12-22)

19
README-zh.md

@ -64,7 +64,8 @@
## 📖 学习资源
社区提供的教程、学习资料及配套解决方案请查阅 [教程与资源](https://mengshukeji.github.io/LuckysheetDocs/zh/guide/resource.html)
- 新用户优先阅读:[用户指引](https://github.com/mengshukeji/Luckysheet/wiki/User-Guide)
- 社区提供的教程、学习资料及配套解决方案请查阅:[教程与资源](https://mengshukeji.github.io/LuckysheetDocs/zh/guide/resource.html)
## 📜 更新日志
@ -88,12 +89,12 @@
通过CDN引入依赖
```
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/plugins/css/pluginsCss.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/plugins/plugins.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/css/luckysheet.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/assets/iconfont/iconfont.css' />
<script src="https://cdn.jsdelivr.net/npm/luckysheet/dist/plugins/js/plugin.js"></script>
<script src="https://cdn.jsdelivr.net/npm/luckysheet/dist/luckysheet.umd.js"></script>
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/plugins/css/pluginsCss.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/plugins/plugins.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/css/luckysheet.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/assets/iconfont/iconfont.css' />
<script src="https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/plugins/js/plugin.js"></script>
<script src="https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/luckysheet.umd.js"></script>
```
### 第二步
指定一个表格容器
@ -188,6 +189,10 @@ Luckysheet是MIT许可的开源项目,其持续稳定的开发离不开这些
- 曹治军 ¥ 1
- *特 ¥ 10
- **权 ¥ 9.9
- **sdmq ¥ 20
- *旭 ¥ 10
- Quentin ¥ 20
- 周宇凡 ¥ 100
## 贡献者和感谢

20
README.md

@ -57,8 +57,8 @@ English| [简体中文](./README-zh.md)
For a more detailed feature list, please refer to: [Features](https://mengshukeji.github.io/LuckysheetDocs/guide/#features)
## 📖 Resources
For the tutorials, learning materials and supporting solutions provided by the community, please refer to [Tutorials and Resources](https://mengshukeji.github.io/LuckysheetDocs/guide/resource.html)
- Priority reading for new users: [User Guide](https://github.com/mengshukeji/Luckysheet/wiki/User-Guide)
- For the tutorials, learning materials and supporting solutions provided by the community, please refer to: [Tutorials and Resources](https://mengshukeji.github.io/LuckysheetDocs/guide/resource.html)
## 📜 Changelog
@ -81,12 +81,12 @@ Please make sure to read the[ Contributing Guide](https://mengshukeji.github.io/
### First step
Introduce dependencies through CDN
```
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/plugins/css/pluginsCss.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/plugins/plugins.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/css/luckysheet.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/assets/iconfont/iconfont.css' />
<script src="https://cdn.jsdelivr.net/npm/luckysheet/dist/plugins/js/plugin.js"></script>
<script src="https://cdn.jsdelivr.net/npm/luckysheet/dist/luckysheet.umd.js"></script>
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/plugins/css/pluginsCss.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/plugins/plugins.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/css/luckysheet.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/assets/iconfont/iconfont.css' />
<script src="https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/plugins/js/plugin.js"></script>
<script src="https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/luckysheet.umd.js"></script>
```
### Second step
Specify a table container
@ -173,6 +173,10 @@ Funds donated via Patreon go directly to support mengshukeji's work on Luckyshee
- 曹治军 ¥ 1
- *特 ¥ 10
- **权 ¥ 9.9
- **sdmq ¥ 20
- *旭 ¥ 10
- Quentin ¥ 20
- 周宇凡 ¥ 100
## Authors and acknowledgment

4
docs/about/sponsor.md

@ -41,3 +41,7 @@ Funds donated via Patreon go directly to support mengshukeji's work on Luckyshee
- 曹治军 ¥ 1
- *特 ¥ 10
- **权 ¥ 9.9
- **sdmq ¥ 20
- *旭 ¥ 10
- Quentin ¥ 20
- 周宇凡 ¥ 100

14
docs/guide/README.md

@ -126,15 +126,15 @@ There are two ways to introduce dependencies
#### CDN
```html
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/plugins/css/pluginsCss.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/plugins/plugins.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/css/luckysheet.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/assets/iconfont/iconfont.css' />
<script src="https://cdn.jsdelivr.net/npm/luckysheet/dist/plugins/js/plugin.js"></script>
<script src="https://cdn.jsdelivr.net/npm/luckysheet/dist/luckysheet.umd.js"></script>
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/plugins/css/pluginsCss.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/plugins/plugins.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/css/luckysheet.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/assets/iconfont/iconfont.css' />
<script src="https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/plugins/js/plugin.js"></script>
<script src="https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/luckysheet.umd.js"></script>
```
Note that the path of `https://cdn.jsdelivr.net/npm/luckysheet/dist/luckysheet.umd.js` means that the latest luckysheet code will be pulled, but if Luckysheet has just been released, the jsdelivr website may not have time Synchronize from npm, so using this path will still pull to the previous version. We recommend that you directly specify the latest version.
Note that the path of `https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/luckysheet.umd.js` means that the latest luckysheet code will be pulled, but if Luckysheet has just been released, the jsdelivr website may not have time Synchronize from npm, so using this path will still pull to the previous version. We recommend that you directly specify the latest version.
To specify the Luckysheet version, please add the version number after all CDN dependent files, such as: `https://cdn.jsdelivr.net/npm/luckysheet@2.1.12/dist/luckysheet.umd.js`.

19
docs/guide/api.md

@ -1930,9 +1930,9 @@ Use note:
+ `"flipLeftRight"`: flip left and right
+ `"flipClockwise"`: rotate clockwise
+ `"flipCounterClockwise"`: rotate counterclockwise
+ `"Transpose"`: Transpose
+ `"DeleteZeroByRow"`: delete 0 values at both ends by row
+ `"DeleteZeroByColumn"`: delete zero values at both ends by column
+ `"transpose"`: Transpose
+ `"deleteZeroByRow"`: delete 0 values at both ends by row
+ `"deleteZeroByColumn"`: delete zero values at both ends by column
+ `"removeDuplicateByRow"`: delete duplicate values by row
+ `"removeDuplicateByColumn"`: remove duplicate values by column
+ `"newMatrix"`: Produce a new matrix
@ -2603,6 +2603,19 @@ Use note:
------------
### checkTheStatusOfTheSelectedCells(type,status)
- **Parameter**
- {String} type: type
- {String} status: Target state value
- **Explanation**
Check whether the status of all specified types of cells in the selection meets the conditions (mainly bold, italics, strikeouts, underscores, etc.).
------------
## Chart
### insertChart([setting])

26
docs/guide/config.md

@ -636,7 +636,7 @@ The hook functions are uniformly configured under ʻoptions.hook`, and configura
- Usage: Triggered before the cell is rendered, `return false` will not render the cell
- Parameter:
- {Object} [cell]:Cell object
- {Object} [postion]:
- {Object} [position]:
+ {Number} [r]: The row number of the cell
+ {Number} [c]: The column number of the cell
+ {Number} [start_r]: The horizontal coordinate of the upper left corner of the cell
@ -654,7 +654,7 @@ The hook functions are uniformly configured under ʻoptions.hook`, and configura
- Usage: Triggered after the cell rendering ends, `return false` will not render the cell
- Parameter:
- {Object} [cell]: Cell object
- {Object} [postion]:
- {Object} [position]:
+ {Number} [r]: The row number of the cell
+ {Number} [c]: The column number of the cell
+ {Number} [start_r]: The horizontal coordinate of the upper left corner of the cell
@ -671,9 +671,9 @@ The hook functions are uniformly configured under ʻoptions.hook`, and configura
```js
luckysheet.create({
hook: {
cellRenderAfter: function (cell, postion, sheetFile, ctx) {
var r = postion.r;
var c = postion.c;
cellRenderAfter: function (cell, position, sheetFile, ctx) {
var r = position.r;
var c = position.c;
if (r === 0 && c === 3) { // Specify to process cell D1
if (!window.storeUserImage) {
window.storeUserImage = {}
@ -708,20 +708,20 @@ The hook functions are uniformly configured under ʻoptions.hook`, and configura
if (img.complete) { //Direct rendering that has been loaded
ctx.drawImage(img, postion.start_c, postion.start_r, 10, 10);
ctx.drawImage(img, position.start_c, position.start_r, 10, 10);
} else {
img.onload = function () {
ctx.drawImage(img, postion.start_c, postion.start_r, 10, 10);
ctx.drawImage(img, position.start_c, position.start_r, 10, 10);
}
}
if (imgRight.complete) {
ctx.drawImage(imgRight, postion.end_c - 10, postion.end_r - 10, 10, 10);
ctx.drawImage(imgRight, position.end_c - 10, position.end_r - 10, 10, 10);
} else {
imgRight.onload = function () {
ctx.drawImage(imgRight, postion.end_c - 10, postion.end_r - 10, 10, 10);
ctx.drawImage(imgRight, position.end_c - 10, position.end_r - 10, 10, 10);
}
}
@ -751,7 +751,7 @@ The hook functions are uniformly configured under ʻoptions.hook`, and configura
- Usage: Triggered before the row header cell is rendered, `return false` will not render the row header
- Parameter:
- {String} [rowNum]: Row number
- {Object} [postion]:
- {Object} [position]:
+ {Number} [r]: The row number of the cell
+ {Number} [top]: The vertical coordinate of the upper left corner of the cell
+ {Number} [width]: Cell width
@ -766,7 +766,7 @@ The hook functions are uniformly configured under ʻoptions.hook`, and configura
- Usage: Triggered after the row header cell is rendered, `return false` will not render the row header
- Parameter:
- {String} [rowNum]: Row number
- {Object} [postion]:
- {Object} [position]:
+ {Number} [r]: The row number of the cell
+ {Number} [top]: The vertical coordinate of the upper left corner of the cell
+ {Number} [width]: Cell width
@ -781,7 +781,7 @@ The hook functions are uniformly configured under ʻoptions.hook`, and configura
- Usage: Triggered before the column header cell is rendered, `return false` will not render the column header
- Parameter:
- {Object} [columnAbc]: Column header characters
- {Object} [postion]:
- {Object} [position]:
- {Number} [c]: The column number of the cell
- {Number} [left]: The horizontal coordinate of the upper left corner of the cell
- {Number} [width]: Cell width
@ -796,7 +796,7 @@ The hook functions are uniformly configured under ʻoptions.hook`, and configura
- Usage: Triggered after the column header cell is rendered, `return false` will not render the column header
- Parameter:
- {Object} [columnAbc]: Column header characters
- {Object} [postion]:
- {Object} [position]:
- {Number} [c]: The column number of the cell
- {Number} [left]: The horizontal coordinate of the upper left corner of the cell
- {Number} [width]: Cell width

6
docs/zh/about/sponsor.md

@ -40,4 +40,8 @@ Luckysheet是MIT许可的开源项目,其持续稳定的开发离不开这些
- 张铭 ¥ 200
- 曹治军 ¥ 1
- *特 ¥ 10
- **权 ¥ 9.9
- **权 ¥ 9.9
- **sdmq ¥ 20
- *旭 ¥ 10
- Quentin ¥ 20
- 周宇凡 ¥ 100

14
docs/zh/guide/README.md

@ -125,15 +125,15 @@ npm run build
#### CDN
```html
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/plugins/css/pluginsCss.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/plugins/plugins.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/css/luckysheet.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/assets/iconfont/iconfont.css' />
<script src="https://cdn.jsdelivr.net/npm/luckysheet/dist/plugins/js/plugin.js"></script>
<script src="https://cdn.jsdelivr.net/npm/luckysheet/dist/luckysheet.umd.js"></script>
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/plugins/css/pluginsCss.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/plugins/plugins.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/css/luckysheet.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/assets/iconfont/iconfont.css' />
<script src="https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/plugins/js/plugin.js"></script>
<script src="https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/luckysheet.umd.js"></script>
```
注意,`https://cdn.jsdelivr.net/npm/luckysheet/dist/luckysheet.umd.js`这个路径意思是会拉取到最新的luckysheet代码,但是如果Luckysheet刚刚发布,jsdelivr网站可能还没来得及从npm上同步过去,故而使用这个路径还是会拉到上一个版本,我们推荐您直接指定最新版本。
注意,`https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/luckysheet.umd.js`这个路径意思是会拉取到最新的luckysheet代码,但是如果Luckysheet刚刚发布,jsdelivr网站可能还没来得及从npm上同步过去,故而使用这个路径还是会拉到上一个版本,我们推荐您直接指定最新版本。
想要指定Luckysheet版本,请在所有的CDN依赖文件后面加上版本号,如:`https://cdn.jsdelivr.net/npm/luckysheet@2.1.12/dist/luckysheet.umd.js`。

21
docs/zh/guide/api.md

@ -1900,10 +1900,10 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
+ `"flipUpDown"`: 上下翻转
+ `"flipLeftRight"`: 左右翻转
+ `"flipClockwise"`: 顺时针旋转
+ `"flipCounterClockwise"`: 逆时针旋转
+ `"Transpose"`: 转置
+ `"DeleteZeroByRow"`: 按行删除两端0值
+ `"DeleteZeroByColumn"`: 按列删除两端0值
+ `"flipCounterClockwise"`: 逆时针旋转api
+ `"transpose"`: 转置
+ `"deleteZeroByRow"`: 按行删除两端0值
+ `"deleteZeroByColumn"`: 按列删除两端0值
+ `"removeDuplicateByRow"`: 按行删除重复值
+ `"removeDuplicateByColumn"`: 按列删除重复值
+ `"newMatrix"`: 生产新矩阵
@ -2549,6 +2549,19 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
------------
### checkTheStatusOfTheSelectedCells(type,status)
- **参数**
- {String} type: 类型
- {String} status: 目标状态值
- **说明**
检查选区内所有cell指定类型的状态是否满足条件(主要是粗体、斜体、删除线和下划线等等)。
------------
## 图表
### insertChart([setting])

36
docs/zh/guide/config.md

@ -740,7 +740,7 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 作用:单元格渲染前触发,`return false` 则不渲染该单元格
- 参数:
- {Object} [cell]:单元格对象
- {Object} [postion]:
- {Object} [position]:
+ {Number} [r]:单元格所在行号
+ {Number} [c]:单元格所在列号
+ {Number} [start_r]:单元格左上角的水平坐标
@ -758,7 +758,7 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 作用:单元格渲染结束后触发,`return false` 则不渲染该单元格
- 参数:
- {Object} [cell]:单元格对象
- {Object} [postion]:
- {Object} [position]:
+ {Number} [r]:单元格所在行号
+ {Number} [c]:单元格所在列号
+ {Number} [start_r]:单元格左上角的水平坐标
@ -775,9 +775,9 @@ Luckysheet开放了更细致的自定义配置选项,分别有
```js
luckysheet.create({
hook: {
cellRenderAfter: function (cell, postion, sheetFile, ctx) {
var r = postion.r;
var c = postion.c;
cellRenderAfter: function (cell, position, sheetFile, ctx) {
var r = position.r;
var c = position.c;
if (r === 0 && c === 3) { // 指定处理D1单元格
if (!window.storeUserImage) {
window.storeUserImage = {}
@ -812,20 +812,20 @@ Luckysheet开放了更细致的自定义配置选项,分别有
if (img.complete) { // 已经加载完成的直接渲染
ctx.drawImage(img, postion.start_c, postion.start_r, 10, 10);
ctx.drawImage(img, position.start_c, position.start_r, 10, 10);
} else {
img.onload = function () {
ctx.drawImage(img, postion.start_c, postion.start_r, 10, 10);
ctx.drawImage(img, position.start_c, position.start_r, 10, 10);
}
}
if (imgRight.complete) {
ctx.drawImage(imgRight, postion.end_c - 10, postion.end_r - 10, 10, 10);
ctx.drawImage(imgRight, position.end_c - 10, position.end_r - 10, 10, 10);
} else {
imgRight.onload = function () {
ctx.drawImage(imgRight, postion.end_c - 10, postion.end_r - 10, 10, 10);
ctx.drawImage(imgRight, position.end_c - 10, position.end_r - 10, 10, 10);
}
}
@ -855,7 +855,7 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 作用:行标题单元格渲染前触发,`return false` 则不渲染行标题
- 参数:
- {String} [rowNum]:行号
- {Object} [postion]:
- {Object} [position]:
+ {Number} [r]:单元格所在行号
+ {Number} [top]:单元格左上角的垂直坐标
+ {Number} [width]:单元格宽度
@ -870,7 +870,7 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 作用:行标题单元格渲染后触发,`return false` 则不渲染行标题
- 参数:
- {String} [rowNum]:行号
- {Object} [postion]:
- {Object} [position]:
+ {Number} [r]:单元格所在行号
+ {Number} [top]:单元格左上角的垂直坐标
+ {Number} [width]:单元格宽度
@ -885,7 +885,7 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 作用:列标题单元格渲染前触发,`return false` 则不渲染列标题
- 参数:
- {Object} [columnAbc]:列标题字符
- {Object} [postion]:
- {Object} [position]:
- {Number} [c]:单元格所在列号
- {Number} [left]:单元格左上角的水平坐标
- {Number} [width]:单元格宽度
@ -900,7 +900,7 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 作用:列标题单元格渲染后触发,`return false` 则不渲染列标题
- 参数:
- {Object} [columnAbc]:列标题字符
- {Object} [postion]:
- {Object} [position]:
- {Number} [c]:单元格所在列号
- {Number} [left]:单元格左上角的水平坐标
- {Number} [width]:单元格宽度
@ -918,7 +918,7 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 作用:单元格点击前的事件,`return false`则终止之后的点击操作
- 参数:
- {Object} [cell]:单元格对象
- {Object} [postion]:
- {Object} [position]:
+ {Number} [r]:单元格所在行号
+ {Number} [c]:单元格所在列号
+ {Number} [start_r]:单元格左上角的水平坐标
@ -936,7 +936,7 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 作用:单元格点击后的事件,`return false`则终止之后的点击操作
- 参数:
- {Object} [cell]:单元格对象
- {Object} [postion]:
- {Object} [position]:
+ {Number} [r]:单元格所在行号
+ {Number} [c]:单元格所在列号
+ {Number} [start_r]:单元格左上角的水平坐标
@ -954,7 +954,7 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 作用:鼠标移动事件,可通过cell判断鼠标停留在哪个单元格
- 参数:
- {Object} [cell]:单元格对象
- {Object} [postion]:
- {Object} [position]:
+ {Number} [r]:单元格所在行号
+ {Number} [c]:单元格所在列号
+ {Number} [start_r]:单元格左上角的水平坐标
@ -990,7 +990,7 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 作用:鼠标按钮释放事件,可通过cell判断鼠标停留在哪个单元格
- 参数:
- {Object} [cell]:单元格对象
- {Object} [postion]:
- {Object} [position]:
+ {Number} [r]:单元格所在行号
+ {Number} [c]:单元格所在列号
+ {Number} [start_r]:单元格左上角的水平坐标
@ -1043,7 +1043,7 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 作用:鼠标拖拽文件到Luckysheet内部的结束事件
- 参数:
- {Object} [cell]:单元格对象
- {Object} [postion]:
- {Object} [position]:
+ {Number} [r]:单元格所在行号
+ {Number} [c]:单元格所在列号
+ {Number} [start_r]:单元格左上角的水平坐标

1
gulpfile.js

@ -87,6 +87,7 @@ const paths = {
css:['src/css/*.css','node_modules/flatpickr/dist/themes/light.css'],
pluginsJs:[
'node_modules/jquery/dist/jquery.min.js',
'node_modules/uuid/dist/umd/uuid.min.js',
'src/plugins/js/clipboard.min.js',
'src/plugins/js/spectrum.min.js',
'src/plugins/js/jquery-ui.min.js',

3
package.json

@ -1,6 +1,6 @@
{
"name": "luckysheet",
"version": "2.1.12",
"version": "2.1.13",
"main": "dist/luckysheet.cjs.js",
"module": "dist/luckysheet.esm.js",
"browser": "dist/luckysheet.umd.js",
@ -28,6 +28,7 @@
"rollup": "^2.32.1",
"rollup-plugin-terser": "^6.1.0",
"standard-version": "^8.0.2",
"uuid": "^8.3.2",
"vuepress": "^1.5.0",
"vuepress-plugin-baidu-autopush": "^1.0.1",
"vuepress-plugin-code-copy": "^1.0.6",

1
src/config.js

@ -3,6 +3,7 @@
*/
export default {
container: "luckysheet", //容器的ID
loading:{}, //自定义loading
column: 60, //空表格默认的列数量
row: 84, //空表格默认的行数据量
allowCopy: true, //是否允许拷贝

104
src/controllers/constant.js

@ -1577,11 +1577,107 @@ function menuToolBar (){
`;
}
const luckysheetlodingHTML = function(){
const _locale = locale()
const info =_locale.info;
return'<div id="luckysheetloadingdata" style="width:100%;text-align:center;position:absolute;top:0px;height:100%;font-size: 16px;z-index:1000000000;background:#fff;"><div style="position:relative;top:45%;width:100%;"> <div class="luckysheetLoaderGif"></div> <span>'+info.loading+'...</span></div></div>';
function customLoadingConfig() {
const _locale = locale();
const info = _locale.info;
const config = {
enable: true,
image: 'image://css/loading.gif',
text: info.loading,
viewBox: "32 32 64 64", // 只有为path时,才会使用
imageClass: '',
textClass: '',
customClass: ''
}
if (JSON.stringify(luckysheetConfigsetting.loading) !== '{}') {
Object.assign(config, luckysheetConfigsetting.loading);
}
return config;
}
const luckysheetloadingImage = function (config) {
if(typeof config.image==="function"){
return config.image()
}
const regE = new RegExp("^(image|path)://");
const regResult = regE.exec(config.image);
let imageHtml = '';
if (regResult !== null) {
const prefix = regResult[0];
const type = regResult[1];
const imageStr = regResult.input.substring(prefix.length);
switch (type) {
case "image":
imageHtml = `<div class="image-type" style="background-image: url(${imageStr});"></div>`;
break;
case "path":
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
svg.setAttribute("class", "path-type");
svg.setAttribute("viewBox", config.viewBox);
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
path.setAttribute("d", imageStr);
path.setAttribute("fill", "currentColor");
svg.appendChild(path);
imageHtml = svg.outerHTML;
break;
default:
break;
}
}
return imageHtml;
}
const luckysheetlodingHTML = function (target, coverConfig) {
if (!target) {
return;
}
const config = customLoadingConfig();
if (coverConfig && JSON.stringify(coverConfig) !== "{}") {
Object.assign(config, coverConfig);
}
if (typeof config.enable === "boolean" && config.enable === false) {
return {
el: '',
show: show,
close: close
}
}
const imageHtml = luckysheetloadingImage(config);
const id = "luckysheet-loading-" + uuid.v4();
const loadingHtml = `
<div class="luckysheet-loading-content">
<div class="${config.imageClass} luckysheet-loading-image">
${imageHtml}
</div>
<div class="${config.textClass} luckysheet-loading-text">
<span>${config.text}</span>
</div>
</div>`;
const loading = document.createElement("div");
loading.id = id;
loading.className = "luckysheet-loading-mask " + config.customClass;
$(loading).html(loadingHtml);
$(target).append(loading);
function show() {
if(id){
$("#" + id).show();
}
}
function close() {
if(id){
$("#" + id).hide();
}
}
return {
el: loading,
show: show,
close: close
};
}
// var menusetting = {
// menu_selectall: '<div id="luckysheet-selectall-btn-title"><i class="fa fa-i-cursor"></i> 全选</div>',
// menu_copy: '<div id="luckysheet-copy-btn-title"><i class="fa fa-copy"></i> 复制</div>',

6
src/controllers/controlHistory.js

@ -25,7 +25,6 @@ import { getSheetIndex } from '../methods/get';
import Store from '../store';
import { selectHightlightShow } from './select';
import method from '../global/method';
import {refreshMenuButtonFocus} from "../global/api";
function formulaHistoryHanddler(ctr, type="redo"){
if(ctr==null){
@ -429,9 +428,6 @@ const controlHistory = {
}
Store.clearjfundo = true;
/* 刷新当前状态栏 */
refreshMenuButtonFocus();
// 撤销的时候curdata 跟 data 数据要调换一下
let newCtr = {...ctr, ...{data: ctr.curdata, curdata: ctr.data}}
// 钩子函数
@ -748,8 +744,6 @@ const controlHistory = {
}
Store.clearjfundo = true;
/* 刷新当前状态栏 */
refreshMenuButtonFocus();
}
};

13
src/controllers/dropCell.js

@ -508,12 +508,19 @@ const luckysheetDropCell = {
cell.m = cell.v.toExponential(len).toString();
}
else{
let mask = genarate(Math.round(cell.v * 1000000000) / 1000000000);
cell.m = mask[0].toString();
let mask;
if(cell.ct.fa === "##0.00"){
/* 如果是数字类型 */
mask = genarate(Math.round(cell.v * 1000000000) / 1000000000 + ".00") ;
cell.m = mask[0].toString();
}else {
mask = genarate(Math.round(cell.v * 1000000000) / 1000000000);
cell.m = mask[0].toString();
}
}
}
cell.ct = { "fa": "General", "t": "n" };
cell.ct = cell.ct || { "fa": "General", "t": "n" };
}
else{
let mask = genarate(cell.v);

10
src/controllers/filter.js

@ -5,6 +5,7 @@ import tooltip from '../global/tooltip';
import { rowlenByRange } from '../global/getRowlen';
import { selectHightlightShow } from './select';
import { luckysheetMoveEndCell } from './sheetMove';
import { luckysheetlodingHTML } from '../controllers/constant';
import server from './server';
import locale from '../locale/locale';
import Store from '../store';
@ -480,7 +481,8 @@ function initialFilterHandler(){
orderbydatafiler(st_r, st_c, ed_r, ed_c, cindex, false);
});
$("#luckysheet-filter-byvalue-select").empty().html('<div style="width:100%;text-align:center;position:relative;top:45%;font-size:14px;"><div class="luckysheetLoaderGif"></div><span>'+locale_filter.filiterMoreDataTip+'</span></div>');
const loadingObj = luckysheetlodingHTML("#luckysheet-filter-byvalue-select",{text:locale_filter.filiterMoreDataTip});
$("#luckysheet-filter-byvalue-select").empty().append(loadingObj.el);
let rowhiddenother = {}; //其它筛选列的隐藏行
$("#luckysheet-filter-options-sheet" + Store.currentSheetIndex + " .luckysheet-filter-options").not(this).each(function () {
@ -726,10 +728,14 @@ function initialFilterHandler(){
}
}
}
// 适配小屏设备
let containerH = winH - toffset.top - 350
if (containerH < 0) containerH = 100
$("#luckysheet-filter-byvalue-select").html("<div class='ListBox luckysheet-mousedown-cancel' style='min-height: 100px; max-height: " + containerH + "px; overflow-y: auto; overflow-x: hidden;'><table cellspacing='0' style='width:100%;' class='luckysheet-mousedown-cancel'>" + item.join("") + "</table></div>");
//$("#luckysheet-filter-byvalue-select").html("<div class='ListBox luckysheet-mousedown-cancel' style='min-height: 100px; max-height: " + containerH + "px; overflow-y: auto; overflow-x: hidden;'><table cellspacing='0' style='width:100%;' class='luckysheet-mousedown-cancel'>" + item.join("") + "</table></div>");
$("#luckysheet-filter-byvalue-select").append("<div class='ListBox luckysheet-mousedown-cancel' style='min-height: 100px; max-height: " + containerH + "px; overflow-y: auto; overflow-x: hidden;'><table cellspacing='0' style='width:100%;' class='luckysheet-mousedown-cancel'>" + item.join("") + "</table></div>");
loadingObj.close();
}, 1);
showrightclickmenu($menu, toffset.left, toffset.top + 20);

11
src/controllers/handler.js

@ -503,6 +503,11 @@ export default function luckysheetHandler() {
//按住ctrl 选择选区时 先处理上一个选区
let vText = $("#luckysheet-rich-text-editor").text();
if(vText[vText.length -1 ] === ")"){
vText = vText.substr(0,vText.length - 1); //先删除最后侧的圆括号)
}
if(vText.length > 0){
let lastWord = vText.substr(vText.length-1,1);
if(lastWord!="," && lastWord!="=" && lastWord!="("){
@ -521,7 +526,9 @@ export default function luckysheetHandler() {
formula.functionRangeIndex = textRange;
}
$("#luckysheet-rich-text-editor").html(vText);
/* 在显示前重新 + 右侧的圆括号) */
$("#luckysheet-rich-text-editor").html(vText + ")");
formula.canceFunctionrangeSelected();
formula.createRangeHightlight();
@ -531,7 +538,7 @@ export default function luckysheetHandler() {
formula.rangedrag_column_start = false;
formula.rangedrag_row_start = false;
$("#luckysheet-functionbox-cell").html(vText);
$("#luckysheet-functionbox-cell").html(vText + ")");
formula.rangeHightlightselected($("#luckysheet-rich-text-editor"));
//再进行 选区的选择

6
src/controllers/inlineString.js

@ -575,6 +575,12 @@ function extendCssText(origin, cover, isLimit=true){
let so = originArray[i], isAdd=true;
so = so.toLowerCase();
let okey = textTrim(so.substr(0, so.indexOf(':')));
/* 不设置文字的大小,解决设置删除线等后字体变大的问题 */
if(okey == "font-size"){
continue;
}
let ovalue = textTrim(so.substr(so.indexOf(':') + 1));
if(isLimit){

83
src/controllers/menuButton.js

@ -37,6 +37,7 @@ import { replaceHtml, getObjType, rgbTohex, mouseclickposition, luckysheetfontfo
import {openProtectionModal,checkProtectionFormatCells,checkProtectionNotEnable} from './protection';
import Store from '../store';
import locale from '../locale/locale';
import {checkTheStatusOfTheSelectedCells} from '../global/api';
const menuButton = {
"menu": '<div class="luckysheet-cols-menu luckysheet-rightgclick-menu luckysheet-menuButton ${subclass} luckysheet-mousedown-cancel" id="luckysheet-icon-${id}-menuButton">${item}</div>',
@ -544,8 +545,6 @@ const menuButton = {
_this.updateFormat(d, "fc", color);
});
$("#luckysheet-icon-text-color-menu").mousedown(function(e){
hideMenuByCancel(e);
e.stopPropagation();
@ -600,6 +599,7 @@ const menuButton = {
["#900","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],
["#600","#783f04","#7f6000","#274e13","#0c343d","#073763","#20124d","#4c1130"]],
change: function (color) {
let $input = $(this);
if (color != null) {
color = color.toHexString();
}
@ -607,6 +607,7 @@ const menuButton = {
color = "#000";
}
let oldcolor = null;
// $("#luckysheet-icon-text-color .luckysheet-color-menu-button-indicator").css("border-bottom-color", color);
// 下边框换成了一个DIV
$("#luckysheet-icon-text-color .text-color-bar").css("background-color", color);
@ -617,9 +618,6 @@ const menuButton = {
$menuButton.hide();
luckysheetContainerFocus();
/* 备注:在单元格编辑状态下切换了文本的颜色存在bug,此处需设置编辑框的color样式, */
$("#luckysheet-input-box").css("color",color);
},
});
@ -741,6 +739,7 @@ const menuButton = {
["#600", "#783f04", "#7f6000", "#274e13", "#0c343d", "#073763", "#20124d", "#4c1130"]
],
change: function (color) {
let $input = $(this);
if (color != null) {
color = color.toHexString();
}
@ -748,6 +747,7 @@ const menuButton = {
color = "#fff";
}
let oldcolor = null;
// $("#luckysheet-icon-cell-color .luckysheet-color-menu-button-indicator").css("border-bottom-color", color);
// 下边框换成了一个DIV
$("#luckysheet-icon-cell-color .text-color-bar").css("background-color", color);
@ -2171,19 +2171,11 @@ const menuButton = {
e.stopPropagation();
}).click(function(e){
let d = editor.deepCopyFlowData(Store.flowdata);
let row_index = Store.luckysheet_select_save[0]["row_focus"],
col_index = Store.luckysheet_select_save[0]["column_focus"];
let foucsStatus = _this.checkstatus(d, row_index, col_index, "bl");
if(foucsStatus == 1){
foucsStatus = 0;
}
else{
foucsStatus = 1;
}
let flag = checkTheStatusOfTheSelectedCells("bl",1);
let foucsStatus = flag ? 0 : 1;
_this.updateFormat(d, "bl", foucsStatus);
_this.menuButtonFocus(d, row_index, col_index);
});
//斜体
@ -2192,19 +2184,11 @@ const menuButton = {
e.stopPropagation();
}).click(function(){
let d = editor.deepCopyFlowData(Store.flowdata);
let row_index = Store.luckysheet_select_save[0]["row_focus"],
col_index = Store.luckysheet_select_save[0]["column_focus"];
let foucsStatus = _this.checkstatus(d, row_index, col_index, "it");
if(foucsStatus == 1){
foucsStatus = 0;
}
else{
foucsStatus = 1;
}
let flag = checkTheStatusOfTheSelectedCells("it",1);
let foucsStatus = flag ? 0 : 1;
_this.updateFormat(d, "it", foucsStatus);
_this.menuButtonFocus(d, row_index, col_index);
});
//删除线
@ -2213,19 +2197,10 @@ const menuButton = {
e.stopPropagation();
}).click(function(){
let d = editor.deepCopyFlowData(Store.flowdata);
let row_index = Store.luckysheet_select_save[0]["row_focus"],
col_index = Store.luckysheet_select_save[0]["column_focus"];
let foucsStatus = _this.checkstatus(d, row_index, col_index, "cl");
if(foucsStatus == 1){
foucsStatus = 0;
}
else{
foucsStatus = 1;
}
let flag = checkTheStatusOfTheSelectedCells("cl",1);
let foucsStatus = flag ? 0 : 1;
_this.updateFormat(d, "cl", foucsStatus);
_this.menuButtonFocus(d, row_index, col_index);
});
//下划线
@ -2234,19 +2209,10 @@ const menuButton = {
e.stopPropagation();
}).click(function(){
let d = editor.deepCopyFlowData(Store.flowdata);
let row_index = Store.luckysheet_select_save[0]["row_focus"],
col_index = Store.luckysheet_select_save[0]["column_focus"];
let foucsStatus = _this.checkstatus(d, row_index, col_index, "un");
if(foucsStatus == 1){
foucsStatus = 0;
}
else{
foucsStatus = 1;
}
let flag = checkTheStatusOfTheSelectedCells("un",1);
let foucsStatus = flag ? 0 : 1;
_this.updateFormat(d, "un", foucsStatus);
_this.menuButtonFocus(d, row_index, col_index);
});
//条件格式
@ -2436,7 +2402,7 @@ const menuButton = {
let dataset = new Function("return " + d)();
setTimeout(function(){
$("#luckysheetloadingdata").fadeOut().remove();
Store.loadingObj.close()
}, 500);
for(let item in dataset){
@ -3014,7 +2980,8 @@ const menuButton = {
type = "s"
}
else if(foucsStatus == "General" || foucsStatus === 0){
type = "g";
// type = "g";
type = isRealNum(value) ? "n" : "g";
}
if (getObjType(cell) == "object") {
@ -4225,23 +4192,25 @@ const menuButton = {
let cell = null;
if(type == "c"){
cell = d[ed_m][fix];
cell = d[ed_m + 1][fix];
}
else{
cell = d[fix][ed_m];
cell = d[fix][ed_m + 1];
}
/* 备注:在搜寻的时候排除自己以解决单元格函数引用自己的问题 */
if(cell != null && cell.v != null && cell.v.toString().length > 0){
let c = ed_m;
let c = ed_m + 1;
if(type == "c"){
cell = d[ed_m][fix];
cell = d[ed_m + 1][fix];
}
else{
cell = d[fix][ed_m];
cell = d[fix][ed_m + 1];
}
while ( cell != null && cell.v != null && cell.v.toString().length > 0) {
c++;
let len = null;
@ -4273,10 +4242,10 @@ const menuButton = {
}
else{
if(type == "c"){
_this.backFormulaInput(d, ed_m, fix, [st_m, ed_m], [fix ,fix], formula);
_this.backFormulaInput(d, ed_m + 1, fix, [st_m, ed_m], [fix ,fix], formula);
}
else{
_this.backFormulaInput(d, fix, ed_m, [fix ,fix], [st_m, ed_m], formula);
_this.backFormulaInput(d, fix, ed_m + 1, [fix ,fix], [st_m, ed_m], formula);
}
}
}

16
src/controllers/pivotTable.js

@ -36,6 +36,7 @@ import {checkProtectionAuthorityNormal} from './protection';
import Store from '../store';
import locale from '../locale/locale';
import numeral from 'numeral';
import { luckysheetlodingHTML } from '../controllers/constant';
const pivotTable = {
pivotDatas: null,
@ -283,8 +284,8 @@ const pivotTable = {
else if (byconditiontype == "1") {
$("#luckysheet-pivotTableFilter-menu .luckysheet-pivotTableFilter-selected-input").eq(0).show().find("input").val($t.data("byconditionvalue1"));
}
$("#luckysheet-pivotTableFilter-byvalue-select").empty().html('<div style="width:100%;text-align:center;position:relative;top:45%;font-size: 14px;"> <div class="luckysheetLoaderGif"> </div> <span>'+locale_filter.filiterMoreDataTip+'</span></div>');
const loadingObj = luckysheetlodingHTML("#luckysheet-pivotTableFilter-byvalue-select",{text:locale_filter.filiterMoreDataTip});
$("#luckysheet-pivotTableFilter-byvalue-select").empty().append(loadingObj.el)
let rowhiddenother = {}; //其它筛选列的隐藏行
$("#luckysheet-modal-dialog-pivotTable-list .luckysheet-modal-dialog-slider-list-item").not($t.get(0)).each(function () {
@ -532,10 +533,16 @@ const pivotTable = {
}
}
}
// 适配小屏设备
let containerH = winH - toffset.top - 350
if (containerH < 0) containerH = 100
$("#luckysheet-pivotTableFilter-byvalue-select").html("<div class='ListBox luckysheet-mousedown-cancel' style='max-height:" + containerH + "px;overflow-y:auto;overflow-x:hidden;'>" + item.join("") + "</div>");
//$("#luckysheet-pivotTableFilter-byvalue-select").html("<div class='ListBox luckysheet-mousedown-cancel' style='max-height:" + containerH + "px;overflow-y:auto;overflow-x:hidden;'>" + item.join("") + "</div>");
$("#luckysheet-pivotTableFilter-byvalue-select").append("<div class='ListBox luckysheet-mousedown-cancel' style='max-height:" + containerH + "px;overflow-y:auto;overflow-x:hidden;'>" + item.join("") + "</div>");
loadingObj.close()
}, 1);
showrightclickmenu($menu, toffset.left - 250, toffset.top);
@ -2633,7 +2640,8 @@ const pivotTable = {
}
if (isdatatypemulti(d_value)["num"] === true) {
let num = numFormat(d_value);
//fix issue 265
let num = numFormat(d_value,6);
dataposition[indicator]["digitaldata"].push(num);
dataposition[indicator]["count"] += 1;
dataposition[indicator]["sum"] += num;

8
src/controllers/rowColumnOperation.js

@ -2044,6 +2044,8 @@ export function rowColumnOperationInitial(){
}
jfrefreshgrid(d, Store.luckysheet_select_save);
$("#luckysheet-functionbox-cell").html("");
}
});
@ -2064,6 +2066,12 @@ export function rowColumnOperationInitial(){
const locale_info = locale().info;
/* 对异常情况进行判断:NaN */
if(isNaN(size)){
tooltip.info("只允许使用数字来设置行列的宽高!", "");
return;
}
let cfg = $.extend(true, {}, Store.config);
let type;
let images = null;

6
src/controllers/select.js

@ -8,6 +8,7 @@ import { getSheetIndex, getRangetxt } from '../methods/get';
import Store from '../store';
import method from '../global/method';
import locale from '../locale/locale';
import { refreshMenuButtonFocus } from "../global/api";
//公式函数 选区实体框
function seletedHighlistByindex(id, r1, r2, c1, c2) {
@ -180,6 +181,9 @@ function selectHightlightShow(isRestore = false) {
if (Store.luckysheet_select_save.length == 1 && Store.luckysheet_select_save[0].row[0] == Store.luckysheet_select_save[0].row[1] && Store.luckysheet_select_save[0].column[0] == Store.luckysheet_select_save[0].column[1]) {
dynamicArrayHightShow(Store.luckysheet_select_save[0].row[0], Store.luckysheet_select_save[0].column[0]);
}
/* 刷新当前状态栏 */
refreshMenuButtonFocus();
}
Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)].luckysheet_select_save = Store.luckysheet_select_save;
@ -311,6 +315,7 @@ function selectIsOverlap(range) {
if (range == null) {
range = Store.luckysheet_select_save;
}
range = JSON.parse(JSON.stringify(range));
let overlap = false;
let map = {};
@ -454,6 +459,7 @@ function selectionCopyShow(range) {
if (range == null) {
range = Store.luckysheet_selection_range;
}
range = JSON.parse(JSON.stringify(range));
if (range.length > 0) {
for (let s = 0; s < range.length; s++) {

6
src/controllers/sheetmanage.js

@ -864,12 +864,12 @@ const sheetmanage = {
if(luckysheetConfigsetting.pointEdit){
setTimeout(function(){
$("#luckysheetloadingdata").remove();
Store.loadingObj.close()
}, 0);
}
else{
setTimeout(function(){
$("#luckysheetloadingdata").fadeOut().remove();
Store.loadingObj.close()
}, 500);
}
}
@ -1243,7 +1243,7 @@ const sheetmanage = {
let data = _this.buildGridData(file);
setTimeout(function(){
$("#luckysheetloadingdata").fadeOut().remove();
Store.loadingObj.close()
}, 500);
for(let item in dataset){

5
src/core.js

@ -71,6 +71,7 @@ luckysheet.create = function (setting) {
Store.luckysheetfile = extendsetting.data;
Store.defaultcolumnNum = extendsetting.column;
Store.defaultrowNum = extendsetting.row;
Store.defaultFontSize = extendsetting.defaultFontSize;
Store.fullscreenmode = extendsetting.fullscreenmode;
Store.lang = extendsetting.lang; //language
Store.allowEdit = extendsetting.allowEdit;
@ -89,6 +90,7 @@ luckysheet.create = function (setting) {
luckysheetConfigsetting.accuracy = extendsetting.accuracy;
luckysheetConfigsetting.total = extendsetting.data[0].total;
luckysheetConfigsetting.loading = extendsetting.loading;
luckysheetConfigsetting.allowCopy = extendsetting.allowCopy;
luckysheetConfigsetting.showtoolbar = extendsetting.showtoolbar;
luckysheetConfigsetting.showtoolbarConfig = extendsetting.showtoolbarConfig;
@ -156,7 +158,8 @@ luckysheet.create = function (setting) {
Store.devicePixelRatio = Math.ceil(devicePixelRatio);
//loading
$("#" + container).append(luckysheetlodingHTML());
const loadingObj=luckysheetlodingHTML("#" + container)
Store.loadingObj=loadingObj
if (loadurl == "") {
sheetmanage.initialjfFile(menu, title);

86
src/css/luckysheet-core.css

@ -24,8 +24,8 @@
.luckysheet {
position: absolute;
/* width: 100%;
height: 100%;*/
/*width: 100%;
height: 100%;*/
font-size: 12px;
font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
border: 1px solid #e5e5e5;
@ -37,6 +37,70 @@
outline: none;
}
.luckysheetLoaderGif {
/*换用GIF loading*/
width: 8em;
height: 8em;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -100%);
-moz-transform: translate(-50%, -100%);
-o-transform: translate(-50%, -100%);
transform: translate(-50%, -100%);
background-image: url(loading.gif);
background-repeat: no-repeat;
background-position: center;
background-size: 100% 100%;
}
.luckysheet-loading-mask{
position:absolute;
z-index:1000000000;
margin: 0;
top: 0;
right: 0;
bottom: 0;
left: 0;
width:100%;
height:100%;
background:#fff;
}
.luckysheet-loading-content{
position:relative;
top: 50%;
transform: translateY(-50%);
width:100%;
font-size: 14px;
color: #409eff;
text-align:center;
}
.luckysheet-loading-image{
width: 8em;
height: 8em;
margin: 0 auto;
}
.luckysheet-loading-text{
margin-top: 1em;
}
.luckysheet-loading-image .image-type{
width:100%;
height:100%;
background-repeat: no-repeat;
background-position: center;
background-size: 100% 100%;
}
.luckysheet-loading-image .path-type{
width:100%;
height:100%;
}
.luckysheet-work-area {
height: 90px;
width: 100%;
@ -4961,24 +5025,6 @@ fieldset[disabled] .btn-danger.focus {
animation: load-effect 1s infinite linear;
}
.luckysheetLoaderGif {
/*换用GIF loading*/
width: 8em;
height: 8em;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -100%);
-moz-transform: translate(-50%, -100%);
-o-transform: translate(-50%, -100%);
transform: translate(-50%, -100%);
background-image: url(loading.gif);
background-repeat: no-repeat;
background-position: center;
background-size: 100% 100%;
}
/*.luckysheetLoaderGif>img{
width:100%;
height:100%;

93
src/global/api.js

@ -1577,7 +1577,8 @@ export function getDefaultColWidth(options = {}) {
* @returns {Array}
*/
export function getRange() {
let rangeArr = Store.luckysheet_select_save;
let rangeArr = JSON.parse(JSON.stringify(Store.luckysheet_select_save));
let result = [];
for (let i = 0; i < rangeArr.length; i++) {
@ -1599,9 +1600,9 @@ export function getRange() {
*/
export function getRangeWithFlatten(range){
range = range || getRange();
let result = [];
range.forEach(ele=>{
// 这个data可能是个范围或者是单个cell
let rs = ele.row;
@ -1623,11 +1624,11 @@ export function getRangeWithFlatten(range){
*/
export function getRangeValuesWithFlatte(range){
range = range || getRangeWithFlatten();
let values = [];
// 获取到的这个数据不是最新的数据
range.forEach(item=> {
range.forEach(item=> {
values.push(Store.flowdata[item.r][item.c]);
});
return values;
@ -1641,7 +1642,7 @@ export function getRangeValuesWithFlatte(range){
*/
export function getRangeAxis() {
let result = [];
let rangeArr = Store.luckysheet_select_save;
let rangeArr = JSON.parse(JSON.stringify(Store.luckysheet_select_save));
let sheetIndex = Store.currentSheetIndex;
rangeArr.forEach(ele=>{
@ -1691,6 +1692,7 @@ export function getRangeHtml(options = {}) {
order = getSheetIndex(Store.currentSheetIndex),
success
} = {...options}
range = JSON.parse(JSON.stringify(range));
if(getObjType(range) == 'string'){
if(!formula.iscelldata(range)){
@ -1848,8 +1850,8 @@ export function getRangeHtml(options = {}) {
let cpdata = "";
let colgroup = "";
rowIndexArr = rowIndexArr.sort();
colIndexArr = colIndexArr.sort();
rowIndexArr = rowIndexArr.sort((a, b) => a - b);
colIndexArr = colIndexArr.sort((a, b) => a - b);
for (let i = 0; i < rowIndexArr.length; i++) {
let r = rowIndexArr[i];
@ -2395,7 +2397,7 @@ export function getRangeDiagonal(type, options = {}) {
}
let curSheetOrder = getSheetIndex(Store.currentSheetIndex);
let curRange = Store.luckysheet_select_save;
let curRange = JSON.parse(JSON.stringify(Store.luckysheet_select_save));
let {
column = 1,
range = curRange,
@ -2498,7 +2500,7 @@ export function getRangeDiagonal(type, options = {}) {
*/
export function getRangeBoolean(options = {}) {
let curSheetOrder = getSheetIndex(Store.currentSheetIndex);
let curRange = Store.luckysheet_select_save;
let curRange = JSON.parse(JSON.stringify(Store.luckysheet_select_save));
let {
range = curRange,
order = curSheetOrder
@ -2605,6 +2607,30 @@ export function setRangeShow(range, options = {}) {
}];
}
if(getObjType(range) == 'array'){
for(let i = 0; i < range.length; i++){
if(getObjType(range[i]) === 'string'){
if(!formula.iscelldata(range[i])){
return tooltip.info("The range parameter is invalid.", "");
}
let cellrange = formula.getcellrange(range[i]);
range[i] = {
"row": cellrange.row,
"column": cellrange.column
}
}
else if(getObjType(range) == 'object'){
if(range.row == null || range.column == null){
return tooltip.info("The range parameter is invalid.", "");
}
range = {
"row": range.row,
"column": range.column
};
}
}
}
if(getObjType(range) != 'array'){
return tooltip.info("The range parameter is invalid.", "");
}
@ -2623,9 +2649,11 @@ export function setRangeShow(range, options = {}) {
for(let i = 0; i < range.length; i++){
let changeparam = menuButton.mergeMoveMain(range[i].column, range[i].row, range[i]);
range[i] = {
"row": changeparam[1],
"column": changeparam[0]
if(changeparam) {
range[i] = {
"row": changeparam[1],
"column": changeparam[0]
}
}
}
@ -2787,7 +2815,7 @@ export function setSingleRangeFormat(attr, value, options = {}) {
*/
export function setRangeFormat(attr, value, options = {}) {
let curSheetOrder = getSheetIndex(Store.currentSheetIndex);
let curRange = Store.luckysheet_select_save;
let curRange = JSON.parse(JSON.stringify(Store.luckysheet_select_save));
let {
range = curRange,
order = curSheetOrder,
@ -2935,7 +2963,7 @@ export function setRangeMerge(type, options = {}) {
}
let curSheetOrder = getSheetIndex(Store.currentSheetIndex),
curRange = Store.luckysheet_select_save;
curRange = JSON.parse(JSON.stringify(Store.luckysheet_select_save));
let {
range = curRange,
order = curSheetOrder,
@ -3519,6 +3547,8 @@ export function setRangeConditionalFormatDefault(conditionName, conditionValue,
success
} = {...options}
cellrange = JSON.parse(JSON.stringify(cellrange));
let file = Store.luckysheetfile[order];
let data = file.data;
@ -3785,6 +3815,7 @@ export function setRangeConditionalFormat(type, options = {}) {
success
} = {...options}
cellrange = JSON.parse(JSON.stringify(cellrange));
let file = Store.luckysheetfile[order];
if(file == null){
@ -4106,6 +4137,7 @@ export function clearRange(options = {}) {
success
} = {...options}
range = JSON.parse(JSON.stringify(range));
if(getObjType(range) == 'string'){
if(!formula.iscelldata(range)){
return tooltip.info("The range parameter is invalid.", "");
@ -5632,10 +5664,10 @@ export function setWorkbookName(name, options = {}) {
* @returns {String} 返回工作簿名称如果读取失败则返回空字符串并弹窗提示
*/
export function getWorkbookName(options = {}) {
let name = "";
let element = $("#luckysheet_info_detail_input");
if(element.length == 0){
tooltip.info('Failed to get workbook name, label loading failed!');
@ -5644,7 +5676,7 @@ export function getWorkbookName(options = {}) {
}
name = $.trim(element.val());
let {
success
} = {...options}
@ -6674,16 +6706,37 @@ export function refreshMenuButtonFocus(data ,r,c , success){
if(r == null && c == null){
/* 获取选取范围 */
let last = Store.luckysheet_select_save[Store.luckysheet_select_save.length -1];
r = last.row_focus || last.row[0];
c = last.column_focus || last.column[0];
}
menuButton.menuButtonFocus(data, r, c);
setTimeout(() => {
if (success && typeof success === 'function') {
success();
}
})
}
/**
* 检查选区内所有cell指定类型的状态是否满足条件主要是粗体斜体删除线和下划线等等
* @param {String} type 类型
* @param {String} status 目标状态值
*/
export function checkTheStatusOfTheSelectedCells(type,status){
/* 获取选区内所有的单元格-扁平后的处理 */
let cells = getRangeWithFlatten();
let flag = cells.every(({r,c})=>{
let cell = Store.flowdata[r][c];
if(cell == null){
return false;
}
return cell[type] == status;
})
return flag;
}

4
src/global/format.js

@ -934,6 +934,7 @@ var make_ssf = function make_ssf(SSF) {
SSF.is_date = fmt_is_date;
function eval_fmt(fmt, v, opts, flen) {
let tempV = v;
var out = [],
o = "",
i = 0,
@ -1350,7 +1351,8 @@ var make_ssf = function make_ssf(SSF) {
out[i].v = write_num(out[i].t, out[i].v, myv);
out[i].t = 't';
}
var retval = "";
// var retval = "";
var retval = tempV === 0 ? "0" : "";
for (i = 0; i !== out.length; ++i)
if (out[i] != null) retval += out[i].v;
return retval;

4
src/global/getRowlen.js

@ -1559,10 +1559,10 @@ function drawLineInfo(wordGroup, cancelLine,underLine,option){
if(underLine=="1" || underLine=="2"){
let item = {};
item.startX = left;
item.startY = top;
item.startY = top + 3;
item.endX = left + width;
item.endY = top;
item.endY = top + 3;
item.fs = fs;

4
src/global/method.js

@ -326,7 +326,7 @@ const method = {
luckysheetextendData(dataset["row"], newData);
setTimeout(function(){
$("#luckysheetloadingdata").fadeOut().remove();
Store.loadingObj.close()
}, 500);
if(func && typeof(func)=="function"){
@ -359,7 +359,7 @@ const method = {
let data = sheetmanage.buildGridData(file);
setTimeout(function(){
$("#luckysheetloadingdata").fadeOut().remove();
Store.loadingObj.close()
}, 500);
file["data"] = data;

17
src/global/refresh.js

@ -44,11 +44,10 @@ function jfrefreshgrid(data, range, allParam, isRunExecFunction = true, isRefres
if(range == null){
range = Store.luckysheet_select_save;
}
range = JSON.parse(JSON.stringify(range));
clearTimeout(refreshCanvasTimeOut);
//关联参数
if(allParam == null){
allParam = {};
@ -121,8 +120,8 @@ function jfrefreshgrid(data, range, allParam, isRunExecFunction = true, isRefres
editor.webWorkerFlowDataCache(Store.flowdata);//worker存数据
file.data = Store.flowdata;
//config
if(cfg != null){
//config, null or empty object are not processed
if(cfg != null && Object.keys(cfg).length !== 0){
Store.config = cfg;
file.config = Store.config;
@ -133,15 +132,15 @@ function jfrefreshgrid(data, range, allParam, isRunExecFunction = true, isRefres
}
}
//条件格式
if(cdformat != null){
//condition format, null or empty array are not processed
if(cdformat != null && cdformat.length !== 0){
file["luckysheet_conditionformat_save"] = cdformat;
server.saveParam("all", Store.currentSheetIndex, cdformat, { "k": "luckysheet_conditionformat_save" });
}
//数据验证
if(dataVerification != null){
//data Verification, null or empty object are not processed
if(dataVerification != null && Object.keys(dataVerification).length !== 0){
dataVerificationCtrl.dataVerification = dataVerification;
file["dataVerification"] = dataVerification;
server.saveParam("all", Store.currentSheetIndex, dataVerification, { "k": "dataVerification" });
@ -188,6 +187,8 @@ function jfrefreshgrid(data, range, allParam, isRunExecFunction = true, isRefres
}, 1);
}
/* 选区同步 */
selectHightlightShow();
window.luckysheet_getcelldata_cache = null;
}

37
src/global/setdata.js

@ -69,29 +69,39 @@ function setcellvalue(r, c, d, v) {
cell = {};
}
if(vupdate.toString().substr(0, 1) == "'"){
cell.m = vupdate.toString().substr(1);
let vupdateStr = vupdate.toString();
if(vupdateStr.substr(0, 1) == "'"){
cell.m = vupdateStr.substr(1);
cell.ct = { "fa": "@", "t": "s" };
cell.v = vupdate.toString().substr(1);
cell.v = vupdateStr.substr(1);
cell.qp = 1;
}
else if(cell.qp == 1){
cell.m = vupdate.toString();
cell.m = vupdateStr;
cell.ct = { "fa": "@", "t": "s" };
cell.v = vupdate.toString();
cell.v = vupdateStr;
}
else if(vupdate.toString().toUpperCase() === "TRUE"){
else if(vupdateStr.toUpperCase() === "TRUE"){
cell.m = "TRUE";
cell.ct = { "fa": "General", "t": "b" };
cell.ht = cell.ht || 0;
cell.v = true;
}
else if(vupdate.toString().toUpperCase() === "FALSE"){
else if(vupdateStr.toUpperCase() === "FALSE"){
cell.m = "FALSE";
cell.ct = { "fa": "General", "t": "b" };
cell.ht = cell.ht || 0;
cell.v = false;
}
else if(vupdateStr.substr(-1) === "%" && isRealNum(vupdateStr.substring(0, vupdateStr.length-1))){
cell.ht = cell.ht || 2;
cell.ct = {fa: "0%", t: "n"};
cell.v = vupdateStr.substring(0, vupdateStr.length-1) / 100;
cell.m = vupdate;
}
else if(valueIsError(vupdate)){
cell.m = vupdate.toString();
cell.m = vupdateStr;
// cell.ct = { "fa": "General", "t": "e" };
if(cell.ct!=null){
cell.ct.t = "e";
@ -140,9 +150,12 @@ function setcellvalue(r, c, d, v) {
// cell.m = mask[0].toString();
}
}
/* 如果是公式计算之后得到的结果:总是设置对齐方式为右对齐 */
cell.ht = cell.ht || 2;
}
else if(cell.ct != null && cell.ct.fa == "@"){
cell.m = vupdate.toString();
cell.m = vupdateStr;
cell.v = vupdate;
}
else if(cell.ct != null && cell.ct.fa != null && cell.ct.fa != "General"){
@ -166,11 +179,11 @@ function setcellvalue(r, c, d, v) {
}
else{
if(isRealNum(vupdate) && !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(vupdate)){
vupdate = parseFloat(vupdate);
cell.v = parseFloat(vupdate);
cell.ct = { "fa": "General", "t": "n" };
cell.v = vupdate; /* 备注:如果使用parseFloat,1.1111111111111111会转换为1.1111111111111112 ? */
cell.ct = { "fa": "General", "t": "n" };
cell.ht = cell.ht || 2;
if(cell.v == Infinity || cell.v == -Infinity){
cell.m = cell.v.toString();
}

61
src/index.html

@ -1869,13 +1869,62 @@
"scrollTop": 0
}]*/
}
}
luckysheet.create(options);
})
}
options.loading={
image:()=>{
return `<svg viewBox="25 25 50 50" class="circular">
<circle cx="50" cy="50" r="20" fill="none"></circle>
</svg>`
},
imageClass:"loadingAnimation"
}
luckysheet.create(options);
})
</script>
<style>
/* 自定义loading演示样式 */
@keyframes loading-rotate {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes loading-dash {
0% {
stroke-dasharray: 1, 200;
stroke-dashoffset: 0;
}
50% {
stroke-dasharray: 90, 150;
stroke-dashoffset: -40px;
}
100% {
stroke-dasharray: 90, 150;
stroke-dashoffset: -120px;
}
}
.loadingAnimation {
width: 3em;
height: 3em;
animation: loading-rotate 2s linear infinite;
}
.loadingAnimation circle {
animation: loading-dash 1.5s ease-in-out infinite;
stroke-dasharray: 90, 150;
stroke-dashoffset: 0;
stroke-width: 2;
stroke: currentColor;
stroke-linecap: round;
}
</style>
</body>
</html>

2
src/locale/en.js

@ -8945,7 +8945,7 @@ export default {
detailSave: 'Local cache restored',
row: '',
column: '',
loading:"Loading",
loading:"Loading...",
copy:"Copy",
return:"Exit",

2
src/locale/es.js

@ -8944,7 +8944,7 @@ export default {
detailSave: 'Cache local restaurado',
row: '',
column: '',
loading:"Cargando",
loading:"Cargando...",
copy:"Copiar",
return:"Salir",

2
src/locale/zh.js

@ -9170,7 +9170,7 @@ export default {
detailSave: '已恢复本地缓存',
row: '行',
column: '列',
loading:"渲染中",
loading:"渲染中···",
copy:"副本",
return:"返回",

2
src/locale/zh_tw.js

@ -9164,7 +9164,7 @@ export default {
detailSave : '已恢復本地緩存',
row : '行',
column : '列',
loading : '渲染中',
loading : '渲染中···',
copy : '副本',
return: '返回',

1
src/store/index.js

@ -1,5 +1,6 @@
const Store = {
container: null,
loadingObj:{},
luckysheetfile: null,
defaultcolumnNum: 60,
defaultrowNum: 84,

11586
yarn.lock

File diff suppressed because it is too large
Loading…
Cancel
Save