From f19a26eab08bc44a5c380afd883d4e730f681062 Mon Sep 17 00:00:00 2001 From: liurunze <1414556676@qq.com> Date: Wed, 29 Jul 2020 18:43:54 +0800 Subject: [PATCH] docs(api): api luckysheet function BREAKING CHANGE: 1. luckysheet.flowdata change to luckysheet.flowdata() 2.all apis list in documentation --- docs/.vuepress/config.js | 14 ++- docs/guide/FAQ.md | 24 ++++ docs/guide/feature.md | 138 ++++++++++++--------- docs/guide/format.md | 255 +++++++++++++++++++++++++++++++------- docs/zh/guide/FAQ.md | 15 --- docs/zh/guide/feature.md | 129 +++++++++++-------- docs/zh/guide/format.md | 220 ++++++++++++++++++++++++++++---- src/controllers/select.js | 2 +- src/core.js | 49 ++++++-- src/global/getdata.js | 6 +- src/global/refresh.js | 8 +- src/global/setdata.js | 6 +- src/index.html | 2 +- 13 files changed, 652 insertions(+), 216 deletions(-) create mode 100644 docs/guide/FAQ.md diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 75e9f09..65962bb 100644 --- a/docs/.vuepress/config.js +++ b/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' ], }, }, diff --git a/docs/guide/FAQ.md b/docs/guide/FAQ.md new file mode 100644 index 0000000..eed5db5 --- /dev/null +++ b/docs/guide/FAQ.md @@ -0,0 +1,24 @@ +# FAQ + +## What is the difference between data and celldata in luckysheetfile? + +**A**: 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? + +**A**: Refer to [Cell Format List](https://mengshukeji.github.io/LuckysheetDocs/guide/format.html), with examples of available cell formats + +------------ \ No newline at end of file diff --git a/docs/guide/feature.md b/docs/guide/feature.md index d3e9047..9bb1a65 100644 --- a/docs/guide/feature.md +++ b/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 diff --git a/docs/guide/format.md b/docs/guide/format.md index 4ad0854..61d2425 100644 --- a/docs/guide/format.md +++ b/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();`
`currencyStyle.Number = 8;`| -|f|Format: format definition string `$#,##0;$-#,##0`|`var currencyStyle = book.CreateStyle();`
`currencyStyle.Custom  = "#,##0 SEK";`| -|t|Type:
0: General
1: Decimal
2: Currency
3: Percentage
4: Scientific
5: Fraction
6: Date
7: Time
8: Accounting
9: Text
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:
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 || +|


**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 || +|


**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 || +|


**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. \ No newline at end of file +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. \ No newline at end of file diff --git a/docs/zh/guide/FAQ.md b/docs/zh/guide/FAQ.md index 5c59b26..37f8767 100644 --- a/docs/zh/guide/FAQ.md +++ b/docs/zh/guide/FAQ.md @@ -21,19 +21,4 @@ luckysheet.buildGridData(luckysheetfile) **A** : 参考[单元格格式列表](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有什么区别? - -**A** : - ------------- -## luckysheetfile中的data和celldata有什么区别? - -**A** : - ------------- -## luckysheetfile中的data和celldata有什么区别? - -**A** : - ------------ \ No newline at end of file diff --git a/docs/zh/guide/feature.md b/docs/zh/guide/feature.md index e25ba63..14085f2 100644 --- a/docs/zh/guide/feature.md +++ b/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() - **用法**: - 释放表格 + 删除并释放表格 diff --git a/docs/zh/guide/format.md b/docs/zh/guide/format.md index 354084f..8069909 100644 --- a/docs/zh/guide/format.md +++ b/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 || |


**数字格式** | | | | | -| 整数 | 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 || +|


**时间日期格式** | | | | | +| 时间 | 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 || +|


**货币格式** | | | | | +| 货币:人民币 | "¥" 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 \ No newline at end of file +注意: 导入/导出只用考虑用户看到的数据样式,例如excel中处理日期格式的方式为把日期统一转换为数字:42736 代表 2017-1-1 \ No newline at end of file diff --git a/src/controllers/select.js b/src/controllers/select.js index beb1185..03a4078 100644 --- a/src/controllers/select.js +++ b/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(); diff --git a/src/core.js b/src/core.js index 1714f62..3eacee3 100644 --- a/src/core.js +++ b/src/core.js @@ -14,13 +14,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 = {}; @@ -130,17 +132,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 } \ No newline at end of file diff --git a/src/global/getdata.js b/src/global/getdata.js index dfed0de..3b15fa0 100644 --- a/src/global/getdata.js +++ b/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; diff --git a/src/global/refresh.js b/src/global/refresh.js index 4f3abe8..d5e3446 100644 --- a/src/global/refresh.js +++ b/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(); diff --git a/src/global/setdata.js b/src/global/setdata.js index 315550e..f2460cb 100644 --- a/src/global/setdata.js +++ b/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; diff --git a/src/index.html b/src/index.html index 6836581..4a147c1 100644 --- a/src/index.html +++ b/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] })