wpxp123456 5 years ago
parent
commit
80da253905
  1. 2
      docs/guide/data.md
  2. 64
      docs/guide/format.md
  3. 39
      docs/zh/guide/FAQ.md
  4. 2
      docs/zh/guide/data.md
  5. 152
      docs/zh/guide/format.md
  6. 37
      src/controllers/constant.js
  7. 1512
      src/controllers/filter.js
  8. 293
      src/controllers/formulaBar.js
  9. 6904
      src/controllers/handler.js
  10. 23
      src/controllers/insertFormula.js
  11. 917
      src/controllers/keyboard.js
  12. 1241
      src/controllers/matrixOperation.js
  13. 273
      src/controllers/orderBy.js
  14. 2
      src/controllers/pivotTable.js
  15. 1620
      src/controllers/rowColumnOperation.js
  16. 6
      src/controllers/searchReplace.js
  17. 8
      src/controllers/select.js
  18. 454
      src/controllers/sheetBar.js
  19. 26
      src/controllers/sheetmanage.js
  20. 29
      src/core.js
  21. 2
      src/function/functionImplementation.js
  22. 9201
      src/function/functionlist.js
  23. 13
      src/global/count.js
  24. 19
      src/global/createdom.js
  25. 52
      src/global/formula.js
  26. 4
      src/global/method.js
  27. 2
      src/global/refresh.js
  28. 2
      src/global/tooltip.js
  29. 2
      src/index.html
  30. 74
      src/locale/en.js
  31. 87
      src/locale/zh.js
  32. 5
      src/store/index.js

2
docs/guide/data.md

@ -282,7 +282,7 @@
## celldata
- Type:Array
- Default:[]
- Usage: The original cell data set is a set containing `{r:0,c:0,v:{m:"value",v:"value",ct: {fa: "General", t: "g"}} }`The one-dimensional array of format cell information is only used during initialization. After the table is initialized with celldata, the data is converted to the same level field data in the luckysheetfile, such as `luckysheetfile[0].data`, the subsequent operation of the table Data update will be updated to this data field, and celldata is no longer used. If you need to take out data as initial data, you need to execute `luckysheet.getGridData(data)` to convert it to celldata data. One-dimensional array of `rcv` is converted to two-dimensional array using `luckysheet.buildGridData(luckysheetfile)`, and the input parameter is the table data object `luckysheetfile`, example:
- Usage: The original cell data set is a set containing `{r:0,c:0,v:{m:"value",v:"value",ct: {fa: "General", t: "g"}} }`The one-dimensional array of format cell information is only used during initialization. After the table is initialized with celldata, the data is converted to the same level field data in the luckysheetfile, such as `luckysheetfile[0].data`, the subsequent operation of the table Data update will be updated to this data field, and celldata is no longer used. Example:
```js
[{
"r": 0,

64
docs/guide/format.md

@ -64,13 +64,7 @@
<td>cancelline</td>
<td>Cancelline</td>
<td>0 Regular, 1 Cancelline</td>
<td rowspan="2">Style.Font object's Underline property</td>
</tr>
<tr>
<td>ul</td>
<td>underline</td>
<td>Underline</td>
<td>0 Regular, 1 Underline</td>
<td>Style.Font object's Underline property</td>
</tr>
<tr>
<td>vt</td>
@ -100,13 +94,6 @@
<td>0: 0、1: 45 、2: -45、3 Vertical text、4: 90 、5: -90</td>
<td>setRotationAngle</td>
</tr>
<tr>
<td>fl</td>
<td>floatlenght</td>
<td>Decimal places</td>
<td>3</td>
<td></td>
</tr>
<tr>
<td>tb</td>
<td>textbeak</td>
@ -115,15 +102,15 @@
<td>2: setTextWrapped <br> 0和1: IsTextWrapped =&nbsp;true</td>
</tr>
<tr>
<td>ov</td>
<td>originvalue</td>
<td>v</td>
<td>value</td>
<td>Original value</td>
<td></td>
<td></td>
</tr>
<tr>
<td>v</td>
<td>value</td>
<td>m</td>
<td>monitor</td>
<td>Display value</td>
<td></td>
<td></td>
@ -141,9 +128,33 @@
The following is the storage of 3 cells:
```json
[
{r:0, c:1, v: { v:"display", f:"=SUM(A2)", bg:"#fff000", bs:"1",bc:"#000"}},
{r:10, c:11, v:"value2"},
{r:10, c:11, v:{f:"=sum", v:"100"}}
{
"r": 10,
"c": 11,
"v": {
"f": "=MAX(A7:A9)",
"ct": {
"fa": "General",
"t": "n"
},
"v": 100,
"m": "100"
}
},
{
"r": 0,
"c": 1,
"v": {
"v": 12,
"f": "=SUM(A2)",
"bg": "#fff000"
}
},
{
"r": 10,
"c": 11,
"v": "值2"
}
]
```
@ -155,13 +166,12 @@ The format is set to:
```json
{
"v": "",
"f": "",
"ct": {
"v": 1,
"f": "#,##0.00",
"t": " Decimal"
}
"fa": "General",
"t": "g"
},
"m": "2424",
"v": 2424
}
```

39
docs/zh/guide/FAQ.md

@ -0,0 +1,39 @@
# FAQ
## luckysheetfile中的data和celldata有什么区别?
**<span style="font-size:20px;">A</span>** : 表格初始化时使用一维数组格式的 [celldata](https://mengshukeji.github.io/LuckysheetDocs/zh/guide/data.html#celldata),初始化完成后转化为二维数组格式的data作为存储更新使用,celldata不再使用。
如果需要将data拿出来作为初始化数据,则需要执行 `luckysheet.getGridData(data)`转换为celldata数据。
其中`{ r, c, v }`格式的celldata转换为二维数组使用的是`luckysheet.buildGridData(luckysheetfile)`,传入参数为表格数据对象`luckysheetfile`
总结如下:
```js
// data => celldata 二维数组数据 转化成 {r, c, v}格式 一维数组,传入参数为二维数据data
luckysheet.getGridData(data)
// celldata => data 生成表格所需二维数组,传入参数为表格数据对象file
luckysheet.buildGridData(luckysheetfile)
```
------------
## 单元格的类型有哪些?
**<span style="font-size:20px;">A</span>** : 参考[单元格格式列表](https://mengshukeji.github.io/LuckysheetDocs/zh/guide/format.html#%E5%8D%95%E5%85%83%E6%A0%BC%E6%A0%BC%E5%BC%8F),例举了可用的单元格格式
------------
## luckysheetfile中的data和celldata有什么区别?
**<span style="font-size:20px;">A</span>** :
------------
## luckysheetfile中的data和celldata有什么区别?
**<span style="font-size:20px;">A</span>** :
------------
## luckysheetfile中的data和celldata有什么区别?
**<span style="font-size:20px;">A</span>** :
------------

2
docs/zh/guide/data.md

@ -282,7 +282,7 @@
## celldata
- 类型:Array
- 默认值:[]
- 作用: 原始单元格数据集,是一个包含`{r:0,c:0,v:{m:"value",v:"value",ct: {fa: "General", t: "g"}}}`格式单元格信息的一维数组,只在初始化的时候使用,使用celldata初始化完表格后,数据转换为luckysheetfile中的同级字段data,如`luckysheetfile[0].data`,后续操作表格的数据更新,会更新到这个data字段中,celldata不再使用。如果需要将data拿出来作为初始化数据,则需要执行 `luckysheet.getGridData(data)`转换为celldata数据。其中`rcv`一维数组转换为二维数组使用的是`luckysheet.buildGridData(luckysheetfile)`,传入参数为表格数据对象`luckysheetfile`,示例:
- 作用: 原始单元格数据集,是一个包含`{r:0,c:0,v:{m:"value",v:"value",ct: {fa: "General", t: "g"}}}`格式单元格信息的一维数组,只在初始化的时候使用,使用celldata初始化完表格后,数据转换为luckysheetfile中的同级字段data,如`luckysheetfile[0].data`,后续操作表格的数据更新,会更新到这个data字段中,celldata不再使用。示例:
```js
[{
"r": 0,

152
docs/zh/guide/format.md

@ -64,13 +64,7 @@
<td>cancelline</td>
<td>删除线</td>
<td>0 常规 、 1 删除线</td>
<td rowspan="2">Style.Font object's Underline property</td>
</tr>
<tr>
<td>ul</td>
<td>underline</td>
<td>下划线</td>
<td>0 常规 、 1 下划线</td>
<td>Style.Font object's Underline property</td>
</tr>
<tr>
<td>vt</td>
@ -100,13 +94,6 @@
<td>0: 0、1: 45 、2:-45、3 竖排文字、4: 90 、5:-90</td>
<td>setRotationAngle</td>
</tr>
<tr>
<td>fl</td>
<td>floatlenght</td>
<td>小数位数</td>
<td>3</td>
<td></td>
</tr>
<tr>
<td>tb</td>
<td>textbeak</td>
@ -115,15 +102,15 @@
<td>2:setTextWrapped <br> 0和1:IsTextWrapped =&nbsp;true</td>
</tr>
<tr>
<td>ov</td>
<td>originvalue</td>
<td>v</td>
<td>value</td>
<td>原始值</td>
<td></td>
<td></td>
</tr>
<tr>
<td>v</td>
<td>value</td>
<td>m</td>
<td>monitor</td>
<td>显示值</td>
<td></td>
<td></td>
@ -141,9 +128,33 @@
以下为3个单元格存储:
```json
[
{r:0, c:1, v: { v:"显示", f:"=SUM(A2)", bg:"#fff000", bs:"1",bc:"#000"}},
{r:10, c:11, v:"值2"},
{r:10, c:11, v:{f:"=sum", v:"100"}}
{
"r": 10,
"c": 11,
"v": {
"f": "=MAX(A7:A9)",
"ct": {
"fa": "General",
"t": "n"
},
"v": 100,
"m": "100"
}
},
{
"r": 0,
"c": 1,
"v": {
"v": 12,
"f": "=SUM(A2)",
"bg": "#fff000"
}
},
{
"r": 10,
"c": 11,
"v": "值2"
}
]
```
@ -155,60 +166,59 @@
```json
{
"v": "",
"f": "",
"ct": {
"v": 1,
"f": "#,##0.00",
"t": " Decimal"
}
"fa": "General",
"t": "g"
},
"m": "2424",
"v": 2424
}
```
|参数|说明|使用|
|参数|说明||
| ------------ | ------------ | ------------ |
|v|value,Aspose中的快捷设置值|`var currencyStyle = book.CreateStyle();`<br>`currencyStyle.Number = 8;`|
|f|Format:格式的定义串 `$#,##0;$-#,##0`|`var currencyStyle = book.CreateStyle();`<br>`currencyStyle.Custom  = "#,##0 SEK";`|
|t|Type类型:<br>0:General<br>1:Decimal<br>2:Currency<br>3:Percentage<br>4:Scientific<br>5:Fraction<br>6:Date<br>7:Time<br>8:Accounting<br>9:Text<br>10:DateTime|类型是前端区分的格式,excel导入时根据导入format字符的关键字来区分是哪种类型:<br>1.含YYYY、MM、DD的是6|
|fa|Format格式的定义串| 如"General"|
|t|Type类型|如"g"|
可选择的设置如下:
| 格式 | ct.fa值 | ct.t值 | m值示例 |备注 |
|----------|----------|-------------------------|------------------------- |------------------------- |
| 自动 | General | g | Luckysheet ||
| 纯文本 | @ | s | Luckysheet ||
| <br><br><br>**数字格式** | | | | |
| 整数 | 0 | n | 1235 | 0位小数 ||
| 数字一位小数 | 0.0 | n | 1234.6 | 0.0中,点后面0的个数就代表小数位数,原始数字位数大,设置位数小时会做四舍五入 |
| 数字两位小数 | 0.00 | n | 1234.56 ||
| 更多数字格式 | #,##0 | n | 1,235 ||
| 更多数字格式 | #,##0.00 | n | 1,234.56 ||
| 更多数字格式 | #,##0_);(#,##0) | n | 1,235 ||
| 更多数字格式 | #,##0_);[Red](#,##0) | n | 1,235 ||
| 更多数字格式 | #,##0.00_);(#,##0.00) | n | 1,234.56 ||
| 更多数字格式 | #,##0.00_);[Red](#,##0.00) | n | 1,234.56 ||
| 更多数字格式 | $#,##0_);($#,##0) | n | $1,235 ||
| 更多数字格式 | $#,##0_);[Red]($#,##0) | n | $1,235 ||
| 更多数字格式 | $#,##0.00_);($#,##0.00) | n | $1,234.56 ||
| 更多数字格式 | $#,##0.00_);[Red]($#,##0.00) | n | $1,234.56 ||
| 更多数字格式 | _($* #,##0_);_(...($* "-"_);_(@_) | n | $ 1,235 ||
| 更多数字格式 | _(* #,##0_);_(*..._(* "-"_);_(@_) | n | 1,235 ||
| 更多数字格式 | _($* #,##0.00_);_(...($* "-"_);_(@_) | n | $ 1,234.56 ||
| 更多数字格式 | _(* #,##0.00_);...* "-"??_);_(@_) | n | 1,234.56 ||
| 百分比整数 | 0% | n | 123456% |也支持 #0% 的用法|
| 百分比 | 0.00% | n | 123456.00% |也支持 #0.00% 的用法,点后面0的个数就代表小数位数|
| 科学计数 | 0.00E+00 | n | 1.23E+03 ||
| 科学计数 | ##0.0E+0 | n | 1.2E+3 ||
| 分数 | # ?/? | n | 1234 5/9 ||
| 分数 | # ??/?? | n | 1234 14/25 ||
| 万元 | w | n |12万3456||
| 万元2位小数 | w0.00 | n |12万3456.00||
| 会计 | ¥(0.00) | n ||
Aspose设置如下:
| Value | Type | Format String |
|-------|------------|---------------------------------------------|
| 0 | General | General |
| 1 | Decimal | 0 |
| 2 | Decimal | 0\.00 |
| 3 | Decimal | \#,\#\#0 |
| 4 | Decimal | \#,\#\#0\.00 |
| 5 | Currency | $\#,\#\#0;$\-\#,\#\#0 |
| 6 | Currency | $\#,\#\#0;$\-\#,\#\#0 |
| 7 | Currency | $\#,\#\#0\.00;$\-\#,\#\#0\.00 |
| 8 | Currency | $\#,\#\#0\.00;$\-\#,\#\#0\.00 |
| 9 | Percentage | 0% |
| 10 | Percentage | 0\.00% |
| 11 | Scientific | 0\.00E\+00 |
| 12 | Fraction | \# ?/? |
| 13 | Fraction | \# / |
| 14 | Date | m/d/yy |
| 15 | Date | d\-mmm\-yy |
| 16 | Date | d\-mmm |
| 17 | Date | mmm\-yy |
| 18 | Time | h:mm AM/PM |
| 19 | Time | h:mm:ss AM/PM |
| 20 | Time | h:mm |
| 21 | Time | h:mm:ss |
| 22 | Time | m/d/yy h:mm |
| 37 | Currency | \#,\#\#0;\-\#,\#\#0 |
| 38 | Currency | \#,\#\#0;\-\#,\#\#0 |
| 39 | Currency | \#,\#\#0\.00;\-\#,\#\#0\.00 |
| 40 | Currency | \#,\#\#0\.00;\-\#,\#\#0\.00 |
| 41 | Accounting | \_ \* \#,\#\#0\_ ;\_ \* "\_ ;\_ @\_ |
| 42 | Accounting | \_ $\* \#,\#\#0\_ ;\_ $\* "\_ ;\_ @\_ |
| 43 | Accounting | \_ \* \#,\#\#0\.00\_ ;\_ \* "??\_ ;\_ @\_ |
| 44 | Accounting | \_ $\* \#,\#\#0\.00\_ ;\_ $\* "??\_ ;\_ @\_ |
| 45 | Time | mm:ss |
| 46 | Time | h :mm:ss |
| 47 | Time | mm:ss\.0 |
| 48 | Scientific | \#\#0\.0E\+00 |
| 49 | Text | @ |
| 货币 | ¥0.00 或者 ¥ #.00 | n ||
| 日期 | yyyy-MM-dd | d ||
| 时间 | hh:mm AM/PM | d ||
| 时间24H | hh:mm | d ||
| 日期时间 | yyyy-MM-dd hh:mm AM/PM | d ||
| 日期时间24H | yyyy-MM-dd hh:mm | d ||
| 日期时间24H | yyyy-MM-dd hh:mm | d ||
导入/导出只用考虑用户看到的数据样式,例如excel中处理日期格式的方式为把日期统一转换为数字:42736 代表 2017-1-1
导入/导出只用考虑用户看到的数据样式,例如excel中处理日期格式的方式为把日期统一转换为数字:42736 代表 2017-1-1

37
src/controllers/constant.js

@ -1,19 +1,24 @@
import locale from '../locale/locale';
//dom variable
const gridHTML = '<div class="luckysheet">' +
const gridHTML = function(){
const _locale = locale();
const locale_info = _locale.info;
return '<div class="luckysheet">' +
'<canvas id="luckysheetTableContentF" style="display:none;" class="luckysheetTableContent"></canvas>' +
'<div class="luckysheet-work-area luckysheet-noselected-text">' +
'<div class="luckysheet-share-logo" title="${logotitle}"></div>' +
'<div id ="luckysheet_info_detail" class="luckysheet_info_detail">' +
'<div data-tips="返回" id="luckysheet_info_detail_title" class="luckysheet_info_detail_title">' +
'<div data-tips="'+locale_info.return+'" id="luckysheet_info_detail_title" class="luckysheet_info_detail_title">' +
'<i style="margin-left: -2px;" class="fa fa-chevron-left" aria-hidden="true"></i>' +
'</div>' +
'<div>' +
'<input data-tips="表格重命名" id="luckysheet_info_detail_input" class="luckysheet_info_detail_input luckysheet-mousedown-cancel" value="无标题的电子表格" tabindex="0" dir="ltr" aria-label="重命名" style="visibility: visible; width: 149px;" data-tooltip="重命名">' +
'<input data-tips="'+locale_info.tips+'" id="luckysheet_info_detail_input" class="luckysheet_info_detail_input luckysheet-mousedown-cancel" value="'+locale_info.noName+'" tabindex="0" dir="ltr" aria-label="'+locale_info.rename+'" style="visibility: visible; width: 149px;" data-tooltip="'+locale_info.rename+'">' +
'</div>' +
'<div id="luckysheet_info_detail_update" class="luckysheet_info_detail_update"> 新打开 </div>' +
'<div id="luckysheet_info_detail_save" class="luckysheet_info_detail_save"> 待更新 </div>' +
'<div id="luckysheet_info_detail_update" class="luckysheet_info_detail_update"> '+locale_info.detailUpdate+' </div>' +
'<div id="luckysheet_info_detail_save" class="luckysheet_info_detail_save"> '+locale_info.wait+' </div>' +
'<div class="luckysheet_info_detail_user"> ${functionButton} <span id="luckysheet_info_detail_user"></span> </div>' +
'</div>' +
'<div id="luckysheet-wa-editor" class="luckysheet-wa-editor"> ${menu} </div>' +
@ -160,8 +165,10 @@ const gridHTML = '<div class="luckysheet">' +
'<div id="luckysheet-copy-content" contenteditable="true"></div>' +
'<input id="luckysheet-copy-btn" type="button" data-clipboard-target="luckysheet-copy-content">' +
'<div id="testdpidiv" style="height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"></div>' +
'</div>',
columeHeader_word = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'],
'</div>';
}
const columeHeader_word = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'],
columeHeader_word_index = { 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7, 'I': 8, 'J': 9, 'K': 10, 'L': 11, 'M': 12, 'N': 13, 'O': 14, 'P': 15, 'Q': 16, 'R': 17, 'S': 18, 'T': 19, 'U': 20, 'V': 21, 'W': 22, 'X': 23, 'Y': 24, 'Z': 25 },
flow = '<div id="luckysheet-cell-flow_${index}" class="luckysheet-cell-flow luckysheetsheetchange" style="width:${width}px;"><div class="luckysheet-cell-flow-clip"><div class="luckysheet-grdblkpush"></div>${flow}</div></div>',
colsmenuHTML = '';
@ -434,7 +441,7 @@ const pivottableconfigHTML = '<div class="luckysheet-cols-menu luckysheet-rightg
sheetselectlistHTML = '<div class="luckysheet-cols-menu luckysheet-rightgclick-menu luckysheet-mousedown-cancel" id="luckysheet-sheet-list">${item}</div>',
sheetselectlistitemHTML = '<div class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" id="luckysheet-sheet-btn${index}" data-index="${index}"><div class="luckysheet-cols-menuitem-content luckysheet-mousedown-cancel" style="${style}" ><span class="icon luckysheet-mousedown-cancel">${icon}</span>${name}</div></div>',
inputHTML = '<div dir="ltr"><div class="luckysheet-input-box-index" id="luckysheet-input-box-index"></div><div id="luckysheet-input-box" spellcheck="false" aria-hidden="false" class="luckysheet-input-box"><div class="luckysheet-cell-input editable" tabindex="0" role="combobox" contenteditable="true" id="luckysheet-rich-text-editor" dir="ltr" g_editable="true" aria-autocomplete="list"></div></div></div>',
modelHTML = '<div id="${id}" style="${style}" class="luckysheet-modal-dialog ${addclass}" tabindex="0" role="dialog" aria-labelledby=":41e" dir="ltr"> <div class="luckysheet-modal-dialog-title luckysheet-modal-dialog-title-draggable"> <span class="luckysheet-modal-dialog-title-text" role="heading">${title}</span> <span class="luckysheet-modal-dialog-title-close" role="button" tabindex="0" aria-label="关闭"><i class="fa fa-times" aria-hidden="true"></i></span> </div> <div class="luckysheet-modal-dialog-content">${content}</div> <div class="luckysheet-modal-dialog-buttons"> ${botton} </div></div>',
modelHTML = '<div id="${id}" style="${style}" class="luckysheet-modal-dialog ${addclass}" tabindex="0" role="dialog" aria-labelledby=":41e" dir="ltr"> <div class="luckysheet-modal-dialog-title luckysheet-modal-dialog-title-draggable"> <span class="luckysheet-modal-dialog-title-text" role="heading">${title}</span> <span class="luckysheet-modal-dialog-title-close" role="button" tabindex="0" aria-label="${close}"><i class="fa fa-times" aria-hidden="true"></i></span> </div> <div class="luckysheet-modal-dialog-content">${content}</div> <div class="luckysheet-modal-dialog-buttons"> ${botton} </div></div>',
maskHTML = '<div class="luckysheet-modal-dialog-mask" id="luckysheet-modal-dialog-mask"></div>';
@ -484,8 +491,11 @@ function sheetconfigHTML(){
</div>`;
}
const luckysheetPivotTableHTML = '<div id="luckysheet-modal-dialog-slider-pivot" class="luckysheet-modal-dialog-slider luckysheet-modal-dialog-slider-pivot"> <div class="luckysheet-modal-dialog-slider-title"> <span>数据透视表</span> <span id="luckysheet-modal-dialog-slider-close" title="关闭"><i class="fa fa-times" aria-hidden="true"></i></span> </div> <div class="luckysheet-modal-dialog-slider-content"> <div class="luckysheet-modal-dialog-slider-range"> <div id="luckysheet-dialog-pivotTable-range"></div> <div id="luckysheet-dialog-pivotTable-range-seleted">编辑范围</div> </div> <div class="luckysheet-modal-dialog-slider-list-title"> 选择需要添加到数据透视表的字段 <span title="清除所有已选字段" id="luckysheet-dialog-pivotTable-clearitem">清除</span></div> <div id="luckysheet-modal-dialog-pivotTable-list" class="luckysheet-modal-dialog-slider-list luckysheet-scrollbars"> </div> <div class="luckysheet-modal-dialog-slider-config-c"> <div class="luckysheet-modal-dialog-slider-config luckysheet-modal-dialog-config-filter"> <div> <span><i class="fa fa-filter luckysheet-mousedown-cancel" aria-hidden="true"></i> 筛选</span> </div> <div id="luckysheet-modal-dialog-config-filter" class="luckysheet-modal-dialog-slider-config-list luckysheet-scrollbars"> </div> </div> <div class="luckysheet-modal-dialog-slider-config luckysheet-modal-dialog-config-row"> <div> <span><i class="fa fa-list-alt" aria-hidden="true"></i> 行</span> </div> <div id="luckysheet-modal-dialog-config-row" class="luckysheet-modal-dialog-slider-config-list luckysheet-scrollbars"> </div> </div> <div class="luckysheet-modal-dialog-slider-config luckysheet-modal-dialog-config-column"> <div> <span><i class="fa fa-indent" aria-hidden="true"></i> 列</span> </div> <div id="luckysheet-modal-dialog-config-column" class="luckysheet-modal-dialog-slider-config-list luckysheet-scrollbars"> </div> </div> <div class="luckysheet-modal-dialog-slider-config luckysheet-modal-dialog-config-value"> <div> <span><i class="fa fa-cube" aria-hidden="true"></i> 数值</span> <span style="float: right;margin-right: 10px;display:none;" id="luckysheetpivottablevaluecolrowshow"><label style="padding:0px 5px;margin:0px;font-size:12px;height:15px;line-height:15px;" title="统计字段显示为列" for="luckysheetpivottablevaluecolrow">列</label> <input type="radio" checked="checked" value="1" name="luckysheetpivottablevaluecolrow" id="luckysheetpivottablevaluecolrow" /> <label style="padding:0px 5px;margin:0px;font-size:12px;height:15px;line-height:15px;" title="统计字段显示为行" for="luckysheetpivottablevaluecolrow1">行</label> <input type="radio" value="0" name="luckysheetpivottablevaluecolrow" id="luckysheetpivottablevaluecolrow1" /></span></div> <div id="luckysheet-modal-dialog-config-value" class="luckysheet-modal-dialog-slider-config-list luckysheet-scrollbars"> </div> </div> </div> </div> </div>';
const luckysheetPivotTableHTML = function(){
const _locale = locale();
const locale_pivotTable = _locale.pivotTable;
return '<div id="luckysheet-modal-dialog-slider-pivot" class="luckysheet-modal-dialog-slider luckysheet-modal-dialog-slider-pivot"> <div class="luckysheet-modal-dialog-slider-title"> <span>数据透视表</span> <span id="luckysheet-modal-dialog-slider-close" title="关闭"><i class="fa fa-times" aria-hidden="true"></i></span> </div> <div class="luckysheet-modal-dialog-slider-content"> <div class="luckysheet-modal-dialog-slider-range"> <div id="luckysheet-dialog-pivotTable-range"></div> <div id="luckysheet-dialog-pivotTable-range-seleted">编辑范围</div> </div> <div class="luckysheet-modal-dialog-slider-list-title"> 选择需要添加到数据透视表的字段 <span title="清除所有已选字段" id="luckysheet-dialog-pivotTable-clearitem">清除</span></div> <div id="luckysheet-modal-dialog-pivotTable-list" class="luckysheet-modal-dialog-slider-list luckysheet-scrollbars"> </div> <div class="luckysheet-modal-dialog-slider-config-c"> <div class="luckysheet-modal-dialog-slider-config luckysheet-modal-dialog-config-filter"> <div> <span><i class="fa fa-filter luckysheet-mousedown-cancel" aria-hidden="true"></i> 筛选</span> </div> <div id="luckysheet-modal-dialog-config-filter" class="luckysheet-modal-dialog-slider-config-list luckysheet-scrollbars"> </div> </div> <div class="luckysheet-modal-dialog-slider-config luckysheet-modal-dialog-config-row"> <div> <span><i class="fa fa-list-alt" aria-hidden="true"></i> 行</span> </div> <div id="luckysheet-modal-dialog-config-row" class="luckysheet-modal-dialog-slider-config-list luckysheet-scrollbars"> </div> </div> <div class="luckysheet-modal-dialog-slider-config luckysheet-modal-dialog-config-column"> <div> <span><i class="fa fa-indent" aria-hidden="true"></i> 列</span> </div> <div id="luckysheet-modal-dialog-config-column" class="luckysheet-modal-dialog-slider-config-list luckysheet-scrollbars"> </div> </div> <div class="luckysheet-modal-dialog-slider-config luckysheet-modal-dialog-config-value"> <div> <span><i class="fa fa-cube" aria-hidden="true"></i> 数值</span> <span style="float: right;margin-right: 10px;display:none;" id="luckysheetpivottablevaluecolrowshow"><label style="padding:0px 5px;margin:0px;font-size:12px;height:15px;line-height:15px;" title="统计字段显示为列" for="luckysheetpivottablevaluecolrow">列</label> <input type="radio" checked="checked" value="1" name="luckysheetpivottablevaluecolrow" id="luckysheetpivottablevaluecolrow" /> <label style="padding:0px 5px;margin:0px;font-size:12px;height:15px;line-height:15px;" title="统计字段显示为行" for="luckysheetpivottablevaluecolrow1">行</label> <input type="radio" value="0" name="luckysheetpivottablevaluecolrow" id="luckysheetpivottablevaluecolrow1" /></span></div> <div id="luckysheet-modal-dialog-config-value" class="luckysheet-modal-dialog-slider-config-list luckysheet-scrollbars"> </div> </div> </div> </div> </div>';
}
function filtermenuHTML() {
const _locale = locale();
@ -1150,8 +1160,13 @@ function menuToolBar (){
${toolbar.splitColumn}
</div>`;
}
const luckysheetlodingHTML = '<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>渲染中...</span></div></div>';
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>';
}
// 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>',

1512
src/controllers/filter.js

File diff suppressed because it is too large

293
src/controllers/formulaBar.js

@ -0,0 +1,293 @@
import menuButton from './menuButton';
import luckysheetupdateCell from './updateCell';
import { keycode } from './constant';
import {
luckysheetMoveHighlightCell,
} from './sheetMove';
import insertFormula from './insertFormula';
import {
rowLocation,
colLocation,
mouseposition
} from '../global/location';
import { isEditMode } from '../global/validate';
import formula from '../global/formula';
import tooltip from '../global/tooltip';
import locale from '../locale/locale';
import Store from '../store';
export function formulaBarInitial(){
//公式栏处理
const _locale = locale();
const locale_formula= _locale.formula;
$("#luckysheet-functionbox-cell").focus(function () {
if(isEditMode()){//此模式下禁用公式栏
return;
}
if(Store.luckysheet_select_save.length > 0){
let last = Store.luckysheet_select_save[Store.luckysheet_select_save.length - 1];
let row_index = last["row_focus"], col_index = last["column_focus"];
let row = Store.visibledatarow[row_index],
row_pre = row_index - 1 == -1 ? 0 : Store.visibledatarow[row_index - 1];
let col = Store.visibledatacolumn[col_index],
col_pre = col_index - 1 == -1 ? 0 : Store.visibledatacolumn[col_index - 1];
let margeset = menuButton.mergeborer(Store.flowdata, row_index, col_index);
if(!!margeset){
row = margeset.row[1];
row_pre = margeset.row[0];
row_index = margeset.row[2];
col = margeset.column[1];
col_pre = margeset.column[0];
col_index = margeset.column[2];
}
luckysheetupdateCell(row, row_pre, row_index, col, col_pre, col_index, Store.flowdata, null, true);
formula.rangeResizeTo = $("#luckysheet-functionbox-cell");
}
}).keydown(function (event) {
if(isEditMode()){//此模式下禁用公式栏
return;
}
let ctrlKey = event.ctrlKey;
let altKey = event.altKey;
let shiftKey = event.shiftKey;
let kcode = event.keyCode;
let $inputbox = $("#luckysheet-input-box");
if (kcode == keycode.ENTER && parseInt($inputbox.css("top")) > 0) {
if ($("#luckysheet-formula-search-c").is(":visible") && formula.searchFunctionCell != null) {
formula.searchFunctionEnter($("#luckysheet-formula-search-c").find(".luckysheet-formula-search-item-active"));
}
else {
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();
}
event.preventDefault();
}
else if (kcode == keycode.ESC && parseInt($inputbox.css("top")) > 0) {
formula.dontupdate();
luckysheetMoveHighlightCell("down", 0, "rangeOfSelect");
event.preventDefault();
}
else if (kcode == keycode.F4 && parseInt($inputbox.css("top")) > 0) {
formula.setfreezonFuc(event);
event.preventDefault();
}
else if (kcode == keycode.UP && parseInt($inputbox.css("top")) > 0) {
if ($("#luckysheet-formula-search-c").is(":visible")) {
let $up = $("#luckysheet-formula-search-c").find(".luckysheet-formula-search-item-active").prev();
if ($up.length == 0) {
$up = $("#luckysheet-formula-search-c").find(".luckysheet-formula-search-item").last();
}
$("#luckysheet-formula-search-c").find(".luckysheet-formula-search-item").removeClass("luckysheet-formula-search-item-active");
$up.addClass("luckysheet-formula-search-item-active");
event.preventDefault();
}
}
else if (kcode == keycode.DOWN && parseInt($inputbox.css("top")) > 0) {
if ($("#luckysheet-formula-search-c").is(":visible")) {
let $up = $("#luckysheet-formula-search-c").find(".luckysheet-formula-search-item-active").next();
if ($up.length == 0) {
$up = $("#luckysheet-formula-search-c").find(".luckysheet-formula-search-item").first();
}
$("#luckysheet-formula-search-c").find(".luckysheet-formula-search-item").removeClass("luckysheet-formula-search-item-active");
$up.addClass("luckysheet-formula-search-item-active");
event.preventDefault();
}
}
else if (kcode == keycode.LEFT && parseInt($inputbox.css("top")) > 0) {
formula.rangeHightlightselected($("#luckysheet-functionbox-cell"));
}
else if (kcode == keycode.RIGHT && parseInt($inputbox.css("top")) > 0) {
formula.rangeHightlightselected($("#luckysheet-functionbox-cell"));
}
else if (!((kcode >= 112 && kcode <= 123) || kcode <= 46 || kcode == 144 || kcode == 108 || event.ctrlKey || event.altKey || (event.shiftKey && (kcode == 37 || kcode == 38 || kcode == 39 || kcode == 40))) || kcode == 8 || kcode == 32 || kcode == 46 || (event.ctrlKey && kcode == 86)) {
formula.functionInputHanddler($("#luckysheet-rich-text-editor"), $("#luckysheet-functionbox-cell"), kcode);
}
}).click(function () {
if(isEditMode()){//此模式下禁用公式栏
return;
}
formula.rangeHightlightselected($("#luckysheet-functionbox-cell"));
});
//公式栏 取消(X)按钮
$("#luckysheet-wa-functionbox-cancel").click(function () {
if (!$(this).hasClass("luckysheet-wa-calculate-active")) {
return;
}
//若有参数弹出框,隐藏
if($("#luckysheet-search-formula-parm").is(":visible")){
$("#luckysheet-search-formula-parm").hide();
}
//若有参数选取范围弹出框,隐藏
if($("#luckysheet-search-formula-parm-select").is(":visible")){
$("#luckysheet-search-formula-parm-select").hide();
}
formula.dontupdate();
luckysheetMoveHighlightCell("down", 0, "rangeOfSelect");
});
//公式栏 确认()按钮
$("#luckysheet-wa-functionbox-confirm").click(function () {
if (!$(this).hasClass("luckysheet-wa-calculate-active")) {
return;
}
//若有参数弹出框,隐藏
if($("#luckysheet-search-formula-parm").is(":visible")){
$("#luckysheet-search-formula-parm").hide();
}
//若有参数选取范围弹出框,隐藏
if($("#luckysheet-search-formula-parm-select").is(":visible")){
$("#luckysheet-search-formula-parm-select").hide();
}
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("down", 0, "rangeOfSelect");
});
//公式栏 fx按钮
$("#luckysheet-wa-functionbox-fx").click(function () {
//点击函数查找弹出框
if(Store.luckysheet_select_save.length == 0){
if(isEditMode()){
alert(locale_formula.tipSelectCell);
}
else{
tooltip.info(locale_formula.tipSelectCell,"");
}
return;
}
let last = Store.luckysheet_select_save[Store.luckysheet_select_save.length - 1];
let row_index = last["row_focus"], col_index = last["column_focus"];
let row = Store.visibledatarow[row_index],
row_pre = row_index - 1 == -1 ? 0 : Store.visibledatarow[row_index - 1];
let col = Store.visibledatacolumn[col_index],
col_pre = col_index - 1 == -1 ? 0 : Store.visibledatacolumn[col_index - 1];
luckysheetupdateCell(row, row_pre, row_index, col, col_pre, col_index, Store.flowdata);
let cell = Store.flowdata[row_index][col_index];
if(cell != null && cell.f != null){
//单元格有计算
let functionStr = formula.getfunctionParam(cell.f);
if(functionStr.fn != null){
//有函数公式
insertFormula.formulaParmDialog(functionStr.fn, functionStr.param);
}
else{
//无函数公式
insertFormula.formulaListDialog();
}
}
else{
//单元格无计算
$("#luckysheet-rich-text-editor").html('<span dir="auto" class="luckysheet-formula-text-color">=</span>');
$("#luckysheet-functionbox-cell").html($("#luckysheet-rich-text-editor").html());
insertFormula.formulaListDialog();
}
insertFormula.init();
});
//公式选区操作
$("#luckysheet-formula-functionrange").on("mousedown", ".luckysheet-copy", function (event) {
formula.rangeMove = true;
Store.luckysheet_scroll_status = true;
formula.rangeMoveObj = $(this).parent();
formula.rangeMoveIndex = $(this).parent().attr("rangeindex");
let mouse = mouseposition(event.pageX, event.pageY);
let x = mouse[0] + $("#luckysheet-cell-main").scrollLeft();
let y = mouse[1] + $("#luckysheet-cell-main").scrollTop();
$("#luckysheet-formula-functionrange-highlight-" + formula.rangeMoveIndex).find(".luckysheet-selection-copy-hc").css("opacity", 0.13);
let type = $(this).data("type");
if (type == "top") {
y += 3;
}
else if (type == "right") {
x -= 3;
}
else if (type == "bottom") {
y -= 3;
}
else if (type == "left") {
x += 3;
}
let row_index = rowLocation(y)[2];
let col_index = colLocation(x)[2];
formula.rangeMovexy = [row_index, col_index];
$("#luckysheet-sheettable").css("cursor", "move");
event.stopPropagation();
});
$("#luckysheet-formula-functionrange").on("mousedown", ".luckysheet-highlight", function (e) {
formula.rangeResize = $(this).data("type");//开始状态resize
formula.rangeResizeIndex = $(this).parent().attr("rangeindex");
let mouse = mouseposition(e.pageX, e.pageY),
scrollLeft = $("#luckysheet-cell-main").scrollLeft(),
scrollTop = $("#luckysheet-cell-main").scrollTop();
let x = mouse[0] + scrollLeft;
let y = mouse[1] + scrollTop;
formula.rangeResizeObj = $(this).parent();
$("#luckysheet-formula-functionrange-highlight-" + formula.rangeResizeIndex).find(".luckysheet-selection-copy-hc").css("opacity", 0.13);
if (formula.rangeResize == "lt") {
x += 3;
y += 3;
}
else if (formula.rangeResize == "lb") {
x += 3;
y -= 3;
}
else if (formula.rangeResize == "rt") {
x -= 3;
y += 3;
}
else if (formula.rangeResize == "rb") {
x -= 3;
y -= 3;
}
let row_location = rowLocation(y),
row = row_location[1],
row_pre = row_location[0],
row_index = row_location[2];
let col_location = colLocation(x),
col = col_location[1],
col_pre = col_location[0],
col_index = col_location[2];
let position = formula.rangeResizeObj.position();
formula.rangeResizexy = [
col_pre,
row_pre,
formula.rangeResizeObj.width(),
formula.rangeResizeObj.height(),
position.left + scrollLeft,
position.top + scrollTop, col, row
];
formula.rangeResizeWinH = $("#luckysheet-cell-main")[0].scrollHeight;
formula.rangeResizeWinW = $("#luckysheet-cell-main")[0].scrollWidth;
Store.luckysheet_scroll_status = true;
event.stopPropagation();
});
}

6904
src/controllers/handler.js

File diff suppressed because it is too large

23
src/controllers/insertFormula.js

@ -1,6 +1,6 @@
import { luckysheet_getcelldata } from '../function/func';
import functionlist from '../function/functionlist';
import luckysheet_function from '../function/luckysheet_function';
// import functionlist from '../function/functionlist';
// import Store.luckysheet_function from '../function/Store.luckysheet_function';
import formula from '../global/formula';
import { isRealNum, isRealNull } from '../global/validate';
import { modelHTML } from './constant';
@ -20,6 +20,7 @@ const insertFormula = {
$(document).off("keyup.fxSFLI").on("keyup.fxSFLI", "#searchFormulaListInput", function(){
$("#formulaTypeList").empty();
let txt = $(this).val().toUpperCase();
let functionlist = Store.functionlist;
if(txt == ""){
//若没有查找内容则根据类别筛选
@ -67,16 +68,16 @@ const insertFormula = {
formula.data_parm_index = parmIndex;
let formulatxt = $(this).parents("#luckysheet-search-formula-parm").find(".luckysheet-modal-dialog-title-text").text();
let parmLen = luckysheet_function[formulatxt].p.length;
let parmLen = Store.luckysheet_function[formulatxt].p.length;
let parmDetail, parmRepeat;
if(parmIndex >= parmLen){
parmDetail = luckysheet_function[formulatxt].p[parmLen - 1].detail;
parmRepeat = luckysheet_function[formulatxt].p[parmLen - 1].repeat;
parmDetail = Store.luckysheet_function[formulatxt].p[parmLen - 1].detail;
parmRepeat = Store.luckysheet_function[formulatxt].p[parmLen - 1].repeat;
}
else{
parmDetail = luckysheet_function[formulatxt].p[parmIndex].detail;
parmRepeat = luckysheet_function[formulatxt].p[parmIndex].repeat;
parmDetail = Store.luckysheet_function[formulatxt].p[parmIndex].detail;
parmRepeat = Store.luckysheet_function[formulatxt].p[parmIndex].repeat;
}
//参数选区显示,参数值显示
@ -193,7 +194,7 @@ const insertFormula = {
"id": "luckysheet-search-formula",
"addclass": "luckysheet-search-formula",
"title": "",
"content": "<div class='inpbox'><label for='searchFormulaListInput'>"+ locale_formulaMore.findFunctionTitle +":</label><input class='formulaInputFocus' id='searchFormulaListInput' placeholder='"+ locale_formulaMore.tipInputFunctionName +"' spellcheck='false'/></div><div class='selbox'><label>或选择类别:</label><select id='formulaTypeSelect'><option value='0'>"+locale_formulaMore.Math+"</option><option value='1'>"+locale_formulaMore.Statistical+"</option><option value='2'>"+locale_formulaMore.Lookup+"</option><option value='3'>"+locale_formulaMore.luckysheet+"</option><option value='4'>"+locale_formulaMore.dataMining+"</option><option value='5'>"+locale_formulaMore.Database+"</option><option value='6'>"+locale_formulaMore.Date+"</option><option value='7'>"+locale_formulaMore.Filter+"</option><option value='8'>"+locale_formulaMore.Financial+"</option><option value='9'>"+locale_formulaMore.Engineering+"</option><option value='10'>"+locale_formulaMore.Logical+"</option><option value='11'>"+locale_formulaMore.Operator+"</option><option value='12'>"+locale_formulaMore.Text+"</option><option value='13'>"+locale_formulaMore.Parser+"</option><option value='14'>"+locale_formulaMore.Array+"</option><option value='-1'>"+locale_formulaMore.other+"</option></select></div><div class='listbox'><label>"+locale_formulaMore.selectFunctionTitle+":</label><div id='formulaTypeList'></div></div>",
"content": "<div class='inpbox'><label for='searchFormulaListInput'>"+ locale_formulaMore.findFunctionTitle +":</label><input class='formulaInputFocus' id='searchFormulaListInput' placeholder='"+ locale_formulaMore.tipInputFunctionName +"' spellcheck='false'/></div><div class='selbox'><label>"+locale_formulaMore.selectCategory+":</label><select id='formulaTypeSelect'><option value='0'>"+locale_formulaMore.Math+"</option><option value='1'>"+locale_formulaMore.Statistical+"</option><option value='2'>"+locale_formulaMore.Lookup+"</option><option value='3'>"+locale_formulaMore.luckysheet+"</option><option value='4'>"+locale_formulaMore.dataMining+"</option><option value='5'>"+locale_formulaMore.Database+"</option><option value='6'>"+locale_formulaMore.Date+"</option><option value='7'>"+locale_formulaMore.Filter+"</option><option value='8'>"+locale_formulaMore.Financial+"</option><option value='9'>"+locale_formulaMore.Engineering+"</option><option value='10'>"+locale_formulaMore.Logical+"</option><option value='11'>"+locale_formulaMore.Operator+"</option><option value='12'>"+locale_formulaMore.Text+"</option><option value='13'>"+locale_formulaMore.Parser+"</option><option value='14'>"+locale_formulaMore.Array+"</option><option value='-1'>"+locale_formulaMore.other+"</option></select></div><div class='listbox'><label>"+locale_formulaMore.selectFunctionTitle+":</label><div id='formulaTypeList'></div></div>",
"botton": '<button id="luckysheet-search-formula-confirm" class="btn btn-primary">'+locale_button.confirm+'</button><button class="btn btn-default luckysheet-model-close-btn">'+locale_button.cancel+'</button>',
"style": "z-index:100003"
}));
@ -209,6 +210,7 @@ const insertFormula = {
},
formulaListByType: function(type){
$("#formulaTypeList").empty();
let functionlist = Store.functionlist;
for(let i = 0; i < functionlist.length; i++){
if((type == "-1" && functionlist[i].t > 14) || functionlist[i].t == type){
@ -225,7 +227,8 @@ const insertFormula = {
let _locale = locale();
let locale_formulaMore = _locale.formulaMore;
let locale_button = _locale.button
let locale_button = _locale.button;
let functionlist = Store.functionlist;
for(let i = 0; i < functionlist.length; i++){
if(functionlist[i].n == formulaTxt.toUpperCase()){
@ -428,7 +431,7 @@ const insertFormula = {
$("#luckysheet-search-formula-parm .parmBox").each(function(i, e){
let parmtxt = $(e).find(".txt input").val();
let parmRequire = luckysheet_function[formulatxt].p[i].require;
let parmRequire = Store.luckysheet_function[formulatxt].p[i].require;
if(parmtxt == "" && parmRequire == "m"){
isVal = false;

917
src/controllers/keyboard.js

@ -0,0 +1,917 @@
import luckysheetConfigsetting from './luckysheetConfigsetting';
import menuButton from './menuButton';
import conditionformat from './conditionformat';
import server from './server';
import luckysheetupdateCell from './updateCell';
import { keycode } from './constant';
import {
luckysheetMoveHighlightCell,
luckysheetMoveHighlightCell2,
luckysheetMoveHighlightRange,
luckysheetMoveHighlightRange2
} from './sheetMove';
import { selectHightlightShow, selectIsOverlap } from './select';
import selection from './selection';
import searchReplace from './searchReplace';
import controlHistory from './controlHistory';
import {
getByteLen,
luckysheetactiveCell,
} from '../utils/util';
import { getSheetIndex } from '../methods/get';
import { hasPartMC, isEditMode } from '../global/validate';
import formula from '../global/formula';
import cleargridelement from '../global/cleargridelement';
import tooltip from '../global/tooltip';
import locale from '../locale/locale';
import Store from '../store';
let luckysheet_shiftkeydown = false;
function formulaMoveEvent(dir, ctrlKey, shiftKey){
if ($("#luckysheet-formula-search-c").is(":visible")) {
let $up = $("#luckysheet-formula-search-c").find(".luckysheet-formula-search-item-active").next();
if ($up.length == 0) {
$up = $("#luckysheet-formula-search-c").find(".luckysheet-formula-search-item").first();
}
$("#luckysheet-formula-search-c").find(".luckysheet-formula-search-item").removeClass("luckysheet-formula-search-item-active");
$up.addClass("luckysheet-formula-search-item-active");
event.preventDefault();
}
else{
if($("#luckysheet-formula-functionrange-select").is(":visible")){
if(ctrlKey && shiftKey){
luckysheetMoveHighlightRange2(dir, "rangeOfFormula");
}
else if(ctrlKey){
luckysheetMoveHighlightCell2(dir, "rangeOfFormula");
}
else if(shiftKey){
let dir_n = dir, step = 1;
if(dir == 'up'){
dir_n = 'down';
step = -1;
}
if(dir == 'left'){
dir_n = 'right';
step = -1;
}
luckysheetMoveHighlightRange(dir_n, step, "rangeOfFormula");
}
else{
let dir_n = dir, step = 1;
if(dir == 'up'){
dir_n = 'down';
step = -1;
}
if(dir == 'left'){
dir_n = 'right';
step = -1;
}
luckysheetMoveHighlightCell(dir_n, step, "rangeOfFormula");
}
}
else if(formula.israngeseleciton()){
let anchor = $(window.getSelection().anchorNode);
if(anchor.parent().next().text() == null || anchor.parent().next().text() == ""){
let vText = $("#luckysheet-input-box #luckysheet-input-box-index").text();
let range = formula.getcellrange(vText);
if(range == null){
range = formula.getcellrange($("#luckysheet-input-box-index").text());
}
let r1 = range["row"][0], r2 = range["row"][1];
let c1 = range["column"][0], c2 = range["column"][1];
let row = Store.visibledatarow[r2],
row_pre = r1 - 1 == -1 ? 0 : Store.visibledatarow[r1 - 1];
let col = Store.visibledatacolumn[c2],
col_pre = c1 - 1 == -1 ? 0 : Store.visibledatacolumn[c1 - 1];
formula.func_selectedrange = {
"left": col_pre,
"width": col - col_pre - 1,
"top": row_pre,
"height": row - row_pre - 1,
"left_move": col_pre,
"width_move": col - col_pre - 1,
"top_move": row_pre,
"height_move": row - row_pre - 1,
"row": [r1, r2],
"column": [c1, c2],
"row_focus": r1,
"column_focus": c1
};
formula.rangeSetValue({ "row": [r1, r2], "column": [c1, c2] });
formula.rangestart = true;
formula.rangedrag_column_start = false;
formula.rangedrag_row_start = false;
if(ctrlKey && shiftKey){
luckysheetMoveHighlightRange2(dir, "rangeOfFormula");
}
else if(ctrlKey){
luckysheetMoveHighlightCell2(dir, "rangeOfFormula");
}
else if(shiftKey){
let dir_n = dir, step = 1;
if(dir == 'up'){
dir_n = 'down';
step = -1;
}
if(dir == 'left'){
dir_n = 'right';
step = -1;
}
luckysheetMoveHighlightRange(dir_n, step, "rangeOfFormula");
}
else{
let dir_n = dir, step = 1;
if(dir == 'up'){
dir_n = 'down';
step = -1;
}
if(dir == 'left'){
dir_n = 'right';
step = -1;
}
luckysheetMoveHighlightCell(dir_n, step, "rangeOfFormula");
}
}
}
else if(!ctrlKey && !shiftKey){
let anchor = $(window.getSelection().anchorNode);
let anchorOffset = window.getSelection().anchorOffset;
if(dir == 'up'){
if(anchor.parent().is("span") && anchor.parent().next().length == 0 && anchorOffset > 0){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("down", -1, "rangeOfSelect");
event.preventDefault();
}
else if(anchor.is("#luckysheet-rich-text-editor") && anchor.context.childElementCount == anchorOffset){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("down", -1, "rangeOfSelect");
event.preventDefault();
}
else if(anchor.parent().is("#luckysheet-rich-text-editor") && anchor.context.length == anchorOffset){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("down", -1, "rangeOfSelect");
event.preventDefault();
}
}
else if(dir == 'down'){
if(anchor.parent().is("span") && anchor.parent().next().length == 0 && anchorOffset > 0){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("down", 1, "rangeOfSelect");
event.preventDefault();
}
else if(anchor.is("#luckysheet-rich-text-editor") && anchor.context.childElementCount == anchorOffset){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("down", 1, "rangeOfSelect");
event.preventDefault();
}
else if(anchor.parent().is("#luckysheet-rich-text-editor") && anchor.context.length == anchorOffset){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("down", 1, "rangeOfSelect");
event.preventDefault();
}
}
else if(dir == 'left'){
if(anchor.parent().is("span") && anchor.parent().prev().length == 0 && anchorOffset == 0){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("right", -1, "rangeOfSelect");
event.preventDefault();
}
else if(anchor.is("#luckysheet-rich-text-editor") && anchorOffset == 1){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("right", -1, "rangeOfSelect");
event.preventDefault();
}
else if(anchor.parent().is("#luckysheet-rich-text-editor") && anchorOffset == 0){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("right", -1, "rangeOfSelect");
event.preventDefault();
}
}
else if(dir == 'right'){
if(anchor.parent().is("span") && anchor.parent().next().length == 0 && anchorOffset > 0){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("right", 1, "rangeOfSelect");
event.preventDefault();
}
else if(anchor.is("#luckysheet-rich-text-editor") && anchor.context.childElementCount == anchorOffset){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("right", 1, "rangeOfSelect");
event.preventDefault();
}
else if(anchor.parent().is("#luckysheet-rich-text-editor") && anchor.context.length == anchorOffset){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("right", 1, "rangeOfSelect");
event.preventDefault();
}
}
}
}
}
export function keyboardInitial(){
const _locale = locale();
const locale_drag = _locale.drag;
//单元格编辑输入
$("#luckysheet-input-box").click(function () {
formula.rangeHightlightselected($("#luckysheet-rich-text-editor"));
}).add("#" + Store.container).on("keydown", function (event) {
if ($("#luckysheet-modal-dialog-mask").is(":visible") || $(event.target).hasClass("luckysheet-mousedown-cancel") || $(event.target).hasClass("formulaInputFocus")) {
return;
}
let ctrlKey = event.ctrlKey;
let altKey = event.altKey;
let shiftKey = event.shiftKey;
let kcode = event.keyCode;
if ($("#luckysheet-modal-dialog-mask").is(":visible") || $(event.target).hasClass("luckysheet-mousedown-cancel") || $(event.target).hasClass("sp-input") || (parseInt($("#luckysheet-input-box").css("top")) > 0 && $(event.target).closest(".luckysheet-input-box").length > 0 && kcode != keycode.ENTER && kcode != keycode.TAB && kcode != keycode.UP && kcode != keycode.DOWN && kcode != keycode.LEFT && kcode != keycode.RIGHT)) {
let anchor = $(window.getSelection().anchorNode);
if(anchor.parent().is("#luckysheet-helpbox-cell") || anchor.is("#luckysheet-helpbox-cell")){
if(kcode == keycode.ENTER){
let helpboxValue = $("#luckysheet-helpbox-cell").text();
if(formula.iscelldata(helpboxValue)){
let cellrange = formula.getcellrange(helpboxValue);
Store.luckysheet_select_save = [{ "row": cellrange["row"], "column": cellrange["column"], "row_focus": cellrange["row"][0], "column_focus": cellrange["column"][0] }];
selectHightlightShow();
$("#luckysheet-helpbox-cell").blur();
let scrollLeft = $("#luckysheet-cell-main").scrollLeft(),
scrollTop = $("#luckysheet-cell-main").scrollTop();
let winH = $("#luckysheet-cell-main").height(),
winW = $("#luckysheet-cell-main").width();
let row = Store.visibledatarow[cellrange["row"][1]],
row_pre = cellrange["row"][0] - 1 == -1 ? 0 : Store.visibledatarow[cellrange["row"][0] - 1];
let col = Store.visibledatacolumn[cellrange["column"][1]],
col_pre = cellrange["column"][0] - 1 == -1 ? 0 : Store.visibledatacolumn[cellrange["column"][0] - 1];
if (col - scrollLeft - winW + 20 > 0) {
$("#luckysheet-scrollbar-x").scrollLeft(col - winW + 20);
}
else if (col_pre - scrollLeft - 20 < 0) {
$("#luckysheet-scrollbar-x").scrollLeft(col_pre - 20);
}
if (row - scrollTop - winH + 20 > 0) {
$("#luckysheet-scrollbar-y").scrollTop(row - winH + 20);
}
else if (row_pre - scrollTop - 20 < 0) {
$("#luckysheet-scrollbar-y").scrollTop(row_pre - 20);
}
}
}
}
return;
}
let $inputbox = $("#luckysheet-input-box");
if (kcode == keycode.ENTER && parseInt($inputbox.css("top")) > 0) {
if ($("#luckysheet-formula-search-c").is(":visible") && formula.searchFunctionCell != null) {
formula.searchFunctionEnter($("#luckysheet-formula-search-c").find(".luckysheet-formula-search-item-active"));
}
else {
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");
}
//若有参数弹出框,隐藏
if($("#luckysheet-search-formula-parm").is(":visible")){
$("#luckysheet-search-formula-parm").hide();
}
//若有参数选取范围弹出框,隐藏
if($("#luckysheet-search-formula-parm-select").is(":visible")){
$("#luckysheet-search-formula-parm-select").hide();
}
event.preventDefault();
}
else if (kcode == keycode.TAB) {
if (parseInt($inputbox.css("top")) > 0) {
return;
}
luckysheetMoveHighlightCell("right", 1, "rangeOfSelect");
event.preventDefault();
}
else if(kcode == keycode.F2){
if (parseInt($inputbox.css("top")) > 0) {
return;
}
let last = Store.luckysheet_select_save[Store.luckysheet_select_save.length - 1];
let row_index = last["row_focus"], col_index = last["column_focus"];
let row = Store.visibledatarow[row_index],
row_pre = row_index - 1 == -1 ? 0 : Store.visibledatarow[row_index - 1];
let col = Store.visibledatacolumn[col_index],
col_pre = col_index - 1 == -1 ? 0 : Store.visibledatacolumn[col_index - 1];
luckysheetupdateCell(row, row_pre, row_index, col, col_pre, col_index, Store.flowdata);
event.preventDefault();
}
else if (kcode == keycode.F4 && parseInt($inputbox.css("top")) > 0) {
formula.setfreezonFuc(event);
event.preventDefault();
}
else if (kcode == keycode.ESC && parseInt($inputbox.css("top")) > 0) {
formula.dontupdate();
luckysheetMoveHighlightCell("down", 0, "rangeOfSelect");
event.preventDefault();
}
else if (kcode == keycode.ENTER) {
if($(event.target).hasClass("formulaInputFocus") || $("#luckysheet-conditionformat-dialog").is(":visible")){
return;
}
else if (String.fromCharCode(kcode) != null && $("#luckysheet-cell-selected").is(":visible")) {
let last = Store.luckysheet_select_save[Store.luckysheet_select_save.length - 1];
let row_index = last["row_focus"], col_index = last["column_focus"];
let row = Store.visibledatarow[row_index],
row_pre = row_index - 1 == -1 ? 0 : Store.visibledatarow[row_index - 1];
let col = Store.visibledatacolumn[col_index],
col_pre = col_index - 1 == -1 ? 0 : Store.visibledatacolumn[col_index - 1];
let margeset = menuButton.mergeborer(Store.flowdata, row_index, col_index);
if(!!margeset){
row = margeset.row[1];
row_pre = margeset.row[0];
row_index = margeset.row[2];
col = margeset.column[1];
col_pre = margeset.column[0];
col_index = margeset.column[2];
}
luckysheetupdateCell(row, row_pre, row_index, col, col_pre, col_index, Store.flowdata);
event.preventDefault();
}
}
else {
if (ctrlKey || event.metaKey) {
if (shiftKey) {
if (!luckysheet_shiftkeydown) {
Store.luckysheet_shiftpositon = $.extend(true, {}, Store.luckysheet_select_save[Store.luckysheet_select_save.length - 1]);
Store.luckysheet_shiftkeydown = true;
}
//Ctrl + shift + 方向键 调整选区
if (kcode == keycode.UP) {
if (parseInt($inputbox.css("top")) > 0 || $("#luckysheet-singleRange-dialog").is(":visible") || $("#luckysheet-multiRange-dialog").is(":visible")) {
return;
}
luckysheetMoveHighlightRange2("up", "rangeOfSelect");
}
else if (kcode == keycode.DOWN) {
if (parseInt($inputbox.css("top")) > 0 || $("#luckysheet-singleRange-dialog").is(":visible") || $("#luckysheet-multiRange-dialog").is(":visible")) {
return;
}
luckysheetMoveHighlightRange2("down", "rangeOfSelect");
}
else if (kcode == keycode.LEFT) {
if (parseInt($inputbox.css("top")) > 0 || $("#luckysheet-singleRange-dialog").is(":visible") || $("#luckysheet-multiRange-dialog").is(":visible")) {
return;
}
luckysheetMoveHighlightRange2("left", "rangeOfSelect");
}
else if (kcode == keycode.RIGHT) {
if (parseInt($inputbox.css("top")) > 0 || $("#luckysheet-singleRange-dialog").is(":visible") || $("#luckysheet-multiRange-dialog").is(":visible")) {
return;
}
luckysheetMoveHighlightRange2("right", "rangeOfSelect");
}
}
else if (kcode == 66) {//Ctrl + B 加粗
$("#luckysheet-icon-bold").click();
}
else if (kcode == 67) {//Ctrl + C 复制
//复制时存在格式刷状态,取消格式刷
if(menuButton.luckysheetPaintModelOn){
menuButton.cancelPaintModel();
}
if(Store.luckysheet_select_save.length == 0){
return;
}
//复制范围内包含部分合并单元格,提示
if(Store.config["merge"] != null){
let has_PartMC = false;
for(let s = 0; s < Store.luckysheet_select_save.length; s++){
let r1 = Store.luckysheet_select_save[s].row[0],
r2 = Store.luckysheet_select_save[s].row[1];
let c1 = Store.luckysheet_select_save[s].column[0],
c2 = Store.luckysheet_select_save[s].column[1];
has_PartMC = hasPartMC(Store.config, r1, r2, c1, c2);
if(has_PartMC){
break;
}
}
if(has_PartMC){
if(isEditMode()){
alert(locale_drag.noMerge);
}
else{
tooltip.info(locale_drag.noMerge, "");
}
return;
}
}
//多重选区 有条件格式时 提示
let cdformat = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)].luckysheet_conditionformat_save;
if(Store.luckysheet_select_save.length > 1 && cdformat != null && cdformat.length > 0){
let hasCF = false;
let cf_compute = conditionformat.getComputeMap();
label:
for(let s = 0; s < Store.luckysheet_select_save.length; s++){
if(hasCF){
break;
}
let r1 = Store.luckysheet_select_save[s].row[0],
r2 = Store.luckysheet_select_save[s].row[1];
let c1 = Store.luckysheet_select_save[s].column[0],
c2 = Store.luckysheet_select_save[s].column[1];
for(let r = r1; r <= r2; r++){
for(let c = c1; c <= c2; c++){
if(conditionformat.checksCF(r, c, cf_compute) != null){
hasCF = true;
continue label;
}
}
}
}
if(hasCF){
if(isEditMode()){
alert(locale_drag.noMulti);
}
else{
tooltip.info(locale_drag.noMulti, "");
}
return;
}
}
//多重选区 行不一样且列不一样时 提示
if(Store.luckysheet_select_save.length > 1){
let isSameRow = true,
str_r = luckysheet_select_save[0].row[0],
end_r = luckysheet_select_save[0].row[1];
let isSameCol = true,
str_c = luckysheet_select_save[0].column[0],
end_c = luckysheet_select_save[0].column[1];
for(let s = 1; s < luckysheet_select_save.length; s++){
if(luckysheet_select_save[s].row[0] != str_r || luckysheet_select_save[s].row[1] != end_r){
isSameRow = false;
}
if(luckysheet_select_save[s].column[0] != str_c || luckysheet_select_save[s].column[1] != end_c){
isSameCol = false;
}
}
if((!isSameRow && !isSameCol) || selectIsOverlap()){
if(isEditMode()){
alert(locale_drag.noMulti);
}
else{
tooltip.info(locale_drag.noMulti, "");
}
return;
}
}
selection.copy(event);
Store.luckysheet_paste_iscut = false;
luckysheetactiveCell();
event.stopPropagation();
return;
}
else if (kcode == 70) {//Ctrl + F 查找
searchReplace.createDialog(0);
searchReplace.init();
$("#luckysheet-search-replace #searchInput input").focus();
}
else if (kcode == 72) {//Ctrl + H 替换
searchReplace.createDialog(1);
searchReplace.init();
$("#luckysheet-search-replace #searchInput input").focus();
}
else if (kcode == 73) {//Ctrl + I 斜体
$("#luckysheet-icon-italic").click();
}
else if (kcode == 86) {//Ctrl + V 粘贴
if(isEditMode()){//此模式下禁用粘贴
return;
}
if($(event.target).hasClass("formulaInputFocus")){
return;
}
if(Store.luckysheet_select_save.length > 1){
if(isEditMode()){
alert(locale_drag.noPaste);
}
else{
tooltip.info(locale_drag.noPaste, "");
}
return;
}
selection.isPasteAction = true;
luckysheetactiveCell();
event.stopPropagation();
return;
}
else if (kcode == 88) {//Ctrl + X 剪切
//复制时存在格式刷状态,取消格式刷
if(menuButton.luckysheetPaintModelOn){
menuButton.cancelPaintModel();
}
if(Store.luckysheet_select_save.length == 0){
return;
}
//复制范围内包含部分合并单元格,提示
if(Store.config["merge"] != null){
let has_PartMC = false;
for(let s = 0; s < Store.luckysheet_select_save.length; s++){
let r1 = Store.luckysheet_select_save[s].row[0],
r2 = Store.luckysheet_select_save[s].row[1];
let c1 = Store.luckysheet_select_save[s].column[0],
c2 = Store.luckysheet_select_save[s].column[1];
has_PartMC = hasPartMC(Store.config, r1, r2, c1, c2);
if(has_PartMC){
break;
}
}
if(has_PartMC){
if(luckysheetConfigsetting.editMode){
alert(_locale_drag.noMerge);
}
else{
tooltip.info(_locale_drag.noMerge, "");
}
return;
}
}
//多重选区时 提示
if(Store.luckysheet_select_save.length > 1){
if(isEditMode()){
alert(locale_drag.noMulti);
}
else{
tooltip.info(locale_drag.noMulti, "");
}
return;
}
selection.copy(event);
Store.luckysheet_paste_iscut = true;
luckysheetactiveCell();
event.stopPropagation();
return;
}
else if (kcode == 90) {//Ctrl + Z 撤销
controlHistory.redo(event);
luckysheetactiveCell();
event.stopPropagation();
return;
}
else if (kcode == 89) {//Ctrl + Y 重做
controlHistory.undo(event);
luckysheetactiveCell();
event.stopPropagation();
return;
}
else if (kcode == keycode.UP) {//Ctrl + up 调整单元格
if (parseInt($inputbox.css("top")) > 0 || $("#luckysheet-singleRange-dialog").is(":visible") || $("#luckysheet-multiRange-dialog").is(":visible")) {
return;
}
luckysheetMoveHighlightCell2("up", "rangeOfSelect");
}
else if (kcode == keycode.DOWN) {//Ctrl + down 调整单元格
if (parseInt($inputbox.css("top")) > 0 || $("#luckysheet-singleRange-dialog").is(":visible") || $("#luckysheet-multiRange-dialog").is(":visible")) {
return;
}
luckysheetMoveHighlightCell2("down", "rangeOfSelect");
}
else if (kcode == keycode.LEFT) {//Ctrl + top 调整单元格
if (parseInt($inputbox.css("top")) > 0 || $("#luckysheet-singleRange-dialog").is(":visible") || $("#luckysheet-multiRange-dialog").is(":visible")) {
return;
}
luckysheetMoveHighlightCell2("left", "rangeOfSelect");
}
else if (kcode == keycode.RIGHT) {//Ctrl + right 调整单元格
if (parseInt($inputbox.css("top")) > 0 || $("#luckysheet-singleRange-dialog").is(":visible") || $("#luckysheet-multiRange-dialog").is(":visible")) {
return;
}
luckysheetMoveHighlightCell2("right", "rangeOfSelect");
}
else if (String.fromCharCode(kcode).toLocaleUpperCase() == "A") {//Ctrl + A 全选
$("#luckysheet-left-top").trigger("mousedown");
$(document).trigger("mouseup");
}
event.preventDefault();
return;
}
else if (shiftKey && (kcode == keycode.UP || kcode == keycode.DOWN || kcode == keycode.LEFT || kcode == keycode.RIGHT || (altKey && (kcode == 53 || kcode == 101)))) {
if (parseInt($inputbox.css("top")) > 0 || $(event.target).hasClass("formulaInputFocus")) {
return;
}
if (!luckysheet_shiftkeydown) {
Store.luckysheet_shiftpositon = $.extend(true, {}, Store.luckysheet_select_save[Store.luckysheet_select_save.length - 1]);
Store.luckysheet_shiftkeydown = true;
}
//shift + 方向键 调整选区
if (kcode == keycode.UP) {
if($("#luckysheet-singleRange-dialog").is(":visible") || $("#luckysheet-multiRange-dialog").is(":visible")){
return;
}
luckysheetMoveHighlightRange("down", -1, "rangeOfSelect");
}
else if (kcode == keycode.DOWN) {
if($("#luckysheet-singleRange-dialog").is(":visible") || $("#luckysheet-multiRange-dialog").is(":visible")){
return;
}
luckysheetMoveHighlightRange("down", 1, "rangeOfSelect");
}
else if (kcode == keycode.LEFT) {
if($("#luckysheet-singleRange-dialog").is(":visible") || $("#luckysheet-multiRange-dialog").is(":visible")){
return;
}
luckysheetMoveHighlightRange("right", -1, "rangeOfSelect");
}
else if (kcode == keycode.RIGHT) {
if($("#luckysheet-singleRange-dialog").is(":visible") || $("#luckysheet-multiRange-dialog").is(":visible")){
return;
}
luckysheetMoveHighlightRange("right", 1, "rangeOfSelect");
}
else if (altKey && (kcode == 53 || kcode == 101)) {
//Alt + Shift + 5(删除线)
$("#luckysheet-icon-strikethrough").click();
}
event.preventDefault();
}
else if (kcode == keycode.ESC) {
if(menuButton.luckysheetPaintModelOn){
menuButton.cancelPaintModel();
}
else{
cleargridelement(event);
event.preventDefault();
}
selectHightlightShow();
}
else if (kcode == keycode.DELETE) {
$("#luckysheet-delete-text").click();
event.preventDefault();
}
else if (kcode == keycode.UP) {
if (parseInt($inputbox.css("top")) > 0 || $(event.target).hasClass("formulaInputFocus") || $("#luckysheet-singleRange-dialog").is(":visible") || $("#luckysheet-multiRange-dialog").is(":visible")) {
return;
}
luckysheetMoveHighlightCell("down", -1, "rangeOfSelect");
event.preventDefault();
}
else if (kcode == keycode.DOWN) {
if (parseInt($inputbox.css("top")) > 0 || $(event.target).hasClass("formulaInputFocus") || $("#luckysheet-singleRange-dialog").is(":visible") || $("#luckysheet-multiRange-dialog").is(":visible")) {
return;
}
luckysheetMoveHighlightCell("down", 1, "rangeOfSelect");
event.preventDefault();
}
else if (kcode == keycode.LEFT) {
if (parseInt($inputbox.css("top")) > 0 || $(event.target).hasClass("formulaInputFocus") || $("#luckysheet-singleRange-dialog").is(":visible") || $("#luckysheet-multiRange-dialog").is(":visible")) {
return;
}
luckysheetMoveHighlightCell("right", -1, "rangeOfSelect");
event.preventDefault();
}
else if (kcode == keycode.RIGHT) {
if (parseInt($inputbox.css("top")) > 0 || $(event.target).hasClass("formulaInputFocus") || $("#luckysheet-singleRange-dialog").is(":visible") || $("#luckysheet-multiRange-dialog").is(":visible")) {
return;
}
luckysheetMoveHighlightCell("right", 1, "rangeOfSelect");
event.preventDefault();
}
else if (!((kcode >= 112 && kcode <= 123) || kcode <= 46 || kcode == 144 || kcode == 108 || event.ctrlKey || event.altKey || (event.shiftKey && (kcode == 37 || kcode == 38 || kcode == 39 || kcode == 40))) || kcode == 8 || kcode == 32 || kcode == 46 || kcode == 0 || (event.ctrlKey && kcode == 86)) {
if (String.fromCharCode(kcode) != null && $("#luckysheet-cell-selected").is(":visible") && (kcode != keycode.CAPSLOCK && kcode != keycode.WIN && kcode != 18)) {
let last = Store.luckysheet_select_save[Store.luckysheet_select_save.length - 1];
let row_index = last["row_focus"], col_index = last["column_focus"];
let row = Store.visibledatarow[row_index],
row_pre = row_index - 1 == -1 ? 0 : Store.visibledatarow[row_index - 1];
let col = Store.visibledatacolumn[col_index],
col_pre = col_index - 1 == -1 ? 0 : Store.visibledatacolumn[col_index - 1];
let margeset = menuButton.mergeborer(Store.flowdata, row_index, col_index);
if(!!margeset){
row = margeset.row[1];
row_pre = margeset.row[0];
row_index = margeset.row[2];
col = margeset.column[1];
col_pre = margeset.column[0];
col_index = margeset.column[2];
}
luckysheetupdateCell(row, row_pre, row_index, col, col_pre, col_index, Store.flowdata, true);
if(kcode == 8){
$("#luckysheet-rich-text-editor").html("<br/>");
}
formula.functionInputHanddler($("#luckysheet-functionbox-cell"), $("#luckysheet-rich-text-editor"), kcode);
}
}
}
luckysheetactiveCell();
event.stopPropagation();
});
//单元格编辑 keydown (公式 上下左右键移动)
$("#" + Store.container).add("#luckysheet-input-box").keydown(function (event) {
if ($("#luckysheet-modal-dialog-mask").is(":visible") || $(event.target).hasClass("luckysheet-mousedown-cancel") || $(event.target).hasClass("formulaInputFocus")) {
return;
}
let ctrlKey = event.ctrlKey;
let altKey = event.altKey;
let shiftKey = event.shiftKey;
let kcode = event.keyCode;
let $inputbox = $("#luckysheet-input-box");
if (kcode == keycode.ESC && parseInt($("#luckysheet-input-box").css("top")) > 0) {
formula.dontupdate();
luckysheetMoveHighlightCell("down", 0, "rangeOfSelect");
event.preventDefault();
}
else if (kcode == keycode.ENTER && parseInt($inputbox.css("top")) > 0) {
if ($("#luckysheet-formula-search-c").is(":visible") && formula.searchFunctionCell != null) {
formula.searchFunctionEnter($("#luckysheet-formula-search-c").find(".luckysheet-formula-search-item-active"));
event.preventDefault();
}
}
else if(kcode == keycode.TAB && parseInt($inputbox.css("top")) > 0){
if ($("#luckysheet-formula-search-c").is(":visible") && formula.searchFunctionCell != null) {
formula.searchFunctionEnter($("#luckysheet-formula-search-c").find(".luckysheet-formula-search-item-active"));
}
else{
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("right", 1, "rangeOfSelect");
}
event.preventDefault();
}
else if (kcode == keycode.F4 && parseInt($inputbox.css("top")) > 0) {
formula.setfreezonFuc(event);
event.preventDefault();
}
else if (kcode == keycode.UP && parseInt($inputbox.css("top")) > 0) {
formulaMoveEvent("up", ctrlKey, shiftKey);
}
else if (kcode == keycode.DOWN && parseInt($inputbox.css("top")) > 0) {
formulaMoveEvent("down", ctrlKey, shiftKey);
}
else if (kcode == keycode.LEFT && parseInt($inputbox.css("top")) > 0) {
formulaMoveEvent("left", ctrlKey, shiftKey);
}
else if (kcode == keycode.RIGHT && parseInt($inputbox.css("top")) > 0) {
formulaMoveEvent("right", ctrlKey, shiftKey);
}
else if (!((kcode >= 112 && kcode <= 123) || kcode <= 46 || kcode == 144 || kcode == 108 || event.ctrlKey || event.altKey || (event.shiftKey && (kcode == 37 || kcode == 38 || kcode == 39 || kcode == 40))) || kcode == 8 || kcode == 32 || kcode == 46 || (event.ctrlKey && kcode == 86)) {
formula.functionInputHanddler($("#luckysheet-functionbox-cell"), $("#luckysheet-rich-text-editor"), kcode);
}
}).keyup(function (e) {
let kcode = e.keyCode;
if (!e.shiftKey && kcode == 16) {
Store.luckysheet_shiftkeydown = false;
Store.luckysheet_shiftpositon = null;
}
//输入框中文输入后 shift 和 空格 处理
if(parseInt($("#luckysheet-input-box").css("top")) > 0 && (kcode == 13 || kcode == 16 || kcode == 32)){
formula.functionInputHanddler($("#luckysheet-functionbox-cell"), $("#luckysheet-rich-text-editor"), kcode);
}
e.preventDefault();
});
//top workBook rename
$("#luckysheet_info_detail_input").val(server.title).css("width", getByteLen(server.title) * 10).keydown(function(){
let ctrlKey = event.ctrlKey;
let altKey = event.altKey;
let shiftKey = event.shiftKey;
let kcode = event.keyCode;
let $t = $(this);
if(kcode == keycode.ENTER){
$t.blur().change();
}
}).bind('input propertychange', function() {
let $t = $(this);
let inputlen = getByteLen($t.val())*10;
let updatelen = $("#luckysheet_info_detail_update").outerWidth();
let savelen = $("#luckysheet_info_detail_save").outerWidth();
let userlen = $("#luckysheet_info_detail_user").parent().outerWidth()+60;
let containerlen = $("#" + Store.container).outerWidth();
let otherlen = 100;
let minuslen = containerlen- savelen - updatelen - userlen - otherlen;
if(inputlen > minuslen){
$("#luckysheet_info_detail_input").css("width", minuslen);
}
else{
$("#luckysheet_info_detail_input").css("width", inputlen);
}
}).change(function(){
server.saveParam("na", null, $(this).val());
});
}

1241
src/controllers/matrixOperation.js

File diff suppressed because it is too large

273
src/controllers/orderBy.js

@ -0,0 +1,273 @@
import { modelHTML } from './constant';
import { selectHightlightShow } from './select';
import {
replaceHtml,
chatatABC,
} from '../utils/util';
import { rowlenByRange } from '../global/getRowlen';
import { isEditMode } from '../global/validate';
import cleargridelement from '../global/cleargridelement';
import {
jfrefreshgrid,
} from '../global/refresh';
import { getcellvalue } from '../global/getdata';
import { orderbydata, sortColumnSeletion } from '../global/sort';
import tooltip from '../global/tooltip';
import editor from '../global/editor';
import { isdatatype } from '../global/datecontroll';
import Store from '../store';
import locale from '../locale/locale';
export function orderByInitial(){
const _locale = locale();
//菜单栏 排序按钮
$("#luckysheetorderbyasc, #luckysheetorderbyasc_t").mousedown(function (event) {
cleargridelement(event);
sortColumnSeletion(Store.orderbyindex, true);
selectHightlightShow();
});
$("#luckysheetorderbydesc, #luckysheetorderbydesc_t").click(function (event) {
cleargridelement(event);
sortColumnSeletion(Store.orderbyindex, false);
selectHightlightShow();
});
//排序事件
let luckysheet_sort_initial = true;
$("#luckysheetorderby").click(function () {
$("body .luckysheet-cols-menu").hide();
const locale_sort = _locale.sort;
if(Store.luckysheet_select_save.length > 1){
if(isEditMode()){
alert(locale_sort.noRangeError);
}
else{
tooltip.info(locale_sort.noRangeError, "");
}
return;
}
let last = Store.luckysheet_select_save[0];
let r1 = last["row"][0], r2 = last["row"][1];
let c1 = last["column"][0], c2 = last["column"][1];
if (luckysheet_sort_initial) {
luckysheet_sort_initial = false;
let content = `<div style="overflow: hidden;" class="luckysheet-sort-modal"><div><label><input type="checkbox" id="luckysheet-sort-haveheader"/><span>${locale_sort.hasTitle}</span></label></div><div style="overflow-y:auto;" id="luckysheet-sort-dialog-tablec"><table data-itemcount="0" cellspacing="0"> <tr><td>${locale_sort.hasTitle} <select name="sort_0"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> </select> </td> <td> <div><label><input value="asc" type="radio" checked="checked" name="sort_0"><span>${locale_sort.asc}A-Z</span></label></div> <div><label><input value="desc" type="radio" name="sort_0"><span>${locale_sort.desc}Z-A</span></label></div></td></tr></table></div><div style="background: #e5e5e5;border-top: 1px solid #f5f5f5; height: 1px; width: 100%;margin:2px 0px;margin-bottom:10px;"></div> <div> <span style="font-weight: bold; text-decoration: underline;text-align:center;color: blue;cursor: pointer;" class="luckysheet-sort-dialog-additem">+ ${locale_sort.addOthers}</span> </div> </div>`;
$("body").append(replaceHtml(modelHTML, { "id": "luckysheet-sort-dialog", "addclass": "", "title": _locale.sort.sortTitle, "content": content, "botton": `<button id="luckysheet-sort-modal-confirm" class="btn btn-primary">${locale_sort.confirm}</button><button class="btn btn-default luckysheet-model-close-btn">${locale_sort.close}</button>`}));
$("#luckysheet-sort-dialog .luckysheet-sort-dialog-additem").click(function () {
let last = Store.luckysheet_select_save[0];
let r1 = last["row"][0], r2 = last["row"][1];
let c1 = last["column"][0], c2 = last["column"][1];
let option = "", i = $("#luckysheet-sort-dialog table").data("itemcount") + 1;
let t = $("#luckysheet-sort-haveheader").is(':checked');
for (let c = c1; c <= c2; c++) {
if (t) {
let v = getcellvalue(r1, c, Store.flowdata, "m");
if(v == null){
v = locale_sort.columnOperation + (c - c1 + 1);
}
option += '<option value="' + c + '">' + v + '</option>';
}
else {
option += '<option value="' + c + '">' + chatatABC(c) + '</option>';
}
}
$("#luckysheet-sort-dialog table").append(`
<tr class="luckysheet-sort-dialog-tr">
<td><span class="luckysheet-sort-item-close" onclick="$(this).parent().parent().remove();"><i class="fa fa-times"
aria-hidden="true"></i></span>${locale_sort.secondaryTitle} <select
name="sort_${i}">${option}</select> </td>
<td>
<div><label><input value="asc" type="radio" checked="checked"
name="sort_${i}"><span>${locale_sort.asc}A-Z</span></label></div>
<div><label><input value="desc" type="radio" name="sort_${i}"><span>${locale_sort.desc}Z-A</span></label>
</div>
</td>
</tr>
`);
$("#luckysheet-sort-dialog table").data("itemcount", i);
});
$("#luckysheet-sort-haveheader").change(function () {
let last = Store.luckysheet_select_save[0];
let r1 = last["row"][0], r2 = last["row"][1];
let c1 = last["column"][0], c2 = last["column"][1];
let t = $(this).is(':checked');
let option = "";
for (let c = c1; c <= c2; c++) {
if (t) {
let v = getcellvalue(r1, c, Store.flowdata, "m");
if(v == null){
v = locale_sort.columnOperation + (c - c1 + 1);
}
option += '<option value="' + c + '">' + v + '</option>';
}
else {
option += '<option value="' + c + '">' + chatatABC(c) + '</option>';
}
}
$("#luckysheet-sort-dialog tr select").each(function () {
$(this).html(option);
});
});
//Custom sort
$("#luckysheet-sort-modal-confirm").click(function () {
if(Store.luckysheet_select_save.length > 1){
if(isEditMode()){
alert(locale_sort.noRangeError);
}
else{
tooltip.info(locale_sort.noRangeError, "");
}
return;
}
let d = editor.deepCopyFlowData(Store.flowdata);
let last = Store.luckysheet_select_save[0];
let r1 = last["row"][0], r2 = last["row"][1];
let c1 = last["column"][0], c2 = last["column"][1];
//Data has header row
let t = $("#luckysheet-sort-haveheader").is(':checked');
let str;
if(t){
str = r1 + 1;
}
else{
str = r1;
}
let hasMc = false; //Whether the sort selection has merged cells
let data = [];
for(let r = str; r <= r2; r++){
let data_row = [];
for(let c = c1; c <= c2; c++){
if(d[r][c] != null && d[r][c].mc != null){
hasMc = true;
break;
}
data_row.push(d[r][c]);
}
data.push(data_row);
}
if(hasMc){
if(isEditMode()){
alert(locale_sort.mergeError);
}
else{
tooltip.info(locale_sort.mergeError, "");
}
return;
}
$($("#luckysheet-sort-dialog table tr").toArray().reverse()).each(function () {
let i = $(this).find("select").val(),
asc = $(this).find('input:radio:checked').val();
i -= c1;
if (asc == "asc") {
asc = true;
}
else {
asc = false;
}
data = orderbydata([].concat(data), i, asc);
});
for(let r = str; r <= r2; r++){
for(let c = c1; c <= c2; c++){
d[r][c] = data[r - str][c - c1];
}
}
if(Store.config["rowlen"] != null){
let cfg = $.extend(true, {}, Store.config);
cfg = rowlenByRange(d, str, r2, cfg);
jfrefreshgrid(d, [{ "row": [str, r2], "column": [c1, c2] }], cfg, null, true);
}
else{
jfrefreshgrid(d, [{ "row": [str, r2], "column": [c1, c2] }]);
}
$("#luckysheet-sort-dialog").hide();
$("#luckysheet-modal-dialog-mask").hide();
});
}
let option = "";
for (let c = c1; c <= c2; c++) {
option += '<option value="' + c + '">' + chatatABC(c) + '</option>';
}
$("#luckysheet-sort-dialog select").html(option);
$("#luckysheet-sort-dialog .luckysheet-sort-dialog-tr").remove();
$("#luckysheet-sort-haveheader").prop("checked", false);
$("#luckysheet-sort-dialog input:radio:first").prop("checked", "checked");
$("#luckysheet-sort-dialog .luckysheet-modal-dialog-title-text").html(locale_sort.sortRangeTitle+"<span>" + chatatABC(c1) + (r1 + 1) + "</span>"+ locale_sort.sortRangeTitleTo +"<span>" + chatatABC(c2) + (r2 + 1) + "</span>");
let $t = $("#luckysheet-sort-dialog"), myh = $t.outerHeight(), myw = $t.outerWidth();
let winw = $(window).width(), winh = $(window).height();
let scrollLeft = $(document).scrollLeft(), scrollTop = $(document).scrollTop();
$("#luckysheet-sort-dialog-tablec").css("max-height", (winh - myh) / 2);
$("#luckysheet-sort-dialog").css({ "left": (winw + scrollLeft - myw) / 2, "top": (winh + scrollTop - myh) / 2 }).show();
$("#luckysheet-modal-dialog-mask").show();
if (r1 < r2) {
setTimeout(function () {
let flowrowdata1 = Store.flowdata[r1],
flowrowdata2 = Store.flowdata[r1 + 1],
hastitle = false;
for (let i = c1; i <= c2; i++) {
let isdatatype_r1 = isdatatype(flowrowdata1[i]),
isdatatype_r2 = isdatatype(flowrowdata2[i]);
if (isdatatype_r1 != isdatatype_r2) {
hastitle = true;
}
}
if (hastitle) {
$("#luckysheet-sort-haveheader").prop("checked", true).change();
}
}, 10);
}
});
}

2
src/controllers/pivotTable.js

@ -873,7 +873,7 @@ const pivotTable = {
if (_this.initial) {
_this.initial = false;
$("body").append(luckysheetPivotTableHTML);
$("body").append(luckysheetPivotTableHTML());
$("#luckysheet-modal-dialog-slider-close").click(function () {
$("#luckysheet-modal-dialog-slider-pivot").hide();
luckysheetsizeauto();

1620
src/controllers/rowColumnOperation.js

File diff suppressed because it is too large

6
src/controllers/searchReplace.js

@ -21,6 +21,7 @@ const luckysheetSearchReplace = {
const _locale = locale();
const locale_findAndReplace = _locale.findAndReplace;
const locale_button = _locale.button;
let content = '<div class="tabBox">' +
'<span id="searchTab">'+ locale_findAndReplace.find +'</span>' +
@ -58,8 +59,9 @@ const luckysheetSearchReplace = {
"addclass": "luckysheet-search-replace",
"title": "",
"content": content,
"botton": '<button class="btn btn-default luckysheet-model-close-btn">关闭</button>',
"style": "z-index:100003"
"botton": '<button class="btn btn-default luckysheet-model-close-btn">'+locale_button.close+'</button>',
"style": "z-index:100003",
"close":locale_button.close
}));
let $t = $("#luckysheet-search-replace").find(".luckysheet-modal-dialog-content").css("min-width", 500).end(),
myh = $t.outerHeight(),

8
src/controllers/select.js

@ -5,6 +5,7 @@ import { rowLocationByIndex, colLocationByIndex } from '../global/location';
import browser from '../global/browser';
import { getSheetIndex, getRangetxt } from '../methods/get';
import Store from '../store';
import locale from '../locale/locale';
//公式函数 选区实体框
function seletedHighlistByindex(id, r1, r2, c1, c2) {
@ -347,6 +348,9 @@ function luckysheet_count_show(left, top, width, height, rowseleted, columnselet
let scrollWidth = $("#luckysheet-cell-main").scrollLeft(),
scrollHeight = $("#luckysheet-cell-main").scrollTop();
const _locale = locale();
const locale_info = _locale.info;
if (rowl >= 4) {
let leftv = left - 25;
if (leftv < 0) {
@ -362,7 +366,7 @@ function luckysheet_count_show(left, top, width, height, rowseleted, columnselet
topv = scrollHeight + drawHeight / 2;
}
$("#luckysheet-row-count-show").css({ "left": leftv, "top": topv, "display": "block" }).html("<div>" + rowl.toString().split("").join("</div><div>") + "</div><div></div>");
$("#luckysheet-row-count-show").css({ "left": leftv, "top": topv, "display": "block" }).html("<div>" + rowl.toString().split("").join("</div><div>") + "</div><div>"+locale_info.row+"</div>");
}
else {
$("#luckysheet-row-count-show").hide();
@ -383,7 +387,7 @@ function luckysheet_count_show(left, top, width, height, rowseleted, columnselet
leftv = scrollWidth + drawWidth / 2;
}
$("#luckysheet-column-count-show").css({ "left": leftv, "top": topv, "display": "block" }).text(coll + "列");
$("#luckysheet-column-count-show").css({ "left": leftv, "top": topv, "display": "block" }).text(coll + locale_info.column);
}
else {
$("#luckysheet-column-count-show").hide();

454
src/controllers/sheetBar.js

@ -0,0 +1,454 @@
import sheetmanage from './sheetmanage';
import server from './server';
import { sheetselectlistitemHTML, sheetselectlistHTML, keycode } from './constant';
import {
replaceHtml,
mouseclickposition,
} from '../utils/util';
import { getSheetIndex } from '../methods/get';
import { isEditMode } from '../global/validate';
import formula from '../global/formula';
import cleargridelement from '../global/cleargridelement';
import tooltip from '../global/tooltip';
import locale from '../locale/locale';
import Store from '../store';
//表格底部名称栏区域 相关事件(增、删、改、隐藏显示、颜色等等)
let isInitialSheetConfig = false, luckysheetcurrentSheetitem = null, jfdbclicklagTimeout = null;
function showsheetconfigmenu() {
if (!isInitialSheetConfig) {
isInitialSheetConfig = true;
const _locale = locale();
let locale_toolbar = _locale.toolbar;
$("#luckysheetsheetconfigcolorur").spectrum({
showPalette: true,
preferredFormat: "hex",
clickoutFiresChange: false,
showInitial: true,
showInput: true,
flat: true,
hideAfterPaletteSelect: false,
showSelectionPalette: true,
maxPaletteSize: 10,
cancelText: _locale.sheetconfig.cancelText,
chooseText: _locale.sheetconfig.chooseText,
togglePaletteMoreText: locale_toolbar.toolMore,
togglePaletteLessText: locale_toolbar.toolLess,
clearText: locale_toolbar.clearText,
noColorSelectedText: locale_toolbar.noColorSelectedText,
palette: [["rgb(0, 0, 0)", "rgb(67, 67, 67)", "rgb(102, 102, 102)", "rgb(204, 204, 204)", "rgb(217, 217, 217)", "rgb(255, 255, 255)"], ["rgb(152, 0, 0)", "rgb(255, 0, 0)", "rgb(255, 153, 0)", "rgb(255, 255, 0)", "rgb(0, 255, 0)", "rgb(0, 255, 255)", "rgb(74, 134, 232)", "rgb(0, 0, 255)", "rgb(153, 0, 255)", "rgb(255, 0, 255)"], ["rgb(230, 184, 175)", "rgb(244, 204, 204)", "rgb(252, 229, 205)", "rgb(255, 242, 204)", "rgb(217, 234, 211)", "rgb(208, 224, 227)", "rgb(201, 218, 248)", "rgb(207, 226, 243)", "rgb(217, 210, 233)", "rgb(234, 209, 220)"], ["rgb(221, 126, 107)", "rgb(234, 153, 153)", "rgb(249, 203, 156)", "rgb(255, 229, 153)", "rgb(182, 215, 168)", "rgb(162, 196, 201)", "rgb(164, 194, 244)", "rgb(159, 197, 232)", "rgb(180, 167, 214)", "rgb(213, 166, 189)"], ["rgb(204, 65, 37)", "rgb(224, 102, 102)", "rgb(246, 178, 107)", "rgb(255, 217, 102)", "rgb(147, 196, 125)", "rgb(118, 165, 175)", "rgb(109, 158, 235)", "rgb(111, 168, 220)", "rgb(142, 124, 195)", "rgb(194, 123, 160)"], ["rgb(166, 28, 0)", "rgb(204, 0, 0)", "rgb(230, 145, 56)", "rgb(241, 194, 50)", "rgb(106, 168, 79)", "rgb(69, 129, 142)", "rgb(60, 120, 216)", "rgb(61, 133, 198)", "rgb(103, 78, 167)", "rgb(166, 77, 121)"], ["rgb(91, 15, 0)", "rgb(102, 0, 0)", "rgb(120, 63, 4)", "rgb(127, 96, 0)", "rgb(39, 78, 19)", "rgb(12, 52, 61)", "rgb(28, 69, 135)", "rgb(7, 55, 99)", "rgb(32, 18, 77)", "rgb(76, 17, 48)"], ["#c1232b", "#27727b", "#fcce10", "#e87c25", "#b5c334", "#fe8463", "#9bca63", "#fad860", "#f3a43b", "#60c0dd", "#d7504b", "#c6e579", "#f4e001", "#f0805a", "#26c0c0", "#c12e34", "#e6b600", "#0098d9", "#2b821d", "#005eaa", "#339ca8", "#cda819", "#32a487", "#3fb1e3", "#6be6c1", "#626c91", "#a0a7e6", "#c4ebad", "#96dee8"]],
change: function (color) {
let $input = $(this);
if (color != null) {
color = color.toHexString();
}
else {
color = "rgb(0, 0, 0)";
}
let oldcolor = null;
if(luckysheetcurrentSheetitem.find(".luckysheet-sheets-item-color").length>0){
oldcolor = luckysheetcurrentSheetitem.find(".luckysheet-sheets-item-color").css("background-color");
}
luckysheetcurrentSheetitem.find(".luckysheet-sheets-item-color").remove();
luckysheetcurrentSheetitem.append('<div class="luckysheet-sheets-item-color" style=" position: absolute; width: 100%; height: 3px; bottom: 0px; left: 0px; background-color: ' + color + ';"></div>');
let index = getSheetIndex(Store.currentSheetIndex);
Store.luckysheetfile[index].color = color;
server.saveParam("all", Store.currentSheetIndex, color, { "k": "color" });
if (Store.clearjfundo) {
let redo = {};
redo["type"] = "sheetColor";
redo["sheetIndex"] = Store.currentSheetIndex;
redo["oldcolor"] = oldcolor;
redo["color"] = color;
Store.jfundo = [];
Store.jfredo.push(redo);
}
}
});
$("#luckysheetsheetconfigcolorreset").click(function () {
let oldcolor = null;
if(luckysheetcurrentSheetitem.find(".luckysheet-sheets-item-color").length>0){
oldcolor = luckysheetcurrentSheetitem.find(".luckysheet-sheets-item-color").css("background-color");
}
luckysheetcurrentSheetitem.find(".luckysheet-sheets-item-color").remove();
let index = getSheetIndex(Store.currentSheetIndex);
Store.luckysheetfile[index].color = null;
server.saveParam("all", Store.currentSheetIndex, null, { "k": "color" } );
if (Store.clearjfundo) {
let redo = {};
redo["type"] = "sheetColor";
redo["sheetIndex"] = Store.currentSheetIndex;
redo["oldcolor"] = oldcolor;
redo["color"] = null;
Store.jfundo = [];
Store.jfredo.push(redo);
}
});
}
let index = getSheetIndex(Store.currentSheetIndex);
if (Store.luckysheetfile[index].color != null && Store.luckysheetfile[index].color.length > 0) {
$("#luckysheetsheetconfigcolorur").spectrum("set", Store.luckysheetfile[index].color);
}
$("#luckysheetsheetconfigcolorur").parent().find("span, div, button, input, a").addClass("luckysheet-mousedown-cancel");
setTimeout(function(){
mouseclickposition($("#luckysheet-rightclick-sheet-menu"), luckysheetcurrentSheetitem.offset().left + luckysheetcurrentSheetitem.width(), luckysheetcurrentSheetitem.offset().top - 18, "leftbottom");
},1);
}
let luckysheetsheetrightclick = function ($t, $cur, e) {
clearTimeout(jfdbclicklagTimeout);
if ($cur.hasClass("luckysheet-sheets-item-name") && $cur.attr("contenteditable") == "true") {
return;
}
if (formula.rangestart || formula.rangedrag_column_start || formula.rangedrag_row_start || formula.israngeseleciton()) {
setTimeout(function () {
formula.setCaretPosition(formula.rangeSetValueTo.get(0), 0, formula.rangeSetValueTo.text().length);
formula.createRangeHightlight();
$("#luckysheet-input-box-index").find(".luckysheet-input-box-index-sheettxt").remove().end().prepend("<span class='luckysheet-input-box-index-sheettxt'>" + sheetmanage.getSheetName(formula.rangetosheet) + "!</span>").show();
$("#luckysheet-input-box-index").css({"left": $("#luckysheet-input-box").css("left"), "top": (parseInt($("#luckysheet-input-box").css("top")) - 20) + "px", "z-index": $("#luckysheet-input-box").css("z-index")});
}, 1);
}
else {
$("#luckysheet-input-box").removeAttr("style");
$("#luckysheet-formula-functionrange .luckysheet-formula-functionrange-highlight").remove();
}
$("#luckysheet-sheet-area div.luckysheet-sheets-item").removeClass("luckysheet-sheets-item-active");
$t.addClass("luckysheet-sheets-item-active");
cleargridelement(e);
sheetmanage.changeSheet($t.data("index"));
$("#luckysheet-sheet-list, #luckysheet-rightclick-sheet-menu").hide();
if ($cur.hasClass("luckysheet-sheets-item-menu") || $cur.hasClass("fa-sort-desc") || e.which == "3") {
luckysheetcurrentSheetitem = $cur.closest(".luckysheet-sheets-item");
showsheetconfigmenu();
}
}
export function initialSheetBar(){
const _locale = locale();
const locale_sheetconfig = _locale.sheetconfig;
$("#luckysheet-sheet-area").on("mousedown", "div.luckysheet-sheets-item", function (e) {
if(isEditMode()){
// alert("非编辑模式下不允许该操作!");
return;
}
let $t = $(this), $cur = $(e.target), $item = $cur.closest(".luckysheet-sheets-item");
if (e.which == "3") {
luckysheetsheetrightclick($t, $cur, e);
luckysheetcurrentSheetitem = $item;
showsheetconfigmenu();
return;
}
if ($item.hasClass("luckysheet-sheets-item-active") && $item.find(".luckysheet-sheets-item-name").attr("contenteditable") == "false") {
jfdbclicklagTimeout = setTimeout(function () {
Store.luckysheet_sheet_move_status = true;
Store.luckysheet_sheet_move_data = {};
Store.luckysheet_sheet_move_data.widthlist = [];
$("#luckysheet-sheet-area div.luckysheet-sheets-item:visible").each(function (i) {
if (i == 0) {
Store.luckysheet_sheet_move_data.widthlist.push(parseInt($(this).outerWidth()));
}
else {
Store.luckysheet_sheet_move_data.widthlist.push(parseInt($(this).outerWidth()) + Store.luckysheet_sheet_move_data.widthlist[i - 1]);
}
});
Store.luckysheet_sheet_move_data.curindex = $("#luckysheet-sheet-area div.luckysheet-sheets-item").index($item);
let x = e.pageX;
Store.luckysheet_sheet_move_data.curleft = x - $item.offset().left;
Store.luckysheet_sheet_move_data.pageX = x;
Store.luckysheet_sheet_move_data.activeobject = $item;
Store.luckysheet_sheet_move_data.cursorobject = $cur;
let $itemclone = $item.clone().css("visibility", "hidden").attr("id", "luckysheet-sheets-item-clone");
$item.after($itemclone);
$item.css({ "position": "absolute", "opacity": 0.8, "cursor": "move", "transition": "initial", "z-index": 10 });
}, 200);
}
}).on("click", "div.luckysheet-sheets-item", function (e) {
if(isEditMode()){
// alert("非编辑模式下不允许该操作!");
return;
}
let $t = $(this), $cur = $(e.target);
luckysheetsheetrightclick($t, $cur, e);
});
let luckysheetsheetnameeditor = function ($t) {
$t.attr("contenteditable", "true").addClass("luckysheet-mousedown-cancel").data("oldtxt", $t.text());
setTimeout(function () {
if (document.selection) {
let range = document.body.createTextRange();
range.moveToElementText($t.get(0));
range.select();
} else if (window.getSelection) {
let range = document.createRange();
range.selectNodeContents($t.get(0));
window.getSelection().removeAllRanges();
window.getSelection().addRange(range);
}
}, 1);
}
$("#luckysheet-sheet-area").on("dblclick", "span.luckysheet-sheets-item-name", function (e) {
luckysheetsheetnameeditor($(this));
});
$("#luckysheet-sheet-area").on("blur", "span.luckysheet-sheets-item-name", function (e) {
let $t = $(this);
let txt = $t.text(), oldtxt = $t.data("oldtxt");
let index = getSheetIndex(Store.currentSheetIndex);
for (let i = 0; i < Store.luckysheetfile.length; i++) {
if (index != i && Store.luckysheetfile[i].name == txt) {
if(isEditMode()){
alert(locale_sheetconfig.tipNameRepeat);
}
else{
tooltip.info("", locale_sheetconfig.tipNameRepeat);
}
$t.text(oldtxt).attr("contenteditable", "false");
return;
}
}
let winW = $(window).width();
let c_width = 0;
$("#luckysheet-sheet-container-c > div.luckysheet-sheets-item:visible").each(function(){
c_width += $(this).outerWidth();
});
if (c_width >= winW * 0.7) {
$("#luckysheet-sheet-area .luckysheet-sheets-scroll").css("display", "inline-block");
$("#luckysheet-sheet-container .docs-sheet-fade-left").show();
}
Store.luckysheetfile[index].name = txt;
server.saveParam("all", Store.currentSheetIndex, txt, { "k": "name" });
$t.attr("contenteditable", "false").removeClass("luckysheet-mousedown-cancel");
if (Store.clearjfundo) {
let redo = {};
redo["type"] = "sheetName";
redo["sheetIndex"] = Store.currentSheetIndex;
redo["oldtxt"] = oldtxt;
redo["txt"] = txt;
Store.jfundo = [];
Store.jfredo.push(redo);
}
});
$("#luckysheet-sheet-area").on("keydown", "span.luckysheet-sheets-item-name", function (e) {
let kcode = e.keyCode;
let $t = $(this);
if (kcode == keycode.ENTER) {
let index = getSheetIndex(Store.currentSheetIndex);
Store.luckysheetfile[index].name = $t.text();
$t.attr("contenteditable", "false");
}
});
$("#luckysheetsheetconfigrename").click(function () {
luckysheetsheetnameeditor(luckysheetcurrentSheetitem.find("span.luckysheet-sheets-item-name"));
$("#luckysheet-input-box").removeAttr("style");
$("#luckysheet-sheet-list, #luckysheet-rightclick-sheet-menu").hide();
});
$("#luckysheetsheetconfigshow").click(function () {
$("#luckysheet-sheets-m").click();
$("#luckysheet-input-box").removeAttr("style");
$("#luckysheet-rightclick-sheet-menu").hide();
});
$("#luckysheetsheetconfigmoveleft").click(function () {
if (luckysheetcurrentSheetitem.prevAll(":visible").length > 0) {
luckysheetcurrentSheetitem.insertBefore(luckysheetcurrentSheetitem.prevAll(":visible").eq(0));
sheetmanage.reOrderAllSheet();
}
$("#luckysheet-input-box").removeAttr("style");
$("#luckysheet-sheet-list, #luckysheet-rightclick-sheet-menu").hide();
});
$("#luckysheetsheetconfigmoveright").click(function () {
if (luckysheetcurrentSheetitem.nextAll(":visible").length > 0) {
luckysheetcurrentSheetitem.insertAfter(luckysheetcurrentSheetitem.nextAll(":visible").eq(0));
sheetmanage.reOrderAllSheet();
}
$("#luckysheet-input-box").removeAttr("style");
$("#luckysheet-sheet-list, #luckysheet-rightclick-sheet-menu").hide();
});
$("#luckysheetsheetconfigdelete").click(function (e) {
$("#luckysheet-sheet-list, #luckysheet-rightclick-sheet-menu").hide();
if($("#luckysheet-sheet-container-c .luckysheet-sheets-item:visible").length <= 1){
if(isEditMode()){
alert(locale_sheetconfig.noMoreSheet);
}
else{
tooltip.info(locale_sheetconfig.noMoreSheet, "");
}
return;
}
let index = getSheetIndex(Store.currentSheetIndex);
tooltip.confirm(locale_sheetconfig.confirmDelete+"【" + Store.luckysheetfile[index].name + "】?", "<span style='color:#9e9e9e;font-size:12px;'>"+locale_sheetconfig.redoDelete+"</span>", function () {
sheetmanage.deleteSheet(luckysheetcurrentSheetitem.data("index"));
}, null);
$("#luckysheet-input-box").removeAttr("style");
});
$("#luckysheetsheetconfigcopy").click(function (e) {
sheetmanage.copySheet(luckysheetcurrentSheetitem.data("index"), e);
$("#luckysheet-input-box").removeAttr("style");
$("#luckysheet-sheet-list, #luckysheet-rightclick-sheet-menu").hide();
});
$("#luckysheetsheetconfighide").click(function () {
if ($("#luckysheet-sheet-area div.luckysheet-sheets-item:visible").length == 1) {
if(isEditMode()){
alert(locale_sheetconfig.noHide);
}
else{
tooltip.info("", locale_sheetconfig.noHide);
}
return;
}
sheetmanage.setSheetHide(luckysheetcurrentSheetitem.data("index"));
$("#luckysheet-input-box").removeAttr("style");
$("#luckysheet-sheet-list, #luckysheet-rightclick-sheet-menu").hide();
});
$("#luckysheet-sheets-add").click(function (e) {
sheetmanage.addNewSheet(e);
sheetmanage.locationSheet();
$("#luckysheet-input-box").removeAttr("style");
});
let sheetscrollani = null, sheetscrollstart = 0, sheetscrollend = 0, sheetscrollstep = 150;
$("#luckysheet-sheets-leftscroll").click(function () {
let $c = $("#luckysheet-sheet-container-c");
sheetscrollstart = $c.scrollLeft();
sheetscrollend = $c.scrollLeft() - sheetscrollstep;
if (sheetscrollend <= 0) {
$("#luckysheet-sheet-container .docs-sheet-fade-left").hide();
}
$("#luckysheet-sheet-container .docs-sheet-fade-right").show();
clearInterval(sheetscrollani);
sheetscrollani = setInterval(function () {
sheetscrollstart -= 4;
$c.scrollLeft(sheetscrollstart);
if (sheetscrollstart <= sheetscrollend) {
clearInterval(sheetscrollani);
}
}, 1);
});
$("#luckysheet-sheets-rightscroll").click(function () {
let $c = $("#luckysheet-sheet-container-c");
sheetscrollstart = $c.scrollLeft();
sheetscrollend = $c.scrollLeft() + sheetscrollstep;
if (sheetscrollstart > 0) {
$("#luckysheet-sheet-container .docs-sheet-fade-right").hide();
}
$("#luckysheet-sheet-container .docs-sheet-fade-left").show();
clearInterval(sheetscrollani);
sheetscrollani = setInterval(function () {
sheetscrollstart += 4;
$c.scrollLeft(sheetscrollstart);
if (sheetscrollstart >= sheetscrollend) {
clearInterval(sheetscrollani);
}
}, 1);
});
let initialOpenSheet = true;
$("#luckysheet-sheets-m").click(function (e) {
$("#luckysheet-sheet-list").html("");
let item = "";
for (let i = 0; i < Store.luckysheetfile.length; i++) {
let f = Store.luckysheetfile[i], icon = '', style = "";
if (f["status"] == 1) {
icon = '<i class="fa fa-check" aria-hidden="true"></i>';
}
if (f["hide"] == 1) {
icon = '<i class="fa fa-low-vision" aria-hidden="true"></i>';
style += "color:#BBBBBB;";
}
if (f["color"] != null && f["color"].length > 0) {
style += "border-right:4px solid " + f["color"] + ";";
}
item += replaceHtml(sheetselectlistitemHTML, { "index": f["index"], "name": f["name"], "icon": icon, "style": style });
}
if (initialOpenSheet) {
$("#" + Store.container).append(replaceHtml(sheetselectlistHTML, { "item": item }));
$("#luckysheet-sheet-list").on("click", ".luckysheet-cols-menuitem", function (e) {
if(isEditMode()){
// tooltip.info("提示", "图表编辑模式下不允许该操作!");
alert(locale_sheetconfig.chartEditNoOpt);
return;
}
let $item = $(this), index = $item.data("index");
if ($item.data("index") != Store.currentSheetIndex) {
sheetmanage.setSheetShow(index);
sheetmanage.locationSheet();
}
});
initialOpenSheet = false;
}
else {
$("#luckysheet-sheet-list").html(item);
}
let $t = $("#luckysheet-sheet-list");
mouseclickposition($t, $(this).offset().left, $(this).offset().top - 12, "leftbottom");
$("#luckysheet-input-box").removeAttr("style");
});
}

26
src/controllers/sheetmanage.js

@ -10,7 +10,7 @@ import editor from '../global/editor';
import { luckysheetextendtable, luckysheetdeletetable } from '../global/extend';
import { isRealNum } from '../global/validate';
import { replaceHtml, getObjType, chatatABC } from '../utils/util';
import { sheetHTML } from './constant';
import { sheetHTML,luckysheetlodingHTML } from './constant';
import server from './server';
import luckysheetConfigsetting from './luckysheetConfigsetting';
import pivotTable from './pivotTable';
@ -20,6 +20,7 @@ import luckysheetFreezen from './freezen';
import { createFilterOptions, labelFilterOptionState } from './filter';
import { selectHightlightShow, selectionCopyShow } from './select';
import Store from '../store';
import locale from '../locale/locale';
const sheetmanage = {
generateRandomSheetIndex: function(prefix) {
@ -62,9 +63,12 @@ const sheetmanage = {
generateCopySheetName: function(file, name) {
let copySheetName = "";
if(name.toString().indexOf("(副本") > -1){
let copy_i = name.toString().indexOf("(副本");
let name2 = name.toString().substring(0, copy_i) + "(副本";
let _locale = locale();
let locale_info = _locale.info;
if(name.toString().indexOf("("+locale_info.copy) > -1){
let copy_i = name.toString().indexOf("("+locale_info.copy);
let name2 = name.toString().substring(0, copy_i) + "("+locale_info.copy;
let index = null;
for(let i = 0; i < file.length; i++){
@ -94,7 +98,7 @@ const sheetmanage = {
else{
let index = null;
let hascopy = false;
let name2 = name + "(副本";
let name2 = name + "("+locale_info.copy;
for(let i = 0; i < file.length; i++){
let fileName = file[i].name.toString();
@ -115,15 +119,15 @@ const sheetmanage = {
if(hascopy){
if(index == null){
copySheetName = name + "(副本2)";
copySheetName = name + "("+ locale_info.copy +"2)";
}
else{
index++;
copySheetName = name + "(副本" + index + ")";
copySheetName = name + "("+ locale_info.copy +"" + index + ")";
}
}
else{
copySheetName = name + "(副本)";
copySheetName = name + "("+ locale_info.copy +")";
}
}
@ -632,7 +636,7 @@ const sheetmanage = {
width: Store.luckysheetTableContentHW[0],
height: Store.luckysheetTableContentHW[1]
}).get(0).getContext("2d");
let locale_info = locale().info;
let key = server.gridKey;
let cahce_key = key + "__qkcache";
@ -663,7 +667,7 @@ const sheetmanage = {
_this.restoreSheetAll(Store.currentSheetIndex);
luckysheetrefreshgrid(0, 0);
$("#luckysheet_info_detail_save").html("已恢复本地缓存");
$("#luckysheet_info_detail_save").html(locale_info.detailSave);
if (!!file.isPivotTable) {
Store.luckysheetcurrentisPivotTable = true;
@ -875,7 +879,7 @@ const sheetmanage = {
server.saveParam("shs", null, Store.currentSheetIndex);
}
else{
$("#luckysheet-grid-window-1").append('<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>渲染中...</span></div></div>');
$("#luckysheet-grid-window-1").append(luckysheetlodingHTML());
let sheetindex = _this.checkLoadSheetIndex(file);

29
src/core.js

@ -7,6 +7,13 @@ import luckysheetConfigsetting from './controllers/luckysheetConfigsetting';
import sheetmanage from './controllers/sheetmanage';
import luckysheetsizeauto from './controllers/resize';
import luckysheetHandler from './controllers/handler';
import {initialFilterHandler} from './controllers/filter';
import {initialMatrixOperation} from './controllers/matrixOperation';
import {initialSheetBar} from './controllers/sheetBar';
import {formulaBarInitial} from './controllers/formulaBar';
import {rowColumnOperationInitial} from './controllers/rowColumnOperation';
import {keyboardInitial} from './controllers/keyboard';
import {orderByInitial} from './controllers/orderBy';
import {initPlugins} from './controllers/expendPlugins';
import {
getluckysheetfile,
@ -19,6 +26,8 @@ import {
setconfig,
} from './methods/set';
import { luckysheetrefreshgrid } from './global/refresh';
import functionlist from './function/functionlist';
import { luckysheetlodingHTML } from './controllers/constant';
let luckysheet = {};
@ -81,6 +90,9 @@ luckysheet.create = function (setting) {
// Register plugins
initPlugins(extendsetting.plugins);
// Store formula information, including internationalization
functionlist();
let devicePixelRatio = extendsetting.devicePixelRatio;
if(devicePixelRatio == null){
devicePixelRatio = 1;
@ -88,13 +100,13 @@ luckysheet.create = function (setting) {
Store.devicePixelRatio = Math.ceil(devicePixelRatio);
//loading
$("#" + container).append('<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>渲染中...</span></div></div>');
$("#" + container).append(luckysheetlodingHTML());
let data = [];
if (loadurl == "") {
sheetmanage.initialjfFile(menu, title);
luckysheetsizeauto();
luckysheetHandler();
initialWorkBook();
}
else {
$.post(loadurl, {"gridKey" : server.gridKey}, function (d) {
@ -103,7 +115,7 @@ luckysheet.create = function (setting) {
sheetmanage.initialjfFile(menu, title);
luckysheetsizeauto();
luckysheetHandler();
initialWorkBook();
//需要更新数据给后台时,建立WebSocket连接
if(server.allowUpdate){
@ -113,6 +125,17 @@ luckysheet.create = function (setting) {
}
}
function initialWorkBook(){
luckysheetHandler();//Overall dom initialization
initialFilterHandler();//Filter initialization
initialMatrixOperation();//Right click matrix initialization
initialSheetBar();//bottom sheet bar initialization
formulaBarInitial();//top formula bar initialization
rowColumnOperationInitial();//row and coloumn operate initialization
keyboardInitial();//Keyboard operate initialization
orderByInitial();//menu bar orderby function initialization
}
//获取所有表格数据
luckysheet.getluckysheetfile = getluckysheetfile;

2
src/function/functionImplementation.js

@ -12361,7 +12361,7 @@ const functionImplementation = {
var endDate = moment(arguments[1]);
var unit = arguments[2];
var result = formula.error.v;
if(luckysheet_function.DAYS.f(endDate,startDate) < 0){
if(window.luckysheet_function.DAYS.f(endDate,startDate) < 0){
return formula.error.v;
}

9201
src/function/functionlist.js

File diff suppressed because it is too large

13
src/global/count.js

@ -2,6 +2,7 @@ import Store from '../store';
import { getdatabyselectionNoCopy } from './getdata';
import { isRealNull, isRealNum } from './validate';
import { update } from './format';
import locale from '../locale/locale';
//表格计数栏
export function countfunc() {
@ -51,21 +52,23 @@ export function countfunc() {
}
}
let locale_formula = locale().formula;
let ret = "";
ret += "<span>计数:" + count + "</span>";
ret += "<span>"+locale_formula.count+":" + count + "</span>";
//处理成亿万格式
if (isFinite(max) || isFinite(min)) {
ret += "<span>求和:" + update("w", sum) + "</span>";
ret += "<span>平均值:" + update("w", Math.round(sum / count * 10000) / 10000) + "</span>";
ret += "<span>"+locale_formula.sum+":" + update("w", sum) + "</span>";
ret += "<span>"+locale_formula.average+":" + update("w", Math.round(sum / count * 10000) / 10000) + "</span>";
}
if (isFinite(max)) {
ret += "<span>最大值:" + update("w", max) + "</span>";
ret += "<span>"+locale_formula.max+":" + update("w", max) + "</span>";
}
if (isFinite(min)) {
ret += "<span>最小值:" + update("w", min) + "</span>";
ret += "<span>"+locale_formula.min+":" + update("w", min) + "</span>";
}
$("#luckysheet-sta-content").html(ret);

19
src/global/createdom.js

@ -18,6 +18,7 @@ import editor from './editor';
import rhchInit from './rhchInit';
import { replaceHtml } from '../utils/util';
import Store from '../store';
import locale from '../locale/locale';
export default function luckysheetcreatedom(colwidth, rowheight, data, menu, title) {
//最少30行
@ -30,7 +31,7 @@ export default function luckysheetcreatedom(colwidth, rowheight, data, menu, tit
colwidth = 22;
}
let gh = gridHTML;
let gh = gridHTML();
gh = replaceHtml(gh, { "logotitle": title });//设置title
gh = replaceHtml(gh, { "menu": menuToolBar() });//设置需要显示的菜单
@ -59,11 +60,19 @@ export default function luckysheetcreatedom(colwidth, rowheight, data, menu, tit
rhchInit(rowheight, colwidth);
let addControll = '<button id="luckysheet-bottom-add-row" class="btn btn-default">添加</button><input id="luckysheet-bottom-add-row-input" type="text" class="luckysheet-datavisual-config-input luckysheet-mousedown-cancel" placeholder="100"><span style="font-size: 14px;">行</span><span style="font-size: 14px;color: #9c9c9c;">(在底部添加)</span>';
let backControll = ' <button id="luckysheet-bottom-bottom-top" class="btn btn-default" style="">回到顶部</button>';
const _locale = locale();
const locale_info = _locale.info;
let addControll = '<button id="luckysheet-bottom-add-row" class="btn btn-default">'+locale_info.add+'</button><input id="luckysheet-bottom-add-row-input" type="text" class="luckysheet-datavisual-config-input luckysheet-mousedown-cancel" placeholder="100"><span style="font-size: 14px;">'+ locale_info.row +'</span><span style="font-size: 14px;color: #9c9c9c;">('+locale_info.addLast+')</span>';
let backControll = ' <button id="luckysheet-bottom-bottom-top" class="btn btn-default" style="">'+ locale_info.backTop +'</button>';
// let pageControll = ' <span id="luckysheet-bottom-page-info" style="font-size: 14px;color: #f34141;">共'+ luckysheetConfigsetting.pageInfo.totalPage +'页,当前已显示'+ (luckysheetConfigsetting.pageInfo.currentPage) +'页,每页'+ luckysheetConfigsetting.pageInfo.pageSize +'条</span> <button id="luckysheet-bottom-page-next" class="btn btn-danger" style="">下一页</button>';
let pageControll = ' <span id="luckysheet-bottom-page-info" style="font-size: 14px;color: #f34141;">共'+ luckysheetConfigsetting.total +'条,'+ luckysheetConfigsetting.pageInfo.totalPage +'页,当前已显示'+ (luckysheetConfigsetting.pageInfo.currentPage) +'页</span> <button id="luckysheet-bottom-page-next" class="btn btn-danger" style="">下一页</button>';
let pageControll2 = ' <span id="luckysheet-bottom-page-info" style="font-size: 14px;color: #f34141;">共'+ luckysheetConfigsetting.total +'条,'+ luckysheetConfigsetting.pageInfo.totalPage +'页,当前已显示'+ (luckysheetConfigsetting.pageInfo.currentPage) +'页</span>';
let pageInfo = replaceHtml(locale_info.pageInfo,{
total:luckysheetConfigsetting.total?luckysheetConfigsetting.total:"",
totalPage:luckysheetConfigsetting.pageInfo.totalPage?luckysheetConfigsetting.pageInfo.totalPage:"",
currentPage:luckysheetConfigsetting.pageInfo.currentPage?luckysheetConfigsetting.pageInfo.currentPage:"",
});
let pageControll = ' <span id="luckysheet-bottom-page-info" style="font-size: 14px;color: #f34141;">'+ pageInfo +'</span> <button id="luckysheet-bottom-page-next" class="btn btn-danger" style="">下一页</button>';
let pageControll2 = ' <span id="luckysheet-bottom-page-info" style="font-size: 14px;color: #f34141;">'+pageInfo+'</span>';
let bottomControll = "";
if(luckysheetConfigsetting.enableAddRow){

52
src/global/formula.js

@ -18,10 +18,11 @@ import tooltip from './tooltip';
import { rowLocation, colLocation, colLocationByIndex, mouseposition } from './location';
import { luckysheetRangeLast } from './cursorPos';
import { jfrefreshgrid } from './refresh';
import luckysheet_function from '../function/luckysheet_function';
import functionlist from '../function/functionlist';
// import luckysheet_function from '../function/luckysheet_function';
// import functionlist from '../function/functionlist';
import { luckysheet_compareWith, luckysheet_getcelldata, luckysheet_indirect_check, luckysheet_indirect_check_return, luckysheet_offset_check } from '../function/func';
import Store from '../store';
import locale from '../locale/locale';
const luckysheetformula = {
error: {
@ -39,6 +40,8 @@ const luckysheetformula = {
},
errorParamCheck: function(thisp, data, i) {
let type, require;
let _locale = locale();
let locale_formulaMore = _locale.formulaMore;
if(i < thisp.length){
type = thisp[i].type;
require = thisp[i].require;
@ -49,30 +52,30 @@ const luckysheetformula = {
}
if(require == "o" && (data == null || data == "")){
return [true, "成功"];
return [true, locale_formulaMore.tipSuccessText];
}
if(type.indexOf("all") > -1){
return [true, "成功"];
return [true, locale_formulaMore.tipSuccessText];
}
else{
if(type.indexOf("range") > -1 && (getObjType(data) == "object" || getObjType(data) == "array")){
return [true, "成功"];
return [true, locale_formulaMore.tipSuccessText];
}
if(type.indexOf("number") > -1 && (isRealNum(data) || getObjType(data) == "boolean")){
return [true, "成功"];
return [true, locale_formulaMore.tipSuccessText];
}
if(type.indexOf("string") > -1 && getObjType(data) == "string"){
return [true, "成功"];
return [true, locale_formulaMore.tipSuccessText];
}
if(type.indexOf("date") > -1 && isdatetime(data)){
return [true, "成功"];
return [true, locale_formulaMore.tipSuccessText];
}
return [false, "参数类型错误"];
return [false, locale_formulaMore.tipParamErrorText];
}
},
getPureValueByData: function(data){
@ -787,7 +790,7 @@ const luckysheetformula = {
$("#luckysheet-formula-functionrange .luckysheet-formula-functionrange-highlight").show();
},
searchHTML: '<div id="luckysheet-formula-search-c" class="luckysheet-formula-search-c"></div>',
helpHTML: '<div id="luckysheet-formula-help-c" class="luckysheet-formula-help-c"> <div class="luckysheet-formula-help-close" title="关闭"><i class="fa fa-times" aria-hidden="true"></i></div> <div class="luckysheet-formula-help-collapse" title="收起"><i class="fa fa-angle-up" aria-hidden="true"></i></div> <div class="luckysheet-formula-help-title"><div class="luckysheet-formula-help-title-formula"> <span class="luckysheet-arguments-help-function-name">SUM</span> <span class="luckysheet-arguments-paren">(</span> <span class="luckysheet-arguments-parameter-holder"> <span class="luckysheet-arguments-help-parameter luckysheet-arguments-help-parameter-active" dir="auto">A2:A100</span>, <span class="luckysheet-arguments-help-parameter" dir="auto">101</span> </span> <span class="luckysheet-arguments-paren">)</span> </div></div> <div class="luckysheet-formula-help-content"> <div class="luckysheet-formula-help-content-example"> <div class="luckysheet-arguments-help-section-title">示例</div> <div class="luckysheet-arguments-help-formula"> <span class="luckysheet-arguments-help-function-name">SUM</span> <span class="luckysheet-arguments-paren">(</span> <span class="luckysheet-arguments-parameter-holder"> <span class="luckysheet-arguments-help-parameter luckysheet-arguments-help-parameter-active" dir="auto">A2:A100</span>, <span class="luckysheet-arguments-help-parameter" dir="auto">101</span> </span> <span class="luckysheet-arguments-paren">)</span> </div> </div> <div class="luckysheet-formula-help-content-detail"> <div class="luckysheet-arguments-help-section"> <div class="luckysheet-arguments-help-section-title luckysheet-arguments-help-parameter-name">摘要</div> <span class="luckysheet-arguments-help-parameter-content">${detail}</span> </div> </div> <div class="luckysheet-formula-help-content-param"> ${param} </div> </div> <div class="luckysheet-formula-help-foot"></div></div>',
helpHTML: '<div id="luckysheet-formula-help-c" class="luckysheet-formula-help-c"> <div class="luckysheet-formula-help-close" title="${helpClose}"><i class="fa fa-times" aria-hidden="true"></i></div> <div class="luckysheet-formula-help-collapse" title="${helpCollapse}"><i class="fa fa-angle-up" aria-hidden="true"></i></div> <div class="luckysheet-formula-help-title"><div class="luckysheet-formula-help-title-formula"> <span class="luckysheet-arguments-help-function-name">SUM</span> <span class="luckysheet-arguments-paren">(</span> <span class="luckysheet-arguments-parameter-holder"> <span class="luckysheet-arguments-help-parameter luckysheet-arguments-help-parameter-active" dir="auto">A2:A100</span>, <span class="luckysheet-arguments-help-parameter" dir="auto">101</span> </span> <span class="luckysheet-arguments-paren">)</span> </div></div> <div class="luckysheet-formula-help-content"> <div class="luckysheet-formula-help-content-example"> <div class="luckysheet-arguments-help-section-title">${helpExample}</div> <div class="luckysheet-arguments-help-formula"> <span class="luckysheet-arguments-help-function-name">SUM</span> <span class="luckysheet-arguments-paren">(</span> <span class="luckysheet-arguments-parameter-holder"> <span class="luckysheet-arguments-help-parameter luckysheet-arguments-help-parameter-active" dir="auto">A2:A100</span>, <span class="luckysheet-arguments-help-parameter" dir="auto">101</span> </span> <span class="luckysheet-arguments-paren">)</span> </div> </div> <div class="luckysheet-formula-help-content-detail"> <div class="luckysheet-arguments-help-section"> <div class="luckysheet-arguments-help-section-title luckysheet-arguments-help-parameter-name">${helpAbstract}</div> <span class="luckysheet-arguments-help-parameter-content">${helpAbstract}</span> </div> </div> <div class="luckysheet-formula-help-content-param"> ${param} </div> </div> <div class="luckysheet-formula-help-foot"></div></div>',
getrangeseleciton: function() {
let currSelection = window.getSelection();
let anchor = $(currSelection.anchorNode);
@ -878,6 +881,7 @@ const luckysheetformula = {
searchFunctionCell: null,
searchFunction: function($editer) {
let _this = this;
let functionlist = Store.functionlist;
let $cell = _this.getrangeseleciton();
_this.searchFunctionCell = $cell;
@ -989,12 +993,16 @@ const luckysheetformula = {
functionlistPosition: {},
helpFunction: function($editer, funcname, paramIndex) {
let _this = this;
let functionlist = Store.functionlist;
let $func = functionlist[_this.functionlistPosition[$.trim(funcname).toUpperCase()]];
if ($func == null) {
return;
}
let _locale = locale();
let locale_formulaMore = _locale.formulaMore;
$("#luckysheet-formula-help-c .luckysheet-arguments-help-function-name").html($func.n);
$("#luckysheet-formula-help-c .luckysheet-arguments-help-parameter-content").html($func.d);
@ -1020,11 +1028,11 @@ const luckysheetformula = {
if (paramitem.repeat == "y") {
name += ", ...";
nameli += '<span class="luckysheet-arguments-help-argument-info">...-可重复</span>';
nameli += '<span class="luckysheet-arguments-help-argument-info">...-'+locale_formulaMore.allowRepeatText+'</span>';
}
if (paramitem.require == "o") {
name = "[" + name + "]";
nameli += '<span class="luckysheet-arguments-help-argument-info">-[可选]</span>';
nameli += '<span class="luckysheet-arguments-help-argument-info">-['+locale_formulaMore.allowOptionText+']</span>';
}
fht += '<span class="luckysheet-arguments-help-parameter" dir="auto">' + name + '</span>, ';
@ -1062,9 +1070,16 @@ const luckysheetformula = {
},
helpFunctionExe: function($editer, currSelection) {
let _this = this;
let functionlist = Store.functionlist;
let _locale = locale();
let locale_formulaMore = _locale.formulaMore;
if ($("#luckysheet-formula-help-c").length == 0) {
$("body").after(_this.helpHTML);
$("body").after(replaceHtml(_this.helpHTML,{
helpClose:locale_formulaMore.helpClose,
helpCollapse:locale_formulaMore.helpCollapse,
helpExample:locale_formulaMore.helpExample,
helpAbstract:locale_formulaMore.helpAbstract,
}));
$("#luckysheet-formula-help-c .luckysheet-formula-help-close").click(function() {
$("#luckysheet-formula-help-c").hide();
});
@ -4739,6 +4754,9 @@ const luckysheetformula = {
},
execfunction: function(txt, r, c, isrefresh, notInsertFunc) {
let _this = this;
let _locale = locale();
let locale_formulaMore = _locale.formulaMore;
if(txt.indexOf(_this.error.r) > -1){
return [false, _this.error.r, txt];
@ -4755,7 +4773,7 @@ const luckysheetformula = {
}
if (!_this.testFunction(txt, fp) || fp == "") {
tooltip.info("提示", "公式存在错误");
tooltip.info("",locale_formulaMore.execfunctionError);
return [false, _this.error.n, txt];
}
@ -4780,10 +4798,10 @@ const luckysheetformula = {
if(funcgRange.sheetIndex == Store.currentSheetIndex && r >= funcgRange.row[0] && r <= funcgRange.row[1] && c >= funcgRange.column[0] && c <= funcgRange.column[1]){
if(isEditMode()){
alert("公式不可引用其本身的单元格");
alert(locale_formulaMore.execfunctionSelfError);
}
else{
tooltip.info("公式不可引用其本身的单元格,会导致计算结果不准确", "");
tooltip.info("", locale_formulaMore.execfunctionSelfErrorResult);
}

4
src/global/method.js

@ -21,7 +21,7 @@ const method = {
url = server.loadSheetUrl;
}
$("#luckysheet-grid-window-1").append(luckysheetlodingHTML);
$("#luckysheet-grid-window-1").append(luckysheetlodingHTML());
param.currentPage++;
let dataType = 'application/json;charset=UTF-8';
@ -67,7 +67,7 @@ const method = {
url = server.loadSheetUrl;
}
$("#luckysheet-grid-window-1").append(luckysheetlodingHTML);
$("#luckysheet-grid-window-1").append(luckysheetlodingHTML());
let arg = {"gridKey" : server.gridKey, "index": index};
param = $.extend(true, param, arg);

2
src/global/refresh.js

@ -268,7 +268,7 @@ function jfrefreshrange(data, range, cdformat) {
"curdata": data,
"range": range,
"sheetIndex": Store.currentSheetIndex,
"cdformat": $.extend(true, [], luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["luckysheet_conditionformat_save"]),
"cdformat": $.extend(true, [], Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["luckysheet_conditionformat_save"]),
"curCdformat": cdformat
});
}

2
src/global/tooltip.js

@ -16,7 +16,7 @@ const tooltip = {
"addclass": "",
"title": title,
"content": content,
"botton": '<button class="btn btn-default luckysheet-model-close-btn">&nbsp;&nbsp;'+locale_button.colse+'&nbsp;&nbsp;</button>',
"botton": '<button class="btn btn-default luckysheet-model-close-btn">&nbsp;&nbsp;'+locale_button.close+'&nbsp;&nbsp;</button>',
"style": "z-index:100003"
}));
let $t = $("#luckysheet-info").find(".luckysheet-modal-dialog-content").css("min-width", 300).end(),

2
src/index.html

@ -32,7 +32,7 @@
luckysheet.create({
container: 'luckysheet',
lang: 'zh',
lang: 'en',
plugins: ['chart'],
data: [sheetCell,sheetFormula,sheetConditionFormat,sheetTable,sheetSparkline,sheetComment,sheetPivotTableData,sheetPivotTable]
})

74
src/locale/en.js

@ -50,6 +50,7 @@ export default {
noColorSelectedText:"No color is selected",
toolMore:"More",
toolLess:"Less",
toolClose:"Close",
toolMoreTip:"More features",
},
@ -93,8 +94,28 @@ export default {
info:{
detailUpdate: 'New opened',
detailSave: 'Local cache restored',
row: 'row',
column: 'column'
row: '',
column: '',
loading:"Loading",
copy:"Copy",
return:"Exit",
rename:"Rename",
tips:"WorkBook rename",
noName:"Untitled spreadsheet",
wait:"waiting for update",
add:"Add",
addLast:"more rows at bottom",
backTop:"Back to the top",
pageInfo:'Total ${total},${totalPage} page,current ${currentPage}',
nextPage:"Next",
tipInputNumber:"Please enter the number",
tipInputNumberLimit:"The increase range is limited to 1-100",
tipRowHeightLimit:"The value must be between 0 ~ 255",
pageInfoFull:'Total ${total},${totalPage} page,All data displayed',
},
currencyDetail:{
RMB:'RMB',
@ -443,6 +464,14 @@ export default {
conditionCellBetween:"Is between",
conditionCellNotBetween:"Is not between",
filiterMoreDataTip:"Big amount of data! please wait",
filiterMonthText:"Month",
filiterYearText:"Year",
filiterByColorTip:"Filter by cell color",
filiterByTextColorTip:"Filter by font color",
filterContainerOneColorTip:"This column contains only one color",
filterDateFormatTip:"Date format",
},
rightclick: {
copy: 'Copy',
@ -533,6 +562,9 @@ export default {
splitDataPreview:"Preview",
splitTextTitle:"Split text",
splitConfirmToExe:"There is already data here, do you want to replace it?",
tipNoMulti:"Cannot perform this operation on multiple selection areas, please select a single area and try again",
tipNoMultiColumn:"Only one column of data can be converted at a time. The selected area can have multiple rows but not multiple columns. Please try again after selecting a single column range",
},
punctuation:{
"tab":"Tab",
@ -613,6 +645,13 @@ export default {
resetColor: 'Reset color',
cancelText: 'Cancel',
chooseText: 'Confirm color',
tipNameRepeat:"The name of the tab page cannot be repeated! Please revise",
noMoreSheet:"The workbook contains at least one visual worksheet. To delete the selected worksheet, please insert a new worksheet or show a hidden worksheet.",
confirmDelete:"Are you sure to delete",
redoDelete:"Can be undo by Ctrl+Z",
noHide:"Can't hide, at least keep one sheet tag",
chartEditNoOpt:"This operation is not allowed in chart editing mode!",
},
conditionformat: {
conditionformat_greaterThan: 'Conditionformat-GreaterThan',
@ -854,6 +893,37 @@ export default {
"selectFunctionTitle":"Select a function",
"calculationResult":"Result",
tipSuccessText:"Success",
tipParamErrorText:"Parameter type error",
"helpClose":"Close",
"helpCollapse":"Collapse",
"helpExample":"Example",
"helpAbstract":"Abstract",
"execfunctionError":'Error in the formula',
"execfunctionSelfError":'Formula cannot refer to its own cell',
"execfunctionSelfErrorResult":'The formula cannot refer to its own cell, which will lead to inaccurate calculation results',
"allowRepeatText":"Repeat",
"allowOptionText":"Option",
"selectCategory":"Or select a category",
},
drag:{
noMerge:"Cannot perform this operation on merged cells",
affectPivot:"This change cannot be made to the selected cell because it will affect the pivot table!",
noMulti:"Cannot perform this operation on multiple selection areas, please select a single area",
noPaste:"Unable to paste this content here, please select a cell in the paste area and try to paste again",
noPartMerge:"Cannot perform this operation on partially merged cells",
inputCorrect:"Please enter the correct value",
notLessOne:"The number of rows and columns cannot be less than 1",
offsetColumnLessZero:"The offset column cannot be negative!",
},
pivotTable:{
}
};

87
src/locale/zh.js

@ -49,6 +49,7 @@ export default {
noColorSelectedText:"没有颜色被选择",
toolMore:"更多",
toolLess:"少于",
toolClose:"收起",
toolMoreTip:"更多功能",
@ -94,7 +95,28 @@ export default {
detailUpdate: '新打开',
detailSave: '已恢复本地缓存',
row: '行',
column: '列'
column: '列',
loading:"渲染中",
copy:"副本",
return:"返回",
rename:"重命名",
tips:"表格重命名",
noName:"无标题的电子表格",
wait:"待更新",
add:"添加",
addLast:"在底部添加",
backTop:"回到顶部",
pageInfo:'共${total}条,${totalPage}页,当前已显示${currentPage}页',
nextPage:"下一页",
tipInputNumber:"请输入数字",
tipInputNumberLimit:"增加范围限制在1-100",
tipRowHeightLimit:"数值必须在0 ~ 255之间",
pageInfoFull:'共${total}条,${totalPage}页,已显示全部数据',
},
currencyDetail:{
RMB:'人民币',
@ -377,6 +399,14 @@ export default {
"wrap":"自动换行",
"clip":"截断",
},
rotation:{
"none":"无选装",
"angleup":"向上倾斜",
"angledown":"向下倾斜",
"vertical":"竖排文字",
"rotationUp":"向上90°",
"rotationDown":"向下90°"
},
freezen:{
default:"冻结首行",
freezenRow:"冻结首行",
@ -403,6 +433,8 @@ export default {
"columnOperation":"列",
"secondaryTitle":"次要排序",
"sortTitle":"排序范围",
"sortRangeTitle":"排序范围从",
"sortRangeTitleTo":"到",
@ -435,6 +467,8 @@ export default {
filterCancel:"取 消",
clearFilter:"清除筛选",
conditionNone:"无",
conditionCellIsNull:"单元格为空",
conditionCellNotNull:"单元格有数据",
@ -454,6 +488,15 @@ export default {
conditionCellNotEqual:"不等于",
conditionCellBetween:"介于",
conditionCellNotBetween:"不在其中",
filiterMoreDataTip:"数据量大!请稍后",
filiterMonthText:"月",
filiterYearText:"年",
filiterByColorTip:"按单元格颜色筛选",
filiterByTextColorTip:"按单元格字体颜色筛选",
filterContainerOneColorTip:"本列仅包含一种颜色",
filterDateFormatTip:"日期格式",
},
rightclick: {
copy: '复制',
@ -543,6 +586,9 @@ export default {
splitDataPreview:"数据预览",
splitTextTitle:"文本分列",
splitConfirmToExe:"此处已有数据,是否替换它?",
tipNoMulti:"不能对多重选择区域执行此操作,请选择单个区域,然后再试",
tipNoMultiColumn:"一次只能转换一列数据,选定区域可以有多行,但不能有多列,请在选定单列区域以后再试",
},
punctuation:{
"tab":"Tab 键",
@ -622,6 +668,14 @@ export default {
resetColor: '重置颜色',
cancelText: '取消',
chooseText: '确定颜色',
tipNameRepeat:"标签页的名称不能重复!请重新修改",
noMoreSheet:"工作薄内至少含有一张可视工作表。若需删除选定的工作表,请先插入一张新工作表或显示一张隐藏的工作表。",
confirmDelete:"是否删除",
redoDelete:"可以通过Ctrl+Z撤销删除",
noHide:"不能隐藏, 至少保留一个sheet标签",
chartEditNoOpt:"图表编辑模式下不允许该操作!",
},
conditionformat: {
conditionformat_greaterThan: '条件格式——大于',
@ -864,5 +918,36 @@ export default {
"selectFunctionTitle":"选择函数",
"calculationResult":"计算结果",
tipSuccessText:"成功",
tipParamErrorText:"参数类型错误",
"helpClose":"关闭",
"helpCollapse":"收起",
"helpExample":"示例",
"helpAbstract":"摘要",
"execfunctionError":'提示", "公式存在错误',
"execfunctionSelfError":'公式不可引用其本身的单元格',
"execfunctionSelfErrorResult":'公式不可引用其本身的单元格,会导致计算结果不准确',
"allowRepeatText":"可重复",
"allowOptionText":"可选",
"selectCategory":"或选择类别",
},
drag:{
noMerge:"无法对合并单元格执行此操作",
affectPivot:"无法对所选单元格进行此更改,因为它会影响数据透视表!",
noMulti:"无法对多重选择区域执行此操作,请选择单个区域",
noPaste:"无法在此处粘贴此内容,请选择粘贴区域的一个单元格,然后再次尝试粘贴",
noPartMerge:"无法对部分合并单元格执行此操作",
inputCorrect:"请输入正确的数值",
notLessOne:"行列数不能小于1",
offsetColumnLessZero:"偏移列不能为负数!",
},
pivotTable:{
}
};

5
src/store/index.js

@ -84,7 +84,10 @@ const Store = {
lang: 'en', //language
createChart: '',
highlightChart: '',
zIndex: 15
zIndex: 15,
functionList:null, //function list explanation
luckysheet_function:null,
}
export default Store;
Loading…
Cancel
Save