liuyang 5 years ago
parent
commit
1872a0e713
  1. 14
      docs/.vuepress/config.js
  2. 24
      docs/guide/FAQ.md
  3. 138
      docs/guide/feature.md
  4. 255
      docs/guide/format.md
  5. 15
      docs/zh/guide/FAQ.md
  6. 129
      docs/zh/guide/feature.md
  7. 220
      docs/zh/guide/format.md
  8. 469
      src/controllers/conditionformat.js
  9. 502
      src/controllers/menuButton.js
  10. 2
      src/controllers/select.js
  11. 49
      src/core.js
  12. 1439
      src/global/draw.js
  13. 6
      src/global/getdata.js
  14. 8
      src/global/refresh.js
  15. 6
      src/global/setdata.js
  16. 2
      src/index.html
  17. 118
      src/locale/en.js
  18. 119
      src/locale/zh.js

14
docs/.vuepress/config.js

@ -40,8 +40,8 @@ module.exports = {
}
},
nav: [
{ text: 'Home', link: '/en/' },
{ text: 'Guide', link: '/en/guide/' },
{ text: 'Home', link: '/' },
{ text: 'Guide', link: '/guide/' },
{ text: 'Demo', link: 'https://mengshukeji.github.io/LuckysheetDemo/' }
],
// 侧边栏
@ -52,7 +52,8 @@ module.exports = {
'feature',
'data',
'operate',
'format'
'format',
'FAQ'
],
},
},
@ -74,8 +75,8 @@ module.exports = {
},
// 导航栏
nav: [
{ text: '首页', link: '/' },
{ text: '指南', link: '/guide/' },
{ text: '首页', link: '/zh/' },
{ text: '指南', link: '/zh/guide/' },
{ text: '演示', link: 'https://mengshukeji.github.io/LuckysheetDemo/' }
],
// 侧边栏
@ -86,7 +87,8 @@ module.exports = {
'feature',
'data',
'operate',
'format'
'format',
'FAQ'
],
},
},

24
docs/guide/FAQ.md

@ -0,0 +1,24 @@
# FAQ
## What is the difference between data and celldata in luckysheetfile?
**<span style="font-size:20px;">A</span>**: Use one-dimensional array format [celldata](https://mengshukeji.github.io/LuckysheetDocs/guide/data.html), after the initialization is completed, the data converted into a two-dimensional array format is used for storage and update, and celldata is no longer used.
If you need to take out data as initial data, you need to execute `luckysheet.getGridData(data)` to convert it to celldata data.
Among them, the celldata in `{ r, c, v }` format is converted to a two-dimensional array using `luckysheet.buildGridData(luckysheetfile)`, and the input parameter is the table data object `luckysheetfile`
Summarized as follows:
```js
// data => celldata two-dimensional array data is converted into {r, c, v} format one-dimensional array, the input parameter is two-dimensional data
luckysheet.getGridData(data)
// celldata => data The two-dimensional array required to generate the table, the input parameter is the table data object file
luckysheet.buildGridData(luckysheetfile)
```
------------
## What are the cell types?
**<span style="font-size:20px;">A</span>**: Refer to [Cell Format List](https://mengshukeji.github.io/LuckysheetDocs/guide/format.html), with examples of available cell formats
------------

138
docs/guide/feature.md

@ -1,125 +1,147 @@
# Advanced Features
## luckysheet.getcellvalue(r, c, data, type)
## luckysheet.create(options)
- **Parameter**
- r: the number of rows in which the cell is located; optional values; integers starting at 0, 0 representing the first row.
- c: the number of columns in which the cell is located; optional values; integers starting at 0, 0 indicating the first column.
- data: table data; two-dimensional array; the default value is the current table data.
- type: cell attribute value; optional value; the default value is'v', which means to get the cell value.
- {Object} [options]:All configuration information of the table
- **Usage**
This method is to get the cell value. When `r` and `c` have no value, return `data`; when `r`, `c` has only one value, return the entire row or column of data;
Initialize a luckysheet, which can contain multiple worksheets, refer to [Configuration List](https://mengshukeji.github.io/LuckysheetDocs/guide/config.html)
------------
## luckysheet.getluckysheetfile()
- **Usage**
Return all table data structures.
------------
## luckysheet.sheetmanage.getSheetByIndex(index)
- **Parameter**
- index: table subscript; integer starting from 0, 0 means the first table; default is the current table subscript.
- **Usage**
Returns a table data structure.
------------
## luckysheet.getconfig()
- **Usage**
Returns the current table configuration.
------------
## luckysheet.getSheetConfig(sheetIndex)
## luckysheet.getcellvalue([r] [,c] [,data] [,type])
- **Parameter**
- sheetIndex: table index; an integer starting from 0, 0 means the first table; the default is the current table index.
- {Number} [r]:The row number of the cell; optional value; an integer starting from 0, 0 means the first row
- {Number} [c]:The column number of the cell; optional value; an integer starting from 0, 0 means the first column
- {Array} [data]:Table data, two-dimensional array; optional value; default value is the current table data
- {String} [type]:Cell attribute value; optional value; the default value is'v', which means to get the actual value of the cell
- **Usage**
Return to a table configuration.
This method is to get the value of the cell.
1. `luckysheet.getcellvalue()`:Return all data in the current worksheet;
2. `luckysheet.getcellvalue(0)`:Return the first row data of the current worksheet;
3. `luckysheet.getcellvalue(null,0)`:Return the data in the first column of the current worksheet;
4. `luckysheet.getcellvalue(0,0)`:Return the v value of the data in the first row and first column of the current worksheet;
5. `luckysheet.getcellvalue(1,1,null,'m')`: Returns the original value of the cell in the second row and second column of the specified data.
Special case: the cell format is `yyyy-MM-dd`, when the type is'v', the display value of'm' will be mandatory
------------
## luckysheet.getvisibledatarow()
## luckysheet.getluckysheetfile()
- **Usage**
Returns the current table row height.
Returns a one-dimensional array of all table data structures[luckysheetfile](https://mengshukeji.github.io/LuckysheetDocs/guide/data.html), `luckysheet.getluckysheetfile()[0]` can get all the information of the first worksheet.
------------
## luckysheet.getvisibledatacolumn()
## luckysheet.getconfig()
- **Usage**
Returns the current table column width.
Quickly return to the current sheet config configuration, the config information of each worksheet is still contained in the luckysheetfile.
------------
## luckysheet.getluckysheet_select_save()
- **Usage**
Returns the current selection.
Returns an array of current selection objects, there may be multiple selections.
------------
## luckysheet.getdatabyselection(range, sheetIndex)
## luckysheet.getdatabyselection([range] [,sheetIndex])
- **Parameter**
- range: selection object; `object: {row: [r1, r2], column: [c1, c2] }`; the default is the current selection.
- sheetIndex: table index; an integer starting from 0, 0 means the first table; the default is the current table index.
- {Object} [range]:Selection object, `object: {row: [r1, r2], column: [c1, c2] }`; optional value; the default is the current first selection.
- {Number} [sheetIndex]:Table subscript, an integer starting from 0, 0 means the first table; optional value; the default is the current table subscript.
- **Usage**
Returns the cell data of a range in a table.
Returns the data of the first selection in a table.
- `luckysheet.getdatabyselection()`: Returns the data of the current selection of the current worksheet
- `luckysheet.getdatabyselection(null,1)`: Returns the data of the current selection of the second worksheet
------------
## luckysheet.luckysheetrefreshgrid(scrollWidth, scrollHeight)
- **Parameter**
- scrollWidth: horizontal scroll value. The default is the current horizontal scroll position.
- scrollHeight: vertical scroll value. The default is the current vertical scroll position.
- {Number} [scrollWidth]:Horizontal scroll value. The default is the current horizontal scroll position.
- {Number} [scrollHeight]:Vertical scroll value. The default is the current vertical scroll position.
- **Usage**
Refresh canvas display data according to scrollWidth, scrollHeight.
Refresh the canvas display data according to scrollWidth and scrollHeight.
------------
## luckysheet.setcellvalue(r, c, d, v)
- **Parameter**
- r: the number of rows in which the cell is located; an integer starting from 0, 0 means the first row.
- c: the number of columns in which the cell is located; an integer starting from 0, 0 means the first column.
- d: table data; two-dimensional array.
- v: The value to be set; it can be an object, and the object should conform to the cell object format.
- {Number} [r]:The row number of the cell; an integer starting from 0, 0 means the first row.
- {Number} [c]:The column number of the cell; an integer starting from 0, 0 means the first column.
- {Array} [d]:Table data; optional value; two-dimensional array.
- {Object | String | Number} [v]:The value to be set; it can be an object, and the object is to conform to the cell object format.
- **Usage**
Set the value of a cell. Cooperate with `luckysheet.luckysheetrefreshgrid()` to refresh to see the cell value changes.
Set the value of a cell. Can be used with `luckysheet.luckysheetrefreshgrid()` to refresh and view cell value changes.
```js
luckysheet.setcellvalue(0, 0, luckysheet.flowdata, 'abc');
luckysheet.luckysheetrefreshgrid();
luckysheet.setcellvalue(0, 0, luckysheet.flowdata(), 'abc');
luckysheet.jfrefreshgrid();
```
------------
## luckysheet.jfrefreshgrid()
- **Usage**
Refresh canvas
------------
## luckysheet.setluckysheet_select_save(v)
- **Parameter**
- v: The selection value (array) to be set. It conforms to the selection format rules, such as `[{ row: [r1, r2], column: [c1, c2] }]`.
- {Array} [v]:The selection value (array) to be set. Comply with selection format rules, such as `[{ row: [r1, r2], column: [c1, c2] }]`.
- **Usage**
Set the value of the current table selection. With `luckysheet.selectHightlightShow()`, you can view the selection changes on the interface.
Set the value of the current table selection area. With `luckysheet.selectHightlightShow()`, you can view the selection changes in the interface.
```js
luckysheet.setluckysheet_select_save([{ row: [0, 1], column: [0, 1] }]);
luckysheet.selectHightlightShow();
```
------------
## luckysheet.sheetmanage.setSheetHide(index)
## luckysheet.selectHightlightShow()
- **Usage**
Highlight the current selection
------------
## luckysheet.setSheetHide(index)
- **Parameter**
- index: table subscript; integer starting from 0, 0 means the first table; default is the current table subscript.
- {Number} [index]:Table index; an integer starting from 0, 0 means the first table; the default is the current table index.
- **Usage**
Hide a table.
------------
## luckysheet.sheetmanage.setSheetShow(index)
## luckysheet.setSheetShow(index)
- **Parameter**
- index: table subscript; integer starting from 0, 0 means the first table; default is the current table subscript.
- {Number} [index]:Table index; an integer starting from 0, 0 means the first table; the default is the current table index.
- **Usage**
Display a table.
------------
## luckysheet.method.destroy()
## luckysheet.flowdata()
- **Usage**
Quickly get the data of the current table
------------
## luckysheet.buildGridData(file)
- **Parameter**
- {Object} [file]:[luckysheetfile](https://mengshukeji.github.io/LuckysheetDocs/zh/guide/data.html#%E8%8E%B7%E5%8F%96%E8%A1%A8%E6%A0%BC%E6%95%B0%E6%8D%AE)
- **Usage**
Generate a two-dimensional array that the table can recognize
------------
## luckysheet.getGridData(data)
- **Parameter**
- {Array} [data]:Two-dimensional array data of worksheet
- **Usage**
Convert two-dimensional array data into `{r, c, v}` format one-dimensional array
------------
## luckysheet.destroy()
- **Usage**
Release table
Delete and release table

255
docs/guide/format.md

@ -175,50 +175,217 @@ The format is set to:
}
```
|Parameter|Explanation|Usage|
|Parameter|Explanation|Value|
| ------------ | ------------ | ------------ |
|v|value, shortcut setting value in Aspose|`var currencyStyle = book.CreateStyle();`<br>`currencyStyle.Number = 8;`|
|f|Format: format definition string `$#,##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|The type is the format distinguished by the front end. When importing excel, the type is distinguished according to the keyword of the format character:<br>1. YYYY, MM, DD is 6|
|fa|Format definition string| such as "General"|
|t|Type|Such as "g"|
Aspose is set as follows:
| 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 | @ |
The available settings are as follows:
| Format | ct.fa | ct.t | Example of m value | Remarks |
|----------|----------|-------------------------|------------------------- |------------------------- |
| Automatic | General | g | Luckysheet ||
| Plain text | @ | s | Luckysheet ||
| <br><br><br>**Number Format** | | | | |
| Integer | 0 | n | 1235 | 0 decimal places |
| One decimal place of the number | 0.0 | n | 1234.6 | The number of 0 after the dot represents the number of decimal places. If the original number is large, the number of digits will be rounded to the nearest hour |
| Two decimal places | 0.00 | n | 1234.56 ||
| Percentage integer | 0% | n | 123456% |The usage of #0% is also supported|
| Percentage | 0.00% | n | 123456.00% |The usage of #0.00% is also supported. The number of 0 after the dot represents the number of decimal places|
| Scientific Notation | 0.00E+00 | n | 1.23E+03 ||
| Scientific Notation | ##0.0E+0 | n | 1.2E+3 ||
| Fractions | # ?/? | n | 1234 5/9 ||
| Score | # ??/?? | n | 1234 14/25 ||
| Ten thousand | w | n |123 thousand and 456||
| Ten thousand two decimal places | w0.00 | n |123 thousand and 3456.00 ||
| Accounting | ¥(0.00) | n ||
| More number formats | #,##0 | n | 1,235 ||
| More number formats | #,##0.00 | n | 1,234.56 ||
| More number formats | `#,##0_);(#,##0)` | n | 1,235 ||
| More number formats | `#,##0_);[Red](#,##0)` | n | 1,235 ||
| More number formats | `#,##0.00_);(#,##0.00)` | n | 1,234.56 ||
| More number formats | `#,##0.00_);[Red](#,##0.00)` | n | 1,234.56 ||
| More number formats | $#,##0_);($#,##0) | n | $1,235 ||
| More number formats | `$#,##0_);[Red]($#,##0)` | n | $1,235 ||
| More number formats | $#,##0.00_);($#,##0.00) | n | $1,234.56 ||
| More number formats | `$#,##0.00_);[Red]($#,##0.00)` | n | $1,234.56 ||
| More number formats | _($* #,##0_);_(...($* "-"_);_(@_) | n | $ 1,235 ||
| More number formats | _(* #,##0_);_(*..._(* "-"_);_(@_) | n | 1,235 ||
| More number formats | _($* #,##0.00_);_(...($* "-"_);_(@_) | n | $ 1,234.56 ||
| More number formats | _(* #,##0.00_);...* "-"??_);_(@_) | n | 1,234.56 ||
| <br><br><br>**Time and Date Format** | | | | |
| Time | hh:mm AM/PM | d |10:23 AM||
| Time 24H | hh:mm | d |10:23||
| Date Time | yyyy-MM-dd hh:mm AM/PM | d |2020-07-29 10:23 AM||
| Date Time 24H | yyyy-MM-dd hh:mm | d |2020-07-29 10:23||
| Date | yyyy-MM-dd | d | 1930-08-05 ||
| Date | yyyy/MM/dd | d | 1930/8/5 ||
| Date | yyyy "year" M" month "d" day" | d | August 5, 1930 ||
| Date | MM-dd | d | 08-05 ||
| Date | M-d | d | 8-5 ||
| Date | M"Month"d"Day" | d | August 5th ||
| Date | h:mm:ss | d | 13:30:30 ||
| Date | h:mm | d | 13:30 ||
| Date | AM/PM hh:mm | d | 01:30 PM ||
| Date | AM/PM h:mm | d | 1:30 PM ||
| Date | AM/PM h:mm:ss | d | 1:30:30 PM ||
| Date | MM-dd AM/PM hh:mm | d | Next 08-05 01:30 PM ||
| <br><br><br>**Currency Format** | | | | |
| Currency: RMB | "¥" 0.00 | n | ¥ 123.00 | Also supports ¥ #.00 or ¥0.00|
| Currency: US Dollar | "$" 0.00 | n | $ 123.00 ||
| Currency: Euro | "€" 0.00 | n | € 123.00 ||
| Currency: British Pound | "£" 0.00 | n | £ 123.00 ||
| Currency: Hong Kong Dollar | "$" 0.00 | n | $ 123.00 ||
| Currency: Japanese Yen | "¥" 0.00 | n | ¥123.00 ||
| Currency: Albanian Lek | "Lek" 0.00 | n | Lek 123.00 ||
| Currency: Algerian Dinar | "din" 0.00 | n | din 123.00 ||
| Currency: Afghani | "Af" 0.00 | n | Af 123.00 ||
| Currency: Argentine Peso | "$" 0.00 | n | $ 123.00 ||
| Currency: United Arab Emirates Dirham | "dh" 0.00 | n | dh 123.00 ||
| Currency: Aruban Florin | "Afl" 0.00 | n | Afl 123.00 ||
| Currency: Omani Rial | "Rial" 0.00 | n | Rial 123.00 ||
| Currency: Azerbaijani Manat | "?" 0.00 | n |? 123.00 ||
| Currency: Egyptian Pound | "£" 0.00 | n | £ 123.00 ||
| Currency: Ethiopian Birr | "Birr" 0.00 | n | Birr 123.00 ||
| Currency: Angolan Kwanza | "Kz" 0.00 | n | Kz 123.00 ||
| Currency: Australian Dollar | "$" 0.00 | n | $ 123.00 ||
| Currency: Macau Patacas | "MOP" 0.00 | n | MOP 123.00 ||
| Currency: Barbadian Dollar | "$" 0.00 | n | $ 123.00 ||
| Currency: Papua New Guinea Kina | "PGK" 0.00 | n | PGK 123.00 ||
| Currency: Bahamian Dollar | "$" 0.00 | n | $ 123.00 ||
| Currency: Pakistani Rupee | "Rs" 0.00 | n | Rs 123.00 ||
| Currency: Paraguayan Guarani | "Gs" 0.00 | n | Gs 123.00 ||
| Currency: Bahraini Dinar | "din" 0.00 | n | din 123.00 ||
| Currency: Panamanian Balboa | "B/" 0.00 | n | B/ 123.00 ||
| Currency: Brazilian Riyal | "R$" 0.00 | n | R$ 123.00 ||
| Currency: Belarusian ruble | "р" 0.00 | n | р 123.00 ||
| Currency: Bermudian Dollar | "$" 0.00 | n | $ 123.00 ||
| Currency: Bulgarian Lev | "lev" 0.00 | n | lev 123.00 ||
| Currency: Iceland Krona | "kr" 0.00 | n | kr 123.00 ||
| Currency: Bosnia and Herzegovina convertible mark | "KM" 0.00 | n | KM 123.00 ||
| Currency: Polish Zloty | "z?" 0.00 | n | z? 123.00 ||
| Currency: Boliviano | "Bs" 0.00 | n | Bs 123.00 ||
| Currency: Belize Dollar | "$" 0.00 | n | $ 123.00 ||
| Currency: Botswana Pula | "P" 0.00 | n | P 123.00 ||
| Currency: Bhutan Nusam | "Nu" 0.00 | n | Nu 123.00 ||
| Currency: Burundian Franc | "FBu" 0.00 | n | FBu 123.00 ||
| Currency: North Korean Won | "?KP" 0.00 | n | ?KP 123.00 ||
| Currency: Danish Krone | "kr" 0.00 | n | kr 123.00 ||
| Currency: East Caribbean Dollar | "$" 0.00 | n | $ 123.00 ||
| Currency: Dominican Peso | "RD$" 0.00 | n | RD$ 123.00 ||
| Currency: Russian ruble | "?" 0.00 | n |? 123.00 ||
| Currency: Eritrean Nakfa | "Nfk" 0.00 | n | Nfk 123.00 ||
| Currency: CFA franc | "CFA" 0.00 | n | CFA 123.00 ||
| Currency: Philippine Peso | "?" 0.00 | n |? 123.00 ||
| Currency: Fijian Dollar | "$" 0.00 | n | $ 123.00 ||
| Currency: Cape Verde Escudo | "CVE" 0.00 | n | CVE 123.00 ||
| Currency: Falkland Islands Pound | "£" 0.00 | n | £ 123.00 ||
| Currency: Gambia Dalasi | "GMD" 0.00 | n | GMD 123.00 ||
| Currency: Congolese Franc | "FrCD" 0.00 | n | FrCD 123.00 ||
| Currency: Colombian Peso | "$" 0.00 | n | $ 123.00 ||
| Currency: Costa Rican Colon | "?" 0.00 | n |? 123.00 ||
| Currency: Cuban Peso | "$" 0.00 | n | $ 123.00 ||
| Currency: Cuban Convertible Peso | "$" 0.00 | n | $ 123.00 ||
| Currency: Guyana Dollar | "$" 0.00 | n | $ 123.00 ||
| Currency: Kazakhstan tenge | "?" 0.00 | n |? 123.00 ||
| Currency: Haitian Gourde | "HTG" 0.00 | n | HTG 123.00 ||
| Currency: Korean Won | "?" 0.00 | n |? 123.00 ||
| Currency: Netherlands Antilles Guild | "NAf." 0.00 | n | NAf. 123.00 ||
| Currency: Honduras Lalempira | "L" 0.00 | n | L 123.00 ||
| Currency: Djiboutian Franc | "Fdj" 0.00 | n | Fdj 123.00 ||
| Currency: Kyrgyzstan Som | "KGS" 0.00 | n | KGS 123.00 ||
| Currency: Guinean Franc | "FG" 0.00 | n | FG 123.00 ||
| Currency: Canadian Dollar | "$" 0.00 | n | $ 123.00 ||
| Currency: Ghanaian Cedi | "GHS" 0.00 | n | GHS 123.00 ||
| Currency: Cambodian Riel | "Riel" 0.00 | n | Riel 123.00 ||
| Currency: Czech Koruna | "K?" 0.00 | n | K? 123.00 ||
| Currency: Zimbabwe dollar | "$" 0.00 | n | $ 123.00 ||
| Currency: Qatari Rial | "Rial" 0.00 | n | Rial 123.00 ||
| Currency: Cayman Islands Dollar | "$" 0.00 | n | $ 123.00 ||
| Currency: Comorian Franc | "CF" 0.00 | n | CF 123.00 ||
| Currency: Kuwaiti Dinar | "din" 0.00 | n | din 123.00 ||
| Currency: Croatian Kuna | "kn" 0.00 | n | kn 123.00 ||
| Currency: Kenyan Shilling | "Ksh" 0.00 | n | Ksh 123.00 ||
| Currency: Lesotho Loti | "LSL" 0.00 | n | LSL 123.00 ||
| Currency: Lao Kip | "?" 0.00 | n |? 123.00 ||
| Currency: Lebanese Pound | "L£" 0.00 | n | L£ 123.00 ||
| Currency: Lithuanian Litas | "Lt" 0.00 | n | Lt 123.00 ||
| Currency: Libyan Dinar | "din" 0.00 | n | din 123.00 ||
| Currency: Libyan Dollar | "$" 0.00 | n | $ 123.00 ||
| Currency: Rwandan franc | "RF" 0.00 | n | RF 123.00 ||
| Currency: Romanian Lei | "RON" 0.00 | n | RON 123.00 ||
| Currency: Madagascar Ariary | "Ar" 0.00 | n | Ar 123.00 ||
| Currency: Maldivian Rufiyaa | "Rf" 0.00 | n | Rf 123.00 ||
| Currency: Malawian Kwacha | "MWK" 0.00 | n | MWK 123.00 ||
| Currency: Malaysian Ringgit | "RM" 0.00 | n | RM 123.00 ||
| Currency: Macedonian Dinar | "din" 0.00 | n | din 123.00 ||
| Currency: Mauritian Rupee | "MURs" 0.00 | n | MURs 123.00 ||
| Currency: Mauritania Ouguiya | "MRO" 0.00 | n | MRO 123.00 ||
| Currency: Mongolian Tugrik | "?" 0.00 | n |? 123.00 ||
| Currency: Bangladeshi Taka | "?" 0.00 | n |? 123.00 ||
| Currency: Peruvian New Sol | "S/" 0.00 | n | S/ 123.00 ||
| Currency: Myanmar Kyat | "K" 0.00 | n | K 123.00 ||
| Currency: Moldovan Lei | "MDL" 0.00 | n | MDL 123.00 ||
| Currency: Moroccan Dirham | "dh" 0.00 | n | dh 123.00 ||
| Currency: Mozambique Metical | "MTn" 0.00 | n | MTn 123.00 ||
| Currency: Mexican Peso | "$" 0.00 | n | $ 123.00 ||
| Currency: Namibian Dollar | "$" 0.00 | n | $ 123.00 ||
| Currency: South African Rand | "R" 0.00 | n | R 123.00 ||
| Currency: South Sudanese Pound | "£" 0.00 | n | £ 123.00 ||
| Currency: Nicaragua Cordoba | "C$" 0.00 | n | C$ 123.00 ||
| Currency: Nepalese Rupee | "Rs" 0.00 | n | Rs 123.00 ||
| Currency: Nigerian Naira | "?" 0.00 | n |? 123.00 ||
| Currency: Norwegian Krone | "kr" 0.00 | n | kr 123.00 ||
| Currency: Georgia Lari | "GEL" 0.00 | n | GEL 123.00 ||
| Currency: RMB (Offshore) | "¥" 0.00 | n | ¥123.00 ||
| Currency: Swedish Krona | "kr" 0.00 | n | kr 123.00 ||
| Currency: Swiss Franc | "CHF" 0.00 | n | CHF 123.00 ||
| Currency: Serbian Dinar | "din" 0.00 | n | din 123.00 ||
| Currency: Sierra Leone Leone | "SLL" 0.00 | n | SLL 123.00 ||
| Currency: Seychelles Rupee | "SCR" 0.00 | n | SCR 123.00 ||
| Currency: Saudi Riyal | "Rial" 0.00 | n | Rial 123.00 ||
| Currency: Sao Tome Dobra | "Db" 0.00 | n | Db 123.00 ||
| Currency: St. Helena Pound | "£" 0.00 | n | £ 123.00 ||
| Currency: Sri Lankan Rupee | "Rs" 0.00 | n | Rs 123.00 ||
| Currency: Swaziland Lilangeni | "SZL" 0.00 | n | SZL 123.00 ||
| Currency: Sudanese Pound | "SDG" 0.00 | n | SDG 123.00 ||
| Currency: Surinamese Dollar | "$" 0.00 | n | $ 123.00 ||
| Currency: Solomon Islands Dollar | "$" 0.00 | n | $ 123.00 ||
| Currency: Somali Shilling | "SOS" 0.00 | n | SOS 123.00 ||
| Currency: Tajikistani Somoni | "Som" 0.00 | n | Som 123.00 ||
| Currency: Pacific Franc | "FCFP" 0.00 | n | FCFP 123.00 ||
| Currency: Thai Baht | "?" 0.00 | n |? 123.00 ||
| Currency: Tanzanian Shilling | "TSh" 0.00 | n | TSh 123.00 ||
| Currency: Tongan Paanga | "T$" 0.00 | n | T$ 123.00 ||
| Currency: Trinidad and Tobago Dollar | "$" 0.00 | n | $ 123.00 ||
| Currency: Tunisian Dinar | "din" 0.00 | n | din 123.00 ||
| Currency: Turkish Lira | "?" 0.00 | n |? 123.00 ||
| Currency: Vanuatu Vatu | "VUV" 0.00 | n | VUV 123.00 ||
| Currency: Guatemalan Quetzal | "Q" 0.00 | n | Q 123.00 ||
| Currency: Venezuelan Bolivar | "Bs" 0.00 | n | Bs 123.00 ||
| Currency: Brunei Dollar | "$" 0.00 | n | $ 123.00 ||
| Currency: Ugandan Shilling | "UGX" 0.00 | n | UGX 123.00 ||
| Currency: Ukrainian Hryvnia | "грн." 0.00 | n | грн. 123.00 ||
| Currency: Uruguayan Peso | "$" 0.00 | n | $ 123.00 ||
| Currency: Uzbekistani Sum | "so?m" 0.00 | n | so?m 123.00 ||
| Currency: Western Samoa Tala | "WST" 0.00 | n | WST 123.00 ||
| Currency: Singapore Dollar | "$" 0.00 | n | $ 123.00 ||
| Currency: New Taiwan Dollar | "NT$" 0.00 | n | NT$ 123.00 ||
| Currency: New Zealand Dollar | "$" 0.00 | n | $ 123.00 ||
| Currency: Hungarian Forint | "Ft" 0.00 | n | Ft 123.00 ||
| Currency: Syrian Pound | "£" 0.00 | n | £ 123.00 ||
| Currency: Jamaican Dollar | "$" 0.00 | n | $ 123.00 ||
| Currency: Armenian Dram | "Dram" 0.00 | n | Dram 123.00 ||
| Currency: Yemeni Rial | "Rial" 0.00 | n | Rial 123.00 ||
| Currency: Iraqi Dinar | "din" 0.00 | n | din 123.00 ||
| Currency: Iranian Rial | "Rial" 0.00 | n | Rial 123.00 ||
| Currency: Israeli New Shekel | "?" 0.00 | n |? 123.00 ||
| Currency: Indian Rupee | "?" 0.00 | n |? 123.00 ||
| Currency: Indonesian Rupiah | "Rp" 0.00 | n | Rp 123.00 ||
| Currency: Jordanian Dinar | "din" 0.00 | n | din 123.00 ||
| Currency: Vietnamese Dong | "?" 0.00 | n |? 123.00 ||
| Currency: Zambian Kwacha | "ZMW" 0.00 | n | ZMW 123.00 ||
| Currency: Gibraltar Pound | "£" 0.00 | n | £ 123.00 ||
| Currency: Chilean Peso | "$" 0.00 | n | $ 123.00 ||
| Currency: China-Africa Financial Cooperation Franc | "FCFA" 0.00 | n | FCFA 123.00 ||
Import/export only considers the data style that the user sees. For example, the way to process the date format in excel is to convert the date into a number: 42736 represents 2017-1-1.
Notice: Import/export only considers the data style that the user sees. For example, the way to process the date format in excel is to convert the date into a number: 42736 represents 2017-1-1.

15
docs/zh/guide/FAQ.md

@ -21,19 +21,4 @@ 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>** :
------------

129
docs/zh/guide/feature.md

@ -1,75 +1,64 @@
# 高级功能
## luckysheet.getcellvalue(r, c, data, type)
## luckysheet.create(options)
- **参数**
- r:单元格所在行数;可选值;从0开始的整数,0表示第一行。
- c:单元格所在列数;可选值;从0开始的整数,0表示第一列。
- data:表数据;二维数组;默认值为当前表格数据。
- type:单元格属性值;可选值;默认值为'v',表示获取单元格的值。
- {Object} [options]:表格的所有配置信息
- **用法**
此方法为获取单元格的值。`r`, `c`都没有值时,返回`data`;`r`, `c`只有一个有值时,返回整行或整列数据;
初始化一个luckysheet,可包含多个工作表,参考 [配置列表](https://mengshukeji.github.io/LuckysheetDocs/zh/guide/config.html#container)
------------
## luckysheet.getluckysheetfile()
- **用法**
返回所有表格数据结构。
------------
## luckysheet.sheetmanage.getSheetByIndex(index)
- **参数**
- index:表格下标;从0开始的整数,0表示第一个表格;默认为当前表格下标。
- **用法**
返回某个表格数据结构。
------------
## luckysheet.getconfig()
- **用法**
返回当前表格config配置。
------------
## luckysheet.getSheetConfig(sheetIndex)
## luckysheet.getcellvalue([r] [,c] [,data] [,type])
- **参数**
- sheetIndex:表格下标;从0开始的整数,0表示第一个表格;默认为当前表格下标。
- {Number} [r]:单元格所在行数;可选值;从0开始的整数,0表示第一行
- {Number} [c]:单元格所在列数;可选值;从0开始的整数,0表示第一列
- {Array} [data]:表数据,二维数组;可选值;默认值为当前表格数据
- {String} [type]:单元格属性值;可选值;默认值为'v',表示获取单元格的实际值
- **用法**
此方法为获取单元格的值。
- `luckysheet.getcellvalue()`:返回当前工作表的所有数据;
- `luckysheet.getcellvalue(0)`:返回当前工作表第1行数据;
- `luckysheet.getcellvalue(null,0)`:返回当前工作表第1列数据;
- `luckysheet.getcellvalue(0,0)`:返回当前工作表第1行第1列单元格的数据的v值;
- `luckysheet.getcellvalue(1,1,null,'m')`: 返回指定data数据的第2行第2列单元格的原始值。
返回某个表格config配置。
特殊情况:单元格格式为`yyyy-MM-dd`,type为'v'时会强制取'm'显示值
------------
## luckysheet.getvisibledatarow()
## luckysheet.getluckysheetfile()
- **用法**
返回当前表格行高
返回所有表格数据结构的一维数组 [luckysheetfile](https://mengshukeji.github.io/LuckysheetDocs/zh/guide/data.html#%E8%8E%B7%E5%8F%96%E8%A1%A8%E6%A0%BC%E6%95%B0%E6%8D%AE),`luckysheet.getluckysheetfile()[0]`可取得第一个工作表的所有信息
------------
## luckysheet.getvisibledatacolumn()
## luckysheet.getconfig()
- **用法**
返回当前表格列宽
快捷返回当前表格config配置,每个工作表的config信息仍然包含在luckysheetfile
------------
## luckysheet.getluckysheet_select_save()
- **用法**
返回当前选区。
返回当前选区对象的数组,可能存在多个选区
------------
## luckysheet.getdatabyselection(range, sheetIndex)
## luckysheet.getdatabyselection([range] [,sheetIndex])
- **参数**
- range:选区对象;`object: { row: [r1, r2], column: [c1, c2] }`;默认为当前选区。
- sheetIndex:表格下标;从0开始的整数,0表示第一个表格;默认为当前表格下标。
- {Object} [range]:选区对象,`object: { row: [r1, r2], column: [c1, c2] }`;可选值;默认为当前第一个选区。
- {Number} [sheetIndex]:表格下标,从0开始的整数,0表示第一个表格;可选值;默认为当前表格下标。
- **用法**
返回某个表格某个区域单元格数据。
返回某个表格第一个选区的数据。
- `luckysheet.getdatabyselection()`: 返回当前工作表当前选区的数据
- `luckysheet.getdatabyselection(null,1)`: 返回第2个工作表的当前选区的数据
------------
## luckysheet.luckysheetrefreshgrid(scrollWidth, scrollHeight)
- **参数**
- scrollWidth:横向滚动值。默认为当前横向滚动位置。
- scrollHeight:纵向滚动值。默认为当前纵向滚动位置。
- {Number} [scrollWidth]:横向滚动值。默认为当前横向滚动位置。
- {Number} [scrollHeight]:纵向滚动值。默认为当前纵向滚动位置。
- **用法**
按照scrollWidth, scrollHeight刷新canvas展示数据。
@ -77,22 +66,28 @@
------------
## luckysheet.setcellvalue(r, c, d, v)
- **参数**
- r:单元格所在行数;从0开始的整数,0表示第一行。
- c:单元格所在列数;从0开始的整数,0表示第一列。
- d:表数据;二维数组。
- v:要设置的值;可为对象,对象是是要符合单元格对象格式。
- {Number} [r]:单元格所在行数;从0开始的整数,0表示第一行。
- {Number} [c]:单元格所在列数;从0开始的整数,0表示第一列。
- {Array} [d]:表数据;可选值;二维数组。
- {Object | String | Number} [v]:要设置的值;可为对象,对象是是要符合单元格对象格式。
- **用法**
设置某个单元格的值。可配合`luckysheet.luckysheetrefreshgrid()`刷新查看单元格值改变。
```js
luckysheet.setcellvalue(0, 0, luckysheet.flowdata, 'abc');
luckysheet.luckysheetrefreshgrid();
luckysheet.setcellvalue(0, 0, luckysheet.flowdata(), 'abc');
luckysheet.jfrefreshgrid();
```
------------
## luckysheet.jfrefreshgrid()
- **用法**
刷新canvas
------------
## luckysheet.setluckysheet_select_save(v)
- **参数**
- v:要设置的选区值(数组)。符合选区格式规则,如`[{ row: [r1, r2], column: [c1, c2] }]`。
- {Array} [v]:要设置的选区值(数组)。符合选区格式规则,如`[{ row: [r1, r2], column: [c1, c2] }]`。
- **用法**
设置当前表格选区的值。配合`luckysheet.selectHightlightShow()`可在界面查看选区改变。
@ -102,23 +97,51 @@
```
------------
## luckysheet.sheetmanage.setSheetHide(index)
## luckysheet.selectHightlightShow()
- **用法**
高亮当前选区
------------
## luckysheet.setSheetHide(index)
- **参数**
- index:表格下标;从0开始的整数,0表示第一个表格;默认为当前表格下标。
- {Number} [index]:表格索引;从0开始的整数,0表示第一个表格;默认为当前表格索引
- **用法**
隐藏某个表格。
------------
## luckysheet.sheetmanage.setSheetShow(index)
## luckysheet.setSheetShow(index)
- **参数**
- index:表格下标;从0开始的整数,0表示第一个表格;默认为当前表格下标
- {Number} [index]:表格索引;从0开始的整数,0表示第一个表格;默认为当前表格索引
- **用法**
显示某个表格。
------------
## luckysheet.method.destroy()
## luckysheet.flowdata()
- **用法**
快捷获取当前表格的数据
------------
## luckysheet.buildGridData(file)
- **参数**
- {Object} [file]:[luckysheetfile](https://mengshukeji.github.io/LuckysheetDocs/zh/guide/data.html#%E8%8E%B7%E5%8F%96%E8%A1%A8%E6%A0%BC%E6%95%B0%E6%8D%AE)
- **用法**
生成表格可以识别的二维数组
------------
## luckysheet.getGridData(data)
- **参数**
- {Array} [data]:工作表的二维数组数据
- **用法**
二维数组数据转化成 `{r, c, v}` 格式 一维数组
------------
## luckysheet.destroy()
- **用法**
释放表格
删除并释放表格

220
docs/zh/guide/format.md

@ -181,28 +181,14 @@
|t|Type类型|如"g"|
可选择的设置如下:
| 格式 | ct.fa值 | ct.t值 | m值示例 |备注 |
| 格式 | ct.fa | ct.t | m 值示例 |备注 |
|----------|----------|-------------------------|------------------------- |------------------------- |
| 自动 | General | g | Luckysheet ||
| 自动 | General | g | Luckysheet ||
| 纯文本 | @ | s | Luckysheet ||
| <br><br><br>**数字格式** | | | | |
| 整数 | 0 | n | 1235 | 0位小数 ||
| 数字一位小数 | 0.0 | n | 1234.6 | 0.0中,点后面0的个数就代表小数位数,原始数字位数大,设置位数小时会做四舍五入 |
| 整数 | 0 | n | 1235 | 0位小数 ||
| 数字一位小数 | 0.0 | n | 1234.6 | 点后面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 ||
@ -212,13 +198,195 @@
| 万元 | w | n |12万3456||
| 万元2位小数 | w0.00 | n |12万3456.00||
| 会计 | ¥(0.00) | n ||
| 更多数字格式 | #,##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 ||
| <br><br><br>**时间日期格式** | | | | |
| 时间 | hh:mm AM/PM | d |10:23 AM||
| 时间24H | hh:mm | d |10:23||
| 日期时间 | yyyy-MM-dd hh:mm AM/PM | d |2020-07-29 10:23 AM||
| 日期时间24H | yyyy-MM-dd hh:mm | d |2020-07-29 10:23||
| 日期 | yyyy-MM-dd | d | 1930-08-05 ||
| 日期 | yyyy/MM/dd | d | 1930/8/5 ||
| 日期 | yyyy"年"M"月"d"日" | d | 1930年8月5日 ||
| 日期 | MM-dd | d | 08-05 ||
| 日期 | M-d | d | 8-5 ||
| 日期 | M"月"d"日" | d | 8月5日 ||
| 日期 | h:mm:ss | d | 13:30:30 ||
| 日期 | h:mm | d | 13:30 ||
| 日期 | AM/PM hh:mm | d | 下午01:30 ||
| 日期 | AM/PM h:mm | d | 下午1:30 ||
| 日期 | AM/PM h:mm:ss | d | 下午1:30:30 ||
| 日期 | MM-dd AM/PM hh:mm | d | 下08-05 下午01:30 ||
| <br><br><br>**货币格式** | | | | |
| 货币:人民币 | "¥" 0.00 | n | ¥ 123.00 |也支持 ¥ #.00 或者 ¥0.00|
| 货币:美元 | "$" 0.00 | n | $ 123.00 ||
| 货币:欧元 | "€" 0.00 | n | € 123.00 ||
| 货币:英镑 | "£" 0.00 | n | £ 123.00 ||
| 货币:港元 | "$" 0.00 | n | $ 123.00 ||
| 货币:日元 | "¥" 0.00 | n | ¥ 123.00 ||
| 货币:阿尔巴尼亚列克 | "Lek" 0.00 | n | Lek 123.00 ||
| 货币:阿尔及利亚第纳尔 | "din" 0.00 | n | din 123.00 ||
| 货币:阿富汗尼 | "Af" 0.00 | n | Af 123.00 ||
| 货币:阿根廷比索 | "$" 0.00 | n | $ 123.00 ||
| 货币:阿拉伯联合酋长国迪拉姆 | "dh" 0.00 | n | dh 123.00 ||
| 货币:阿鲁巴弗罗林 | "Afl" 0.00 | n | Afl 123.00 ||
| 货币:阿曼里亚尔 | "Rial" 0.00 | n | Rial 123.00 ||
| 货币:阿塞拜疆马纳特 | "?" 0.00 | n | ? 123.00 ||
| 货币:埃及镑 | "£" 0.00 | n | £ 123.00 ||
| 货币:埃塞俄比亚比尔 | "Birr" 0.00 | n | Birr 123.00 ||
| 货币:安哥拉宽扎 | "Kz" 0.00 | n | Kz 123.00 ||
| 货币:澳大利亚元 | "$" 0.00 | n | $ 123.00 ||
| 货币:澳门元 | "MOP" 0.00 | n | MOP 123.00 ||
| 货币:巴巴多斯元 | "$" 0.00 | n | $ 123.00 ||
| 货币:巴布亚新几内亚基那 | "PGK" 0.00 | n | PGK 123.00 ||
| 货币:巴哈马元 | "$" 0.00 | n | $ 123.00 ||
| 货币:巴基斯坦卢比 | "Rs" 0.00 | n | Rs 123.00 ||
| 货币:巴拉圭瓜拉尼 | "Gs" 0.00 | n | Gs 123.00 ||
| 货币:巴林第纳尔 | "din" 0.00 | n | din 123.00 ||
| 货币:巴拿马巴波亚 | "B/" 0.00 | n | B/ 123.00 ||
| 货币:巴西里亚伊 | "R$" 0.00 | n | R$ 123.00 ||
| 货币:白俄罗斯卢布 | "р" 0.00 | n | р 123.00 ||
| 货币:百慕大元 | "$" 0.00 | n | $ 123.00 ||
| 货币:保加利亚列弗 | "lev" 0.00 | n | lev 123.00 ||
| 货币:冰岛克朗 | "kr" 0.00 | n | kr 123.00 ||
| 货币:波黑可兑换马克 | "KM" 0.00 | n | KM 123.00 ||
| 货币:波兰兹罗提 | "z?" 0.00 | n | z? 123.00 ||
| 货币:玻利维亚诺 | "Bs" 0.00 | n | Bs 123.00 ||
| 货币:伯利兹元 | "$" 0.00 | n | $ 123.00 ||
| 货币:博茨瓦纳普拉 | "P" 0.00 | n | P 123.00 ||
| 货币:不丹努扎姆 | "Nu" 0.00 | n | Nu 123.00 ||
| 货币:布隆迪法郎 | "FBu" 0.00 | n | FBu 123.00 ||
| 货币:朝鲜圆 | "?KP" 0.00 | n | ?KP 123.00 ||
| 货币:丹麦克朗 | "kr" 0.00 | n | kr 123.00 ||
| 货币:东加勒比元 | "$" 0.00 | n | $ 123.00 ||
| 货币:多米尼加比索 | "RD$" 0.00 | n | RD$ 123.00 ||
| 货币:俄国卢布 | "?" 0.00 | n | ? 123.00 ||
| 货币:厄立特里亚纳克法 | "Nfk" 0.00 | n | Nfk 123.00 ||
| 货币:非洲金融共同体法郎 | "CFA" 0.00 | n | CFA 123.00 ||
| 货币:菲律宾比索 | "?" 0.00 | n | ? 123.00 ||
| 货币:斐济元 | "$" 0.00 | n | $ 123.00 ||
| 货币:佛得角埃斯库多 | "CVE" 0.00 | n | CVE 123.00 ||
| 货币:福克兰群岛镑 | "£" 0.00 | n | £ 123.00 ||
| 货币:冈比亚达拉西 | "GMD" 0.00 | n | GMD 123.00 ||
| 货币:刚果法郎 | "FrCD" 0.00 | n | FrCD 123.00 ||
| 货币:哥伦比亚比索 | "$" 0.00 | n | $ 123.00 ||
| 货币:哥斯达黎加科朗 | "?" 0.00 | n | ? 123.00 ||
| 货币:古巴比索 | "$" 0.00 | n | $ 123.00 ||
| 货币:古巴可兑换比索 | "$" 0.00 | n | $ 123.00 ||
| 货币:圭亚那元 | "$" 0.00 | n | $ 123.00 ||
| 货币:哈萨克斯坦坚戈 | "?" 0.00 | n | ? 123.00 ||
| 货币:海地古德 | "HTG" 0.00 | n | HTG 123.00 ||
| 货币:韩元 | "?" 0.00 | n | ? 123.00 ||
| 货币:荷属安的列斯盾 | "NAf." 0.00 | n | NAf. 123.00 ||
| 货币:洪都拉斯拉伦皮拉 | "L" 0.00 | n | L 123.00 ||
| 货币:吉布提法郎 | "Fdj" 0.00 | n | Fdj 123.00 ||
| 货币:吉尔吉斯斯坦索姆 | "KGS" 0.00 | n | KGS 123.00 ||
| 货币:几内亚法郎 | "FG" 0.00 | n | FG 123.00 ||
| 货币:加拿大元 | "$" 0.00 | n | $ 123.00 ||
| 货币:加纳塞地 | "GHS" 0.00 | n | GHS 123.00 ||
| 货币:柬埔寨瑞尔 | "Riel" 0.00 | n | Riel 123.00 ||
| 货币:捷克克朗 | "K?" 0.00 | n | K? 123.00 ||
| 货币:津巴布韦元 | "$" 0.00 | n | $ 123.00 ||
| 货币:卡塔尔里亚尔 | "Rial" 0.00 | n | Rial 123.00 ||
| 货币:开曼群岛元 | "$" 0.00 | n | $ 123.00 ||
| 货币:科摩罗法郎 | "CF" 0.00 | n | CF 123.00 ||
| 货币:科威特第纳尔 | "din" 0.00 | n | din 123.00 ||
| 货币:克罗地亚库纳 | "kn" 0.00 | n | kn 123.00 ||
| 货币:肯尼亚先令 | "Ksh" 0.00 | n | Ksh 123.00 ||
| 货币:莱索托洛蒂 | "LSL" 0.00 | n | LSL 123.00 ||
| 货币:老挝基普 | "?" 0.00 | n | ? 123.00 ||
| 货币:黎巴嫩镑 | "L£" 0.00 | n | L£ 123.00 ||
| 货币:立陶宛立特 | "Lt" 0.00 | n | Lt 123.00 ||
| 货币:利比亚第纳尔 | "din" 0.00 | n | din 123.00 ||
| 货币:利比亚元 | "$" 0.00 | n | $ 123.00 ||
| 货币:卢旺达法郎 | "RF" 0.00 | n | RF 123.00 ||
| 货币:罗马尼亚列伊 | "RON" 0.00 | n | RON 123.00 ||
| 货币:马达加斯加阿里亚里 | "Ar" 0.00 | n | Ar 123.00 ||
| 货币:马尔代夫拉菲亚 | "Rf" 0.00 | n | Rf 123.00 ||
| 货币:马拉维克瓦查 | "MWK" 0.00 | n | MWK 123.00 ||
| 货币:马来西亚林吉特 | "RM" 0.00 | n | RM 123.00 ||
| 货币:马其顿戴第纳尔 | "din" 0.00 | n | din 123.00 ||
| 货币:毛里求斯卢比 | "MURs" 0.00 | n | MURs 123.00 ||
| 货币:毛里塔尼亚乌吉亚 | "MRO" 0.00 | n | MRO 123.00 ||
| 货币:蒙古图格里克 | "?" 0.00 | n | ? 123.00 ||
| 货币:孟加拉塔卡 | "?" 0.00 | n | ? 123.00 ||
| 货币:秘鲁新索尔 | "S/" 0.00 | n | S/ 123.00 ||
| 货币:缅甸开亚特 | "K" 0.00 | n | K 123.00 ||
| 货币:摩尔多瓦列伊 | "MDL" 0.00 | n | MDL 123.00 ||
| 货币:摩洛哥迪拉姆 | "dh" 0.00 | n | dh 123.00 ||
| 货币:莫桑比克梅蒂卡尔 | "MTn" 0.00 | n | MTn 123.00 ||
| 货币:墨西哥比索 | "$" 0.00 | n | $ 123.00 ||
| 货币:纳米比亚元 | "$" 0.00 | n | $ 123.00 ||
| 货币:南非兰特 | "R" 0.00 | n | R 123.00 ||
| 货币:南苏丹镑 | "£" 0.00 | n | £ 123.00 ||
| 货币:尼加拉瓜科多巴 | "C$" 0.00 | n | C$ 123.00 ||
| 货币:尼泊尔卢比 | "Rs" 0.00 | n | Rs 123.00 ||
| 货币:尼日利亚奈拉 | "?" 0.00 | n | ? 123.00 ||
| 货币:挪威克朗 | "kr" 0.00 | n | kr 123.00 ||
| 货币:乔治亚拉瑞 | "GEL" 0.00 | n | GEL 123.00 ||
| 货币:人民币(离岸) | "¥" 0.00 | n | ¥ 123.00 ||
| 货币:瑞典克朗 | "kr" 0.00 | n | kr 123.00 ||
| 货币:瑞士法郎 | "CHF" 0.00 | n | CHF 123.00 ||
| 货币:塞尔维亚第纳尔 | "din" 0.00 | n | din 123.00 ||
| 货币:塞拉利昂利昂 | "SLL" 0.00 | n | SLL 123.00 ||
| 货币:塞舌尔卢比 | "SCR" 0.00 | n | SCR 123.00 ||
| 货币:沙特里亚尔 | "Rial" 0.00 | n | Rial 123.00 ||
| 货币:圣多美多布拉 | "Db" 0.00 | n | Db 123.00 ||
| 货币:圣赫勒拿群岛磅 | "£" 0.00 | n | £ 123.00 ||
| 货币:斯里兰卡卢比 | "Rs" 0.00 | n | Rs 123.00 ||
| 货币:斯威士兰里兰吉尼 | "SZL" 0.00 | n | SZL 123.00 ||
| 货币:苏丹镑 | "SDG" 0.00 | n | SDG 123.00 ||
| 货币:苏里南元 | "$" 0.00 | n | $ 123.00 ||
| 货币:所罗门群岛元 | "$" 0.00 | n | $ 123.00 ||
| 货币:索马里先令 | "SOS" 0.00 | n | SOS 123.00 ||
| 货币:塔吉克斯坦索莫尼 | "Som" 0.00 | n | Som 123.00 ||
| 货币:太平洋法郎 | "FCFP" 0.00 | n | FCFP 123.00 ||
| 货币:泰国铢 | "?" 0.00 | n | ? 123.00 ||
| 货币:坦桑尼亚先令 | "TSh" 0.00 | n | TSh 123.00 ||
| 货币:汤加潘加 | "T$" 0.00 | n | T$ 123.00 ||
| 货币:特立尼达和多巴哥元 | "$" 0.00 | n | $ 123.00 ||
| 货币:突尼斯第纳尔 | "din" 0.00 | n | din 123.00 ||
| 货币:土耳其里拉 | "?" 0.00 | n | ? 123.00 ||
| 货币:瓦努阿图瓦图 | "VUV" 0.00 | n | VUV 123.00 ||
| 货币:危地马拉格查尔 | "Q" 0.00 | n | Q 123.00 ||
| 货币:委内瑞拉博利瓦 | "Bs" 0.00 | n | Bs 123.00 ||
| 货币:文莱元 | "$" 0.00 | n | $ 123.00 ||
| 货币:乌干达先令 | "UGX" 0.00 | n | UGX 123.00 ||
| 货币:乌克兰格里夫尼亚 | "грн." 0.00 | n | грн. 123.00 ||
| 货币:乌拉圭比索 | "$" 0.00 | n | $ 123.00 ||
| 货币:乌兹别克斯坦苏姆 | "so?m" 0.00 | n | so?m 123.00 ||
| 货币:西萨摩亚塔拉 | "WST" 0.00 | n | WST 123.00 ||
| 货币:新加坡元 | "$" 0.00 | n | $ 123.00 ||
| 货币:新台币 | "NT$" 0.00 | n | NT$ 123.00 ||
| 货币:新西兰元 | "$" 0.00 | n | $ 123.00 ||
| 货币:匈牙利福林 | "Ft" 0.00 | n | Ft 123.00 ||
| 货币:叙利亚镑 | "£" 0.00 | n | £ 123.00 ||
| 货币:牙买加元 | "$" 0.00 | n | $ 123.00 ||
| 货币:亚美尼亚德拉姆 | "Dram" 0.00 | n | Dram 123.00 ||
| 货币:也门里亚尔 | "Rial" 0.00 | n | Rial 123.00 ||
| 货币:伊拉克第纳尔 | "din" 0.00 | n | din 123.00 ||
| 货币:伊朗里亚尔 | "Rial" 0.00 | n | Rial 123.00 ||
| 货币:以色列新谢克尔 | "?" 0.00 | n | ? 123.00 ||
| 货币:印度卢比 | "?" 0.00 | n | ? 123.00 ||
| 货币:印度尼西亚卢比 | "Rp" 0.00 | n | Rp 123.00 ||
| 货币:约旦第纳尔 | "din" 0.00 | n | din 123.00 ||
| 货币:越南盾 | "?" 0.00 | n | ? 123.00 ||
| 货币:赞比亚克瓦查 | "ZMW" 0.00 | n | ZMW 123.00 ||
| 货币:直布罗陀镑 | "£" 0.00 | n | £ 123.00 ||
| 货币:智利比索 | "$" 0.00 | n | $ 123.00 ||
| 货币:中非金融合作法郎 | "FCFA" 0.00 | n | FCFA 123.00 ||
| 货币 | ¥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

469
src/controllers/conditionformat.js

@ -98,6 +98,8 @@ const conditionformat = {
init: function(){
let _this = this;
const conditionformat_Text = locale().conditionformat;
// 管理规则
$(document).off("change.CFchooseSheet").on("change.CFchooseSheet", "#luckysheet-administerRule-dialog .chooseSheet", function(){
let index = $("#luckysheet-administerRule-dialog .chooseSheet option:selected").val();
@ -221,10 +223,10 @@ const conditionformat = {
$(document).off("click.CFnewConditionRule").on("click.CFnewConditionRule", "#newConditionRule", function(){
if(Store.luckysheet_select_save.length == 0){
if(isEditMode()){
alert("请选择应用范围");
alert(conditionformat_Text.pleaseSelectRange);
}
else{
tooltip.info("请选择应用范围", "");
tooltip.info(conditionformat_Text.pleaseSelectRange, "");
}
return;
}
@ -304,7 +306,7 @@ const conditionformat = {
//条件值是否是选区
let rangeArr1 = _this.getRangeByTxt(v1);
if(rangeArr1.length > 1){
_this.infoDialog("只能对单个单元格进行引用", "");
_this.infoDialog(conditionformat_Text.onlySingleCell, "");
return;
}
else if(rangeArr1.length == 1){
@ -318,13 +320,13 @@ const conditionformat = {
conditionValue.push(v1);
}
else{
_this.infoDialog("只能对单个单元格进行引用", "");
_this.infoDialog(conditionformat_Text.onlySingleCell, "");
return;
}
}
else if(rangeArr1.length == 0){
if(isNaN(v1) || v1 == ""){
_this.infoDialog("条件值只能是数字或者单个单元格", "");
_this.infoDialog(conditionformat_Text.conditionValueCanOnly, "");
return;
}
else{
@ -334,7 +336,7 @@ const conditionformat = {
let rangeArr2 = _this.getRangeByTxt(v2);
if(rangeArr2.length > 1){
_this.infoDialog("只能对单个单元格进行引用", "");
_this.infoDialog(conditionformat_Text.onlySingleCell, "");
return;
}
else if(rangeArr2.length == 1){
@ -348,13 +350,13 @@ const conditionformat = {
conditionValue.push(v2);
}
else{
_this.infoDialog("只能对单个单元格进行引用", "");
_this.infoDialog(conditionformat_Text.onlySingleCell, "");
return;
}
}
else if(rangeArr2.length == 0){
if(isNaN(v2) || v2 == ""){
_this.infoDialog("条件值只能是数字或者单个单元格", "");
_this.infoDialog(conditionformat_Text.conditionValueCanOnly, "");
return;
}
else{
@ -369,7 +371,7 @@ const conditionformat = {
//条件值是否是选区
let rangeArr = _this.getRangeByTxt(v);
if(rangeArr.length > 1){
_this.infoDialog("只能对单个单元格进行引用", "");
_this.infoDialog(conditionformat_Text.onlySingleCell, "");
return;
}
else if(rangeArr.length == 1){
@ -383,13 +385,13 @@ const conditionformat = {
conditionValue.push(v);
}
else{
_this.infoDialog("只能对单个单元格进行引用", "");
_this.infoDialog(conditionformat_Text.onlySingleCell, "");
return;
}
}
else if(rangeArr.length == 0){
if(isNaN(v) || v == ""){
_this.infoDialog("条件值只能是数字或者单个单元格", "");
_this.infoDialog(conditionformat_Text.conditionValueCanOnly, "");
return;
}
else{
@ -407,7 +409,7 @@ const conditionformat = {
//条件值是否是选区
let rangeArr = _this.getRangeByTxt(v);
if(rangeArr.length > 1){
_this.infoDialog("只能对单个单元格进行引用", "");
_this.infoDialog(conditionformat_Text.onlySingleCell, "");
return;
}
else if(rangeArr.length == 1){
@ -421,13 +423,13 @@ const conditionformat = {
conditionValue.push(v);
}
else{
_this.infoDialog("只能对单个单元格进行引用", "");
_this.infoDialog(conditionformat_Text.onlySingleCell, "");
return;
}
}
else if(rangeArr.length == 0){
if(isNaN(v) || v == ""){
_this.infoDialog("条件值只能是数字或者单个单元格", "");
_this.infoDialog(conditionformat_Text.conditionValueCanOnly, "");
return;
}
else{
@ -442,7 +444,7 @@ const conditionformat = {
let v = $("#luckysheet-newConditionRule-dialog #daterange-btn").val();
if(v == "" || v == null){
_this.infoDialog("请选择日期", "");
_this.infoDialog(conditionformat_Text.pleaseSelectADate, "");
return;
}
@ -472,7 +474,7 @@ const conditionformat = {
let v = $("#luckysheet-newConditionRule-dialog #conditionVal input").val().trim();
if(parseInt(v) != v || parseInt(v) < 1 || parseInt(v) > 1000){
_this.infoDialog("请输入一个介于 1 和 1000 之间的整数", "");
_this.infoDialog(conditionformat_Text.pleaseEnterInteger, "");
return;
}
@ -669,7 +671,7 @@ const conditionformat = {
//条件值是否是选区
let rangeArr1 = _this.getRangeByTxt(v1);
if(rangeArr1.length > 1){
_this.infoDialog("只能对单个单元格进行引用", "");
_this.infoDialog(conditionformat_Text.onlySingleCell, "");
return;
}
else if(rangeArr1.length == 1){
@ -683,13 +685,13 @@ const conditionformat = {
conditionValue.push(v1);
}
else{
_this.infoDialog("只能对单个单元格进行引用", "");
_this.infoDialog(conditionformat_Text.onlySingleCell, "");
return;
}
}
else if(rangeArr1.length == 0){
if(isNaN(v1) || v1 == ""){
_this.infoDialog("条件值只能是数字或者单个单元格", "");
_this.infoDialog(conditionformat_Text.conditionValueCanOnly, "");
return;
}
else{
@ -699,7 +701,7 @@ const conditionformat = {
let rangeArr2 = _this.getRangeByTxt(v2);
if(rangeArr2.length > 1){
_this.infoDialog("只能对单个单元格进行引用", "");
_this.infoDialog(conditionformat_Text.onlySingleCell, "");
return;
}
else if(rangeArr2.length == 1){
@ -713,13 +715,13 @@ const conditionformat = {
conditionValue.push(v2);
}
else{
_this.infoDialog("只能对单个单元格进行引用", "");
_this.infoDialog(conditionformat_Text.onlySingleCell, "");
return;
}
}
else if(rangeArr2.length == 0){
if(isNaN(v2) || v2 == ""){
_this.infoDialog("条件值只能是数字或者单个单元格", "");
_this.infoDialog(conditionformat_Text.conditionValueCanOnly, "");
return;
}
else{
@ -734,7 +736,7 @@ const conditionformat = {
//条件值是否是选区
let rangeArr = _this.getRangeByTxt(v);
if(rangeArr.length > 1){
_this.infoDialog("只能对单个单元格进行引用", "");
_this.infoDialog(conditionformat_Text.onlySingleCell, "");
return;
}
else if(rangeArr.length == 1){
@ -748,13 +750,13 @@ const conditionformat = {
conditionValue.push(v);
}
else{
_this.infoDialog("只能对单个单元格进行引用", "");
_this.infoDialog(conditionformat_Text.onlySingleCell, "");
return;
}
}
else if(rangeArr.length == 0){
if(isNaN(v) || v == ""){
_this.infoDialog("条件值只能是数字或者单个单元格", "");
_this.infoDialog(conditionformat_Text.conditionValueCanOnly, "");
return;
}
else{
@ -772,7 +774,7 @@ const conditionformat = {
//条件值是否是选区
let rangeArr = _this.getRangeByTxt(v);
if(rangeArr.length > 1){
_this.infoDialog("只能对单个单元格进行引用", "");
_this.infoDialog(conditionformat_Text.onlySingleCell, "");
return;
}
else if(rangeArr.length == 1){
@ -786,13 +788,13 @@ const conditionformat = {
conditionValue.push(v);
}
else{
_this.infoDialog("只能对单个单元格进行引用", "");
_this.infoDialog(conditionformat_Text.onlySingleCell, "");
return;
}
}
else if(rangeArr.length == 0){
if(isNaN(v) || v == ""){
_this.infoDialog("条件值只能是数字或者单个单元格", "");
_this.infoDialog(conditionformat_Text.conditionValueCanOnly, "");
return;
}
else{
@ -807,7 +809,7 @@ const conditionformat = {
let v = $("#luckysheet-editorConditionRule-dialog #daterange-btn").val();
if(v == "" || v == null){
_this.infoDialog("请选择日期", "");
_this.infoDialog(conditionformat_Text.pleaseSelectADate, "");
return;
}
@ -837,7 +839,7 @@ const conditionformat = {
let v = $("#luckysheet-editorConditionRule-dialog #conditionVal input").val().trim();
if(parseInt(v) != v || parseInt(v) < 1 || parseInt(v) > 1000){
_this.infoDialog("请输入一个介于 1 和 1000 之间的整数", "");
_this.infoDialog(conditionformat_Text.pleaseEnterInteger, "");
return;
}
@ -998,7 +1000,7 @@ const conditionformat = {
//条件值是否是选区
let rangeArr = _this.getRangeByTxt(v);
if(rangeArr.length > 1){
_this.infoDialog("只能对单个单元格进行引用", "");
_this.infoDialog(conditionformat_Text.onlySingleCell, "");
return;
}
else if(rangeArr.length == 1){
@ -1012,13 +1014,13 @@ const conditionformat = {
conditionValue.push(v);
}
else{
_this.infoDialog("只能对单个单元格进行引用", "");
_this.infoDialog(conditionformat_Text.onlySingleCell, "");
return;
}
}
else if(rangeArr.length == 0){
if(isNaN(v) || v == ""){
_this.infoDialog("条件值只能是数字或者单个单元格", "");
_this.infoDialog(conditionformat_Text.conditionValueCanOnly, "");
return;
}
else{
@ -1033,7 +1035,7 @@ const conditionformat = {
//条件值是否是选区
let rangeArr1 = _this.getRangeByTxt(v1);
if(rangeArr1.length > 1){
_this.infoDialog("只能对单个单元格进行引用", "");
_this.infoDialog(conditionformat_Text.onlySingleCell, "");
return;
}
else if(rangeArr1.length == 1){
@ -1047,13 +1049,13 @@ const conditionformat = {
conditionValue.push(v1);
}
else{
_this.infoDialog("只能对单个单元格进行引用", "");
_this.infoDialog(conditionformat_Text.onlySingleCell, "");
return;
}
}
else if(rangeArr1.length == 0){
if(isNaN(v1) || v1 == ""){
_this.infoDialog("条件值只能是数字或者单个单元格", "");
_this.infoDialog(conditionformat_Text.conditionValueCanOnly, "");
return;
}
else{
@ -1063,7 +1065,7 @@ const conditionformat = {
let rangeArr2 = _this.getRangeByTxt(v2);
if(rangeArr2.length > 1){
_this.infoDialog("只能对单个单元格进行引用", "");
_this.infoDialog(conditionformat_Text.onlySingleCell, "");
return;
}
else if(rangeArr2.length == 1){
@ -1077,13 +1079,13 @@ const conditionformat = {
conditionValue.push(v2);
}
else{
_this.infoDialog("只能对单个单元格进行引用", "");
_this.infoDialog(conditionformat_Text.onlySingleCell, "");
return;
}
}
else if(rangeArr2.length == 0){
if(isNaN(v2) || v2 == ""){
_this.infoDialog("条件值只能是数字或者单个单元格", "");
_this.infoDialog(conditionformat_Text.conditionValueCanOnly, "");
return;
}
else{
@ -1095,7 +1097,7 @@ const conditionformat = {
let v = $("#luckysheet-conditionformat-dialog #daterange-btn").val();
if(v == "" || v == null){
_this.infoDialog("请选择日期", "");
_this.infoDialog(conditionformat_Text.pleaseSelectADate, "");
return;
}
@ -1108,7 +1110,7 @@ const conditionformat = {
let v = $("#luckysheet-conditionformat-dialog #conditionVal").val().trim();
if(parseInt(v) != v || parseInt(v) < 1 || parseInt(v) > 1000){
_this.infoDialog("请输入一个介于 1 和 1000 之间的整数", "");
_this.infoDialog(conditionformat_Text.pleaseEnterInteger, "");
return;
}
@ -1287,7 +1289,7 @@ const conditionformat = {
//新建规则弹出层
if(id == "luckysheet-newConditionRule-dialog"){
let source=$("#" + id).find("#luckysheet-newConditionRule-dialog-close").attr("data-source");
let source = $("#" + id).find("#luckysheet-newConditionRule-dialog-close").attr("data-source");
//新建规则入口
if(source == 1){
$("#luckysheet-administerRule-dialog").show();
@ -1343,12 +1345,15 @@ const conditionformat = {
$("#luckysheet-modal-dialog-mask").hide();
$("#luckysheet-singleRange-dialog").remove();
const conditionformat_Text = locale().conditionformat;
$("body").append(replaceHtml(modelHTML, {
"id": "luckysheet-singleRange-dialog",
"addclass": "luckysheet-singleRange-dialog",
"title": "选择单元格",
"content": '<input readonly="readonly" placeholder="请选择单元格" value="'+value+'"/>',
"botton": '<button id="luckysheet-singleRange-dialog-confirm" class="btn btn-primary" data-source="'+source+'">确定</button><button id="luckysheet-singleRange-dialog-close" class="btn btn-default" data-source="'+source+'">取消</button>',
"title": conditionformat_Text.selectCell,
"content": `<input readonly="readonly" placeholder="${conditionformat_Text.pleaseSelectCell}" value="${value}"/>`,
"botton": `<button id="luckysheet-singleRange-dialog-confirm" class="btn btn-primary" data-source="${source}">${conditionformat_Text.confirm}</button>
<button id="luckysheet-singleRange-dialog-close" class="btn btn-default" data-source="${source}">${conditionformat_Text.cancel}</button>`,
"style": "z-index:100003"
}));
let $t = $("#luckysheet-singleRange-dialog")
@ -1370,12 +1375,15 @@ const conditionformat = {
$("#luckysheet-modal-dialog-mask").hide();
$("#luckysheet-multiRange-dialog").remove();
const conditionformat_Text = locale().conditionformat;
$("body").append(replaceHtml(modelHTML, {
"id": "luckysheet-multiRange-dialog",
"addclass": "luckysheet-multiRange-dialog",
"title": "选择应用范围",
"content": '<input readonly="readonly" placeholder="请选择应用范围" value="'+value+'"/>',
"botton": '<button id="luckysheet-multiRange-dialog-confirm" class="btn btn-primary" data-item="'+dataItem+'">确定</button><button id="luckysheet-multiRange-dialog-close" class="btn btn-default">取消</button>',
"title": conditionformat_Text.selectRange,
"content": `<input readonly="readonly" placeholder="${conditionformat_Text.pleaseSelectRange}" value="${value}"/>`,
"botton": `<button id="luckysheet-multiRange-dialog-confirm" class="btn btn-primary" data-item="${dataItem}">${conditionformat_Text.confirm}</button>
<button id="luckysheet-multiRange-dialog-close" class="btn btn-default">${conditionformat_Text.cancel}</button>`,
"style": "z-index:100003"
}));
let $t = $("#luckysheet-multiRange-dialog")
@ -1431,6 +1439,8 @@ const conditionformat = {
return range;
},
colorSelectInit: function(){
const conditionformat_Text = locale().conditionformat;
$(".luckysheet-conditionformat-config-color").spectrum({
showPalette: true,
showPaletteOnly:true,
@ -1445,12 +1455,12 @@ const conditionformat = {
maxPaletteSize: 8,
maxSelectionSize: 8,
// color: currenColor,
cancelText: "取消",
chooseText: "确定颜色",
cancelText: conditionformat_Text.cancel,
chooseText: conditionformat_Text.confirmColor,
togglePaletteMoreText: "自定义",
togglePaletteLessText: "收起",
togglePaletteOnly: true,
clearText: "清除颜色选择",
clearText: conditionformat_Text.clearColorSelect,
noColorSelectedText: "没有颜色被选择",
localStorageKey: "spectrum.textcolor" + server.gridKey,
palette: [["#000","#444","#666","#999","#ccc","#eee","#f3f3f3","#fff"],
@ -1474,12 +1484,15 @@ const conditionformat = {
$("#luckysheet-modal-dialog-mask").show();
$("#luckysheet-conditionformat-dialog").remove();
const conditionformat_Text = locale().conditionformat;
$("body").append(replaceHtml(modelHTML, {
"id": "luckysheet-conditionformat-dialog",
"addclass": "luckysheet-conditionformat-dialog",
"title": title,
"content": content,
"botton": '<button id="luckysheet-conditionformat-dialog-confirm" class="btn btn-primary">确定</button><button class="btn btn-default luckysheet-model-close-btn">取消</button>',
"botton": `<button id="luckysheet-conditionformat-dialog-confirm" class="btn btn-primary">${conditionformat_Text.confirm}</button>
<button class="btn btn-default luckysheet-model-close-btn">${conditionformat_Text.cancel}</button>`,
"style": "z-index:100003"
}));
let $t = $("#luckysheet-conditionformat-dialog")
@ -1498,7 +1511,7 @@ const conditionformat = {
_this.init();
_this.colorSelectInit();
if(title == "条件格式——发生日期"){
if(title == locale().conditionformat.conditionformat_occurrenceDate){
_this.daterangeInit("luckysheet-conditionformat-dialog");
}
},
@ -1506,68 +1519,70 @@ const conditionformat = {
$("#luckysheet-modal-dialog-mask").show();
$("#luckysheet-CFicons-dialog").remove();
let content = '<div class="box">'+
'<div style="margin-bottom: 10px;">请点击选择一组图标:</div>'+
'<div class="title">方向</div>'+
'<div class="list">'+
'<div class="left">'+
'<div class="item" data-len="3" data-leftMin="0" data-top="0" title="三向箭头(彩色)"><div style="background-position:0 0;"></div></div>'+
'<div class="item" data-len="3" data-leftMin="0" data-top="1" title="3个三角形"><div style="background-position:0 -20px;"></div></div>'+
'<div class="item" data-len="4" data-leftMin="0" data-top="2" title="四向箭头(彩色)"><div style="background-position:0 -40px;"></div></div>'+
'<div class="item" data-len="5" data-leftMin="0" data-top="3" title="五向箭头(彩色)"><div style="background-position:0 -60px;"></div></div>'+
'</div>'+
'<div class="right">'+
'<div class="item" data-len="3" data-leftMin="5" data-top="0" title="三向箭头(灰色)"><div style="background-position:-131px 0;"></div></div>'+
'<div class="item" data-len="4" data-leftMin="5" data-top="1" title="四向箭头(灰色)"><div style="background-position:-131px -20px;"></div></div>'+
'<div class="item" data-len="5" data-leftMin="5" data-top="2" title="五向箭头(灰色)"><div style="background-position:-131px -40px;"></div></div>'+
'</div>'+
'<div style="clear:both;"></div>'+
'</div>'+
'<div class="title">形状</div>'+
'<div class="list">'+
'<div class="left">'+
'<div class="item" data-len="3" data-leftMin="0" data-top="4" title="三色交通灯(无边框)"><div style="background-position:0 -80px;"></div></div>'+
'<div class="item" data-len="3" data-leftMin="0" data-top="5" title="三标志"><div style="background-position:0 -100px;"></div></div>'+
'<div class="item" data-len="4" data-leftMin="0" data-top="6" title="绿-红-黑渐变"><div style="background-position:0 -120px;"></div></div>'+
'</div>'+
'<div class="right">'+
'<div class="item" data-len="3" data-leftMin="5" data-top="4" title="三色交通灯(有边框)"><div style="background-position:-131px -80px;"></div></div>'+
'<div class="item" data-len="4" data-leftMin="5" data-top="5" title="四色交通灯"><div style="background-position:-131px -100px;"></div></div>'+
'</div>'+
'<div style="clear:both;"></div>'+
'</div>'+
'<div class="title">标记</div>'+
'<div class="list">'+
'<div class="left">'+
'<div class="item" data-len="3" data-leftMin="0" data-top="7" title="三个符号(有圆圈)"><div style="background-position:0 -140px;"></div></div>'+
'<div class="item" data-len="3" data-leftMin="0" data-top="8" title="三色旗"><div style="background-position:0 -160px;"></div></div>'+
'</div>'+
'<div class="right">'+
'<div class="item" data-len="3" data-leftMin="5" data-top="7" title="三个符号(无圆圈)"><div style="background-position:-131px -140px;"></div></div>'+
'</div>'+
'<div style="clear:both;"></div>'+
'</div>'+
'<div class="title">等级</div>'+
'<div class="list">'+
'<div class="left">'+
'<div class="item" data-len="3" data-leftMin="0" data-top="9" title="3个星形"><div style="background-position:0 -180px;"></div></div>'+
'<div class="item" data-len="5" data-leftMin="0" data-top="10" title="五象限图"><div style="background-position:0 -200px;"></div></div>'+
'<div class="item" data-len="5" data-leftMin="0" data-top="11" title="5个框"><div style="background-position:0 -220px;"></div></div>'+
'</div>'+
'<div class="right">'+
'<div class="item" data-len="4" data-leftMin="5" data-top="9" title="四等级"><div style="background-position:-131px -180px;"></div></div>'+
'<div class="item" data-len="5" data-leftMin="5" data-top="10" title="五等级"><div style="background-position:-131px -200px;"></div></div>'+
'</div>'+
'<div style="clear:both;"></div>'+
'</div>'+
'</div>';
const conditionformat_Text = locale().conditionformat;
let content = `<div class="box">
<div style="margin-bottom: 10px;">${conditionformat_Text.pleaseSelectIcon}</div>
<div class="title">${conditionformat_Text.direction}</div>
<div class="list">
<div class="left">
<div class="item" data-len="3" data-leftMin="0" data-top="0" title="${conditionformat_Text.threeWayArrow}(${conditionformat_Text.multicolor})"><div style="background-position:0 0;"></div></div>
<div class="item" data-len="3" data-leftMin="0" data-top="1" title="${conditionformat_Text.threeTriangles}"><div style="background-position:0 -20px;"></div></div>
<div class="item" data-len="4" data-leftMin="0" data-top="2" title="${conditionformat_Text.fourWayArrow}(${conditionformat_Text.multicolor})"><div style="background-position:0 -40px;"></div></div>
<div class="item" data-len="5" data-leftMin="0" data-top="3" title="${conditionformat_Text.fiveWayArrow}(${conditionformat_Text.multicolor})"><div style="background-position:0 -60px;"></div></div>
</div>
<div class="right">
<div class="item" data-len="3" data-leftMin="5" data-top="0" title="${conditionformat_Text.threeWayArrow}(${conditionformat_Text.grayColor})"><div style="background-position:-131px 0;"></div></div>
<div class="item" data-len="4" data-leftMin="5" data-top="1" title="${conditionformat_Text.fourWayArrow}(${conditionformat_Text.grayColor})"><div style="background-position:-131px -20px;"></div></div>
<div class="item" data-len="5" data-leftMin="5" data-top="2" title="${conditionformat_Text.fiveWayArrow}(${conditionformat_Text.grayColor})"><div style="background-position:-131px -40px;"></div></div>
</div>
<div style="clear:both;"></div>
</div>
<div class="title">${conditionformat_Text.shape}</div>
<div class="list">
<div class="left">
<div class="item" data-len="3" data-leftMin="0" data-top="4" title="${conditionformat_Text.threeColorTrafficLight}(${conditionformat_Text.rimless})"><div style="background-position:0 -80px;"></div></div>
<div class="item" data-len="3" data-leftMin="0" data-top="5" title="${conditionformat_Text.threeSigns}"><div style="background-position:0 -100px;"></div></div>
<div class="item" data-len="4" data-leftMin="0" data-top="6" title="${conditionformat_Text.greenRedBlackGradient}"><div style="background-position:0 -120px;"></div></div>
</div>
<div class="right">
<div class="item" data-len="3" data-leftMin="5" data-top="4" title="${conditionformat_Text.threeColorTrafficLight}(${conditionformat_Text.bordered})"><div style="background-position:-131px -80px;"></div></div>
<div class="item" data-len="4" data-leftMin="5" data-top="5" title="${conditionformat_Text.fourColorTrafficLight}"><div style="background-position:-131px -100px;"></div></div>
</div>
<div style="clear:both;"></div>
</div>
<div class="title">${conditionformat_Text.mark}</div>
<div class="list">
<div class="left">
<div class="item" data-len="3" data-leftMin="0" data-top="7" title="${conditionformat_Text.threeSymbols}(${conditionformat_Text.circled})"><div style="background-position:0 -140px;"></div></div>
<div class="item" data-len="3" data-leftMin="0" data-top="8" title="${conditionformat_Text.tricolorFlag}"><div style="background-position:0 -160px;"></div></div>
</div>
<div class="right">
<div class="item" data-len="3" data-leftMin="5" data-top="7" title="${conditionformat_Text.threeSymbols}(${conditionformat_Text.noCircle})"><div style="background-position:-131px -140px;"></div></div>
</div>
<div style="clear:both;"></div>
</div>
<div class="title">${conditionformat_Text.grade}</div>
<div class="list">
<div class="left">
<div class="item" data-len="3" data-leftMin="0" data-top="9" title="${conditionformat_Text.threeStars}"><div style="background-position:0 -180px;"></div></div>
<div class="item" data-len="5" data-leftMin="0" data-top="10" title="${conditionformat_Text.fiveQuadrantDiagram}"><div style="background-position:0 -200px;"></div></div>
<div class="item" data-len="5" data-leftMin="0" data-top="11" title="${conditionformat_Text.fiveBoxes}"><div style="background-position:0 -220px;"></div></div>
</div>
<div class="right">
<div class="item" data-len="4" data-leftMin="5" data-top="9" title="${conditionformat_Text.grade4}"><div style="background-position:-131px -180px;"></div></div>
<div class="item" data-len="5" data-leftMin="5" data-top="10" title="${conditionformat_Text.grade5}"><div style="background-position:-131px -200px;"></div></div>
</div>
<div style="clear:both;"></div>
</div>
</div>`;
$("body").append(replaceHtml(modelHTML, {
"id": "luckysheet-CFicons-dialog",
"addclass": "luckysheet-CFicons-dialog",
"title": "图标集",
"title": conditionformat_Text.icons,
"content": content,
"botton": '<button class="btn btn-default luckysheet-model-close-btn">关闭</button>',
"botton": `<button class="btn btn-default luckysheet-model-close-btn">${conditionformat_Text.close}</button>`,
"style": "z-index:100003"
}));
let $t = $("#luckysheet-CFicons-dialog")
@ -1627,7 +1642,7 @@ const conditionformat = {
$("body").append(replaceHtml(modelHTML, {
"id": "luckysheet-administerRule-dialog",
"addclass": "luckysheet-administerRule-dialog",
"title": conditionformat_Text.manageRules,
"title": conditionformat_Text.conditionformatManageRules,
"content": content,
"botton": `<button id="luckysheet-administerRule-dialog-confirm" class="btn btn-primary">${conditionformat_Text.confirm}</button>
<button id="luckysheet-administerRule-dialog-close" class="btn btn-default">${conditionformat_Text.close}</button>`,
@ -1912,6 +1927,8 @@ const conditionformat = {
editorConditionRuleDialog: function(){
let _this = this;
const conditionformat_Text = locale().conditionformat;
let rule = _this.editorRule.data;
let ruleType = rule["type"], ruleFormat = rule["format"];
@ -1965,9 +1982,9 @@ const conditionformat = {
$("#luckysheet-editorConditionRule-dialog").remove();
let content = '<div>' +
'<div class="boxTitle">选择规则类型:</div>' +
'<div class="boxTitle">'+ conditionformat_Text.chooseRuleType +':</div>' +
_this.ruleTypeHtml() +
'<div class="boxTitle">编辑规则说明:</div>' +
'<div class="boxTitle">'+ conditionformat_Text.editRuleDescription +':</div>' +
'<div class="ruleExplainBox">' +
ruleExplainHtml +
'</div>' +
@ -1976,9 +1993,10 @@ const conditionformat = {
$("body").append(replaceHtml(modelHTML, {
"id": "luckysheet-editorConditionRule-dialog",
"addclass": "luckysheet-newEditorRule-dialog",
"title": "编辑格式规则",
"title": conditionformat_Text.editFormatRule,
"content": content,
"botton": '<button id="luckysheet-editorConditionRule-dialog-confirm" class="btn btn-primary">确定</button><button id="luckysheet-editorConditionRule-dialog-close" class="btn btn-default">取消</button>',
"botton": `<button id="luckysheet-editorConditionRule-dialog-confirm" class="btn btn-primary">${conditionformat_Text.confirm}</button>
<button id="luckysheet-editorConditionRule-dialog-close" class="btn btn-default">${conditionformat_Text.cancel}</button>`,
"style": "z-index:100003"
}));
let $t = $("#luckysheet-editorConditionRule-dialog")
@ -2129,7 +2147,7 @@ const conditionformat = {
"addclass": "",
"title": title,
"content": content,
"botton": '<button id="luckysheet-conditionformat-info-dialog-close" class="btn btn-default">&nbsp;&nbsp;关闭&nbsp;&nbsp;</button>',
"botton": `<button id="luckysheet-conditionformat-info-dialog-close" class="btn btn-default">${locale().conditionformat.close}</button>`,
"style": "z-index:100003"
}));
let $t = $("#luckysheet-conditionformat-info-dialog")
@ -2213,138 +2231,159 @@ const conditionformat = {
<li><div data-len="5" data-leftmin="5" data-top="2" title="${conditionformat_Text.fiveWayArrow}(${conditionformat_Text.grayColor})" style="background-position: -131px -40px;"></div></li>
<li><div data-len="3" data-leftmin="0" data-top="4" title="${conditionformat_Text.threeColorTrafficLight}(${conditionformat_Text.rimless})" style="background-position: 0 -80px;"></div></li>
<li><div data-len="3" data-leftmin="5" data-top="4" title="${conditionformat_Text.threeColorTrafficLight}(${conditionformat_Text.bordered})" style="background-position: -131px -80px;"></div></li>
<li><div data-len="3" data-leftmin="0" data-top="5" title="三标志" style="background-position: 0 -100px;"></div></li>
<li><div data-len="3" data-leftmin="0" data-top="5" title="${conditionformat_Text.threeSigns}" style="background-position: 0 -100px;"></div></li>
<li><div data-len="4" data-leftmin="5" data-top="5" title="${conditionformat_Text.fourColorTrafficLight}" style="background-position: -131px -100px;"></div></li>
<li><div data-len="4" data-leftmin="0" data-top="6" title="绿-红-黑渐变" style="background-position: 0 -120px;"></div></li>
<li><div data-len="3" data-leftmin="0" data-top="7" title="三个符号(有圆圈)" style="background-position: 0 -140px;"></div></li>
<li><div data-len="3" data-leftmin="5" data-top="7" title="三个符号(无圆圈)" style="background-position: -131px -140px;"></div></li>
<li><div data-len="3" data-leftmin="0" data-top="8" title="三色旗" style="background-position: 0 -160px;"></div></li>
<li><div data-len="3" data-leftmin="0" data-top="9" title="3个星形" style="background-position: 0 -180px;"></div></li>
<li><div data-len="5" data-leftmin="0" data-top="10" title="五象限图" style="background-position: 0 -200px;"></div></li>
<li><div data-len="5" data-leftmin="0" data-top="11" title="5个框" style="background-position: 0 -220px;"></div></li>
<li><div data-len="4" data-leftmin="5" data-top="9" title="四等级" style="background-position: -131px -180px;"></div></li>
<li><div data-len="5" data-leftmin="5" data-top="10" title="五等级" style="background-position: -131px -200px;"></div></li>
<li><div data-len="4" data-leftmin="0" data-top="6" title="${conditionformat_Text.greenRedBlackGradient}" style="background-position: 0 -120px;"></div></li>
<li><div data-len="3" data-leftmin="0" data-top="7" title="${conditionformat_Text.threeSymbols}(${conditionformat_Text.circled})" style="background-position: 0 -140px;"></div></li>
<li><div data-len="3" data-leftmin="5" data-top="7" title="${conditionformat_Text.threeSymbols}(${conditionformat_Text.noCircle})" style="background-position: -131px -140px;"></div></li>
<li><div data-len="3" data-leftmin="0" data-top="8" title="${conditionformat_Text.tricolorFlag}" style="background-position: 0 -160px;"></div></li>
<li><div data-len="3" data-leftmin="0" data-top="9" title="${conditionformat_Text.threeStars}" style="background-position: 0 -180px;"></div></li>
<li><div data-len="5" data-leftmin="0" data-top="10" title="${conditionformat_Text.fiveQuadrantDiagram}" style="background-position: 0 -200px;"></div></li>
<li><div data-len="5" data-leftmin="0" data-top="11" title="${conditionformat_Text.fiveBoxes}" style="background-position: 0 -220px;"></div></li>
<li><div data-len="4" data-leftmin="5" data-top="9" title="${conditionformat_Text.grade4}" style="background-position: -131px -180px;"></div></li>
<li><div data-len="5" data-leftmin="5" data-top="10" title="${conditionformat_Text.grade5}" style="background-position: -131px -200px;"></div></li>
</ul>
</div>
</div>`;
break;
case 1: //只为包含以下内容的单元格设置格式
ruleExplainHtml = '<div class="title">只为满足以下条件的单元格:</div>' +
'<div style="height: 30px;margin-bottom: 10px;">' +
'<select id="type1">' +
'<option value="number">单元格值</option>' +
'<option value="text">特定文本</option>' +
'<option value="date">发生日期</option>' +
'</select>'+
'<div>' +
'<div class="type1Box numberBox">' +
'<select id="type2">' +
'<option value="greaterThan">大于</option>' +
'<option value="lessThan">小于</option>' +
'<option value="betweenness">介于</option>' +
'<option value="equal">等于</option>' +
'</select>' +
'<div class="inpbox range" id="conditionVal">' +
'<input class="formulaInputFocus"/><i class="fa fa-table" aria-hidden="true" title="点击选择单元格"></i>' +
'</div>' +
'<span class="txt" style="display: none;">到</span>' +
'<div class="inpbox range" id="conditionVal2" style="display: none;">' +
'<input class="formulaInputFocus"/><i class="fa fa-table" aria-hidden="true" title="点击选择数据范围"></i>' +
'</div>' +
'</div>' +
'<div class="type1Box textBox" style="display: none;">' +
'<select id="type2">' +
'<option value="">包含</option>' +
'</select>' +
'<div class="inpbox range" id="conditionVal">' +
'<input class="formulaInputFocus"/><i class="fa fa-table" aria-hidden="true" title="点击选择单元格"></i>' +
'</div>' +
'</div>' +
'<div class="type1Box dateBox" style="display: none;">' +
'<div style="width: 162px;" class="inpbox">' +
'<input style="width: 150px;" id="daterange-btn" readonly="readonly" placeholder="请选择日期"/>' +
'</div>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="title">设置格式:</div>' + textCellColorHtml;
ruleExplainHtml = `<div class="title">${conditionformat_Text.ruleTypeItem2_title}:</div>
<div style="height: 30px;margin-bottom: 10px;">
<select id="type1">
<option value="number">${conditionformat_Text.cellValue}</option>
<option value="text">${conditionformat_Text.specificText}</option>
<option value="date">${conditionformat_Text.occurrence}</option>
</select>
<div>
<div class="type1Box numberBox">
<select id="type2">
<option value="greaterThan">${conditionformat_Text.greaterThan}</option>
<option value="lessThan">${conditionformat_Text.lessThan}</option>
<option value="betweenness">${conditionformat_Text.between}</option>
<option value="equal">${conditionformat_Text.equal}</option>
</select>
<div class="inpbox range" id="conditionVal">
<input class="formulaInputFocus"/>
<i class="fa fa-table" aria-hidden="true" title="${conditionformat_Text.selectCell}"></i>
</div>
<span class="txt" style="display: none;">${conditionformat_Text.in}</span>
<div class="inpbox range" id="conditionVal2" style="display: none;">
<input class="formulaInputFocus"/>
<i class="fa fa-table" aria-hidden="true" title="${conditionformat_Text.selectDataRange}"></i>
</div>
</div>
<div class="type1Box textBox" style="display: none;">
<select id="type2">
<option value="">${conditionformat_Text.contain}</option>
</select>
<div class="inpbox range" id="conditionVal">
<input class="formulaInputFocus"/>
<i class="fa fa-table" aria-hidden="true" title="${conditionformat_Text.selectCell}"></i>
</div>
</div>
<div class="type1Box dateBox" style="display: none;">
<div style="width: 162px;" class="inpbox">
<input style="width: 150px;" id="daterange-btn" readonly="readonly" placeholder="${conditionformat_Text.pleaseSelectADate}"/>
</div>
</div>
</div>
</div>
<div class="title">设置格式</div>${textCellColorHtml}`;
break;
case 2: //仅对排名靠前或靠后的数值设置格式
ruleExplainHtml = '<div class="title">为以下排名内的值:</div>'+
'<div style="height: 30px;margin-bottom: 10px;">'+
'<select id="type1">'+
'<option value="top">前</option>'+
'<option value="last">后</option>'+
'</select>'+
'<div class="inpbox" id="conditionVal">'+
'<input class="formulaInputFocus" type="number" value="10"/>'+
'</div>'+
'<input id="isPercent" type="checkbox"/>'+
'<label for="isPercent" class="txt">所选范围的百分比</label>'+
'</div>'+
'<div class="title">设置格式:</div>' + textCellColorHtml;
ruleExplainHtml = `<div class="title">${conditionformat_Text.ruleTypeItem3_title}:</div>
<div style="height: 30px;margin-bottom: 10px;">
<select id="type1">
<option value="top">${conditionformat_Text.top}</option>
<option value="last">${conditionformat_Text.last}</option>
</select>
<div class="inpbox" id="conditionVal">
<input class="formulaInputFocus" type="number" value="10"/>
</div>
<input id="isPercent" type="checkbox"/>
<label for="isPercent" class="txt">${conditionformat_Text.selectRange_percent}</label>
</div>
<div class="title">${conditionformat_Text.setFormat}</div>${textCellColorHtml}`;
break;
case 3: //仅对高于或低于平均值的数值设置格式
ruleExplainHtml = '<div class="title">为满足以下条件的值:</div>'+
'<div style="height: 30px;margin-bottom: 10px;">'+
'<select id="type1">'+
'<option value="AboveAverage">高于</option>'+
'<option value="SubAverage">低于</option>'+
'</select>'+
'<span class="txt">选定范围的平均值</span>'+
'</div>'+
'<div class="title">设置格式:</div>' + textCellColorHtml;
ruleExplainHtml = `<div class="title">${conditionformat_Text.ruleTypeItem4_title}:</div>
<div style="height: 30px;margin-bottom: 10px;">
<select id="type1">
<option value="AboveAverage">${conditionformat_Text.above}</option>
<option value="SubAverage">${conditionformat_Text.below}</option>
</select>
<span class="txt">${conditionformat_Text.selectRange_average}</span>
</div>
<div class="title">${conditionformat_Text.setFormat}</div>${textCellColorHtml}`;
break;
case 4: //仅对唯一值或重复值设置格式
ruleExplainHtml = '<div class="title">全部:</div>'+
'<div style="height: 30px;margin-bottom: 10px;">'+
'<select id="type1">'+
'<option value="0">重复</option>'+
'<option value="1">唯一</option>'+
'</select>'+
'<span class="txt">选定范围中的数值</span>'+
'</div>'+
'<div class="title">设置格式:</div>' + textCellColorHtml;
ruleExplainHtml = `<div class="title">${conditionformat_Text.all}:</div>
<div style="height: 30px;margin-bottom: 10px;">
<select id="type1">
<option value="0">${conditionformat_Text.duplicateValue}</option>
<option value="1">${conditionformat_Text.uniqueValue}</option>
</select>
<span class="txt">${conditionformat_Text.selectRange_value}</span>
</div>
<div class="title">${conditionformat_Text.setFormat}</div>${textCellColorHtml}`;
break;
}
return ruleExplainHtml;
},
daterangeInit: function(id){
const conditionformat_Text = locale().conditionformat;
//日期选择插件
$('.ranges_1 ul').remove();
$('#' + id).find("#daterange-btn").daterangepicker({
ranges:
{
// '全部': [moment(), moment().subtract(-1, 'days')],
'昨天': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'今天': [moment(), moment()],
// '明天': [moment().subtract(-1, 'days'), moment().subtract(-1, 'days')],
'上周': [moment(moment().subtract(1, 'week')).subtract(new Date().getDay() - 1, 'days'), moment().subtract(new Date().getDay(), 'days')],
'本周': [moment().subtract(new Date().getDay() - 1, 'days'), moment().add(7 - new Date().getDay(), 'days')],
'上月': [moment(moment().format('YYYY-MM')).subtract(1, 'month'), moment(moment().format('YYYY-MM')).subtract(1, 'day')],
'本月': [moment().format('YYYY-MM'), moment(moment(moment().format('YYYY-MM')).add(1, 'month')).subtract(1, 'day')],
'去年': [moment(moment(moment().format('YYYY'))).subtract(1, 'years').format('YYYY'), moment(moment().format('YYYY')).subtract(1, 'day')],
'本年': [moment().format('YYYY'), moment(moment(moment().add(1, 'years')).format('YYYY')).subtract(1, 'day')],
'最近7天': [moment().subtract(6, 'days'), moment()],
'最近30天': [moment().subtract(29, 'days'), moment()]
// '未来七天': [moment(),moment().subtract(-6, 'days')],
// '未来30天': [moment(),moment().subtract(-29, 'days')],
// '未来60天': [moment(),moment().subtract(-59, 'days'), ]
// [conditionformat_Text.all]: [moment(), moment().subtract(-1, 'days')],
[conditionformat_Text.yesterday]: [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
[conditionformat_Text.today]: [moment(), moment()],
// [conditionformat_Text.tomorrow]: [moment().subtract(-1, 'days'), moment().subtract(-1, 'days')],
[conditionformat_Text.lastWeek]: [moment(moment().subtract(1, 'week')).subtract(new Date().getDay() - 1, 'days'), moment().subtract(new Date().getDay(), 'days')],
[conditionformat_Text.thisWeek]: [moment().subtract(new Date().getDay() - 1, 'days'), moment().add(7 - new Date().getDay(), 'days')],
[conditionformat_Text.lastMonth]: [moment(moment().format('YYYY-MM')).subtract(1, 'month'), moment(moment().format('YYYY-MM')).subtract(1, 'day')],
[conditionformat_Text.thisMonth]: [moment().format('YYYY-MM'), moment(moment(moment().format('YYYY-MM')).add(1, 'month')).subtract(1, 'day')],
[conditionformat_Text.lastYear]: [moment(moment(moment().format('YYYY'))).subtract(1, 'years').format('YYYY'), moment(moment().format('YYYY')).subtract(1, 'day')],
[conditionformat_Text.thisYear]: [moment().format('YYYY'), moment(moment(moment().add(1, 'years')).format('YYYY')).subtract(1, 'day')],
[conditionformat_Text.last7days]: [moment().subtract(6, 'days'), moment()],
[conditionformat_Text.last30days]: [moment().subtract(29, 'days'), moment()]
// [conditionformat_Text.next7days]: [moment(),moment().subtract(-6, 'days')],
// [conditionformat_Text.next30days]: [moment(),moment().subtract(-29, 'days')],
// [conditionformat_Text.next60days]: [moment(),moment().subtract(-59, 'days'), ]
},
startDate: moment(),
endDate: moment()
},
function(start, end,label) {
//label:通过它来知道用户选择的是什么,传给后台进行相应的展示
if(label == '全部'){
let format1 = [
conditionformat_Text.yesterday,
conditionformat_Text.today
];
let format2 = [
conditionformat_Text.lastWeek,
conditionformat_Text.thisWeek,
conditionformat_Text.lastMonth,
conditionformat_Text.thisMonth,
conditionformat_Text.lastYear,
conditionformat_Text.thisYear,
conditionformat_Text.last7days,
conditionformat_Text.last30days
]
if(label == conditionformat_Text.all){
$('#daterange-btn').val('');
}
else if(label == '昨天' || label == '今天'){
else if(format1.indexOf(label) > -1){
$('#daterange-btn').val(start.format('YYYY/MM/DD'));
}
else if(label == '上周' || label == '本周' || label == '上月' || label == '本月' || label == '去年' || label == '本年' || label == '最近7天' || label == '最近30天'){
$('#daterange-btn').val(start.format('YYYY/MM/DD')+'-'+end.format('YYYY/MM/DD'));
else if(format2.indexOf(label) > -1){
$('#daterange-btn').val(start.format('YYYY/MM/DD') + '-' + end.format('YYYY/MM/DD'));
}
}
);

502
src/controllers/menuButton.js

@ -2108,131 +2108,132 @@ const menuButton = {
$("#luckysheet-icon-conditionformat").click(function(){
let menuButtonId = $(this).attr("id") + "-menuButton";
let $menuButton = $("#" + menuButtonId);
const conditionformat_text = locale().conditionformat;
if($menuButton.length == 0){
let itemdata = [
{"text": "突出显示单元格规则", "value": "highlightCellRule", "example": "more"},
{"text": "项目选取规则", "value": "projectSelectRule", "example": "more"},
{"text": "数据条", "value": "dataBar", "example": "more"},
{"text": "色阶", "value": "colorGradation", "example": "more"},
{"text": "图标集", "value": "icons", "example": ""},
{"text": "", "value": "split", "example": ""},
{"text": "新建规则", "value": "newRule", "example": ""},
{"text": "清除规则", "value": "deleteRule", "example": "more"},
{"text": "管理规则", "value": "administerRule", "example": ""}
{ "text": conditionformat_text.highlightCellRules, "value": "highlightCellRule", "example": "more" },
{ "text": conditionformat_text.itemSelectionRules, "value": "projectSelectRule", "example": "more" },
{ "text": conditionformat_text.dataBar, "value": "dataBar", "example": "more" },
{ "text": conditionformat_text.colorGradation, "value": "colorGradation", "example": "more" },
{ "text": conditionformat_text.icons, "value": "icons", "example": "" },
{ "text": "", "value": "split", "example": "" },
{ "text": conditionformat_text.newRule, "value": "newRule", "example": "" },
{ "text": conditionformat_text.deleteRule, "value": "deleteRule", "example": "more" },
{ "text": conditionformat_text.manageRules, "value": "administerRule", "example": "" }
];
let itemset = _this.createButtonMenu(itemdata);
let menu = replaceHtml(_this.menu, {"id": "conditionformat", "item": itemset, "subclass": "", "sub": ""});
//突出显示单元格规则子菜单
let subitemdata = [
{"text": "大于", "value": "greaterThan", "example": ">"},
{"text": "小于", "value": "lessThan", "example": "<"},
{"text": "介于", "value": "betweenness", "example": "[]"},
{"text": "等于", "value": "equal", "example": "="},
{"text": "文本包含", "value": "textContains", "example": "()"},
{"text": "发生日期", "value": "occurrenceDate", "example": "昨天"},
{"text": "重复值", "value": "duplicateValue", "example": "##"}
{ "text": conditionformat_text.greaterThan, "value": "greaterThan", "example": ">" },
{ "text": conditionformat_text.lessThan, "value": "lessThan", "example": "<" },
{ "text": conditionformat_text.between, "value": "betweenness", "example": "[]" },
{ "text": conditionformat_text.equal, "value": "equal", "example": "=" },
{ "text": conditionformat_text.textContains, "value": "textContains", "example": "()" },
{ "text": conditionformat_text.occurrence, "value": "occurrenceDate", "example": conditionformat_text.yesterday },
{ "text": conditionformat_text.duplicateValue, "value": "duplicateValue", "example": "##" }
];
let subitemset = _this.createButtonMenu(subitemdata);
let submenu = replaceHtml(_this.menu, {"id": "highlightCellRule", "item": subitemset, "subclass": "luckysheet-menuButton-sub"});
//项目选取规则子菜单
let subitemdata2 = [
{"text": "前 10 项", "value": "top10", "example": "前10项"},
{"text": "前 10%", "value": "top10%", "example": "前10%"},
{"text": "最后 10 项", "value": "last10", "example": "后10项"},
{"text": "最后 10%", "value": "last10%", "example": "后10%"},
{"text": "高于平均值", "value": "AboveAverage", "example": "高于均值"},
{"text": "低于平均值", "value": "SubAverage", "example": "低于均值"}
{ "text": conditionformat_text.top10, "value": "top10", "example": conditionformat_text.top10 },
{ "text": conditionformat_text.top10_percent, "value": "top10%", "example": conditionformat_text.top10_percent },
{ "text": conditionformat_text.last10, "value": "last10", "example": conditionformat_text.last10 },
{ "text": conditionformat_text.last10_percent, "value": "last10%", "example": conditionformat_text.last10_percent },
{ "text": conditionformat_text.aboveAverage, "value": "AboveAverage", "example": conditionformat_text.aboveAverage },
{ "text": conditionformat_text.belowAverage, "value": "SubAverage", "example": conditionformat_text.belowAverage }
];
let subitemset2 = _this.createButtonMenu(subitemdata2);
let submenu2 = replaceHtml(_this.menu, {"id": "projectSelectRule", "item": subitemset2, "subclass": "luckysheet-menuButton-sub"});
//数据条子菜单
let submenu3 = '<div class="luckysheet-cols-menu luckysheet-rightgclick-menu luckysheet-menuButton luckysheet-menuButton-sub luckysheet-mousedown-cancel" id="luckysheet-icon-dataBar-menuButton" style="width: 126px;padding: 5px;top: 118.5px;left: 1321.48px;display: none;">' +
'<div itemvalue="0" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: 0 0;" title="蓝-白渐变数据条"></div>' +
'</div>' +
'<div itemvalue="1" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -38px 0;" title="绿-白渐变数据条"></div>' +
'</div>' +
'<div itemvalue="2" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -76px 0;" title="红-白渐变数据条"></div>' +
'</div>' +
'<div itemvalue="3" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: 0 -36px;" title="橙-白渐变数据条"></div>' +
'</div>' +
'<div itemvalue="4" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -38px -36px;" title="浅蓝-白渐变数据条"></div>' +
'</div>' +
'<div itemvalue="5" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -76px -36px;" title="紫-白渐变数据条"></div>' +
'</div>' +
'<div itemvalue="6" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: 0 -72px;" title="蓝色数据条"></div>' +
'</div>' +
'<div itemvalue="7" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -38px -72px;" title="绿色数据条"></div>' +
'</div>' +
'<div itemvalue="8" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -76px -72px;" title="红色数据条"></div>' +
'</div>' +
'<div itemvalue="9" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: 0 -108px;" title="橙色数据条"></div>' +
'</div>' +
'<div itemvalue="10" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -38px -108px;" title="浅蓝色数据条"></div>' +
'</div>' +
'<div itemvalue="11" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -76px -108px;" title="紫色数据条"></div>' +
'</div>' +
'</div>';
let submenu3 = `<div id="luckysheet-icon-dataBar-menuButton" class="luckysheet-cols-menu luckysheet-rightgclick-menu luckysheet-menuButton luckysheet-menuButton-sub luckysheet-mousedown-cancel" style="width: 126px;padding: 5px;top: 118.5px;left: 1321.48px;display: none;">
<div itemvalue="0" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: 0 0;" title="${conditionformat_text.gradientDataBar_1}"></div>
</div>
<div itemvalue="1" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -38px 0;" title="${conditionformat_text.gradientDataBar_2}"></div>
</div>
<div itemvalue="2" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -76px 0;" title="${conditionformat_text.gradientDataBar_3}"></div>
</div>
<div itemvalue="3" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: 0 -36px;" title="${conditionformat_text.gradientDataBar_4}"></div>
</div>
<div itemvalue="4" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -38px -36px;" title="${conditionformat_text.gradientDataBar_5}"></div>
</div>
<div itemvalue="5" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -76px -36px;" title="${conditionformat_text.gradientDataBar_6}"></div>
</div>
<div itemvalue="6" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: 0 -72px;" title="${conditionformat_text.solidColorDataBar_1}"></div>
</div>
<div itemvalue="7" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -38px -72px;" title="${conditionformat_text.solidColorDataBar_2}"></div>
</div>
<div itemvalue="8" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -76px -72px;" title="${conditionformat_text.solidColorDataBar_3}"></div>
</div>
<div itemvalue="9" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: 0 -108px;" title="${conditionformat_text.solidColorDataBar_4}"></div>
</div>
<div itemvalue="10" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -38px -108px;" title="${conditionformat_text.solidColorDataBar_5}"></div>
</div>
<div itemvalue="11" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -76px -108px;" title="${conditionformat_text.solidColorDataBar_6}"></div>
</div>
</div>`;
//色阶
let submenu4 = '<div class="luckysheet-cols-menu luckysheet-rightgclick-menu luckysheet-menuButton luckysheet-menuButton-sub luckysheet-mousedown-cancel" id="luckysheet-icon-colorGradation-menuButton" style="width: 126px;padding: 5px;top: 143.5px;left: 1321.48px;display: none;">' +
'<div itemvalue="0" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: 0 0;" title="绿-黄-红色阶"></div>' +
'</div>' +
'<div itemvalue="1" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -38px 0;" title="红-黄-绿色阶"></div>' +
'</div>' +
'<div itemvalue="2" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -76px 0;" title="绿-白-红色阶"></div>' +
'</div>' +
'<div itemvalue="3" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -114px 0;" title="红-白-绿色阶"></div>' +
'</div>' +
'<div itemvalue="4" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: 0 -36px;" title="蓝-白-红色阶"></div>' +
'</div>' +
'<div itemvalue="5" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -38px -36px;" title="红-白-蓝色阶"></div>' +
'</div>' +
'<div itemvalue="6" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -76px -36px;" title="白-红色阶"></div>' +
'</div>' +
'<div itemvalue="7" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -114px -36px;" title="红-白色阶"></div>' +
'</div>' +
'<div itemvalue="8" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: 0 -72px;" title="绿-白色阶"></div>' +
'</div>' +
'<div itemvalue="9" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -38px -72px;" title="白-绿色阶"></div>' +
'</div>' +
'<div itemvalue="10" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -76px -72px;" title="绿-黄色阶"></div>' +
'</div>' +
'<div itemvalue="11" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">' +
'<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -114px -72px;" title="黄-绿色阶"></div>' +
'</div>' +
'</div>';
let submenu4 = `<div id="luckysheet-icon-colorGradation-menuButton" class="luckysheet-cols-menu luckysheet-rightgclick-menu luckysheet-menuButton luckysheet-menuButton-sub luckysheet-mousedown-cancel" style="width: 126px;padding: 5px;top: 143.5px;left: 1321.48px;display: none;">
<div itemvalue="0" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: 0 0;" title="${conditionformat_text.colorGradation_1}"></div>
</div>
<div itemvalue="1" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -38px 0;" title="${conditionformat_text.colorGradation_2}"></div>
</div>
<div itemvalue="2" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -76px 0;" title="${conditionformat_text.colorGradation_3}"></div>
</div>
<div itemvalue="3" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -114px 0;" title="${conditionformat_text.colorGradation_4}"></div>
</div>
<div itemvalue="4" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: 0 -36px;" title="${conditionformat_text.colorGradation_5}"></div>
</div>
<div itemvalue="5" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -38px -36px;" title="${conditionformat_text.colorGradation_6}"></div>
</div>
<div itemvalue="6" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -76px -36px;" title="${conditionformat_text.colorGradation_7}"></div>
</div>
<div itemvalue="7" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -114px -36px;" title="${conditionformat_text.colorGradation_8}"></div>
</div>
<div itemvalue="8" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: 0 -72px;" title="${conditionformat_text.colorGradation_9}"></div>
</div>
<div itemvalue="9" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -38px -72px;" title="${conditionformat_text.colorGradation_10}"></div>
</div>
<div itemvalue="10" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -76px -72px;" title="${conditionformat_text.colorGradation_11}"></div>
</div>
<div itemvalue="11" class="luckysheet-cols-menuitem luckysheet-mousedown-cancel" style="width: 28px; height: 26px;padding: 5px;float: left;">
<div class="luckysheet-mousedown-cancel bgImgBox" style="background-position: -114px -72px;" title="${conditionformat_text.colorGradation_12}"></div>
</div>
</div>`;
//清除规则子菜单
let subitemdata6 = [
// {"text":"清除所选单元格的规则", "value":"", "example":""},
{"text":"清除整个工作表的规则", "value":"delSheet", "example":""}
{ "text": conditionformat_text.deleteSheetRule, "value": "delSheet", "example": "" }
];
let subitemset6 = _this.createButtonMenu(subitemdata6);
let submenu6 = replaceHtml(_this.menu, {"id": "deleteRule", "item": subitemset6, "subclass":"luckysheet-menuButton-sub"});
@ -2251,10 +2252,10 @@ const menuButton = {
if(itemvalue == "icons"){
if(Store.luckysheet_select_save.length == 0){
if(isEditMode()){
alert("请选择应用范围");
alert(conditionformat_text.pleaseSelectRange);
}
else{
tooltip.info("请选择应用范围", "");
tooltip.info(conditionformat_text.pleaseSelectRange, "");
}
return;
}
@ -2265,10 +2266,10 @@ const menuButton = {
else if(itemvalue == "newRule"){
if(Store.luckysheet_select_save.length == 0){
if(isEditMode()){
alert("请选择应用范围");
alert(conditionformat_text.pleaseSelectRange);
}
else{
tooltip.info("请选择应用范围", "");
tooltip.info(conditionformat_text.pleaseSelectRange, "");
}
return;
}
@ -2329,108 +2330,107 @@ const menuButton = {
if(Store.luckysheet_select_save.length == 0){
if(isEditMode()){
alert("请选择条件格式的应用范围");
alert(conditionformat_text.pleaseSelectRange);
}
else{
tooltip.info("请选择条件格式的应用范围", "");
tooltip.info(conditionformat_text.pleaseSelectRange, "");
}
return;
}
else{
let textCellColorHtml = conditionformat.textCellColorHtml;
let textCellColorHtml = conditionformat.textCellColorHtml();
let title, content;
switch(itemvalue){
case "greaterThan":
title = "条件格式——大于";
content = '<div class="box" data-itemvalue="greaterThan">' +
'<div class="boxTitleOne">为大于以下值的单元格设置格式:</div>' +
'<div class="inpbox range">' +
'<input id="conditionVal" class="formulaInputFocus"/>' +
'<i class="fa fa-table" aria-hidden="true" title="点击选择单元格"></i>' +
'</div>' +
'<div style="margin: 5px 0;">设置为:</div>' +
textCellColorHtml +
'</div>';
title = conditionformat_text.conditionformat_greaterThan;
content = `<div class="box" data-itemvalue="greaterThan">
<div class="boxTitleOne">${conditionformat_text.conditionformat_greaterThan_title}</div>
<div class="inpbox range">
<input id="conditionVal" class="formulaInputFocus"/>
<i class="fa fa-table" aria-hidden="true" title="${conditionformat_text.selectCell}"></i>
</div>
<div style="margin: 5px 0;">${conditionformat_text.setAs}</div>
${textCellColorHtml}
</div>`;
break;
case "lessThan":
title = "条件格式——小于";
content = '<div class="box" data-itemvalue="lessThan">' +
'<div class="boxTitleOne">为小于以下值的单元格设置格式:</div>' +
'<div class="inpbox range">' +
'<input id="conditionVal" class="formulaInputFocus"/>' +
'<i class="fa fa-table" aria-hidden="true" title="点击选择单元格"></i>' +
'</div>' +
'<div style="margin: 5px 0;">设置为:</div>' +
textCellColorHtml +
'</div>';
title = conditionformat_text.conditionformat_lessThan;
content = `<div class="box" data-itemvalue="lessThan">
<div class="boxTitleOne">${conditionformat_text.conditionformat_lessThan_title}</div>
<div class="inpbox range">
<input id="conditionVal" class="formulaInputFocus"/>
<i class="fa fa-table" aria-hidden="true" title="${conditionformat_text.selectCell}"></i>
</div>
<div style="margin: 5px 0;">${conditionformat_text.setAs}</div>
${textCellColorHtml}
</div>`;
break;
case "betweenness":
title = "条件格式——介于";
content = '<div class="box" data-itemvalue="betweenness">' +
'<div class="boxTitleOne">为介于以下值的单元格设置格式:</div>' +
'<div style="height: 30px;line-height: 30px;">' +
'<div class="inpbox2 range">' +
'<input id="conditionVal" class="formulaInputFocus"/>' +
'<i class="fa fa-table" aria-hidden="true" title="点击选择单元格"></i>' +
'</div>' +
'<div style="float: left;height: 30px;line-height: 30px;margin: 0 5px;">到</div>' +
'<div class="inpbox2 range">' +
'<input id="conditionVal2" class="formulaInputFocus"/>' +
'<i class="fa fa-table" aria-hidden="true" title="点击选择单元格"></i>' +
'</div>' +
'</div>' +
'<div style="margin: 5px 0;">设置为:</div>' +
textCellColorHtml +
'</div>';
title = conditionformat_text.conditionformat_betweenness;
content = `<div class="box" data-itemvalue="betweenness">
<div class="boxTitleOne">${conditionformat_text.conditionformat_betweenness_title}</div>
<div style="height: 30px;line-height: 30px;">
<div class="inpbox2 range">
<input id="conditionVal" class="formulaInputFocus"/>
<i class="fa fa-table" aria-hidden="true" title="${conditionformat_text.selectCell}"></i>
</div>
<div style="float: left;height: 30px;line-height: 30px;margin: 0 5px;">${conditionformat_text.to}</div>
<div class="inpbox2 range">
<input id="conditionVal2" class="formulaInputFocus"/>
<i class="fa fa-table" aria-hidden="true" title="${conditionformat_text.selectCell}"></i>
</div>
</div>
<div style="margin: 5px 0;">${conditionformat_text.setAs}</div>
${textCellColorHtml}
</div>`;
break;
case "equal":
title = "条件格式——等于";
content = '<div class="box" data-itemvalue="equal">' +
'<div class="boxTitleOne">为等于以下值的单元格设置格式:</div>' +
'<div class="inpbox range">' +
'<input id="conditionVal" class="formulaInputFocus"/>' +
'<i class="fa fa-table" aria-hidden="true" title="点击选择单元格"></i>' +
'</div>' +
'<div style="margin: 5px 0;">设置为:</div>' +
textCellColorHtml +
'</div>';
title = conditionformat_text.conditionformat_equal;
content = `<div class="box" data-itemvalue="equal">
<div class="boxTitleOne">${conditionformat_text.conditionformat_equal_title}</div>
<div class="inpbox range">
<input id="conditionVal" class="formulaInputFocus"/>
<i class="fa fa-table" aria-hidden="true" title="${conditionformat_text.selectCell}"></i>
</div>
<div style="margin: 5px 0;">${conditionformat_text.setAs}</div>
${textCellColorHtml}
</div>`;
break;
case "textContains":
title = "条件格式——文本包含";
content = '<div class="box" data-itemvalue="textContains">' +
'<div class="boxTitleOne">为包含以下文本的单元格设置格式:</div>' +
'<div class="inpbox range">' +
'<input id="conditionVal" class="formulaInputFocus"/>' +
'<i class="fa fa-table" aria-hidden="true" title="点击选择单元格"></i>' +
'</div>' +
'<div style="margin: 5px 0;">设置为:</div>' +
textCellColorHtml +
'</div>';
title = conditionformat_text.conditionformat_textContains;
content = `<div class="box" data-itemvalue="textContains">
<div class="boxTitleOne">${conditionformat_text.conditionformat_textContains_title}</div>
<div class="inpbox range">
<input id="conditionVal" class="formulaInputFocus"/>
<i class="fa fa-table" aria-hidden="true" title="${conditionformat_text.selectCell}"></i>
</div>
<div style="margin: 5px 0;">${conditionformat_text.setAs}</div>
${textCellColorHtml}
</div>`;
break;
case "occurrenceDate":
title = "条件格式——发生日期";
content = '<div class="box" data-itemvalue="occurrenceDate">' +
'<div class="boxTitleOne">为包含以下日期的单元格设置格式:</div>' +
'<div class="inpbox">' +
'<input id="daterange-btn" class="formulaInputFocus" readonly="readonly" placeholder="请选择日期"/>' +
'</div>' +
'<div style="margin: 5px 0;">设置为:</div>' +
textCellColorHtml +
'</div>';
title = conditionformat_text.conditionformat_occurrenceDate;
content = `<div class="box" data-itemvalue="occurrenceDate">
<div class="boxTitleOne">${conditionformat_text.conditionformat_occurrenceDate_title}</div>
<div class="inpbox">
<input id="daterange-btn" class="formulaInputFocus" readonly="readonly" placeholder="${conditionformat_text.pleaseSelectADate}"/>
</div>
<div style="margin: 5px 0;">${conditionformat_text.setAs}</div>
${textCellColorHtml}
</div>`;
break;
case "duplicateValue":
title = "条件格式——重复值";
content = '<div class="box" data-itemvalue="duplicateValue">' +
'<div class="boxTitleOne">为包含以下类型值的单元格设置格式:</div>' +
'<select id="conditionVal" class="selectbox">' +
'<option value="0">重复</option>' +
'<option value="1">唯一</option>' +
'</select>' +
'<span style="margin-left: 5px;">值</span>' +
'<div style="margin:5px 0;">设置为:</div>' +
textCellColorHtml +
'</div>';
title = conditionformat_text.conditionformat_duplicateValue;
content = `<div class="box" data-itemvalue="duplicateValue">
<div class="boxTitleOne">${conditionformat_text.conditionformat_duplicateValue_title}</div>
<select id="conditionVal" class="selectbox">
<option value="0">${conditionformat_text.duplicateValue}</option>
<option value="1">${conditionformat_text.uniqueValue}</option>
</select>
<div style="margin:5px 0;">${conditionformat_text.setAs}</div>
${textCellColorHtml}
</div>`;
break;
}
@ -2448,93 +2448,93 @@ const menuButton = {
if(Store.luckysheet_select_save.length == 0){
if(isEditMode()){
alert("请选择条件格式的应用范围");
alert(conditionformat_text.pleaseSelectRange);
}
else{
tooltip.info("请选择条件格式的应用范围", "");
tooltip.info(conditionformat_text.pleaseSelectRange, "");
}
return;
}
else{
let textCellColorHtml = conditionformat.textCellColorHtml;
let textCellColorHtml = conditionformat.textCellColorHtml();
let title, content;
switch(itemvalue){
case "top10":
title = "条件格式——前 10 项";
content = '<div class="box" data-itemvalue="top10">' +
'<div class="boxTitleOne">为值最大的那些单元格设置格式:</div>' +
'<div style="height: 30px;line-height: 30px;">' +
'<div style="float: left;height: 30px;line-height: 30px;margin: 0 5px;">前</div>' +
'<div class="inpbox2">' +
'<input id="conditionVal" class="formulaInputFocus" type="number" value="10"/>' +
'</div>' +
'<div style="float: left;height: 30px;line-height: 30px;margin: 0 5px;">项</div>' +
'</div>' +
'<div style="margin: 5px 0;">设置为:</div>' +
textCellColorHtml +
'</div>';
title = conditionformat_text.conditionformat_top10;
content = `<div class="box" data-itemvalue="top10">
<div class="boxTitleOne">${conditionformat_text.conditionformat_top10_title}</div>
<div style="height: 30px;line-height: 30px;">
<div style="float: left;height: 30px;line-height: 30px;margin: 0 5px;">${conditionformat_text.top}</div>
<div class="inpbox2">
<input id="conditionVal" class="formulaInputFocus" type="number" value="10"/>
</div>
<div style="float: left;height: 30px;line-height: 30px;margin: 0 5px;">${conditionformat_text.oneself}</div>
</div>
<div style="margin: 5px 0;">${conditionformat_text.setAs}</div>
${textCellColorHtml}
</div>`;
break;
case "top10%":
title = "条件格式——前 10%";
content = '<div class="box" data-itemvalue="top10%">' +
'<div class="boxTitleOne">为值最大的那些单元格设置格式:</div>' +
'<div style="height: 30px;line-height: 30px;">' +
'<div style="float: left;height: 30px;line-height: 30px;margin: 0 5px;">前</div>' +
'<div class="inpbox2">' +
'<input id="conditionVal" class="formulaInputFocus" type="number" value="10"/>' +
'</div>' +
'<div style="float: left;height: 30px;line-height: 30px;margin: 0 5px;">%</div>' +
'</div>' +
'<div style="margin: 5px 0;">设置为:</div>' +
textCellColorHtml +
'</div>';
title = conditionformat_text.conditionformat_top10_percent;
content = `<div class="box" data-itemvalue="top10%">
<div class="boxTitleOne">${conditionformat_text.conditionformat_top10_title}</div>
<div style="height: 30px;line-height: 30px;">
<div style="float: left;height: 30px;line-height: 30px;margin: 0 5px;">${conditionformat_text.top}</div>
<div class="inpbox2">
<input id="conditionVal" class="formulaInputFocus" type="number" value="10"/>
</div>
<div style="float: left;height: 30px;line-height: 30px;margin: 0 5px;">%</div>
</div>
<div style="margin: 5px 0;">${conditionformat_text.setAs}</div>
${textCellColorHtml}
</div>`;
break;
case "last10":
title = "条件格式——最后 10 项";
content = '<div class="box" data-itemvalue="last10">' +
'<div class="boxTitleOne">为值最小的那些单元格设置格式:</div>' +
'<div style="height: 30px;line-height: 30px;">' +
'<div style="float: left;height: 30px;line-height: 30px;margin: 0 5px;">最后</div>' +
'<div class="inpbox2">' +
'<input id="conditionVal" class="formulaInputFocus" type="number" value="10"/>' +
'</div>' +
'<div style="float: left;height: 30px;line-height: 30px;margin: 0 5px;">项</div>' +
'</div>' +
'<div style="margin: 5px 0;">设置为:</div>' +
textCellColorHtml +
'</div>';
title = conditionformat_text.conditionformat_last10;
content = `<div class="box" data-itemvalue="last10">
<div class="boxTitleOne">${conditionformat_text.conditionformat_last10_title}</div>
<div style="height: 30px;line-height: 30px;">
<div style="float: left;height: 30px;line-height: 30px;margin: 0 5px;">${conditionformat_text.last}</div>
<div class="inpbox2">
<input id="conditionVal" class="formulaInputFocus" type="number" value="10"/>
</div>
<div style="float: left;height: 30px;line-height: 30px;margin: 0 5px;">${conditionformat_text.oneself}</div>
</div>
<div style="margin: 5px 0;">${conditionformat_text.setAs}</div>
${textCellColorHtml}
</div>`;
break;
case "last10%":
title = "条件格式——最后 10%";
content = '<div class="box" data-itemvalue="last10%">' +
'<div class="boxTitleOne">为值最小的那些单元格设置格式:</div>' +
'<div style="height: 30px;line-height: 30px;">' +
'<div style="float: left;height: 30px;line-height: 30px;margin: 0 5px;">最后</div>' +
'<div class="inpbox2">' +
'<input id="conditionVal" class="formulaInputFocus" type="number" value="10"/>' +
'</div>' +
'<div style="float: left;height: 30px;line-height: 30px;margin: 0 5px;">%</div>' +
'</div>' +
'<div style="margin:5px 0;">设置为:</div>' +
textCellColorHtml +
'</div>';
title = conditionformat_text.conditionformat_last10_percent;
content = `<div class="box" data-itemvalue="last10%">
<div class="boxTitleOne">${conditionformat_text.conditionformat_last10_title}</div>
<div style="height: 30px;line-height: 30px;">
<div style="float: left;height: 30px;line-height: 30px;margin: 0 5px;">${conditionformat_text.last}</div>
<div class="inpbox2">
<input id="conditionVal" class="formulaInputFocus" type="number" value="10"/>
</div>
<div style="float: left;height: 30px;line-height: 30px;margin: 0 5px;">%</div>
</div>
<div style="margin:5px 0;">设置为</div>
${textCellColorHtml}
</div>`;
break;
case "AboveAverage":
title = "条件格式——高于平均值";
content = '<div class="box" data-itemvalue="AboveAverage">' +
'<div class="boxTitleOne">为高于平均值的单元格设置格式:</div>' +
'<div style="margin: 5px 0;">针对选定区域,设置为:</div>' +
textCellColorHtml +
'</div>';
title = conditionformat_text.conditionformat_AboveAverage;
content = `<div class="box" data-itemvalue="AboveAverage">
<div class="boxTitleOne">${conditionformat_text.conditionformat_AboveAverage_title}</div>
<div style="margin: 5px 0;">${conditionformat_text.setAsByArea}</div>
${textCellColorHtml}
</div>`;
break;
case "SubAverage":
title = "条件格式——低于平均值";
content = '<div class="box" data-itemvalue="SubAverage">' +
'<div class="boxTitleOne">为低于平均值的单元格设置格式:</div>' +
'<div style="margin: 5px 0;">针对选定区域,设置为:</div>' +
textCellColorHtml +
'</div>';
title = conditionformat_text.conditionformat_SubAverage;
content = `<div class="box" data-itemvalue="SubAverage">
<div class="boxTitleOne">${conditionformat_text.conditionformat_SubAverage_title}</div>
<div style="margin: 5px 0;">${conditionformat_text.setAsByArea}</div>
${textCellColorHtml}
</div>`;
break;
}

2
src/controllers/select.js

@ -22,7 +22,7 @@ function seletedHighlistByindex(id, r1, r2, c1, c2) {
});
}
//选区
//Set selection highlight
function selectHightlightShow() {
$("#luckysheet-cell-selected-boxs").show();
$("#luckysheet-cell-selected-boxs #luckysheet-cell-selected").siblings(".luckysheet-cell-selected").remove();

49
src/core.js

@ -21,13 +21,15 @@ import {
getconfig,
} from './methods/get';
import {
setluckysheetfile,
setluckysheet_select_save,
setconfig,
setluckysheet_select_save
} from './methods/set';
import { luckysheetrefreshgrid } from './global/refresh';
import { luckysheetrefreshgrid, jfrefreshgrid } from './global/refresh';
import functionlist from './function/functionlist';
import { luckysheetlodingHTML } from './controllers/constant';
import { getcellvalue, getdatabyselection } from './global/getdata';
import { setcellvalue } from './global/setdata';
import { selectHightlightShow } from './controllers/select';
import method from './global/method';
let luckysheet = {};
@ -148,17 +150,50 @@ luckysheet.setluckysheet_select_save = setluckysheet_select_save;
//获取当前表格 config配置
luckysheet.getconfig = getconfig;
//设置当前表格 config配置
luckysheet.setconfig = setconfig;
//二维数组数据 转化成 {r, c, v}格式 一维数组 (传入参数为二维数据data)
luckysheet.getGridData = sheetmanage.getGridData;
//生成表格所需二维数组 (传入参数为表格数据对象file)
luckysheet.buildGridData = sheetmanage.buildGridData;
// Refresh the canvas display data according to scrollHeight and scrollWidth
luckysheet.luckysheetrefreshgrid = luckysheetrefreshgrid;
// Refresh canvas
luckysheet.jfrefreshgrid = jfrefreshgrid;
// Get the value of the cell
luckysheet.getcellvalue = getcellvalue;
// Set cell value
luckysheet.setcellvalue = setcellvalue;
// Get selection range value
luckysheet.getdatabyselection = getdatabyselection;
// Data of the current table
luckysheet.flowdata = function () {
return Store.flowdata;
}
// Set selection highlight
luckysheet.selectHightlightShow = selectHightlightShow;
// Set the worksheet to hide
// Use the call method to change the `this` of the function to `this` of sheetmanage,
// Prevent _this error in setSheetHide
luckysheet.setSheetHide = function(index) {
return sheetmanage.setSheetHide.call(sheetmanage,index);
}
// Set the worksheet to show
luckysheet.setSheetShow = function(index) {
return sheetmanage.setSheetShow.call(sheetmanage,index);
}
// Reset parameters after destroying the table
luckysheet.destroy = method.destroy;
export {
luckysheet
}

1439
src/global/draw.js

File diff suppressed because it is too large

6
src/global/getdata.js

@ -6,7 +6,7 @@ import editor from './editor';
import { dynamicArrayCompute } from './dynamicArray';
import Store from '../store';
//获取选区范围值
//Get selection range value
export function getdatabyselection(range, sheetIndex) {
if(range == null){
range = Store.luckysheet_select_save[0];
@ -118,7 +118,7 @@ export function getdatabyselectionNoCopy(range) {
return data;
}
//得到单元格的值
//Get the value of the cell
export function getcellvalue(r, c, data, type) {
if (type == null) {
type = "v";
@ -171,7 +171,7 @@ export function getcellvalue(r, c, data, type) {
return retv;
}
//数据增加行列
//Data increase in rows and columns
export function datagridgrowth(data, addr, addc, iscallback) {
if (addr <= 0 && addc <= 0) {
return data;

8
src/global/refresh.js

@ -19,6 +19,12 @@ import { getSheetIndex } from '../methods/get';
import Store from '../store';
function jfrefreshgrid(data, range, cfg, cdformat, RowlChange, isRunExecFunction=true) {
if(data == null){
data = Store.flowdata;
}
if(range == null){
range = Store.luckysheet_select_save;
}
//单元格数据更新联动
if (isRunExecFunction) {
formula.execFunctionExist = [];
@ -781,7 +787,7 @@ function jfrefreshgrid_rhcw(rowheight, colwidth){
}, 1);
}
//按照scrollHeight, scrollWidth刷新canvas展示数据
//Refresh the canvas display data according to scrollHeight and scrollWidth
function luckysheetrefreshgrid(scrollWidth, scrollHeight) {
formula.groupValuesRefresh();

6
src/global/setdata.js

@ -3,9 +3,13 @@ import { isRealNull, isRealNum, valueIsError } from './validate';
import { genarate, update } from './format';
import server from '../controllers/server';
import luckysheetConfigsetting from '../controllers/luckysheetConfigsetting';
import Store from '../store/index'
//设置单元格的值
//Set cell value
function setcellvalue(r, c, d, v) {
if(d == null){
d = Store.flowdata;
}
let cell = d[r][c];
let vupdate;

2
src/index.html

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

118
src/locale/en.js

@ -655,46 +655,147 @@ export default {
chartEditNoOpt:"This operation is not allowed in chart editing mode!",
},
conditionformat: {
conditionformat_greaterThan: 'Conditionformat-GreaterThan',
conditionformat_greaterThan_title: 'Format cells greater than',
conditionformat_lessThan: 'Conditionformat-LessThan',
conditionformat_lessThan_title: 'Format cells smaller than',
conditionformat_betweenness: 'Conditionformat-Betweenness',
conditionformat_betweenness_title: 'Format cells with values between',
conditionformat_equal: 'Conditionformat-Equal',
conditionformat_equal_title: 'Format cells equal to',
conditionformat_textContains: 'Conditionformat-TextContains',
conditionformat_textContains_title: 'Format cells containing the following text',
conditionformat_occurrenceDate: 'Conditionformat-OccurrenceDate',
conditionformat_occurrenceDate_title: 'Format cells containing the following dates',
conditionformat_duplicateValue: 'Conditionformat-DuplicateValue',
conditionformat_duplicateValue_title: 'Format cells containing the following types of values',
conditionformat_top10: 'Conditionformat-Top10',
conditionformat_top10_percent: 'Conditionformat-Top10%',
conditionformat_top10_title: 'Format the cells with the highest value',
conditionformat_last10: 'Conditionformat-Last10',
conditionformat_last10_percent: 'Conditionformat-Last10%',
conditionformat_last10_title: 'Format the cells with the smallest value',
conditionformat_AboveAverage: 'Conditionformat-AboveAverage',
conditionformat_AboveAverage_title: 'Format cells above average',
conditionformat_SubAverage: 'Conditionformat-SubAverage',
conditionformat_SubAverage_title: 'Format cells below average',
rule: 'Rule',
newRule: 'New rule',
editRule: 'Edit rule',
deleteRule: 'Delete rule',
deleteCellRule: 'Delete cell rule',
deleteSheetRule: 'Delete sheet rule',
manageRules: 'Management rules',
showRules: 'Show its formatting rules',
manageRules: 'Conditional Formatting Rule Manager',
highlightCellRules: 'Highlight cell rules',
itemSelectionRules: 'Item selection rules',
conditionformatManageRules: 'Conditional Formatting Rule Manager',
format: 'Format',
setFormat: 'Set format',
setAs: 'Set as',
setAsByArea: 'For the selected area, set to',
applyRange: 'Apply range',
selectRange: 'Click to select application range',
selectRange_percent: 'Percentage of selected range',
selectRange_average: 'Average value of selected range',
selectRange_value: 'Value in the selected range',
pleaseSelectRange: 'Please select application range',
selectDataRange: 'Click to select data range',
selectCell: 'select cell',
pleaseSelectCell: 'Please select cell',
pleaseSelectADate: 'Please select a date',
pleaseEnterInteger: 'Please enter an integer between 1 and 1000',
onlySingleCell: 'Only a single cell can be referenced',
conditionValueCanOnly: 'The condition value can only be a number or a single cell',
ruleTypeItem1: 'Format all cells based on their respective values',
ruleTypeItem2: 'Only format cells that contain',
ruleTypeItem2_title: 'Only for cells that meet the following conditions',
ruleTypeItem3: 'Format only the top or bottom numbers',
ruleTypeItem3_title: 'Is the value in the following ranking',
ruleTypeItem4: 'Format only values above or below the average',
ruleTypeItem4_title: 'Is a value that satisfies the following conditions',
ruleTypeItem5: 'Format only unique or repeated values',
textColor: 'Text color',
cellColor: 'Cell color',
confirm: 'Confirm',
confirmColor: 'Confirm color',
cancel: 'Cancel',
close: 'Close',
clearColorSelect: 'Clear color select',
sheet: 'Sheet',
currentSheet: 'CurrentSheet',
dataBar: 'dataBar',
dataBarColor: 'dataBar color',
gradientDataBar_1: 'Blue-white gradient data bar',
gradientDataBar_2: 'Green-white gradient data bar',
gradientDataBar_3: 'Red-white gradient data bar',
gradientDataBar_4: 'Orange-white gradient stripes',
gradientDataBar_5: 'Light blue-white gradient stripes',
gradientDataBar_6: 'Purple-white gradient data bar',
solidColorDataBar_1: 'Blue data bar',
solidColorDataBar_2: 'Green data bar',
solidColorDataBar_3: 'Red data bar',
solidColorDataBar_4: 'Orange data bar',
solidColorDataBar_5: 'Light blue data bar',
solidColorDataBar_6: 'Purple data bar',
colorGradation: 'colorGradation',
colorGradation_1: 'Green-yellow-red color gradation',
colorGradation_2: 'Red-yellow-green color gradation',
colorGradation_3: 'Green-white-red color gradation',
colorGradation_4: 'Red-white-green color gradation',
colorGradation_5: 'Blue-white-red color gradation',
colorGradation_6: 'Red-white-blue color gradation',
colorGradation_7: 'White-red color gradation',
colorGradation_8: 'Red-white color gradation',
colorGradation_9: 'Green-white color gradation',
colorGradation_10: 'White-green color gradation',
colorGradation_11: 'Green-yellow color gradation',
colorGradation_12: 'Yellow-green color gradation',
icons: 'icons',
pleaseSelectIcon: 'Please click to select a group of icons:',
cellValue: 'Cell value',
specificText: 'Specific text',
occurrence: 'Date of occurrence',
greaterThan: 'Greater than',
lessThan: 'Less than',
between: 'Between',
equal: 'Equal',
in: 'In',
between2: '',
contain: 'Contain',
textContains: 'Text contains',
duplicateValue: 'Duplicate value',
uniqueValue: 'Unique value',
top: 'Top',
top10: 'Top10',
top10_percent: 'Top10%',
last: 'Last',
last10: 'Last10',
last10_percent: 'Last10%',
oneself: '',
above: 'Above',
aboveAverage: 'Above average',
below: 'Below',
belowAverage: 'Below average',
all: 'All',
yesterday: 'Yesterday',
today: 'Today',
tomorrow: 'Tomorrow',
lastWeek: 'Last week',
thisWeek: 'This week',
lastMonth: 'Last month',
thisMonth: 'This month',
lastYear: 'Last year',
thisYear: 'This year',
last7days: 'Last 7 days',
last30days: 'Last 30 days',
next7days: 'Next 7 days',
next30days: 'Next 30 days',
next60days: 'Next 60 days',
chooseRuleType: 'Choose rule type',
editRuleDescription: 'Edit rule description',
newFormatRule: 'New format rule',
editFormatRule: 'Edit format rule',
formatStyle: 'Format style',
fillType: 'Fill type',
color: 'Color',
@ -707,14 +808,29 @@ export default {
maxValue: 'Max value',
medianValue: 'Median value',
minValue: 'Min value',
direction: 'Direction',
threeWayArrow: 'Three-way arrow',
fourWayArrow: 'Four-way arrow',
fiveWayArrow: 'Five-way arrow',
threeTriangles: 'Three triangles',
shape: 'Shape',
threeColorTrafficLight: 'Three-color traffic light',
fourColorTrafficLight: 'Four-color traffic light',
threeSigns: 'Three signs',
greenRedBlackGradient: 'Green-red-black gradient',
rimless: 'Rimless',
bordered: 'Bordered',
mark: 'Mark',
threeSymbols: 'Three symbols',
tricolorFlag: 'Tricolor flag',
circled: 'Circled',
noCircle: 'No circle',
grade: 'Grade',
grade4: '4 Grade',
grade5: '5 Grade',
threeStars: '3 Stars',
fiveQuadrantDiagram: 'Five-quadrant diagram',
fiveBoxes: '5 Boxes',
},
formula:{
sum:"Sum",

119
src/locale/zh.js

@ -679,46 +679,148 @@ export default {
},
conditionformat: {
conditionformat_greaterThan: '条件格式——大于',
conditionformat_greaterThan_title: '为大于以下值的单元格设置格式',
conditionformat_lessThan: '条件格式——小于',
conditionformat_lessThan_title: '为小于以下值的单元格设置格式',
conditionformat_betweenness: '条件格式——介于',
conditionformat_betweenness_title: '为介于以下值的单元格设置格式',
conditionformat_equal: '条件格式——等于',
conditionformat_equal_title: '为等于以下值的单元格设置格式',
conditionformat_textContains: '条件格式——文本包含',
conditionformat_textContains_title: '为包含以下文本的单元格设置格式',
conditionformat_occurrenceDate: '条件格式——发生日期',
conditionformat_occurrenceDate_title: '为包含以下日期的单元格设置格式',
conditionformat_duplicateValue: '条件格式——重复值',
conditionformat_duplicateValue_title: '为包含以下类型值的单元格设置格式',
conditionformat_top10: '条件格式——前 10 项',
conditionformat_top10_percent: '条件格式——前 10%',
conditionformat_top10_title: '为值最大的那些单元格设置格式',
conditionformat_last10: '条件格式——最后 10 项',
conditionformat_last10_percent: '条件格式——最后 10%',
conditionformat_last10_title: '为值最小的那些单元格设置格式',
conditionformat_AboveAverage: '条件格式——高于平均值',
conditionformat_AboveAverage_title: '为高于平均值的单元格设置格式',
conditionformat_SubAverage: '条件格式——低于平均值',
conditionformat_SubAverage_title: '为低于平均值的单元格设置格式',
rule: '规则',
newRule: '新建规则',
editRule: '编辑规则',
deleteRule: '删除规则',
deleteCellRule: '清除所选单元格的规则',
deleteSheetRule: '清除整个工作表的规则',
manageRules: '管理规则',
showRules: '显示其格式规则',
manageRules: '条件格式规则管理器',
highlightCellRules: '突出显示单元格规则',
itemSelectionRules: '项目选取规则',
conditionformatManageRules: '条件格式规则管理器',
format: '格式',
setFormat: '设置格式',
setAs: '设置为',
setAsByArea: '针对选定区域,设置为',
applyRange: '应用范围',
selectRange: '点击选择应用范围',
selectRange_percent: '所选范围的百分比',
selectRange_average: '选定范围的平均值',
selectRange_value: '选定范围中的数值',
pleaseSelectRange: '请选择应用范围',
selectDataRange: '点击选择数据范围',
selectCell: '选择单元格',
pleaseSelectCell: '请选择单元格',
pleaseSelectADate: '请选择日期',
pleaseEnterInteger: '请输入一个介于 1 和 1000 之间的整数',
onlySingleCell: '只能对单个单元格进行引用',
conditionValueCanOnly: '条件值只能是数字或者单个单元格',
ruleTypeItem1: '基于各自值设置所有单元格的格式',
ruleTypeItem2: '只为包含以下内容的单元格设置格式',
ruleTypeItem2_title: '只为满足以下条件的单元格',
ruleTypeItem3: '仅对排名靠前或靠后的数值设置格式',
ruleTypeItem3_title: '为以下排名内的值',
ruleTypeItem4: '仅对高于或低于平均值的数值设置格式',
ruleTypeItem4_title: '为满足以下条件的值',
ruleTypeItem5: '仅对唯一值或重复值设置格式',
textColor: '文本颜色',
cellColor: '单元格颜色',
confirm: '确定',
confirmColor: '确定颜色',
cancel: '取消',
close: '关闭',
clearColorSelect: '清除颜色选择',
sheet: '表',
currentSheet: '当前工作表',
dataBar: '数据条',
dataBarColor: '数据条颜色',
gradientDataBar_1: '蓝-白渐变数据条',
gradientDataBar_2: '绿-白渐变数据条',
gradientDataBar_3: '红-白渐变数据条',
gradientDataBar_4: '橙-白渐变数据条',
gradientDataBar_5: '浅蓝-白渐变数据条',
gradientDataBar_6: '紫-白渐变数据条',
solidColorDataBar_1: '蓝色数据条',
solidColorDataBar_2: '绿色数据条',
solidColorDataBar_3: '红色数据条',
solidColorDataBar_4: '橙色数据条',
solidColorDataBar_5: '浅蓝色数据条',
solidColorDataBar_6: '紫色数据条',
colorGradation: '色阶',
colorGradation_1: '绿-黄-红色阶',
colorGradation_2: '红-黄-绿色阶',
colorGradation_3: '绿-白-红色阶',
colorGradation_4: '红-白-绿色阶',
colorGradation_5: '蓝-白-红色阶',
colorGradation_6: '红-白-蓝色阶',
colorGradation_7: '白-红色阶',
colorGradation_8: '红-白色阶',
colorGradation_9: '绿-白色阶',
colorGradation_10: '白-绿色阶',
colorGradation_11: '绿-黄色阶',
colorGradation_12: '黄-绿色阶',
icons: '图标集',
pleaseSelectIcon: '请点击选择一组图标:',
cellValue: '单元格值',
specificText: '特定文本',
occurrence: '发生日期',
greaterThan: '大于',
lessThan: '小于',
between: '介于',
equal: '等于',
in: '和',
to: '到',
between2: '之间',
contain: '包含',
textContains: '文本包含',
duplicateValue: '重复值',
uniqueValue: '唯一值',
top: '前',
top10: '前 10 项',
top10_percent: '前 10%',
last: '后',
last10: '后 10 项',
last10_percent: '后 10%',
oneself: '个',
above: '高于',
aboveAverage: '高于平均值',
below: '低于',
belowAverage: '低于平均值',
all: '全部',
yesterday: '昨天',
today: '今天',
tomorrow: '明天',
lastWeek: '上周',
thisWeek: '本周',
lastMonth: '上月',
thisMonth: '本月',
lastYear: '去年',
thisYear: '本年',
last7days: '最近7天',
last30days: '最近30天',
next7days: '未来7天',
next30days: '未来30天',
next60days: '未来60天',
chooseRuleType: '选择规则类型',
editRuleDescription: '编辑规则说明',
newFormatRule: '新建格式规则',
editFormatRule: '编辑格式规则',
formatStyle: '格式样式',
fillType: '填充类型',
color: '颜色',
@ -731,14 +833,29 @@ export default {
maxValue: '最大值',
medianValue: '中间值',
minValue: '最小值',
direction: '方向',
threeWayArrow: '三向箭头',
fourWayArrow: '四向箭头',
fiveWayArrow: '五向箭头',
threeTriangles: '3个三角形',
shape: '形状',
threeColorTrafficLight: '三色交通灯',
fourColorTrafficLight: '四色交通灯',
threeSigns: '三标志',
greenRedBlackGradient: '绿-红-黑渐变',
rimless: '无边框',
bordered: '有边框',
mark: '标记',
threeSymbols: '三个符号',
tricolorFlag: '三色旗',
circled: '有圆圈',
noCircle: '无圆圈',
grade: '等级',
grade4: '四等级',
grade5: '五等级',
threeStars: '3个星形',
fiveQuadrantDiagram: '五象限图',
fiveBoxes: '5个框',
},
formula:{
sum:"求和",

Loading…
Cancel
Save