diff --git a/.eslintignore b/.eslintignore index 85de9cf93..b8104aaba 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1 @@ -src +src diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index ea3a5175d..4ca25e378 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,12 +1,12 @@ -# These are supported funding model platforms - -github: # [mengshukeji] -patreon: mengshukeji -open_collective: luckysheet -ko_fi: # Replace with a single Ko-fi username -tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel -community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -liberapay: # Replace with a single Liberapay username -issuehunt: # Replace with a single IssueHunt username -otechie: # Replace with a single Otechie username -custom: ['https://www.paypal.me/wbfsa'] +# These are supported funding model platforms + +github: # [mengshukeji] +patreon: mengshukeji +open_collective: luckysheet +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: ['https://www.paypal.me/wbfsa'] diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 2cb46e7bd..1a464bbf5 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,38 +1,38 @@ ---- -name: Bug report -about: Create a report to help us improve -title: "[BUG]Find a bug" -labels: '' -assignees: '' - ---- - - - - - - - -**Describe the bug** - - -**To Reproduce** - -1. The first step: -2. The second step: -3. The third step: -4. See error: - -**What is expected?** - - -**Screenshots or demo** - - -**Environment** - - OS: - - Browser Version: - - Luckysheet Version: - -**Additional context** - +--- +name: Bug report +about: Create a report to help us improve +title: "[BUG]Find a bug" +labels: '' +assignees: '' + +--- + + + + + + + +**Describe the bug** + + +**To Reproduce** + +1. The first step: +2. The second step: +3. The third step: +4. See error: + +**What is expected?** + + +**Screenshots or demo** + + +**Environment** + - OS: + - Browser Version: + - Luckysheet Version: + +**Additional context** + diff --git a/.github/ISSUE_TEMPLATE/bug_report_zh.md b/.github/ISSUE_TEMPLATE/bug_report_zh.md index 6c7fb5010..e227fbf23 100644 --- a/.github/ISSUE_TEMPLATE/bug_report_zh.md +++ b/.github/ISSUE_TEMPLATE/bug_report_zh.md @@ -1,38 +1,38 @@ ---- -name: '错误报告' -about: 创建报告帮助我们改进 -title: '[BUG]发现了个bug' -labels: '' -assignees: '' - ---- - - - - - - - -**描述错误** - - -**重现** - -1. 第一步操作: -2. 第二步操作: -3. 第三步操作: -4. 最后看到了什么错误: - -**期望的结果** - - -**屏幕截图或演示** - - -**环境:** - - 操作系统: - - 浏览器 版本号: - - Luckysheet版本: - -**备注** - +--- +name: '错误报告' +about: 创建报告帮助我们改进 +title: '[BUG]发现了个bug' +labels: '' +assignees: '' + +--- + + + + + + + +**描述错误** + + +**重现** + +1. 第一步操作: +2. 第二步操作: +3. 第三步操作: +4. 最后看到了什么错误: + +**期望的结果** + + +**屏幕截图或演示** + + +**环境:** + - 操作系统: + - 浏览器 版本号: + - Luckysheet版本: + +**备注** + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index e32412e9f..63edf3dc9 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,23 +1,23 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: "[Feature request]I have an idea" -labels: '' -assignees: '' - ---- - - - - - - - -**Is your feature request related to a problem? Please describe.** - - -**Describe the solution you'd like** - - -**Additional context** - +--- +name: Feature request +about: Suggest an idea for this project +title: "[Feature request]I have an idea" +labels: '' +assignees: '' + +--- + + + + + + + +**Is your feature request related to a problem? Please describe.** + + +**Describe the solution you'd like** + + +**Additional context** + diff --git a/.github/ISSUE_TEMPLATE/feature_request_zh.md b/.github/ISSUE_TEMPLATE/feature_request_zh.md index 7f0a43831..fef9b6c79 100644 --- a/.github/ISSUE_TEMPLATE/feature_request_zh.md +++ b/.github/ISSUE_TEMPLATE/feature_request_zh.md @@ -1,24 +1,24 @@ ---- -name: 功能要求 -about: 为这个项目提出想法 -title: "[Feature request]我有个点子" -labels: '' -assignees: '' - ---- - - - - - - - -**您的功能请求与问题有关吗?** - - - -**描述您想要的解决方案** - - -**其他内容** - +--- +name: 功能要求 +about: 为这个项目提出想法 +title: "[Feature request]我有个点子" +labels: '' +assignees: '' + +--- + + + + + + + +**您的功能请求与问题有关吗?** + + + +**描述您想要的解决方案** + + +**其他内容** + diff --git a/.github/workflows/gitee-mirror.yml b/.github/workflows/gitee-mirror.yml index e1c9e223c..ba4840608 100644 --- a/.github/workflows/gitee-mirror.yml +++ b/.github/workflows/gitee-mirror.yml @@ -1,40 +1,40 @@ -# 使用 GitHub Action 来解决手动同步到 Gitee 的问题 -# 效果:github repo 代码更新之后,会自动同步至 gitee -# 使用到的 GitHub Action:https://github.com/Yikun/hub-mirror-action - -# This is a basic workflow to help you get started with Actions - -name: gitee-mirror - -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch -on: - push: - branches: - - '*' - -jobs: - # This workflow contains a single job called "build" - build: - # The type of runner that the job will run on - runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - - name: Mirror the Github organization repos to Gitee. - uses: Yikun/hub-mirror-action@master - with: - src: github/mengshukeji - dst: gitee/mengshukeji - # 这里请填写与gitee上公钥匹配的的 ssh private key,参见:https://gitee.com/profile/sshkeys - # 填写地址:https://github.com/ly525/luban-h5/settings/secrets - dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} - # 这里请填写 gitee的令牌,参见:https://gitee.com/profile/personal_access_tokens - # 填写地址:https://github.com/ly525/luban-h5/settings/secrets - dst_token: ${{ secrets.GITEE_TOKEN }} - # 项目同步白名单,可以选择填写多个,以英文逗号分割 - static_list: "Luckyexcel,Luckysheet,LuckysheetDemo,LuckyexcelDemo,LuckysheetDocs,chartMix,LuckysheetServer" - # 是否强制同步 - force_update: true - # 账号类型:对 luban-h5 而言是 user,因为是个人项目;如果是企业项目,请填写 org,因为是组织下的项目 - account_type: user +# 使用 GitHub Action 来解决手动同步到 Gitee 的问题 +# 效果:github repo 代码更新之后,会自动同步至 gitee +# 使用到的 GitHub Action:https://github.com/Yikun/hub-mirror-action + +# This is a basic workflow to help you get started with Actions + +name: gitee-mirror + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: + - '*' + +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - name: Mirror the Github organization repos to Gitee. + uses: Yikun/hub-mirror-action@master + with: + src: github/mengshukeji + dst: gitee/mengshukeji + # 这里请填写与gitee上公钥匹配的的 ssh private key,参见:https://gitee.com/profile/sshkeys + # 填写地址:https://github.com/ly525/luban-h5/settings/secrets + dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} + # 这里请填写 gitee的令牌,参见:https://gitee.com/profile/personal_access_tokens + # 填写地址:https://github.com/ly525/luban-h5/settings/secrets + dst_token: ${{ secrets.GITEE_TOKEN }} + # 项目同步白名单,可以选择填写多个,以英文逗号分割 + static_list: "Luckyexcel,Luckysheet,LuckysheetDemo,LuckyexcelDemo,LuckysheetDocs,chartMix,LuckysheetServer" + # 是否强制同步 + force_update: true + # 账号类型:对 luban-h5 而言是 user,因为是个人项目;如果是企业项目,请填写 org,因为是组织下的项目 + account_type: user diff --git a/.github/workflows/github-demo.yml b/.github/workflows/github-demo.yml index ac01116bd..eee16bbe8 100644 --- a/.github/workflows/github-demo.yml +++ b/.github/workflows/github-demo.yml @@ -1,35 +1,35 @@ -name: Luckysheet demo github pages deploy - -on: - push: - tags: - - 'v*' - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - name: Checkout # 检查项目 - uses: actions/checkout@v2 - - - name: Set up Node.js # Nodejs版本 - uses: actions/setup-node@master - with: - node-version: 12.13.0 - - - name: Install dependencies & Generate static files # 安装依赖打包demo和文档 - run: | - node -v - npm install - npm install gulp -g - npm run build - - - name: Deploy LuckysheetDemo to GitHub Pages # 发布demo 到github pages - if: success() - uses: crazy-max/ghaction-github-pages@v2 - with: - repo: mengshukeji/LuckysheetDemo - target_branch: gh-pages - build_dir: dist - env: +name: Luckysheet demo github pages deploy + +on: + push: + tags: + - 'v*' + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout # 检查项目 + uses: actions/checkout@v2 + + - name: Set up Node.js # Nodejs版本 + uses: actions/setup-node@master + with: + node-version: 12.13.0 + + - name: Install dependencies & Generate static files # 安装依赖打包demo和文档 + run: | + node -v + npm install + npm install gulp -g + npm run build + + - name: Deploy LuckysheetDemo to GitHub Pages # 发布demo 到github pages + if: success() + uses: crazy-max/ghaction-github-pages@v2 + with: + repo: mengshukeji/LuckysheetDemo + target_branch: gh-pages + build_dir: dist + env: GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/github-doc.yml b/.github/workflows/github-doc.yml index 6d5d7489e..433f75e42 100644 --- a/.github/workflows/github-doc.yml +++ b/.github/workflows/github-doc.yml @@ -1,35 +1,35 @@ -name: Luckysheet docs github pages deploy - -on: - push: - tags: - - 'doc*' - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - name: Checkout # 检查项目 - uses: actions/checkout@v2 - - - name: Set up Node.js # Nodejs版本 - uses: actions/setup-node@master - with: - node-version: 12.13.0 - - - name: Install dependencies & Generate static files # 安装依赖打包demo和文档 - run: | - node -v - npm install - npm install gulp -g - npm run docs:build - - - name: Deploy LuckysheetDocs to GitHub Pages # 发布docs 到github pages - if: success() - uses: crazy-max/ghaction-github-pages@v2 - with: - repo: mengshukeji/LuckysheetDocs - target_branch: gh-pages - build_dir: docs/.vuepress/dist - env: +name: Luckysheet docs github pages deploy + +on: + push: + tags: + - 'doc*' + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout # 检查项目 + uses: actions/checkout@v2 + + - name: Set up Node.js # Nodejs版本 + uses: actions/setup-node@master + with: + node-version: 12.13.0 + + - name: Install dependencies & Generate static files # 安装依赖打包demo和文档 + run: | + node -v + npm install + npm install gulp -g + npm run docs:build + + - name: Deploy LuckysheetDocs to GitHub Pages # 发布docs 到github pages + if: success() + uses: crazy-max/ghaction-github-pages@v2 + with: + repo: mengshukeji/LuckysheetDocs + target_branch: gh-pages + build_dir: docs/.vuepress/dist + env: GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index edfa44e37..c42e3af45 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,12 @@ -.DS_Store -node_modules -package-lock.json -dist -docs/.vuepress/dist - -.idea -.history -.vs \ No newline at end of file +.DS_Store +node_modules +package-lock.json +yarn.lock +dist +docs/.vuepress/dist +src/expendPlugins/print/print.js + +.idea +.history +.vs +.vscode \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..fa02f4f37 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,9 @@ +dist + +*.css +*.html +*.md +*.yml +*.min.js +package.json +package-lock.json diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 000000000..be6575bf8 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,8 @@ +{ + "printWidth": 80, + "trailingComma": "es5", + "tabWidth": 2, + "semi": true, + "singleQuote": false, + "arrowParens": "avoid" +} diff --git a/.vs/luckysheet/config/applicationhost.config b/.vs/luckysheet/config/applicationhost.config deleted file mode 100644 index 7a99442e9..000000000 --- a/.vs/luckysheet/config/applicationhost.config +++ /dev/null @@ -1,1025 +0,0 @@ - - - - - - - -
-
-
-
-
-
-
-
- - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
- -
-
-
-
-
-
- -
-
-
-
-
- -
-
-
- -
-
- -
-
- -
-
-
- - -
-
-
-
-
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.vs/luckysheet/v16/.suo b/.vs/luckysheet/v16/.suo deleted file mode 100644 index d97978dfb..000000000 Binary files a/.vs/luckysheet/v16/.suo and /dev/null differ diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite deleted file mode 100644 index b11abada7..000000000 Binary files a/.vs/slnx.sqlite and /dev/null differ diff --git a/CHANGELOG.md b/CHANGELOG.md index 77d475d2a..2fb9447a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,474 +1,474 @@ -# Changelog - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. - -### [2.1.13](https://github.com/mengshukeji/Luckysheet/compare/v2.1.12...v2.1.13) (2021-01-19) - - -### Bug Fixes - -* **bug:** bug ([025823b](https://github.com/mengshukeji/Luckysheet/commit/025823b9f386c8048aa44b62f076a739eaa980c0)), closes [#435](https://github.com/mengshukeji/Luckysheet/issues/435) -* **bug:** bug ([a8ff967](https://github.com/mengshukeji/Luckysheet/commit/a8ff967be9cdcf3bbcb0045888951a26a852500a)), closes [#398](https://github.com/mengshukeji/Luckysheet/issues/398) -* **bug:** bug ([deb3a96](https://github.com/mengshukeji/Luckysheet/commit/deb3a965b881d747f9a2171f7d9c9f967d671901)) -* **bug:** bug ([5ce1f4a](https://github.com/mengshukeji/Luckysheet/commit/5ce1f4a0b753b7a95569b5285d749389e4d8b943)), closes [#433](https://github.com/mengshukeji/Luckysheet/issues/433) -* **bug:** bug ([932e821](https://github.com/mengshukeji/Luckysheet/commit/932e8215563248f97547ad21a429ef3f8ed0682b)), closes [#423](https://github.com/mengshukeji/Luckysheet/issues/423) [#424](https://github.com/mengshukeji/Luckysheet/issues/424) -* **bug:** bug ([06636f6](https://github.com/mengshukeji/Luckysheet/commit/06636f6a3c08128fe50aa880baabc9420fce4092)), closes [#154](https://github.com/mengshukeji/Luckysheet/issues/154) [#410](https://github.com/mengshukeji/Luckysheet/issues/410) [#416](https://github.com/mengshukeji/Luckysheet/issues/416) -* **bug:** history bug ([973eec8](https://github.com/mengshukeji/Luckysheet/commit/973eec8b71ea963bb23c9fe35c985e86c85ef019)) -* **bug:** setRangeFormat history ([065148b](https://github.com/mengshukeji/Luckysheet/commit/065148b5a97e9090479f401463c548c3346757ec)) -* **bug:** setRangeShow api ([5bbc45b](https://github.com/mengshukeji/Luckysheet/commit/5bbc45b68e807a2c58c328d93fe8079f3e56fa9f)) -* bug ([7412c5b](https://github.com/mengshukeji/Luckysheet/commit/7412c5b4f5aa0afd93f3e0210d3f3fe182c67273)) -* **bug:** 文本自动换行bug ([bc926e5](https://github.com/mengshukeji/Luckysheet/commit/bc926e5c49f008c14b4b5e1fdf13713fd6e995b5)) -* 换行 ([94022a4](https://github.com/mengshukeji/Luckysheet/commit/94022a48b6407523c5924e94c86fb2ada0fab301)) -* **bug:** 渲染换行空行 ([4162b7a](https://github.com/mengshukeji/Luckysheet/commit/4162b7a049f109715a9246ce610d05882d5a5f12)) -* **hook:** cellrender ([d444980](https://github.com/mengshukeji/Luckysheet/commit/d44498086fcd3b1b2bf75e95c6a236bc79a1df13)) -* **let:** let declar ([71ade32](https://github.com/mengshukeji/Luckysheet/commit/71ade32abd3989230db609ec37f92e931a4473f0)) -* **pivottable:** fix ([7cecb12](https://github.com/mengshukeji/Luckysheet/commit/7cecb12ae3a1a0bd0d5bdce803429d4464388e31)), closes [#439](https://github.com/mengshukeji/Luckysheet/issues/439) [#447](https://github.com/mengshukeji/Luckysheet/issues/447) -* **pivottable:** init ([5b19e8b](https://github.com/mengshukeji/Luckysheet/commit/5b19e8b06bdd95c2b799d2cc1d6ae677b96617cd)) -* **pivottable:** refresh ([78330c9](https://github.com/mengshukeji/Luckysheet/commit/78330c95db2735c8139b0320c2e81ee6f438adea)) - -### [2.1.12](https://github.com/mengshukeji/Luckysheet/compare/v2.1.11...v2.1.12) (2020-12-22) - - -### Features - -* **api:** find ([ea97233](https://github.com/mengshukeji/Luckysheet/commit/ea97233a668b3a682f6f0b1ad3fec251b01c33ab)) - - -### Bug Fixes - -* **bug:** bug ([9357792](https://github.com/mengshukeji/Luckysheet/commit/9357792fd1c49737398cf86cdf87d9dbfe35df26)), closes [#359](https://github.com/mengshukeji/Luckysheet/issues/359) [#360](https://github.com/mengshukeji/Luckysheet/issues/360) [#376](https://github.com/mengshukeji/Luckysheet/issues/376) [#382](https://github.com/mengshukeji/Luckysheet/issues/382) -* **bug:** bug ([19560eb](https://github.com/mengshukeji/Luckysheet/commit/19560eba3fe36cce4ee65ba3e8ac80ab7ec8d620)), closes [#367](https://github.com/mengshukeji/Luckysheet/issues/367) [#370](https://github.com/mengshukeji/Luckysheet/issues/370) -* **bug:** bug ([0f257e8](https://github.com/mengshukeji/Luckysheet/commit/0f257e8f153bb6c0cf38fb85200c587aabac164c)), closes [#361](https://github.com/mengshukeji/Luckysheet/issues/361) [#364](https://github.com/mengshukeji/Luckysheet/issues/364) [#365](https://github.com/mengshukeji/Luckysheet/issues/365) -* **bug:** copy bug ([2bcbab9](https://github.com/mengshukeji/Luckysheet/commit/2bcbab9a9f4727fd03930962a2dbdcaec3401597)) -* **feature:** functionButton ([5983cb0](https://github.com/mengshukeji/Luckysheet/commit/5983cb015e092e2edc1d3f27dba2d585fb4db099)), closes [#336](https://github.com/mengshukeji/Luckysheet/issues/336) [#381](https://github.com/mengshukeji/Luckysheet/issues/381) -* copy ([d177cc8](https://github.com/mengshukeji/Luckysheet/commit/d177cc8f5ee01d32932d1137920883209ec24be4)) - -### [2.1.10](https://github.com/mengshukeji/Luckysheet/compare/v2.1.9...v2.1.10) (2020-12-18) - - -### Bug Fixes - -* **rowtitle:** bug ([8faeffe](https://github.com/mengshukeji/Luckysheet/commit/8faeffee08840a5e8119d9fc8ac7204248105616)) - -### [2.1.9](https://github.com/mengshukeji/Luckysheet/compare/v2.1.8...v2.1.9) (2020-12-17) - - -### Bug Fixes - -* **bug:** bug ([54ae143](https://github.com/mengshukeji/Luckysheet/commit/54ae143aa268b5ce0253752a2a92b2ab22601b42)), closes [#222](https://github.com/mengshukeji/Luckysheet/issues/222) [#355](https://github.com/mengshukeji/Luckysheet/issues/355) -* **numeral:** userInfo ([871d381](https://github.com/mengshukeji/Luckysheet/commit/871d3819f7c734b604f19da1ba81bf5ee0ea0814)), closes [#338](https://github.com/mengshukeji/Luckysheet/issues/338) - -### [2.1.8](https://github.com/mengshukeji/Luckysheet/compare/v2.1.7...v2.1.8) (2020-12-16) - - -### ⚠ BREAKING CHANGES - -* **bug:** n - -### Features - -* **api add:** image ([16131b2](https://github.com/mengshukeji/Luckysheet/commit/16131b2776cd278bb7bddae674c206aa739f3a46)), closes [#270](https://github.com/mengshukeji/Luckysheet/issues/270) -* **changlang:** changLang ([cbc81e9](https://github.com/mengshukeji/Luckysheet/commit/cbc81e9e17ca56e09f9e697e5372650f3d6a476b)), closes [#318](https://github.com/mengshukeji/Luckysheet/issues/318) -* **collaborative editing:** collaborative editing ([6fe8726](https://github.com/mengshukeji/Luckysheet/commit/6fe87260e8986cd83e7bcf655594389c01739107)), closes [#199](https://github.com/mengshukeji/Luckysheet/issues/199) [#201](https://github.com/mengshukeji/Luckysheet/issues/201) [#202](https://github.com/mengshukeji/Luckysheet/issues/202) -* **condition format:** formula condition ([6c98bde](https://github.com/mengshukeji/Luckysheet/commit/6c98bded8dcf16aab4bcc89a63a62d3878c06cd3)), closes [#186](https://github.com/mengshukeji/Luckysheet/issues/186) -* **demo:** proxy ([bc64807](https://github.com/mengshukeji/Luckysheet/commit/bc64807de9e3f8f60ddc529c6b795c95aff1884c)) -* **feature:** closeWebsocket api and ctrl ; ([9153bc7](https://github.com/mengshukeji/Luckysheet/commit/9153bc799db2aea947f2ba70a7b947daca55b844)), closes [#328](https://github.com/mengshukeji/Luckysheet/issues/328) [#326](https://github.com/mengshukeji/Luckysheet/issues/326) -* **hook:** add ([2c6b1c2](https://github.com/mengshukeji/Luckysheet/commit/2c6b1c21b3ad6535671745fd7483d9318f7e55ec)) -* **print feature:** develop ([a0921b6](https://github.com/mengshukeji/Luckysheet/commit/a0921b62d73b8b3edcaf1c72dd9e35cd43848f2f)) - - -### Bug Fixes - -* **add forcecaculation config:** add ([e96d210](https://github.com/mengshukeji/Luckysheet/commit/e96d210fe544caa8b912720a274374bccb0cef7d)) -* **bug:** bug ([95e26c3](https://github.com/mengshukeji/Luckysheet/commit/95e26c3fa07fa74c238c0c7b96b5b7ff91b79889)), closes [#330](https://github.com/mengshukeji/Luckysheet/issues/330) -* **bug:** bug ([c003f8a](https://github.com/mengshukeji/Luckysheet/commit/c003f8a4281f346c89226061851f71693208574a)), closes [#184](https://github.com/mengshukeji/Luckysheet/issues/184) [#337](https://github.com/mengshukeji/Luckysheet/issues/337) -* **bug:** bug ([4900b4a](https://github.com/mengshukeji/Luckysheet/commit/4900b4a0f2a82528e130d7281bb1f153ed3297fe)), closes [#331](https://github.com/mengshukeji/Luckysheet/issues/331) -* **bug:** bug ([b93ea6b](https://github.com/mengshukeji/Luckysheet/commit/b93ea6b66e444d387f230602dd02034b4b237369)), closes [#284](https://github.com/mengshukeji/Luckysheet/issues/284) [#296](https://github.com/mengshukeji/Luckysheet/issues/296) -* **bug:** bug ([57ff2b9](https://github.com/mengshukeji/Luckysheet/commit/57ff2b959b4be8d5cad559624d92f00e996d315f)), closes [#182](https://github.com/mengshukeji/Luckysheet/issues/182) [#220](https://github.com/mengshukeji/Luckysheet/issues/220) -* **bug:** bug ([31bdc4f](https://github.com/mengshukeji/Luckysheet/commit/31bdc4feae0037c92074b244e9e52363298b164d)), closes [#263](https://github.com/mengshukeji/Luckysheet/issues/263) -* **bug:** bug ([385bc03](https://github.com/mengshukeji/Luckysheet/commit/385bc039c91727655ea771c7a48d6f0890a275fb)), closes [#243](https://github.com/mengshukeji/Luckysheet/issues/243) [#226](https://github.com/mengshukeji/Luckysheet/issues/226) -* **bug:** bug ([88aa6c5](https://github.com/mengshukeji/Luckysheet/commit/88aa6c5b59964078c6a9cfffb41308c196a44953)), closes [#278](https://github.com/mengshukeji/Luckysheet/issues/278) [#276](https://github.com/mengshukeji/Luckysheet/issues/276) [#267](https://github.com/mengshukeji/Luckysheet/issues/267) [#215](https://github.com/mengshukeji/Luckysheet/issues/215) -* **bug:** copy to excel ([5cf72ec](https://github.com/mengshukeji/Luckysheet/commit/5cf72ec0781f0e3b2ddc77eac228812507ce66a2)), closes [#319](https://github.com/mengshukeji/Luckysheet/issues/319) -* **bug:** data verification range select ([6d60679](https://github.com/mengshukeji/Luckysheet/commit/6d606791abaa5d410ce68cfb49f8bc9c2dfaf609)) -* **cell:** render ([ba21140](https://github.com/mengshukeji/Luckysheet/commit/ba2114055ba62b0401c76075054588642fa4fbf1)) -* **demo:** websocket url ([cf77ec3](https://github.com/mengshukeji/Luckysheet/commit/cf77ec3307c0d44bc5303f606762c003d4f50b86)) -* **dynamic array refresh fix:** fix ([b7d634f](https://github.com/mengshukeji/Luckysheet/commit/b7d634f0425dd8cb337784b10094d0952edc460a)) -* **fix #209:** highlight ([ab2d8b7](https://github.com/mengshukeji/Luckysheet/commit/ab2d8b7b5467200e12c8d4c1ece014ebfc6ee7cc)), closes [#209](https://github.com/mengshukeji/Luckysheet/issues/209) -* **fix #209 ,fix #219:** highlight follow checkout keep highlight ([c547596](https://github.com/mengshukeji/Luckysheet/commit/c5475964e41eb7bb12d87b679dffba4b988abb30)), closes [#209](https://github.com/mengshukeji/Luckysheet/issues/209) [#219](https://github.com/mengshukeji/Luckysheet/issues/219) -* **fix #209 fix #219:** highlight follow checkout page ([0a5ca86](https://github.com/mengshukeji/Luckysheet/commit/0a5ca86ab808d2cb1da8cb14d93c5d787c50f540)), closes [#209](https://github.com/mengshukeji/Luckysheet/issues/209) [#219](https://github.com/mengshukeji/Luckysheet/issues/219) -* **fix #209 fix #219:** highlight follow, checkout keep highlight ([2c7b0bb](https://github.com/mengshukeji/Luckysheet/commit/2c7b0bbdf5adf1b2a6fc537e37825ab01ee3cf96)), closes [#209](https://github.com/mengshukeji/Luckysheet/issues/209) [#219](https://github.com/mengshukeji/Luckysheet/issues/219) -* **fix #290:** userinfo ([80d67e1](https://github.com/mengshukeji/Luckysheet/commit/80d67e157d010f8e59c472b2e6046c04efe9b966)), closes [#290](https://github.com/mengshukeji/Luckysheet/issues/290) -* **fix #290:** userinfo ([dddfc8f](https://github.com/mengshukeji/Luckysheet/commit/dddfc8f9418991466025682309e73950da6611cd)), closes [#290](https://github.com/mengshukeji/Luckysheet/issues/290) -* **fix #290:** userinfo ([27a770e](https://github.com/mengshukeji/Luckysheet/commit/27a770ee863356d2ef120970723bb048c510d9aa)), closes [#290](https://github.com/mengshukeji/Luckysheet/issues/290) -* **main canvas:** bottom space ([23c8a78](https://github.com/mengshukeji/Luckysheet/commit/23c8a78cb3bd387c7c609250de41b187105475b5)) -* **tojson:** bug ([1c94783](https://github.com/mengshukeji/Luckysheet/commit/1c94783677bcfe6488caf39028f18e5b2505a737)) -* setCellValue API 可设置自定义的属性,不显式设置v, v 不会丢失 ([6d45cf2](https://github.com/mengshukeji/Luckysheet/commit/6d45cf2ce63dca282f4a40ce5aaf628f94bfc8d1)) -* jfrefreshgrid 函数第二个参数应该是个数组 ([c7cf87a](https://github.com/mengshukeji/Luckysheet/commit/c7cf87a49b1b8ce64fb21249cd05950fabc0e546)) -* setCellFormat data 引用 ([ed50e47](https://github.com/mengshukeji/Luckysheet/commit/ed50e47b44e079bc76419ba3f96f04d964c70610)) -* setCellValue 刷新页面时的历史记录问题 ([a2cf969](https://github.com/mengshukeji/Luckysheet/commit/a2cf96978f97b289d603aa404bcfaf8a0d64f87b)) -* 修复alert ([94e0020](https://github.com/mengshukeji/Luckysheet/commit/94e0020acd49aed50810e6c133688c950690ab3c)) -* 修复主动关闭socket仍然alert弹窗 ([e0bdb2c](https://github.com/mengshukeji/Luckysheet/commit/e0bdb2c4015355e428c5e8d567196d607606a38e)) -* 修复主动关闭socket定时器仍运行问题 ([82a8731](https://github.com/mengshukeji/Luckysheet/commit/82a87319342c698c1a1a58972a9d59ab3b7e91cd)) -* 初始化表单状态下标调整 ([3a54312](https://github.com/mengshukeji/Luckysheet/commit/3a54312c93a6daebf575639dd612e0d01be2a296)) -* 复制选区虚线框正确显示 ([9d6a2ee](https://github.com/mengshukeji/Luckysheet/commit/9d6a2eed05ae660fb65515217e156817fc4d6443)) -* 解决单击非时间日期单元格后还会跳出日期时间弹框 ([fc9eb4e](https://github.com/mengshukeji/Luckysheet/commit/fc9eb4e7984af6991b79acae6a2a5c0bbea5254f)) -* **fix forcecaculation feature:** complete ([7568ceb](https://github.com/mengshukeji/Luckysheet/commit/7568ceb442acdfdedeb6d6e4d623bdcd2a8c4018)) -* **formula contain text bug:** add iscell method ([89358d3](https://github.com/mengshukeji/Luckysheet/commit/89358d36045baca791f2b5e9d2152349bf5903cf)) -* **formula update fix:** formula update only one level, when cell value change. Fix it ([cf6c5be](https://github.com/mengshukeji/Luckysheet/commit/cf6c5be8a45616e1002db0ff4b04b47c3ed4c38e)) - -### [2.1.7](https://github.com/mengshukeji/Luckysheet/compare/v2.1.6...v2.1.7) (2020-11-26) - - -### Features - -* **demo:** tool function ([3baf93c](https://github.com/mengshukeji/Luckysheet/commit/3baf93cdb57238ee73ace3e7b9bca142fad81584)) -* 修改日期能够正常的弹出格式框和设置对应格式的日期时间 ([2c27044](https://github.com/mengshukeji/Luckysheet/commit/2c2704473c1c5a77091acda45a46f39ebbad3592)) -* 修改日期能够正常的弹出格式框和设置对应格式的日期时间 ([67c44e7](https://github.com/mengshukeji/Luckysheet/commit/67c44e7a68d948fcb90bd499ecc15cfb2bea5127)) - - -### Bug Fixes - -* **formula:** function ([dad6e2b](https://github.com/mengshukeji/Luckysheet/commit/dad6e2b2d144a31f4cfaaf84c90588e1a02ee006)) -* **formular:** docs ([ddac582](https://github.com/mengshukeji/Luckysheet/commit/ddac582f696898a1a46fc0ce3eb5d245d20077ae)) -* **hook:** function ([fb43a56](https://github.com/mengshukeji/Luckysheet/commit/fb43a56222c3d4c77b84efa9ff37eed8e1333a1a)) -* **hook function:** cellupdate ([5e8f71f](https://github.com/mengshukeji/Luckysheet/commit/5e8f71f32e5104769dbe6e0c61de3cd26b286344)) -* ie11右下角菜单图标会出现错位 ([34fd6e7](https://github.com/mengshukeji/Luckysheet/commit/34fd6e74cb87f9563ff28979d9f5f8a192fb558a)) -* 重复create会出现很多问题 ([8f22790](https://github.com/mengshukeji/Luckysheet/commit/8f227904fe9600ea17fdc346924d73c3bc81a041)) - -### [2.1.6](https://github.com/mengshukeji/Luckysheet/compare/v2.1.5...v2.1.6) (2020-11-23) - - -### ⚠ BREAKING CHANGES - -* yes - -q - -### Features - -* **api:** hook function ([a0db530](https://github.com/mengshukeji/Luckysheet/commit/a0db530295bca24b81b02171a073f6b6f1227ce6)) -* **hook:** add hook function ([215dec2](https://github.com/mengshukeji/Luckysheet/commit/215dec27d796ee9b5be7857a425093a53db84332)) -* q ([54a42a2](https://github.com/mengshukeji/Luckysheet/commit/54a42a274a96eb3334602fd0de65e1d4b2fc492a)) -* **bottom alignment of english letters:** fix ([a596d2f](https://github.com/mengshukeji/Luckysheet/commit/a596d2fcd617cac196e3336a8dfe8ac9ba58c9f7)) -* **config:** sheetRightClickConfig ([59c7cb3](https://github.com/mengshukeji/Luckysheet/commit/59c7cb34a33450e59023fd1ae5e615f3e40ef0d9)) -* add underline button ([df56ba6](https://github.com/mengshukeji/Luckysheet/commit/df56ba6f359bb12eb765b26b973100c554601eca)) -* use npm dependencies ([e4bd439](https://github.com/mengshukeji/Luckysheet/commit/e4bd439a0e96dbec0cb3a45e01aaecb129fab2ad)) -* **row and column width:** batch change the height and width of the selected row and column ([956bd2a](https://github.com/mengshukeji/Luckysheet/commit/956bd2a01012b429c58a14b5b88d02a02350b662)) - - -### Bug Fixes - -* **bug fix:** [#26](https://github.com/mengshukeji/Luckysheet/issues/26) [#91](https://github.com/mengshukeji/Luckysheet/issues/91) ([a26ffd8](https://github.com/mengshukeji/Luckysheet/commit/a26ffd8ac388db475dfd38e4ae83098eeeee8bc8)) -* **cooperative:** bug ([9e48c72](https://github.com/mengshukeji/Luckysheet/commit/9e48c72a47022188d387558b5b5f3a6250878c65)) -* **demo:** ie11 ([e7ddc39](https://github.com/mengshukeji/Luckysheet/commit/e7ddc397c8b1e421c63f3e9f661ced99a3d81556)), closes [#234](https://github.com/mengshukeji/Luckysheet/issues/234) -* **fix #212:** cancel highlight ([289d3ef](https://github.com/mengshukeji/Luckysheet/commit/289d3ef46ebadf9662d272109a1f24d2a8b0dc1d)), closes [#212](https://github.com/mengshukeji/Luckysheet/issues/212) -* **fix #219:** checkout ([15dca04](https://github.com/mengshukeji/Luckysheet/commit/15dca040840d228f6326d4eecad917df38e15f04)), closes [#219](https://github.com/mengshukeji/Luckysheet/issues/219) -* **fix #219:** clear info ([080f027](https://github.com/mengshukeji/Luckysheet/commit/080f0275b80143026cc30e8450c901715fc51c19)), closes [#219](https://github.com/mengshukeji/Luckysheet/issues/219) -* sheet menu position ([a40f679](https://github.com/mengshukeji/Luckysheet/commit/a40f679fde6700c90cd66c66bb070afabb31fb83)) -* **iconfont:** conflict ([bf4d539](https://github.com/mengshukeji/Luckysheet/commit/bf4d539dddc4cef232f8eae602b39980ded5b208)) -* **mousemove hook error:** fix ([89b93e7](https://github.com/mengshukeji/Luckysheet/commit/89b93e71460750be8f736df0dbc13675daf5d72d)) - -### [2.1.5](https://github.com/mengshukeji/Luckysheet/compare/v2.1.4...v2.1.5) (2020-11-03) - - -### Features - -* **cell date picker:** cell date picker and bug solve ([2996ae9](https://github.com/mengshukeji/Luckysheet/commit/2996ae9cab724714903d00e0b63022abc4a1a3b6)) -* **cell hooks add:** go to document for detail ([927ff46](https://github.com/mengshukeji/Luckysheet/commit/927ff46949f688a5bcffcb3fe48dc6b4b12b61c9)) -* **config:** custom menu button config ([14eb78e](https://github.com/mengshukeji/Luckysheet/commit/14eb78e153cbce726adf9e093702f9b93af1fa03)) -* **config:** sheetbar ([3555746](https://github.com/mengshukeji/Luckysheet/commit/3555746f4cc8ef2c1fe163a34edd428f1a6377ed)) -* **date format:** date format Chinese ([8f8d0cb](https://github.com/mengshukeji/Luckysheet/commit/8f8d0cb8c5563a31afba3fe11b525e6bccd5eb56)) -* **hyperlink:** add hyperlink function ([439dff4](https://github.com/mengshukeji/Luckysheet/commit/439dff4330ab5053643331286091d44ae910fb8d)) -* **hyperlink:** perfect hyperlink function ([5adfc60](https://github.com/mengshukeji/Luckysheet/commit/5adfc6055bf4cfed7f1ff40933d292057196bc7e)) -* **statisticbar:** config docs ([c1ed417](https://github.com/mengshukeji/Luckysheet/commit/c1ed417074e89e665f9ef39ee186db9106904c4e)) -* **tojson:** api/docs ([8e410f5](https://github.com/mengshukeji/Luckysheet/commit/8e410f5d3cd61724230b3024898d6de3c6c41101)) - - -### Bug Fixes - -* **bug:** bug ([ad73f9a](https://github.com/mengshukeji/Luckysheet/commit/ad73f9a679d77721d8af0a483dffe70b90e56412)), closes [#129](https://github.com/mengshukeji/Luckysheet/issues/129) -* **bug:** bug ([801cbe5](https://github.com/mengshukeji/Luckysheet/commit/801cbe5a8040d80f2e672b3607c0b92c922281a9)) -* **bug:** bug ([f8716c1](https://github.com/mengshukeji/Luckysheet/commit/f8716c18db05c7ab8bf59d1feb0dc4c3b364c560)), closes [#67](https://github.com/mengshukeji/Luckysheet/issues/67) [#85](https://github.com/mengshukeji/Luckysheet/issues/85) -* **bug:** bug ([0909f5e](https://github.com/mengshukeji/Luckysheet/commit/0909f5e4c957e3d3248a8c86d6e092c5a5396112)), closes [#142](https://github.com/mengshukeji/Luckysheet/issues/142) [#132](https://github.com/mengshukeji/Luckysheet/issues/132) -* **bug:** dataVerification and sheet move and delete cell bug ([4815d86](https://github.com/mengshukeji/Luckysheet/commit/4815d86ce564da43aa1ced3b48d38e88afc39f77)) -* **conflict:** conflict ([b11de26](https://github.com/mengshukeji/Luckysheet/commit/b11de26c4d2dbdd7e9d4363558e95d4433f26585)) -* **conflict:** toolbar ([8cfa6ac](https://github.com/mengshukeji/Luckysheet/commit/8cfa6ac1bec8bcb156fe45e8c488aa7026b65738)) -* **fix bug with inline string rotate wrap:** add change to max, fix height error ([1988687](https://github.com/mengshukeji/Luckysheet/commit/198868719ffb19738ee5ecc1ee060a0840fa92df)) -* **hide row/column:** right click menu ([8070858](https://github.com/mengshukeji/Luckysheet/commit/8070858f6c35f11ee8cf2692d8828d0e78c46d92)), closes [#37](https://github.com/mengshukeji/Luckysheet/issues/37) -* **restore demo:** restore demo ([e799862](https://github.com/mengshukeji/Luckysheet/commit/e7998627400b82bf082bad3c984f4d26e3c9f43a)) - -### [2.1.3](https://github.com/mengshukeji/Luckysheet/compare/v2.1.2...v2.1.3) (2020-10-22) - - -### Features - -* **api add:** getRowHeight getColumnWidth getDefaultRowHeight getDefaultColumnWidth ([a72f38b](https://github.com/mengshukeji/Luckysheet/commit/a72f38b641a999bdf15281029777222e0bf79e85)) -* **api add:** setRowHeight setColumnWidth setSheetZoom setDataVerification deleteDataVerification ([0fd06cc](https://github.com/mengshukeji/Luckysheet/commit/0fd06cc4d7f465967b3bcc91e0b2484ba61b71f6)) -* **api add:** setSheetOrder refresh getScreenshot setWorkbookName undo redo ([b2a4617](https://github.com/mengshukeji/Luckysheet/commit/b2a46171c2cfcd9682537a801a1ea68e7e2d3ba0)) -* **api and config:** api exitEditMode() scroll() config defaultFontSize ([5eedc48](https://github.com/mengshukeji/Luckysheet/commit/5eedc48a764727bebe09fd626087b158b2979c1e)) -* **support spanish:** support Spanish ([41c527c](https://github.com/mengshukeji/Luckysheet/commit/41c527c6f39a8cb3a99d3fc70603f29ab7ba0a82)) - - -### Bug Fixes - -* **api:** api ([14d72eb](https://github.com/mengshukeji/Luckysheet/commit/14d72ebe56a2f87f0df5d14595c60e41fe9af077)) -* **bug:** postil image zoom ([76dbb5c](https://github.com/mengshukeji/Luckysheet/commit/76dbb5cc613c8290696e917c554aff934050b6a2)) -* **destroy function repaire:** repair ([02b9fe7](https://github.com/mengshukeji/Luckysheet/commit/02b9fe75f28a87a475bd0593522b20d030d31b85)) -* **event name:** fix ([f64ba54](https://github.com/mengshukeji/Luckysheet/commit/f64ba54455e2a757c72fb4c0110fef2cc5ccdaab)) -* **fix focus after formula edit:** fix ([0ee5f31](https://github.com/mengshukeji/Luckysheet/commit/0ee5f31f5ce84c1a7fab2af17ff102790603e3bb)) -* **fix text whole text wrap bug:** fix ([ef3d324](https://github.com/mengshukeji/Luckysheet/commit/ef3d324e80bc648080b1e5a53108b30dccf74520)) -* **function array value error:** fix it ([31e4b3d](https://github.com/mengshukeji/Luckysheet/commit/31e4b3d9e4cf16f005f8cede059b7cb1cab05031)) -* **function update fix:** fix bug ([28835bb](https://github.com/mengshukeji/Luckysheet/commit/28835bb7533087eb16866b4cdaebe94231c7832b)) -* **image:** resize and change row or column size ([05c49a2](https://github.com/mengshukeji/Luckysheet/commit/05c49a2fad21706ee7e232fe75d213fed3724109)) -* **image fuzzy:** fix it ([8fb1a88](https://github.com/mengshukeji/Luckysheet/commit/8fb1a88669d772a0067edb614e5974ada7301c9c)) -* **image zoom:** fix ([1337178](https://github.com/mengshukeji/Luckysheet/commit/1337178a991b4aa99a6e255e50d69e2c8ca47b82)) -* **index offset indirect fix:** improve the overall execution efficiency of the function ([7a2f8d0](https://github.com/mengshukeji/Luckysheet/commit/7a2f8d02daf2cc0180adc56dafcfb1d1f6d022ec)) -* **inline style:** inline style cell delete bug ([8067a01](https://github.com/mengshukeji/Luckysheet/commit/8067a012ec59a39c5a389d357c3ba2c19bc6acb9)) -* **lineheight change to 0.5:** similar to excel ([760378b](https://github.com/mengshukeji/Luckysheet/commit/760378b369b9bf71da0182ea3b413a0accb23c38)) -* **more btn:** fix more btn align middle ([c5112e9](https://github.com/mengshukeji/Luckysheet/commit/c5112e9700cd89d4820cbbbefdc0e1d3d0ed940a)) -* **more formats toolbar:** fix more formats toolbar can't sync with cell, fix mac delete button can't delete cell, fix can't delete cell with inline-style ([23fcb13](https://github.com/mengshukeji/Luckysheet/commit/23fcb137cb594cfb4bc6dfe2ac86d306c42427f9)) -* **selection bug:** fix it ([b83447d](https://github.com/mengshukeji/Luckysheet/commit/b83447d61805192d0310b20e97821eb01b790fb7)) -* **setcellvalue delete function fix:** fix it ([00b351f](https://github.com/mengshukeji/Luckysheet/commit/00b351fa0dc01c32cf9c6b8852937e7d2ceb292d)) -* **sheet name contains squotes bug:** formla can not execute, when sheet name contains squotes ([fc1dd83](https://github.com/mengshukeji/Luckysheet/commit/fc1dd837d4a3d1639914923201e853e55a865143)) -* **text wrap postion bug:** wrap and rotation postion wrong ([9538972](https://github.com/mengshukeji/Luckysheet/commit/9538972f910ed77e02ccb55c0b96386fcf87297b)) -* **the bug with first word is space:** fix ti ([6ae8319](https://github.com/mengshukeji/Luckysheet/commit/6ae83196cb50fafbf5657104babd124fac27b818)) -* **update number add quote automatically:** similar to excel ([05b01a6](https://github.com/mengshukeji/Luckysheet/commit/05b01a6c95a5d0736c51c5c1ca41e9eb463122d8)) -* **validation of "0" values:** fix ([7255c51](https://github.com/mengshukeji/Luckysheet/commit/7255c51d7b46523ff423ee5560b78d18f8535821)) - -## [2.1.0](https://github.com/mengshukeji/Luckysheet/compare/v2.0.0...v2.1.0) (2020-10-10) - - -### ⚠ BREAKING CHANGES - -* **frozen,docs:** when init workbook and sheet has frozen row or column,you need init sheet's -property frozen - -### Features - -* **add autocalculationmerge sheet attribute:** it can auto calculate merge infomation ([f7e30cf](https://github.com/mengshukeji/Luckysheet/commit/f7e30cf946f9c5945fd7e69bf4a3273f54e2616f)) -* **add force cacultion formula:** add forceCaculate parameter ([4dd82ad](https://github.com/mengshukeji/Luckysheet/commit/4dd82ad131e0a936c040852657b05ffd53e4b465)) -* **api:** add some api functions ([37910ab](https://github.com/mengshukeji/Luckysheet/commit/37910abea38dc37fcb5cc5b905c7b028e3390c10)) -* **api:** api ([6f7ca26](https://github.com/mengshukeji/Luckysheet/commit/6f7ca26ba22c47ed0746363dccfd1e392040aed9)) -* **api:** api ([66aecbe](https://github.com/mengshukeji/Luckysheet/commit/66aecbe7fe16be03c9c62e1ebbf941c1a9f4bac7)) -* **api:** provides an api for users ([b176753](https://github.com/mengshukeji/Luckysheet/commit/b176753ceacba3ab8a243bfe27c5ea8d9455d617)) -* **api add:** api add ([e4198fa](https://github.com/mengshukeji/Luckysheet/commit/e4198fa5bda4f6787a3153a113d2be10cfe64fd5)) -* **api add:** deleteRangeConditionalFormat clearRange deleteRange ([44cf72a](https://github.com/mengshukeji/Luckysheet/commit/44cf72a1c7592ac5227a92c3e325e7f5088bca30)) -* **api add:** setSheetDelete setSheetCopy setSheetHide setSheetShow setSheetName setSheetColor ([62f641f](https://github.com/mengshukeji/Luckysheet/commit/62f641fe7f519b8679c4e006427a74e2e17a8f98)) -* **data verification:** data verification ([a661d30](https://github.com/mengshukeji/Luckysheet/commit/a661d303101ee6ebedf22aabb60f7a5a50722b0e)) -* **data verification:** data verification ([9cbbbce](https://github.com/mengshukeji/Luckysheet/commit/9cbbbce556444182536bf0a0641c5db22d4a6007)) -* **delete cell:** delete cell ([d7de718](https://github.com/mengshukeji/Luckysheet/commit/d7de718d5e6e6308cae1ccf7a7699c3f7d790d8f)) -* **draw use sacle:** cancel manual devicePixRatio, use context sacle ([c832283](https://github.com/mengshukeji/Luckysheet/commit/c832283c9709a8393f2c6b74d50e984c7720bb34)) -* **drawmain efficiency optimization:** efficiency optimization ([37080fa](https://github.com/mengshukeji/Luckysheet/commit/37080faa39dccb23539d346080baf07ad367c2d7)) -* **editor box position fit:** show diffrent position acording to align ([636046d](https://github.com/mengshukeji/Luckysheet/commit/636046dbb2f005c2e6110b3559b72a59a7c67d87)) -* **fix:** fix ([9830714](https://github.com/mengshukeji/Luckysheet/commit/983071467d21a5eb1a35c0c427005e95364128db)) -* **hide column:** hide column ([9f05959](https://github.com/mengshukeji/Luckysheet/commit/9f05959d4d5fea7fc26e0cedb7217f0be92bcae9)) -* **image:** copy and paste ([33d6c96](https://github.com/mengshukeji/Luckysheet/commit/33d6c961bb2d88fa1ba73448c2b808957f750544)) -* **image insert:** image insert ([4232dfc](https://github.com/mengshukeji/Luckysheet/commit/4232dfc7832846013e623d13f6157ee1e371bda3)) -* **inline string:** finished ([325b66c](https://github.com/mengshukeji/Luckysheet/commit/325b66ccd0e7508535f16a7dfc51acba622cfc14)) -* **inline string:** operation like excel ([9ac9f08](https://github.com/mengshukeji/Luckysheet/commit/9ac9f08acf088b614b5318000df2e0d442df21fd)) -* **inline string:** when focus cell, show inline string content ([713805c](https://github.com/mengshukeji/Luckysheet/commit/713805cd031ccdf3e5ef1b70da504b635fed85fa)) -* **inline string render finished:** begin to develop edit feature ([2ffd9ae](https://github.com/mengshukeji/Luckysheet/commit/2ffd9aedd82e9abaf32b374337503f25d56fd9da)) -* **insert image:** insert image ([cf3ba93](https://github.com/mengshukeji/Luckysheet/commit/cf3ba930cadc90e3fc753ac30154974e74089cfc)) -* **insert image perfect:** insert image perfect ([ad0a88a](https://github.com/mengshukeji/Luckysheet/commit/ad0a88a8d412202692ce1611f6ac7fe4ac30d2e9)) -* **mobile touch event optimized:** very smooth, good experience ([0ed0bf6](https://github.com/mengshukeji/Luckysheet/commit/0ed0bf63ba06895a2ea39c581d0180db6c0d9266)) -* **new style:** new style ([5c8d603](https://github.com/mengshukeji/Luckysheet/commit/5c8d603fc41e9c214cb3dca84a147b39f2f6ce06)) -* **optimization function:** setCellvalue support any cell param ([9b208e4](https://github.com/mengshukeji/Luckysheet/commit/9b208e4e2eeeaae09dbe75b245c989f98747613a)) -* **protection feature:** protection feature similar to Excel ([a71c92a](https://github.com/mengshukeji/Luckysheet/commit/a71c92a5f05aaed6c3df1556a81fc1b2ed97419a)) -* **zoom feature beta:** zoom in and zoom out sheet ([249aa02](https://github.com/mengshukeji/Luckysheet/commit/249aa02fa6c74eb854034ee0913a73267b6057cc)) -* **zoom gui:** zoom plus and minus, restore origin, slider ([d70dab4](https://github.com/mengshukeji/Luckysheet/commit/d70dab4938ff33e1fcefdd15492279347efe6b33)) -* **zoom redo undo suport:** redo undo ([4d03906](https://github.com/mengshukeji/Luckysheet/commit/4d0390675f3aa021f7e15bf529a8102830878202)) - - -### Bug Fixes - -* **a few bug fix:** fix ([f07e25d](https://github.com/mengshukeji/Luckysheet/commit/f07e25d0010775b71c1e73cd3ed2db6413d661ca)) -* **add button bug:** fix ([3250ef6](https://github.com/mengshukeji/Luckysheet/commit/3250ef69606d24518d7b615806c1210c2ce0a684)) -* **allowedit dont work ,when press del:** allowEdit dont work ,when press DEL ([10dccec](https://github.com/mengshukeji/Luckysheet/commit/10dcceccc7f5f04afe70adebb4db59046382abb6)) -* **array unique very slow:** fix it ([20f3cb3](https://github.com/mengshukeji/Luckysheet/commit/20f3cb3e2028e455b49a4d1947ac8f02186363af)) -* **big data slowly:** speed up ([5109873](https://github.com/mengshukeji/Luckysheet/commit/5109873500996ac4e17abb95899f1fe5950f33b9)) -* **blank border position:** fix ([d285d9f](https://github.com/mengshukeji/Luckysheet/commit/d285d9fb5e3ff74385debaf493ad6125173644a4)) -* **bug:** bug ([6bb113b](https://github.com/mengshukeji/Luckysheet/commit/6bb113bb4421fc0497f7cf833975e4e2e7544aaa)) -* **bug:** bug ([4806de8](https://github.com/mengshukeji/Luckysheet/commit/4806de8de501c08bde6e69be1779b3327ecf2364)) -* **bug:** bug ([0cb1ec2](https://github.com/mengshukeji/Luckysheet/commit/0cb1ec23c26e2393a14475d982349a310587e7a7)) -* **bug:** bug ([735d1c8](https://github.com/mengshukeji/Luckysheet/commit/735d1c8b5c3777615b20795f70e867e576b8afbf)) -* **bug:** bug ([ad1ac61](https://github.com/mengshukeji/Luckysheet/commit/ad1ac6154502193a7e34177a08ce678522d08a03)) -* **bug:** bug ([27d1be0](https://github.com/mengshukeji/Luckysheet/commit/27d1be0037c2bd5ba290e7b0f9db229de04582d9)) -* **bug:** bug ([dea7bbf](https://github.com/mengshukeji/Luckysheet/commit/dea7bbf44414be31191841443119a3505003522e)) -* **bug:** bug ([061ea20](https://github.com/mengshukeji/Luckysheet/commit/061ea2003dca838dffb9ee92d1c43f28c64a9978)) -* **bug:** bug ([ba0b047](https://github.com/mengshukeji/Luckysheet/commit/ba0b04752f35f32df82229339bdb3f295fbcecb2)) -* **bug:** bug ([7263008](https://github.com/mengshukeji/Luckysheet/commit/726300811a9fdb6e36d19187764aa73daacfc7b7)) -* **bug:** bug ([c578c0e](https://github.com/mengshukeji/Luckysheet/commit/c578c0e34b6e589dba2ef29146d894b5c6333676)) -* **bug:** bug ([fc8f61b](https://github.com/mengshukeji/Luckysheet/commit/fc8f61b0154f2220c233e680eaf814edfce3a52b)) -* **bug:** bug ([fb3b512](https://github.com/mengshukeji/Luckysheet/commit/fb3b5122a5f4e333cca581251ef6d672da767b37)) -* **bug:** bug ([6236e5e](https://github.com/mengshukeji/Luckysheet/commit/6236e5e8d6621c0ad829206704bdc2fac684d3bc)) -* **bug:** bug ([f057d7d](https://github.com/mengshukeji/Luckysheet/commit/f057d7d281fccc7094c4f806c4590dca39cfbaa0)) -* **bug fix:** [#55](https://github.com/mengshukeji/Luckysheet/issues/55) [#50](https://github.com/mengshukeji/Luckysheet/issues/50) [#54](https://github.com/mengshukeji/Luckysheet/issues/54) ([5caf2b0](https://github.com/mengshukeji/Luckysheet/commit/5caf2b028c962e8ca2e6bd1c92fed3e6a9fb462d)) -* **bug fix:** pivotTable blank title disapear, merge cell is recognized as range ([47fe25c](https://github.com/mengshukeji/Luckysheet/commit/47fe25c32107e719115a98ceef2ed97ae6161f3b)) -* **bugs:** fix issue [#27](https://github.com/mengshukeji/Luckysheet/issues/27) [#29](https://github.com/mengshukeji/Luckysheet/issues/29) ([5d57267](https://github.com/mengshukeji/Luckysheet/commit/5d572676d46692719309c20e536d001ccfe2cd2f)) -* **celloverflow border bug:** celloverflow border bug ([86403c2](https://github.com/mengshukeji/Luckysheet/commit/86403c20b329ea4106d6498c33927b714e22941b)) -* **change sheet:** change sheet must setTimeOut ([e51457e](https://github.com/mengshukeji/Luckysheet/commit/e51457ef492ae74b77a0298931268b9f14feaa44)) -* **change sheet bug:** multiple refresh canvas bug ([7a625e0](https://github.com/mengshukeji/Luckysheet/commit/7a625e0dae187cc7af8e10e3449abf666fd332eb)) -* **change sheet scroll bar fix:** change sheet scroll bar dont restore ([02d2655](https://github.com/mengshukeji/Luckysheet/commit/02d26557a52b7cef0cb3b2b8d14996eb29fafa51)) -* **chart:** chart ([2be467d](https://github.com/mengshukeji/Luckysheet/commit/2be467d6a4b385d7d7bb0585c9be7a227614a04b)) -* **cloumn and row highlight bug:** column and row highlight bar disapear ([c806211](https://github.com/mengshukeji/Luckysheet/commit/c80621118e28f711b1513c869da36989c1a70c8f)) -* **columlen:** columlen ([b656c27](https://github.com/mengshukeji/Luckysheet/commit/b656c27a3971b756ea809f4c1010ae28310569da)) -* **copy cut paste bug:** bug fix ([ade56d5](https://github.com/mengshukeji/Luckysheet/commit/ade56d5b5ff38dd5095234b71bc89927841fa387)) -* **demo fix:** fix ([3d17426](https://github.com/mengshukeji/Luckysheet/commit/3d174260e27793d1634c5f15b83a4aa9ca4100de)) -* **demo fix:** fix ([732f678](https://github.com/mengshukeji/Luckysheet/commit/732f6788bcff9ddcf4b0e6bc266b3be9e28eea41)) -* **demo fontlist url change:** local path ([feb89b3](https://github.com/mengshukeji/Luckysheet/commit/feb89b301b116745e82a2b17071909d7a4873562)) -* **filter option bug:** position error ([3324512](https://github.com/mengshukeji/Luckysheet/commit/33245124be8972d1e011c047caf657275ac76916)) -* **fix:** bug fix ([52375dc](https://github.com/mengshukeji/Luckysheet/commit/52375dcb416f435a1adea1fa3abeb486a73d513f)) -* **fix:** fix ([194dea1](https://github.com/mengshukeji/Luckysheet/commit/194dea17672cc15e76b364b788f0818299b5e64c)) -* **fix bug:** param dont remenber change ([0425e4e](https://github.com/mengshukeji/Luckysheet/commit/0425e4eef2c585873a61efe9ee34496aab40b810)) -* **fix bugs:** fix ([bbaafe0](https://github.com/mengshukeji/Luckysheet/commit/bbaafe0d68d670b7621d616db5f91394ded8f573)) -* **fix index.html:** fix ([e980cd9](https://github.com/mengshukeji/Luckysheet/commit/e980cd91afee781a004d7e207283e41990b4e45c)) -* **fix number to column title bug:** if column title is big , it will show undefined ([2d6e73e](https://github.com/mengshukeji/Luckysheet/commit/2d6e73eb3fba5ebd85b76d22ba4ffdc9c5197b58)) -* **fix touch:** touch fix ([d884a69](https://github.com/mengshukeji/Luckysheet/commit/d884a698d6f62aa21bea7d76705682e7406e7973)) -* **fix wrap bug:** alt + enter twice bug ([789bab5](https://github.com/mengshukeji/Luckysheet/commit/789bab5e5d712af889577ed141387c02a049f21f)) -* **float calculate bug:** fix it ([ef2a96a](https://github.com/mengshukeji/Luckysheet/commit/ef2a96a7cd6d341810b99698f26063862cf33e35)) -* **fonts bug on ie:** fit it ([f9a1546](https://github.com/mengshukeji/Luckysheet/commit/f9a1546ca783c058994759dc3443d2e0d9929267)) -* **format of formula cell bug fix:** if cell has format , it is no effect ([1f6ebad](https://github.com/mengshukeji/Luckysheet/commit/1f6ebad36da9de608bc32bddc945a5e3bb68528d)) -* **formula -(1-2) error:** fix it ([dee2333](https://github.com/mengshukeji/Luckysheet/commit/dee2333b295aa63fae544c075a98f993c1c3e84c)) -* **formula bug:** formula bug ([6c84420](https://github.com/mengshukeji/Luckysheet/commit/6c84420ad4461281ba87378af41cde0e5a7fee93)) -* **formula efficiency up:** speed up ([d05151f](https://github.com/mengshukeji/Luckysheet/commit/d05151f474145cb765a60b2f118c222f8b488efb)) -* **formula initialization bug:** if formula has cross sheet param, initial this ([c5f6254](https://github.com/mengshukeji/Luckysheet/commit/c5f6254bccd89a90abfa3a6d6728416983ebbb4c)) -* **frozen bug:** fix ([91daa07](https://github.com/mengshukeji/Luckysheet/commit/91daa07ec94255f9135d423aa17d9425c0ffe58d)) -* **frozen bug and style change:** fix bug ([7cfd0d9](https://github.com/mengshukeji/Luckysheet/commit/7cfd0d914c8999cfd4dbb2bca50f5766645cb108)) -* **frozen,docs:** frozen,docs ([e1bd844](https://github.com/mengshukeji/Luckysheet/commit/e1bd844749fa05a7b178565a90bbdba0c81ce1fe)) -* **function box input bug:** editor box and function box fix ([4ebb79d](https://github.com/mengshukeji/Luckysheet/commit/4ebb79d67f50dc46f97bc64a0cef0ba8d44e5c12)) -* **green label size fix:** fix ([b0734b5](https://github.com/mengshukeji/Luckysheet/commit/b0734b57bb42c55e99eb831c0ca24053ea4aa6a8)) -* **hide row and column fix:** add lines ([c430d66](https://github.com/mengshukeji/Luckysheet/commit/c430d6625a23b0f4b8ef903ae62e82833ed0618f)) -* **hot key bug fix:** range bug when formula move selection ([f4625d1](https://github.com/mengshukeji/Luckysheet/commit/f4625d1dc38d6f69fddb0ae131d54f65bd7bcbd7)) -* **image background opacity:** fix ([d61d3a0](https://github.com/mengshukeji/Luckysheet/commit/d61d3a07e55978350e9e5171537fee1457847209)) -* **image,config:** image,config ([2dddfaa](https://github.com/mengshukeji/Luckysheet/commit/2dddfaa8f1a13476f512db0e0d27742ebebb7f35)) -* **inline string bug:** style lost when change cell to inline string, input error ([405d90b](https://github.com/mengshukeji/Luckysheet/commit/405d90bfec0c7b47dee64e2034aeec8686c53e32)) -* **inline string finished:** fix some bus ([57e7518](https://github.com/mengshukeji/Luckysheet/commit/57e75188ffb718e92251cb9813ae47b467410889)) -* **inline string space dont recognize:** fix it ([ddc5c5d](https://github.com/mengshukeji/Luckysheet/commit/ddc5c5dde9a4d4db2ee42207383d696c12c58249)) -* **input range bug:** fix it ([5412721](https://github.com/mengshukeji/Luckysheet/commit/5412721675598979689e4de31ec37c2e807c7c16)) -* **jquery error:** jquery error ([1a2fed9](https://github.com/mengshukeji/Luckysheet/commit/1a2fed99871d79bcb895af1796909ee3e286e05f)) -* **menubutton.js fonts:** fix bug ([1e62de3](https://github.com/mengshukeji/Luckysheet/commit/1e62de3d2f358e99373259600c736ca83601d2ba)) -* **mobile text dose not display:** fix bug ([19922c7](https://github.com/mengshukeji/Luckysheet/commit/19922c76dd6afc4991ca3816262d40a6659baa5f)) -* **mobile touch:** moubile touch fix ([04e2b8e](https://github.com/mengshukeji/Luckysheet/commit/04e2b8e06965673f807a46fbcda2a403711ec7ea)) -* **my english is pool:** fix ([26ff1fd](https://github.com/mengshukeji/Luckysheet/commit/26ff1fd21180e2c795dcc24ed4d4aa2d5ba1f689)) -* **no fullscreen bug:** when no fullscreen , div go to top ([64f7d0e](https://github.com/mengshukeji/Luckysheet/commit/64f7d0e6c44c24f21e6e7d8d16beac6f23a5d770)) -* **normal style change bug:** fit error ([f24eb7f](https://github.com/mengshukeji/Luckysheet/commit/f24eb7f69c5c9ae53832f130a27473a686720e72)) -* **offset indirect formula fix:** fix bug ([d8dfe50](https://github.com/mengshukeji/Luckysheet/commit/d8dfe50782108745e5f132c0bbb1438f7180d198)) -* **old chrome dont surport actualboundingboxascent:** fix it and make it beautiful ([5c503d8](https://github.com/mengshukeji/Luckysheet/commit/5c503d851945d5ece1d69c2da8fa26c330d13930)) -* **paste bug:** fixed ([76d966f](https://github.com/mengshukeji/Luckysheet/commit/76d966f27eb7632061b97a438d07a63f88704878)) -* **pivot table bug:** bug ([9fcc209](https://github.com/mengshukeji/Luckysheet/commit/9fcc209b936eed2057a09b1f070d62832c9801b1)) -* **pivot table change sheet bug:** if prevous sheet is pivot table and pennel is closed, change bug ([7cac8e6](https://github.com/mengshukeji/Luckysheet/commit/7cac8e62631d90bea0521498e9980234fde88fc3)) -* **pivot table filter bug:** change sheet bug ,after filter pivot table ([c7c1999](https://github.com/mengshukeji/Luckysheet/commit/c7c1999081289c70b6e575e9e37fae82bdfe438c)) -* **pivot table show error:** when column area have field and row area is null,pivot table show error ([04bc51c](https://github.com/mengshukeji/Luckysheet/commit/04bc51cf8dc5ff24fc5d71b3bbf755a9787ca57d)) -* **remain cell style in inline string mode:** click cell and change cell style like to Excel ([7d0438a](https://github.com/mengshukeji/Luckysheet/commit/7d0438a10db44f371c23daccb9c066f30773e307)) -* **render:** render ([40550d6](https://github.com/mengshukeji/Luckysheet/commit/40550d6e59c44e0f47e23f8b5fac4c5e79a5c122)) -* **render bug fix:** new render method ([a1bcf81](https://github.com/mengshukeji/Luckysheet/commit/a1bcf81562ebc8c8327baad01d5e814e23fae647)) -* **rotate text position mistake, when sheet zoom:** fix zoom bug, fix strike and underline bug ([6680a13](https://github.com/mengshukeji/Luckysheet/commit/6680a134252a65b346b0a99142998ced277e8adf)) -* **scroll bug:** scroll bug ([3637fa4](https://github.com/mengshukeji/Luckysheet/commit/3637fa4121340e6278f12104e7877c450e92d511)) -* **several bug and new feature:** formula calculation , quotePrefix add ([5a95304](https://github.com/mengshukeji/Luckysheet/commit/5a95304289714d130501faae352dc07fb21dbf68)) -* **sheet change arrow:** fix bug ([4a7850b](https://github.com/mengshukeji/Luckysheet/commit/4a7850b86ef1086fe18fa7961a62bbc622ed760d)) -* **splines and dynamicarray bug fix:** formula calculation update is finished ([a59aa04](https://github.com/mengshukeji/Luckysheet/commit/a59aa04e4db70e3d90c6109a18ea6a7d2747c156)) -* **ssf column resize:** change ([2a09f59](https://github.com/mengshukeji/Luckysheet/commit/2a09f5977e35a388c42d4b43d7fbe6df891234db)) -* **store cache:** bug fix ([cbd9014](https://github.com/mengshukeji/Luckysheet/commit/cbd90140e0aae293b40724bce692b861047d47c3)) -* **text get wrong height when zoom:** fix height ([106f1fd](https://github.com/mengshukeji/Luckysheet/commit/106f1fd111a75778a2c61424290f33295cec9964)) -* **toolbar:** menu button style ([d18478c](https://github.com/mengshukeji/Luckysheet/commit/d18478c0e11cdce994d585be216b9ad95836f073)) -* **underline and cancelline:** add and fix ([d3f23ff](https://github.com/mengshukeji/Luckysheet/commit/d3f23fffd72f95b241710e9fdf1a70113502a815)) -* **undo redo bug fix:** formula update bug ([373dc4f](https://github.com/mengshukeji/Luckysheet/commit/373dc4f464d8bd106408ce28bd48b9e44b310b5f)) -* **update demo:** fix ([e101b91](https://github.com/mengshukeji/Luckysheet/commit/e101b91c4a4a427a83ef727f2e8c2e8166124485)) -* **updatecell bug fix:** fix undo redo ([d8b76ce](https://github.com/mengshukeji/Luckysheet/commit/d8b76ce52f25d9fc487ca62b7007c049a4a80160)) -* **websocket bux:** bug ([4eda52a](https://github.com/mengshukeji/Luckysheet/commit/4eda52ac89587515d6a20574c0711fe22de0a8c0)) -* **zoom scroll position wrong:** fix ([5830e9a](https://github.com/mengshukeji/Luckysheet/commit/5830e9af5a9c8757f55a18b34af2f08ce02f2351)) -* **zoom slider drag lag:** fix lag ([17ddd13](https://github.com/mengshukeji/Luckysheet/commit/17ddd13b2e87d3879fa49e1f3569f062400eb251)) - -## [2.0.0](https://github.com/mengshukeji/Luckysheet/compare/v2.0.0-0...v2.0.0) (2020-07-31) - - -### ⚠ BREAKING CHANGES - -* **api:** 1. luckysheet.flowdata change to luckysheet.flowdata() 2.all apis list in -documentation -* **gulp:** demo index.html's js and css refrence change -* **bug:** bug - -bug -* **chart:** add new config : plugins, array -* **main:** bug - -### Features - -* **cell overflow:** cell overflow ([c3e4f39](https://github.com/mengshukeji/Luckysheet/commit/c3e4f39919e68d99ad72c6a0ae104926acce6b23)) -* **chart:** chart ([9991702](https://github.com/mengshukeji/Luckysheet/commit/999170251810720fc4d44012bcc7c70c124463fd)) -* **chart:** chart plugin ([196362d](https://github.com/mengshukeji/Luckysheet/commit/196362db053a25ea0deaff14b5019e1450902ceb)) -* d ([07d004f](https://github.com/mengshukeji/Luckysheet/commit/07d004f9d63962dc3ad09a32a1d3c61866de5525)) -* **allowedit support:** allowEdit support ([59561bb](https://github.com/mengshukeji/Luckysheet/commit/59561bb3453469cbf86703672ec770187545459d)) -* **bug fix:** bu ([f23ba5d](https://github.com/mengshukeji/Luckysheet/commit/f23ba5df9b967cd9d8188680723c903ee467bb29)) -* **canvas:** canvas ([c63871f](https://github.com/mengshukeji/Luckysheet/commit/c63871fbeabb47d766320800d3bb8be47604690b)) -* **chart:** add chart ([139bc6e](https://github.com/mengshukeji/Luckysheet/commit/139bc6ea8510667c4900db6d1b5b26a33fb52734)) -* **gloabe improve and bug fix:** global improve and bug fix,include formula,find and replace,filter ([e6cfa31](https://github.com/mengshukeji/Luckysheet/commit/e6cfa3156ac2ec8989f3716601dc27bcfbdc4d13)) -* **globalization fix:** pivot table , drop cell ([55d4cf2](https://github.com/mengshukeji/Luckysheet/commit/55d4cf29868787a94377ea2e659da9e74e062628)) -* **locale:** locale ([4cd2ee4](https://github.com/mengshukeji/Luckysheet/commit/4cd2ee4cb3f115be9e2455a626469711d8be2c2e)) -* **move:** move chart ([cda6df0](https://github.com/mengshukeji/Luckysheet/commit/cda6df0209fb1d440e54d663de682f4749660917)) -* **optimiz:** optimization ([abbf592](https://github.com/mengshukeji/Luckysheet/commit/abbf592d2df320d8a44eb5375075cd65f4ef4066)) -* **rightclick menu perfect:** add rows and cols delete rows and cols hide rows and cols ([32f94a7](https://github.com/mengshukeji/Luckysheet/commit/32f94a72285d6051df87ce45390cb4e5a4cc49b2)) -* **scroll style fix beautify:** scroll,sheet color and style ([63f2630](https://github.com/mengshukeji/Luckysheet/commit/63f2630b95ab811807199670db6eee332af882a8)) -* **split handler.js to small file:** split handler.js file to seven files ([0a62ff0](https://github.com/mengshukeji/Luckysheet/commit/0a62ff0565d4116ae66a758386ef8d84dcfceba5)) -* **zh en:** zh en ([040bfe4](https://github.com/mengshukeji/Luckysheet/commit/040bfe4b456eb910dc7ddbcc3f5ae0e42d440951)) -* **zh-cn:** zh-cn ([907226c](https://github.com/mengshukeji/Luckysheet/commit/907226c74297882896f527b9c54a88a11d592a4d)) -* **zh-cn:** zh-cn ([01f9521](https://github.com/mengshukeji/Luckysheet/commit/01f9521ed37e11b2e9630b01b84583a45302fc77)) - - -### Bug Fixes - -* **bug:** bug ([7dff640](https://github.com/mengshukeji/Luckysheet/commit/7dff64086aaf034a8c427e37ef7b15da96e1123c)) -* **bug:** bug ([8baf378](https://github.com/mengshukeji/Luckysheet/commit/8baf378407f67684b77e62bacf6894e4359ed2d3)) -* **bug:** bug ([5ebd31e](https://github.com/mengshukeji/Luckysheet/commit/5ebd31e4a455c7547e46c418838e2e3a16def6a7)) -* **bug:** bug ([f53addb](https://github.com/mengshukeji/Luckysheet/commit/f53addbf70e96b45d73014d8e181c2712820b5c3)) -* **bug:** bug ([9cc36cf](https://github.com/mengshukeji/Luckysheet/commit/9cc36cf40ebb5a4f41b52f230e35d253f8261f69)) -* **bug:** bug ([186e3c9](https://github.com/mengshukeji/Luckysheet/commit/186e3c9a557a555d1737d456abf872622004f052)) -* **bug:** bug ([447735c](https://github.com/mengshukeji/Luckysheet/commit/447735c7ea365c2c292dd98a4fba8813a9a62d34)) -* **bug:** bug ([74639a8](https://github.com/mengshukeji/Luckysheet/commit/74639a8b719db028ab856f95a80d82553c0d919c)) -* **bug:** bug ([1082ab0](https://github.com/mengshukeji/Luckysheet/commit/1082ab0e2e84c7863ab29c7b68bb2d9934dcf11c)) -* **bug fix:** sparkLines, pivot Table, change to sheet ([69aee1a](https://github.com/mengshukeji/Luckysheet/commit/69aee1aec3200c75cb4897f0f782a945c2ef9fd1)) -* **canvas:** canvas,function ([2445ff5](https://github.com/mengshukeji/Luckysheet/commit/2445ff5094fe8da9f7d56612ceb06dd86b75b30e)) -* **fix:** fix ([bd6a9bd](https://github.com/mengshukeji/Luckysheet/commit/bd6a9bdd31cefe00a6470fbec9d10471d21fac9f)) -* **fix:** fix byg ([d9fb5fe](https://github.com/mengshukeji/Luckysheet/commit/d9fb5fe4c48637d2ac947fe8aa21d6a7ccde0264)) -* **fix allowedit:** fix allowEdit attribute ([35820b3](https://github.com/mengshukeji/Luckysheet/commit/35820b3c2ea8437036cfc32911acde9ff32c2fea)) -* **from github:** github ([abd44e8](https://github.com/mengshukeji/Luckysheet/commit/abd44e882e39bfb85c0e213e049325754bc3ba4f)) -* **hot key and mousemove:** hot key fix ([1ad40cf](https://github.com/mengshukeji/Luckysheet/commit/1ad40cf5521b7b3bd804c2c1f5f13fe6860ab95e)) -* **internationalization:** internationalization,formula ([c6901fc](https://github.com/mengshukeji/Luckysheet/commit/c6901fc884d14c5fb8f48a60192f1eb8ad26a485)) -* **linestyle bug:** lineStyle ([27ba0a3](https://github.com/mengshukeji/Luckysheet/commit/27ba0a3010865aa0e28158e661bcd6196bc1cfe4)) -* **locale:** locale bug ([3bd0cae](https://github.com/mengshukeji/Luckysheet/commit/3bd0cae0502e14c329304bfbf8c0f98c8e7b284e)) -* **locale finished and bug fix:** locale finished, condition bug fix , multi range bug fix ([0aa9b3b](https://github.com/mengshukeji/Luckysheet/commit/0aa9b3baa51c818ec2415b9d1c2e838ef32bdc85)) -* **locale,formula:** locale,formula ([b11b862](https://github.com/mengshukeji/Luckysheet/commit/b11b86295108d8b25ad2cd7b1ba016b3555cee0d)) -* **mac scroll x reverse fix:** mac scroll x reverse fix and scroll optimization ([8eb68e8](https://github.com/mengshukeji/Luckysheet/commit/8eb68e82e2898b1be2702f463c326a304bc96106)) -* **main:** bug ([67ebe19](https://github.com/mengshukeji/Luckysheet/commit/67ebe1978bf067c17c74e5b3b7b048055c53c0b4)) -* **pivot table bug:** uni ([56181e6](https://github.com/mengshukeji/Luckysheet/commit/56181e610085604666d96aa6068944e05355ec7d)) - - -### build - -* **gulp:** gulpfile,index.html,pack js css ([8be0467](https://github.com/mengshukeji/Luckysheet/commit/8be0467dea483be7be2a5af1bc3545a04a67ea72)) - - -* **api:** api ([f19a26e](https://github.com/mengshukeji/Luckysheet/commit/f19a26eab08bc44a5c380afd883d4e730f681062)) - -### [1.0.1-6](https://github.com/mengshukeji/Luckysheet/compare/v1.0.1-2...v1.0.1-6) (2020-07-14) - - -### Bug Fixes - -* **core.js:** core function ([6e63969](https://github.com/mengshukeji/Luckysheet/commit/6e639699e117abd241532de5530a533b80d547bb)) - -### [1.0.1-2](https://github.com/mengshukeji/Luckysheet/compare/v1.0.1-1...v1.0.1-2) (2020-07-14) - -### [1.0.1-1](https://github.com/mengshukeji/Luckysheet/compare/v1.0.1-0...v1.0.1-1) (2020-07-14) - -### 1.0.1-0 (2020-07-14) - -## 2.0.0-0 (2020-07-24) - - -### ⚠ BREAKING CHANGES - -* **all project:** File name change - -* **all project:** modular,Document promotion,Some bugs ([37c3070](https://github.com/mengshukeji/Luckysheet/commit/37c307087cb50efa9eb3e1f3a22a356024aa43b5)), closes [#11](https://github.com/mengshukeji/Luckysheet/issues/11) [#2](https://github.com/mengshukeji/Luckysheet/issues/2) +# Changelog + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +### [2.1.13](https://github.com/mengshukeji/Luckysheet/compare/v2.1.12...v2.1.13) (2021-01-19) + + +### Bug Fixes + +* **bug:** bug ([025823b](https://github.com/mengshukeji/Luckysheet/commit/025823b9f386c8048aa44b62f076a739eaa980c0)), closes [#435](https://github.com/mengshukeji/Luckysheet/issues/435) +* **bug:** bug ([a8ff967](https://github.com/mengshukeji/Luckysheet/commit/a8ff967be9cdcf3bbcb0045888951a26a852500a)), closes [#398](https://github.com/mengshukeji/Luckysheet/issues/398) +* **bug:** bug ([deb3a96](https://github.com/mengshukeji/Luckysheet/commit/deb3a965b881d747f9a2171f7d9c9f967d671901)) +* **bug:** bug ([5ce1f4a](https://github.com/mengshukeji/Luckysheet/commit/5ce1f4a0b753b7a95569b5285d749389e4d8b943)), closes [#433](https://github.com/mengshukeji/Luckysheet/issues/433) +* **bug:** bug ([932e821](https://github.com/mengshukeji/Luckysheet/commit/932e8215563248f97547ad21a429ef3f8ed0682b)), closes [#423](https://github.com/mengshukeji/Luckysheet/issues/423) [#424](https://github.com/mengshukeji/Luckysheet/issues/424) +* **bug:** bug ([06636f6](https://github.com/mengshukeji/Luckysheet/commit/06636f6a3c08128fe50aa880baabc9420fce4092)), closes [#154](https://github.com/mengshukeji/Luckysheet/issues/154) [#410](https://github.com/mengshukeji/Luckysheet/issues/410) [#416](https://github.com/mengshukeji/Luckysheet/issues/416) +* **bug:** history bug ([973eec8](https://github.com/mengshukeji/Luckysheet/commit/973eec8b71ea963bb23c9fe35c985e86c85ef019)) +* **bug:** setRangeFormat history ([065148b](https://github.com/mengshukeji/Luckysheet/commit/065148b5a97e9090479f401463c548c3346757ec)) +* **bug:** setRangeShow api ([5bbc45b](https://github.com/mengshukeji/Luckysheet/commit/5bbc45b68e807a2c58c328d93fe8079f3e56fa9f)) +* bug ([7412c5b](https://github.com/mengshukeji/Luckysheet/commit/7412c5b4f5aa0afd93f3e0210d3f3fe182c67273)) +* **bug:** 文本自动换行bug ([bc926e5](https://github.com/mengshukeji/Luckysheet/commit/bc926e5c49f008c14b4b5e1fdf13713fd6e995b5)) +* 换行 ([94022a4](https://github.com/mengshukeji/Luckysheet/commit/94022a48b6407523c5924e94c86fb2ada0fab301)) +* **bug:** 渲染换行空行 ([4162b7a](https://github.com/mengshukeji/Luckysheet/commit/4162b7a049f109715a9246ce610d05882d5a5f12)) +* **hook:** cellrender ([d444980](https://github.com/mengshukeji/Luckysheet/commit/d44498086fcd3b1b2bf75e95c6a236bc79a1df13)) +* **let:** let declar ([71ade32](https://github.com/mengshukeji/Luckysheet/commit/71ade32abd3989230db609ec37f92e931a4473f0)) +* **pivottable:** fix ([7cecb12](https://github.com/mengshukeji/Luckysheet/commit/7cecb12ae3a1a0bd0d5bdce803429d4464388e31)), closes [#439](https://github.com/mengshukeji/Luckysheet/issues/439) [#447](https://github.com/mengshukeji/Luckysheet/issues/447) +* **pivottable:** init ([5b19e8b](https://github.com/mengshukeji/Luckysheet/commit/5b19e8b06bdd95c2b799d2cc1d6ae677b96617cd)) +* **pivottable:** refresh ([78330c9](https://github.com/mengshukeji/Luckysheet/commit/78330c95db2735c8139b0320c2e81ee6f438adea)) + +### [2.1.12](https://github.com/mengshukeji/Luckysheet/compare/v2.1.11...v2.1.12) (2020-12-22) + + +### Features + +* **api:** find ([ea97233](https://github.com/mengshukeji/Luckysheet/commit/ea97233a668b3a682f6f0b1ad3fec251b01c33ab)) + + +### Bug Fixes + +* **bug:** bug ([9357792](https://github.com/mengshukeji/Luckysheet/commit/9357792fd1c49737398cf86cdf87d9dbfe35df26)), closes [#359](https://github.com/mengshukeji/Luckysheet/issues/359) [#360](https://github.com/mengshukeji/Luckysheet/issues/360) [#376](https://github.com/mengshukeji/Luckysheet/issues/376) [#382](https://github.com/mengshukeji/Luckysheet/issues/382) +* **bug:** bug ([19560eb](https://github.com/mengshukeji/Luckysheet/commit/19560eba3fe36cce4ee65ba3e8ac80ab7ec8d620)), closes [#367](https://github.com/mengshukeji/Luckysheet/issues/367) [#370](https://github.com/mengshukeji/Luckysheet/issues/370) +* **bug:** bug ([0f257e8](https://github.com/mengshukeji/Luckysheet/commit/0f257e8f153bb6c0cf38fb85200c587aabac164c)), closes [#361](https://github.com/mengshukeji/Luckysheet/issues/361) [#364](https://github.com/mengshukeji/Luckysheet/issues/364) [#365](https://github.com/mengshukeji/Luckysheet/issues/365) +* **bug:** copy bug ([2bcbab9](https://github.com/mengshukeji/Luckysheet/commit/2bcbab9a9f4727fd03930962a2dbdcaec3401597)) +* **feature:** functionButton ([5983cb0](https://github.com/mengshukeji/Luckysheet/commit/5983cb015e092e2edc1d3f27dba2d585fb4db099)), closes [#336](https://github.com/mengshukeji/Luckysheet/issues/336) [#381](https://github.com/mengshukeji/Luckysheet/issues/381) +* copy ([d177cc8](https://github.com/mengshukeji/Luckysheet/commit/d177cc8f5ee01d32932d1137920883209ec24be4)) + +### [2.1.10](https://github.com/mengshukeji/Luckysheet/compare/v2.1.9...v2.1.10) (2020-12-18) + + +### Bug Fixes + +* **rowtitle:** bug ([8faeffe](https://github.com/mengshukeji/Luckysheet/commit/8faeffee08840a5e8119d9fc8ac7204248105616)) + +### [2.1.9](https://github.com/mengshukeji/Luckysheet/compare/v2.1.8...v2.1.9) (2020-12-17) + + +### Bug Fixes + +* **bug:** bug ([54ae143](https://github.com/mengshukeji/Luckysheet/commit/54ae143aa268b5ce0253752a2a92b2ab22601b42)), closes [#222](https://github.com/mengshukeji/Luckysheet/issues/222) [#355](https://github.com/mengshukeji/Luckysheet/issues/355) +* **numeral:** userInfo ([871d381](https://github.com/mengshukeji/Luckysheet/commit/871d3819f7c734b604f19da1ba81bf5ee0ea0814)), closes [#338](https://github.com/mengshukeji/Luckysheet/issues/338) + +### [2.1.8](https://github.com/mengshukeji/Luckysheet/compare/v2.1.7...v2.1.8) (2020-12-16) + + +### ⚠ BREAKING CHANGES + +* **bug:** n + +### Features + +* **api add:** image ([16131b2](https://github.com/mengshukeji/Luckysheet/commit/16131b2776cd278bb7bddae674c206aa739f3a46)), closes [#270](https://github.com/mengshukeji/Luckysheet/issues/270) +* **changlang:** changLang ([cbc81e9](https://github.com/mengshukeji/Luckysheet/commit/cbc81e9e17ca56e09f9e697e5372650f3d6a476b)), closes [#318](https://github.com/mengshukeji/Luckysheet/issues/318) +* **collaborative editing:** collaborative editing ([6fe8726](https://github.com/mengshukeji/Luckysheet/commit/6fe87260e8986cd83e7bcf655594389c01739107)), closes [#199](https://github.com/mengshukeji/Luckysheet/issues/199) [#201](https://github.com/mengshukeji/Luckysheet/issues/201) [#202](https://github.com/mengshukeji/Luckysheet/issues/202) +* **condition format:** formula condition ([6c98bde](https://github.com/mengshukeji/Luckysheet/commit/6c98bded8dcf16aab4bcc89a63a62d3878c06cd3)), closes [#186](https://github.com/mengshukeji/Luckysheet/issues/186) +* **demo:** proxy ([bc64807](https://github.com/mengshukeji/Luckysheet/commit/bc64807de9e3f8f60ddc529c6b795c95aff1884c)) +* **feature:** closeWebsocket api and ctrl ; ([9153bc7](https://github.com/mengshukeji/Luckysheet/commit/9153bc799db2aea947f2ba70a7b947daca55b844)), closes [#328](https://github.com/mengshukeji/Luckysheet/issues/328) [#326](https://github.com/mengshukeji/Luckysheet/issues/326) +* **hook:** add ([2c6b1c2](https://github.com/mengshukeji/Luckysheet/commit/2c6b1c21b3ad6535671745fd7483d9318f7e55ec)) +* **print feature:** develop ([a0921b6](https://github.com/mengshukeji/Luckysheet/commit/a0921b62d73b8b3edcaf1c72dd9e35cd43848f2f)) + + +### Bug Fixes + +* **add forcecaculation config:** add ([e96d210](https://github.com/mengshukeji/Luckysheet/commit/e96d210fe544caa8b912720a274374bccb0cef7d)) +* **bug:** bug ([95e26c3](https://github.com/mengshukeji/Luckysheet/commit/95e26c3fa07fa74c238c0c7b96b5b7ff91b79889)), closes [#330](https://github.com/mengshukeji/Luckysheet/issues/330) +* **bug:** bug ([c003f8a](https://github.com/mengshukeji/Luckysheet/commit/c003f8a4281f346c89226061851f71693208574a)), closes [#184](https://github.com/mengshukeji/Luckysheet/issues/184) [#337](https://github.com/mengshukeji/Luckysheet/issues/337) +* **bug:** bug ([4900b4a](https://github.com/mengshukeji/Luckysheet/commit/4900b4a0f2a82528e130d7281bb1f153ed3297fe)), closes [#331](https://github.com/mengshukeji/Luckysheet/issues/331) +* **bug:** bug ([b93ea6b](https://github.com/mengshukeji/Luckysheet/commit/b93ea6b66e444d387f230602dd02034b4b237369)), closes [#284](https://github.com/mengshukeji/Luckysheet/issues/284) [#296](https://github.com/mengshukeji/Luckysheet/issues/296) +* **bug:** bug ([57ff2b9](https://github.com/mengshukeji/Luckysheet/commit/57ff2b959b4be8d5cad559624d92f00e996d315f)), closes [#182](https://github.com/mengshukeji/Luckysheet/issues/182) [#220](https://github.com/mengshukeji/Luckysheet/issues/220) +* **bug:** bug ([31bdc4f](https://github.com/mengshukeji/Luckysheet/commit/31bdc4feae0037c92074b244e9e52363298b164d)), closes [#263](https://github.com/mengshukeji/Luckysheet/issues/263) +* **bug:** bug ([385bc03](https://github.com/mengshukeji/Luckysheet/commit/385bc039c91727655ea771c7a48d6f0890a275fb)), closes [#243](https://github.com/mengshukeji/Luckysheet/issues/243) [#226](https://github.com/mengshukeji/Luckysheet/issues/226) +* **bug:** bug ([88aa6c5](https://github.com/mengshukeji/Luckysheet/commit/88aa6c5b59964078c6a9cfffb41308c196a44953)), closes [#278](https://github.com/mengshukeji/Luckysheet/issues/278) [#276](https://github.com/mengshukeji/Luckysheet/issues/276) [#267](https://github.com/mengshukeji/Luckysheet/issues/267) [#215](https://github.com/mengshukeji/Luckysheet/issues/215) +* **bug:** copy to excel ([5cf72ec](https://github.com/mengshukeji/Luckysheet/commit/5cf72ec0781f0e3b2ddc77eac228812507ce66a2)), closes [#319](https://github.com/mengshukeji/Luckysheet/issues/319) +* **bug:** data verification range select ([6d60679](https://github.com/mengshukeji/Luckysheet/commit/6d606791abaa5d410ce68cfb49f8bc9c2dfaf609)) +* **cell:** render ([ba21140](https://github.com/mengshukeji/Luckysheet/commit/ba2114055ba62b0401c76075054588642fa4fbf1)) +* **demo:** websocket url ([cf77ec3](https://github.com/mengshukeji/Luckysheet/commit/cf77ec3307c0d44bc5303f606762c003d4f50b86)) +* **dynamic array refresh fix:** fix ([b7d634f](https://github.com/mengshukeji/Luckysheet/commit/b7d634f0425dd8cb337784b10094d0952edc460a)) +* **fix #209:** highlight ([ab2d8b7](https://github.com/mengshukeji/Luckysheet/commit/ab2d8b7b5467200e12c8d4c1ece014ebfc6ee7cc)), closes [#209](https://github.com/mengshukeji/Luckysheet/issues/209) +* **fix #209 ,fix #219:** highlight follow checkout keep highlight ([c547596](https://github.com/mengshukeji/Luckysheet/commit/c5475964e41eb7bb12d87b679dffba4b988abb30)), closes [#209](https://github.com/mengshukeji/Luckysheet/issues/209) [#219](https://github.com/mengshukeji/Luckysheet/issues/219) +* **fix #209 fix #219:** highlight follow checkout page ([0a5ca86](https://github.com/mengshukeji/Luckysheet/commit/0a5ca86ab808d2cb1da8cb14d93c5d787c50f540)), closes [#209](https://github.com/mengshukeji/Luckysheet/issues/209) [#219](https://github.com/mengshukeji/Luckysheet/issues/219) +* **fix #209 fix #219:** highlight follow, checkout keep highlight ([2c7b0bb](https://github.com/mengshukeji/Luckysheet/commit/2c7b0bbdf5adf1b2a6fc537e37825ab01ee3cf96)), closes [#209](https://github.com/mengshukeji/Luckysheet/issues/209) [#219](https://github.com/mengshukeji/Luckysheet/issues/219) +* **fix #290:** userinfo ([80d67e1](https://github.com/mengshukeji/Luckysheet/commit/80d67e157d010f8e59c472b2e6046c04efe9b966)), closes [#290](https://github.com/mengshukeji/Luckysheet/issues/290) +* **fix #290:** userinfo ([dddfc8f](https://github.com/mengshukeji/Luckysheet/commit/dddfc8f9418991466025682309e73950da6611cd)), closes [#290](https://github.com/mengshukeji/Luckysheet/issues/290) +* **fix #290:** userinfo ([27a770e](https://github.com/mengshukeji/Luckysheet/commit/27a770ee863356d2ef120970723bb048c510d9aa)), closes [#290](https://github.com/mengshukeji/Luckysheet/issues/290) +* **main canvas:** bottom space ([23c8a78](https://github.com/mengshukeji/Luckysheet/commit/23c8a78cb3bd387c7c609250de41b187105475b5)) +* **tojson:** bug ([1c94783](https://github.com/mengshukeji/Luckysheet/commit/1c94783677bcfe6488caf39028f18e5b2505a737)) +* setCellValue API 可设置自定义的属性,不显式设置v, v 不会丢失 ([6d45cf2](https://github.com/mengshukeji/Luckysheet/commit/6d45cf2ce63dca282f4a40ce5aaf628f94bfc8d1)) +* jfrefreshgrid 函数第二个参数应该是个数组 ([c7cf87a](https://github.com/mengshukeji/Luckysheet/commit/c7cf87a49b1b8ce64fb21249cd05950fabc0e546)) +* setCellFormat data 引用 ([ed50e47](https://github.com/mengshukeji/Luckysheet/commit/ed50e47b44e079bc76419ba3f96f04d964c70610)) +* setCellValue 刷新页面时的历史记录问题 ([a2cf969](https://github.com/mengshukeji/Luckysheet/commit/a2cf96978f97b289d603aa404bcfaf8a0d64f87b)) +* 修复alert ([94e0020](https://github.com/mengshukeji/Luckysheet/commit/94e0020acd49aed50810e6c133688c950690ab3c)) +* 修复主动关闭socket仍然alert弹窗 ([e0bdb2c](https://github.com/mengshukeji/Luckysheet/commit/e0bdb2c4015355e428c5e8d567196d607606a38e)) +* 修复主动关闭socket定时器仍运行问题 ([82a8731](https://github.com/mengshukeji/Luckysheet/commit/82a87319342c698c1a1a58972a9d59ab3b7e91cd)) +* 初始化表单状态下标调整 ([3a54312](https://github.com/mengshukeji/Luckysheet/commit/3a54312c93a6daebf575639dd612e0d01be2a296)) +* 复制选区虚线框正确显示 ([9d6a2ee](https://github.com/mengshukeji/Luckysheet/commit/9d6a2eed05ae660fb65515217e156817fc4d6443)) +* 解决单击非时间日期单元格后还会跳出日期时间弹框 ([fc9eb4e](https://github.com/mengshukeji/Luckysheet/commit/fc9eb4e7984af6991b79acae6a2a5c0bbea5254f)) +* **fix forcecaculation feature:** complete ([7568ceb](https://github.com/mengshukeji/Luckysheet/commit/7568ceb442acdfdedeb6d6e4d623bdcd2a8c4018)) +* **formula contain text bug:** add iscell method ([89358d3](https://github.com/mengshukeji/Luckysheet/commit/89358d36045baca791f2b5e9d2152349bf5903cf)) +* **formula update fix:** formula update only one level, when cell value change. Fix it ([cf6c5be](https://github.com/mengshukeji/Luckysheet/commit/cf6c5be8a45616e1002db0ff4b04b47c3ed4c38e)) + +### [2.1.7](https://github.com/mengshukeji/Luckysheet/compare/v2.1.6...v2.1.7) (2020-11-26) + + +### Features + +* **demo:** tool function ([3baf93c](https://github.com/mengshukeji/Luckysheet/commit/3baf93cdb57238ee73ace3e7b9bca142fad81584)) +* 修改日期能够正常的弹出格式框和设置对应格式的日期时间 ([2c27044](https://github.com/mengshukeji/Luckysheet/commit/2c2704473c1c5a77091acda45a46f39ebbad3592)) +* 修改日期能够正常的弹出格式框和设置对应格式的日期时间 ([67c44e7](https://github.com/mengshukeji/Luckysheet/commit/67c44e7a68d948fcb90bd499ecc15cfb2bea5127)) + + +### Bug Fixes + +* **formula:** function ([dad6e2b](https://github.com/mengshukeji/Luckysheet/commit/dad6e2b2d144a31f4cfaaf84c90588e1a02ee006)) +* **formular:** docs ([ddac582](https://github.com/mengshukeji/Luckysheet/commit/ddac582f696898a1a46fc0ce3eb5d245d20077ae)) +* **hook:** function ([fb43a56](https://github.com/mengshukeji/Luckysheet/commit/fb43a56222c3d4c77b84efa9ff37eed8e1333a1a)) +* **hook function:** cellupdate ([5e8f71f](https://github.com/mengshukeji/Luckysheet/commit/5e8f71f32e5104769dbe6e0c61de3cd26b286344)) +* ie11右下角菜单图标会出现错位 ([34fd6e7](https://github.com/mengshukeji/Luckysheet/commit/34fd6e74cb87f9563ff28979d9f5f8a192fb558a)) +* 重复create会出现很多问题 ([8f22790](https://github.com/mengshukeji/Luckysheet/commit/8f227904fe9600ea17fdc346924d73c3bc81a041)) + +### [2.1.6](https://github.com/mengshukeji/Luckysheet/compare/v2.1.5...v2.1.6) (2020-11-23) + + +### ⚠ BREAKING CHANGES + +* yes + +q + +### Features + +* **api:** hook function ([a0db530](https://github.com/mengshukeji/Luckysheet/commit/a0db530295bca24b81b02171a073f6b6f1227ce6)) +* **hook:** add hook function ([215dec2](https://github.com/mengshukeji/Luckysheet/commit/215dec27d796ee9b5be7857a425093a53db84332)) +* q ([54a42a2](https://github.com/mengshukeji/Luckysheet/commit/54a42a274a96eb3334602fd0de65e1d4b2fc492a)) +* **bottom alignment of english letters:** fix ([a596d2f](https://github.com/mengshukeji/Luckysheet/commit/a596d2fcd617cac196e3336a8dfe8ac9ba58c9f7)) +* **config:** sheetRightClickConfig ([59c7cb3](https://github.com/mengshukeji/Luckysheet/commit/59c7cb34a33450e59023fd1ae5e615f3e40ef0d9)) +* add underline button ([df56ba6](https://github.com/mengshukeji/Luckysheet/commit/df56ba6f359bb12eb765b26b973100c554601eca)) +* use npm dependencies ([e4bd439](https://github.com/mengshukeji/Luckysheet/commit/e4bd439a0e96dbec0cb3a45e01aaecb129fab2ad)) +* **row and column width:** batch change the height and width of the selected row and column ([956bd2a](https://github.com/mengshukeji/Luckysheet/commit/956bd2a01012b429c58a14b5b88d02a02350b662)) + + +### Bug Fixes + +* **bug fix:** [#26](https://github.com/mengshukeji/Luckysheet/issues/26) [#91](https://github.com/mengshukeji/Luckysheet/issues/91) ([a26ffd8](https://github.com/mengshukeji/Luckysheet/commit/a26ffd8ac388db475dfd38e4ae83098eeeee8bc8)) +* **cooperative:** bug ([9e48c72](https://github.com/mengshukeji/Luckysheet/commit/9e48c72a47022188d387558b5b5f3a6250878c65)) +* **demo:** ie11 ([e7ddc39](https://github.com/mengshukeji/Luckysheet/commit/e7ddc397c8b1e421c63f3e9f661ced99a3d81556)), closes [#234](https://github.com/mengshukeji/Luckysheet/issues/234) +* **fix #212:** cancel highlight ([289d3ef](https://github.com/mengshukeji/Luckysheet/commit/289d3ef46ebadf9662d272109a1f24d2a8b0dc1d)), closes [#212](https://github.com/mengshukeji/Luckysheet/issues/212) +* **fix #219:** checkout ([15dca04](https://github.com/mengshukeji/Luckysheet/commit/15dca040840d228f6326d4eecad917df38e15f04)), closes [#219](https://github.com/mengshukeji/Luckysheet/issues/219) +* **fix #219:** clear info ([080f027](https://github.com/mengshukeji/Luckysheet/commit/080f0275b80143026cc30e8450c901715fc51c19)), closes [#219](https://github.com/mengshukeji/Luckysheet/issues/219) +* sheet menu position ([a40f679](https://github.com/mengshukeji/Luckysheet/commit/a40f679fde6700c90cd66c66bb070afabb31fb83)) +* **iconfont:** conflict ([bf4d539](https://github.com/mengshukeji/Luckysheet/commit/bf4d539dddc4cef232f8eae602b39980ded5b208)) +* **mousemove hook error:** fix ([89b93e7](https://github.com/mengshukeji/Luckysheet/commit/89b93e71460750be8f736df0dbc13675daf5d72d)) + +### [2.1.5](https://github.com/mengshukeji/Luckysheet/compare/v2.1.4...v2.1.5) (2020-11-03) + + +### Features + +* **cell date picker:** cell date picker and bug solve ([2996ae9](https://github.com/mengshukeji/Luckysheet/commit/2996ae9cab724714903d00e0b63022abc4a1a3b6)) +* **cell hooks add:** go to document for detail ([927ff46](https://github.com/mengshukeji/Luckysheet/commit/927ff46949f688a5bcffcb3fe48dc6b4b12b61c9)) +* **config:** custom menu button config ([14eb78e](https://github.com/mengshukeji/Luckysheet/commit/14eb78e153cbce726adf9e093702f9b93af1fa03)) +* **config:** sheetbar ([3555746](https://github.com/mengshukeji/Luckysheet/commit/3555746f4cc8ef2c1fe163a34edd428f1a6377ed)) +* **date format:** date format Chinese ([8f8d0cb](https://github.com/mengshukeji/Luckysheet/commit/8f8d0cb8c5563a31afba3fe11b525e6bccd5eb56)) +* **hyperlink:** add hyperlink function ([439dff4](https://github.com/mengshukeji/Luckysheet/commit/439dff4330ab5053643331286091d44ae910fb8d)) +* **hyperlink:** perfect hyperlink function ([5adfc60](https://github.com/mengshukeji/Luckysheet/commit/5adfc6055bf4cfed7f1ff40933d292057196bc7e)) +* **statisticbar:** config docs ([c1ed417](https://github.com/mengshukeji/Luckysheet/commit/c1ed417074e89e665f9ef39ee186db9106904c4e)) +* **tojson:** api/docs ([8e410f5](https://github.com/mengshukeji/Luckysheet/commit/8e410f5d3cd61724230b3024898d6de3c6c41101)) + + +### Bug Fixes + +* **bug:** bug ([ad73f9a](https://github.com/mengshukeji/Luckysheet/commit/ad73f9a679d77721d8af0a483dffe70b90e56412)), closes [#129](https://github.com/mengshukeji/Luckysheet/issues/129) +* **bug:** bug ([801cbe5](https://github.com/mengshukeji/Luckysheet/commit/801cbe5a8040d80f2e672b3607c0b92c922281a9)) +* **bug:** bug ([f8716c1](https://github.com/mengshukeji/Luckysheet/commit/f8716c18db05c7ab8bf59d1feb0dc4c3b364c560)), closes [#67](https://github.com/mengshukeji/Luckysheet/issues/67) [#85](https://github.com/mengshukeji/Luckysheet/issues/85) +* **bug:** bug ([0909f5e](https://github.com/mengshukeji/Luckysheet/commit/0909f5e4c957e3d3248a8c86d6e092c5a5396112)), closes [#142](https://github.com/mengshukeji/Luckysheet/issues/142) [#132](https://github.com/mengshukeji/Luckysheet/issues/132) +* **bug:** dataVerification and sheet move and delete cell bug ([4815d86](https://github.com/mengshukeji/Luckysheet/commit/4815d86ce564da43aa1ced3b48d38e88afc39f77)) +* **conflict:** conflict ([b11de26](https://github.com/mengshukeji/Luckysheet/commit/b11de26c4d2dbdd7e9d4363558e95d4433f26585)) +* **conflict:** toolbar ([8cfa6ac](https://github.com/mengshukeji/Luckysheet/commit/8cfa6ac1bec8bcb156fe45e8c488aa7026b65738)) +* **fix bug with inline string rotate wrap:** add change to max, fix height error ([1988687](https://github.com/mengshukeji/Luckysheet/commit/198868719ffb19738ee5ecc1ee060a0840fa92df)) +* **hide row/column:** right click menu ([8070858](https://github.com/mengshukeji/Luckysheet/commit/8070858f6c35f11ee8cf2692d8828d0e78c46d92)), closes [#37](https://github.com/mengshukeji/Luckysheet/issues/37) +* **restore demo:** restore demo ([e799862](https://github.com/mengshukeji/Luckysheet/commit/e7998627400b82bf082bad3c984f4d26e3c9f43a)) + +### [2.1.3](https://github.com/mengshukeji/Luckysheet/compare/v2.1.2...v2.1.3) (2020-10-22) + + +### Features + +* **api add:** getRowHeight getColumnWidth getDefaultRowHeight getDefaultColumnWidth ([a72f38b](https://github.com/mengshukeji/Luckysheet/commit/a72f38b641a999bdf15281029777222e0bf79e85)) +* **api add:** setRowHeight setColumnWidth setSheetZoom setDataVerification deleteDataVerification ([0fd06cc](https://github.com/mengshukeji/Luckysheet/commit/0fd06cc4d7f465967b3bcc91e0b2484ba61b71f6)) +* **api add:** setSheetOrder refresh getScreenshot setWorkbookName undo redo ([b2a4617](https://github.com/mengshukeji/Luckysheet/commit/b2a46171c2cfcd9682537a801a1ea68e7e2d3ba0)) +* **api and config:** api exitEditMode() scroll() config defaultFontSize ([5eedc48](https://github.com/mengshukeji/Luckysheet/commit/5eedc48a764727bebe09fd626087b158b2979c1e)) +* **support spanish:** support Spanish ([41c527c](https://github.com/mengshukeji/Luckysheet/commit/41c527c6f39a8cb3a99d3fc70603f29ab7ba0a82)) + + +### Bug Fixes + +* **api:** api ([14d72eb](https://github.com/mengshukeji/Luckysheet/commit/14d72ebe56a2f87f0df5d14595c60e41fe9af077)) +* **bug:** postil image zoom ([76dbb5c](https://github.com/mengshukeji/Luckysheet/commit/76dbb5cc613c8290696e917c554aff934050b6a2)) +* **destroy function repaire:** repair ([02b9fe7](https://github.com/mengshukeji/Luckysheet/commit/02b9fe75f28a87a475bd0593522b20d030d31b85)) +* **event name:** fix ([f64ba54](https://github.com/mengshukeji/Luckysheet/commit/f64ba54455e2a757c72fb4c0110fef2cc5ccdaab)) +* **fix focus after formula edit:** fix ([0ee5f31](https://github.com/mengshukeji/Luckysheet/commit/0ee5f31f5ce84c1a7fab2af17ff102790603e3bb)) +* **fix text whole text wrap bug:** fix ([ef3d324](https://github.com/mengshukeji/Luckysheet/commit/ef3d324e80bc648080b1e5a53108b30dccf74520)) +* **function array value error:** fix it ([31e4b3d](https://github.com/mengshukeji/Luckysheet/commit/31e4b3d9e4cf16f005f8cede059b7cb1cab05031)) +* **function update fix:** fix bug ([28835bb](https://github.com/mengshukeji/Luckysheet/commit/28835bb7533087eb16866b4cdaebe94231c7832b)) +* **image:** resize and change row or column size ([05c49a2](https://github.com/mengshukeji/Luckysheet/commit/05c49a2fad21706ee7e232fe75d213fed3724109)) +* **image fuzzy:** fix it ([8fb1a88](https://github.com/mengshukeji/Luckysheet/commit/8fb1a88669d772a0067edb614e5974ada7301c9c)) +* **image zoom:** fix ([1337178](https://github.com/mengshukeji/Luckysheet/commit/1337178a991b4aa99a6e255e50d69e2c8ca47b82)) +* **index offset indirect fix:** improve the overall execution efficiency of the function ([7a2f8d0](https://github.com/mengshukeji/Luckysheet/commit/7a2f8d02daf2cc0180adc56dafcfb1d1f6d022ec)) +* **inline style:** inline style cell delete bug ([8067a01](https://github.com/mengshukeji/Luckysheet/commit/8067a012ec59a39c5a389d357c3ba2c19bc6acb9)) +* **lineheight change to 0.5:** similar to excel ([760378b](https://github.com/mengshukeji/Luckysheet/commit/760378b369b9bf71da0182ea3b413a0accb23c38)) +* **more btn:** fix more btn align middle ([c5112e9](https://github.com/mengshukeji/Luckysheet/commit/c5112e9700cd89d4820cbbbefdc0e1d3d0ed940a)) +* **more formats toolbar:** fix more formats toolbar can't sync with cell, fix mac delete button can't delete cell, fix can't delete cell with inline-style ([23fcb13](https://github.com/mengshukeji/Luckysheet/commit/23fcb137cb594cfb4bc6dfe2ac86d306c42427f9)) +* **selection bug:** fix it ([b83447d](https://github.com/mengshukeji/Luckysheet/commit/b83447d61805192d0310b20e97821eb01b790fb7)) +* **setcellvalue delete function fix:** fix it ([00b351f](https://github.com/mengshukeji/Luckysheet/commit/00b351fa0dc01c32cf9c6b8852937e7d2ceb292d)) +* **sheet name contains squotes bug:** formla can not execute, when sheet name contains squotes ([fc1dd83](https://github.com/mengshukeji/Luckysheet/commit/fc1dd837d4a3d1639914923201e853e55a865143)) +* **text wrap postion bug:** wrap and rotation postion wrong ([9538972](https://github.com/mengshukeji/Luckysheet/commit/9538972f910ed77e02ccb55c0b96386fcf87297b)) +* **the bug with first word is space:** fix ti ([6ae8319](https://github.com/mengshukeji/Luckysheet/commit/6ae83196cb50fafbf5657104babd124fac27b818)) +* **update number add quote automatically:** similar to excel ([05b01a6](https://github.com/mengshukeji/Luckysheet/commit/05b01a6c95a5d0736c51c5c1ca41e9eb463122d8)) +* **validation of "0" values:** fix ([7255c51](https://github.com/mengshukeji/Luckysheet/commit/7255c51d7b46523ff423ee5560b78d18f8535821)) + +## [2.1.0](https://github.com/mengshukeji/Luckysheet/compare/v2.0.0...v2.1.0) (2020-10-10) + + +### ⚠ BREAKING CHANGES + +* **frozen,docs:** when init workbook and sheet has frozen row or column,you need init sheet's +property frozen + +### Features + +* **add autocalculationmerge sheet attribute:** it can auto calculate merge infomation ([f7e30cf](https://github.com/mengshukeji/Luckysheet/commit/f7e30cf946f9c5945fd7e69bf4a3273f54e2616f)) +* **add force cacultion formula:** add forceCaculate parameter ([4dd82ad](https://github.com/mengshukeji/Luckysheet/commit/4dd82ad131e0a936c040852657b05ffd53e4b465)) +* **api:** add some api functions ([37910ab](https://github.com/mengshukeji/Luckysheet/commit/37910abea38dc37fcb5cc5b905c7b028e3390c10)) +* **api:** api ([6f7ca26](https://github.com/mengshukeji/Luckysheet/commit/6f7ca26ba22c47ed0746363dccfd1e392040aed9)) +* **api:** api ([66aecbe](https://github.com/mengshukeji/Luckysheet/commit/66aecbe7fe16be03c9c62e1ebbf941c1a9f4bac7)) +* **api:** provides an api for users ([b176753](https://github.com/mengshukeji/Luckysheet/commit/b176753ceacba3ab8a243bfe27c5ea8d9455d617)) +* **api add:** api add ([e4198fa](https://github.com/mengshukeji/Luckysheet/commit/e4198fa5bda4f6787a3153a113d2be10cfe64fd5)) +* **api add:** deleteRangeConditionalFormat clearRange deleteRange ([44cf72a](https://github.com/mengshukeji/Luckysheet/commit/44cf72a1c7592ac5227a92c3e325e7f5088bca30)) +* **api add:** setSheetDelete setSheetCopy setSheetHide setSheetShow setSheetName setSheetColor ([62f641f](https://github.com/mengshukeji/Luckysheet/commit/62f641fe7f519b8679c4e006427a74e2e17a8f98)) +* **data verification:** data verification ([a661d30](https://github.com/mengshukeji/Luckysheet/commit/a661d303101ee6ebedf22aabb60f7a5a50722b0e)) +* **data verification:** data verification ([9cbbbce](https://github.com/mengshukeji/Luckysheet/commit/9cbbbce556444182536bf0a0641c5db22d4a6007)) +* **delete cell:** delete cell ([d7de718](https://github.com/mengshukeji/Luckysheet/commit/d7de718d5e6e6308cae1ccf7a7699c3f7d790d8f)) +* **draw use sacle:** cancel manual devicePixRatio, use context sacle ([c832283](https://github.com/mengshukeji/Luckysheet/commit/c832283c9709a8393f2c6b74d50e984c7720bb34)) +* **drawmain efficiency optimization:** efficiency optimization ([37080fa](https://github.com/mengshukeji/Luckysheet/commit/37080faa39dccb23539d346080baf07ad367c2d7)) +* **editor box position fit:** show diffrent position acording to align ([636046d](https://github.com/mengshukeji/Luckysheet/commit/636046dbb2f005c2e6110b3559b72a59a7c67d87)) +* **fix:** fix ([9830714](https://github.com/mengshukeji/Luckysheet/commit/983071467d21a5eb1a35c0c427005e95364128db)) +* **hide column:** hide column ([9f05959](https://github.com/mengshukeji/Luckysheet/commit/9f05959d4d5fea7fc26e0cedb7217f0be92bcae9)) +* **image:** copy and paste ([33d6c96](https://github.com/mengshukeji/Luckysheet/commit/33d6c961bb2d88fa1ba73448c2b808957f750544)) +* **image insert:** image insert ([4232dfc](https://github.com/mengshukeji/Luckysheet/commit/4232dfc7832846013e623d13f6157ee1e371bda3)) +* **inline string:** finished ([325b66c](https://github.com/mengshukeji/Luckysheet/commit/325b66ccd0e7508535f16a7dfc51acba622cfc14)) +* **inline string:** operation like excel ([9ac9f08](https://github.com/mengshukeji/Luckysheet/commit/9ac9f08acf088b614b5318000df2e0d442df21fd)) +* **inline string:** when focus cell, show inline string content ([713805c](https://github.com/mengshukeji/Luckysheet/commit/713805cd031ccdf3e5ef1b70da504b635fed85fa)) +* **inline string render finished:** begin to develop edit feature ([2ffd9ae](https://github.com/mengshukeji/Luckysheet/commit/2ffd9aedd82e9abaf32b374337503f25d56fd9da)) +* **insert image:** insert image ([cf3ba93](https://github.com/mengshukeji/Luckysheet/commit/cf3ba930cadc90e3fc753ac30154974e74089cfc)) +* **insert image perfect:** insert image perfect ([ad0a88a](https://github.com/mengshukeji/Luckysheet/commit/ad0a88a8d412202692ce1611f6ac7fe4ac30d2e9)) +* **mobile touch event optimized:** very smooth, good experience ([0ed0bf6](https://github.com/mengshukeji/Luckysheet/commit/0ed0bf63ba06895a2ea39c581d0180db6c0d9266)) +* **new style:** new style ([5c8d603](https://github.com/mengshukeji/Luckysheet/commit/5c8d603fc41e9c214cb3dca84a147b39f2f6ce06)) +* **optimization function:** setCellvalue support any cell param ([9b208e4](https://github.com/mengshukeji/Luckysheet/commit/9b208e4e2eeeaae09dbe75b245c989f98747613a)) +* **protection feature:** protection feature similar to Excel ([a71c92a](https://github.com/mengshukeji/Luckysheet/commit/a71c92a5f05aaed6c3df1556a81fc1b2ed97419a)) +* **zoom feature beta:** zoom in and zoom out sheet ([249aa02](https://github.com/mengshukeji/Luckysheet/commit/249aa02fa6c74eb854034ee0913a73267b6057cc)) +* **zoom gui:** zoom plus and minus, restore origin, slider ([d70dab4](https://github.com/mengshukeji/Luckysheet/commit/d70dab4938ff33e1fcefdd15492279347efe6b33)) +* **zoom redo undo suport:** redo undo ([4d03906](https://github.com/mengshukeji/Luckysheet/commit/4d0390675f3aa021f7e15bf529a8102830878202)) + + +### Bug Fixes + +* **a few bug fix:** fix ([f07e25d](https://github.com/mengshukeji/Luckysheet/commit/f07e25d0010775b71c1e73cd3ed2db6413d661ca)) +* **add button bug:** fix ([3250ef6](https://github.com/mengshukeji/Luckysheet/commit/3250ef69606d24518d7b615806c1210c2ce0a684)) +* **allowedit dont work ,when press del:** allowEdit dont work ,when press DEL ([10dccec](https://github.com/mengshukeji/Luckysheet/commit/10dcceccc7f5f04afe70adebb4db59046382abb6)) +* **array unique very slow:** fix it ([20f3cb3](https://github.com/mengshukeji/Luckysheet/commit/20f3cb3e2028e455b49a4d1947ac8f02186363af)) +* **big data slowly:** speed up ([5109873](https://github.com/mengshukeji/Luckysheet/commit/5109873500996ac4e17abb95899f1fe5950f33b9)) +* **blank border position:** fix ([d285d9f](https://github.com/mengshukeji/Luckysheet/commit/d285d9fb5e3ff74385debaf493ad6125173644a4)) +* **bug:** bug ([6bb113b](https://github.com/mengshukeji/Luckysheet/commit/6bb113bb4421fc0497f7cf833975e4e2e7544aaa)) +* **bug:** bug ([4806de8](https://github.com/mengshukeji/Luckysheet/commit/4806de8de501c08bde6e69be1779b3327ecf2364)) +* **bug:** bug ([0cb1ec2](https://github.com/mengshukeji/Luckysheet/commit/0cb1ec23c26e2393a14475d982349a310587e7a7)) +* **bug:** bug ([735d1c8](https://github.com/mengshukeji/Luckysheet/commit/735d1c8b5c3777615b20795f70e867e576b8afbf)) +* **bug:** bug ([ad1ac61](https://github.com/mengshukeji/Luckysheet/commit/ad1ac6154502193a7e34177a08ce678522d08a03)) +* **bug:** bug ([27d1be0](https://github.com/mengshukeji/Luckysheet/commit/27d1be0037c2bd5ba290e7b0f9db229de04582d9)) +* **bug:** bug ([dea7bbf](https://github.com/mengshukeji/Luckysheet/commit/dea7bbf44414be31191841443119a3505003522e)) +* **bug:** bug ([061ea20](https://github.com/mengshukeji/Luckysheet/commit/061ea2003dca838dffb9ee92d1c43f28c64a9978)) +* **bug:** bug ([ba0b047](https://github.com/mengshukeji/Luckysheet/commit/ba0b04752f35f32df82229339bdb3f295fbcecb2)) +* **bug:** bug ([7263008](https://github.com/mengshukeji/Luckysheet/commit/726300811a9fdb6e36d19187764aa73daacfc7b7)) +* **bug:** bug ([c578c0e](https://github.com/mengshukeji/Luckysheet/commit/c578c0e34b6e589dba2ef29146d894b5c6333676)) +* **bug:** bug ([fc8f61b](https://github.com/mengshukeji/Luckysheet/commit/fc8f61b0154f2220c233e680eaf814edfce3a52b)) +* **bug:** bug ([fb3b512](https://github.com/mengshukeji/Luckysheet/commit/fb3b5122a5f4e333cca581251ef6d672da767b37)) +* **bug:** bug ([6236e5e](https://github.com/mengshukeji/Luckysheet/commit/6236e5e8d6621c0ad829206704bdc2fac684d3bc)) +* **bug:** bug ([f057d7d](https://github.com/mengshukeji/Luckysheet/commit/f057d7d281fccc7094c4f806c4590dca39cfbaa0)) +* **bug fix:** [#55](https://github.com/mengshukeji/Luckysheet/issues/55) [#50](https://github.com/mengshukeji/Luckysheet/issues/50) [#54](https://github.com/mengshukeji/Luckysheet/issues/54) ([5caf2b0](https://github.com/mengshukeji/Luckysheet/commit/5caf2b028c962e8ca2e6bd1c92fed3e6a9fb462d)) +* **bug fix:** pivotTable blank title disapear, merge cell is recognized as range ([47fe25c](https://github.com/mengshukeji/Luckysheet/commit/47fe25c32107e719115a98ceef2ed97ae6161f3b)) +* **bugs:** fix issue [#27](https://github.com/mengshukeji/Luckysheet/issues/27) [#29](https://github.com/mengshukeji/Luckysheet/issues/29) ([5d57267](https://github.com/mengshukeji/Luckysheet/commit/5d572676d46692719309c20e536d001ccfe2cd2f)) +* **celloverflow border bug:** celloverflow border bug ([86403c2](https://github.com/mengshukeji/Luckysheet/commit/86403c20b329ea4106d6498c33927b714e22941b)) +* **change sheet:** change sheet must setTimeOut ([e51457e](https://github.com/mengshukeji/Luckysheet/commit/e51457ef492ae74b77a0298931268b9f14feaa44)) +* **change sheet bug:** multiple refresh canvas bug ([7a625e0](https://github.com/mengshukeji/Luckysheet/commit/7a625e0dae187cc7af8e10e3449abf666fd332eb)) +* **change sheet scroll bar fix:** change sheet scroll bar dont restore ([02d2655](https://github.com/mengshukeji/Luckysheet/commit/02d26557a52b7cef0cb3b2b8d14996eb29fafa51)) +* **chart:** chart ([2be467d](https://github.com/mengshukeji/Luckysheet/commit/2be467d6a4b385d7d7bb0585c9be7a227614a04b)) +* **cloumn and row highlight bug:** column and row highlight bar disapear ([c806211](https://github.com/mengshukeji/Luckysheet/commit/c80621118e28f711b1513c869da36989c1a70c8f)) +* **columlen:** columlen ([b656c27](https://github.com/mengshukeji/Luckysheet/commit/b656c27a3971b756ea809f4c1010ae28310569da)) +* **copy cut paste bug:** bug fix ([ade56d5](https://github.com/mengshukeji/Luckysheet/commit/ade56d5b5ff38dd5095234b71bc89927841fa387)) +* **demo fix:** fix ([3d17426](https://github.com/mengshukeji/Luckysheet/commit/3d174260e27793d1634c5f15b83a4aa9ca4100de)) +* **demo fix:** fix ([732f678](https://github.com/mengshukeji/Luckysheet/commit/732f6788bcff9ddcf4b0e6bc266b3be9e28eea41)) +* **demo fontlist url change:** local path ([feb89b3](https://github.com/mengshukeji/Luckysheet/commit/feb89b301b116745e82a2b17071909d7a4873562)) +* **filter option bug:** position error ([3324512](https://github.com/mengshukeji/Luckysheet/commit/33245124be8972d1e011c047caf657275ac76916)) +* **fix:** bug fix ([52375dc](https://github.com/mengshukeji/Luckysheet/commit/52375dcb416f435a1adea1fa3abeb486a73d513f)) +* **fix:** fix ([194dea1](https://github.com/mengshukeji/Luckysheet/commit/194dea17672cc15e76b364b788f0818299b5e64c)) +* **fix bug:** param dont remenber change ([0425e4e](https://github.com/mengshukeji/Luckysheet/commit/0425e4eef2c585873a61efe9ee34496aab40b810)) +* **fix bugs:** fix ([bbaafe0](https://github.com/mengshukeji/Luckysheet/commit/bbaafe0d68d670b7621d616db5f91394ded8f573)) +* **fix index.html:** fix ([e980cd9](https://github.com/mengshukeji/Luckysheet/commit/e980cd91afee781a004d7e207283e41990b4e45c)) +* **fix number to column title bug:** if column title is big , it will show undefined ([2d6e73e](https://github.com/mengshukeji/Luckysheet/commit/2d6e73eb3fba5ebd85b76d22ba4ffdc9c5197b58)) +* **fix touch:** touch fix ([d884a69](https://github.com/mengshukeji/Luckysheet/commit/d884a698d6f62aa21bea7d76705682e7406e7973)) +* **fix wrap bug:** alt + enter twice bug ([789bab5](https://github.com/mengshukeji/Luckysheet/commit/789bab5e5d712af889577ed141387c02a049f21f)) +* **float calculate bug:** fix it ([ef2a96a](https://github.com/mengshukeji/Luckysheet/commit/ef2a96a7cd6d341810b99698f26063862cf33e35)) +* **fonts bug on ie:** fit it ([f9a1546](https://github.com/mengshukeji/Luckysheet/commit/f9a1546ca783c058994759dc3443d2e0d9929267)) +* **format of formula cell bug fix:** if cell has format , it is no effect ([1f6ebad](https://github.com/mengshukeji/Luckysheet/commit/1f6ebad36da9de608bc32bddc945a5e3bb68528d)) +* **formula -(1-2) error:** fix it ([dee2333](https://github.com/mengshukeji/Luckysheet/commit/dee2333b295aa63fae544c075a98f993c1c3e84c)) +* **formula bug:** formula bug ([6c84420](https://github.com/mengshukeji/Luckysheet/commit/6c84420ad4461281ba87378af41cde0e5a7fee93)) +* **formula efficiency up:** speed up ([d05151f](https://github.com/mengshukeji/Luckysheet/commit/d05151f474145cb765a60b2f118c222f8b488efb)) +* **formula initialization bug:** if formula has cross sheet param, initial this ([c5f6254](https://github.com/mengshukeji/Luckysheet/commit/c5f6254bccd89a90abfa3a6d6728416983ebbb4c)) +* **frozen bug:** fix ([91daa07](https://github.com/mengshukeji/Luckysheet/commit/91daa07ec94255f9135d423aa17d9425c0ffe58d)) +* **frozen bug and style change:** fix bug ([7cfd0d9](https://github.com/mengshukeji/Luckysheet/commit/7cfd0d914c8999cfd4dbb2bca50f5766645cb108)) +* **frozen,docs:** frozen,docs ([e1bd844](https://github.com/mengshukeji/Luckysheet/commit/e1bd844749fa05a7b178565a90bbdba0c81ce1fe)) +* **function box input bug:** editor box and function box fix ([4ebb79d](https://github.com/mengshukeji/Luckysheet/commit/4ebb79d67f50dc46f97bc64a0cef0ba8d44e5c12)) +* **green label size fix:** fix ([b0734b5](https://github.com/mengshukeji/Luckysheet/commit/b0734b57bb42c55e99eb831c0ca24053ea4aa6a8)) +* **hide row and column fix:** add lines ([c430d66](https://github.com/mengshukeji/Luckysheet/commit/c430d6625a23b0f4b8ef903ae62e82833ed0618f)) +* **hot key bug fix:** range bug when formula move selection ([f4625d1](https://github.com/mengshukeji/Luckysheet/commit/f4625d1dc38d6f69fddb0ae131d54f65bd7bcbd7)) +* **image background opacity:** fix ([d61d3a0](https://github.com/mengshukeji/Luckysheet/commit/d61d3a07e55978350e9e5171537fee1457847209)) +* **image,config:** image,config ([2dddfaa](https://github.com/mengshukeji/Luckysheet/commit/2dddfaa8f1a13476f512db0e0d27742ebebb7f35)) +* **inline string bug:** style lost when change cell to inline string, input error ([405d90b](https://github.com/mengshukeji/Luckysheet/commit/405d90bfec0c7b47dee64e2034aeec8686c53e32)) +* **inline string finished:** fix some bus ([57e7518](https://github.com/mengshukeji/Luckysheet/commit/57e75188ffb718e92251cb9813ae47b467410889)) +* **inline string space dont recognize:** fix it ([ddc5c5d](https://github.com/mengshukeji/Luckysheet/commit/ddc5c5dde9a4d4db2ee42207383d696c12c58249)) +* **input range bug:** fix it ([5412721](https://github.com/mengshukeji/Luckysheet/commit/5412721675598979689e4de31ec37c2e807c7c16)) +* **jquery error:** jquery error ([1a2fed9](https://github.com/mengshukeji/Luckysheet/commit/1a2fed99871d79bcb895af1796909ee3e286e05f)) +* **menubutton.js fonts:** fix bug ([1e62de3](https://github.com/mengshukeji/Luckysheet/commit/1e62de3d2f358e99373259600c736ca83601d2ba)) +* **mobile text dose not display:** fix bug ([19922c7](https://github.com/mengshukeji/Luckysheet/commit/19922c76dd6afc4991ca3816262d40a6659baa5f)) +* **mobile touch:** moubile touch fix ([04e2b8e](https://github.com/mengshukeji/Luckysheet/commit/04e2b8e06965673f807a46fbcda2a403711ec7ea)) +* **my english is pool:** fix ([26ff1fd](https://github.com/mengshukeji/Luckysheet/commit/26ff1fd21180e2c795dcc24ed4d4aa2d5ba1f689)) +* **no fullscreen bug:** when no fullscreen , div go to top ([64f7d0e](https://github.com/mengshukeji/Luckysheet/commit/64f7d0e6c44c24f21e6e7d8d16beac6f23a5d770)) +* **normal style change bug:** fit error ([f24eb7f](https://github.com/mengshukeji/Luckysheet/commit/f24eb7f69c5c9ae53832f130a27473a686720e72)) +* **offset indirect formula fix:** fix bug ([d8dfe50](https://github.com/mengshukeji/Luckysheet/commit/d8dfe50782108745e5f132c0bbb1438f7180d198)) +* **old chrome dont surport actualboundingboxascent:** fix it and make it beautiful ([5c503d8](https://github.com/mengshukeji/Luckysheet/commit/5c503d851945d5ece1d69c2da8fa26c330d13930)) +* **paste bug:** fixed ([76d966f](https://github.com/mengshukeji/Luckysheet/commit/76d966f27eb7632061b97a438d07a63f88704878)) +* **pivot table bug:** bug ([9fcc209](https://github.com/mengshukeji/Luckysheet/commit/9fcc209b936eed2057a09b1f070d62832c9801b1)) +* **pivot table change sheet bug:** if prevous sheet is pivot table and pennel is closed, change bug ([7cac8e6](https://github.com/mengshukeji/Luckysheet/commit/7cac8e62631d90bea0521498e9980234fde88fc3)) +* **pivot table filter bug:** change sheet bug ,after filter pivot table ([c7c1999](https://github.com/mengshukeji/Luckysheet/commit/c7c1999081289c70b6e575e9e37fae82bdfe438c)) +* **pivot table show error:** when column area have field and row area is null,pivot table show error ([04bc51c](https://github.com/mengshukeji/Luckysheet/commit/04bc51cf8dc5ff24fc5d71b3bbf755a9787ca57d)) +* **remain cell style in inline string mode:** click cell and change cell style like to Excel ([7d0438a](https://github.com/mengshukeji/Luckysheet/commit/7d0438a10db44f371c23daccb9c066f30773e307)) +* **render:** render ([40550d6](https://github.com/mengshukeji/Luckysheet/commit/40550d6e59c44e0f47e23f8b5fac4c5e79a5c122)) +* **render bug fix:** new render method ([a1bcf81](https://github.com/mengshukeji/Luckysheet/commit/a1bcf81562ebc8c8327baad01d5e814e23fae647)) +* **rotate text position mistake, when sheet zoom:** fix zoom bug, fix strike and underline bug ([6680a13](https://github.com/mengshukeji/Luckysheet/commit/6680a134252a65b346b0a99142998ced277e8adf)) +* **scroll bug:** scroll bug ([3637fa4](https://github.com/mengshukeji/Luckysheet/commit/3637fa4121340e6278f12104e7877c450e92d511)) +* **several bug and new feature:** formula calculation , quotePrefix add ([5a95304](https://github.com/mengshukeji/Luckysheet/commit/5a95304289714d130501faae352dc07fb21dbf68)) +* **sheet change arrow:** fix bug ([4a7850b](https://github.com/mengshukeji/Luckysheet/commit/4a7850b86ef1086fe18fa7961a62bbc622ed760d)) +* **splines and dynamicarray bug fix:** formula calculation update is finished ([a59aa04](https://github.com/mengshukeji/Luckysheet/commit/a59aa04e4db70e3d90c6109a18ea6a7d2747c156)) +* **ssf column resize:** change ([2a09f59](https://github.com/mengshukeji/Luckysheet/commit/2a09f5977e35a388c42d4b43d7fbe6df891234db)) +* **store cache:** bug fix ([cbd9014](https://github.com/mengshukeji/Luckysheet/commit/cbd90140e0aae293b40724bce692b861047d47c3)) +* **text get wrong height when zoom:** fix height ([106f1fd](https://github.com/mengshukeji/Luckysheet/commit/106f1fd111a75778a2c61424290f33295cec9964)) +* **toolbar:** menu button style ([d18478c](https://github.com/mengshukeji/Luckysheet/commit/d18478c0e11cdce994d585be216b9ad95836f073)) +* **underline and cancelline:** add and fix ([d3f23ff](https://github.com/mengshukeji/Luckysheet/commit/d3f23fffd72f95b241710e9fdf1a70113502a815)) +* **undo redo bug fix:** formula update bug ([373dc4f](https://github.com/mengshukeji/Luckysheet/commit/373dc4f464d8bd106408ce28bd48b9e44b310b5f)) +* **update demo:** fix ([e101b91](https://github.com/mengshukeji/Luckysheet/commit/e101b91c4a4a427a83ef727f2e8c2e8166124485)) +* **updatecell bug fix:** fix undo redo ([d8b76ce](https://github.com/mengshukeji/Luckysheet/commit/d8b76ce52f25d9fc487ca62b7007c049a4a80160)) +* **websocket bux:** bug ([4eda52a](https://github.com/mengshukeji/Luckysheet/commit/4eda52ac89587515d6a20574c0711fe22de0a8c0)) +* **zoom scroll position wrong:** fix ([5830e9a](https://github.com/mengshukeji/Luckysheet/commit/5830e9af5a9c8757f55a18b34af2f08ce02f2351)) +* **zoom slider drag lag:** fix lag ([17ddd13](https://github.com/mengshukeji/Luckysheet/commit/17ddd13b2e87d3879fa49e1f3569f062400eb251)) + +## [2.0.0](https://github.com/mengshukeji/Luckysheet/compare/v2.0.0-0...v2.0.0) (2020-07-31) + + +### ⚠ BREAKING CHANGES + +* **api:** 1. luckysheet.flowdata change to luckysheet.flowdata() 2.all apis list in +documentation +* **gulp:** demo index.html's js and css refrence change +* **bug:** bug + +bug +* **chart:** add new config : plugins, array +* **main:** bug + +### Features + +* **cell overflow:** cell overflow ([c3e4f39](https://github.com/mengshukeji/Luckysheet/commit/c3e4f39919e68d99ad72c6a0ae104926acce6b23)) +* **chart:** chart ([9991702](https://github.com/mengshukeji/Luckysheet/commit/999170251810720fc4d44012bcc7c70c124463fd)) +* **chart:** chart plugin ([196362d](https://github.com/mengshukeji/Luckysheet/commit/196362db053a25ea0deaff14b5019e1450902ceb)) +* d ([07d004f](https://github.com/mengshukeji/Luckysheet/commit/07d004f9d63962dc3ad09a32a1d3c61866de5525)) +* **allowedit support:** allowEdit support ([59561bb](https://github.com/mengshukeji/Luckysheet/commit/59561bb3453469cbf86703672ec770187545459d)) +* **bug fix:** bu ([f23ba5d](https://github.com/mengshukeji/Luckysheet/commit/f23ba5df9b967cd9d8188680723c903ee467bb29)) +* **canvas:** canvas ([c63871f](https://github.com/mengshukeji/Luckysheet/commit/c63871fbeabb47d766320800d3bb8be47604690b)) +* **chart:** add chart ([139bc6e](https://github.com/mengshukeji/Luckysheet/commit/139bc6ea8510667c4900db6d1b5b26a33fb52734)) +* **gloabe improve and bug fix:** global improve and bug fix,include formula,find and replace,filter ([e6cfa31](https://github.com/mengshukeji/Luckysheet/commit/e6cfa3156ac2ec8989f3716601dc27bcfbdc4d13)) +* **globalization fix:** pivot table , drop cell ([55d4cf2](https://github.com/mengshukeji/Luckysheet/commit/55d4cf29868787a94377ea2e659da9e74e062628)) +* **locale:** locale ([4cd2ee4](https://github.com/mengshukeji/Luckysheet/commit/4cd2ee4cb3f115be9e2455a626469711d8be2c2e)) +* **move:** move chart ([cda6df0](https://github.com/mengshukeji/Luckysheet/commit/cda6df0209fb1d440e54d663de682f4749660917)) +* **optimiz:** optimization ([abbf592](https://github.com/mengshukeji/Luckysheet/commit/abbf592d2df320d8a44eb5375075cd65f4ef4066)) +* **rightclick menu perfect:** add rows and cols delete rows and cols hide rows and cols ([32f94a7](https://github.com/mengshukeji/Luckysheet/commit/32f94a72285d6051df87ce45390cb4e5a4cc49b2)) +* **scroll style fix beautify:** scroll,sheet color and style ([63f2630](https://github.com/mengshukeji/Luckysheet/commit/63f2630b95ab811807199670db6eee332af882a8)) +* **split handler.js to small file:** split handler.js file to seven files ([0a62ff0](https://github.com/mengshukeji/Luckysheet/commit/0a62ff0565d4116ae66a758386ef8d84dcfceba5)) +* **zh en:** zh en ([040bfe4](https://github.com/mengshukeji/Luckysheet/commit/040bfe4b456eb910dc7ddbcc3f5ae0e42d440951)) +* **zh-cn:** zh-cn ([907226c](https://github.com/mengshukeji/Luckysheet/commit/907226c74297882896f527b9c54a88a11d592a4d)) +* **zh-cn:** zh-cn ([01f9521](https://github.com/mengshukeji/Luckysheet/commit/01f9521ed37e11b2e9630b01b84583a45302fc77)) + + +### Bug Fixes + +* **bug:** bug ([7dff640](https://github.com/mengshukeji/Luckysheet/commit/7dff64086aaf034a8c427e37ef7b15da96e1123c)) +* **bug:** bug ([8baf378](https://github.com/mengshukeji/Luckysheet/commit/8baf378407f67684b77e62bacf6894e4359ed2d3)) +* **bug:** bug ([5ebd31e](https://github.com/mengshukeji/Luckysheet/commit/5ebd31e4a455c7547e46c418838e2e3a16def6a7)) +* **bug:** bug ([f53addb](https://github.com/mengshukeji/Luckysheet/commit/f53addbf70e96b45d73014d8e181c2712820b5c3)) +* **bug:** bug ([9cc36cf](https://github.com/mengshukeji/Luckysheet/commit/9cc36cf40ebb5a4f41b52f230e35d253f8261f69)) +* **bug:** bug ([186e3c9](https://github.com/mengshukeji/Luckysheet/commit/186e3c9a557a555d1737d456abf872622004f052)) +* **bug:** bug ([447735c](https://github.com/mengshukeji/Luckysheet/commit/447735c7ea365c2c292dd98a4fba8813a9a62d34)) +* **bug:** bug ([74639a8](https://github.com/mengshukeji/Luckysheet/commit/74639a8b719db028ab856f95a80d82553c0d919c)) +* **bug:** bug ([1082ab0](https://github.com/mengshukeji/Luckysheet/commit/1082ab0e2e84c7863ab29c7b68bb2d9934dcf11c)) +* **bug fix:** sparkLines, pivot Table, change to sheet ([69aee1a](https://github.com/mengshukeji/Luckysheet/commit/69aee1aec3200c75cb4897f0f782a945c2ef9fd1)) +* **canvas:** canvas,function ([2445ff5](https://github.com/mengshukeji/Luckysheet/commit/2445ff5094fe8da9f7d56612ceb06dd86b75b30e)) +* **fix:** fix ([bd6a9bd](https://github.com/mengshukeji/Luckysheet/commit/bd6a9bdd31cefe00a6470fbec9d10471d21fac9f)) +* **fix:** fix byg ([d9fb5fe](https://github.com/mengshukeji/Luckysheet/commit/d9fb5fe4c48637d2ac947fe8aa21d6a7ccde0264)) +* **fix allowedit:** fix allowEdit attribute ([35820b3](https://github.com/mengshukeji/Luckysheet/commit/35820b3c2ea8437036cfc32911acde9ff32c2fea)) +* **from github:** github ([abd44e8](https://github.com/mengshukeji/Luckysheet/commit/abd44e882e39bfb85c0e213e049325754bc3ba4f)) +* **hot key and mousemove:** hot key fix ([1ad40cf](https://github.com/mengshukeji/Luckysheet/commit/1ad40cf5521b7b3bd804c2c1f5f13fe6860ab95e)) +* **internationalization:** internationalization,formula ([c6901fc](https://github.com/mengshukeji/Luckysheet/commit/c6901fc884d14c5fb8f48a60192f1eb8ad26a485)) +* **linestyle bug:** lineStyle ([27ba0a3](https://github.com/mengshukeji/Luckysheet/commit/27ba0a3010865aa0e28158e661bcd6196bc1cfe4)) +* **locale:** locale bug ([3bd0cae](https://github.com/mengshukeji/Luckysheet/commit/3bd0cae0502e14c329304bfbf8c0f98c8e7b284e)) +* **locale finished and bug fix:** locale finished, condition bug fix , multi range bug fix ([0aa9b3b](https://github.com/mengshukeji/Luckysheet/commit/0aa9b3baa51c818ec2415b9d1c2e838ef32bdc85)) +* **locale,formula:** locale,formula ([b11b862](https://github.com/mengshukeji/Luckysheet/commit/b11b86295108d8b25ad2cd7b1ba016b3555cee0d)) +* **mac scroll x reverse fix:** mac scroll x reverse fix and scroll optimization ([8eb68e8](https://github.com/mengshukeji/Luckysheet/commit/8eb68e82e2898b1be2702f463c326a304bc96106)) +* **main:** bug ([67ebe19](https://github.com/mengshukeji/Luckysheet/commit/67ebe1978bf067c17c74e5b3b7b048055c53c0b4)) +* **pivot table bug:** uni ([56181e6](https://github.com/mengshukeji/Luckysheet/commit/56181e610085604666d96aa6068944e05355ec7d)) + + +### build + +* **gulp:** gulpfile,index.html,pack js css ([8be0467](https://github.com/mengshukeji/Luckysheet/commit/8be0467dea483be7be2a5af1bc3545a04a67ea72)) + + +* **api:** api ([f19a26e](https://github.com/mengshukeji/Luckysheet/commit/f19a26eab08bc44a5c380afd883d4e730f681062)) + +### [1.0.1-6](https://github.com/mengshukeji/Luckysheet/compare/v1.0.1-2...v1.0.1-6) (2020-07-14) + + +### Bug Fixes + +* **core.js:** core function ([6e63969](https://github.com/mengshukeji/Luckysheet/commit/6e639699e117abd241532de5530a533b80d547bb)) + +### [1.0.1-2](https://github.com/mengshukeji/Luckysheet/compare/v1.0.1-1...v1.0.1-2) (2020-07-14) + +### [1.0.1-1](https://github.com/mengshukeji/Luckysheet/compare/v1.0.1-0...v1.0.1-1) (2020-07-14) + +### 1.0.1-0 (2020-07-14) + +## 2.0.0-0 (2020-07-24) + + +### ⚠ BREAKING CHANGES + +* **all project:** File name change + +* **all project:** modular,Document promotion,Some bugs ([37c3070](https://github.com/mengshukeji/Luckysheet/commit/37c307087cb50efa9eb3e1f3a22a356024aa43b5)), closes [#11](https://github.com/mengshukeji/Luckysheet/issues/11) [#2](https://github.com/mengshukeji/Luckysheet/issues/2) diff --git a/LICENSE b/LICENSE index d17c8fab0..339d0f601 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,21 @@ -The MIT License (MIT) - -Copyright (c) 2020-present, Mengshukeji - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +The MIT License (MIT) + +Copyright (c) 2020-present, Mengshukeji + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README-zh.md b/README-zh.md index 82b35eb27..0c39db56f 100644 --- a/README-zh.md +++ b/README-zh.md @@ -1,237 +1,327 @@ -
- -![logo](/docs/.vuepress/public/img/logo_text.png) - -
- -# Luckysheet 3.x 目前正在使用Typescript重构 - -简体中文 | [English](./README.md) - -## 介绍 -🚀Luckysheet ,一款纯前端类似excel的在线表格,功能强大、配置简单、完全开源。 - -## 相关链接 - | 源码 | 文档 | Demo | 插件Demo | 论坛 | - | ------ | -------- | ------ | ------ | ------ | - | [Github](https://github.com/mengshukeji/Luckysheet)| [在线文档](https://mengshukeji.github.io/LuckysheetDocs/zh/) | [在线Demo](https://mengshukeji.github.io/LuckysheetDemo) / [协同编辑Demo](http://luckysheet.lashuju.com/demo/) | [导入Excel Demo](https://mengshukeji.github.io/LuckyexcelDemo/) | [中文论坛](https://support.qq.com/product/288322) | - | [Gitee镜像](https://gitee.com/mengshukeji/Luckysheet)| [Gitee在线文档](https://mengshukeji.gitee.io/LuckysheetDocs/zh/) | [Gitee在线Demo](https://mengshukeji.gitee.io/luckysheetdemo/) | [Gitee导入Excel Demo](https://mengshukeji.gitee.io/luckyexceldemo/) | [Google Group](https://groups.google.com/g/luckysheet) | - -![演示](/docs/.vuepress/public/img/LuckysheetDemo.gif) - -## 插件 -- [Luckyexcel](https://gitee.com/mengshukeji/Luckyexcel):excel导入导出库 -- [chartMix](https://gitee.com/mengshukeji/chartMix):图表插件 - -## 生态 - -| 工程 | 描述 | -|---------|-------------| -| [Luckysheet Vue] | 在vue cli 3项目中使用Luckysheet和Luckyexcel| -| [Luckysheet React] | 在React项目中使用Luckysheet | -| [Luckyexcel Node] | 在koa2中使用Luckyexcel | -| [Luckysheet Server] | Java后台Luckysheet Server | -| [Luckysheet Server Starter] | LuckysheetServer 一键docker部署 | - -[Luckysheet Vue]: https://gitee.com/mengshukeji/luckysheet-vue -[Luckysheet React]: https://gitee.com/mengshukeji/luckysheet-react -[Luckyexcel Node]: https://gitee.com/mengshukeji/Luckyexcel-node -[Luckysheet Server]: https://gitee.com/mengshukeji/LuckysheetServer -[Luckysheet Server Starter]: https://gitee.com/mengshukeji/LuckysheetServerStarter - -## 特性 - -- **格式设置**:样式,条件格式,文本对齐及旋转,文本截断、溢出、自动换行,多种数据类型,单元格内多样式 -- **单元格**:拖拽,下拉填充,多选区,查找和替换,定位,合并单元格,数据验证 -- **行和列操作**:隐藏、插入、删除行或列,冻结,文本分列 -- **操作体验**:撤销、重做,复制、粘贴、剪切,快捷键,格式刷,选区拖拽 -- **公式和函数**:内置公式,远程公式,自定义公式 -- **表格操作**:筛选,排序 -- **增强功能**:数据透视表,图表,评论,共享编辑,插入图片,矩阵计算,截图,复制到其他格式,EXCEL导入及导出等 - -更详细的功能列表,请查阅:[特性](https://mengshukeji.github.io/LuckysheetDocs/zh/guide/#%E7%89%B9%E6%80%A7) - -## 📖 学习资源 - -- 新用户优先阅读:[用户指引](https://github.com/mengshukeji/Luckysheet/wiki/User-Guide) -- 社区提供的教程、学习资料及配套解决方案请查阅:[教程与资源](https://mengshukeji.github.io/LuckysheetDocs/zh/guide/resource.html) - -## 📜 更新日志 - -每个版本的详细更改都记录在 [CHANGELOG.md](CHANGELOG.md) 中。 - -## ❗️ 问题反馈 - -在反馈问题之前,请确保仔细阅读 [如何提交问题](https://mengshukeji.github.io/LuckysheetDocs/zh/guide/contribute.html#如何提交问题)。 不符合准则的问题可能会立即被移除。 - -## ✅ 开发计划 - -通过 [GitHub Projects](https://github.com/mengshukeji/Luckysheet/projects/1) 管理 - -## 💪 贡献 - -在提交PR之前,请确保仔细阅读 [贡献指南](https://mengshukeji.github.io/LuckysheetDocs/zh/guide/contribute.html)。 - -## 用法 - -### 第一步 -通过CDN引入依赖 - -``` - - - - - - -``` -### 第二步 -指定一个表格容器 -``` -
-``` -### 第三步 -创建一个表格 -``` - -``` -## 开发 - -### 环境 -[Node.js](https://nodejs.org/en/) Version >= 6 - -### 安装 -``` -npm install -npm install gulp -g -``` -### 开发 -``` -npm run dev -``` -### 打包 -``` -npm run build -``` - -## 合作项目 - -- [鲁班h5](https://github.com/ly525/luban-h5) -- [h5-Dooring](https://github.com/MrXujiang/h5-Dooring) -- [Furion](https://gitee.com/monksoul/Furion) - -## 交流 - -- [Github 论坛](https://github.com/mengshukeji/Luckysheet/discussions) -- 以下扫码加入官方微信群或者QQ群 - -| 官方微信群 | 群满则加小编微信,备注:加群 | QQ群 | -|---|---|---| -| | | | - - -[英文社群](./README.md) - -## 赞助 - -Luckysheet是MIT许可的开源项目,其持续稳定的开发离不开这些优秀的 [**支持者**](https://mengshukeji.github.io/LuckysheetDocs/zh/about/sponsor.html#%E8%B5%9E%E5%8A%A9%E8%80%85%E5%88%97%E8%A1%A8)。 如果您想加入他们,请考虑: - -- [成为Patreon的支持者或赞助商](https://www.patreon.com/mengshukeji) -- [成为Open Collective的支持者或赞助商](https://opencollective.com/luckysheet) -- 通过PayPal,微信或支付宝一次性捐赠 - -| PayPal | 微信 | 支付宝 | -|---|---|---| -| [Paypal Me](https://www.paypal.me/wbfsa) | | | - -### Patreon和OpenCollective有什么区别? - -通过Patreon捐赠的资金将直接用于支持menshshukeji在Luckysheet上的工作。 通过OpenCollective捐赠的资金由透明费用管理,将用于补偿核心团队成员的工作和费用或赞助社区活动。 通过在任一平台上捐款,您的姓名/徽标将得到适当的认可和曝光。 - -## 赞助者列表 - -(按时间顺序排列) -- *勇 ¥ 30 -- 虚我 ¥ 200 -- 甜党 ¥ 50 -- Alphabet(Google)-gcf ¥ 1 -- **平 ¥ 100 -- **东 ¥ 10 -- debugger ¥ 20 -- 烦了烦 ¥ 10 -- 文顶顶 ¥ 200 -- yangxshn ¥ 10 -- 爱乐 ¥ 100 -- 小李飞刀刀 ¥ 66 -- 张铭 ¥ 200 -- 曹治军 ¥ 1 -- *特 ¥ 10 -- **权 ¥ 9.9 -- **sdmq ¥ 20 -- *旭 ¥ 10 -- Quentin ¥ 20 -- 周宇凡 ¥ 100 -- *超 ¥ 10 -- 维宁 ¥ 100 -- hyy ¥ 20 -- 雨亭寒江月 ¥ 50 -- **功 ¥ 10 -- **光 ¥ 20 -- terrywan ¥ 100 -- 王晓洪 ¥ 10 -- Sun ¥ 10 -- 忧绣 ¥ 100 -- Jasonx ¥ 10 -- 国勇 ¥ 66.6 -- 郎志 ¥ 100 -- 匿名 ¥ 1 -- ni ¥ 100 -- 苏 ¥ 50 -- Mads_chan ¥ 1 -- LK ¥ 100 -- 智连方舟 李汪石 ¥ 168 -- **发 ¥ 260 -- *超 ¥ 10 -- *勇 ¥ 10 -- *腾 ¥ 15 -- 名字好难起 ¥ 20 - -## 贡献者和感谢 - -### 核心团队活跃成员 -- [@wbfsa](https://github.com/wbfsa) -- [@eiji-th](https://github.com/eiji-th) -- [@fly-95](https://github.com/fly-95) -- [@tonytonychopper123](https://github.com/tonytonychopper123) -- [@Dushusir](https://github.com/Dushusir) -- [@iamxuchen800117](https://github.com/iamxuchen800117) -- [@wpxp123456](https://github.com/wpxp123456) -- [@c19c19i](https://weibo.com/u/3884623955) -- [@zhangchen915](https://github.com/zhangchen915) -- [@jerry-f](https://github.com/jerry-f) -- [@flowerField](https://github.com/flowerField) - -### 社区伙伴 -- [@yiwasheng](https://github.com/yiwasheng) -- [@danielcai1987](https://github.com/danielcai1987) -- [@qq6690876](https://github.com/qq6690876) -- [@javahuang](https://github.com/javahuang) -- [@TimerGang](https://github.com/TimerGang) -- [@gsw945](https://github.com/gsw945) -- [@swen-xiong](https://github.com/swen-xiong) -- [@lzmch](https://github.com/lzmch) -- [@kdevilpf](https://github.com/kdevilpf) -- [@WJWM0316](https://github.com/WJWM0316) - -## 版权信息 -[MIT](http://opensource.org/licenses/MIT) - -Copyright (c) 2020-present, mengshukeji +
+ +![logo](/docs/.vuepress/public/img/logo_text.png) + +
+ +简体中文 | [English](./README.md) + +# Luckysheet 已不再维护,推荐使用升级版 [Univer](https://univer.short.gy/LuckysheetRepository) 用于生产环境部署,新版解决了大数据量加载,图表样式,透视表,公式计算等方面的问题,做了很多优化设计,增加了导入,导出,打印,协同等功能,提高了表格性能,更有专业技术团队进行技术支持。 + +点击 [#1454](https://github.com/dream-num/Luckysheet/issues/1454) 查看更多详情。 + + +## 介绍 +🚀Luckysheet ,一款纯前端类似excel的在线表格,功能强大、配置简单、完全开源。 + + +## 相关链接 + | 源码 | 文档 | Demo | 论坛 | + | ------ | -------- | ------ | ------ | + | [Github](https://github.com/mengshukeji/Luckysheet)| [在线文档](https://dream-num.github.io/LuckysheetDocs/zh/) | [在线Demo](https://dream-num.github.io/LuckysheetDemo) / [协同编辑Demo](http://luckysheet.lashuju.com/demo/) | [中文论坛](https://support.qq.com/product/288322) | + | [Gitee镜像](https://gitee.com/mengshukeji/Luckysheet)| [Gitee在线文档](https://mengshukeji.gitee.io/LuckysheetDocs/zh/) | [Gitee在线Demo](https://mengshukeji.gitee.io/luckysheetdemo/) | [Google Group](https://groups.google.com/g/luckysheet) | + +![演示](/docs/.vuepress/public/img/LuckysheetDemo.gif) + +## 插件 + +导入导出、打印等高级功能请使用 [Univer](https://github.com/dream-num/univer/) + +## 生态 + +| 工程 | 描述 | +|---------|-------------| +| [Luckysheet Vue] | 在vue cli 3项目中使用Luckysheet和Luckyexcel| +| [Luckysheet Vue3] | 在vue3, vite项目中使用Luckysheet和Luckyexcel| +| [Luckysheet React] | 在React项目中使用Luckysheet | +| [Luckyexcel Node] | 在koa2中使用Luckyexcel | +| [Luckysheet Server] | Java后台Luckysheet Server | +| [Luckysheet Server Starter] | LuckysheetServer 一键docker部署 | + +[Luckysheet Vue]: https://gitee.com/mengshukeji/luckysheet-vue +[Luckysheet Vue3]: https://gitee.com/hjwforever/luckysheet-vue3-vite.git +[Luckysheet React]: https://gitee.com/mengshukeji/luckysheet-react +[Luckyexcel Node]: https://gitee.com/mengshukeji/Luckyexcel-node +[Luckysheet Server]: https://gitee.com/mengshukeji/LuckysheetServer +[Luckysheet Server Starter]: https://gitee.com/mengshukeji/LuckysheetServerStarter + +## 特性 + +- **格式设置**:样式,条件格式,文本对齐及旋转,文本截断、溢出、自动换行,多种数据类型,单元格内多样式 +- **单元格**:拖拽,下拉填充,多选区,查找和替换,定位,合并单元格,数据验证 +- **行和列操作**:隐藏、插入、删除行或列,冻结,文本分列 +- **操作体验**:撤销、重做,复制、粘贴、剪切,快捷键,格式刷,选区拖拽 +- **公式和函数**:内置公式,远程公式,自定义公式 +- **表格操作**:筛选,排序 +- **增强功能**:数据透视表,图表,评论,共享编辑,插入图片,矩阵计算,截图,复制到其他格式,EXCEL导入及导出等 + +更详细的功能列表,请查阅:[特性](https://dream-num.github.io/LuckysheetDocs/zh/guide/#%E7%89%B9%E6%80%A7) + +## 📖 学习资源 + +- 新用户优先阅读:[用户指引](https://github.com/mengshukeji/Luckysheet/wiki/User-Guide) +- 社区提供的教程、学习资料及配套解决方案请查阅:[教程与资源](https://dream-num.github.io/LuckysheetDocs/zh/guide/resource.html) + +## 📜 更新日志 + +每个版本的详细更改都记录在 [CHANGELOG.md](CHANGELOG.md) 中。 + +## ❗️ 问题反馈 + +在反馈问题之前,请确保仔细阅读 [如何提交问题](https://dream-num.github.io/LuckysheetDocs/zh/guide/contribute.html#如何提交问题)。 不符合准则的问题可能会立即被移除。 + +## ✅ 开发计划 + +通过 [GitHub Projects](https://github.com/mengshukeji/Luckysheet/projects/1) 管理 + +## 💪 贡献 + +在提交PR之前,请确保仔细阅读 [贡献指南](https://dream-num.github.io/LuckysheetDocs/zh/guide/contribute.html)。 + +## 用法 + +### 第一步 +通过CDN引入依赖 + +``` + + + + + + +``` +### 第二步 +指定一个表格容器 +``` +
+``` +### 第三步 +创建一个表格 +``` + +``` +## 开发 + +### 环境 +[Node.js](https://nodejs.org/en/) Version >= 6 + +### 安装 +``` +npm install +npm install gulp -g +``` +### 开发 +``` +npm run dev +``` +### 打包 +``` +npm run build +``` + +## 合作项目 + +- [h5-Dooring](https://github.com/MrXujiang/h5-Dooring) + +## 交流 + +- [官网](http://lucky.lashuju.com/index.html) +- [Github 论坛](https://github.com/mengshukeji/Luckysheet/discussions) +- 以下扫码加入官方微信群或者QQ群 + +加小编微信: msuniver,备注:加群 + + + + +[英文社群](./README.md) + +## 赞助 + +Luckysheet是MIT许可的开源项目,其持续稳定的开发离不开这些优秀的 [**支持者**](https://dream-num.github.io/LuckysheetDocs/zh/about/sponsor.html#%E8%B5%9E%E5%8A%A9%E8%80%85%E5%88%97%E8%A1%A8)。 如果您想加入他们,请考虑: + +- [成为Patreon的支持者或赞助商](https://www.patreon.com/mengshukeji) +- [成为Open Collective的支持者或赞助商](https://opencollective.com/luckysheet) +- 通过PayPal,微信或支付宝一次性捐赠 + +| PayPal | 微信 | 支付宝 | +|---|---|---| +| [Paypal Me](https://www.paypal.me/wbfsa) | | | + +### Patreon和OpenCollective有什么区别? + +通过Patreon捐赠的资金将直接用于支持menshshukeji在Luckysheet上的工作。 通过OpenCollective捐赠的资金由透明费用管理,将用于补偿核心团队成员的工作和费用或赞助社区活动。 通过在任一平台上捐款,您的姓名/徽标将得到适当的认可和曝光。 + +## 赞助者列表 + +(按时间顺序排列) +- *涛 ¥ 200 +- popo ¥ 1 +- 孔垂善 ¥ 5 +- Shawn文 ¥ 99 +- 幸运的小路易 ¥ 1 +- 冯启俊 ¥ 88 +- mxb ¥ 10 +- 祭阳 ¥ 20 +- *勇 ¥ 30 +- 虚我 ¥ 200 +- 甜党 ¥ 50 +- Alphabet(Google)-gcf ¥ 1 +- **平 ¥ 100 +- **东 ¥ 10 +- debugger ¥ 20 +- 烦了烦 ¥ 10 +- 文顶顶 ¥ 200 +- yangxshn ¥ 10 +- 爱乐 ¥ 100 +- 小李飞刀刀 ¥ 66 +- 张铭 ¥ 200 +- 曹治军 ¥ 1 +- *特 ¥ 10 +- **权 ¥ 9.9 +- **sdmq ¥ 20 +- *旭 ¥ 10 +- Quentin ¥ 20 +- 周宇凡 ¥ 100 +- *超 ¥ 10 +- 维宁 ¥ 100 +- hyy ¥ 20 +- 雨亭寒江月 ¥ 50 +- **功 ¥ 10 +- **光 ¥ 20 +- terrywan ¥ 100 +- 王晓洪 ¥ 10 +- Sun ¥ 10 +- 忧绣 ¥ 100 +- Jasonx ¥ 10 +- 国勇 ¥ 66.6 +- 郎志 ¥ 100 +- 匿名 ¥ 1 +- ni ¥ 100 +- 苏 ¥ 50 +- Mads_chan ¥ 1 +- LK ¥ 100 +- 智连方舟 李汪石 ¥ 168 +- **发 ¥ 260 +- *超 ¥ 10 +- *勇 ¥ 10 +- *腾 ¥ 15 +- 名字好难起 ¥ 20 +- 大山 ¥ 1 +- waiting ¥ 1000 +- **宇 ¥ 10.00 +- 刘小帅的哥哥 ¥ 20.00 +- 宁静致远 ¥ 10.00 +- Eleven ¥ 1.00 +- **帆 ¥ 188 +- henry ¥ 100 +- .波罗 ¥ 50 +- 花落有家 ¥ 50 +- 踏遍南水北山 ¥ 1 +- LC ¥ 5 +- **明 ¥ 8.80 +- *军 ¥ 20 +- 张彪 ¥ 50 +- 企业文档云@肖敏 ¥ 10 +- 匿名 ¥ 50 +- 逍遥行 ¥ 10 +- z.wasaki ¥ 50 +- Make Children ¥ 20 +- Foam ¥ 20 +- 奥特曼( o|o)ノ三 ¥ 50 +- **凯 ¥ 10 +- **兵 ¥ 20 +- **川 ¥ 1 +- 二万 ¥ 50 +- 蔚然成林 ¥ 10 +- 邹杰 ¥ 10 +- 张永强 ¥ 50 +- 鱼得水 ¥ 270 +- Ccther ¥ 1 +- Eric Cheng ¥ 10 +- 佚名 ¥ 1 +- 花叶 ¥ 50 +- GT ¥ 20 +- 菜菜心 ¥ 10 +- fisher ¥ 1 +- JC ¥ 5 +- 佚名 ¥ 20 +- 独孤一剑 ¥ 50 +- mxt ¥ 20 +- 一叶迷山 ¥ 100 +- Jeff ¥ 100 +- 八千多条狗🐶 ¥ 100 +- 晓峰 ¥ 10 +- 戒 ¥ 1 +- 浪里个浪 ¥ 1 +- 回调函数 ¥ 50 +- 赖瓜子 ¥ 5 +- Milo•J ¥ 20 +- 可道云 ¥ 200 +- *程 ¥ 10 +- 来一杯卡布酸奶 ¥ 5 +- 刘久胜 ¥ 100 +- 快意江湖 ¥ 50 +- *新 ¥ 9.9 +- **龙 ¥ 100 +- **江 ¥ 100 +- **威 ¥ 9.8 +- **涛 ¥ 500 +- **嘉 ¥ 10 +- *涛 ¥ 1 +- *兵 ¥ 5 +- *阳 ¥ 200 +- *辉 ¥ 1 +- *帆 ¥ 30 +- **旺 ¥ 10 +- **麟 ¥ 20 +- *霖 ¥ 9.9 +- *帅 ¥ 10 +- *鑫 ¥ 6.66 +- ~朴:shu ¥ 29.79 +- 未来 ¥ 1 +- 国勇 ¥ 0.1 +- 用心灵听雨 ¥ 10 +- 钊 ¥ 5 +- 星稀 ¥ 5 + +## 贡献者和感谢 + +### 核心团队活跃成员 +- [@wbfsa](https://github.com/wbfsa) +- [@eiji-th](https://github.com/eiji-th) +- [@fly-95](https://github.com/fly-95) +- [@tonytonychopper123](https://github.com/tonytonychopper123) +- [@Dushusir](https://github.com/Dushusir) +- [@iamxuchen800117](https://github.com/iamxuchen800117) +- [@wpxp123456](https://github.com/wpxp123456) +- [@c19c19i](https://weibo.com/u/3884623955) +- [@zhangchen915](https://github.com/zhangchen915) +- [@jerry-f](https://github.com/jerry-f) +- [@flowerField](https://github.com/flowerField) + +### 社区伙伴 +- [@yiwasheng](https://github.com/yiwasheng) +- [@danielcai1987](https://github.com/danielcai1987) +- [@qq6690876](https://github.com/qq6690876) +- [@javahuang](https://github.com/javahuang) +- [@TimerGang](https://github.com/TimerGang) +- [@gsw945](https://github.com/gsw945) +- [@swen-xiong](https://github.com/swen-xiong) +- [@lzmch](https://github.com/lzmch) +- [@kdevilpf](https://github.com/kdevilpf) +- [@WJWM0316](https://github.com/WJWM0316) + +## 版权信息 +[MIT](http://opensource.org/licenses/MIT) + +Copyright (c) 2020-present, mengshukeji diff --git a/README.md b/README.md index 5a12220ae..a84ab41eb 100644 --- a/README.md +++ b/README.md @@ -1,237 +1,326 @@ -
- -![logo](/docs/.vuepress/public/img/logo_text.png) - -[![Join the chat at https://gitter.im/mengshukeji/Luckysheet](https://badges.gitter.im/mengshukeji/Luckysheet.svg)](https://gitter.im/mengshukeji/Luckysheet?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - - follow on Twitter - -
- -# Luckysheet 3.x is currently being rewritten in Typescript - -English| [简体中文](./README-zh.md) - -## Introduction -🚀Luckysheet is an online spreadsheet like excel that is powerful, simple to configure, and completely open source. - - -## Links - | Source Code | Documentation | Demo | Plugins Demo | Forum | - | ------ | -------- | ------ | ------ | ------ | - | [Github](https://github.com/mengshukeji/Luckysheet)| [Online Documentation](https://mengshukeji.github.io/LuckysheetDocs/) | [Online Demo](https://mengshukeji.github.io/LuckysheetDemo) / [Cooperative editing demo](http://luckysheet.lashuju.com/demo/) | [Import Excel Demo](https://mengshukeji.github.io/LuckyexcelDemo/) | [Chinese Forum](https://support.qq.com/product/288322) | - | [Gitee Mirror](https://gitee.com/mengshukeji/Luckysheet)| [Gitee Online Documentation](https://mengshukeji.gitee.io/LuckysheetDocs/) | [Gitee Online Demo](https://mengshukeji.gitee.io/luckysheetdemo/) | [Gitee Import Excel Demo](https://mengshukeji.gitee.io/luckyexceldemo/) | [Google Group](https://groups.google.com/g/luckysheet) | - -![Demo](/docs/.vuepress/public/img/LuckysheetDemo.gif) - -## Plugins -- [Luckyexcel](https://github.com/mengshukeji/Luckyexcel): Excel import and export library -- [chartMix](https://github.com/mengshukeji/chartMix): Chart plugin - -## Ecosystem - -| Project | Description | -|---------|-------------| -| [Luckysheet Vue] | Luckysheet and Luckyexcel in a vue cli3 project | -| [Luckysheet React] | Luckysheet in a React project | -| [Luckyexcel Node] | Use Luckyexcel in koa2 | -| [Luckysheet Server] | Java backend Luckysheet Server | -| [Luckysheet Server Starter] | LuckysheetServer docker deployment startup template | - -[Luckysheet Vue]: https://github.com/mengshukeji/luckysheet-vue -[Luckysheet React]: https://github.com/mengshukeji/luckysheet-react -[Luckyexcel Node]: https://github.com/mengshukeji/Luckyexcel-node -[Luckysheet Server]: https://github.com/mengshukeji/LuckysheetServer -[Luckysheet Server Starter]: https://github.com/mengshukeji/LuckysheetServerStarter - - -## Features - -- **Formatting**: style, conditional formatting, text alignment and rotation, text truncation, overflow, automatic line wrapping, multiple data types, cell segmentation style -- **Cells**: drag and drop, fill handle, multiple selection, find and replace, location, merge cells, data verification -- **Row & column**: hide, insert, delete rows or columns, freeze, and split text -- **Operation**: undo, redo, copy, paste, cut, hot key, format painter, drag and drop selection -- **Formulas & Functions**: Built-in, remote and custom formulas -- **Tables**: filter, sort -- **Enhanced functions**: Pivot tables, charts, comments, cooperative editing, insert picture, matrix calculations, screenshots, copying to other formats, EXCEL import and export, etc. - -For a more detailed feature list, please refer to: [Features](https://mengshukeji.github.io/LuckysheetDocs/guide/#features) - -## 📖 Resources -- Priority reading for new users: [User Guide](https://github.com/mengshukeji/Luckysheet/wiki/User-Guide) -- For the tutorials, learning materials and supporting solutions provided by the community, please refer to: [Tutorials and Resources](https://mengshukeji.github.io/LuckysheetDocs/guide/resource.html) - -## 📜 Changelog - -Detailed changes for each release are documented in the [CHANGELOG.md](CHANGELOG.md). - -## ❗️ Issues - -Please make sure to read the [Issue Reporting Checklist](https://mengshukeji.github.io/LuckysheetDocs/guide/contribute.html#how-to-submit-issues) before opening an issue. Issues not conforming to the guidelines may be closed immediately. - -## ✅ TODO - -Managed with [GitHub Projects](https://github.com/mengshukeji/Luckysheet/projects/1) - -## 💪Contribution - -Please make sure to read the[ Contributing Guide](https://mengshukeji.github.io/LuckysheetDocs/guide/contribute.html) before making a pull request. - -## Usage - -### First step -Introduce dependencies through CDN -``` - - - - - - -``` -### Second step -Specify a table container -``` -
-``` -### Third step -Create a table -``` - -``` - -## Development - -### Requirements -[Node.js](https://nodejs.org/en/) Version >= 6 - -### Installation -``` -npm install -npm install gulp -g -``` -### Development -``` -npm run dev -``` -### Package -``` -npm run build -``` - -## Partner project - -- [luban-h5](https://github.com/ly525/luban-h5) -- [h5-Dooring](https://github.com/MrXujiang/h5-Dooring) -- [Furion](https://gitee.com/monksoul/Furion) - -## Communication -- [Github Discussions](https://github.com/mengshukeji/Luckysheet/discussions) -- [Gitter](https://gitter.im/mengshukeji/Luckysheet) - -[Chinese community](./README-zh.md) - -## Sponsor - -Luckysheet is an MIT-licensed open source project with its ongoing development made possible entirely by the support of these awesome [backers](https://mengshukeji.github.io/LuckysheetDocs/about/sponsor.html#sponsors-list). If you'd like to join them, please consider: - -- [Become a backer or sponsor on Patreon](https://www.patreon.com/mengshukeji). -- [Become a backer or sponsor on Open Collective](https://opencollective.com/luckysheet). -- One-time donation via PayPal, WeChat or Alipay - -| PayPal | WeChat | Alipay | -|---|---|---| -| [Paypal Me](https://www.paypal.me/wbfsa) | | | - -### What's the difference between Patreon and OpenCollective? - -Funds donated via Patreon go directly to support mengshukeji's work on Luckysheet. Funds donated via OpenCollective are managed with transparent expenses and will be used for compensating work and expenses for core team members or sponsoring community events. Your name/logo will receive proper recognition and exposure by donating on either platform. - -## Sponsors List - -(Sort by time) -- *勇 ¥ 30 -- 虚我 ¥ 200 -- 甜党 ¥ 50 -- Alphabet(Google)-gcf ¥ 1 -- **平 ¥ 100 -- **东 ¥ 10 -- debugger ¥ 20 -- 烦了烦 ¥ 10 -- 文顶顶 ¥ 200 -- yangxshn ¥ 10 -- 爱乐 ¥ 100 -- 小李飞刀刀 ¥ 66 -- 张铭 ¥ 200 -- 曹治军 ¥ 1 -- *特 ¥ 10 -- **权 ¥ 9.9 -- **sdmq ¥ 20 -- *旭 ¥ 10 -- Quentin ¥ 20 -- 周宇凡 ¥ 100 -- *超 ¥ 10 -- 维宁 ¥ 100 -- hyy ¥ 20 -- 雨亭寒江月 ¥ 50 -- **功 ¥ 10 -- **光 ¥ 20 -- terrywan ¥ 100 -- 王晓洪 ¥ 10 -- Sun ¥ 10 -- 忧绣 ¥ 100 -- Jasonx ¥ 10 -- 国勇 ¥ 66.6 -- 郎志 ¥ 100 -- 匿名 ¥ 1 -- ni ¥ 100 -- 苏 ¥ 50 -- Mads_chan ¥ 1 -- LK ¥ 100 -- 智连方舟 李汪石 ¥ 168 -- **发 ¥ 260 -- *超 ¥ 10 -- *勇 ¥ 10 -- *腾 ¥ 15 -- 名字好难起 ¥ 20 - -## Authors and acknowledgment - -### Active Core Team Members -- [@wbfsa](https://github.com/wbfsa) -- [@eiji-th](https://github.com/eiji-th) -- [@fly-95](https://github.com/fly-95) -- [@tonytonychopper123](https://github.com/tonytonychopper123) -- [@Dushusir](https://github.com/Dushusir) -- [@iamxuchen800117](https://github.com/iamxuchen800117) -- [@wpxp123456](https://github.com/wpxp123456) -- [@c19c19i](https://weibo.com/u/3884623955) -- [@zhangchen915](https://github.com/zhangchen915) -- [@jerry-f](https://github.com/jerry-f) -- [@flowerField](https://github.com/flowerField) - -### Community Partners -- [@yiwasheng](https://github.com/yiwasheng) -- [@danielcai1987](https://github.com/danielcai1987) -- [@qq6690876](https://github.com/qq6690876) -- [@javahuang](https://github.com/javahuang) -- [@TimerGang](https://github.com/TimerGang) -- [@gsw945](https://github.com/gsw945) -- [@swen-xiong](https://github.com/swen-xiong) -- [@lzmch](https://github.com/lzmch) -- [@kdevilpf](https://github.com/kdevilpf) -- [@WJWM0316](https://github.com/WJWM0316) - -## License -[MIT](http://opensource.org/licenses/MIT) - -Copyright (c) 2020-present, mengshukeji +
+ +![logo](/docs/.vuepress/public/img/logo_text.png) + +[![Join the chat at https://gitter.im/mengshukeji/Luckysheet](https://badges.gitter.im/mengshukeji/Luckysheet.svg)](https://gitter.im/mengshukeji/Luckysheet?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + + follow on Twitter + +
+ +English| [简体中文](./README-zh.md) + +# Luckysheet is no longer maintained. It is recommended to use the upgraded version of [Univer](https://univer.short.gy/LuckysheetRepository) for production environment deployment. The new version solves problems such as large data loading, chart styles, pivot tables, formula calculations, etc., and has made many optimization designs, added import, export, printing, collaboration and other functions, improved table performance, and has a professional technical team to provide technical support. + +Follow the [#1454](https://github.com/dream-num/Luckysheet/issues/1454) issue for more details. + +## Introduction +🚀Luckysheet is an online spreadsheet like excel that is powerful, simple to configure, and completely open source. + + +## Links + | Source Code | Documentation | Demo | Forum | + | ------ | -------- | ------ | ------ | + | [Github](https://github.com/mengshukeji/Luckysheet)| [Online Documentation](https://dream-num.github.io/LuckysheetDocs/) | [Online Demo](https://dream-num.github.io/LuckysheetDemo) / [Cooperative editing demo](http://luckysheet.lashuju.com/demo/) | [Chinese Forum](https://support.qq.com/product/288322) | + | [Gitee Mirror](https://gitee.com/mengshukeji/Luckysheet)| [Gitee Online Documentation](https://mengshukeji.gitee.io/LuckysheetDocs/) | [Gitee Online Demo](https://mengshukeji.gitee.io/luckysheetdemo/) | [Google Group](https://groups.google.com/g/luckysheet) | + +![Demo](/docs/.vuepress/public/img/LuckysheetDemo.gif) + +## Plugins + +For advanced features like import, export, and printing, please use [Univer](https://github.com/dream-num/univer/) + +## Ecosystem + +| Project | Description | +|---------|-------------| +| [Luckysheet Vue] | Luckysheet and Luckyexcel in a vue cli3 project | +| [Luckysheet Vue3] | Luckysheet and Luckyexcel in a vue3 project with vite| +| [Luckysheet React] | Luckysheet in a React project | +| [Luckyexcel Node] | Use Luckyexcel in koa2 | +| [Luckysheet Server] | Java backend Luckysheet Server | +| [Luckysheet Server Starter] | LuckysheetServer docker deployment startup template | + +[Luckysheet Vue]: https://github.com/mengshukeji/luckysheet-vue +[Luckysheet Vue3]: https://github.com/hjwforever/luckysheet-vue3-vite +[Luckysheet React]: https://github.com/mengshukeji/luckysheet-react +[Luckyexcel Node]: https://github.com/mengshukeji/Luckyexcel-node +[Luckysheet Server]: https://github.com/mengshukeji/LuckysheetServer +[Luckysheet Server Starter]: https://github.com/mengshukeji/LuckysheetServerStarter + + +## Features + +- **Formatting**: style, conditional formatting, text alignment and rotation, text truncation, overflow, automatic line wrapping, multiple data types, cell segmentation style +- **Cells**: drag and drop, fill handle, multiple selection, find and replace, location, merge cells, data verification +- **Row & column**: hide, insert, delete rows or columns, freeze, and split text +- **Operation**: undo, redo, copy, paste, cut, hot key, format painter, drag and drop selection +- **Formulas & Functions**: Built-in, remote and custom formulas +- **Tables**: filter, sort +- **Enhanced functions**: Pivot tables, charts, comments, cooperative editing, insert picture, matrix calculations, screenshots, copying to other formats, EXCEL import and export, etc. + +For a more detailed feature list, please refer to: [Features](https://dream-num.github.io/LuckysheetDocs/guide/#features) + +## 📖 Resources +- Priority reading for new users: [User Guide](https://github.com/mengshukeji/Luckysheet/wiki/User-Guide) +- For the tutorials, learning materials and supporting solutions provided by the community, please refer to: [Tutorials and Resources](https://dream-num.github.io/LuckysheetDocs/guide/resource.html) + +## 📜 Changelog + +Detailed changes for each release are documented in the [CHANGELOG.md](CHANGELOG.md). + +## ❗️ Issues + +Please make sure to read the [Issue Reporting Checklist](https://dream-num.github.io/LuckysheetDocs/guide/contribute.html#how-to-submit-issues) before opening an issue. Issues not conforming to the guidelines may be closed immediately. + +## ✅ TODO + +Managed with [GitHub Projects](https://github.com/mengshukeji/Luckysheet/projects/1) + +## 💪Contribution + +Please make sure to read the[ Contributing Guide](https://dream-num.github.io/LuckysheetDocs/guide/contribute.html) before making a pull request. + +## Usage + +### First step +Introduce dependencies through CDN +``` + + + + + + +``` +### Second step +Specify a table container +``` +
+``` +### Third step +Create a table +``` + +``` + +## Development + +### Requirements +[Node.js](https://nodejs.org/en/) Version >= 6 + +### Installation +``` +npm install +npm install gulp -g +``` +### Development +``` +npm run dev +``` +### Package +``` +npm run build +``` + +## Partner project + +- [h5-Dooring](https://github.com/MrXujiang/h5-Dooring) + +## Communication + +- [WebSite](http://lucky.lashuju.com/index.html) +- [Github Discussions](https://github.com/mengshukeji/Luckysheet/discussions) +- [Gitter](https://gitter.im/mengshukeji/Luckysheet) + +[Chinese community](./README-zh.md) + +## Sponsor + +Luckysheet is an MIT-licensed open source project with its ongoing development made possible entirely by the support of these awesome [backers](https://dream-num.github.io/LuckysheetDocs/about/sponsor.html#sponsors-list). If you'd like to join them, please consider: + +- [Become a backer or sponsor on Patreon](https://www.patreon.com/mengshukeji). +- [Become a backer or sponsor on Open Collective](https://opencollective.com/luckysheet). +- One-time donation via PayPal, WeChat or Alipay + +| PayPal | WeChat | Alipay | +|---|---|---| +| [Paypal Me](https://www.paypal.me/wbfsa) | | | + +### What's the difference between Patreon and OpenCollective? + +Funds donated via Patreon go directly to support mengshukeji's work on Luckysheet. Funds donated via OpenCollective are managed with transparent expenses and will be used for compensating work and expenses for core team members or sponsoring community events. Your name/logo will receive proper recognition and exposure by donating on either platform. + +## Sponsors List + +(Sort by time) +- *涛 ¥ 200 +- popo ¥ 1 +- 孔垂善 ¥ 5 +- Shawn文 ¥ 99 +- 幸运的小路易 ¥ 1 +- 冯启俊 ¥ 88 +- mxb ¥ 10 +- 祭阳 ¥ 20 +- *勇 ¥ 30 +- 虚我 ¥ 200 +- 甜党 ¥ 50 +- Alphabet(Google)-gcf ¥ 1 +- **平 ¥ 100 +- **东 ¥ 10 +- debugger ¥ 20 +- 烦了烦 ¥ 10 +- 文顶顶 ¥ 200 +- yangxshn ¥ 10 +- 爱乐 ¥ 100 +- 小李飞刀刀 ¥ 66 +- 张铭 ¥ 200 +- 曹治军 ¥ 1 +- *特 ¥ 10 +- **权 ¥ 9.9 +- **sdmq ¥ 20 +- *旭 ¥ 10 +- Quentin ¥ 20 +- 周宇凡 ¥ 100 +- *超 ¥ 10 +- 维宁 ¥ 100 +- hyy ¥ 20 +- 雨亭寒江月 ¥ 50 +- **功 ¥ 10 +- **光 ¥ 20 +- terrywan ¥ 100 +- 王晓洪 ¥ 10 +- Sun ¥ 10 +- 忧绣 ¥ 100 +- Jasonx ¥ 10 +- 国勇 ¥ 66.6 +- 郎志 ¥ 100 +- 匿名 ¥ 1 +- ni ¥ 100 +- 苏 ¥ 50 +- Mads_chan ¥ 1 +- LK ¥ 100 +- 智连方舟 李汪石 ¥ 168 +- **发 ¥ 260 +- *超 ¥ 10 +- *勇 ¥ 10 +- *腾 ¥ 15 +- 名字好难起 ¥ 20 +- 大山 ¥ 1 +- waiting ¥ 1000 +- **宇 ¥ 10.00 +- 刘小帅的哥哥 ¥ 20.00 +- 宁静致远 ¥ 10.00 +- Eleven ¥ 1.00 +- **帆 ¥ 188 +- henry ¥ 100 +- .波罗 ¥ 50 +- 花落有家 ¥ 50 +- 踏遍南水北山 ¥ 1 +- LC ¥ 5 +- **明 ¥ 8.80 +- *军 ¥ 20 +- 张彪 ¥ 50 +- 企业文档云@肖敏 ¥ 10 +- 匿名 ¥ 50 +- 逍遥行 ¥ 10 +- z.wasaki ¥ 50 +- Make Children ¥ 20 +- Foam ¥ 20 +- 奥特曼( o|o)ノ三 ¥ 50 +- **凯 ¥ 10 +- **兵 ¥ 20 +- **川 ¥ 1 +- 二万 ¥ 50 +- 蔚然成林 ¥ 10 +- 邹杰 ¥ 10 +- 张永强 ¥ 50 +- 鱼得水 ¥ 50 +- Ccther ¥ 1 +- Eric Cheng ¥ 10 +- 佚名 ¥ 1 +- 花叶 ¥ 50 +- GT ¥ 20 +- 菜菜心 ¥ 10 +- fisher ¥ 1 +- JC ¥ 5 +- 佚名 ¥ 20 +- 独孤一剑 ¥ 50 +- mxt ¥ 20 +- 一叶迷山 ¥ 100 +- Jeff ¥ 100 +- 八千多条狗🐶 ¥ 100 +- 晓峰 ¥ 10 +- 戒 ¥ 1 +- 浪里个浪 ¥ 1 +- 回调函数 ¥ 50 +- 赖瓜子 ¥ 5 +- Milo•J ¥ 20 +- 可道云 ¥ 200 +- *程 ¥ 10 +- 来一杯卡布酸奶 ¥ 5 +- 刘久胜 ¥ 100 +- 快意江湖 ¥ 50 +- *新 ¥ 9.9 +- **龙 ¥ 100 +- **江 ¥ 100 +- **威 ¥ 9.8 +- **涛 ¥ 500 +- **嘉 ¥ 10 +- *涛 ¥ 1 +- *兵 ¥ 5 +- *阳 ¥ 200 +- *辉 ¥ 1 +- *帆 ¥ 30 +- **旺 ¥ 10 +- **麟 ¥ 20 +- *霖 ¥ 9.9 +- *帅 ¥ 10 +- *鑫 ¥ 6.66 +- ~朴:shu ¥ 29.79 +- 未来 ¥ 1 +- 国勇 ¥ 0.1 +- 用心灵听雨 ¥ 10 +- 钊 ¥ 5 +- 星稀 ¥ 5 + +## Authors and acknowledgment + +### Active Core Team Members +- [@wbfsa](https://github.com/wbfsa) +- [@eiji-th](https://github.com/eiji-th) +- [@fly-95](https://github.com/fly-95) +- [@tonytonychopper123](https://github.com/tonytonychopper123) +- [@Dushusir](https://github.com/Dushusir) +- [@iamxuchen800117](https://github.com/iamxuchen800117) +- [@wpxp123456](https://github.com/wpxp123456) +- [@c19c19i](https://weibo.com/u/3884623955) +- [@zhangchen915](https://github.com/zhangchen915) +- [@jerry-f](https://github.com/jerry-f) +- [@flowerField](https://github.com/flowerField) + +### Community Partners +- [@yiwasheng](https://github.com/yiwasheng) +- [@danielcai1987](https://github.com/danielcai1987) +- [@qq6690876](https://github.com/qq6690876) +- [@javahuang](https://github.com/javahuang) +- [@TimerGang](https://github.com/TimerGang) +- [@gsw945](https://github.com/gsw945) +- [@swen-xiong](https://github.com/swen-xiong) +- [@lzmch](https://github.com/lzmch) +- [@kdevilpf](https://github.com/kdevilpf) +- [@WJWM0316](https://github.com/WJWM0316) + +## License +[MIT](http://opensource.org/licenses/MIT) + +Copyright (c) 2020-present, mengshukeji diff --git a/commitlint.config.js b/commitlint.config.js index f3f3988d8..18a2e9a64 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,3 +1,3 @@ -module.exports = { - extends: ['@commitlint/config-conventional'] -} +module.exports = { + extends: ['@commitlint/config-conventional'] +} diff --git a/deploy.bat b/deploy.bat index 51f8cdaac..ff0bc8cc1 100644 --- a/deploy.bat +++ b/deploy.bat @@ -1,103 +1,103 @@ -# deploy Demo -npm run build -cd dist -git init -git remote add origin https://github.com/mengshukeji/LuckysheetDemo.git -git config --local user.email "1414556676@qq.com" -git config --local user.name "Dushusir" -git add . -git commit -m 'deploy Luckysheet demo' -git push -f origin master:gh-pages - -# =============================================== - -# deploy Docs -npm run docs:build -cd docs/.vuepress/dist -git init -git remote add origin https://github.com/mengshukeji/LuckysheetDocs.git -git add . -git commit -m 'deploy Luckysheet docs' -git push -f origin master:gh-pages - -# =============================================== - -# add a tags -git tag -a doc -m "doc" - - -# replease -npm run build -npm run release -- --release-as patch -git push --follow-tags origin master -npm publish - -# only publish -npm run build -git add . -npm run commit -npm version patch -git push -u origin master -npm publish - - -# ============================================== - -# test feature branch -git checkout -b fea origin/feature -git pull - -## After some test, create PR merge feature to master branch - -git checkout master -git branch -d fea - -# =============================================== - -# test pull request: https://docs.github.com/cn/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/checking-out-pull-requests-locally - -# 139 is ID, dev is branch name -git fetch origin pull/139/head:test-139 -git checkout test-139 -# test code -git push origin test-139 -# create new PR ,merge test-139 to master - -# list all remote and local branchs -git branch -a -# delete remote branch -git push origin --delete dev -git checkout master -# delete local branch -git branch -d dev - -# pr -## 1. fork 到自己的仓库 - -## 2. git clone 到本地 - -## 3. 上游建立连接 -git remote add upstream https://github.com/mengshukeji/Luckysheet.git - -## 4. 创建开发分支 -git checkout -b dev - -## 5. 修改提交代码 -git add . -git commit -m "add" -git push origin dev - -## 6. 同步代码,将最新代码同步到本地 -git fetch upstream -git rebase upstream/master - -## 7. 如果有冲突(没有可以略过) -git status # 查看冲突文件,并修改冲突 -git add . -git rebase --continue - -## 8.提交分支代码 -git push origin dev - -## 7. 提交pr +# deploy Demo +npm run build +cd dist +git init +git remote add origin https://github.com/mengshukeji/LuckysheetDemo.git +git config --local user.email "1414556676@qq.com" +git config --local user.name "Dushusir" +git add . +git commit -m 'deploy Luckysheet demo' +git push -f origin master:gh-pages + +# =============================================== + +# deploy Docs +npm run docs:build +cd docs/.vuepress/dist +git init +git remote add origin https://github.com/mengshukeji/LuckysheetDocs.git +git add . +git commit -m 'deploy Luckysheet docs' +git push -f origin master:gh-pages + +# =============================================== + +# add a tags +git tag -a doc -m "doc" + + +# replease +npm run build +npm run release -- --release-as patch +git push --follow-tags origin master +npm publish + +# only publish +npm run build +git add . +npm run commit +npm version patch +git push -u origin master +npm publish + + +# ============================================== + +# test feature branch +git checkout -b fea origin/feature +git pull + +## After some test, create PR merge feature to master branch + +git checkout master +git branch -d fea + +# =============================================== + +# test pull request: https://docs.github.com/cn/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/checking-out-pull-requests-locally + +# 139 is ID, dev is branch name +git fetch origin pull/139/head:test-139 +git checkout test-139 +# test code +git push origin test-139 +# create new PR ,merge test-139 to master + +# list all remote and local branchs +git branch -a +# delete remote branch +git push origin --delete dev +git checkout master +# delete local branch +git branch -d dev + +# pr +## 1. fork 到自己的仓库 + +## 2. git clone 到本地 + +## 3. 上游建立连接 +git remote add upstream https://github.com/mengshukeji/Luckysheet.git + +## 4. 创建开发分支 +git checkout -b dev + +## 5. 修改提交代码 +git add . +git commit -m "add" +git push origin dev + +## 6. 同步代码,将最新代码同步到本地 +git fetch upstream +git rebase upstream/master + +## 7. 如果有冲突(没有可以略过) +git status # 查看冲突文件,并修改冲突 +git add . +git rebase --continue + +## 8.提交分支代码 +git push origin dev + +## 7. 提交pr 去自己github仓库对应fork的项目下new pull request \ No newline at end of file diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 87e6df39c..3bda4eda4 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -1,147 +1,147 @@ -module.exports = { - base: '/LuckysheetDocs/', - locales: { - // 键名是该语言所属的子路径 - // 作为特例,默认语言可以使用 '/' 作为其路径。 - '/': { - lang: 'en-US', // 将会被设置为 的 lang 属性 - title: 'Luckysheet Document', - description: 'Luckysheet is an online spreadsheet like excel that is powerful, simple to configure, and completely open source.This site contains official configuration document, API, and tutorial.' - }, - '/zh/': { - lang: 'zh-CN', - title: 'Luckysheet文档', - description: 'Luckysheet ,一款纯前端类似excel的在线表格,功能强大、配置简单、完全开源。本站包含官方配置文档,API,教程。' - }, - - }, - themeConfig: { - domain: 'https://mengshukeji.github.io/LuckysheetDemo', - logo: '/img/logo.png', - author: 'Luckysheet', - // 仓库地址 - repo: 'mengshukeji/Luckysheet', - // 允许编辑链接文字 - editLinks: true, - // 仓库的文档目录 - docsDir: 'docs', - // 页面滚动 - smoothScroll: true, - locales: { - '/': { - selectText: 'Languages', - label: 'English', - ariaLabel: 'Select language', - editLinkText: 'Edit this page on GitHub', - lastUpdated: 'Last Updated', - serviceWorker: { - updatePopup: { - message: "New content is available.", - buttonText: "Refresh" - } - }, - nav: [ - { text: 'Home', link: '/' }, - { text: 'Guide', link: '/guide/' }, - { text: 'Demo', link: 'https://mengshukeji.github.io/LuckysheetDemo/' }, - { - text: 'More', - ariaLabel: 'More', - items: [ - { text: 'About', link: '/about/' } - ] - }, - ], - // 侧边栏 - sidebar: { - '/guide/': [ - '', - 'config', - 'sheet', - 'cell', - 'operate', - 'api', - 'resource', - 'FAQ', - 'contribute' - ], - '/about/': [ - '', - 'sponsor', - 'company' - ], - }, - }, - '/zh/': { - // 多语言下拉菜单的标题 - selectText: '选择语言', - // 该语言在下拉菜单中的标签 - label: '简体中文', - ariaLabel: '选择语言', - // 编辑链接文字 - editLinkText: '在 GitHub 上编辑此页', - lastUpdated: '上次更新', - // Service Worker 的配置 - serviceWorker: { - updatePopup: { - message: "发现新内容可用.", - buttonText: "刷新" - } - }, - // 导航栏 - nav: [ - { text: '首页', link: '/zh/' }, - { text: '指南', link: '/zh/guide/' }, - { text: '演示', link: 'https://mengshukeji.github.io/LuckysheetDemo/' }, - { - text: '了解更多', - ariaLabel: '了解更多', - items: [ - { text: '关于', link: '/zh/about/' } - ] - }, - ], - // 侧边栏 - sidebar: { - '/zh/guide/': [ - '', - 'config', - 'sheet', - 'cell', - 'operate', - 'api', - 'resource', - 'FAQ', - 'contribute' - ], - '/zh/about/': [ - '', - 'sponsor', - 'company' - ], - }, - }, - - }, - }, - plugins: { - 'vuepress-plugin-baidu-autopush': {}, - 'sitemap': { - hostname: 'https://mengshukeji.github.io/LuckysheetDocs' - }, - 'vuepress-plugin-code-copy': true, - 'seo': { - siteTitle: (_, $site) => $site.title, - title: $page => $page.title, - description: $page => $page.frontmatter.description, - author: (_, $site) => $site.themeConfig.author, - tags: $page => $page.frontmatter.tags, - twitterCard: _ => 'summary_large_image', - type: $page => ['guide'].some(folder => $page.regularPath.startsWith('/' + folder)) ? 'article' : 'website', - url: (_, $site, path) => ($site.themeConfig.domain || '') + path, - image: ($page, $site) => $page.frontmatter.image && (($site.themeConfig.domain && !$page.frontmatter.image.startsWith('http') || '') + $page.frontmatter.image), - publishedAt: $page => $page.frontmatter.date && new Date($page.frontmatter.date), - modifiedAt: $page => $page.lastUpdated && new Date($page.lastUpdated), - } - } +module.exports = { + base: '/LuckysheetDocs/', + locales: { + // 键名是该语言所属的子路径 + // 作为特例,默认语言可以使用 '/' 作为其路径。 + '/': { + lang: 'en-US', // 将会被设置为 的 lang 属性 + title: 'Luckysheet Document', + description: 'Luckysheet is an online spreadsheet like excel that is powerful, simple to configure, and completely open source.This site contains official configuration document, API, and tutorial.' + }, + '/zh/': { + lang: 'zh-CN', + title: 'Luckysheet文档', + description: 'Luckysheet ,一款纯前端类似excel的在线表格,功能强大、配置简单、完全开源。本站包含官方配置文档,API,教程。' + }, + + }, + themeConfig: { + domain: 'https://dream-num.github.io/LuckysheetDemo', + logo: '/img/logo.png', + author: 'Luckysheet', + // 仓库地址 + repo: 'mengshukeji/Luckysheet', + // 允许编辑链接文字 + editLinks: true, + // 仓库的文档目录 + docsDir: 'docs', + // 页面滚动 + smoothScroll: true, + locales: { + '/': { + selectText: 'Languages', + label: 'English', + ariaLabel: 'Select language', + editLinkText: 'Edit this page on GitHub', + lastUpdated: 'Last Updated', + serviceWorker: { + updatePopup: { + message: "New content is available.", + buttonText: "Refresh" + } + }, + nav: [ + { text: 'Home', link: '/' }, + { text: 'Guide', link: '/guide/' }, + { text: 'Demo', link: 'https://dream-num.github.io/LuckysheetDemo/' }, + { + text: 'More', + ariaLabel: 'More', + items: [ + { text: 'About', link: '/about/' } + ] + }, + ], + // 侧边栏 + sidebar: { + '/guide/': [ + '', + 'config', + 'sheet', + 'cell', + 'operate', + 'api', + 'resource', + 'FAQ', + 'contribute' + ], + '/about/': [ + '', + 'sponsor', + 'company' + ], + }, + }, + '/zh/': { + // 多语言下拉菜单的标题 + selectText: '选择语言', + // 该语言在下拉菜单中的标签 + label: '简体中文', + ariaLabel: '选择语言', + // 编辑链接文字 + editLinkText: '在 GitHub 上编辑此页', + lastUpdated: '上次更新', + // Service Worker 的配置 + serviceWorker: { + updatePopup: { + message: "发现新内容可用.", + buttonText: "刷新" + } + }, + // 导航栏 + nav: [ + { text: '首页', link: '/zh/' }, + { text: '指南', link: '/zh/guide/' }, + { text: '演示', link: 'https://dream-num.github.io/LuckysheetDemo/' }, + { + text: '了解更多', + ariaLabel: '了解更多', + items: [ + { text: '关于', link: '/zh/about/' } + ] + }, + ], + // 侧边栏 + sidebar: { + '/zh/guide/': [ + '', + 'config', + 'sheet', + 'cell', + 'operate', + 'api', + 'resource', + 'FAQ', + 'contribute' + ], + '/zh/about/': [ + '', + 'sponsor', + 'company' + ], + }, + }, + + }, + }, + plugins: { + 'vuepress-plugin-baidu-autopush': {}, + 'sitemap': { + hostname: 'https://dream-num.github.io/LuckysheetDocs' + }, + 'vuepress-plugin-code-copy': true, + 'seo': { + siteTitle: (_, $site) => $site.title, + title: $page => $page.title, + description: $page => $page.frontmatter.description, + author: (_, $site) => $site.themeConfig.author, + tags: $page => $page.frontmatter.tags, + twitterCard: _ => 'summary_large_image', + type: $page => ['guide'].some(folder => $page.regularPath.startsWith('/' + folder)) ? 'article' : 'website', + url: (_, $site, path) => ($site.themeConfig.domain || '') + path, + image: ($page, $site) => $page.frontmatter.image && (($site.themeConfig.domain && !$page.frontmatter.image.startsWith('http') || '') + $page.frontmatter.image), + publishedAt: $page => $page.frontmatter.date && new Date($page.frontmatter.date), + modifiedAt: $page => $page.lastUpdated && new Date($page.lastUpdated), + } + } } \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index 198825b98..608ffc250 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,15 +1,15 @@ ---- -home: true -heroText: Luckysheet -tagline: Configuration Document · API · Tutorial -actionText: Get Started → -actionLink: /guide/ -features: -- title: Powerful Features - details: Contains a large number of commonly used spreadsheet functions to replace your excel -- title: Simple Configuration - details: Get started with minimal configuration -- title: Open Source - details: Community driven, work together to improve your ideas -footer: MIT Licensed | Copyright © 2020-present Mengshukeji +--- +home: true +heroText: Luckysheet +tagline: Configuration Document · API · Tutorial +actionText: Get Started → +actionLink: /guide/ +features: +- title: Powerful Features + details: Contains a large number of commonly used spreadsheet functions to replace your excel +- title: Simple Configuration + details: Get started with minimal configuration +- title: Open Source + details: Community driven, work together to improve your ideas +footer: MIT Licensed | Copyright © 2020-present Mengshukeji --- \ No newline at end of file diff --git a/docs/about/README.md b/docs/about/README.md index 6ceeae8c0..2c8e3d580 100644 --- a/docs/about/README.md +++ b/docs/about/README.md @@ -1,28 +1,28 @@ -# Meet the Team - -Luckysheet is a project led by an individual and jointly developed by several friends with the same interests. - -### Active Core Team Members -- [@wbfsa](https://github.com/wbfsa) -- [@eiji-th](https://github.com/eiji-th) -- [@fly-95](https://github.com/fly-95) -- [@tonytonychopper123](https://github.com/tonytonychopper123) -- [@Dushusir](https://github.com/Dushusir) -- [@iamxuchen800117](https://github.com/iamxuchen800117) -- [@wpxp123456](https://github.com/wpxp123456) -- [@c19c19i](https://weibo.com/u/3884623955) -- [@zhangchen915](https://github.com/zhangchen915) -- [@jerry-f](https://github.com/jerry-f) -- [@flowerField](https://github.com/flowerField) - -### Community Partners -- [@yiwasheng](https://github.com/yiwasheng) -- [@danielcai1987](https://github.com/danielcai1987) -- [@qq6690876](https://github.com/qq6690876) -- [@javahuang](https://github.com/javahuang) -- [@TimerGang](https://github.com/TimerGang) -- [@gsw945](https://github.com/gsw945) -- [@swen-xiong](https://github.com/swen-xiong) -- [@lzmch](https://github.com/lzmch) -- [@kdevilpf](https://github.com/kdevilpf) +# Meet the Team + +Luckysheet is a project led by an individual and jointly developed by several friends with the same interests. + +### Active Core Team Members +- [@wbfsa](https://github.com/wbfsa) +- [@eiji-th](https://github.com/eiji-th) +- [@fly-95](https://github.com/fly-95) +- [@tonytonychopper123](https://github.com/tonytonychopper123) +- [@Dushusir](https://github.com/Dushusir) +- [@iamxuchen800117](https://github.com/iamxuchen800117) +- [@wpxp123456](https://github.com/wpxp123456) +- [@c19c19i](https://weibo.com/u/3884623955) +- [@zhangchen915](https://github.com/zhangchen915) +- [@jerry-f](https://github.com/jerry-f) +- [@flowerField](https://github.com/flowerField) + +### Community Partners +- [@yiwasheng](https://github.com/yiwasheng) +- [@danielcai1987](https://github.com/danielcai1987) +- [@qq6690876](https://github.com/qq6690876) +- [@javahuang](https://github.com/javahuang) +- [@TimerGang](https://github.com/TimerGang) +- [@gsw945](https://github.com/gsw945) +- [@swen-xiong](https://github.com/swen-xiong) +- [@lzmch](https://github.com/lzmch) +- [@kdevilpf](https://github.com/kdevilpf) - [@WJWM0316](https://github.com/WJWM0316) \ No newline at end of file diff --git a/docs/about/company.md b/docs/about/company.md index e01b43cd4..f197f3f92 100644 --- a/docs/about/company.md +++ b/docs/about/company.md @@ -1,49 +1,49 @@ -# Community case - -We collected a lot of case feedback from the community, and also discovered Luckysheet usage scenarios that we did not expect before. - -It is our responsibility to actively listen to the voice of the community, and to continuously update and iterate with your support and feedback. - - -## Company Case - - - - - - - - - - - - - - - - +# Community case + +We collected a lot of case feedback from the community, and also discovered Luckysheet usage scenarios that we did not expect before. + +It is our responsibility to actively listen to the voice of the community, and to continuously update and iterate with your support and feedback. + + +## Company Case + +
- - - -

雄安智评云数字科技有限公司

-
- - - -

Code the Future

-
- - - -

吉客云

-
- - - -

华为

-
- - - -
+ + + + + + + + + + + + + +
+ + + +

雄安智评云数字科技有限公司

+
+ + + +

Code the Future

+
+ + + +

吉客云

+
+ + + +

华为

+
+ + + +
\ No newline at end of file diff --git a/docs/about/sponsor.md b/docs/about/sponsor.md index d7d1f8789..68259188b 100644 --- a/docs/about/sponsor.md +++ b/docs/about/sponsor.md @@ -1,71 +1,156 @@ -# Sponsor - -## Why sponsor - -If you run a business and is using Luckysheet in a revenue-generating product, it would make business sense to sponsor Luckysheet development: it ensures the project that your product relies on stays healthy and actively maintained. It can also help your exposure in the Luckysheet community and more people pay attention to your products. - -Of course, individual users are also welcome to buy author a glass of juice if Luckysheet has helped you in your work or personal projects 😋. - -## How to sponsor - -Luckysheet is an MIT-licensed open source project with its ongoing development made possible entirely by the support of these awesome [**backers**](#sponsors-list). If you'd like to join them, please consider: - -- [Become a backer or sponsor on Patreon](https://www.patreon.com/mengshukeji). -- [Become a backer or sponsor on Open Collective](https://opencollective.com/luckysheet). -- One-time donation via PayPal, WeChat or Alipay - -| PayPal | WeChat | Alipay | -|---|---|---| -| [Paypal Me](https://www.paypal.me/wbfsa) | | | - -### What's the difference between Patreon and OpenCollective? - -Funds donated via Patreon go directly to support mengshukeji's work on Luckysheet. Funds donated via OpenCollective are managed with transparent expenses and will be used for compensating work and expenses for core team members or sponsoring community events. Your name/logo will receive proper recognition and exposure by donating on either platform. - -## Sponsors List - -(Sort by time) -- *勇 ¥ 30 -- 虚我 ¥ 200 -- 甜党 ¥ 50 -- Alphabet(Google)-gcf ¥ 1 -- **平 ¥ 100 -- **东 ¥ 10 -- debugger ¥ 20 -- 烦了烦 ¥ 10 -- 文顶顶 ¥ 200 -- yangxshn ¥ 10 -- 爱乐 ¥ 100 -- 小李飞刀刀 ¥ 66 -- 张铭 ¥ 200 -- 曹治军 ¥ 1 -- *特 ¥ 10 -- **权 ¥ 9.9 -- **sdmq ¥ 20 -- *旭 ¥ 10 -- Quentin ¥ 20 -- 周宇凡 ¥ 100 -- *超 ¥ 10 -- 维宁 ¥ 100 -- hyy ¥ 20 -- 雨亭寒江月 ¥ 50 -- **功 ¥ 10 -- **光 ¥ 20 -- terrywan ¥ 100 -- 王晓洪 ¥ 10 -- Sun ¥ 10 -- 忧绣 ¥ 100 -- Jasonx ¥ 10 -- 国勇 ¥ 66.6 -- 郎志 ¥ 100 -- 匿名 ¥ 1 -- ni ¥ 100 -- 苏 ¥ 50 -- Mads_chan ¥ 1 -- LK ¥ 100 -- 智连方舟 李汪石 ¥ 168 -- **发 ¥ 260 -- *超 ¥ 10 -- *勇 ¥ 10 -- *腾 ¥ 15 -- 名字好难起 ¥ 20 +# Sponsor + +## Why sponsor + +If you run a business and is using Luckysheet in a revenue-generating product, it would make business sense to sponsor Luckysheet development: it ensures the project that your product relies on stays healthy and actively maintained. It can also help your exposure in the Luckysheet community and more people pay attention to your products. + +Of course, individual users are also welcome to buy author a glass of juice if Luckysheet has helped you in your work or personal projects 😋. + +## How to sponsor + +Luckysheet is an MIT-licensed open source project with its ongoing development made possible entirely by the support of these awesome [**backers**](#sponsors-list). If you'd like to join them, please consider: + +- [Become a backer or sponsor on Patreon](https://www.patreon.com/mengshukeji). +- [Become a backer or sponsor on Open Collective](https://opencollective.com/luckysheet). +- One-time donation via PayPal, WeChat or Alipay + +| PayPal | WeChat | Alipay | +|---|---|---| +| [Paypal Me](https://www.paypal.me/wbfsa) | | | + +### What's the difference between Patreon and OpenCollective? + +Funds donated via Patreon go directly to support mengshukeji's work on Luckysheet. Funds donated via OpenCollective are managed with transparent expenses and will be used for compensating work and expenses for core team members or sponsoring community events. Your name/logo will receive proper recognition and exposure by donating on either platform. + +## Sponsors List + +(Sort by time) +- *涛 ¥ 200 +- popo ¥ 1 +- 孔垂善 ¥ 5 +- Shawn文 ¥ 99 +- 幸运的小路易 ¥ 1 +- 冯启俊 ¥ 88 +- mxb ¥ 10 +- 祭阳 ¥ 20 +- *勇 ¥ 30 +- 虚我 ¥ 200 +- 甜党 ¥ 50 +- Alphabet(Google)-gcf ¥ 1 +- **平 ¥ 100 +- **东 ¥ 10 +- debugger ¥ 20 +- 烦了烦 ¥ 10 +- 文顶顶 ¥ 200 +- yangxshn ¥ 10 +- 爱乐 ¥ 100 +- 小李飞刀刀 ¥ 66 +- 张铭 ¥ 200 +- 曹治军 ¥ 1 +- *特 ¥ 10 +- **权 ¥ 9.9 +- **sdmq ¥ 20 +- *旭 ¥ 10 +- Quentin ¥ 20 +- 周宇凡 ¥ 100 +- *超 ¥ 10 +- 维宁 ¥ 100 +- hyy ¥ 20 +- 雨亭寒江月 ¥ 50 +- **功 ¥ 10 +- **光 ¥ 20 +- terrywan ¥ 100 +- 王晓洪 ¥ 10 +- Sun ¥ 10 +- 忧绣 ¥ 100 +- Jasonx ¥ 10 +- 国勇 ¥ 66.6 +- 郎志 ¥ 100 +- 匿名 ¥ 1 +- ni ¥ 100 +- 苏 ¥ 50 +- Mads_chan ¥ 1 +- LK ¥ 100 +- 智连方舟 李汪石 ¥ 168 +- **发 ¥ 260 +- *超 ¥ 10 +- *勇 ¥ 10 +- *腾 ¥ 15 +- 名字好难起 ¥ 20 +- 大山 ¥ 1 +- waiting ¥ 1000 +- **宇 ¥ 10.00 +- 刘小帅的哥哥 ¥ 20.00 +- 宁静致远 ¥ 10.00 +- Eleven ¥ 1.00 +- **帆 ¥ 188 +- henry ¥ 100 +- .波罗 ¥ 50 +- 花落有家 ¥ 50 +- 踏遍南水北山 ¥ 1 +- LC ¥ 5 +- **明 ¥ 8.80 +- *军 ¥ 20 +- 张彪 ¥ 50 +- 企业文档云@肖敏 ¥ 10 +- 匿名 ¥ 50 +- 逍遥行 ¥ 10 +- z.wasaki ¥ 50 +- Make Children ¥ 20 +- Foam ¥ 20 +- 奥特曼( o|o)ノ三 ¥ 50 +- **凯 ¥ 10 +- **兵 ¥ 20 +- **川 ¥ 1 +- 二万 ¥ 50 +- 蔚然成林 ¥ 10 +- 邹杰 ¥ 10 +- 张永强 ¥ 50 +- 鱼得水 ¥ 50 +- Ccther ¥ 1 +- Eric Cheng ¥ 10 +- 佚名 ¥ 1 +- 花叶 ¥ 50 +- GT ¥ 20 +- 菜菜心 ¥ 10 +- fisher ¥ 1 +- JC ¥ 5 +- 佚名 ¥ 20 +- 独孤一剑 ¥ 50 +- mxt ¥ 20 +- 一叶迷山 ¥ 100 +- Jeff ¥ 100 +- 八千多条狗🐶 ¥ 100 +- 晓峰 ¥ 10 +- 戒 ¥ 1 +- 浪里个浪 ¥ 1 +- 回调函数 ¥ 50 +- 赖瓜子 ¥ 5 +- Milo•J ¥ 20 +- 可道云 ¥ 200 +- *程 ¥ 10 +- 来一杯卡布酸奶 ¥ 5 +- 刘久胜 ¥ 100 +- 快意江湖 ¥ 50 +- *新 ¥ 9.9 +- **龙 ¥ 100 +- **江 ¥ 100 +- **威 ¥ 9.8 +- **涛 ¥ 500 +- **嘉 ¥ 10 +- *涛 ¥ 1 +- *兵 ¥ 5 +- *阳 ¥ 200 +- *辉 ¥ 1 +- *帆 ¥ 30 +- **旺 ¥ 10 +- **麟 ¥ 20 +- *霖 ¥ 9.9 +- *帅 ¥ 10 +- *鑫 ¥ 6.66 +- ~朴:shu ¥ 29.79 +- 未来 ¥ 1 +- 国勇 ¥ 0.1 +- 用心灵听雨 ¥ 10 +- 钊 ¥ 5 +- 星稀 ¥ 5 \ No newline at end of file diff --git a/docs/guide/FAQ.md b/docs/guide/FAQ.md index 274777226..55ea3f10e 100644 --- a/docs/guide/FAQ.md +++ b/docs/guide/FAQ.md @@ -1,325 +1,325 @@ -# FAQ - -The content of this chapter collects the common problems that everyone has feedback. If the official documents and this list can’t answer your questions, I recommend you to [Official Forum](https://github.com/mengshukeji/Luckysheet/discussions) - -## What is the difference between data and celldata in luckysheetfile? - -**A**: Use one-dimensional array format [celldata](/guide/sheet.html#celldata), 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 [transToCellData(data)](/guide/api.html#transtocelldata-data-setting) to convert it to celldata data. -Among them, the celldata in `{ r, c, v }` format is converted to a two-dimensional array using [transToData(celldata)](/guide/api.html#transtodata-celldata-setting) - -Summarized as follows: -```js -// data => celldata two-dimensional array data into {r, c, v} format one-dimensional array -luckysheet.transToCellData(data) - -// celldata => data to generate the two-dimensional array required for the table -luckysheet.transToData(celldata) -``` - ------------- - -## What are the cell types? - -**A**: Refer to [Cell Format List](/guide/cell.html), with examples of available cell formats - ------------- - -## How to use Luckysheet in Vue/React project? - -**A**: Check - -- Vue case: [luckysheet-vue](https://github.com/mengshukeji/luckysheet-vue) -- React case: [luckysheet-react](https://github.com/mengshukeji/luckysheet-react) - ------------- - -## Why will the formula in the table not be triggered after initialization? - -**A**: Refer to [Table data format](/guide/sheet.html#calcchain) ,just set the calcChain corresponding to the cell data. - ------------- - -## Is the remote loading data loadUrl or updateUrl? - -**A**: [loadUrl](/guide/config.html#loadurl). Configure loadUrl, Luckysheet will request the entire table data through ajax, and updateUrl will be used as the interface address for collaborative editing in real-time saving. -Note: Initial data needs to be configured with loadUrl parameter, while for collaborative editing, the four parameters of loadUrl, updateUrl and allowUpdate can be configured to take effect. - ------------- - -## What is the difference between `index` and `order` for each sheet page? - -**A**: Each sheet page has a unique id, which is `index`, which can be incremented by numbers or a random string. And `order` is the sorting situation of all sheets, starting from 0, can only be numbers `0,1,2...`. - ------------- - -## Why can’t I run the project directly under the dist folder? - -**A**: Need to start the local server - -- [Node build a local server](https://github.com/JacksonTian/anywhere) -- [Python build local server](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/set_up_a_local_testing_server) - ------------- - -## How to import and export excel? - -**A**: The excel import and export library developed with Luckysheet-[Luckyexcel](https://github.com/mengshukeji/Luckyexcel) has realized the excel import function, and the export function is under development.You can refer to these 2 blog posts for excel export at this stage: - -- [Development of Excel download function based on LuckySheet online form](https://www.cnblogs.com/recode-hyh/p/13168226.html) -- [Use exceljs to export luckysheet form](https://blog.csdn.net/csdn_lsy/article/details/107179708) - ------------- - -## How to merge cells during initialization? - -**A**: Refer to the following case: -- [How Luckysheet initializes the data with merged cells](https://www.cnblogs.com/DuShuSir/p/13272397.html) - ------------- - -## How does 'Luckysheet' save the data from the table to the database? Is there a soulution for storage and collaboration? - -**A**: There are two options: - -- 1. after the table operation is completed, you can use `luckysheet.getAllSheets()` to get all sheet data that stroed in the back-end. -- 2. enable the collaborative editing function to transmit data to the back-end in real-time. -refer this article: -[How Luckysheet saves the data in the table to the database](https://www.cnblogs.com/DuShuSir/p/13857874.html) - ------------- - -## How to monitor cell hover or click events? how to monitor `cellRenderAfter` in real-time? - -**A**: We have collected the secondary development requirements for cell events, and planned the cell-related hook functions, refer to [cell hook function](/guide/config.html#cellrenderafter) (the TODO displayed is not yet open) - ------------- - -## How to customize the top toolbar? - -**A**: -reference: [options.showtoolbarconfig](/guide/config.html#showtoolbarconfig)(TODO means waiting to developed) - ------------- - -## Does the project use jQuery? - -**A**: yes. At the beginning, Luckysheet uses jQuery。The packaging tool will package the jQuery to this file `./plugins/js/plugin.js` - -If your project (such as react / Vue) also references jQuery globally and causes conflicts, you can try to remove a jQuery. - -if you want to remove jQuery in `Luckysheet`, you can find `jQuery` in source code folder `gulpfile.js`: [src/plugins/js/jquery.min.js](https://github.com/mengshukeji/Luckysheet/blob/master/gulpfile.js),then delete information related to jQuery. - ------------- - -## How to add a field to a cell object? - -**A**: reference [cell object format](/guide/cell.html),then read this annotation[src/controllers/postil.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/postil.js)。the annotation is a configuration in a cell object. - ------------- - -## The toolbar icon is on the loading stage all the time. - -**A**: The luckysheet use iconfont icon in this project, if any icon cannot be loaded ,plz check your iconfont.css. we are so sorry that we did not describe it clearly in the old version documents. - -Now the documents have been updated.[official documents](/guide/#steps-for-usage) - ------------- - -## Can't run Luckyexcel after package. - -**A**: Terminal does not show `end`, but if the `dist` folder has this file `luckyexcel.js`, it is normal. - -Lucky excel is an excel import and export library. The project uses `gulp` as a packaging tool. There is a problem with the old version of the packaging tool, but it is fixed now. if this problem still troubles you, plz check the following steps: -1. pull the latest code. -2. `npm i` -3. `npm run build` - -more information: [Luckyexcel](https://github.com/mengshukeji/Luckyexcel/) - ------------- - -## How to disable editing of cells?How to open sheet protection? - -**A**: Sheet protection includes disable editing of cells that you need to make some configurations on each sheets. `config.authority`, the latest configurations[sheet protection](/guide/sheet.html#config-authority)。 - -In order to make it easier for you to understand the function of sheet protection, the following video shows how to make the whole sheet uneditable, but allow a column of cells to be edited: - - - -In you local browser, you can open the control pannel, use `luckysheet.getLuckysheetfile()[0].config.authority` to get the configuration parameters. - ------------- - -## How to configure data validation? - -**A**: there is the configuration of data validation,[data validation](/guide/sheet.html#dataVerification)。Also there is the API that you can use `data validation` in any time. [setDataVerification](/guide/api.html#setdataverification-optionitem-setting). - ------------- - -## Is there a case for using Luckysheet with CDN? - -**A**: Luckysheet supports CDN. reference: [The case of using luckysheet by CDN](https://www.cnblogs.com/DuShuSir/p/13859103.html) - ------------- - -## how to limit the adaptive height of a picture in a cell? - -**A**: First of all, you need to move the picture and adjust the cell size, and then there are the following situations: - -- if the cell contains a picture and you expand the cell, the picure will not be expanded. -- if the cell contains a picture and you shorten the cell to the edge of the picture, the picture will shrink. -- When the picture exceeds the border of the cell, the size of this picture will change with the size of the cell. - -if you want to get the position of the picture, you can overlap the picture with the border of the cell.(in the source code, it needs to overlap more than 2px.)The following demo video shows how to limit the image to the adaptive width and height of the cell. - - - ------------- - -## How to get the default row height and column width of the worksheet? - -**A**: There are two ways to get it - -- 1. use `luckysheet.getLuckysheetfile()` to get all configuration data, so you can get the `defaultRowHeight` and `defaultColWidth` in the sheet configuration data。 -- 2. use API to get the default row height [getDefaultRowHeight](/guide/api.html#getdefaultrowheight-setting) and column width.[getDefaultColWidth](/guide/api.html#getdefaultcolwidth-setting) - ------------- - -## How to hide the add row button and the back to top button below the worksheet? - -**A**: Configuration is open -- Allow adding rows [enableAddRow](/guide/config.html#enableaddrow) -- Allow back to top [enableAddBackTop](/guide/config.html#enableAddBackTop) - ------------- - -## How to hide the row and column headings of the worksheet? - -**A**: Configuration is open -- The width of the row header area [rowHeaderWidth](/guide/config.html#rowheaderwidth) -- The height of the column header area [columnHeaderHeight](/guide/config.html#columnHeaderHeight) - ------------- - -## What method can be called to set `config.merge`? - -**A**: Three methods -- Interface operation -- Use API: [setRangeMerge](/guide/api.html#setrangemerge-type-setting) -- Manually assemble merge parameters - ------------- - -## Why is the official new feature ineffective? - -**A**: The first step is to check whether you have used CDN to import, - -The CDN link used in the Luckysheet tutorial is the service provided by [jsdelivr](https://www.jsdelivr.com/package/npm/luckysheet), and the code is from [npmjs.com](https://www.npmjs.com/) automatically sync the past, not from [Github](https://github.com/mengshukeji/Luckysheet/). Because our newly submitted code still needs to be tested for a period of time, it will not be released to npm immediately, causing the npm code to lag behind Github. - -If you need to try the latest code, we strongly recommend that you pull the code from the [Luckysheet Github](https://github.com/mengshukeji/Luckysheet/) main repository. After our version is stable, we will consider releasing the npm package in real time. - -The second step, if it is to import the packaged code of the github repository, test to determine whether there is a bug, you can find the problem and try to fix it, and then [submit a PR](https://github.com/mengshukeji/Luckysheet/pulls), if can't fix it, please [submit issues](https://github.com/mengshukeji/Luckysheet/issues). - ------------- - -## `npm run dev` reported an error: ʻError: Cannot find module'rollup'`? - -**A**: It may be a problem with the npm package installation, try the following steps: -1. `npm cache clean --force` -2. `npm i rimraf -g` -3. `rimraf node_modules` -4. Delete the package-lock.json file -5. `npm i` -6. `npm run dev` - -Tip: Most other npm installation problems can also be solved by trying above steps. - ------------- - -## How to carry out secondary development of Luckysheet in Vue project? - -**A**: The [luckysheet-vue](https://github.com/mengshukeji/luckysheet-vue) case is to provide an application integration solution. - -If directly developed locally: -1. Start both the Luckysheet project and your own Vue project. For example, the Luckysheet project is at http://localhost:3001 -2. Import Luckysheet to use in the Vue project through `http://localhost:3001` - -In this case, after Luckysheet is modified in real time, the changes can be seen in the Vue project - ------------- - -## Error reporting `Store.createChart` when creating chart? - -**A**: You need to introduce a chart plugin to use it. You should configure the chart plugin to use when the workbook is initialized. Refer to - -- Plugins configuration [plugins](/guide/config.html#plugins) -- 或 官方demo [src/index.html](https://github.com/mengshukeji/Luckysheet/blob/master/src/index.html) - ------------- - -## Can cells add custom attributes? - -**A**: The custom attributes directly assigned to the cell object will be filtered. To make the custom attributes take effect, you need to edit the code to remove the filter attributes. - ------------- - -## How to enter text starting with `'='`? For example, `=currentDate('YYYY-MM-DD')`, it will remove the function by default, how to prohibit the function? - -**A**: Just add a single quotation mark in front of it, and it will be forcibly recognized as a string, which is consistent with excel. For example: `'=currentDate('YYYY-MM-DD')` - ------------- - -## Why does the create callback have no effect? - -**A**: The API method `luckysheet.create()` does not have a callback, but Luckysheet provides a hook function to execute the callback method at a specified location, such as: -- Triggered before the workbook is created [workbookCreateBefore](/guide/config.html#workbookcreatebefore) -- Triggered after the workbook is created [workbookCreateAfter](/guide/config.html#workbookcreateafter) - ------------- - -## When create, the first cell is selected by default, how to remove it? - -**A**: When the cell is selected, it is highlighted by default, just remove the highlight, use API: [setRangeShow](/guide/api.html#setrangeshow-range-setting) - -```js -luckysheet.setRangeShow("A2",{show:false}) -``` - ------------- - -## Where is the right-click event bound? - -**A**: In the source code [src/controllers/hander.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/handler.js), search for `event.which == "3"` to find the code executed by the right-click event. - ------------- - -## How to add a custom toolbar? - -**A**: No configuration is currently provided, you can refer to the implementation of the print button in the toolbar to modify the source code: -1. Search for `luckysheet-icon-print` globally to find the implementation of the print button, in [src/controllers/constant.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/constant.js) add a similar template string, you need to customize a unique id -2. Modify [src/controllers/resize.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/resize.js) and add a new record in the toobarConfig object -3. Modify [src/controllers/menuButton.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/menuButton.js) to add an event listener - ------------- - -## How to add custom formulas? - -**A**: Two source codes need to be modified: -1. Add a formula to the `functionImplementation` object in the [src/function/functionImplementation.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/function/functionImplementation.js) file, format refer to formulas such as `SUM`/`AVERAGE` -2. Modify all the language packs in the [src/locale](https://github.com/mengshukeji/Luckysheet/blob/master/src/locale) file directory, and add the new formula description to the `functionlist` array in. Among them, `t` is the category of the function, `m` is the number of parameters, the minimum number of parameters and the maximum number of parameters. - ------------- - -## Is there a similar loadData interface, I want to load 10 records first, and then dynamically load the data, these data are appended to the table? - -**A**: Yes. Our `loadSheetUrl` provides this function, which can be turned on by initializing `options.enablePage = true`. - -Searching for `enablePage` in the source code, you can see that there is a `method.addDataAjax` method, which contains an ajax request to dynamically load data, which will be appended to the worksheet. - -This function is now hidden in the document, because when we made this interface, the interface parameters were matched according to our actual business, which may not be universal. We are going to abstract and release it for everyone to use. If you want to use it yourself you can change it based on this. - -It is recommended that you consider writing your own interface to load the data, and then use `setRangeValue` to append the data at the specified location, which has a higher degree of customization. - +# FAQ + +The content of this chapter collects the common problems that everyone has feedback. If the official documents and this list can’t answer your questions, I recommend you to [Official Forum](https://github.com/mengshukeji/Luckysheet/discussions) + +## What is the difference between data and celldata in luckysheetfile? + +**A**: Use one-dimensional array format [celldata](/guide/sheet.html#celldata), 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 [transToCellData(data)](/guide/api.html#transtocelldata-data-setting) to convert it to celldata data. +Among them, the celldata in `{ r, c, v }` format is converted to a two-dimensional array using [transToData(celldata)](/guide/api.html#transtodata-celldata-setting) + +Summarized as follows: +```js +// data => celldata two-dimensional array data into {r, c, v} format one-dimensional array +luckysheet.transToCellData(data) + +// celldata => data to generate the two-dimensional array required for the table +luckysheet.transToData(celldata) +``` + +------------ + +## What are the cell types? + +**A**: Refer to [Cell Format List](/guide/cell.html), with examples of available cell formats + +------------ + +## How to use Luckysheet in Vue/React project? + +**A**: Check + +- Vue case: [luckysheet-vue](https://github.com/mengshukeji/luckysheet-vue) +- React case: [luckysheet-react](https://github.com/mengshukeji/luckysheet-react) + +------------ + +## Why will the formula in the table not be triggered after initialization? + +**A**: Refer to [Table data format](/guide/sheet.html#calcchain) ,just set the calcChain corresponding to the cell data. + +------------ + +## Is the remote loading data loadUrl or updateUrl? + +**A**: [loadUrl](/guide/config.html#loadurl). Configure loadUrl, Luckysheet will request the entire table data through ajax, and updateUrl will be used as the interface address for collaborative editing in real-time saving. +Note: Initial data needs to be configured with loadUrl parameter, while for collaborative editing, the four parameters of loadUrl, updateUrl and allowUpdate can be configured to take effect. + +------------ + +## What is the difference between `index` and `order` for each sheet page? + +**A**: Each sheet page has a unique id, which is `index`, which can be incremented by numbers or a random string. And `order` is the sorting situation of all sheets, starting from 0, can only be numbers `0,1,2...`. + +------------ + +## Why can’t I run the project directly under the dist folder? + +**A**: Need to start the local server + +- [Node build a local server](https://github.com/JacksonTian/anywhere) +- [Python build local server](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/set_up_a_local_testing_server) + +------------ + +## How to import and export excel? + +**A**: The excel import and export library developed with Luckysheet-[Luckyexcel](https://github.com/mengshukeji/Luckyexcel) has realized the excel import function, and the export function is under development.You can refer to these 2 blog posts for excel export at this stage: + +- [Development of Excel download function based on LuckySheet online form](https://www.cnblogs.com/recode-hyh/p/13168226.html) +- [Use exceljs to export luckysheet form](https://blog.csdn.net/csdn_lsy/article/details/107179708) + +------------ + +## How to merge cells during initialization? + +**A**: Refer to the following case: +- [How Luckysheet initializes the data with merged cells](https://www.cnblogs.com/DuShuSir/p/13272397.html) + +------------ + +## How does 'Luckysheet' save the data from the table to the database? Is there a soulution for storage and collaboration? + +**A**: There are two options: + +- 1. after the table operation is completed, you can use `luckysheet.getAllSheets()` to get all sheet data that stroed in the back-end. +- 2. enable the collaborative editing function to transmit data to the back-end in real-time. +refer this article: +[How Luckysheet saves the data in the table to the database](https://www.cnblogs.com/DuShuSir/p/13857874.html) + +------------ + +## How to monitor cell hover or click events? how to monitor `cellRenderAfter` in real-time? + +**A**: We have collected the secondary development requirements for cell events, and planned the cell-related hook functions, refer to [cell hook function](/guide/config.html#cellrenderafter) (the TODO displayed is not yet open) + +------------ + +## How to customize the top toolbar? + +**A**: +reference: [options.showtoolbarconfig](/guide/config.html#showtoolbarconfig)(TODO means waiting to developed) + +------------ + +## Does the project use jQuery? + +**A**: yes. At the beginning, Luckysheet uses jQuery。The packaging tool will package the jQuery to this file `./plugins/js/plugin.js` + +If your project (such as react / Vue) also references jQuery globally and causes conflicts, you can try to remove a jQuery. + +if you want to remove jQuery in `Luckysheet`, you can find `jQuery` in source code folder `gulpfile.js`: [src/plugins/js/jquery.min.js](https://github.com/mengshukeji/Luckysheet/blob/master/gulpfile.js),then delete information related to jQuery. + +------------ + +## How to add a field to a cell object? + +**A**: reference [cell object format](/guide/cell.html),then read this annotation[src/controllers/postil.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/postil.js)。the annotation is a configuration in a cell object. + +------------ + +## The toolbar icon is on the loading stage all the time. + +**A**: The luckysheet use iconfont icon in this project, if any icon cannot be loaded ,plz check your iconfont.css. we are so sorry that we did not describe it clearly in the old version documents. + +Now the documents have been updated.[official documents](/guide/#steps-for-usage) + +------------ + +## Can't run Luckyexcel after package. + +**A**: Terminal does not show `end`, but if the `dist` folder has this file `luckyexcel.js`, it is normal. + +Lucky excel is an excel import and export library. The project uses `gulp` as a packaging tool. There is a problem with the old version of the packaging tool, but it is fixed now. if this problem still troubles you, plz check the following steps: +1. pull the latest code. +2. `npm i` +3. `npm run build` + +more information: [Luckyexcel](https://github.com/mengshukeji/Luckyexcel/) + +------------ + +## How to disable editing of cells?How to open sheet protection? + +**A**: Sheet protection includes disable editing of cells that you need to make some configurations on each sheets. `config.authority`, the latest configurations[sheet protection](/guide/sheet.html#config-authority)。 + +In order to make it easier for you to understand the function of sheet protection, the following video shows how to make the whole sheet uneditable, but allow a column of cells to be edited: + + + +In you local browser, you can open the control pannel, use `luckysheet.getLuckysheetfile()[0].config.authority` to get the configuration parameters. + +------------ + +## How to configure data validation? + +**A**: there is the configuration of data validation,[data validation](/guide/sheet.html#dataVerification)。Also there is the API that you can use `data validation` in any time. [setDataVerification](/guide/api.html#setdataverification-optionitem-setting). + +------------ + +## Is there a case for using Luckysheet with CDN? + +**A**: Luckysheet supports CDN. reference: [The case of using luckysheet by CDN](https://www.cnblogs.com/DuShuSir/p/13859103.html) + +------------ + +## how to limit the adaptive height of a picture in a cell? + +**A**: First of all, you need to move the picture and adjust the cell size, and then there are the following situations: + +- if the cell contains a picture and you expand the cell, the picure will not be expanded. +- if the cell contains a picture and you shorten the cell to the edge of the picture, the picture will shrink. +- When the picture exceeds the border of the cell, the size of this picture will change with the size of the cell. + +if you want to get the position of the picture, you can overlap the picture with the border of the cell.(in the source code, it needs to overlap more than 2px.)The following demo video shows how to limit the image to the adaptive width and height of the cell. + + + +------------ + +## How to get the default row height and column width of the worksheet? + +**A**: There are two ways to get it + +- 1. use `luckysheet.getLuckysheetfile()` to get all configuration data, so you can get the `defaultRowHeight` and `defaultColWidth` in the sheet configuration data。 +- 2. use API to get the default row height [getDefaultRowHeight](/guide/api.html#getdefaultrowheight-setting) and column width.[getDefaultColWidth](/guide/api.html#getdefaultcolwidth-setting) + +------------ + +## How to hide the add row button and the back to top button below the worksheet? + +**A**: Configuration is open +- Allow adding rows [enableAddRow](/guide/config.html#enableaddrow) +- Allow back to top [enableAddBackTop](/guide/config.html#enableAddBackTop) + +------------ + +## How to hide the row and column headings of the worksheet? + +**A**: Configuration is open +- The width of the row header area [rowHeaderWidth](/guide/config.html#rowheaderwidth) +- The height of the column header area [columnHeaderHeight](/guide/config.html#columnHeaderHeight) + +------------ + +## What method can be called to set `config.merge`? + +**A**: Three methods +- Interface operation +- Use API: [setRangeMerge](/guide/api.html#setrangemerge-type-setting) +- Manually assemble merge parameters + +------------ + +## Why is the official new feature ineffective? + +**A**: The first step is to check whether you have used CDN to import, + +The CDN link used in the Luckysheet tutorial is the service provided by [jsdelivr](https://www.jsdelivr.com/package/npm/luckysheet), and the code is from [npmjs.com](https://www.npmjs.com/) automatically sync the past, not from [Github](https://github.com/mengshukeji/Luckysheet/). Because our newly submitted code still needs to be tested for a period of time, it will not be released to npm immediately, causing the npm code to lag behind Github. + +If you need to try the latest code, we strongly recommend that you pull the code from the [Luckysheet Github](https://github.com/mengshukeji/Luckysheet/) main repository. After our version is stable, we will consider releasing the npm package in real time. + +The second step, if it is to import the packaged code of the github repository, test to determine whether there is a bug, you can find the problem and try to fix it, and then [submit a PR](https://github.com/mengshukeji/Luckysheet/pulls), if can't fix it, please [submit issues](https://github.com/mengshukeji/Luckysheet/issues). + +------------ + +## `npm run dev` reported an error: ʻError: Cannot find module'rollup'`? + +**A**: It may be a problem with the npm package installation, try the following steps: +1. `npm cache clean --force` +2. `npm i rimraf -g` +3. `rimraf node_modules` +4. Delete the package-lock.json file +5. `npm i` +6. `npm run dev` + +Tip: Most other npm installation problems can also be solved by trying above steps. + +------------ + +## How to carry out secondary development of Luckysheet in Vue project? + +**A**: The [luckysheet-vue](https://github.com/mengshukeji/luckysheet-vue) case is to provide an application integration solution. + +If directly developed locally: +1. Start both the Luckysheet project and your own Vue project. For example, the Luckysheet project is at http://localhost:3001 +2. Import Luckysheet to use in the Vue project through `http://localhost:3001` + +In this case, after Luckysheet is modified in real time, the changes can be seen in the Vue project + +------------ + +## Error reporting `Store.createChart` when creating chart? + +**A**: You need to introduce a chart plugin to use it. You should configure the chart plugin to use when the workbook is initialized. Refer to + +- Plugins configuration [plugins](/guide/config.html#plugins) +- 或 官方demo [src/index.html](https://github.com/mengshukeji/Luckysheet/blob/master/src/index.html) + +------------ + +## Can cells add custom attributes? + +**A**: The custom attributes directly assigned to the cell object will be filtered. To make the custom attributes take effect, you need to edit the code to remove the filter attributes. + +------------ + +## How to enter text starting with `'='`? For example, `=currentDate('YYYY-MM-DD')`, it will remove the function by default, how to prohibit the function? + +**A**: Just add a single quotation mark in front of it, and it will be forcibly recognized as a string, which is consistent with excel. For example: `'=currentDate('YYYY-MM-DD')` + +------------ + +## Why does the create callback have no effect? + +**A**: The API method `luckysheet.create()` does not have a callback, but Luckysheet provides a hook function to execute the callback method at a specified location, such as: +- Triggered before the workbook is created [workbookCreateBefore](/guide/config.html#workbookcreatebefore) +- Triggered after the workbook is created [workbookCreateAfter](/guide/config.html#workbookcreateafter) + +------------ + +## When create, the first cell is selected by default, how to remove it? + +**A**: When the cell is selected, it is highlighted by default, just remove the highlight, use API: [setRangeShow](/guide/api.html#setrangeshow-range-setting) + +```js +luckysheet.setRangeShow("A2",{show:false}) +``` + +------------ + +## Where is the right-click event bound? + +**A**: In the source code [src/controllers/hander.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/handler.js), search for `event.which == "3"` to find the code executed by the right-click event. + +------------ + +## How to add a custom toolbar? + +**A**: No configuration is currently provided, you can refer to the implementation of the print button in the toolbar to modify the source code: +1. Search for `luckysheet-icon-print` globally to find the implementation of the print button, in [src/controllers/constant.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/constant.js) add a similar template string, you need to customize a unique id +2. Modify [src/controllers/resize.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/resize.js) and add a new record in the toobarConfig object +3. Modify [src/controllers/menuButton.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/menuButton.js) to add an event listener + +------------ + +## How to add custom formulas? + +**A**: Two source codes need to be modified: +1. Add a formula to the `functionImplementation` object in the [src/function/functionImplementation.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/function/functionImplementation.js) file, format refer to formulas such as `SUM`/`AVERAGE` +2. Modify all the language packs in the [src/locale](https://github.com/mengshukeji/Luckysheet/blob/master/src/locale) file directory, and add the new formula description to the `functionlist` array in. Among them, `t` is the category of the function, `m` is the number of parameters, the minimum number of parameters and the maximum number of parameters. + +------------ + +## Is there a similar loadData interface, I want to load 10 records first, and then dynamically load the data, these data are appended to the table? + +**A**: Yes. Our `loadSheetUrl` provides this function, which can be turned on by initializing `options.enablePage = true`. + +Searching for `enablePage` in the source code, you can see that there is a `method.addDataAjax` method, which contains an ajax request to dynamically load data, which will be appended to the worksheet. + +This function is now hidden in the document, because when we made this interface, the interface parameters were matched according to our actual business, which may not be universal. We are going to abstract and release it for everyone to use. If you want to use it yourself you can change it based on this. + +It is recommended that you consider writing your own interface to load the data, and then use `setRangeValue` to append the data at the specified location, which has a higher degree of customization. + ------------ \ No newline at end of file diff --git a/docs/guide/README.md b/docs/guide/README.md index 1710f3a9e..5574ba45b 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -1,269 +1,271 @@ -# Get started - -## Introduction -Luckysheet is an online spreadsheet like excel that is powerful, simple to configure, and completely open source. - -## Demo -[Online demo](https://mengshukeji.github.io/LuckysheetDemo/) - -![Demo](/LuckysheetDocs/img/LuckysheetDemo.gif) - -## Online Case - -- [Cooperative editing demo](http://luckysheet.lashuju.com/demo/)(Note: The official Java backend will also be open source after finishing,using OT algorithm. Please do not operate frequently to prevent the server from crashing) - -## Features - -### 🛠️Formatting -+ **Styling** (Change font style, size, color, or apply effects) -+ **Conditional formatting** (highlight interesting cells or ranges of cells, emphasize unusual values, and visualize data by using data bars, color scales, and icon sets that correspond to specific variations in the data) -+ **Align or rotate text** -+ **Support text truncation, overflow, automatic line wrapping** -+ **Data types** - + **currency, percentages, decimals, dates** - + **Custom** (E.g `##,###0.00` , `$1,234.56$##,###0.00_);[Red]($##,###0.00)`, `_($* ##,###0.00_);_(...($* "-"_);_(@_)`, `08-05 PM 01:30MM-dd AM/PM hh:mm` ) -+ **Cell segmentation style** (Alt+Enter line break, sub,super, in-cell style) - -### 🧬Cells -+ **Move cells by drag and dropping** (Operate on selection) -+ **Fill handle** (For a series like 1, 2, 3, 4, 5..., type 1 and 2 in the first two cells. For the series 2, 4, 6, 8..., type 2 and 4. Support arithmetic sequence, geometric sequence,date, week,chinese numbers) -+ **Auto Fill Options** (Fill copy, sequence, only format, no format, day, month, year) -+ **Multiple selection** (Hold Ctrl Selecting multiple cells, copy and paste) -+ **Find and replace** (Such as a particular number or text string, Support regular expression, whole word, case sensitive) -+ **Location** (Cells can be selected according to the data type) -+ **Merge cells** -+ **Data validation** (Checkbox, drop-down list, datePicker) - -### 🖱️Row & columns -+ **Hide, Insert, Delete rows and columns** -+ **Frozen rows and columns** (First row, first column, Frozen to selection, freeze adjustment lever can be dragged) -+ **Split text** (Split text into different columns with the Convert Text to Columns Wizard) - -### 🔨Operation -+ **Undo/Redo** -+ **Copy/Paste/Cut** (Copy from excel to Luckysheet with format, vice versa) -+ **Hot key** (The operating experience is consistent with excel, if there are differences or missing, please feedback to us) -+ **Format Painter** (Similar to google sheet) -+ **Selection by drag and dropping** (Change the parameters of formula and chart through selection) - -### ⚙️Formulas & functions -+ **Built-in formulas** - + Math (SUMIFS, AVERAGEIFS, SUMIF, SUM, etc.) - + Text (CONCATENATE, REGEXMATCH, MID) - + Date (DATEVALUE, DATEDIF, NOW, WEEKDAY, etc.) - + Financial (PV, FV, IRR, NPV, etc.) - + Logical (IF, AND, OR, IFERROR, etc.) - + Lookup (VLOOKUP, HLOOkUP, INDIRECT, OFFSET, etc.) - + Dynamic Array (Excel2019 new formulas, SORT,FILTER,UNIQUE,RANDARRAY,SEQUENCE) -+ **Array** (={1,2,3,4,5,6}, Crtl+Shift+Enter) -+ **Remote formulas** (DM_TEXT_TFIDF, DM_TEXT_TEXTRANK,DATA_CN_STOCK_CLOSE etc. Need remote interface, can realize complex calculation) -+ **Custom** (Some formula suitable for use in China have been added. AGE_BY_IDCARD, SEX_BY_IDCARD, BIRTHDAY_BY_IDCARD, PROVINCE_BY_IDCARD, CITY_BY_IDCARD, etc. You can define any formula you want) - -### 📐Tables -+ **Filters** (Support color , numerical, date, text filtering) -+ **Sort** (Sort multiple fields simultaneously) - -### 📈Pivot table -+ **Arrange fields** (Add fileds to rows, columns, values, area, it is similar to excel) -+ **Aggregation** (Surport Sum,Count,CountA,CountUnique,Average,Max,Min,Median,Product,Stdev,Stdevp,Var,VarP etc.) -+ **Filter data** (Add fileds to filters area and analyze the desired data ) -+ **Drill down** (Double click pivot table cell to drill down for detail data ) -+ **Create a PivotChart** (Pivot table can create a chart ) - -### 📊Chart -+ **Support types** (Line, Column, Area, Bar, Pie, comming soon Scatter, Radar, Gauge, Funnel etc.) -+ **Chart Plugins** (Link to another project [ChartMix](https://github.com/mengshukeji/chartMix)(MIT): ECharts is currently supported,Highcharts, Ali G2, amCharts, googleChart, chart.js are being developed gradually) -+ **Sparklines** (Support by formula : Line, Pie, Box, Pie etc.) - -### ✍️Share -+ **Comments** (Add, delete, update) -+ **Collaborate** (Simultaneous editing by multiple users) - -### 📚Insert object -+ **Insert picture** (JPG,PNG,SVG and so on) - -### ⚡Luckysheet -+ **Matrix operation** (Operate selection through the right-click menu: transpose, rotate, numerical calculation) -+ **Screenshot** (Take a screenshot with selection) -+ **Copy to** (In the right-click menu, copy selection to json, array etc.) -+ **EXCEL import/export** (Specially adapted to Luckysheet, export is under development) - -### ⏱️Coming soon -+ **Print** (Like excel print option, save to PDF) -+ **Tree menu** (Just like the outline (group) function of excel) -+ **Table new Features** (filter, slicer) -+ **CSV,TXT import/export** (Specially adapted to Luckysheet) -+ **Insert Shapes** ([Pen tool](https://github.com/mengshukeji/Pentool) Shapes) -+ **Documentation** (Improve documentation and API) -+ **More...** (Please advise us) - -## Development model - -### Requirements -[Node.js](https://nodejs.org/en/) Version >= 6 - -### Installation -```shell -npm install -npm install gulp -g -``` - -### Development -```shell -npm run dev -``` - -### Package -```shell -npm run build -``` - -## Steps for usage - -### First step - -There are two ways to introduce dependencies - -#### CDN -```html - - - - - - -``` - -Note that the path of `https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/luckysheet.umd.js` means that the latest luckysheet code will be pulled, but if Luckysheet has just been released, the jsdelivr website may not have time Synchronize from npm, so using this path will still pull to the previous version. We recommend that you directly specify the latest version. - -To specify the Luckysheet version, please add the version number after all CDN dependent files, such as: `https://cdn.jsdelivr.net/npm/luckysheet@2.1.12/dist/luckysheet.umd.js`. - -> How do I know which version is the latest version? View the latest [release record](https://github.com/mengshukeji/Luckysheet/releases) or [package.json](https://github.com/mengshukeji/Luckysheet/blob/master/package.json)` version` field. - -If it is not convenient to access jsdelivr.net, you can also import it locally - -#### Import locally -After `npm run build`, all files in the `dist` folder are copied to the project directory -```html - - - - - - -``` -### Second step -Specify a table container -```html -
-``` -### Third step -Create a table -```javascript - -``` - -## Structure - -### Format - -The data format of a complete Luckysheet table file is: luckysheetfile, a table file contains several sheet files, corresponding to excel sheet0, sheet1, etc. - -An example of a Luckysheet file is as follows, the table contains 3 sheets:` -luckysheetfile = [{sheet1 settings}, {sheet2 settings}, {sheet3 settings}]` -Equivalent to 3 sheets of excel - -![excel sheet](/LuckysheetDocs/img/excel.png) - -An example of a sheet in the file is as follows: -```javascript -luckysheetfile[0] = -{ - "name": "Cell", //Worksheet name - "color": "", //Worksheet color - "config": {}, //Table row height, column width, merged cells, borders, hidden rows and other settings - "index": "0", //Worksheet index - "chart": [], //Chart configuration - "status": "1", //Activation status - "order": "0", //The order of the worksheet - "hide": 0,//whether to hide - "column": 18, //Number of columns - "row": 36, //number of rows - "celldata": [], //Original cell data set - "visibledatarow": [], //The position of all rows - "visibledatacolumn": [], //The position of all columns - "ch_width": 2322, //The width of the worksheet area - "rh_height": 949, //The height of the worksheet area - "scrollLeft": 0, //Left and right scroll bar position - "scrollTop": 315, //Up and down scroll bar position - "luckysheet_select_save": [], //selected area - "luckysheet_conditionformat_save": {},//Conditional format - "calcChain": [],//Formula chain - "isPivotTable":false,//Whether to pivot table - "pivotTable":{},//Pivot table settings - "filter_select": null,//Filter range - "filter": null,//Filter configuration - "luckysheet_alternateformat_save": [], //Alternate colors - "luckysheet_alternateformat_save_modelCustom": []//Customize alternate colors -} -``` -### View method -View in chrome's console -`luckysheet.getluckysheetfile()` -You can see the complete settings -`[{shee1}, {sheet2}, {sheet3}]` - -## Keyboard shortcuts - -| Keyboard shortcuts | Features | -| ------------ | ------------ | -| CTRL + C | Copy cell | -| CTRL + V | Paste cell | -| CTRL + X | Cut cell | -| CTRL + Z | Undo | -| CTRL + Y | Redo | -| CTRL + A | Select all | -| CTRL + B | Bold | -| CTRL + F | Find | -| CTRL + H | Replace | -| CTRL + I | Italic | -| CTRL + UP/DOWN/LEFT/RIGHT | Quickly adjust cell marquee | -| SHIFT + UP/DOWN/LEFT/RIGHT | Adjust selection area | -| CTRL + Left mouse click | Multiple selection cell | -| SHIFT + Left mouse click | Adjust selection area | -| UP/DOWN/LEFT/RIGHT | Move cell selection box | -| ENTER | Edit cell | -| TAB | Move cell selection box to the right | -| DELETE | Clear cell data | - -## Guide - -If you encounter problems with Luckysheet, follow the steps below to find the answer - -1. Use Doge or Google to search for common technical issues -2. For Luckysheet related issues, please view [Luckysheet Official Document](https://mengshukeji.github.io/LuckysheetDocs/)(Note that the function of marking TODO has not yet been implemented) -3. Search [FAQ List](https://mengshukeji.github.io/LuckysheetDocs/guide/FAQ.html) -4. Search [Official Forum](https://groups.google.com/g/luckysheet) to see if anyone has encountered it -5. Try to check or experiment by yourself to find the answer -6. Please try to read the source code to find the answer, - -If none of the above methods solve your problem, you can consider: - -- Go to [Official Forum](https://groups.google.com/g/luckysheet) to ask questions -- Go to [Gitter](https://gitter.im/mengshukeji/Luckysheet) to ask questions -- If there are obvious problems or the needs cannot be met, please submit [issues](https://github.com/mengshukeji/Luckysheet/issues) - -> Recommended reading [How To Ask Questions The Smart Way](http://www.catb.org/~esr/faqs/smart-questions.html) - -At the same time, we strongly recommend you to help us enrich the Luckysheet community - -- If you find a problem with the documentation or code, you can contribute by submitting a PR. All reasonable changes, optimizations, amendments, or document amendments or updates related to submissions will be accepted +# Luckysheet is no longer maintained, please use [Univer](https://github.com/dream-num/univer) instead! + +# Get started + +## Introduction +Luckysheet is an online spreadsheet like excel that is powerful, simple to configure, and completely open source. + +## Demo +[Online demo](https://dream-num.github.io/LuckysheetDemo/) + +![Demo](/LuckysheetDocs/img/LuckysheetDemo.gif) + +## Online Case + +- [Cooperative editing demo](http://luckysheet.lashuju.com/demo/)(Note: The official Java backend will also be open source after finishing,using OT algorithm. Please do not operate frequently to prevent the server from crashing) + +## Features + +### 🛠️Formatting ++ **Styling** (Change font style, size, color, or apply effects) ++ **Conditional formatting** (highlight interesting cells or ranges of cells, emphasize unusual values, and visualize data by using data bars, color scales, and icon sets that correspond to specific variations in the data) ++ **Align or rotate text** ++ **Support text truncation, overflow, automatic line wrapping** ++ **Data types** + + **currency, percentages, decimals, dates** + + **Custom** (E.g `##,###0.00` , `$1,234.56$##,###0.00_);[Red]($##,###0.00)`, `_($* ##,###0.00_);_(...($* "-"_);_(@_)`, `08-05 PM 01:30MM-dd AM/PM hh:mm` ) ++ **Cell segmentation style** (Alt+Enter line break, sub,super, in-cell style) + +### 🧬Cells ++ **Move cells by drag and dropping** (Operate on selection) ++ **Fill handle** (For a series like 1, 2, 3, 4, 5..., type 1 and 2 in the first two cells. For the series 2, 4, 6, 8..., type 2 and 4. Support arithmetic sequence, geometric sequence,date, week,chinese numbers) ++ **Auto Fill Options** (Fill copy, sequence, only format, no format, day, month, year) ++ **Multiple selection** (Hold Ctrl Selecting multiple cells, copy and paste) ++ **Find and replace** (Such as a particular number or text string, Support regular expression, whole word, case sensitive) ++ **Location** (Cells can be selected according to the data type) ++ **Merge cells** ++ **Data validation** (Checkbox, drop-down list, datePicker) + +### 🖱️Row & columns ++ **Hide, Insert, Delete rows and columns** ++ **Frozen rows and columns** (First row, first column, Frozen to selection, freeze adjustment lever can be dragged) ++ **Split text** (Split text into different columns with the Convert Text to Columns Wizard) + +### 🔨Operation ++ **Undo/Redo** ++ **Copy/Paste/Cut** (Copy from excel to Luckysheet with format, vice versa) ++ **Hot key** (The operating experience is consistent with excel, if there are differences or missing, please feedback to us) ++ **Format Painter** (Similar to google sheet) ++ **Selection by drag and dropping** (Change the parameters of formula and chart through selection) + +### ⚙️Formulas & functions ++ **Built-in formulas** + + Math (SUMIFS, AVERAGEIFS, SUMIF, SUM, etc.) + + Text (CONCATENATE, REGEXMATCH, MID) + + Date (DATEVALUE, DATEDIF, NOW, WEEKDAY, etc.) + + Financial (PV, FV, IRR, NPV, etc.) + + Logical (IF, AND, OR, IFERROR, etc.) + + Lookup (VLOOKUP, HLOOkUP, INDIRECT, OFFSET, etc.) + + Dynamic Array (Excel2019 new formulas, SORT,FILTER,UNIQUE,RANDARRAY,SEQUENCE) ++ **Array** (={1,2,3,4,5,6}, Crtl+Shift+Enter) ++ **Remote formulas** (DM_TEXT_TFIDF, DM_TEXT_TEXTRANK,DATA_CN_STOCK_CLOSE etc. Need remote interface, can realize complex calculation) ++ **Custom** (Some formula suitable for use in China have been added. AGE_BY_IDCARD, SEX_BY_IDCARD, BIRTHDAY_BY_IDCARD, PROVINCE_BY_IDCARD, CITY_BY_IDCARD, etc. You can define any formula you want) + +### 📐Tables ++ **Filters** (Support color , numerical, date, text filtering) ++ **Sort** (Sort multiple fields simultaneously) + +### 📈Pivot table ++ **Arrange fields** (Add fileds to rows, columns, values, area, it is similar to excel) ++ **Aggregation** (Surport Sum,Count,CountA,CountUnique,Average,Max,Min,Median,Product,Stdev,Stdevp,Var,VarP etc.) ++ **Filter data** (Add fileds to filters area and analyze the desired data ) ++ **Drill down** (Double click pivot table cell to drill down for detail data ) ++ **Create a PivotChart** (Pivot table can create a chart ) + +### 📊Chart ++ **Support types** (Line, Column, Area, Bar, Pie, comming soon Scatter, Radar, Gauge, Funnel etc.) ++ **Chart Plugins** (Link to another project [ChartMix](https://github.com/mengshukeji/chartMix)(MIT): ECharts is currently supported,Highcharts, Ali G2, amCharts, googleChart, chart.js are being developed gradually) ++ **Sparklines** (Support by formula : Line, Pie, Box, Pie etc.) + +### ✍️Share ++ **Comments** (Add, delete, update) ++ **Collaborate** (Simultaneous editing by multiple users) + +### 📚Insert object ++ **Insert picture** (JPG,PNG,SVG and so on) + +### ⚡Luckysheet ++ **Matrix operation** (Operate selection through the right-click menu: transpose, rotate, numerical calculation) ++ **Screenshot** (Take a screenshot with selection) ++ **Copy to** (In the right-click menu, copy selection to json, array etc.) ++ **EXCEL import/export** (Specially adapted to Luckysheet, export is under development) + +### ⏱️Coming soon ++ **Print** (Like excel print option, save to PDF) ++ **Tree menu** (Just like the outline (group) function of excel) ++ **Table new Features** (filter, slicer) ++ **CSV,TXT import/export** (Specially adapted to Luckysheet) ++ **Insert Shapes** ([Pen tool](https://github.com/mengshukeji/Pentool) Shapes) ++ **Documentation** (Improve documentation and API) ++ **More...** (Please advise us) + +## Development model + +### Requirements +[Node.js](https://nodejs.org/en/) Version >= 6 + +### Installation +```shell +npm install +npm install gulp -g +``` + +### Development +```shell +npm run dev +``` + +### Package +```shell +npm run build +``` + +## Steps for usage + +### First step + +There are two ways to introduce dependencies + +#### CDN +```html + + + + + + +``` + +Note that the path of `https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/luckysheet.umd.js` means that the latest luckysheet code will be pulled, but if Luckysheet has just been released, the jsdelivr website may not have time Synchronize from npm, so using this path will still pull to the previous version. We recommend that you directly specify the latest version. + +To specify the Luckysheet version, please add the version number after all CDN dependent files, such as: `https://cdn.jsdelivr.net/npm/luckysheet@2.1.12/dist/luckysheet.umd.js`. + +> How do I know which version is the latest version? View the latest [release record](https://github.com/mengshukeji/Luckysheet/releases) or [package.json](https://github.com/mengshukeji/Luckysheet/blob/master/package.json)` version` field. + +If it is not convenient to access jsdelivr.net, you can also import it locally + +#### Import locally +After `npm run build`, all files in the `dist` folder are copied to the project directory +```html + + + + + + +``` +### Second step +Specify a table container +```html +
+``` +### Third step +Create a table +```javascript + +``` + +## Structure + +### Format + +The data format of a complete Luckysheet table file is: luckysheetfile, a table file contains several sheet files, corresponding to excel sheet0, sheet1, etc. + +An example of a Luckysheet file is as follows, the table contains 3 sheets:` +luckysheetfile = [{sheet1 settings}, {sheet2 settings}, {sheet3 settings}]` +Equivalent to 3 sheets of excel + +![excel sheet](/LuckysheetDocs/img/excel.png) + +An example of a sheet in the file is as follows: +```javascript +luckysheetfile[0] = +{ + "name": "Cell", //Worksheet name + "color": "", //Worksheet color + "config": {}, //Table row height, column width, merged cells, borders, hidden rows and other settings + "index": "0", //Worksheet index + "chart": [], //Chart configuration + "status": "1", //Activation status + "order": "0", //The order of the worksheet + "hide": 0,//whether to hide + "column": 18, //Number of columns + "row": 36, //number of rows + "celldata": [], //Original cell data set + "visibledatarow": [], //The position of all rows + "visibledatacolumn": [], //The position of all columns + "ch_width": 2322, //The width of the worksheet area + "rh_height": 949, //The height of the worksheet area + "scrollLeft": 0, //Left and right scroll bar position + "scrollTop": 315, //Up and down scroll bar position + "luckysheet_select_save": [], //selected area + "luckysheet_conditionformat_save": {},//Conditional format + "calcChain": [],//Formula chain + "isPivotTable":false,//Whether to pivot table + "pivotTable":{},//Pivot table settings + "filter_select": null,//Filter range + "filter": null,//Filter configuration + "luckysheet_alternateformat_save": [], //Alternate colors + "luckysheet_alternateformat_save_modelCustom": []//Customize alternate colors +} +``` +### View method +View in chrome's console +`luckysheet.getluckysheetfile()` +You can see the complete settings +`[{shee1}, {sheet2}, {sheet3}]` + +## Keyboard shortcuts + +| Keyboard shortcuts | Features | +| ------------ | ------------ | +| CTRL + C | Copy cell | +| CTRL + V | Paste cell | +| CTRL + X | Cut cell | +| CTRL + Z | Undo | +| CTRL + Y | Redo | +| CTRL + A | Select all | +| CTRL + B | Bold | +| CTRL + F | Find | +| CTRL + H | Replace | +| CTRL + I | Italic | +| CTRL + UP/DOWN/LEFT/RIGHT | Quickly adjust cell marquee | +| SHIFT + UP/DOWN/LEFT/RIGHT | Adjust selection area | +| CTRL + Left mouse click | Multiple selection cell | +| SHIFT + Left mouse click | Adjust selection area | +| UP/DOWN/LEFT/RIGHT | Move cell selection box | +| ENTER | Edit cell | +| TAB | Move cell selection box to the right | +| DELETE | Clear cell data | + +## Guide + +If you encounter problems with Luckysheet, follow the steps below to find the answer + +1. Use Doge or Google to search for common technical issues +2. For Luckysheet related issues, please view [Luckysheet Official Document](https://dream-num.github.io/LuckysheetDocs/)(Note that the function of marking TODO has not yet been implemented) +3. Search [FAQ List](https://dream-num.github.io/LuckysheetDocs/guide/FAQ.html) +4. Search [Official Forum](https://groups.google.com/g/luckysheet) to see if anyone has encountered it +5. Try to check or experiment by yourself to find the answer +6. Please try to read the source code to find the answer, + +If none of the above methods solve your problem, you can consider: + +- Go to [Official Forum](https://groups.google.com/g/luckysheet) to ask questions +- Go to [Gitter](https://gitter.im/mengshukeji/Luckysheet) to ask questions +- If there are obvious problems or the needs cannot be met, please submit [issues](https://github.com/mengshukeji/Luckysheet/issues) + +> Recommended reading [How To Ask Questions The Smart Way](http://www.catb.org/~esr/faqs/smart-questions.html) + +At the same time, we strongly recommend you to help us enrich the Luckysheet community + +- If you find a problem with the documentation or code, you can contribute by submitting a PR. All reasonable changes, optimizations, amendments, or document amendments or updates related to submissions will be accepted - When you have some experience in using or secondary developing Luckysheet, we encourage you to share it through blog posts \ No newline at end of file diff --git a/docs/guide/api.md b/docs/guide/api.md index 6ee77b690..9afd59d37 100644 --- a/docs/guide/api.md +++ b/docs/guide/api.md @@ -1,2983 +1,2983 @@ -# API - -Luckysheet has opened up the main function API for common data operation requirements, and developers can do any docking development according to their needs. - -Use note: -1. When script is introduced globally, all APIs are mounted under the window.luckysheet object, which can be printed and seen in the browser console; when npm is introduced, all APIs are also mounted under the luckysheet object -2. The first parameter of the `success` callback function is the return value of the API method -3. If you need a new API, please submit it to github [Issues](https://github.com/mengshukeji/Luckysheet/issues/new/choose), and decide whether to open the new API according to the number of likes -4. The required `order` parameter in the API method is the value of `order` in the worksheet object, not `index` - -## Cell operation - -### getCellValue(row, column [,setting])
- - -- **Parameter**: - - - {Number} [row]: The row number of the cell; an integer starting from 0, 0 means the first row - - {Number} [column]: The number of the column where the cell is located; an integer starting from 0, 0 means the first column - - {PlainObject} [setting]: optional parameters - + {String} [type]: The value type of the cell, which can be set to the original value `v` or the display value `m`; the default value is `v`, which means to get the actual value of the cell - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - -- **Explanation**: - - Get the value of the cell. - - In special cases, the cell format is `yyyy-MM-dd`, when `type` is `'v'`, the display value of `'m'` will be forced - -- **Usage**: - - - Returns the v value of the data in the first row and first column of the current worksheet - - `luckysheet.getCellValue(0, 0)` - - - Returns the original value of the cell in the second row and second column of the specified data. - - `luckysheet.getCellValue(1, 1, {type:"m"})` - ------------- - -### setCellValue(row, column, value [,setting]) - -- **Parameter**: - - - {Number} [row]: The row number of the cell; an integer starting from 0, 0 means the first row - - {Number} [column]: The number of the column where the cell is located; an integer starting from 0, 0 means the first column - - {Object| String| Number} [value]: The value to be set; it can be a string or a number, or an object conforming to the Luckysheet cell format, refer to [cell attribute table](/zh/guide/cell.html ) - - {PlainObject} [setting]: Optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Boolean} [isRefresh]: Whether to refresh the interface; the default is `true`; used to control throttling when multiple cells are assigned, the previous cell should be set to `false`, and the last cell is set Is `true`. - + {Function} [success]: The callback function for the end of the operation - -- **Explanation**: - - Set the value of a cell, you can also set the entire cell object, which is used to set multiple cell properties at the same time. - - If you need to update the formula, you can also assign a value here. Luckysheet will actively calculate this formula internally and add it to the formula chain, and finally refresh the interface. - -- **Usage**: - - - Set the value of cell "A1" in the current worksheet to "1" - `luckysheet.setCellValue(0, 0, 1);` - - - Set the current worksheet "B1" cell value to the formula "=sum(A1)" - `luckysheet.setCellValue(0, 1, "=sum(A1)");` - - - Set the cell "C1" of the current worksheet to the formula "=sum(A1:B1" with a red background. The cell object can have no `v` and `m` values. Luckysheet will automatically calculate the result according to the formula information. With `v` and `m` values ​​that have not been updated or are non-formula results, Luckysheet will still calculate the prepared results based on the data actually associated with the formula. - `luckysheet.setCellValue(0, 2, {f: "=sum(A1:B1)", bg:"#FF0000"})` - - Set the "C1" cell again and the new formula can still take effect - `luckysheet.setCellValue(0, 2, {f: "=sum(A1)", bg:"#00FF00"})` - ------------- -### clearCell(row, column [,setting]) - - -- **Parameter**: - - - {Number} [row]: The row number of the cell; an integer starting from 0, 0 means the first row - - {Number} [column]: The number of the column where the cell is located; an integer starting from 0, 0 means the first column - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Clear the contents of the specified cell of the specified worksheet, return the cleared data, which is different from the function of deleting the cell, no need to set the cell movement - -- **Usage**: - - - Clear the contents of cell `B2` - `luckysheet.clearCell(1,1)` - ------------- - -### deleteCell(move, row, column [,setting]) - - -- **Parameter**: - - {String} [move]: After deleting, whether the cells on the right or below move - - Possible values of `move` are: - - + `"left"`: Move the right cell to the left - + `"up"`: Move the lower cell up - - - {Number} [row]: The row number of the cell; an integer starting from 0, 0 means the first row - - {Number} [column]: The number of the column where the cell is located; an integer starting from 0, 0 means the first column - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Delete the specified cell of the specified worksheet, return the deleted data, and at the same time, specify whether to move the right cell to the left or the bottom cell to move up - -- **Usage**: - - - Delete the current cell and after deleting, the right cell moves to the left - `luckysheet.deleteCell('left')` - ------------- - -### setCellFormat(row, column, attr, value [,setting]) - - -- **Parameter**: - - - {Number} [row]: The row number of the cell; an integer starting from 0, 0 means the first row - - {Number} [column]: The number of the column where the cell is located; an integer starting from 0, 0 means the first column - - {String} [attr]: attribute type, refer to attribute value of [cell attribute table](/zh/guide/cell.html) - - {String | Number | Object} [value]: Specific setting value, one attribute will correspond to multiple values, refer to the value example of [cell attribute table](/zh/guide/cell.html), if the attribute type is ` Attr` is the cell format `ct`, then the setting value `value` should provide a ct object, such as: `{fa:"General", t:"g"}`, for example, set the format of cell A1 to percentage format: - - `luckysheet.setCellFormat(0, 0, "ct", {fa:"0.00%", t:"n"})` - - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Set the properties of a cell. If you want to set the value of a cell or set multiple cell properties at the same time, it is recommended to use `setCellValue` - - Special settings - - When setting the border, attr is `"bd"`, value is a key/value object, and the border type: `borderType`/border thickness:`style`/border color:`color` need to be set at the same time, such as setting A1 unit The border of the grid is all/red/thin: - - `luckysheet.setCellFormat(0, 0, "bd", {borderType: "border-right",style: "1", color: "#ff0000"})` - - The complete optional setting parameters are as follows: - - + Border Type `borderType: "border-left" | "border-right" | "border-top" | "border-bottom" | "border-all" | "border-outside" | "border-inside" | "border -horizontal" | "border-vertical" | "border-none"`, - + Border thickness `style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick` - + Border color `color: hexadecimal color value` - -- **Usage**: - - - Set the current worksheet A1 cell text bold - `luckysheet.setCellFormat(0, 0, "bl", 1)` - - Set the B2 cell background of the second worksheet to red - `luckysheet.setCellFormat(1, 1, "bg", "#ff0000", {order:1})` - - Set the value of cell "A1" of the current worksheet to "abc" - `luckysheet.setCellFormat(0, 0,'v','abc');` - ------------- - -### find(content [,setting]) - - -- **Parameter**: - - - {String} [content]: the content to find - - {PlainObject} [setting]: optional parameters - + {Boolean} [isRegularExpression]: Whether to match the regular expression; the default is `false` - + {Boolean} [isWholeWord]: Whether to match the whole word; the default is `false` - + {Boolean} [isCaseSensitive]: Whether to match case sensitively; the default is `false` - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {String} [type]: cell attribute; the default value is `"m"` - -- **Explanation**: - - Find the specified content in a worksheet and return a one-bit array of cells composed of the found content, the data format is the same as `celldata`. - -- **Usage**: - - - Find the string `"value"` in the current worksheet - `luckysheet.find("value")` - - Find cells in the current worksheet whose formula contains `"SUM"` - `luckysheet.find("SUM",{type:"f"})` - ------------- - -### replace(content, replaceContent [,setting]) - - -- **Parameter**: - - - {String} [content]: the content to find - - {String} [replaceContent]: The content to be replaced - - {PlainObject} [setting]: optional parameters - + {Boolean} [isRegularExpression]: Whether to match the regular expression; the default is `false` - + {Boolean} [isWholeWord]: Whether to match the whole word; the default is `false` - + {Boolean} [isCaseSensitive]: Whether to match case sensitively; the default is `false` - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Find the specified content in a worksheet and replace it with new content, and return a one-bit array of cells composed of the replaced content. The data format is the same as `celldata`. - -- **Usage**: - - - Find the string `"value"` in the current worksheet and replace it with `"out"` - `luckysheet.replace("value", "out")` - ------------- - -### exitEditMode([,setting]) - - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Exit edit mode. After double-clicking the cell with the mouse, it will enter the cell editing mode. After the editing is completed, when the mouse clicks on the input box elsewhere to lose focus, the editing mode will be exited, and the value of the cell will be saved. This Api is the operation of automatically exiting the editing mode, mainly to trigger the automatic saving of cells. - -- **Usage**: - - - Manually trigger to exit edit mode - `luckysheet.exitEditMode()` - ------------- - -## Row and column operations - -### setHorizontalFrozen(isRange [,setting]) - - -- **Parameter**: - - - {Boolean} [isRange]: Whether to freeze rows to selection - Possible values of `isRange` are: - - + `"false"`: Freeze the first line - + `"true"`: freeze line to selection - - {PlainObject} [setting]: optional parameters - + {Array | Object | String} [range]: Set when `isRange` is `true`, open the frozen cell position, the format is `{ row_focus:0, column_focus:0 }`, which means the currently activated cell The number of rows and columns of the grid; the default is obtained from the last selection of the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Freeze row operation - - Pay special attention to the setting of `range` in `setting` only when `isRange` is set to `true`, which is different from the general range format. - -- **Usage**: - - - Freeze the first row - - `luckysheet.setHorizontalFrozen(false)` - - - Frozen to `B5` selection - - `luckysheet.setHorizontalFrozen(true, { range: 'B5' })` - ------------- - -### setVerticalFrozen(isRange [,setting]) - - -- **Parameter**: - - - {Boolean} [isRange]: Whether to freeze the selection - Possible values of `isRange` are: - - + `"false"`: Freeze the first column - + `"true"`: Freeze column to selection - - {PlainObject} [setting]: optional parameters - + {Array | Object | String} [range]: Set when `isRange` is `true`, open the frozen cell position, the format is `{ row_focus:0, column_focus:0 }`, which means the currently activated cell The number of rows and columns of the grid; the default is obtained from the last selection of the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Freeze column operation - - Pay special attention to the setting of `range` in `setting` only when `isRange` is set to `true`, which is different from the general range format. - -- **Usage**: - - - Freeze the first column - - `luckysheet.setVerticalFrozen(false)` - ------------- - -### setBothFrozen(isRange [,setting]) - - -- **Parameter**: - - - {Boolean} [isRange]: Whether to freeze the ranks to the selection - Possible values of `isRange` are: - - + `"false"`: Freeze ranks - + `"true"`: Freeze ranks to selection - - {PlainObject} [setting]: optional parameters - + {Array | Object | String} [range]: Set when `isRange` is `true`, open the frozen cell position, the format is `{ row_focus:0, column_focus:0 }`, which means the currently activated cell The number of rows and columns of the grid; the default is obtained from the last selection of the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Freeze rank operation - - Pay special attention to the setting of `range` in `setting` only when `isRange` is set to `true`, which is different from the general range format. - - If you want to use this API to set the freeze after the workbook is initialized, you can execute it in the hook function after the workbook is created, such as: - ```js - luckysheet.create({ - hook:{ - workbookCreateAfter:function(){ - luckysheet.setBothFrozen(false); - } - } - }); - -- **Usage**: - - - Frozen ranks - - `luckysheet.setBothFrozen(false)` - ------------- - -### cancelFrozen([setting]) - - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Cancel freeze operation - -- **Usage**: - - - Cancel freeze - - `luckysheet.cancelFrozen()` - ------------- - -### insertRow(row [,setting]) - - -- **Parameter**: - - - {Number} [row]: Insert a blank row in the first few rows, starting from 0 - - - {PlainObject} [setting]: optional parameters - + {Number} [number]: The number of blank rows inserted; the default is 1 - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Insert a blank line in the `number` line at the position of the `row` line - -- **Usage**: - - - Insert a blank line at the position of line 2 - - `luckysheet.insertRow(1)` - ------------- - -### insertColumn( column [,setting]) - - -- **Parameter**: - - - {Number} [column]: Insert a blank column in the first column - - - {PlainObject} [setting]: optional parameters - + {Number} [number]: The number of blank columns to insert; the default is 1 - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Insert a blank column in column `number` at the position of column `column` - -- **Usage**: - - - Insert 3 blank rows in column 1 - - `luckysheet.insertRow(0, { number: 3 })` - ------------- - -### deleteRow(rowStart, rowEnd [,setting]) - - -- **Parameter**: - - - {Number} [rowStart]: the starting row to delete - - {Number} [rowEnd]: the end row to be deleted - - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Delete the specified row - - Special reminder, after deleting the row, the serial number of the row will not change, the following row will be added to the above, pay attention to observe whether the data is deleted correctly. - -- **Usage**: - - - Delete 2-4 lines - - `luckysheet.deleteRow(1, 3)` - ------------- - -### deleteColumn(columnStart, columnEnd [,setting]) - -- **Parameter**: - - - {Number} [columnStart]: the starting column to be deleted - - {Number} [columnEnd]: the end column to be deleted - To - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Delete the specified column - - Special reminder, after deleting the column, the serial number of the column will not change, the right column will be added to the left, pay attention to whether the data is deleted correctly. - -- **Usage**: - - - Delete 2-4 columns - - `luckysheet.deleteColumn(1, 3)` - ------------- - -### hideRow(rowStart, rowEnd [,setting]) - -- **Parameter**: - - - {Number} [rowStart]: The starting row to be hidden - - {Number} [rowEnd]: the end row to be hidden - To - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Hide the specified row - - Special reminder, after the row is hidden, the row number will change. - -- **Usage**: - - - Hide 2-4 rows - - `luckysheet.hideRow(1, 3)` - ------------- - -### hideColumn(columnStart, columnEnd [,setting])(TODO) - -- **Parameter**: - - - {Number} [columnStart]: the starting column to be hidden - - {Number} [columnEnd]: the end column to be hidden - - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Hide the specified column - - Special reminder, after hiding the column, the sequence number of the column will change. - -- **Usage**: - - - Hide 2-4 columns - - `luckysheet.hideColumn(1, 3)` - ------------- - -### showRow(rowStart, rowEnd [,setting]) - -- **Parameter**: - - - {Number} [rowStart]: the starting row to be displayed - - {Number} [rowEnd]: the end row to be displayed - To - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Show the specified row - -- **Usage**: - - - Display 2-4 lines - - `luckysheet.showRow(1, 3)` - ------------- - -### showColumn(columnStart, columnEnd [,setting])(TODO) - - -- **Parameter**: - - - {Number} [columnStart]: the starting column to be displayed - - {Number} [columnEnd]: the end column to be displayed - To - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Show the specified column - -- **Usage**: - - - Display 2-4 columns - - `luckysheet.showColumn(1, 3)` - ------------- - -### setRowHeight(rowInfo [,setting]) - -(TODO) - -- **Parameter**: - - - {Object} [rowInfo]: Correspondence between number of rows and height - - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Set the height of the specified ~~row~~ - -- **Usage**: - - - Set the height of the first row to 50px and the height of the second row to 60px - - `luckysheet.setRowHeight({0:50,1:60})` - ------------- - -### setColumnWidth(columnInfo [,setting]) - -(TODO) - -- **Parameter**: - - - {Object} [columnInfo]: Correspondence between the number of columns and the width - - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Set the width of the specified column - -- **Usage**: - - - Set the width of the first column to 50px and the width of the second column to 60px - - `luckysheet.setColumnWidth({0:50,1:60})` - ------------- - -### getRowHeight(rowInfo [,setting]) - -(TODO) - -- **Parameter**: - - - {Array} [rowInfo]: The number of rows - - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Get the height of the specified row, get the object corresponding to the number of rows and height - -- **Usage**: - - - The height of the first row is 50px, the height of the second row is 60px, get these values - - `luckysheet.getRowHeight([0,1])` - Return to get - `{0:50,1:60}` - ------------- - -### getColumnWidth(columnInfo [,setting]) - -(TODO) - -- **Parameter**: - - - {Array} [columnInfo]: The number of columns - - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Get the width of the specified column, get the object of the corresponding relationship between the number of columns and the width - -- **Usage**: - - - The width of the first column is 50px, the width of the second column is 60px, get these values - - `luckysheet.getColumnWidth([0,1])` - Return to get - `{0:50,1:60}` - ------------- - -### getDefaultRowHeight([,setting]) - -(TODO) - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Get the default row height of the specified worksheet - -- **Usage**: - - - Returns the default row height of the current worksheet - - `luckysheet.getDefaultRowHeight()` - Return to get - `19` - ------------- - -### getDefaultColWidth([,setting]) - -(TODO) - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Get the default column width of the specified worksheet - -- **Usage**: - - - Returns the default column width of the current worksheet - - `luckysheet.getDefaultColWidth()` - Return to get - `73` - ------------- - -## Selection operation - -### getRange() - - -- **Explanation**: - - Returns an array of current selection objects, there may be multiple selections. The format of each selection area is an object composed of row/column information `{row:[0,1],column:[0,1]}` - -- **Usage**: - - - The current selection is "A1:B2" and "B4:C5", execute - - `luckysheet.getRange()` - - The returned result is: - ```json - [ - { "row": [0,1], "column": [0,1] }, - { "row": [3,4], "column": [1,2] } - ] - ``` - ------------- - - -### getRangeWithFlatten() - -- **Explanation**: - - Returns an array representing the positions of all cells in the specified area, which is different from the getrange method, which organizes the data of the selection by cell (rather than a continuous area). - -- **Usage**: - - - Select the specified area in the table, and then execute - - `luckysheet.getRange()` - - The returned result is: - ```json - [ - {"row":[0,0],"column":[0,2]}, - {"row":[1,1],"column":[0,0]}, - {"row":[3,3],"column":[0,0]} - ] - ``` - Where,{"row":[0,0],"column":[0,2]} denote a whole continuous region. - - - Select the area above in the table and execute - - `luckysheet.getRangeWithFlatten()` - - The returned result is: - ```json - [ - {"r":0,"c":0}, - {"r":0,"c":1}, - {"r":0,"c":2}, - {"r":1,"c":0}, - {"r":3,"c":0} - ] - ``` - ------------- - - -### getRangeValuesWithFlatte() - -- **Explanation**: - - Returns an array of objects representing the contents of all cells in a specified range - -- **Usage**: - - - Select the specified area in the table, and then execute - - `luckysheet.getRange()` - - The returned result is: - ```json - [ - {"row":[0,0],"column":[0,2]}, - {"row":[1,1],"column":[0,0]}, - {"row":[3,3],"column":[0,0]} - ] - ``` - Where,{"row":[0,0],"column":[0,2]} denote a whole continuous region. - - - Select the area above in the table and execute - - `luckysheet.getRangeValuesWithFlatte()` - - The returned result is: - ```json - [ - { - "bg": null, - "bl": 0, - "it": 0, - "ff": 0, - "fs": 11, - "fc": "rgb(51, 51, 51)", - "ht": 1, - "vt": 1, - "v": 1, - "ct": { - "fa": "General", - "t": "n" - }, - "m": "1" - }, - { - "bg": null, - "bl": 0, - "it": 0, - "ff": 0, - "fs": 11, - "fc": "rgb(51, 51, 51)", - "ht": 1, - "vt": 1, - "v": 2, - "ct": { - "fa": "General", - "t": "n" - }, - "m": "2" - }, - { - "bg": null, - "bl": 0, - "it": 0, - "ff": 0, - "fs": 11, - "fc": "rgb(51, 51, 51)", - "ht": 1, - "vt": 1, - "v": 3, - "ct": { - "fa": "General", - "t": "n" - }, - "m": "3" - }, - { - "v": "Background", - "ct": { - "fa": "General", - "t": "g" - }, - "m": "Background", - "bg": null, - "bl": 1, - "it": 0, - "ff": 0, - "fs": 11, - "fc": "rgb(51, 51, 51)", - "ht": 1, - "vt": 1 - }, - { - "v": "Border", - "ct": { - "fa": "General", - "t": "g" - }, - "m": "Border", - "bg": null, - "bl": 1, - "it": 0, - "ff": 0, - "fs": 11, - "fc": "rgb(51, 51, 51)", - "ht": 1, - "vt": 1 - } - ] - ``` ------------- - -### getRangeAxis() - -- **Explanation**: - - Returns an array of coordinate strings corresponding to the current selection. Multiple selections may exist. Each selection may be a single cell (such as A1) or a rectangular region of multiple cells (such as D9: E12) - -- **Usage**: - - - The current selection is"E10:E14"、"A7:B13"、"C4"、 "A3" and "C6:D9", execute - - `luckysheet.getRangeAxis()` - - The returned result is: - ```json - ["E10:E14", "A7:B13", "C4", "A3", "C6:D9"] - ``` - ------------- - -### getRangeValue([setting]) - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column:[0 ,1]}`, can only be a single selection; the default is the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - -- **Explanation**: - - Returns the data of a two-dimensional array of cells in the specified range of the specified worksheet, each cell is an object. - - [Cell Object Format Reference](/zh/guide/cell.html) - -- **Usage**: - - - The current selection is "A1:B2", execute - - `luckysheet.getRangeValue()` - - The returned result is: - ```json - [ - [ - { - "v": "vaule1", - "ct": { "fa": "General", "t": "g" }, - "m": "vaule1", - "bg": "rgba(255,255,255)", - "bl": 0, - "it": 0, - "ff": 1, - "fs": 11, - "fc": "rgb(51, 51, 51)", - "ht": 1, - "vt": 0 - }, - { - "v": "value3", - "ct": { "fa": "General", "t": "g" }, - "m": "value3", - "bg": "rgba(255,255,255)", - "bl": 0, - "it": 0, - "ff": 1, - "fs": 11, - "fc": "rgb(51, 51, 51)", - "ht": 1, - "vt": 0 - } - ], - [ - { - "v": "vaule2", - "ct": { "fa": "General", "t": "g" }, - "m": "vaule2", - "bg": "rgba(255,255,255)", - "bl": 0, - "it": 0, - "ff": 1, - "fs": 11, - "fc": "rgb(51, 51, 51)", - "ht": 1, - "vt": 0 - }, - { - "v": "value4", - "ct": { "fa": "General", "t": "g" }, - "m": "value4", - "bg": "rgba(255,255,255)", - "bl": 0, - "it": 0, - "ff": 1, - "fs": 11, - "fc": "rgb(51, 51, 51)", - "ht": 1, - "vt": 0 - } - ] - ] - ``` - ------------- - -### getRangeHtml([setting]) - -[todo] - - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, allows an array of multiple selections; the default is the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - -- **Explanation**: - - Copy the data in the specified cell area of the specified worksheet and return the data containing the ``html format, which can be used to paste into excel to maintain the cell style. - - Note that if you copy multiple selections, these selections must have the same row or the same column to copy, and the copied results will also be automatically merged into a concatenated array, for example, multiple selections `"C18:C20"` / `"E18:E20"` / `"G18:H20"` is allowed, but multiple selections of `"C18:C20"` / `"E18:E21"` are not allowed - -- **Usage**: - - - The current selection is "A1:B2", execute - - `luckysheet.getRangeHtml()` - - The returned result is: - ```html -
- - - - - - - - - - - - -
- value1 - - value3 -
- value2 - - value4 -
- ``` - ------------- - -### getRangeJson(title [,setting]) - -- **Parameter**: - - - {Boolean} [title]: Whether the first line is the title - - Possible values of `title` are: - - + `"true"`: first row is title - + `"false"`: The first row is not title - - {PlainObject} [setting]: optional parameters - + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, can only be a single selection; the default is the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - -- **Explanation**: - - Copy the data in the specified cell area of the specified worksheet and return the data in `json` format - -- **Usage**: - - - The current selection is "A1:B2", the first row is the title to get json - - `luckysheet.getRangeJson(true)` - - The returned result is: - ```json - [ - { "value1": "value2", "value3": "value4" } - ] - ``` - - - The current selection is "A1:B2", the first row is not title to get json - - `luckysheet.getRangeJson(false)` - - The returned result is: - ```json - [ - { "A": "value1", "B": "value3" }, - { "A": "value2", "B": "value4" } - ] - ``` - ------------- - -### getRangeArray(dimensional [,setting]) - -[todo] - -- **Parameter**: - - - {String} [dimensional]: array dimension - - Possible values of `dimensional` are: - - + `"oneDimensional"`: one-dimensional array - + `"twoDimensional"`: two-dimensional array - + `"custom"`: a two-dimensional array of custom rows and columns - - {PlainObject} [setting]: optional parameters - + {Number} [row]: Set when `dimensional` is `custom`, the number of rows in the multidimensional array - + {Number} [column]: Set when `dimensional` is `custom`, the number of columns in the multidimensional array - + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, can only be a single selection; the default is the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - -- **Explanation**: - - Copy the data in the specified cell area of the specified worksheet, and return the data in a one-dimensional, two-dimensional, or two-dimensional array of custom rows and columns. - - Pay special attention to the setting of `row` and `column` in `setting` only when `dimensional` is set to `custom` - -- **Usage**: - - - The current selection is "A1:B2", a one-dimensional array - - `luckysheet.getRangeArray('oneDimensional')` - - The returned result is: - ```json - ["value1","value3","value2","value4"] - ``` - - - The current selection is "A1:B2", a two-dimensional array - - `luckysheet.getRangeArray('twoDimensional')` - - The returned result is: - ```json - [ - [ "value1", "value3" ], - [ "value2", "value4" ] - ] - ``` - - - The current selection area is "A1:C5", which is composed of values from'value1' to'value15', and obtains a two-dimensional array data with 3 rows and 2 columns - - `luckysheet.getRangeArray('custom', { row: 3, column: 2 })` - - The returned result is: - ```json - [ - [ - { - "m": "value1", - "ct": { "fa": "General", "t": "g" }, - "v": "value1" - }, - { - "ct": { "fa": "General", "t": "g" }, - "v": "value6", - "m": "value6" - } - ], - [ - { - "ct": { "fa": "General", "t": "g" }, - "v": "value11", - "m": "value11" - }, - { - "m": "value2", - "ct": { "fa": "General", "t": "g" }, - "v": "value2" - } - ], - [ - { - "ct": { "fa": "General", "t": "g" }, - "v": "value7", - "m": "value7" - }, - { - "ct": { "fa": "General", "t": "g" }, - "v": "value12", - "m": "value12" - } - ] - ] - ``` - ------------- - -### getRangeDiagonal(type [,setting]) - - -- **Parameter**: - - - {String} [type]: diagonal or diagonal offset - - Possible values of `type` are: - - + `"normal"`: diagonal - + `"anti"`: anti-diagonal - + `"offset"`: diagonal offset - - {PlainObject} [setting]: optional parameters - - {Number} [column]: Set when `type` is `offset`, the number of columns for diagonal offset - + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, can only be a single selection; the default is the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - -- **Explanation**: - - Copy the data in the specified cell area of the specified worksheet, and return the diagonal or diagonal offset data from the `column` column. - - Pay special attention to the setting of `column` in `setting` only when `type` is set to `offset`. - -- **Usage**: - - - The current selection is "A1:B2", diagonal - - `luckysheet.getRangeDiagonal('normal')` - - The returned result is: - ```json - [ - { - "m": "value1", - "ct": { "fa": "General", "t": "g" }, - "v": "value1" - }, - { - "m": "value4", - "ct": { "fa": "General", "t": "g" }, - "v": "value4" - } - ] - ``` - - - The current selection is "A1:B2", against the diagonal - - `luckysheet.getRangeDiagonal('anti')` - - The returned result is: - ```json - [ - { - "m": "value3", - "ct": { "fa": "General", "t": "g" }, - "v": "value3" - }, - { - "m": "value2", - "ct": { "fa": "General", "t": "g" }, - "v": "value2" - } - ] - ``` - - The current selection is "A1:B2", and the diagonal is offset by 1 column - - `luckysheet.getRangeDiagonal('offset', { column: 1 })` - - The returned result is: - ```json - [ - { - "m": "value3", - "ct": { "fa": "General", "t": "g" }, - "v": "value3" - } - ] - ``` ------------- - -### getRangeBoolean([setting]) - - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, can only be a single selection; the default is the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - -- **Explanation**: - - Copy the data in the specified cell area of the specified worksheet, and return the data of Boolean value - -- **Usage**: - - - The current selection is "A1:B2" - - `luckysheet.getRangeBoolean()` - - The returned result is: - ```json - [ - [ false, false ], - [ false, false ] - ] - ``` - ------------- - -### setRangeShow(range [,setting])
- -- **Parameter**: - - - {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, allows an array of multiple selections; the default is the current selection - - {PlainObject} [setting]: optional parameters - + {Boolean} [show]: Whether to show the highlight selection effect; the default value is `true` - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Specify one or more selection areas in the worksheet to be selected and choose whether to highlight or not. Multiple format settings are supported. - - Special reminder, the selection range setting involved in Luckysheet can refer to this setting - -- **Usage**: - - + Set the current worksheet selection area `A1:B2`: - - `luckysheet.setRangeShow("A1:B2")` - + Set selection range `A1:B2`: - - `luckysheet.setRangeShow(["A1:B2"])` - + Set selection range `A1:B2`: - - `luckysheet.setRangeShow({row:[0,1],column:[0,1]})` - + Set selection range `A1:B2`: - - `luckysheet.setRangeShow([{row:[0,1],column:[0,1]}])` - + Set the selection range `A1:B2` and `C3:D4`: - - `luckysheet.setRangeShow(["A1:B2","C3:D4"])` - + Set the selection range `A1:B2` and `D3`: - - `luckysheet.setRangeShow([{row:[0,1],column:[0,1]},{row:[2,2],column:[3,3]}])` - ------------- - -### setRangeValue(data [,setting]) - -- **Parameter**: - - - {Array} [data]: The data of a two-dimensional array of cells to be assigned. The value of each cell can be a string or a number, or an object conforming to the Luckysheet format. Refer to [cell attribute table](/zh /guide/cell.html) - - {PlainObject} [setting]: optional parameters - + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, can only be a single selection; the default is the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Boolean} [isRefresh]: Whether to refresh the interface; the default is `true`; used to control throttling when multiple cells are assigned, the previous cell should be set to `false`, and the last cell is set Is `true`. - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Assign a cell array data to the specified area, the data format is the same as the data obtained by the `getRangeValue` method. - - Note that usually the `getRangeValue` method only obtains the selection data, but does not include the border and merged cell information. When the `setRangeValue` is executed, it will dynamically determine whether the previous step has executed the `getRangeValue`, if executed, the border will be Obtained from Luckysheet configuration together with the merged cell information. - -- **Usage**: - - + Assign value to current selection - - ```js - const data = [ - [ - { - "m": "value1", - "ct": { - "fa": "General", - "t": "g" - }, - "v": "value1" - }, - { - "m": "value3", - "ct": { - "fa": "General", - "t": "g" - }, - "v": "value3" - } - ], - [ - { - "m": "value2", - "ct": { - "fa": "General", - "t": "g" - }, - "v": "value2" - }, - { - "m": "value4", - "ct": { - "fa": "General", - "t": "g" - }, - "v": "value4" - } - ] - ] - luckysheet.setRangeValue(data,{range:"A1:B2"}) - ``` - ------------- - -### setRangeFormat(attr, value [,setting]) - - -- **Parameter**: - - - {String} [attr]: attribute type, - Refer to the attribute value of [cell attribute table](/zh/guide/cell.html) - - {String | Number | Object} [value]: Specific setting value, one attribute will correspond to multiple values, refer to the value example of [cell attribute table](/zh/guide/cell.html), special case: if The attribute type `attr` is the cell format `ct`, then the setting value `value` should provide `ct.fa`, for example, set the cell format of `"A1:B2"` to percentage format: - To - `luckysheet.setRangeFormat("ct", "0.00%", {range:"A1:B2"})` - - - {PlainObject} [setting]: optional parameters - + {Object | String} [range]: Set the target selection range of the parameter. The supported selection format is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1], column:[0,1]}`, allows an array of multiple selections; the default is the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Set the cell format of the specified range, generally used as a processing format, the assignment operation recommends using the `setRangeValue` method - - When setting the border, attr is `"bd"`, value is a key/value object, and the border type: `borderType`/border thickness:`style`/border color:`color` need to be set at the same time, such as setting `" A1:B2"`The border of the cell is all/red/thin: - - `luckysheet.setRangeFormat("bd", {borderType: "border-right",style: "1", color: "#ff0000"}, {range:["A1:B2"]})` - - The complete optional setting parameters are as follows: - - + Border Type `borderType: "border-left" | "border-right" | "border-top" | "border-bottom" | "border-all" | "border-outside" | "border-inside" | "border -horizontal" | "border-vertical" | "border-none"`, - + Border thickness `style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick` - + Border color `color: hexadecimal color value` - -- **Usage**: - - - Set the cell text in the current worksheet `"A1:B2"` range to be bold - - `luckysheet.setRangeFormat("bl", 1, {range:"A1:B2"})` - - Set the background of the cells in the range of `"B2"` and `"C4:D5"` of the second worksheet to red - - `luckysheet.setRangeFormat("bg", "#ff0000", {range:["B2","C4:D5"], order:1})` - ------------- - -### setRangeFilter(type [,setting]) - -[todo] - - -- **Parameter**: - - - {String} [type]: Turn on or off the filtering function - - Possible values of `type` are: - - + `"open"`: Open the filter function and return the current filtered range object - + `"close"`: Close the filter function and return to the scope of the filter before closing - - {PlainObject} [setting]: optional parameters - + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, can only be a single selection; the default is the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - For the worksheet of the specified subscript, the filter function is turned on or off for the selected range - -- **Usage**: - - - Open the filter function of the second worksheet "A1:B2" - `luckysheet.setRangeFilter("open",{range:"A1:B2",order:1})` - ------------- - -### setRangeMerge(type [,setting]) - - -- **Parameter**: - - - {String} [type]: merge cell type - - Possible values of `type` are: - - + `"all"`: Merge all, all cells in the area are merged into one large cell - + `"horizontal"`: merge horizontally, cells in the same row in the area are merged into one cell - + `"vertical"`: merge vertically, the cells in the same column in the area are merged into one cell - - - {PlainObject} [setting]: optional parameters - + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, allows an array of multiple selections; the default is the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Set the merged cells for the worksheet with the specified subscript and the selected range - -- **Usage**: - - - The current selection'A1:B2' is set to merge cells, the type is merge all - - `luckysheet.setRangeMerge("all")` - The data of'A1:B1' is: - ```json - [ - [ - { - "m": "value1", - "ct": { "fa": "General", "t": "g" }, - "v": "value1", - "mc": { "r": 0, "c": 0, "rs": 2, "cs": 2 } - }, - { - "mc": { "r": 0, "c": 0 } - } - ], - [ - { - "mc": { "r": 0, "c": 0 } - }, - { - "mc": { "r": 0, "c": 0 } - } - ] - ] - ``` - ------------- - -### cancelRangeMerge( [setting]) - - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, allows an array of multiple selections; the default is the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Unmerge cells in the selected range for the worksheet with the specified subscript - -- **Usage**: - - - The current selection'A1:B2' is already a merged cell, now you want to cancel the merge - - `luckysheet.cancelRangeMerge()` - ------------- - -### setRangeSort(type [,setting]) - - -- **Parameter**: - - - {String} [type]: sort type - - Possible values of `type` are: - - + `"asc"`: ascending order - + `"des"`: descending order - - - {PlainObject} [setting]: optional parameters - - + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, can only be a single selection; the default is the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - For the worksheet of the specified subscript, the sort function is turned on for the selected range, and the sorted data of the selected range is returned. - -- **Usage**: - - - Set the current selection of the current worksheet to ascending order - `luckysheet.setRangeSort("asc")` - ------------- - -### setRangeSortMulti(title, sort [,setting]) - - -- **Parameter**: - - - {Boolean} [title]: Does the data have a title row - - {Array} [sort]: Column setting, set the column index and sort method to be sorted, the format is like: `[{ i:0,sort:'asc' },{ i:1,sort:'des' }] ` - - {PlainObject} [setting]: optional parameters - - + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, can only be a single selection; the default is the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - For the worksheet of the specified subscript, the selected range enables the multi-column custom sorting function to return the sorted data of the selected range. - -- **Usage**: - - - Set the current selection of the current worksheet to a custom sort, the data has a header row, and it is sorted according to the rules of the first column ascending order and the second column descending order - `luckysheet.setRangeSortMulti(true,[{ i:0,sort:'asc' },{ i:1,sort:'des' }])` - ------------- - -### setRangeConditionalFormatDefault(conditionName, conditionValue [,setting]) - -- **Parameter**: - - - {String} [conditionName]: Conditional format rule type - - Possible values ​​of `conditionName` are: - - + `"greaterThan"`: greater than (conditionValue value is numeric or cell range) - + `"lessThan"`: Less than (conditionValue value is numeric value or cell range) - + `"betweenness"`: between (conditionValue value is numeric value or cell range) - + `"equal"`: equal to (conditionValue value is numeric value or cell range) - + `"textContains"`: text contains (conditionValue value is text or cell range) - + `"occurrenceDate"`: date of occurrence (conditionValue value is date) - + `"duplicateValue"`: Duplicate value (conditionValue value is '0': duplicate value, '1': unique value) - + `"top10"`: the first N items (conditionValue value is 1~1000) - + `"top10%"`: Top N% (conditionValue value is 1~1000) - + `"last10"`: the last N items (conditionValue is 1~1000) - + `"last10%"`: Last N% (conditionValue value is 1~1000) - + `"AboveAverage"`: above average (conditionValue can be an empty array) - + `"SubAverage"`: below average (conditionValue can be an empty array) - - - {Array} [conditionValue]: You can set condition cells or condition values - Value rules (at least one value in the condition value array and at most two values) - ```js - [2] - ``` - Or (if the value is the cell range, take the cell value in the upper left corner) - ```js - ['A1'] - ``` - - - {PlainObject} [setting]: optional parameters - - + {Object} [format]: color setting - - * Set the text color and cell color; the default value is `{ - "textColor": "#000000", - "cellColor": "#ff0000" - }` - + {Array | Object | String} [cellrange]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, allows an array of multiple selections; the default is the current selection - - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - For the worksheet of the specified subscript, the conditional formatting is enabled for the selected range, and some cells are highlighted according to the set conditional formatting rules, and the data after the conditional formatting is enabled is returned. - -- **Usage**: - - - Highlight cells with content greater than the number 2 - `luckysheet.setRangeConditionalFormatDefault("greaterThan",{ type: 'value', content: [2] })` - - - Highlight the cells whose content is less than the content of cell A1 - `luckysheet.setRangeConditionalFormatDefault("lessThan",{ type: 'range', content: ['A1'] })` - - - Highlight cells with content between 2 and 10 - `luckysheet.setRangeConditionalFormatDefault("betweenness",{ type: 'value', content: [2,10] })` - - - Highlight the cell whose content is equal to the content of cell A1 - `luckysheet.setRangeConditionalFormatDefault("equal",{ type: 'range', content: ['A1'] })` - - - Highlight the cell that contains the content of cell A1 - `luckysheet.setRangeConditionalFormatDefault("textContains",{ type: 'range', content: ['A1'] })` - - - Highlight cells with dates between `2020/09/24-2020/10/15` - `luckysheet.setRangeConditionalFormatDefault("occurrenceDate",{ type: 'value', content: ['2020/09/24 - 2020/10/15'] })` - - - Highlight cells with repeated values, content is 0 - `luckysheet.setRangeConditionalFormatDefault("duplicateValue",{ type: 'value', content: [0] })` - - - Highlight the cell with unique value, content is 1 - `luckysheet.setRangeConditionalFormatDefault("duplicateValue",{ type: 'value', content: [1] })` - - - Highlight the top 20 cells - `luckysheet.setRangeConditionalFormatDefault("top",{ type: 'value', content: [20] })` - - - Highlight the top 30% of cells - `luckysheet.setRangeConditionalFormatDefault("topPercent",{ type: 'value', content: [30] })` - - - Highlight the bottom 15 cells - `luckysheet.setRangeConditionalFormatDefault("last",{ type: 'value', content: [15] })` - - - Highlight the bottom 15% of cells - `luckysheet.setRangeConditionalFormatDefault("lastPercent",{ type: 'value', content: [15] })` - - - Highlight cells that are above average - `luckysheet.setRangeConditionalFormatDefault("AboveAverage",{ type: 'value', content: ['AboveAverage'] })` - - - Highlight cells below average - `luckysheet.setRangeConditionalFormatDefault("SubAverage",{ type: 'value', content: ['SubAverage'] })` - ------------- - -### setRangeConditionalFormat(type [,setting]) - -- **Parameter**: - - - {String} [type]: Conditional formatting rule type - - Possible values ​​of `type` are: - - + `"dataBar"`: data bar - + `"icons"`: icon set - + `"colorGradation"`: Color Gradation - - - {PlainObject} [setting]: optional parameters - - + {Array | String} [format]: Color setting - - * When `type` is `dataBar`, the gradient color should be set; the default value is blue-white gradient` ["#638ec6", "#ffffff"]` - - Recommended shortcut value: - ```js - ["#638ec6", "#ffffff"], //Blue-white gradient data bar - ["#63c384", "#ffffff"], //Green-white gradient data bar - ["#ff555a", "#ffffff"], //Red-white gradient data bar - ["#ffb628", "#ffffff"], //Orange-white gradient data bar - ["#008aef", "#ffffff"], //Light blue-white gradient data bar - ["#d6007b", "#ffffff"], //Purple-white gradient data bar - ["#638ec6"], //Blue data bar - ["#63c384"], //green data bar - ["#ff555a"], //Red data bar - ["#ffb628"], //Orange data bar - ["#008aef"], //Light blue data bar - ["#d6007b"] //Purple data bar - ``` - - * When `type` is `icons`, the icon type should be set; the default value is "threeWayArrowMultiColor": the three-way arrow color, - - Possible values ​​are: - - `threeWayArrowMultiColor`: three-way arrow (color), - - `threeTriangles`: 3 triangles, - - `fourWayArrowMultiColor`: four-way arrow (color), - - `fiveWayArrowMultiColor`: five-way arrow (color), - - `threeWayArrowGrayColor`: three-way arrow (gray), - - `fourWayArrowGrayColor`: four-way arrow (gray), - - `fiveWayArrowGrayColor`: five-way arrow (gray), - - `threeColorTrafficLightRimless`: three-color traffic light (no border), - - `threeSigns`: three signs, - - `greenRedBlackGradient`: green-red-black gradient, - - `threeColorTrafficLightBordered`: three-color traffic light (with border), - - `fourColorTrafficLight`: Four-color traffic light, - - `threeSymbolsCircled`: three symbols (with a circle), - - `tricolorFlag`: tricolor flag, - - `threeSymbolsnoCircle`: three symbols (no circle), - - `threeStars`: 3 stars, - - `fiveQuadrantDiagram`: five-quadrant diagram, - - `fiveBoxes`: 5 boxes, - - `grade4`: Four grades, - - `grade5`: Five grades, - - * When `type` is `colorGradation`, the color value of the color scale should be set; the default value is green-yellow-red scale` ["rgb(99, 190, 123)", "rgb(255, 235, 132)", "rgb(248, 105, 107)"]` - - Recommended shortcut value: - ```js - ["rgb(99, 190, 123)", "rgb(255, 235, 132)", "rgb(248, 105, 107)"], //green-yellow-red level - ["rgb(248, 105, 107)", "rgb(255, 235, 132)", "rgb(99, 190, 123)"], //red-yellow-green level - - ["rgb(99, 190, 123)", "rgb(252, 252, 255)", "rgb(248, 105, 107)"], //green-white-red level - ["rgb(248, 105, 107)", "rgb(252, 252, 255)", "rgb(99, 190, 123)"], //red-white-green level - - ["rgb(90, 138, 198)", "rgb(252, 252, 255)", "rgb(248, 105, 107)"], //blue-white-red level - ["rgb(248, 105, 107)", "rgb(252, 252, 255)", "rgb(90, 138, 198)"], //red-white-blue level - - ["rgb(252, 252, 255)", "rgb(248, 105, 107)"], //white-red level - ["rgb(248, 105, 107)", "rgb(252, 252, 255)"], //red-white level - - ["rgb(99, 190, 123)", "rgb(252, 252, 255)"], //green-white level - ["rgb(252, 252, 255)", "rgb(99, 190, 123)"], //white-green level - - ["rgb(99, 190, 123)", "rgb(255, 235, 132)"], //green-yellow level - ["rgb(255, 235, 132)", "rgb(99, 190, 123)"] //Yellow-green level - ``` - - + {Array | Object | String} [cellrange]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, allows an array of multiple selections; the default is the current selection - - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - For the worksheet of the specified subscript, the conditional format is turned on for the selected range, and the data after the conditional format is turned on is returned. - -- **Usage**: - - - Conditional formatting is enabled for the current selection area, showing gradient - `luckysheet.setRangeConditionalFormat("dataBar", { format: ["#63c384", "#ffffff"] })` - ------------- - -### deleteRangeConditionalFormat(itemIndex [,setting]) - -[todo] - - -- **Parameter**: - - - {Number} [itemIndex]: Conditional format rule index - - - {PlainObject} [setting]: optional parameters - - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - For the worksheet of the specified subscript, delete the conditional format rule, and return the deleted conditional format rule. - -- **Usage**: - - - Delete the third conditional formatting rule - `luckysheet.deleteRangeConditionalFormat(2)` - ------------- - -### clearRange([setting]) - -[todo] - - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Array | Object | String} [range]: The range of the selection to be cleared. The format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1] ,column:[0,1]}`, allows an array of multiple selections; the default is the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Clear the contents of the specified cell area of the specified worksheet, return the cleared data, which is different from the function of deleting the selection area, no need to set the cell movement - -- **Usage**: - - - Clear the content of the current selection - `luckysheet.clearRange()` - ------------- - -### deleteRange(move [,setting]) - -[todo] - - -- **Parameter**: - - - {String} [move]: After deleting, whether the cells on the right or below move - - Possible values of `move` are: - - + `"left"`: Move the right cell to the left - + `"up"`: Move the lower cell up - - - {PlainObject} [setting]: optional parameters - + {Array | Object | String} [range]: The range of the selection to be deleted, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1] ,column:[0,1]}`, allows an array composed of multiple selections; the default is the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Delete the specified cell range of the specified worksheet, return the deleted data, and at the same time, specify whether to move the right cell to the left or the bottom cell to move up - -- **Usage**: - - - Delete the current selection and after deleting, the right cell moves to the left - `luckysheet.deleteRange('left')` - ------------- - -### insertRange(move [,setting]) - -[todo] - - -- **Parameter**: - - - {String} [move]: Move the active cell right or down - - Possible values of `move` are: - - + `"right"`: Move the active cell to the right - + `"bottom"`: move the active cell down - - - {PlainObject} [setting]: optional parameters - + {Array} [data]: The data of a two-dimensional array of cells assigned to the range area, [Cell Object Format Reference](/zh/guide/cell.html); the default value is an empty array, that is, a blank area is inserted - + {Array | Object | String} [range]: The position to be inserted, the range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0, 1],column:[0,1]}`, the default is the current selection - - When data data is not set, an array composed of multiple selections is allowed, and the blank area inserted is the area of these selections. - - When the data data is set, it can only be a single selection, and the data data will be inserted into the first cell position of the current selection - - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - In the specified cell area of the specified worksheet, assign cell data, or create a new blank area, return data data, and at the same time, specify the active cell to move right or down - -- **Usage**: - - - Insert a blank cell at the current selection position, and move the current selection cell to the right after inserting - `luckysheet.insertRange('right')` - ------------- - -### matrixOperation(type [,setting]) - -[todo] - - -- **Parameter**: - - - {String} [type]: the type of matrix operation - - Possible values of `type` are: - - + `"flipUpDown"`: flip up and down - + `"flipLeftRight"`: flip left and right - + `"flipClockwise"`: rotate clockwise - + `"flipCounterClockwise"`: rotate counterclockwise - + `"transpose"`: Transpose - + `"deleteZeroByRow"`: delete 0 values at both ends by row - + `"deleteZeroByColumn"`: delete zero values at both ends by column - + `"removeDuplicateByRow"`: delete duplicate values by row - + `"removeDuplicateByColumn"`: remove duplicate values by column - + `"newMatrix"`: Produce a new matrix - - {PlainObject} [setting]: optional parameters - + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, can only be a single selection; the default is the current selection - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Specify the data in the specified cell area of the worksheet to perform matrix operations, and return the result data after the operation is successful - -- **Usage**: - - - Flip current selection upside down - - `luckysheet.matrixOperation('flipUpDown')` - - Copy the original selection as a two-dimensional array: - - `[["value1","value3"],["value2","value4"]]` - - After flipping up and down, the selection is copied as a two-dimensional array: - - `[["value2","value4"],["value1","value3"]]` - ------------- - -### matrixCalculation(type, number [,setting]) - -[todo] - - -- **Parameter**: - - {String} [type]: calculation method - - Possible values of `type` are: - - + `"plus"`: add - + `"minus"`: subtract - + `"multiply"`: multiply - + `"divided"`: Divide - + `"power"`: power - + `"root"`: power root - + `"log"`: log - - {Number} [number]: Calculate the number, such as: 2 - - {PlainObject} [setting]: optional parameters - + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, can only be a single selection; the default is the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Specify the data in the specified cell area of the worksheet for matrix calculation, and return the result data after the calculation is successful - -- **Usage**: - - - Add 2 to the value of all cells in the current selection - - `luckysheet.matrixCalculation('plus', 2)` - - Copy the original selection as a two-dimensional array: - - `[[1,2],[3,4]]` - - After adding 2, the selection is copied as a two-dimensional array: - - `[[3,4],[5,6]]` - ------------- - -## Worksheet operations - -### getAllSheets() - - -- **Explanation**: - - Return all worksheet configurations, the format is the same as the worksheet configuration, and the results obtained can be used as options.data when the form is initialized. - - Therefore, this API is suitable for manually operating and configuring a table, and then taking out all the worksheet information to save it, and then use it for table creation in other places. If you want to get all the workbook data including the workbook configuration, it is recommended to use [toJson](#toJson()), and it can be directly used to initialize Luckysheet. - -- **Usage**: - - - Get all the basic information of the first worksheet - `luckysheet.getAllSheets()[0]` - ------------- - -### getLuckysheetfile() - -- **Explanation**: - - Returns a one-dimensional array `luckysheetfile` of all table data structures. Unlike the `getAllSheets` method, the worksheet parameters obtained by this method will contain many internal variables. The most obvious difference is that the table data operation will maintain `luckysheetfile[i]. data`, and the initialization data uses `options.data[i].celldata`, so `luckysheetfile` can be used for debugging, but the initialization table is not applicable. - - In addition, a `load = 1` will be added to the loaded worksheet parameters, this parameter needs to be set to 0 when initializing the data. Therefore, to initialize the workbook with the data obtained by `getLuckysheetfile()`, two tasks need to be done: - - - Convert celldata to data, refer to: [transToData](/zh/guide/api.html#transtodata-celldata-setting) - - Load reset to 0 or delete this field - - Now there is `getAllSheets` to complete this work, no need to manually convert the data. - -- **Usage**: - - - Get all the debugging information of the first worksheet - `luckysheet.getLuckysheetfile()[0]` - ------------- - -### getSheet([setting]) - -[todo] - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Number} [index]: worksheet index; the default value is the current worksheet index - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Number} [name]: Worksheet name; the default value is the current worksheet name - -- **Explanation**: - - According to index/order/name, quickly return the configuration of the specified worksheet, same as `luckysheetfile[i]`. If multiple parameters are set, the priority is: index> order> name. - ------------- - -### getSheetData([setting]) - -[todo] - - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - -- **Explanation**: - - Quickly return the data of the specified worksheet, same as `luckysheetfile[i].data` - ------------- - -### getConfig([setting]) - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - -- **Explanation**: - - Quickly return to the config configuration of the specified worksheet, same as `luckysheetfile[i].config` - ------------- - -### setConfig([setting]) - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Quickly set the current worksheet config configuration - ------------- -### updataSheet([setting]) - -- **参数**: - - - {PlainObject} [setting]: optional parameters - + {Array} [data]: Worksheet Configuration - + {Function} [success]: callback function for the end of the operation - -- **说明**: - - Update the corresponding sheet according to the set sheet configuration - ------------- - -### setSheetAdd([setting]) - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Object} [sheetObject]: The data of the newly added worksheet; the default value is an empty object.Worksheet data format reference [options.data](/guide/sheet.html#initial) - + {Number} [order]: New worksheet subscript; the default value is the last subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Add a sheet and return the newly added worksheet object. The optional setting data in `setting` is `sheetObject`, and a blank worksheet will be added if `sheetObject` is not passed. - -- **Usage**: - - - Add a blank worksheet at the subscript position of the last worksheet - `luckysheet.setSheetAdd()` - ------------- - -### setSheetDelete([setting]) - -[todo] - - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Delete the worksheet of the specified subscript and return the deleted worksheet object - -- **Usage**: - - - Delete current worksheet - `luckysheet.setSheetDelete()` - ------------- - -### setSheetCopy([setting]) - -[todo] - - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Number} [targetOrder]: The target index position of the newly copied worksheet; the default value is the next index position of the current worksheet index (incremental) - + {Number} [order]: The subscript of the copied worksheet; the default value is the subscript of the current worksheet - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Copy the worksheet with the specified subscript to the specified subscript position, optionally set the specified subscript position `targetOrder` in `setting`, and return the newly copied worksheet object - -- **Usage**: - - - Copy the current worksheet to the next subscript position - `luckysheet.setSheetCopy()` - ------------- - -### setSheetHide([setting]) - -[todo] - - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Number} [order]: The hidden worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Hide the worksheet of the specified subscript and return the hidden worksheet object - -- **Usage**: - - - Hide current worksheet - `luckysheet.setSheetHide(true)` - - Hide the third worksheet - `luckysheet.setSheetHide({order:2})` - ------------- - -### setSheetShow([setting]) - -[todo] - - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Number} [order]: The subscript of the unhidden worksheet; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Unhide the worksheet of the specified subscript, and return the unhidden worksheet object - -- **Usage**: - - - Unhide the third worksheet - `luckysheet.setSheetShow({order:2})` - ------------- - -### setSheetActive(order [,setting]) - -[todo] - -- **Parameter**: - - - {Number} [order]: The subscript of the worksheet to be activated - - {PlainObject} [setting]: optional parameters - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Set the worksheet of the specified subscript as the current worksheet (active state), that is, switch to the specified worksheet and return the activated worksheet object - -- **Usage**: - - - Switch to the second worksheet - `luckysheet.setSheetActive(1)` - ------------- - -### setSheetName(name [,setting]) - -[todo] - - -- **Parameter**: - - - {String} [name]: new worksheet name - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Modify worksheet name - -- **Usage**: - - - Modify the name of the current worksheet to "CellSheet" - `luckysheet.setSheetName("CellSheet")` - ------------- - -### setSheetColor(color [,setting]) - -[todo] - -- **Parameter**: - - - {String} [color]: Worksheet color - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Set the color at the worksheet name - -- **Usage**: - - - Modify the color of the current worksheet name to red - `luckysheet.setSheetColor("#ff0000")` - ------------- - -### setSheetMove(type [,setting]) - -- **Parameter**: - - - {String | Number} [type]: The moving direction of the worksheet or the subscript of the moving target, - - Possible values of `type` are: - - + `"left"`: to the left - + `"right"`: to the right - + `1`/`2`/`3`/...: Specify subscript - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Specify the worksheet to move one position to the left or right, or specify subscript, and return the specified worksheet object - -- **Usage**: - - - Move the current worksheet one position to the left - `luckysheet.setSheetMove("left")` - - Move the second worksheet to the subscript position of the fourth worksheet - `luckysheet.setSheetMove(3,{order:1})` - ------------- - -### setSheetOrder(orderList [,setting]) - -[todo] - - -- **Parameter**: - - - {Array} [orderList]: Worksheet order, set the index and order of the worksheet to specify the position, such as: - - ```json - [ - {index:'sheet_01',order: 2}, - {index:'sheet_02',order: 1}, - {index:'sheet_03',order: 0}, - ] - ``` - The order in the array is not important, the key is to specify the correspondence between sheet index and order. - - - {PlainObject} [setting]: optional parameters - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Reorder the positions of all worksheets and specify an array of worksheet order. - - -- **Usage**: - - - Rearrange the worksheets, this workbook contains 3 worksheets - ```js - luckysheet.setSheetOrder([ - {index:'sheet_01',order: 2}, - {index:'sheet_02',order: 1}, - {index:'sheet_03',order: 0}, - ]) - ``` - ------------- - -### setSheetZoom(zoom [,setting]) - -[todo] - - -- **Parameter**: - - - {Number} [zoom]: Worksheet zoom ratio - - - {PlainObject} [setting]: optional parameters - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Set worksheet zoom ratio - - -- **Usage**: - - - Set the current worksheet zoom ratio to 0.5 - ```js - luckysheet.setSheetZoom(0.5) - ``` - ------------- - -### showGridLines([setting]) - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Number} [order]: The subscript of the worksheet that needs to show the grid lines; the default value is the subscript of the current worksheet - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Show the grid lines of the specified subscript worksheet, and return the worksheet object of the operation - -- **Usage**: - - - Show the grid lines of the current worksheet - `luckysheet.showGridLines()` - - Show the grid lines of the third worksheet - `luckysheet.showGridLines({order:2})` - ------------- - -### hideGridLines([setting]) - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Number} [order]: The subscript of the worksheet that needs to hdie the grid lines; the default value is the subscript of the current worksheet - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Hide the grid lines of the specified subscript worksheet, and return the worksheet object of the operation - -- **Usage**: - - - Hide grid lines of current worksheet - `luckysheet.hideGridLines()` - - Hide the grid lines of the third worksheet - `luckysheet.hideGridLines({order:2})` - ------------- - -## Workbook operations - -### create(options [,setting]) - -- **Parameter**: - - - {Object} [options]: All configuration information of the table - - {PlainObject} [setting]: optional parameters - + {Function} [success]: callback function after the table is created successfully - -- **Explanation**: - - Initialize a Luckysheet, which can contain multiple worksheets, refer to [Configuration List](/zh/guide/config.html) - ------------- - -### refresh([setting]) - -[todo] - - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Function} [success]: The callback function after the table is refreshed successfully - -- **Explanation**: - - Refresh canvas - ------------- - -### scroll([setting]) - -- **参数**: - - - {PlainObject} [setting]: optional parameters - + {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. - + {Number} [targetRow]: Scroll vertically to the specified row number. The default is the current vertical scroll position. - + {Number} [targetColumn]: scroll horizontally to the specified column number. The default is the current horizontal scroll position. - + {Function} [success]: The callback function after the table is refreshed successfully - -- **说明**: - - Scroll current worksheet position - ------------- - -### resize([setting]) - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Automatically resize the canvas according to the window size - ------------- - -### destroy([setting]) - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Function} [success]: callback function after the table is released successfully - -- **Explanation**: - - Delete and release table - ------------- - -### getScreenshot([setting]) - -[todo] - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, can only be a single selection; the default is the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - -- **Explanation**: - - Returns the base64 format image generated after the screenshot of the specified selection - ------------- - -### setWorkbookName(name [,setting]) - -- **Parameter**: - - - {Number} [name]: Workbook name - - {PlainObject} [setting]: optional parameters - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Set workbook name - ------------- - -### getWorkbookName(name [,setting]) - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - get workbook name - ------------- - -### undo([setting]) - -[todo] - - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Undo the current operation and return the operation object that was just undone - ------------- - -### redo([setting]) - -[todo] - - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Redo the current operation and return the operation object that was just redone - ------------- - -### refreshFormula([setting]) - -- **Parameter**: - - - {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Force refresh formula. When you directly modify the values of multiple cells without triggering a refresh, and these cells are associated with formulas, you can use this API to force a formula refresh to be triggered at the end. - ------------- - -### refreshMenuButtonFocus([data],[r],[c],[success]) - -- **Parameter**: - - - {Array} [data]: Operational data - - {Number} [r]: Specified row - - {Number} [c]: Specified column - - {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Refreshes the top status bar status of the specified cell. - ------------- - -### checkTheStatusOfTheSelectedCells(type,status) - -- **Parameter**: - - - {String} type: type - - {String} status: Target state value - -- **Explanation**: - - Check whether the status of all specified types of cells in the selection meets the conditions (mainly bold, italics, strikeouts, underscores, etc.). - ------------- - -## Chart - -### insertChart([setting]) - -[todo] - - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Array | Object | String} [range]: The selection range of the chart data. The format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1] ,column:[0,1]}`, can only be a single selection; the default is the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Generate a chart in the specified selection area of the specified worksheet, and return the chart parameter object, including the chart id - ------------- - -### setChart(chartId, attr, value [,setting]) - -[todo] - - -- **Parameter**: - - - {String} [chartId]: Specify the id of the chart to be modified - - {String} [attr]: attribute type - - Possible values of `attr` are: - - + `"left"`: the distance from the left to the edge of the worksheet - + `"top"`: the distance from the top edge to the edge of the worksheet - + `"width"`: the width of the chart frame - + `"height"`: the height of the chart outline - + `"chartOptions"`: detailed settings for the chart - - - {Number | Object}} [value]: attribute value, when `attr` is `chartOptions`, directly set the configuration object of the entire chart - - - {PlainObject} [setting]: optional parameters - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Modify the parameters of the specified id chart and return the modified parameters of the entire chart - ------------- - -### getChart(chartId) - -[todo] - - -- **Parameter**: - - - {String} [chartId]: Specify the chart id to be obtained - -- **Explanation**: - - Get the parameters of the specified id chart - ------------- - -### deleteChart(chartId [,setting]) - -[todo] - - -- **Parameter**: - - - {String} [chartId]: the id of the chart to be deleted - To - - {PlainObject} [setting]: optional parameters - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Delete the chart with the specified id and return the parameters of the deleted chart - ------------- - -## Data Verification - -### setDataVerification(option, [setting]) - -[todo] - -- **Parameter**: - - - {Object} [option]: Configuration information for data verification - - {PlainObject} [setting]: optional parameters - + {Array | Object | String} [range]: The selection area for data verification, The format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1] ,column:[0,1]}`, can only be a single selection; the default is the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Specify the worksheet range to set the data verification function and set the parameters - ------------- - -### deleteDataVerification([setting]) - -[todo, to be confirmed whether it is reasonable] - -- **Parameter**: - - - {PlainObject} [setting]: optional parameters - + {Array | Object | String} [range]: The selection area for data verification, The format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1] ,column:[0,1]}`, can only be a single selection; the default is the current selection - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Specify the worksheet range to delete the data verification function - ------------- - -## Worksheet Protection - - -### setProtection(option, [setting]) - -[todo] - -- **Parameter**: - - - {Object} [option]: Configuration information for worksheet protection - - {PlainObject} [setting]: optional parameters - + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - Specify the worksheet to set the worksheet protection - ------------- - -## Public method - -### transToCellData(data [,setting])
- -- **Parameter**: - - - {Array} [data]: data - To - - {PlainObject} [setting]: optional parameters - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - data => celldata, data two-dimensional array data is converted into a one-dimensional array in {r, c, v} format - ------------- - -### transToData(celldata [,setting])
- -[todo] - -- **Parameter**: - - - {Array} [celldata]: data - To - - {PlainObject} [setting]: optional parameters - + {Function} [success]: callback function for the end of the operation - -- **Explanation**: - - celldata => data, the celldata one-dimensional array data is converted into the two-dimensional array required by the table - ------------- - -### toJson() - -- **Explanation**: - - The exported json string can be directly used as the parameter `options` when the workbook is initialized by `luckysheet.create(options)`. The usage scenario is to manually save all the parameters after the user manipulates the table, and then initialize the table elsewhere. Use, similar to the import and export of a luckysheet proprietary format. - ------------- - -## Legacy API - -::: warning -To maintain compatibility, the old version of the API is still supported, but its use is deprecated. -::: - -### getcellvalue([r] [,c] [,data] [,type]) - -- **Parameter**: - - - {Number} [r]: The row number of the cell; optional value; an integer starting from 0, 0 means the first row - - {Number} [c]: The number of the column where the cell is located; 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 - -- **Explanation**: - - This method is to get the value of the cell. - - - luckysheet.getcellvalue(): returns all data of the current worksheet; - - luckysheet.getcellvalue(0): returns the data of the first row of the current worksheet; - - luckysheet.getcellvalue(null,0): returns the data in the first column of the current worksheet; - - luckysheet.getcellvalue(0,0): returns the v value of the cell data in the first row and the first column of the current worksheet; - - 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 - - > Recommend to use the new API: getCellValue - ------------- - -### getluckysheetfile() - -- **Explanation**: - - Returns a one-dimensional array `luckysheetfile` of all table data structures - - > Recommend to use new API: [getLuckysheetfile](#getLuckysheetfile()) - ------------- - -### getconfig() - -- **Explanation**: - - Quickly return to the current sheet config configuration, the config information of each worksheet is still contained in the luckysheetfile. - - > Recommend to use new API: [getConfig](#getConfig([setting])) - ------------- - -### getluckysheet_select_save() - -- **Explanation**: - - Returns an array of current selection objects, there may be multiple selections. - - > Recommend to use new API: [getRange](#getRange()) - ------------- - -### getdatabyselection([range] [,sheetOrder]) - -- **Parameter**: - - - {Object} [range]: Selection object, `object: {row: [r1, r2], column: [c1, c2] }`; the default is the current first selection. - - {Number} [sheetOrder]: Table subscript, an integer starting from 0, 0 means the first table; the default is the current table subscript. - -- **Explanation**: - - 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 - - > Recommend to use the new API: [getRangeValue](#getRangeValue([setting])) - ------------- - -### luckysheetrefreshgrid(scrollWidth, scrollHeight) - -- **Parameter**: - - - {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. - -- **Explanation**: - - Refresh the canvas display data according to scrollWidth and scrollHeight. - ------------- - -### setcellvalue(r, c, d, v) - -- **Parameter**: - - - {Number} [r]: The row number of the cell; an integer starting from 0, 0 means the first row. - - {Number} [c]: The number of the column where the cell is located; 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 must conform to the cell object format. - -- **Explanation**: - - Set the value of a cell. Can be used with `luckysheet.jfrefreshgrid()` to refresh and view cell value changes. - - ```js - luckysheet.setcellvalue(0, 0, luckysheet.flowdata(), 'abc'); - luckysheet.jfrefreshgrid(); - ``` - ------------- - -### jfrefreshgrid() - -- **Explanation**: - - Refresh canvas - - > Recommended new API: [refresh](#refresh([setting])) - ------------- - -### setluckysheet_select_save(v) - -- **Parameter**: - - - {Array} [v]:The selection value (array) to be set. Comply with the selection format rules, such as `[{ row: [r1, r2], column: [c1, c2] }]`. - -- **Explanation**: - - 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(); - ``` - - > Recommend to use new API:setRangeShow - ------------- - -### selectHightlightShow() - -- **Explanation**: - - Highlight the current selection - - > Recommend to use new API:setRangeShow - ------------- - -### flowdata() - -- **Explanation**: - - Quickly get the data of the current table - - > Recommend to use new API:[getSheetData](#getSheetData()) - ------------- - -### buildGridData(file) - -- **Parameter**: - - - {Object} [file]:[luckysheetfile](/zh/guide/sheet.html) - -- **Explanation**: - - Generate a two-dimensional array that the table can recognize - - > Recommend to use new API:transToData - ------------- - -### getGridData(data) - -- **Parameter**: - - - {Array} [data]: Two-dimensional array data of the worksheet - -- **Explanation**: - - Convert two-dimensional array data into `{r, c, v}` format one-dimensional array - +# API + +Luckysheet has opened up the main function API for common data operation requirements, and developers can do any docking development according to their needs. + +Use note: +1. When script is introduced globally, all APIs are mounted under the window.luckysheet object, which can be printed and seen in the browser console; when npm is introduced, all APIs are also mounted under the luckysheet object +2. The first parameter of the `success` callback function is the return value of the API method +3. If you need a new API, please submit it to github [Issues](https://github.com/mengshukeji/Luckysheet/issues/new/choose), and decide whether to open the new API according to the number of likes +4. The required `order` parameter in the API method is the value of `order` in the worksheet object, not `index` + +## Cell operation + +### getCellValue(row, column [,setting])
+ + +- **Parameter**: + + - {Number} [row]: The row number of the cell; an integer starting from 0, 0 means the first row + - {Number} [column]: The number of the column where the cell is located; an integer starting from 0, 0 means the first column + - {PlainObject} [setting]: optional parameters + + {String} [type]: The value type of the cell, which can be set to the original value `v` or the display value `m`; the default value is `v`, which means to get the actual value of the cell + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + +- **Explanation**: + + Get the value of the cell. + + In special cases, the cell format is `yyyy-MM-dd`, when `type` is `'v'`, the display value of `'m'` will be forced + +- **Usage**: + + - Returns the v value of the data in the first row and first column of the current worksheet + + `luckysheet.getCellValue(0, 0)` + + - Returns the original value of the cell in the second row and second column of the specified data. + + `luckysheet.getCellValue(1, 1, {type:"m"})` + +------------ + +### setCellValue(row, column, value [,setting]) + +- **Parameter**: + + - {Number} [row]: The row number of the cell; an integer starting from 0, 0 means the first row + - {Number} [column]: The number of the column where the cell is located; an integer starting from 0, 0 means the first column + - {Object| String| Number} [value]: The value to be set; it can be a string or a number, or an object conforming to the Luckysheet cell format, refer to [cell attribute table](/zh/guide/cell.html ) + - {PlainObject} [setting]: Optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Boolean} [isRefresh]: Whether to refresh the interface; the default is `true`; used to control throttling when multiple cells are assigned, the previous cell should be set to `false`, and the last cell is set Is `true`. + + {Function} [success]: The callback function for the end of the operation + +- **Explanation**: + + Set the value of a cell, you can also set the entire cell object, which is used to set multiple cell properties at the same time. + + If you need to update the formula, you can also assign a value here. Luckysheet will actively calculate this formula internally and add it to the formula chain, and finally refresh the interface. + +- **Usage**: + + - Set the value of cell "A1" in the current worksheet to "1" + `luckysheet.setCellValue(0, 0, 1);` + + - Set the current worksheet "B1" cell value to the formula "=sum(A1)" + `luckysheet.setCellValue(0, 1, "=sum(A1)");` + + - Set the cell "C1" of the current worksheet to the formula "=sum(A1:B1" with a red background. The cell object can have no `v` and `m` values. Luckysheet will automatically calculate the result according to the formula information. With `v` and `m` values ​​that have not been updated or are non-formula results, Luckysheet will still calculate the prepared results based on the data actually associated with the formula. + `luckysheet.setCellValue(0, 2, {f: "=sum(A1:B1)", bg:"#FF0000"})` + + Set the "C1" cell again and the new formula can still take effect + `luckysheet.setCellValue(0, 2, {f: "=sum(A1)", bg:"#00FF00"})` + +------------ +### clearCell(row, column [,setting]) + + +- **Parameter**: + + - {Number} [row]: The row number of the cell; an integer starting from 0, 0 means the first row + - {Number} [column]: The number of the column where the cell is located; an integer starting from 0, 0 means the first column + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Clear the contents of the specified cell of the specified worksheet, return the cleared data, which is different from the function of deleting the cell, no need to set the cell movement + +- **Usage**: + + - Clear the contents of cell `B2` + `luckysheet.clearCell(1,1)` + +------------ + +### deleteCell(move, row, column [,setting]) + + +- **Parameter**: + - {String} [move]: After deleting, whether the cells on the right or below move + + Possible values of `move` are: + + + `"left"`: Move the right cell to the left + + `"up"`: Move the lower cell up + + - {Number} [row]: The row number of the cell; an integer starting from 0, 0 means the first row + - {Number} [column]: The number of the column where the cell is located; an integer starting from 0, 0 means the first column + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Delete the specified cell of the specified worksheet, return the deleted data, and at the same time, specify whether to move the right cell to the left or the bottom cell to move up + +- **Usage**: + + - Delete the current cell and after deleting, the right cell moves to the left + `luckysheet.deleteCell('left')` + +------------ + +### setCellFormat(row, column, attr, value [,setting]) + + +- **Parameter**: + + - {Number} [row]: The row number of the cell; an integer starting from 0, 0 means the first row + - {Number} [column]: The number of the column where the cell is located; an integer starting from 0, 0 means the first column + - {String} [attr]: attribute type, refer to attribute value of [cell attribute table](/zh/guide/cell.html) + - {String | Number | Object} [value]: Specific setting value, one attribute will correspond to multiple values, refer to the value example of [cell attribute table](/zh/guide/cell.html), if the attribute type is ` Attr` is the cell format `ct`, then the setting value `value` should provide a ct object, such as: `{fa:"General", t:"g"}`, for example, set the format of cell A1 to percentage format: + + `luckysheet.setCellFormat(0, 0, "ct", {fa:"0.00%", t:"n"})` + + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Set the properties of a cell. If you want to set the value of a cell or set multiple cell properties at the same time, it is recommended to use `setCellValue` + + Special settings + + When setting the border, attr is `"bd"`, value is a key/value object, and the border type: `borderType`/border thickness:`style`/border color:`color` need to be set at the same time, such as setting A1 unit The border of the grid is all/red/thin: + + `luckysheet.setCellFormat(0, 0, "bd", {borderType: "border-right",style: "1", color: "#ff0000"})` + + The complete optional setting parameters are as follows: + + + Border Type `borderType: "border-left" | "border-right" | "border-top" | "border-bottom" | "border-all" | "border-outside" | "border-inside" | "border -horizontal" | "border-vertical" | "border-none"`, + + Border thickness `style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick` + + Border color `color: hexadecimal color value` + +- **Usage**: + + - Set the current worksheet A1 cell text bold + `luckysheet.setCellFormat(0, 0, "bl", 1)` + - Set the B2 cell background of the second worksheet to red + `luckysheet.setCellFormat(1, 1, "bg", "#ff0000", {order:1})` + - Set the value of cell "A1" of the current worksheet to "abc" + `luckysheet.setCellFormat(0, 0,'v','abc');` + +------------ + +### find(content [,setting]) + + +- **Parameter**: + + - {String} [content]: the content to find + - {PlainObject} [setting]: optional parameters + + {Boolean} [isRegularExpression]: Whether to match the regular expression; the default is `false` + + {Boolean} [isWholeWord]: Whether to match the whole word; the default is `false` + + {Boolean} [isCaseSensitive]: Whether to match case sensitively; the default is `false` + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {String} [type]: cell attribute; the default value is `"m"` + +- **Explanation**: + + Find the specified content in a worksheet and return a one-bit array of cells composed of the found content, the data format is the same as `celldata`. + +- **Usage**: + + - Find the string `"value"` in the current worksheet + `luckysheet.find("value")` + - Find cells in the current worksheet whose formula contains `"SUM"` + `luckysheet.find("SUM",{type:"f"})` + +------------ + +### replace(content, replaceContent [,setting]) + + +- **Parameter**: + + - {String} [content]: the content to find + - {String} [replaceContent]: The content to be replaced + - {PlainObject} [setting]: optional parameters + + {Boolean} [isRegularExpression]: Whether to match the regular expression; the default is `false` + + {Boolean} [isWholeWord]: Whether to match the whole word; the default is `false` + + {Boolean} [isCaseSensitive]: Whether to match case sensitively; the default is `false` + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Find the specified content in a worksheet and replace it with new content, and return a one-bit array of cells composed of the replaced content. The data format is the same as `celldata`. + +- **Usage**: + + - Find the string `"value"` in the current worksheet and replace it with `"out"` + `luckysheet.replace("value", "out")` + +------------ + +### exitEditMode([,setting]) + + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Exit edit mode. After double-clicking the cell with the mouse, it will enter the cell editing mode. After the editing is completed, when the mouse clicks on the input box elsewhere to lose focus, the editing mode will be exited, and the value of the cell will be saved. This Api is the operation of automatically exiting the editing mode, mainly to trigger the automatic saving of cells. + +- **Usage**: + + - Manually trigger to exit edit mode + `luckysheet.exitEditMode()` + +------------ + +## Row and column operations + +### setHorizontalFrozen(isRange [,setting]) + + +- **Parameter**: + + - {Boolean} [isRange]: Whether to freeze rows to selection + Possible values of `isRange` are: + + + `"false"`: Freeze the first line + + `"true"`: freeze line to selection + - {PlainObject} [setting]: optional parameters + + {Array | Object | String} [range]: Set when `isRange` is `true`, open the frozen cell position, the format is `{ row_focus:0, column_focus:0 }`, which means the currently activated cell The number of rows and columns of the grid; the default is obtained from the last selection of the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Freeze row operation + + Pay special attention to the setting of `range` in `setting` only when `isRange` is set to `true`, which is different from the general range format. + +- **Usage**: + + - Freeze the first row + + `luckysheet.setHorizontalFrozen(false)` + + - Frozen to `B5` selection + + `luckysheet.setHorizontalFrozen(true, { range: 'B5' })` + +------------ + +### setVerticalFrozen(isRange [,setting]) + + +- **Parameter**: + + - {Boolean} [isRange]: Whether to freeze the selection + Possible values of `isRange` are: + + + `"false"`: Freeze the first column + + `"true"`: Freeze column to selection + - {PlainObject} [setting]: optional parameters + + {Array | Object | String} [range]: Set when `isRange` is `true`, open the frozen cell position, the format is `{ row_focus:0, column_focus:0 }`, which means the currently activated cell The number of rows and columns of the grid; the default is obtained from the last selection of the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Freeze column operation + + Pay special attention to the setting of `range` in `setting` only when `isRange` is set to `true`, which is different from the general range format. + +- **Usage**: + + - Freeze the first column + + `luckysheet.setVerticalFrozen(false)` + +------------ + +### setBothFrozen(isRange [,setting]) + + +- **Parameter**: + + - {Boolean} [isRange]: Whether to freeze the ranks to the selection + Possible values of `isRange` are: + + + `"false"`: Freeze ranks + + `"true"`: Freeze ranks to selection + - {PlainObject} [setting]: optional parameters + + {Array | Object | String} [range]: Set when `isRange` is `true`, open the frozen cell position, the format is `{ row_focus:0, column_focus:0 }`, which means the currently activated cell The number of rows and columns of the grid; the default is obtained from the last selection of the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Freeze rank operation + + Pay special attention to the setting of `range` in `setting` only when `isRange` is set to `true`, which is different from the general range format. + + If you want to use this API to set the freeze after the workbook is initialized, you can execute it in the hook function after the workbook is created, such as: + ```js + luckysheet.create({ + hook:{ + workbookCreateAfter:function(){ + luckysheet.setBothFrozen(false); + } + } + }); + +- **Usage**: + + - Frozen ranks + + `luckysheet.setBothFrozen(false)` + +------------ + +### cancelFrozen([setting]) + + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Cancel freeze operation + +- **Usage**: + + - Cancel freeze + + `luckysheet.cancelFrozen()` + +------------ + +### insertRow(row [,setting]) + + +- **Parameter**: + + - {Number} [row]: Insert a blank row in the first few rows, starting from 0 + + - {PlainObject} [setting]: optional parameters + + {Number} [number]: The number of blank rows inserted; the default is 1 + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Insert a blank line in the `number` line at the position of the `row` line + +- **Usage**: + + - Insert a blank line at the position of line 2 + + `luckysheet.insertRow(1)` + +------------ + +### insertColumn( column [,setting]) + + +- **Parameter**: + + - {Number} [column]: Insert a blank column in the first column + + - {PlainObject} [setting]: optional parameters + + {Number} [number]: The number of blank columns to insert; the default is 1 + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Insert a blank column in column `number` at the position of column `column` + +- **Usage**: + + - Insert 3 blank rows in column 1 + + `luckysheet.insertRow(0, { number: 3 })` + +------------ + +### deleteRow(rowStart, rowEnd [,setting]) + + +- **Parameter**: + + - {Number} [rowStart]: the starting row to delete + - {Number} [rowEnd]: the end row to be deleted + + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Delete the specified row + + Special reminder, after deleting the row, the serial number of the row will not change, the following row will be added to the above, pay attention to observe whether the data is deleted correctly. + +- **Usage**: + + - Delete 2-4 lines + + `luckysheet.deleteRow(1, 3)` + +------------ + +### deleteColumn(columnStart, columnEnd [,setting]) + +- **Parameter**: + + - {Number} [columnStart]: the starting column to be deleted + - {Number} [columnEnd]: the end column to be deleted + To + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Delete the specified column + + Special reminder, after deleting the column, the serial number of the column will not change, the right column will be added to the left, pay attention to whether the data is deleted correctly. + +- **Usage**: + + - Delete 2-4 columns + + `luckysheet.deleteColumn(1, 3)` + +------------ + +### hideRow(rowStart, rowEnd [,setting]) + +- **Parameter**: + + - {Number} [rowStart]: The starting row to be hidden + - {Number} [rowEnd]: the end row to be hidden + To + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Hide the specified row + + Special reminder, after the row is hidden, the row number will change. + +- **Usage**: + + - Hide 2-4 rows + + `luckysheet.hideRow(1, 3)` + +------------ + +### hideColumn(columnStart, columnEnd [,setting])(TODO) + +- **Parameter**: + + - {Number} [columnStart]: the starting column to be hidden + - {Number} [columnEnd]: the end column to be hidden + + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Hide the specified column + + Special reminder, after hiding the column, the sequence number of the column will change. + +- **Usage**: + + - Hide 2-4 columns + + `luckysheet.hideColumn(1, 3)` + +------------ + +### showRow(rowStart, rowEnd [,setting]) + +- **Parameter**: + + - {Number} [rowStart]: the starting row to be displayed + - {Number} [rowEnd]: the end row to be displayed + To + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Show the specified row + +- **Usage**: + + - Display 2-4 lines + + `luckysheet.showRow(1, 3)` + +------------ + +### showColumn(columnStart, columnEnd [,setting])(TODO) + + +- **Parameter**: + + - {Number} [columnStart]: the starting column to be displayed + - {Number} [columnEnd]: the end column to be displayed + To + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Show the specified column + +- **Usage**: + + - Display 2-4 columns + + `luckysheet.showColumn(1, 3)` + +------------ + +### setRowHeight(rowInfo [,setting]) + +(TODO) + +- **Parameter**: + + - {Object} [rowInfo]: Correspondence between number of rows and height + + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Set the height of the specified ~~row~~ + +- **Usage**: + + - Set the height of the first row to 50px and the height of the second row to 60px + + `luckysheet.setRowHeight({0:50,1:60})` + +------------ + +### setColumnWidth(columnInfo [,setting]) + +(TODO) + +- **Parameter**: + + - {Object} [columnInfo]: Correspondence between the number of columns and the width + + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Set the width of the specified column + +- **Usage**: + + - Set the width of the first column to 50px and the width of the second column to 60px + + `luckysheet.setColumnWidth({0:50,1:60})` + +------------ + +### getRowHeight(rowInfo [,setting]) + +(TODO) + +- **Parameter**: + + - {Array} [rowInfo]: The number of rows + + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Get the height of the specified row, get the object corresponding to the number of rows and height + +- **Usage**: + + - The height of the first row is 50px, the height of the second row is 60px, get these values + + `luckysheet.getRowHeight([0,1])` + Return to get + `{0:50,1:60}` + +------------ + +### getColumnWidth(columnInfo [,setting]) + +(TODO) + +- **Parameter**: + + - {Array} [columnInfo]: The number of columns + + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Get the width of the specified column, get the object of the corresponding relationship between the number of columns and the width + +- **Usage**: + + - The width of the first column is 50px, the width of the second column is 60px, get these values + + `luckysheet.getColumnWidth([0,1])` + Return to get + `{0:50,1:60}` + +------------ + +### getDefaultRowHeight([,setting]) + +(TODO) + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Get the default row height of the specified worksheet + +- **Usage**: + + - Returns the default row height of the current worksheet + + `luckysheet.getDefaultRowHeight()` + Return to get + `19` + +------------ + +### getDefaultColWidth([,setting]) + +(TODO) + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Get the default column width of the specified worksheet + +- **Usage**: + + - Returns the default column width of the current worksheet + + `luckysheet.getDefaultColWidth()` + Return to get + `73` + +------------ + +## Selection operation + +### getRange() + + +- **Explanation**: + + Returns an array of current selection objects, there may be multiple selections. The format of each selection area is an object composed of row/column information `{row:[0,1],column:[0,1]}` + +- **Usage**: + + - The current selection is "A1:B2" and "B4:C5", execute + + `luckysheet.getRange()` + + The returned result is: + ```json + [ + { "row": [0,1], "column": [0,1] }, + { "row": [3,4], "column": [1,2] } + ] + ``` + +------------ + + +### getRangeWithFlatten() + +- **Explanation**: + + Returns an array representing the positions of all cells in the specified area, which is different from the getrange method, which organizes the data of the selection by cell (rather than a continuous area). + +- **Usage**: + + - Select the specified area in the table, and then execute + + `luckysheet.getRange()` + + The returned result is: + ```json + [ + {"row":[0,0],"column":[0,2]}, + {"row":[1,1],"column":[0,0]}, + {"row":[3,3],"column":[0,0]} + ] + ``` + Where,{"row":[0,0],"column":[0,2]} denote a whole continuous region. + + - Select the area above in the table and execute + + `luckysheet.getRangeWithFlatten()` + + The returned result is: + ```json + [ + {"r":0,"c":0}, + {"r":0,"c":1}, + {"r":0,"c":2}, + {"r":1,"c":0}, + {"r":3,"c":0} + ] + ``` + +------------ + + +### getRangeValuesWithFlatte() + +- **Explanation**: + + Returns an array of objects representing the contents of all cells in a specified range + +- **Usage**: + + - Select the specified area in the table, and then execute + + `luckysheet.getRange()` + + The returned result is: + ```json + [ + {"row":[0,0],"column":[0,2]}, + {"row":[1,1],"column":[0,0]}, + {"row":[3,3],"column":[0,0]} + ] + ``` + Where,{"row":[0,0],"column":[0,2]} denote a whole continuous region. + + - Select the area above in the table and execute + + `luckysheet.getRangeValuesWithFlatte()` + + The returned result is: + ```json + [ + { + "bg": null, + "bl": 0, + "it": 0, + "ff": 0, + "fs": 11, + "fc": "rgb(51, 51, 51)", + "ht": 1, + "vt": 1, + "v": 1, + "ct": { + "fa": "General", + "t": "n" + }, + "m": "1" + }, + { + "bg": null, + "bl": 0, + "it": 0, + "ff": 0, + "fs": 11, + "fc": "rgb(51, 51, 51)", + "ht": 1, + "vt": 1, + "v": 2, + "ct": { + "fa": "General", + "t": "n" + }, + "m": "2" + }, + { + "bg": null, + "bl": 0, + "it": 0, + "ff": 0, + "fs": 11, + "fc": "rgb(51, 51, 51)", + "ht": 1, + "vt": 1, + "v": 3, + "ct": { + "fa": "General", + "t": "n" + }, + "m": "3" + }, + { + "v": "Background", + "ct": { + "fa": "General", + "t": "g" + }, + "m": "Background", + "bg": null, + "bl": 1, + "it": 0, + "ff": 0, + "fs": 11, + "fc": "rgb(51, 51, 51)", + "ht": 1, + "vt": 1 + }, + { + "v": "Border", + "ct": { + "fa": "General", + "t": "g" + }, + "m": "Border", + "bg": null, + "bl": 1, + "it": 0, + "ff": 0, + "fs": 11, + "fc": "rgb(51, 51, 51)", + "ht": 1, + "vt": 1 + } + ] + ``` +------------ + +### getRangeAxis() + +- **Explanation**: + + Returns an array of coordinate strings corresponding to the current selection. Multiple selections may exist. Each selection may be a single cell (such as A1) or a rectangular region of multiple cells (such as D9: E12) + +- **Usage**: + + - The current selection is"E10:E14"、"A7:B13"、"C4"、 "A3" and "C6:D9", execute + + `luckysheet.getRangeAxis()` + + The returned result is: + ```json + ["E10:E14", "A7:B13", "C4", "A3", "C6:D9"] + ``` + +------------ + +### getRangeValue([setting]) + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column:[0 ,1]}`, can only be a single selection; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + +- **Explanation**: + + Returns the data of a two-dimensional array of cells in the specified range of the specified worksheet, each cell is an object. + + [Cell Object Format Reference](/zh/guide/cell.html) + +- **Usage**: + + - The current selection is "A1:B2", execute + + `luckysheet.getRangeValue()` + + The returned result is: + ```json + [ + [ + { + "v": "vaule1", + "ct": { "fa": "General", "t": "g" }, + "m": "vaule1", + "bg": "rgba(255,255,255)", + "bl": 0, + "it": 0, + "ff": 1, + "fs": 11, + "fc": "rgb(51, 51, 51)", + "ht": 1, + "vt": 0 + }, + { + "v": "value3", + "ct": { "fa": "General", "t": "g" }, + "m": "value3", + "bg": "rgba(255,255,255)", + "bl": 0, + "it": 0, + "ff": 1, + "fs": 11, + "fc": "rgb(51, 51, 51)", + "ht": 1, + "vt": 0 + } + ], + [ + { + "v": "vaule2", + "ct": { "fa": "General", "t": "g" }, + "m": "vaule2", + "bg": "rgba(255,255,255)", + "bl": 0, + "it": 0, + "ff": 1, + "fs": 11, + "fc": "rgb(51, 51, 51)", + "ht": 1, + "vt": 0 + }, + { + "v": "value4", + "ct": { "fa": "General", "t": "g" }, + "m": "value4", + "bg": "rgba(255,255,255)", + "bl": 0, + "it": 0, + "ff": 1, + "fs": 11, + "fc": "rgb(51, 51, 51)", + "ht": 1, + "vt": 0 + } + ] + ] + ``` + +------------ + +### getRangeHtml([setting]) + +[todo] + + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, allows an array of multiple selections; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + +- **Explanation**: + + Copy the data in the specified cell area of the specified worksheet and return the data containing the ``html format, which can be used to paste into excel to maintain the cell style. + + Note that if you copy multiple selections, these selections must have the same row or the same column to copy, and the copied results will also be automatically merged into a concatenated array, for example, multiple selections `"C18:C20"` / `"E18:E20"` / `"G18:H20"` is allowed, but multiple selections of `"C18:C20"` / `"E18:E21"` are not allowed + +- **Usage**: + + - The current selection is "A1:B2", execute + + `luckysheet.getRangeHtml()` + + The returned result is: + ```html +
+ + + + + + + + + + + + +
+ value1 + + value3 +
+ value2 + + value4 +
+ ``` + +------------ + +### getRangeJson(title [,setting]) + +- **Parameter**: + + - {Boolean} [title]: Whether the first line is the title + + Possible values of `title` are: + + + `"true"`: first row is title + + `"false"`: The first row is not title + - {PlainObject} [setting]: optional parameters + + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, can only be a single selection; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + +- **Explanation**: + + Copy the data in the specified cell area of the specified worksheet and return the data in `json` format + +- **Usage**: + + - The current selection is "A1:B2", the first row is the title to get json + + `luckysheet.getRangeJson(true)` + + The returned result is: + ```json + [ + { "value1": "value2", "value3": "value4" } + ] + ``` + + - The current selection is "A1:B2", the first row is not title to get json + + `luckysheet.getRangeJson(false)` + + The returned result is: + ```json + [ + { "A": "value1", "B": "value3" }, + { "A": "value2", "B": "value4" } + ] + ``` + +------------ + +### getRangeArray(dimensional [,setting]) + +[todo] + +- **Parameter**: + + - {String} [dimensional]: array dimension + + Possible values of `dimensional` are: + + + `"oneDimensional"`: one-dimensional array + + `"twoDimensional"`: two-dimensional array + + `"custom"`: a two-dimensional array of custom rows and columns + - {PlainObject} [setting]: optional parameters + + {Number} [row]: Set when `dimensional` is `custom`, the number of rows in the multidimensional array + + {Number} [column]: Set when `dimensional` is `custom`, the number of columns in the multidimensional array + + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, can only be a single selection; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + +- **Explanation**: + + Copy the data in the specified cell area of the specified worksheet, and return the data in a one-dimensional, two-dimensional, or two-dimensional array of custom rows and columns. + + Pay special attention to the setting of `row` and `column` in `setting` only when `dimensional` is set to `custom` + +- **Usage**: + + - The current selection is "A1:B2", a one-dimensional array + + `luckysheet.getRangeArray('oneDimensional')` + + The returned result is: + ```json + ["value1","value3","value2","value4"] + ``` + + - The current selection is "A1:B2", a two-dimensional array + + `luckysheet.getRangeArray('twoDimensional')` + + The returned result is: + ```json + [ + [ "value1", "value3" ], + [ "value2", "value4" ] + ] + ``` + + - The current selection area is "A1:C5", which is composed of values from'value1' to'value15', and obtains a two-dimensional array data with 3 rows and 2 columns + + `luckysheet.getRangeArray('custom', { row: 3, column: 2 })` + + The returned result is: + ```json + [ + [ + { + "m": "value1", + "ct": { "fa": "General", "t": "g" }, + "v": "value1" + }, + { + "ct": { "fa": "General", "t": "g" }, + "v": "value6", + "m": "value6" + } + ], + [ + { + "ct": { "fa": "General", "t": "g" }, + "v": "value11", + "m": "value11" + }, + { + "m": "value2", + "ct": { "fa": "General", "t": "g" }, + "v": "value2" + } + ], + [ + { + "ct": { "fa": "General", "t": "g" }, + "v": "value7", + "m": "value7" + }, + { + "ct": { "fa": "General", "t": "g" }, + "v": "value12", + "m": "value12" + } + ] + ] + ``` + +------------ + +### getRangeDiagonal(type [,setting]) + + +- **Parameter**: + + - {String} [type]: diagonal or diagonal offset + + Possible values of `type` are: + + + `"normal"`: diagonal + + `"anti"`: anti-diagonal + + `"offset"`: diagonal offset + - {PlainObject} [setting]: optional parameters + - {Number} [column]: Set when `type` is `offset`, the number of columns for diagonal offset + + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, can only be a single selection; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + +- **Explanation**: + + Copy the data in the specified cell area of the specified worksheet, and return the diagonal or diagonal offset data from the `column` column. + + Pay special attention to the setting of `column` in `setting` only when `type` is set to `offset`. + +- **Usage**: + + - The current selection is "A1:B2", diagonal + + `luckysheet.getRangeDiagonal('normal')` + + The returned result is: + ```json + [ + { + "m": "value1", + "ct": { "fa": "General", "t": "g" }, + "v": "value1" + }, + { + "m": "value4", + "ct": { "fa": "General", "t": "g" }, + "v": "value4" + } + ] + ``` + + - The current selection is "A1:B2", against the diagonal + + `luckysheet.getRangeDiagonal('anti')` + + The returned result is: + ```json + [ + { + "m": "value3", + "ct": { "fa": "General", "t": "g" }, + "v": "value3" + }, + { + "m": "value2", + "ct": { "fa": "General", "t": "g" }, + "v": "value2" + } + ] + ``` + - The current selection is "A1:B2", and the diagonal is offset by 1 column + + `luckysheet.getRangeDiagonal('offset', { column: 1 })` + + The returned result is: + ```json + [ + { + "m": "value3", + "ct": { "fa": "General", "t": "g" }, + "v": "value3" + } + ] + ``` +------------ + +### getRangeBoolean([setting]) + + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, can only be a single selection; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + +- **Explanation**: + + Copy the data in the specified cell area of the specified worksheet, and return the data of Boolean value + +- **Usage**: + + - The current selection is "A1:B2" + + `luckysheet.getRangeBoolean()` + + The returned result is: + ```json + [ + [ false, false ], + [ false, false ] + ] + ``` + +------------ + +### setRangeShow(range [,setting])
+ +- **Parameter**: + + - {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, allows an array of multiple selections; the default is the current selection + - {PlainObject} [setting]: optional parameters + + {Boolean} [show]: Whether to show the highlight selection effect; the default value is `true` + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Specify one or more selection areas in the worksheet to be selected and choose whether to highlight or not. Multiple format settings are supported. + + Special reminder, the selection range setting involved in Luckysheet can refer to this setting + +- **Usage**: + + + Set the current worksheet selection area `A1:B2`: + + `luckysheet.setRangeShow("A1:B2")` + + Set selection range `A1:B2`: + + `luckysheet.setRangeShow(["A1:B2"])` + + Set selection range `A1:B2`: + + `luckysheet.setRangeShow({row:[0,1],column:[0,1]})` + + Set selection range `A1:B2`: + + `luckysheet.setRangeShow([{row:[0,1],column:[0,1]}])` + + Set the selection range `A1:B2` and `C3:D4`: + + `luckysheet.setRangeShow(["A1:B2","C3:D4"])` + + Set the selection range `A1:B2` and `D3`: + + `luckysheet.setRangeShow([{row:[0,1],column:[0,1]},{row:[2,2],column:[3,3]}])` + +------------ + +### setRangeValue(data [,setting]) + +- **Parameter**: + + - {Array} [data]: The data of a two-dimensional array of cells to be assigned. The value of each cell can be a string or a number, or an object conforming to the Luckysheet format. Refer to [cell attribute table](/zh /guide/cell.html) + - {PlainObject} [setting]: optional parameters + + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, can only be a single selection; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Boolean} [isRefresh]: Whether to refresh the interface; the default is `true`; used to control throttling when multiple cells are assigned, the previous cell should be set to `false`, and the last cell is set Is `true`. + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Assign a cell array data to the specified area, the data format is the same as the data obtained by the `getRangeValue` method. + + Note that usually the `getRangeValue` method only obtains the selection data, but does not include the border and merged cell information. When the `setRangeValue` is executed, it will dynamically determine whether the previous step has executed the `getRangeValue`, if executed, the border will be Obtained from Luckysheet configuration together with the merged cell information. + +- **Usage**: + + + Assign value to current selection + + ```js + const data = [ + [ + { + "m": "value1", + "ct": { + "fa": "General", + "t": "g" + }, + "v": "value1" + }, + { + "m": "value3", + "ct": { + "fa": "General", + "t": "g" + }, + "v": "value3" + } + ], + [ + { + "m": "value2", + "ct": { + "fa": "General", + "t": "g" + }, + "v": "value2" + }, + { + "m": "value4", + "ct": { + "fa": "General", + "t": "g" + }, + "v": "value4" + } + ] + ] + luckysheet.setRangeValue(data,{range:"A1:B2"}) + ``` + +------------ + +### setRangeFormat(attr, value [,setting]) + + +- **Parameter**: + + - {String} [attr]: attribute type, + Refer to the attribute value of [cell attribute table](/zh/guide/cell.html) + - {String | Number | Object} [value]: Specific setting value, one attribute will correspond to multiple values, refer to the value example of [cell attribute table](/zh/guide/cell.html), special case: if The attribute type `attr` is the cell format `ct`, then the setting value `value` should provide `ct.fa`, for example, set the cell format of `"A1:B2"` to percentage format: + To + `luckysheet.setRangeFormat("ct", "0.00%", {range:"A1:B2"})` + + - {PlainObject} [setting]: optional parameters + + {Object | String} [range]: Set the target selection range of the parameter. The supported selection format is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1], column:[0,1]}`, allows an array of multiple selections; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Set the cell format of the specified range, generally used as a processing format, the assignment operation recommends using the `setRangeValue` method + + When setting the border, attr is `"bd"`, value is a key/value object, and the border type: `borderType`/border thickness:`style`/border color:`color` need to be set at the same time, such as setting `" A1:B2"`The border of the cell is all/red/thin: + + `luckysheet.setRangeFormat("bd", {borderType: "border-right",style: "1", color: "#ff0000"}, {range:["A1:B2"]})` + + The complete optional setting parameters are as follows: + + + Border Type `borderType: "border-left" | "border-right" | "border-top" | "border-bottom" | "border-all" | "border-outside" | "border-inside" | "border -horizontal" | "border-vertical" | "border-none"`, + + Border thickness `style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick` + + Border color `color: hexadecimal color value` + +- **Usage**: + + - Set the cell text in the current worksheet `"A1:B2"` range to be bold + + `luckysheet.setRangeFormat("bl", 1, {range:"A1:B2"})` + - Set the background of the cells in the range of `"B2"` and `"C4:D5"` of the second worksheet to red + + `luckysheet.setRangeFormat("bg", "#ff0000", {range:["B2","C4:D5"], order:1})` + +------------ + +### setRangeFilter(type [,setting]) + +[todo] + + +- **Parameter**: + + - {String} [type]: Turn on or off the filtering function + + Possible values of `type` are: + + + `"open"`: Open the filter function and return the current filtered range object + + `"close"`: Close the filter function and return to the scope of the filter before closing + - {PlainObject} [setting]: optional parameters + + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, can only be a single selection; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + For the worksheet of the specified subscript, the filter function is turned on or off for the selected range + +- **Usage**: + + - Open the filter function of the second worksheet "A1:B2" + `luckysheet.setRangeFilter("open",{range:"A1:B2",order:1})` + +------------ + +### setRangeMerge(type [,setting]) + + +- **Parameter**: + + - {String} [type]: merge cell type + + Possible values of `type` are: + + + `"all"`: Merge all, all cells in the area are merged into one large cell + + `"horizontal"`: merge horizontally, cells in the same row in the area are merged into one cell + + `"vertical"`: merge vertically, the cells in the same column in the area are merged into one cell + + - {PlainObject} [setting]: optional parameters + + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, allows an array of multiple selections; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Set the merged cells for the worksheet with the specified subscript and the selected range + +- **Usage**: + + - The current selection'A1:B2' is set to merge cells, the type is merge all + + `luckysheet.setRangeMerge("all")` + The data of'A1:B1' is: + ```json + [ + [ + { + "m": "value1", + "ct": { "fa": "General", "t": "g" }, + "v": "value1", + "mc": { "r": 0, "c": 0, "rs": 2, "cs": 2 } + }, + { + "mc": { "r": 0, "c": 0 } + } + ], + [ + { + "mc": { "r": 0, "c": 0 } + }, + { + "mc": { "r": 0, "c": 0 } + } + ] + ] + ``` + +------------ + +### cancelRangeMerge( [setting]) + + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, allows an array of multiple selections; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Unmerge cells in the selected range for the worksheet with the specified subscript + +- **Usage**: + + - The current selection'A1:B2' is already a merged cell, now you want to cancel the merge + + `luckysheet.cancelRangeMerge()` + +------------ + +### setRangeSort(type [,setting]) + + +- **Parameter**: + + - {String} [type]: sort type + + Possible values of `type` are: + + + `"asc"`: ascending order + + `"des"`: descending order + + - {PlainObject} [setting]: optional parameters + + + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, can only be a single selection; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + For the worksheet of the specified subscript, the sort function is turned on for the selected range, and the sorted data of the selected range is returned. + +- **Usage**: + + - Set the current selection of the current worksheet to ascending order + `luckysheet.setRangeSort("asc")` + +------------ + +### setRangeSortMulti(title, sort [,setting]) + + +- **Parameter**: + + - {Boolean} [title]: Does the data have a title row + - {Array} [sort]: Column setting, set the column index and sort method to be sorted, the format is like: `[{ i:0,sort:'asc' },{ i:1,sort:'des' }] ` + - {PlainObject} [setting]: optional parameters + + + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, can only be a single selection; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + For the worksheet of the specified subscript, the selected range enables the multi-column custom sorting function to return the sorted data of the selected range. + +- **Usage**: + + - Set the current selection of the current worksheet to a custom sort, the data has a header row, and it is sorted according to the rules of the first column ascending order and the second column descending order + `luckysheet.setRangeSortMulti(true,[{ i:0,sort:'asc' },{ i:1,sort:'des' }])` + +------------ + +### setRangeConditionalFormatDefault(conditionName, conditionValue [,setting]) + +- **Parameter**: + + - {String} [conditionName]: Conditional format rule type + + Possible values ​​of `conditionName` are: + + + `"greaterThan"`: greater than (conditionValue value is numeric or cell range) + + `"lessThan"`: Less than (conditionValue value is numeric value or cell range) + + `"betweenness"`: between (conditionValue value is numeric value or cell range) + + `"equal"`: equal to (conditionValue value is numeric value or cell range) + + `"textContains"`: text contains (conditionValue value is text or cell range) + + `"occurrenceDate"`: date of occurrence (conditionValue value is date) + + `"duplicateValue"`: Duplicate value (conditionValue value is '0': duplicate value, '1': unique value) + + `"top10"`: the first N items (conditionValue value is 1~1000) + + `"top10%"`: Top N% (conditionValue value is 1~1000) + + `"last10"`: the last N items (conditionValue is 1~1000) + + `"last10%"`: Last N% (conditionValue value is 1~1000) + + `"AboveAverage"`: above average (conditionValue can be an empty array) + + `"SubAverage"`: below average (conditionValue can be an empty array) + + - {Array} [conditionValue]: You can set condition cells or condition values + Value rules (at least one value in the condition value array and at most two values) + ```js + [2] + ``` + Or (if the value is the cell range, take the cell value in the upper left corner) + ```js + ['A1'] + ``` + + - {PlainObject} [setting]: optional parameters + + + {Object} [format]: color setting + + * Set the text color and cell color; the default value is `{ + "textColor": "#000000", + "cellColor": "#ff0000" + }` + + {Array | Object | String} [cellrange]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, allows an array of multiple selections; the default is the current selection + + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + For the worksheet of the specified subscript, the conditional formatting is enabled for the selected range, and some cells are highlighted according to the set conditional formatting rules, and the data after the conditional formatting is enabled is returned. + +- **Usage**: + + - Highlight cells with content greater than the number 2 + `luckysheet.setRangeConditionalFormatDefault("greaterThan",{ type: 'value', content: [2] })` + + - Highlight the cells whose content is less than the content of cell A1 + `luckysheet.setRangeConditionalFormatDefault("lessThan",{ type: 'range', content: ['A1'] })` + + - Highlight cells with content between 2 and 10 + `luckysheet.setRangeConditionalFormatDefault("betweenness",{ type: 'value', content: [2,10] })` + + - Highlight the cell whose content is equal to the content of cell A1 + `luckysheet.setRangeConditionalFormatDefault("equal",{ type: 'range', content: ['A1'] })` + + - Highlight the cell that contains the content of cell A1 + `luckysheet.setRangeConditionalFormatDefault("textContains",{ type: 'range', content: ['A1'] })` + + - Highlight cells with dates between `2020/09/24-2020/10/15` + `luckysheet.setRangeConditionalFormatDefault("occurrenceDate",{ type: 'value', content: ['2020/09/24 - 2020/10/15'] })` + + - Highlight cells with repeated values, content is 0 + `luckysheet.setRangeConditionalFormatDefault("duplicateValue",{ type: 'value', content: [0] })` + + - Highlight the cell with unique value, content is 1 + `luckysheet.setRangeConditionalFormatDefault("duplicateValue",{ type: 'value', content: [1] })` + + - Highlight the top 20 cells + `luckysheet.setRangeConditionalFormatDefault("top",{ type: 'value', content: [20] })` + + - Highlight the top 30% of cells + `luckysheet.setRangeConditionalFormatDefault("topPercent",{ type: 'value', content: [30] })` + + - Highlight the bottom 15 cells + `luckysheet.setRangeConditionalFormatDefault("last",{ type: 'value', content: [15] })` + + - Highlight the bottom 15% of cells + `luckysheet.setRangeConditionalFormatDefault("lastPercent",{ type: 'value', content: [15] })` + + - Highlight cells that are above average + `luckysheet.setRangeConditionalFormatDefault("AboveAverage",{ type: 'value', content: ['AboveAverage'] })` + + - Highlight cells below average + `luckysheet.setRangeConditionalFormatDefault("SubAverage",{ type: 'value', content: ['SubAverage'] })` + +------------ + +### setRangeConditionalFormat(type [,setting]) + +- **Parameter**: + + - {String} [type]: Conditional formatting rule type + + Possible values ​​of `type` are: + + + `"dataBar"`: data bar + + `"icons"`: icon set + + `"colorGradation"`: Color Gradation + + - {PlainObject} [setting]: optional parameters + + + {Array | String} [format]: Color setting + + * When `type` is `dataBar`, the gradient color should be set; the default value is blue-white gradient` ["#638ec6", "#ffffff"]` + + Recommended shortcut value: + ```js + ["#638ec6", "#ffffff"], //Blue-white gradient data bar + ["#63c384", "#ffffff"], //Green-white gradient data bar + ["#ff555a", "#ffffff"], //Red-white gradient data bar + ["#ffb628", "#ffffff"], //Orange-white gradient data bar + ["#008aef", "#ffffff"], //Light blue-white gradient data bar + ["#d6007b", "#ffffff"], //Purple-white gradient data bar + ["#638ec6"], //Blue data bar + ["#63c384"], //green data bar + ["#ff555a"], //Red data bar + ["#ffb628"], //Orange data bar + ["#008aef"], //Light blue data bar + ["#d6007b"] //Purple data bar + ``` + + * When `type` is `icons`, the icon type should be set; the default value is "threeWayArrowMultiColor": the three-way arrow color, + + Possible values ​​are: + + `threeWayArrowMultiColor`: three-way arrow (color), + + `threeTriangles`: 3 triangles, + + `fourWayArrowMultiColor`: four-way arrow (color), + + `fiveWayArrowMultiColor`: five-way arrow (color), + + `threeWayArrowGrayColor`: three-way arrow (gray), + + `fourWayArrowGrayColor`: four-way arrow (gray), + + `fiveWayArrowGrayColor`: five-way arrow (gray), + + `threeColorTrafficLightRimless`: three-color traffic light (no border), + + `threeSigns`: three signs, + + `greenRedBlackGradient`: green-red-black gradient, + + `threeColorTrafficLightBordered`: three-color traffic light (with border), + + `fourColorTrafficLight`: Four-color traffic light, + + `threeSymbolsCircled`: three symbols (with a circle), + + `tricolorFlag`: tricolor flag, + + `threeSymbolsnoCircle`: three symbols (no circle), + + `threeStars`: 3 stars, + + `fiveQuadrantDiagram`: five-quadrant diagram, + + `fiveBoxes`: 5 boxes, + + `grade4`: Four grades, + + `grade5`: Five grades, + + * When `type` is `colorGradation`, the color value of the color scale should be set; the default value is green-yellow-red scale` ["rgb(99, 190, 123)", "rgb(255, 235, 132)", "rgb(248, 105, 107)"]` + + Recommended shortcut value: + ```js + ["rgb(99, 190, 123)", "rgb(255, 235, 132)", "rgb(248, 105, 107)"], //green-yellow-red level + ["rgb(248, 105, 107)", "rgb(255, 235, 132)", "rgb(99, 190, 123)"], //red-yellow-green level + + ["rgb(99, 190, 123)", "rgb(252, 252, 255)", "rgb(248, 105, 107)"], //green-white-red level + ["rgb(248, 105, 107)", "rgb(252, 252, 255)", "rgb(99, 190, 123)"], //red-white-green level + + ["rgb(90, 138, 198)", "rgb(252, 252, 255)", "rgb(248, 105, 107)"], //blue-white-red level + ["rgb(248, 105, 107)", "rgb(252, 252, 255)", "rgb(90, 138, 198)"], //red-white-blue level + + ["rgb(252, 252, 255)", "rgb(248, 105, 107)"], //white-red level + ["rgb(248, 105, 107)", "rgb(252, 252, 255)"], //red-white level + + ["rgb(99, 190, 123)", "rgb(252, 252, 255)"], //green-white level + ["rgb(252, 252, 255)", "rgb(99, 190, 123)"], //white-green level + + ["rgb(99, 190, 123)", "rgb(255, 235, 132)"], //green-yellow level + ["rgb(255, 235, 132)", "rgb(99, 190, 123)"] //Yellow-green level + ``` + + + {Array | Object | String} [cellrange]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, allows an array of multiple selections; the default is the current selection + + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + For the worksheet of the specified subscript, the conditional format is turned on for the selected range, and the data after the conditional format is turned on is returned. + +- **Usage**: + + - Conditional formatting is enabled for the current selection area, showing gradient + `luckysheet.setRangeConditionalFormat("dataBar", { format: ["#63c384", "#ffffff"] })` + +------------ + +### deleteRangeConditionalFormat(itemIndex [,setting]) + +[todo] + + +- **Parameter**: + + - {Number} [itemIndex]: Conditional format rule index + + - {PlainObject} [setting]: optional parameters + + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + For the worksheet of the specified subscript, delete the conditional format rule, and return the deleted conditional format rule. + +- **Usage**: + + - Delete the third conditional formatting rule + `luckysheet.deleteRangeConditionalFormat(2)` + +------------ + +### clearRange([setting]) + +[todo] + + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Array | Object | String} [range]: The range of the selection to be cleared. The format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1] ,column:[0,1]}`, allows an array of multiple selections; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Clear the contents of the specified cell area of the specified worksheet, return the cleared data, which is different from the function of deleting the selection area, no need to set the cell movement + +- **Usage**: + + - Clear the content of the current selection + `luckysheet.clearRange()` + +------------ + +### deleteRange(move [,setting]) + +[todo] + + +- **Parameter**: + + - {String} [move]: After deleting, whether the cells on the right or below move + + Possible values of `move` are: + + + `"left"`: Move the right cell to the left + + `"up"`: Move the lower cell up + + - {PlainObject} [setting]: optional parameters + + {Array | Object | String} [range]: The range of the selection to be deleted, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1] ,column:[0,1]}`, allows an array composed of multiple selections; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Delete the specified cell range of the specified worksheet, return the deleted data, and at the same time, specify whether to move the right cell to the left or the bottom cell to move up + +- **Usage**: + + - Delete the current selection and after deleting, the right cell moves to the left + `luckysheet.deleteRange('left')` + +------------ + +### insertRange(move [,setting]) + +[todo] + + +- **Parameter**: + + - {String} [move]: Move the active cell right or down + + Possible values of `move` are: + + + `"right"`: Move the active cell to the right + + `"bottom"`: move the active cell down + + - {PlainObject} [setting]: optional parameters + + {Array} [data]: The data of a two-dimensional array of cells assigned to the range area, [Cell Object Format Reference](/zh/guide/cell.html); the default value is an empty array, that is, a blank area is inserted + + {Array | Object | String} [range]: The position to be inserted, the range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0, 1],column:[0,1]}`, the default is the current selection + + When data data is not set, an array composed of multiple selections is allowed, and the blank area inserted is the area of these selections. + + When the data data is set, it can only be a single selection, and the data data will be inserted into the first cell position of the current selection + + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + In the specified cell area of the specified worksheet, assign cell data, or create a new blank area, return data data, and at the same time, specify the active cell to move right or down + +- **Usage**: + + - Insert a blank cell at the current selection position, and move the current selection cell to the right after inserting + `luckysheet.insertRange('right')` + +------------ + +### matrixOperation(type [,setting]) + +[todo] + + +- **Parameter**: + + - {String} [type]: the type of matrix operation + + Possible values of `type` are: + + + `"flipUpDown"`: flip up and down + + `"flipLeftRight"`: flip left and right + + `"flipClockwise"`: rotate clockwise + + `"flipCounterClockwise"`: rotate counterclockwise + + `"transpose"`: Transpose + + `"deleteZeroByRow"`: delete 0 values at both ends by row + + `"deleteZeroByColumn"`: delete zero values at both ends by column + + `"removeDuplicateByRow"`: delete duplicate values by row + + `"removeDuplicateByColumn"`: remove duplicate values by column + + `"newMatrix"`: Produce a new matrix + - {PlainObject} [setting]: optional parameters + + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, can only be a single selection; the default is the current selection + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Specify the data in the specified cell area of the worksheet to perform matrix operations, and return the result data after the operation is successful + +- **Usage**: + + - Flip current selection upside down + + `luckysheet.matrixOperation('flipUpDown')` + + Copy the original selection as a two-dimensional array: + + `[["value1","value3"],["value2","value4"]]` + + After flipping up and down, the selection is copied as a two-dimensional array: + + `[["value2","value4"],["value1","value3"]]` + +------------ + +### matrixCalculation(type, number [,setting]) + +[todo] + + +- **Parameter**: + - {String} [type]: calculation method + + Possible values of `type` are: + + + `"plus"`: add + + `"minus"`: subtract + + `"multiply"`: multiply + + `"divided"`: Divide + + `"power"`: power + + `"root"`: power root + + `"log"`: log + - {Number} [number]: Calculate the number, such as: 2 + - {PlainObject} [setting]: optional parameters + + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, can only be a single selection; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Specify the data in the specified cell area of the worksheet for matrix calculation, and return the result data after the calculation is successful + +- **Usage**: + + - Add 2 to the value of all cells in the current selection + + `luckysheet.matrixCalculation('plus', 2)` + + Copy the original selection as a two-dimensional array: + + `[[1,2],[3,4]]` + + After adding 2, the selection is copied as a two-dimensional array: + + `[[3,4],[5,6]]` + +------------ + +## Worksheet operations + +### getAllSheets() + + +- **Explanation**: + + Return all worksheet configurations, the format is the same as the worksheet configuration, and the results obtained can be used as options.data when the form is initialized. + + Therefore, this API is suitable for manually operating and configuring a table, and then taking out all the worksheet information to save it, and then use it for table creation in other places. If you want to get all the workbook data including the workbook configuration, it is recommended to use [toJson](#toJson()), and it can be directly used to initialize Luckysheet. + +- **Usage**: + + - Get all the basic information of the first worksheet + `luckysheet.getAllSheets()[0]` + +------------ + +### getLuckysheetfile() + +- **Explanation**: + + Returns a one-dimensional array `luckysheetfile` of all table data structures. Unlike the `getAllSheets` method, the worksheet parameters obtained by this method will contain many internal variables. The most obvious difference is that the table data operation will maintain `luckysheetfile[i]. data`, and the initialization data uses `options.data[i].celldata`, so `luckysheetfile` can be used for debugging, but the initialization table is not applicable. + + In addition, a `load = 1` will be added to the loaded worksheet parameters, this parameter needs to be set to 0 when initializing the data. Therefore, to initialize the workbook with the data obtained by `getLuckysheetfile()`, two tasks need to be done: + + - Convert celldata to data, refer to: [transToData](/zh/guide/api.html#transtodata-celldata-setting) + - Load reset to 0 or delete this field + + Now there is `getAllSheets` to complete this work, no need to manually convert the data. + +- **Usage**: + + - Get all the debugging information of the first worksheet + `luckysheet.getLuckysheetfile()[0]` + +------------ + +### getSheet([setting]) + +[todo] + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Number} [index]: worksheet index; the default value is the current worksheet index + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Number} [name]: Worksheet name; the default value is the current worksheet name + +- **Explanation**: + + According to index/order/name, quickly return the configuration of the specified worksheet, same as `luckysheetfile[i]`. If multiple parameters are set, the priority is: index> order> name. + +------------ + +### getSheetData([setting]) + +[todo] + + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + +- **Explanation**: + + Quickly return the data of the specified worksheet, same as `luckysheetfile[i].data` + +------------ + +### getConfig([setting]) + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + +- **Explanation**: + + Quickly return to the config configuration of the specified worksheet, same as `luckysheetfile[i].config` + +------------ + +### setConfig([setting]) + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Quickly set the current worksheet config configuration + +------------ +### updataSheet([setting]) + +- **参数**: + + - {PlainObject} [setting]: optional parameters + + {Array} [data]: Worksheet Configuration + + {Function} [success]: callback function for the end of the operation + +- **说明**: + + Update the corresponding sheet according to the set sheet configuration + +------------ + +### setSheetAdd([setting]) + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Object} [sheetObject]: The data of the newly added worksheet; the default value is an empty object.Worksheet data format reference [options.data](/guide/sheet.html#initial) + + {Number} [order]: New worksheet subscript; the default value is the last subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Add a sheet and return the newly added worksheet object. The optional setting data in `setting` is `sheetObject`, and a blank worksheet will be added if `sheetObject` is not passed. + +- **Usage**: + + - Add a blank worksheet at the subscript position of the last worksheet + `luckysheet.setSheetAdd()` + +------------ + +### setSheetDelete([setting]) + +[todo] + + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Delete the worksheet of the specified subscript and return the deleted worksheet object + +- **Usage**: + + - Delete current worksheet + `luckysheet.setSheetDelete()` + +------------ + +### setSheetCopy([setting]) + +[todo] + + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Number} [targetOrder]: The target index position of the newly copied worksheet; the default value is the next index position of the current worksheet index (incremental) + + {Number} [order]: The subscript of the copied worksheet; the default value is the subscript of the current worksheet + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Copy the worksheet with the specified subscript to the specified subscript position, optionally set the specified subscript position `targetOrder` in `setting`, and return the newly copied worksheet object + +- **Usage**: + + - Copy the current worksheet to the next subscript position + `luckysheet.setSheetCopy()` + +------------ + +### setSheetHide([setting]) + +[todo] + + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Number} [order]: The hidden worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Hide the worksheet of the specified subscript and return the hidden worksheet object + +- **Usage**: + + - Hide current worksheet + `luckysheet.setSheetHide(true)` + - Hide the third worksheet + `luckysheet.setSheetHide({order:2})` + +------------ + +### setSheetShow([setting]) + +[todo] + + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Number} [order]: The subscript of the unhidden worksheet; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Unhide the worksheet of the specified subscript, and return the unhidden worksheet object + +- **Usage**: + + - Unhide the third worksheet + `luckysheet.setSheetShow({order:2})` + +------------ + +### setSheetActive(order [,setting]) + +[todo] + +- **Parameter**: + + - {Number} [order]: The subscript of the worksheet to be activated + - {PlainObject} [setting]: optional parameters + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Set the worksheet of the specified subscript as the current worksheet (active state), that is, switch to the specified worksheet and return the activated worksheet object + +- **Usage**: + + - Switch to the second worksheet + `luckysheet.setSheetActive(1)` + +------------ + +### setSheetName(name [,setting]) + +[todo] + + +- **Parameter**: + + - {String} [name]: new worksheet name + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Modify worksheet name + +- **Usage**: + + - Modify the name of the current worksheet to "CellSheet" + `luckysheet.setSheetName("CellSheet")` + +------------ + +### setSheetColor(color [,setting]) + +[todo] + +- **Parameter**: + + - {String} [color]: Worksheet color + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Set the color at the worksheet name + +- **Usage**: + + - Modify the color of the current worksheet name to red + `luckysheet.setSheetColor("#ff0000")` + +------------ + +### setSheetMove(type [,setting]) + +- **Parameter**: + + - {String | Number} [type]: The moving direction of the worksheet or the subscript of the moving target, + + Possible values of `type` are: + + + `"left"`: to the left + + `"right"`: to the right + + `1`/`2`/`3`/...: Specify subscript + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Specify the worksheet to move one position to the left or right, or specify subscript, and return the specified worksheet object + +- **Usage**: + + - Move the current worksheet one position to the left + `luckysheet.setSheetMove("left")` + - Move the second worksheet to the subscript position of the fourth worksheet + `luckysheet.setSheetMove(3,{order:1})` + +------------ + +### setSheetOrder(orderList [,setting]) + +[todo] + + +- **Parameter**: + + - {Array} [orderList]: Worksheet order, set the index and order of the worksheet to specify the position, such as: + + ```json + [ + {index:'sheet_01',order: 2}, + {index:'sheet_02',order: 1}, + {index:'sheet_03',order: 0}, + ] + ``` + The order in the array is not important, the key is to specify the correspondence between sheet index and order. + + - {PlainObject} [setting]: optional parameters + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Reorder the positions of all worksheets and specify an array of worksheet order. + + +- **Usage**: + + - Rearrange the worksheets, this workbook contains 3 worksheets + ```js + luckysheet.setSheetOrder([ + {index:'sheet_01',order: 2}, + {index:'sheet_02',order: 1}, + {index:'sheet_03',order: 0}, + ]) + ``` + +------------ + +### setSheetZoom(zoom [,setting]) + +[todo] + + +- **Parameter**: + + - {Number} [zoom]: Worksheet zoom ratio + + - {PlainObject} [setting]: optional parameters + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Set worksheet zoom ratio + + +- **Usage**: + + - Set the current worksheet zoom ratio to 0.5 + ```js + luckysheet.setSheetZoom(0.5) + ``` + +------------ + +### showGridLines([setting]) + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Number} [order]: The subscript of the worksheet that needs to show the grid lines; the default value is the subscript of the current worksheet + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Show the grid lines of the specified subscript worksheet, and return the worksheet object of the operation + +- **Usage**: + + - Show the grid lines of the current worksheet + `luckysheet.showGridLines()` + - Show the grid lines of the third worksheet + `luckysheet.showGridLines({order:2})` + +------------ + +### hideGridLines([setting]) + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Number} [order]: The subscript of the worksheet that needs to hdie the grid lines; the default value is the subscript of the current worksheet + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Hide the grid lines of the specified subscript worksheet, and return the worksheet object of the operation + +- **Usage**: + + - Hide grid lines of current worksheet + `luckysheet.hideGridLines()` + - Hide the grid lines of the third worksheet + `luckysheet.hideGridLines({order:2})` + +------------ + +## Workbook operations + +### create(options [,setting]) + +- **Parameter**: + + - {Object} [options]: All configuration information of the table + - {PlainObject} [setting]: optional parameters + + {Function} [success]: callback function after the table is created successfully + +- **Explanation**: + + Initialize a Luckysheet, which can contain multiple worksheets, refer to [Configuration List](/zh/guide/config.html) + +------------ + +### refresh([setting]) + +[todo] + + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Function} [success]: The callback function after the table is refreshed successfully + +- **Explanation**: + + Refresh canvas + +------------ + +### scroll([setting]) + +- **参数**: + + - {PlainObject} [setting]: optional parameters + + {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. + + {Number} [targetRow]: Scroll vertically to the specified row number. The default is the current vertical scroll position. + + {Number} [targetColumn]: scroll horizontally to the specified column number. The default is the current horizontal scroll position. + + {Function} [success]: The callback function after the table is refreshed successfully + +- **说明**: + + Scroll current worksheet position + +------------ + +### resize([setting]) + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Automatically resize the canvas according to the window size + +------------ + +### destroy([setting]) + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Function} [success]: callback function after the table is released successfully + +- **Explanation**: + + Delete and release table + +------------ + +### getScreenshot([setting]) + +[todo] + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Array | Object | String} [range]: The range of the selection, the format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1],column: [0,1]}`, can only be a single selection; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + +- **Explanation**: + + Returns the base64 format image generated after the screenshot of the specified selection + +------------ + +### setWorkbookName(name [,setting]) + +- **Parameter**: + + - {Number} [name]: Workbook name + - {PlainObject} [setting]: optional parameters + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Set workbook name + +------------ + +### getWorkbookName(name [,setting]) + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + get workbook name + +------------ + +### undo([setting]) + +[todo] + + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Undo the current operation and return the operation object that was just undone + +------------ + +### redo([setting]) + +[todo] + + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Redo the current operation and return the operation object that was just redone + +------------ + +### refreshFormula([setting]) + +- **Parameter**: + + - {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Force refresh formula. When you directly modify the values of multiple cells without triggering a refresh, and these cells are associated with formulas, you can use this API to force a formula refresh to be triggered at the end. + +------------ + +### refreshMenuButtonFocus([data],[r],[c],[success]) + +- **Parameter**: + + - {Array} [data]: Operational data + - {Number} [r]: Specified row + - {Number} [c]: Specified column + - {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Refreshes the top status bar status of the specified cell. + +------------ + +### checkTheStatusOfTheSelectedCells(type,status) + +- **Parameter**: + + - {String} type: type + - {String} status: Target state value + +- **Explanation**: + + Check whether the status of all specified types of cells in the selection meets the conditions (mainly bold, italics, strikeouts, underscores, etc.). + +------------ + +## Chart + +### insertChart([setting]) + +[todo] + + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Array | Object | String} [range]: The selection range of the chart data. The format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1] ,column:[0,1]}`, can only be a single selection; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Generate a chart in the specified selection area of the specified worksheet, and return the chart parameter object, including the chart id + +------------ + +### setChart(chartId, attr, value [,setting]) + +[todo] + + +- **Parameter**: + + - {String} [chartId]: Specify the id of the chart to be modified + - {String} [attr]: attribute type + + Possible values of `attr` are: + + + `"left"`: the distance from the left to the edge of the worksheet + + `"top"`: the distance from the top edge to the edge of the worksheet + + `"width"`: the width of the chart frame + + `"height"`: the height of the chart outline + + `"chartOptions"`: detailed settings for the chart + + - {Number | Object}} [value]: attribute value, when `attr` is `chartOptions`, directly set the configuration object of the entire chart + + - {PlainObject} [setting]: optional parameters + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Modify the parameters of the specified id chart and return the modified parameters of the entire chart + +------------ + +### getChart(chartId) + +[todo] + + +- **Parameter**: + + - {String} [chartId]: Specify the chart id to be obtained + +- **Explanation**: + + Get the parameters of the specified id chart + +------------ + +### deleteChart(chartId [,setting]) + +[todo] + + +- **Parameter**: + + - {String} [chartId]: the id of the chart to be deleted + To + - {PlainObject} [setting]: optional parameters + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Delete the chart with the specified id and return the parameters of the deleted chart + +------------ + +## Data Verification + +### setDataVerification(option, [setting]) + +[todo] + +- **Parameter**: + + - {Object} [option]: Configuration information for data verification + - {PlainObject} [setting]: optional parameters + + {Array | Object | String} [range]: The selection area for data verification, The format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1] ,column:[0,1]}`, can only be a single selection; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Specify the worksheet range to set the data verification function and set the parameters + +------------ + +### deleteDataVerification([setting]) + +[todo, to be confirmed whether it is reasonable] + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Array | Object | String} [range]: The selection area for data verification, The format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1] ,column:[0,1]}`, can only be a single selection; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Specify the worksheet range to delete the data verification function + +------------ + +## Worksheet Protection + + +### setProtection(option, [setting]) + +[todo] + +- **Parameter**: + + - {Object} [option]: Configuration information for worksheet protection + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Specify the worksheet to set the worksheet protection + +------------ + +## Public method + +### transToCellData(data [,setting])
+ +- **Parameter**: + + - {Array} [data]: data + To + - {PlainObject} [setting]: optional parameters + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + data => celldata, data two-dimensional array data is converted into a one-dimensional array in {r, c, v} format + +------------ + +### transToData(celldata [,setting])
+ +[todo] + +- **Parameter**: + + - {Array} [celldata]: data + To + - {PlainObject} [setting]: optional parameters + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + celldata => data, the celldata one-dimensional array data is converted into the two-dimensional array required by the table + +------------ + +### toJson() + +- **Explanation**: + + The exported json string can be directly used as the parameter `options` when the workbook is initialized by `luckysheet.create(options)`. The usage scenario is to manually save all the parameters after the user manipulates the table, and then initialize the table elsewhere. Use, similar to the import and export of a luckysheet proprietary format. + +------------ + +## Legacy API + +::: warning +To maintain compatibility, the old version of the API is still supported, but its use is deprecated. +::: + +### getcellvalue([r] [,c] [,data] [,type]) + +- **Parameter**: + + - {Number} [r]: The row number of the cell; optional value; an integer starting from 0, 0 means the first row + - {Number} [c]: The number of the column where the cell is located; 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 + +- **Explanation**: + + This method is to get the value of the cell. + + - luckysheet.getcellvalue(): returns all data of the current worksheet; + - luckysheet.getcellvalue(0): returns the data of the first row of the current worksheet; + - luckysheet.getcellvalue(null,0): returns the data in the first column of the current worksheet; + - luckysheet.getcellvalue(0,0): returns the v value of the cell data in the first row and the first column of the current worksheet; + - 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 + + > Recommend to use the new API: getCellValue + +------------ + +### getluckysheetfile() + +- **Explanation**: + + Returns a one-dimensional array `luckysheetfile` of all table data structures + + > Recommend to use new API: [getLuckysheetfile](#getLuckysheetfile()) + +------------ + +### getconfig() + +- **Explanation**: + + Quickly return to the current sheet config configuration, the config information of each worksheet is still contained in the luckysheetfile. + + > Recommend to use new API: [getConfig](#getConfig([setting])) + +------------ + +### getluckysheet_select_save() + +- **Explanation**: + + Returns an array of current selection objects, there may be multiple selections. + + > Recommend to use new API: [getRange](#getRange()) + +------------ + +### getdatabyselection([range] [,sheetOrder]) + +- **Parameter**: + + - {Object} [range]: Selection object, `object: {row: [r1, r2], column: [c1, c2] }`; the default is the current first selection. + - {Number} [sheetOrder]: Table subscript, an integer starting from 0, 0 means the first table; the default is the current table subscript. + +- **Explanation**: + + 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 + + > Recommend to use the new API: [getRangeValue](#getRangeValue([setting])) + +------------ + +### luckysheetrefreshgrid(scrollWidth, scrollHeight) + +- **Parameter**: + + - {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. + +- **Explanation**: + + Refresh the canvas display data according to scrollWidth and scrollHeight. + +------------ + +### setcellvalue(r, c, d, v) + +- **Parameter**: + + - {Number} [r]: The row number of the cell; an integer starting from 0, 0 means the first row. + - {Number} [c]: The number of the column where the cell is located; 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 must conform to the cell object format. + +- **Explanation**: + + Set the value of a cell. Can be used with `luckysheet.jfrefreshgrid()` to refresh and view cell value changes. + + ```js + luckysheet.setcellvalue(0, 0, luckysheet.flowdata(), 'abc'); + luckysheet.jfrefreshgrid(); + ``` + +------------ + +### jfrefreshgrid() + +- **Explanation**: + + Refresh canvas + + > Recommended new API: [refresh](#refresh([setting])) + +------------ + +### setluckysheet_select_save(v) + +- **Parameter**: + + - {Array} [v]:The selection value (array) to be set. Comply with the selection format rules, such as `[{ row: [r1, r2], column: [c1, c2] }]`. + +- **Explanation**: + + 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(); + ``` + + > Recommend to use new API:setRangeShow + +------------ + +### selectHightlightShow() + +- **Explanation**: + + Highlight the current selection + + > Recommend to use new API:setRangeShow + +------------ + +### flowdata() + +- **Explanation**: + + Quickly get the data of the current table + + > Recommend to use new API:[getSheetData](#getSheetData()) + +------------ + +### buildGridData(file) + +- **Parameter**: + + - {Object} [file]:[luckysheetfile](/zh/guide/sheet.html) + +- **Explanation**: + + Generate a two-dimensional array that the table can recognize + + > Recommend to use new API:transToData + +------------ + +### getGridData(data) + +- **Parameter**: + + - {Array} [data]: Two-dimensional array data of the worksheet + +- **Explanation**: + + Convert two-dimensional array data into `{r, c, v}` format one-dimensional array + > Recommend to use new API:transToCellData \ No newline at end of file diff --git a/docs/guide/cell.md b/docs/guide/cell.md index e65daf8e6..eafff7314 100644 --- a/docs/guide/cell.md +++ b/docs/guide/cell.md @@ -1,391 +1,391 @@ -# Format attributes - -## Cell attributes table - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Attribute valueFull name
Explanation
Example valueAspose method or attribute
ctcelltypeCell value format: text, time, etc.Cell format
bgbackgroundbackground color#fff000setBackgroundColor
fffontfamilyFont0 Times New Roman, 1 Arial, 2 Tahoma, 3 Verdana, 4 Microsoft Yahei, 5 Song, 6 ST Heiti, 7 ST Kaiti, 8 ST FangSong, 9 ST Song, 10 Chinese New Wei, 11 Chinese Xingkai, 12 Chinese LishuStyle.Font object's Name property.
fcfontcolorfont color#fff000Style.Font object's Color property
blboldBold0 Regular, 1 BoldStyle.Font object's IsBold property to true.
ititalicItalic0 Regular, 1 Italic
fsfontsizefont size14Style.Font object's Size property.
clcancellineCancelline0 Regular, 1 CancellineStyle.Font object's Underline property
vtverticaltypeVertical alignment0 middle, 1 up, 2 downsetVerticalAlignment
hthorizontaltypeHorizontal alignment0 center, 1 left, 2 rightsetHorizontalAlignment
mcmergecellMerge Cells{rs: 10, cs:5} indicates that the cells from this cell to 10 rows and 5 columns are merged.Merge
trtextrotateText rotation0: 0、1: 45 、2: -45、3 Vertical text、4: 90 、5: -90setRotationAngle
tbtextbeakText wrap0 truncation, 1 overflow, 2 word wrap2: setTextWrapped
0和1: IsTextWrapped = true
vvalueOriginal value
mmonitorDisplay value
ffunctionformulasetFormula
setArrayFormula
workbook.calculateFormula();
- - -The following is the storage of 3 cells: -```json -[ - { - "r": 10, - "c": 11, - "v": { - "f": "=MAX(A7:A9)", - "ct": { - "fa": "General", - "t": "n" - }, - "v": 100, - "m": "100" - } - }, - { - "r": 0, - "c": 1, - "v": { - "v": 12, - "f": "=SUM(A2)", - "bg": "#fff000" - } - }, - { - "r": 10, - "c": 11, - "v": "值2" - } -] -``` - -##
Cell format
- -Reference[Aspose.Cells](https://docs.aspose.com/display/cellsnet/List+of+Supported+Number+Formats#ListofSupportedNumberFormats-Aspose.Cells) - -The format is set to: - -```json -{ - "ct": { - "fa": "General", - "t": "g" - }, - "m": "2424", - "v": 2424 -} -``` - -|Parameter|Explanation|Value| -| ------------ | ------------ | ------------ | -|fa|Format definition string| such as "General"| -|t|Type|Such as "g"| - -The available settings are as follows: -| Format | ct.fa | ct.t | Example of m value | Remarks | -|----------|----------|-------------------------|------------------------- |------------------------- | -| Automatic | General | g | Luckysheet |Automatic format, which is also the default format; When the cell content is a number, the value of `m` is `'n'`| -| 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 || - +# Format attributes + +## Cell attributes table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Attribute valueFull name
Explanation
Example valueAspose method or attribute
ctcelltypeCell value format: text, time, etc.Cell format
bgbackgroundbackground color#fff000setBackgroundColor
fffontfamilyFont0 Times New Roman, 1 Arial, 2 Tahoma, 3 Verdana, 4 Microsoft Yahei, 5 Song, 6 ST Heiti, 7 ST Kaiti, 8 ST FangSong, 9 ST Song, 10 Chinese New Wei, 11 Chinese Xingkai, 12 Chinese LishuStyle.Font object's Name property.
fcfontcolorfont color#fff000Style.Font object's Color property
blboldBold0 Regular, 1 BoldStyle.Font object's IsBold property to true.
ititalicItalic0 Regular, 1 Italic
fsfontsizefont size14Style.Font object's Size property.
clcancellineCancelline0 Regular, 1 CancellineStyle.Font object's Underline property
vtverticaltypeVertical alignment0 middle, 1 up, 2 downsetVerticalAlignment
hthorizontaltypeHorizontal alignment0 center, 1 left, 2 rightsetHorizontalAlignment
mcmergecellMerge Cells{rs: 10, cs:5} indicates that the cells from this cell to 10 rows and 5 columns are merged.Merge
trtextrotateText rotation0: 0、1: 45 、2: -45、3 Vertical text、4: 90 、5: -90setRotationAngle
tbtextbeakText wrap0 truncation, 1 overflow, 2 word wrap2: setTextWrapped
0和1: IsTextWrapped = true
vvalueOriginal value
mmonitorDisplay value
ffunctionformulasetFormula
setArrayFormula
workbook.calculateFormula();
+ + +The following is the storage of 3 cells: +```json +[ + { + "r": 10, + "c": 11, + "v": { + "f": "=MAX(A7:A9)", + "ct": { + "fa": "General", + "t": "n" + }, + "v": 100, + "m": "100" + } + }, + { + "r": 0, + "c": 1, + "v": { + "v": 12, + "f": "=SUM(A2)", + "bg": "#fff000" + } + }, + { + "r": 10, + "c": 11, + "v": "值2" + } +] +``` + +##
Cell format
+ +Reference[Aspose.Cells](https://docs.aspose.com/display/cellsnet/List+of+Supported+Number+Formats#ListofSupportedNumberFormats-Aspose.Cells) + +The format is set to: + +```json +{ + "ct": { + "fa": "General", + "t": "g" + }, + "m": "2424", + "v": 2424 +} +``` + +|Parameter|Explanation|Value| +| ------------ | ------------ | ------------ | +|fa|Format definition string| such as "General"| +|t|Type|Such as "g"| + +The available settings are as follows: +| Format | ct.fa | ct.t | Example of m value | Remarks | +|----------|----------|-------------------------|------------------------- |------------------------- | +| Automatic | General | g | Luckysheet |Automatic format, which is also the default format; When the cell content is a number, the value of `m` is `'n'`| +| 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 || + 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/guide/config.md b/docs/guide/config.md index c03224f70..bc4adaaf6 100644 --- a/docs/guide/config.md +++ b/docs/guide/config.md @@ -1,1360 +1,1360 @@ -# Overall configuration - -## Basic Structure - -When initializing the workbook, you can set an object configuration string ʻoptions` to customize the configuration of Luckysheet. - -The following is a simple configuration example: - -```js -// Configuration item -const options = { - container:'luckysheet', // set the id of the DOM container - title:'Luckysheet Demo', // set the name of the table - lang:'zh' // set language - - // More other settings... -} - -// Initialize the table -luckysheet.create(options) -``` - -The `options` configuration item here will affect the entire workbook. In particular, the configuration of a single worksheet needs to be set in the `options.data` array to set corresponding more detailed parameters. Refer to [Worksheet Configuration](/zh/guide/sheet.html) - -For personalized needs, in addition to allowing configuration information bar ([showinfobar](#showinfobar)), toolbar ([showtoolbar](#showtoolbar)), bottom sheet bar ([showsheetbar](#showsheetbar)), bottom count bar ([ShowstatisticBar](#showstatisticBar)), -Luckysheet has opened more detailed custom configuration options, which are as follows: - -- Customize the toolbar ([showtoolbarConfig](#showtoolbarConfig)) -- Customize the bottom sheet bar ([showsheetbarConfig](#showsheetbarConfig)) -- Customize the counting bar ([showstatisticBarConfig](#showstatisticBarConfig)) -- Custom cell right-click menu ([cellRightClickConfig](#cellRightClickConfig)) -- Customize the right-click menu of the bottom sheet bar ([sheetRightClickConfig](#sheetRightClickConfig)) - -## Configuration item - -The following are all supported setting parameters - -- Container ID [container](#container) -- Workbook name [title](#title) -- Language [lang](#lang) -- Unique key [gridKey](#gridKey) -- Load the entire workbook [loadUrl](#loadUrl) -- Load other worksheet celldata [loadSheetUrl](#loadSheetUrl) -- Allow updates [allowUpdate](#allowUpdate) -- Update address [updateUrl](#updateUrl) -- Thumbnail update address [updateImageUrl](#updateImageUrl) -- Worksheet configuration [data](#data) -- Plugins [plugins](#plugins) -- Number of columns [column](#column) -- Number of rows [row](#row) -- Billion format [autoFormatw](#autoFormatw) -- Accuracy [accuracy](#accuracy) -- Allow copying [allowCopy](#allowCopy) -- Toolbar [showtoolbar](#showtoolbar) -- Customize Toolbar [showtoolbarConfig](#showtoolbarConfig) -- Information bar [showinfobar](#showinfobar) -- Bottom sheet bar [showsheetbar](#showsheetbar) -- Customize the bottom sheet bar [showsheetbarConfig](#showsheetbarConfig) -- The bottom count bar [showstatisticBar](#showstatisticBar) -- Custom Count Bar [showstatisticBarConfig](#showstatisticBarConfig) -- Allow adding rows [enableAddRow](#enableAddRow) -- Allow back to top [enableAddBackTop](#enableAddBackTop) -- User Info [userInfo](#userInfo) -- User Information Menu [userMenuItem](#userMenuItem) -- Back button link [myFolderUrl](#myFolderUrl) -- Ratio [devicePixelRatio](#devicePixelRatio) -- Function Button [functionButton](#functionButton) -- Auto-indent interface [showConfigWindowResize](#showConfigWindowResize) -- Refresh formula [forceCalculation](#forceCalculation) -- Custom cell right-click menu [cellRightClickConfig](#cellRightClickConfig) -- Customize the right-click menu of the bottom sheet bar [sheetRightClickConfig](#sheetRightClickConfig) -- The width of the row header area [rowHeaderWidth](#rowHeaderWidth) -- The height of the column header area [columnHeaderHeight](#columnHeaderHeight) -- Whether to show the formula bar [sheetFormulaBar](#sheetFormulaBar) -- Initialize the default font size [defaultFontSize](#defaultFontSize) -- Pager [pager](#pager) - -### container -- Type: String -- Default: "luckysheet" -- Usage: Container ID - ------------- -### title -- Type: String -- Default: "Luckysheet Demo" -- Usage:Workbook name - ------------- -### lang -- Type: String -- Default: "en" -- Usage: Internationalization settings, allow to set the language of the table, support simplified Chinese ("zh"), English ("en") and traditional Chinese ("zh_tw") and Spanish ("es") - ------------- -### gridKey -- Type: String -- Default: "" -- Usage: Workbook unique identifier - ------------- -### loadUrl -- Type: String -- Default: "" -- Usage: Configure the address of `loadUrl` and use it in conjunction with `loadSheetUrl`, which is generally used when the amount of data is large. You can also not use the interface parameters provided by Luckysheet, and use the [data](#data) parameter to prepare all table data for initialization in advance. - - Luckysheet will request the entire workbook data through ajax, and load all `celldata` in the worksheet data with status 1 by default, and load all the fields except the `celldata` field in the rest of the worksheets. However, considering that some formulas, charts and pivot tables will reference data from other worksheets, the front end will add a judgment. If the current worksheet references data from other worksheets, it will request data through the interface address configured by `loadSheetUrl` , And load the data of the related worksheets. Because `loadUrl` is only responsible for the current worksheet data, it is also necessary to configure `loadSheetUrl` as an interface for asynchronously loading data. - ------------- -### loadSheetUrl -- Type: String -- Default: "" -- Usage: Configure the address of `loadSheetUrl`, the parameters are `gridKey` (workbook primary key) and `index` (worksheet primary key collection, the format is `["sheet_01","sheet_02","sheet_03"]`), the returned data is the `celldata` field data collection of the worksheet. In order to load performance considerations, except for the first load of the celldata data of the current worksheet, the data of the other worksheets will be requested only when the worksheet is switched to that worksheet. - ------------- -### allowUpdate -- Type: Boolean -- Default: false -- Usage: Whether to allow back-end update after operating the table, used in conjunction with `updateUrl` - ------------- -### updateUrl -- Type: String -- Default: "" -- Usage: The back-end update address after operating the workbook will be valid only when `allowUpdate` is `true`. This interface is also the interface address for shared editing. - -Note that you also need to configure `loadUrl` and `loadSheetUrl` to take effect. - ------------- -### updateImageUrl -- Type: String -- Default: "" -- Usage: Update address of thumbnail - ------------- -### data -- Type: Array -- Default: [{ "name": "Sheet1", color: "", "status": "1", "order": "0", "data": [], "config": {}, "index":0 }, { "name": "Sheet2", color: "", "status": "0", "order": "1", "data": [], "config": {}, "index":1 }, { "name": "Sheet3", color: "", "status": "0", "order": "2", "data": [], "config": {}, "index":2 }] -- Usage: When `loadUrl` and `loadSheetUrl` are not configured, you need to manually configure all the sheet data passed to the entire client `[shee1, sheet2, sheet3]`. For detailed parameter settings, please refer to [worksheet configuration](/zh/guide/sheet.html) - ------------- -### plugins -- Type: Array -- Default: [] -- Usage: Configure plug-in, support chart: "chart" - ------------- -### column -- Type: Number -- Default: 60 -- Usage: The default number of columns in an empty workbook - ------------- -### row -- Type: Number -- Default: 84 -- Usage: The default number of rows in an empty workbook - ------------- -### autoFormatw -- Type: Boolean -- Default: false -- Usage: Automatically format numbers with more than 4 digits into "billion format", for example: true or "true" or "TRUE" - ------------- -### accuracy -- Type: Number -- Default: undefined -- Usage: Set the precision, the number of digits after the decimal point. The parameter is a number or a string of numbers, for example: "0" or 0 - ------------- -### allowCopy -- Type: Boolean -- Default: true -- Usage: Whether to allow copy - ------------- -### showtoolbar -- Type: Boolean -- Default: true -- Usage: Whether to show the toolbar - ------------- -### showtoolbarConfig - -- Type: Object -- Default: {} -- Usage: Custom configuration toolbar,can be used in conjunction with `showtoolbar`, `showtoolbarConfig` has a higher priority. -- Format: - ```json - { - undoRedo: false, //Undo redo - paintFormat: false, //Format brush - currencyFormat: false, //currency format - percentageFormat: false, //Percentage format - numberDecrease: false, //'Decrease the number of decimal places' - numberIncrease: false, //'Increase the number of decimal places - moreFormats: false, //'More Formats' - font: false, //'font' - fontSize: false, //'Font size' - bold: false, //'Bold (Ctrl+B)' - italic: false, //'Italic (Ctrl+I)' - strikethrough: false, //'Strikethrough (Alt+Shift+5)' - underline: false, // 'Underline (Alt+Shift+6)' - textColor: false, //'Text color' - fillColor: false, //'Cell color' - border: false, //'border' - mergeCell: false, //'Merge cells' - horizontalAlignMode: false, //'Horizontal alignment' - verticalAlignMode: false, //'Vertical alignment' - textWrapMode: false, //'Wrap mode' - textRotateMode: false, //'Text Rotation Mode' - image:false, // 'Insert picture' - link:false, // 'Insert link' - chart: false, //'chart' (the icon is hidden, but if the chart plugin is configured, you can still create a new chart by right click) - postil: false, //'comment' - pivotTable: false, //'PivotTable' - function: false, //'formula' - frozenMode: false, //'freeze mode' - sortAndFilter: false, //'Sort and filter' - conditionalFormat: false, //'Conditional Format' - dataVerification: false, // 'Data Verification' - splitColumn: false, //'Split column' - screenshot: false, //'screenshot' - findAndReplace: false, //'Find and Replace' - protection:false, // 'Worksheet protection' - print:false, // 'Print' - } - ``` -- Example: - - Show only the `undo/redo` and `font` buttons: - - ```js - //options - { - showtoolbar: false, - showtoolbarConfig:{ - undoRedo: true, - font: true, - } - } - ``` - - Hide only the `image` and `print` buttons: - - ```js - //options - { - showtoolbar: true, // The default is true, you can leave it unset - showtoolbarConfig:{ - image: false, - print: false, - } - } - ``` - ------------- -### showinfobar -- Type: Boolean -- Default: true -- Usage: Whether to show the top information bar - ------------- -### showsheetbar -- Type: Boolean -- Default: true -- Usage: Whether to show the bottom sheet button - ------------- -### showsheetbarConfig - -- Type: Object -- Default: {} -- Usage: Custom configuration bottom sheet button, can be used in conjunction with `showsheetbar`, `showsheetbarConfig` has a higher priority. -- Format: - ```json - { - add: false, //Add worksheet - menu: false, //Worksheet management menu - sheet: false //Worksheet display - } - ``` -- Example: - - Only display the `Add worksheet` button: - - ```js - //options - { - showsheetbar: false, - showsheetbarConfig:{ - add: true, - } - } - ``` - - Only hide the `Add worksheet` and `Worksheet management menu` buttons: - - ```js - //options - { - showsheetbar: true, // The default is true, you can leave it unset - showsheetbarConfig:{ - add: false, - menu: false, - } - } - ``` - ------------- -### showstatisticBar -- Type: Boolean -- Default: true -- Usage: Whether to show the bottom count bar - ------------- -### showstatisticBarConfig - -- Type: Object -- Default: {} -- Usage: Customize the bottom count bar, can be used in conjunction with `showstatisticBar`, `showstatisticBarConfig` has a higher priority. -- Format: - ```json - { - count: false, // Count bar - view: false, // Print view - zoom: false // Zoom - } - ``` -- Example: - - Only display the `Zoom` button: - - ```js - //options - { - showstatisticBar: false, - showstatisticBarConfig:{ - zoom: true, - } - } - ``` - - Only hide the `print view` button: - - ```js - //options - { - showstatisticBar: true, // The default is true, you can leave it unset - showstatisticBarConfig:{ - view: false, - } - } - ``` ------------- -### enableAddRow -- Type: Boolean -- Default: true -- Usage: Allow additional rows - ------------- -### enableAddBackTop -- Type: Boolean -- Default: true -- Usage: Allow back to top - ------------- -### userInfo -- Type: String | Boolean | Object -- Default: false -- Usage: User information display style in the upper right corner,Support the following three formats - 1. HTML template string, such as: - - ```js - options:{ - // Other configuration - userInfo:' Lucky', - } - ``` - - Or an ordinary string, such as: - - ```js - options:{ - // Other configuration - userInfo:'Lucky', - } - ``` - - 2. Boolean type, such as: - - `false`: Do not show - ```js - options:{ - // Other configuration - userInfo:false, // Do not display user information - } - - ``` - `ture`: Show the default string - ```js - options:{ - // Other configuration - userInfo:true, // Show HTML:' Lucky' - } - - ``` - 3. Object format, set `userImage`: user avatar address and `userName`: user name, such as: - ```js - options:{ - // Other configuration - userImage:'https://cdn.jsdelivr.net/npm/luckyresources@1.0.3/assets/img/logo/logo.png', // Avatar url - userName:'Lucky', // username - } - ``` - 4. Note that if set to `undefined` or not set, the same as setting `false` - ------------- -### userMenuItem -- Type: Array -- Default: `[{url:"www.baidu.com", "icon":'', "name":"我的表格"}, {url:"www.baidu.com", "icon":'', "name":"退出登陆"}]` -- Usage: Click the pop-up menu of user information in the upper right corner - ------------- -### myFolderUrl -- Type: String -- Default: "www.baidu.com" -- Usage: The link of the `<` back button in the upper left corner - ------------- -### devicePixelRatio -- Type: Number -- Default: window.devicePixelRatio -- Usage: Device ratio, the larger the ratio, the higher the resolution of the workbook - ------------- -### functionButton -- Type: String -- Default: "" -- Usage: Function buttons in the upper right corner, for example:`' '` - ------------- -### showConfigWindowResize -- Type: Boolean -- Default: true -- Usage: The configuration of the chart or pivot table will pop up on the right, set whether the workbook will be automatically indented after popping up - ------------- -### forceCalculation -- Type: Boolean -- Default: false -- Usage: Force refresh formula. - - By default, in order to improve loading performance, when the table is initialized, cells containing formulas will directly obtain `v` and `m` as data results by default without real-time calculation. - - If the data of the cell associated with the formula has changed, or the result of the cell data where the formula is located has changed, it will cause the calculated result of the associated cell to be inconsistent with the actual displayed result. This requires the formula refresh to be turned on to ensure the data The accuracy of real-time calculations. - - ⚠️Reminder, there will be performance problems when there are more formulas, use it with caution! - ------------- -### cellRightClickConfig - -- Type: Object -- Default: {} -- Usage: Custom configuration cell right-click menu -- Format: - ```json - { - copy: false, // copy - copyAs: false, // copy as - paste: false, // paste - insertRow: false, // insert row - insertColumn: false, // insert column - deleteRow: false, // delete the selected row - deleteColumn: false, // delete the selected column - deleteCell: false, // delete cell - hideRow: false, // hide the selected row and display the selected row - hideColumn: false, // hide the selected column and display the selected column - rowHeight: false, // row height - columnWidth: false, // column width - clear: false, // clear content - matrix: false, // matrix operation selection - sort: false, // sort selection - filter: false, // filter selection - chart: false, // chart generation - image: false, // insert picture - link: false, // insert link - data: false, // data verification - cellFormat: false // Set cell format - } - ``` - - In addition to the cells, the configuration here also includes the row header right-click menu, the column header right-click menu, and the column header drop-down arrow menu. The specific configuration relationships are as follows: - - |Right-click menu configuration|Cell|Row header|Column header|Column arrow| - | ------------ | ------------ | ------------ | ----------- | ------------ | - |copy|copy|copy|copy|copy| - |copyAs|copy as|copy as|copy as|copy as| - |paste|paste|paste|paste|paste| - |insertRow|Insert a row|Increase N rows upwards and N rows downwards|-|-| - |insertColumn|Insert Column|-|Add N columns to the left and N columns to the right|Add N columns to the left and N columns to the right| - |deleteRow|Delete selected row|Delete selected row|-|-| - |deleteColumn|Delete selected column|-|Delete selected column|Delete selected column| - |deleteCell|Delete cell|-|-|-| - |hideRow|-|Hide the selected row and show the selected row|-|-| - |hideColumn|-|-|Hide the selected column and show the selected column|Hide the selected column and show the selected column| - |rowHeight|-|row height|-|-| - |columnWidth|-|-|Column Width|Column Width| - |clear|clear content|clear content|clear content|-| - |matrix|Matrix Operation Selection|Matrix Operation Selection|Matrix Operation Selection|-| - |sort|Sort selection|Sort selection|Sort selection|A-Z sort and Z-A sort| - |filter|Filter selection|Filter selection|Filter selection|-| - |chart|chart generation|chart generation|chart generation|-| - |image|Insert Picture|Insert Picture|Insert Picture|-| - |link|Insert link|Insert link|Insert link|-| - |data|Data Verification|Data Verification|Data Verification|-| - |cellFormat|Set cell format|Set cell format|Set cell format|-| - ------------- -### sheetRightClickConfig - -- Type: Object -- Default: {} -- Usage: Customize the right-click menu of the bottom sheet bar -- Format: - ```json - { - delete: false, //Delete - copy: false, //Copy - rename: false, //Rename - color: false, //Change color - hide: false, //Hide, unhide - move: false, //Move to the left, move to the right - } - ------------- -### rowHeaderWidth -- Type: Number -- Default: 46 -- Usage: The width of the row header area, if set to 0, it means to hide the row header - ------------- -### columnHeaderHeight -- Type: Number -- Default: 20 -- Usage: The height of the column header area, if set to 0, it means hide the column header - ------------- -### sheetFormulaBar -- Type: Boolean -- Default: true -- Usage: Whether to show the formula bar - ------------- -### defaultFontSize -- Type:Number -- Default:11 -- Usage:Initialize the default font size - ------------- - -### limitSheetNameLength -- Type: Boolean -- Default: true -- Usage:Is the length of the sheet name limited in scenarios such as sheet renaming - ------------- - -### defaultSheetNameMaxLength -- Type:Number -- Default:31 -- Usage:Default maximum allowed sheet name length - ------------- - -### pager -- Type:Object -- Default:null -- Usage:Pager button settings, the first version of the solution is directly used jquery plug-in [sPage](https://github.com/jvbei/sPage) - Clicking the paging button will trigger the hook function `onTogglePager`, which returns the current page number, which is the same as the `backFun` method of `sPage`. This pager setting is only responsible for the UI part. For the specific data request and data rendering after switching paging, please enter the `onTogglePager` custom processing in the number of hook lines. - ```js - pager: { - pageIndex: 1, //Current page number - pageSize: 10, //How many rows of data are displayed on each page - total: 50, //Total number of rows of data - selectOption: [10, 20] //Options that allow setting the number of rows per page - } - ``` - ------------- - -## Hook Function (TODO) - -When the hook function is used in secondary development, hooks will be implanted in each common mouse or keyboard operation, and the function passed in by the developer will be called to expand the function of Luckysheet. - -The hook functions are uniformly configured under ʻoptions.hook`, and configuration hooks can be created separately for cells, sheet pages, and tables. - -## Cell - -### cellEditBefore - -- Type: Function -- Default: null -- Usage: Triggered before entering the cell editing mode. When a cell is selected and in the non-editing state, there are usually the following three conventional methods to trigger the edit mode - - Double click the cell - - Hit Enter - - Use API: enterEditMode -- Parameter: - - {Array} [range]: Current selection range - ------------- -### cellUpdateBefore - -- Type: Function -- Default: null -- Usage: Triggered before updating this cell value, `return false` will not perform subsequent updates. After modifying the cell in the editing state, this hook is triggered before exiting the editing mode and updating the data. -- Parameter: - - {Number} [r]: The row number of the cell - - {Number} [c]: The column number of the cell - - {Object | String | Number} [value]: The content of the cell to be modified - - {Boolean} [isRefresh]: Whether to refresh the entire table - ------------- -### cellUpdated - -- Type: Function -- Default: null -- Usage: Triggered after updating this cell -- Parameter: - - {Number} [r]: The row number of the cell - - {Number} [c]: The column number of the cell - - {Object} [oldValue]: Cell object before modification - - {Object} [newValue]: Modified cell object - - {Boolean} [isRefresh]: Whether to refresh the entire table - ------------- -### cellRenderBefore - -- Type: Function -- Default: null -- Usage: Triggered before the cell is rendered, `return false` will not render the cell -- Parameter: - - {Object} [cell]:Cell object - - {Object} [position]: - + {Number} [r]: The row number of the cell - + {Number} [c]: The column number of the cell - + {Number} [start_r]: The horizontal coordinate of the upper left corner of the cell - + {Number} [start_c]: The vertical coordinate of the upper left corner of the cell - + {Number} [end_r]: The horizontal coordinate of the lower right corner of the cell - + {Number} [end_c]: The vertical coordinate of the lower right corner of the cell - - {Object} [sheet]: Current sheet object - - {Object} [ctx]: The context of the current canvas - ------------- -### cellRenderAfter - -- Type: Function -- Default: null -- Usage: Triggered after the cell rendering ends, `return false` will not render the cell -- Parameter: - - {Object} [cell]: Cell object - - {Object} [position]: - + {Number} [r]: The row number of the cell - + {Number} [c]: The column number of the cell - + {Number} [start_r]: The horizontal coordinate of the upper left corner of the cell - + {Number} [start_c]: The vertical coordinate of the upper left corner of the cell - + {Number} [end_r]: The horizontal coordinate of the lower right corner of the cell - + {Number} [end_c]: The vertical coordinate of the lower right corner of the cell - - {Object} [sheet]: Current worksheet object - - {Object} [ctx]: The context of the current canvas - -- Example: - - A case of drawing two pictures in the upper left corner and lower right corner of cell D1 - :::::: details - ```js - luckysheet.create({ - hook: { - cellRenderAfter: function (cell, position, sheetFile, ctx) { - var r = position.r; - var c = position.c; - if (r === 0 && c === 3) { // Specify to process cell D1 - if (!window.storeUserImage) { - window.storeUserImage = {} - } - - if (!window.storeUserImage[r + '_' + c]) { - window.storeUserImage[r + '_' + c] = {} - } - - var img = null; - var imgRight = null; - - if (window.storeUserImage[r + '_' + c].image && window.storeUserImage[r + '_' + c].imgRight) { - - // Fetch directly after loading - img = window.storeUserImage[r + '_' + c].image; - imgRight = window.storeUserImage[r + '_' + c].imgRight; - - } else { - - img = new Image(); - imgRight = new Image(); - - img.src = 'https://www.dogedoge.com/favicon/developer.mozilla.org.ico'; - imgRight.src = 'https://www.dogedoge.com/static/icons/twemoji/svg/1f637.svg'; - - // The picture is cached in the memory, fetched directly next time, no need to reload - window.storeUserImage[r + '_' + c].image = img; - window.storeUserImage[r + '_' + c].imgRight = imgRight; - - } - - - if (img.complete) { //Direct rendering that has been loaded - ctx.drawImage(img, position.start_c, position.start_r, 10, 10); - } else { - img.onload = function () { - ctx.drawImage(img, position.start_c, position.start_r, 10, 10); - } - - } - - if (imgRight.complete) { - ctx.drawImage(imgRight, position.end_c - 10, position.end_r - 10, 10, 10); - } else { - - imgRight.onload = function () { - ctx.drawImage(imgRight, position.end_c - 10, position.end_r - 10, 10, 10); - } - } - - } - } - } - }) - ``` - ::: - ------------- -### cellAllRenderBefore - -- Type: Function -- Default: null -- Usage:The method executed before all cells are rendered. Internally, this method is added before `luckysheetDrawMain` renders the table. -- Parameter: - - {Object} [data]: Two-dimensional array data of the current worksheet - - {Object} [sheet]: Current worksheet object - - {Object} [ctx]: The context of the current canvas - ------------- -### rowTitleCellRenderBefore - -- Type: Function -- Default: null -- Usage: Triggered before the row header cell is rendered, `return false` will not render the row header -- Parameter: - - {String} [rowNum]: Row number - - {Object} [position]: - + {Number} [r]: The row number of the cell - + {Number} [top]: The vertical coordinate of the upper left corner of the cell - + {Number} [width]: Cell width - + {Number} [height]: Cell height - - {Object} [ctx]: The context of the current canvas - ------------- -### rowTitleCellRenderAfter - -- Type: Function -- Default: null -- Usage: Triggered after the row header cell is rendered, `return false` will not render the row header -- Parameter: - - {String} [rowNum]: Row number - - {Object} [position]: - + {Number} [r]: The row number of the cell - + {Number} [top]: The vertical coordinate of the upper left corner of the cell - + {Number} [width]: Cell width - + {Number} [height]: Cell height - - {Object} [ctx]: The context of the current canvas - ------------- -### columnTitleCellRenderBefore - -- Type: Function -- Default: null -- Usage: Triggered before the column header cell is rendered, `return false` will not render the column header -- Parameter: - - {Object} [columnAbc]: Column header characters - - {Object} [position]: - - {Number} [c]: The column number of the cell - - {Number} [left]: The horizontal coordinate of the upper left corner of the cell - - {Number} [width]: Cell width - - {Number} [height]: Cell height - - {Object} [ctx]: The context of the current canvas - ------------- -### columnTitleCellRenderAfter - -- Type: Function -- Default: null -- Usage: Triggered after the column header cell is rendered, `return false` will not render the column header -- Parameter: - - {Object} [columnAbc]: Column header characters - - {Object} [position]: - - {Number} [c]: The column number of the cell - - {Number} [left]: The horizontal coordinate of the upper left corner of the cell - - {Number} [width]: Cell width - - {Number} [height]: Cell height - - {Object} [ctx]: The context of the current canvas - ------------- - -## Selected area - -### rangeSelect -- Type: Function -- Default: null -- Usage: Frame selection or trigger after setting selection -- Parameter: - - {Object} [sheet]: Current worksheet object - - {Object | Array} [range]: Selection area, may be multiple selection areas - ------------- - -### rangeMoveBefore -- Type: Function -- Default: null -- Usage: Before moving the selection, include a single cell -- Parameter: - - {Array} [range]: The current selection area, can only be a single selection area - ------------- -### rangeMoveAfter -- Type: Function -- Default: null -- Usage: After moving the selection, include a single cell -- Parameter: - - {Array} [oldRange]: The current selection range before moving, can only be a single selection - - {Array} [newRange]: The current selection range after moving, can only be a single selection - ------------- -### rangeEditBefore -- Type: Function -- Default: null -- Usage: Before the selection -- Parameter: - - {Object | Array} [range]: Selection area, may be multiple selection areas - - {Object} [data]: Data corresponding to the selection area - ------------- -### rangeEditAfter -- Type: Function -- Default: null -- Usage: After the selection is modified -- Parameter: - - {Object | Array} [range]: Selection area, may be multiple selection areas - - {Object} [oldData]: Before modification, the data corresponding to the selection area - - {Object} [newData]: After modification, the data corresponding to the selection area - ------------- -### rangeCopyBefore -- Type: Function -- Default: null -- Usage: Before copying selection -- Parameter: - - {Object | Array} [range]: Selection area, may be multiple selection areas - - {Object} [data]: Data corresponding to the selection area - ------------- -### rangeCopyAfter -- Type: Function -- Default: null -- Usage: After copying selection -- Parameter: - - {Object | Array} [range]: Selection area, may be multiple selection areas - - {Object} [data]: Data corresponding to the selection area - ------------- -### rangePasteBefore -- Type: Function -- Default: null -- Usage: Before pasting the selection -- Parameter: - - {Object | Array} [range]: Selection area, may be multiple selection areas - - {Object} [data]: The data corresponding to the selection area to be pasted - ------------- -### rangePasteAfter -- Type: Function -- Default: null -- Usage: After pasting the selection -- Parameter: - - {Object | Array} [range]: Selection area, may be multiple selection areas - - {Object} [originData]: The data corresponding to the selection area to be pasted - - {Object} [pasteData]: Data to paste - ------------- -### rangeCutBefore -- Type: Function -- Default: null -- Usage: Before selection cut -- Parameter: - - {Array} [range]: Selection range, can only be a single range - - {Object} [data]: The data corresponding to the selection area to be cut - ------------- -### rangeCutAfter -- Type: Function -- Default: null -- Usage: After selection cut -- Parameter: - - {Array} [range]: Selection range, can only be a single range - - {Object} [data]: The data corresponding to the selection area to be cut - ------------- -### rangeDeleteBefore -- Type: Function -- Default: null -- Usage: Before the selection is deleted -- Parameter: - - {Array} [range]: Selection range, can only be a single range - - {Object} [data]: The data corresponding to the selection area to be deleted - ------------- -### rangeDeleteAfter -- Type: Function -- Default: null -- Usage: After the selection is deleted -- Parameter: - - {Array} [range]: Selection range, can only be a single range - - {Object} [data]: The data corresponding to the selection area to be deleted - ------------- -### rangeClearBefore -- Type: Function -- Default: null -- Usage: Before the selection is cleared -- Parameter: - - {Object | Array} [range]: Selection area, may be multiple selection areas - - {Object} [data]: The data corresponding to the selection area to be cleared - ------------- -### rangeClearAfter -- Type: Function -- Default: null -- Usage: After the selection is cleared -- Parameter: - - {Object | Array} [range]: Selection area, may be multiple selection areas - - {Object} [data]: The data corresponding to the selection area to be cleared - ------------- -### rangePullBefore -- Type: Function -- Default: null -- Usage: Before selection drop down -- Parameter: - - {Array} [range]: The current selection range, can only be a single range - ------------- -### rangePullAfter -- Type: Function -- Default: null -- Usage: After selection drop down -- Parameter: - - {Array} [range]: The selection range after the drop-down can only be a single range - ------------- - -## Worksheet - -### sheetCreatekBefore -(TODO) -- Type: Function -- Default: null -- Usage: Triggered before the worksheet is created, the new worksheet also includes the new pivot table - ------------- -### sheetCreateAfter -(TODO) -- Type: Function -- Default: null -- Usage: Triggered after the worksheet is created, the new worksheet also includes the new pivot table -- Parameter: - - {Object} [sheet]: The configuration of the newly created worksheet - ------------- -### sheetMoveBefore -(TODO) -- Type: Function -- Default: null -- Usage: Before the worksheet is moved -- Parameter: - - {Number} [i]: `index` of current worksheet - - {Number} [order]: `Order` of current worksheet - ------------- -### sheetMoveAfter -(TODO) -- Type: Function -- Default: null -- Usage: After the worksheet is moved -- Parameter: - - {Number} [i]: `index` of current worksheet - - {Number} [oldOrder]: Before modification, the `order` of the current worksheet - - {Number} [newOrder]: After modification, the `order` of the current worksheet - ------------- -### sheetDeleteBefore -(TODO) -- Type: Function -- Default: null -- Usage: Before the worksheet is deleted -- Parameter: - - {Object} [sheet]: Configuration of the worksheet to be deleted - ------------- -### sheetDeleteAfter -(TODO) -- Type: Function -- Default: null -- Usage: After the worksheet is deleted -- Parameter: - - {Object} [sheet]: Configuration of deleted worksheet - ------------- -### sheetEditNameBefore -(TODO) -- Type: Function -- Default: null -- Usage: Before changing the name of the worksheet -- Parameter: - - {Number} [i]: `index` of current worksheet - - {String} [name]: Current worksheet name - ------------- -### sheetEditNameAfter -(TODO) -- Type: Function -- Default: null -- Usage: After changing the name of the worksheet -- Parameter: - - {Number} [i]: `index` of current worksheet - - {String} [oldName]: Before modification, the current worksheet name - - {String} [newName]: After modification, the current worksheet name - ------------- -### sheetEditColorBefore -(TODO) -- Type: Function -- Default: null -- Usage: Before changing the color of the worksheet -- Parameter: - - {Number} [i]: `index` of current worksheet - - {String} [color]: Current worksheet color - ------------- -### sheetEditColorAfter -(TODO) -- Type: Function -- Default: null -- Usage: After changing the color of the worksheet -- Parameter: - - {Number} [i]: `index` of current worksheet - - {String} [oldColor]: Before modification, the current worksheet color - - {String} [newColor]: After modification, the current worksheet color - ------------- -### sheetZoomBefore -(TODO) -- Type: Function -- Default: null -- Usage: Before worksheet zoom -- Parameter: - - {Number} [i]: `index` of current worksheet - - {String} [zoom]: Current worksheet zoom ratio - ------------- -### sheetZoomAfter -(TODO) -- Type: Function -- Default: null -- Usage: After worksheet zoom -- Parameter: - - {Number} [i]: `index` of current worksheet - - {String} [oldZoom]: Before modification, the current worksheet zoom ratio - - {String} [newZoom]: After modification, the current worksheet zoom ratio - ------------- -### sheetActivateBefore -(TODO) -- Type: Function -- Default: null -- Usage:Before worksheet activate -- Parameter: - - {Number} [i]: `index` of current worksheet - ------------- -### sheetActivateAfter -(TODO) -- Type: Function -- Default: null -- Usage:After worksheet activate -- Parameter: - - {Number} [i]: `index` of current worksheet - ------------- -### sheetDeactivateBefore -(TODO) -- Type: Function -- Default: null -- Usage:Before the worksheet changes from active to inactive -- Parameter: - - {Number} [i]: `index` of current worksheet - ------------- -### sheetDeactivateAfter -(TODO) -- Type: Function -- Default: null -- Usage:After the worksheet is changed from active to inactive -- Parameter: - - {Number} [i]: `index` of current worksheet - ------------- - -## Workbook - -### workbookCreateBefore -- Type: Function -- Default: null -- Usage: Triggered before the worksheet is created. The old hook function is called `beforeCreateDom` -- Parameter: - - {Object} [book]:Configuration of the entire workbook (options) - ------------- -### workbookCreateAfter -- Type: Function -- Default: null -- Usage: Triggered after the workbook is created -- Parameter: - - {Object} [book]:Configuration of the entire workbook (options) - ------------- -### workbookDestroyBefore -- Type: Function -- Default: null -- Usage: Triggered before the workbook is destroyed -- Parameter: - - {Object} [book]:Configuration of the entire workbook (options) - ------------- -### workbookDestroyAfter -- Type: Function -- Default: null -- Usage: Triggered after the workbook is destroyed -- Parameter: - - {Object} [book]:Configuration of the entire workbook (options) - ------------- -### updated -- Type: Function -- Default: null -- Usage: The method executed after each operation is updated is executed after the canvas rendering, monitor changes in worksheet content, that is, every time the client performs a workbook operation, Luckysheet saves the operation in the history and triggers it. When undoing and redoing, it is also an operation, of course, the hook function will be triggered. -- Parameter: - - {Object} [operate]: The history information of this operation will have different history records according to different operations. Refer to the source code [History](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/controlHistory.js ) - ------------- -### resized -- Type: Function -- Default: null -- Usage: After resize is executed -- Parameter: - - {Object} [size]: The width and height of the entire workbook area - ------------- - -## Cooperative - -### cooperativeMessage - -- Type:Function -- Default:null -- Usage:Receive the cooperation message, secondary development. Expanding cooperative message instruction set -- Params: - - {Object} : Receives the entire collaboration message body object sent by the server - -## Image - -### imageInsertBefore -- Type: Function -- Default: null -- Usage: Before the picture is inserted -- Parameter: - - {Object} [url]: Picture address - ------------- -### imageInsertAfter -- Type: Function -- Default: null -- Usage: After the picture is inserted -- Parameter: - - {Object} [item]]: Picture address, width and height, location and other information - ------------- -### imageUpdateBefore -- Type: Function -- Default: null -- Usage: Before the picture is modified, the modified content includes operations such as width and height, position, and cropping -- Parameter: - - {Object} [item]]: Picture address, width and height, location and other information - ------------- -### imageUpdateAfter -- Type: Function -- Default: null -- Usage: After the picture is modified, the modified content includes operations such as width and height, position, and cropping -- Parameter: - - {Object} [oldItem]]: Before modification, the picture address, width and height, location and other information - - {Object} [newItem]]: After modification, the picture address, width and height, location and other information - ------------- -### imageDeleteBefore -- Type: Function -- Default: null -- Usage: Before the picture is deleted -- Parameter: - - {Object} [item]]: Picture address, width and height, location and other information - ------------- -### imageDeleteAfter -- Type: Function -- Default: null -- Usage: After the picture is deleted -- Parameter: - - {Object} [item]]: Picture address, width and height, location and other information - ------------- - -## Comment - -### commentInsertBefore -- Type: Function -- Default: null -- Usage: Before inserting comments -- Parameter: - - {Object} [cell]: The cell information of the comment to be inserted, such as:`{ r:0,c:2,v:{m:'233',v:'233'}}` - ------------- -### commentInsertAfter -- Type: Function -- Default: null -- Usage: After inserting comments -- Parameter: - - {Object} [cell]: The cell information where the comment is inserted, such as:`{ r:0,c:2,v:{m:'233',v:'233'}}`, contains comment information - ------------- -### commentDeleteBefore -- Type: Function -- Default: null -- Usage: Before deleting comments -- Parameter: - - {Object} [cell]: The cell information of the comment to be deleted, such as:`{ r:0,c:2,v:{m:'233',v:'233'}}` - ------------- -### commentDeleteAfter -- Type: Function -- Default: null -- Usage: After deleting the comment -- Parameter: - - {Object} [cell]: The cell information of the deleted comment, such as:`{ r:0,c:2,v:{m:'233',v:'233'}}` - ------------- -### commentUpdateBefore -- Type: Function -- Default: null -- Usage: Before modifying comments -- Parameter: - - {Object} [cell]: The cell information of the comment, such as:`{ r:0,c:2,v:{m:'233',v:'233'}}` - ------------- -### commentUpdateAfter -- Type: Function -- Default: null -- Usage: After modifying the comment -- Parameter: - - {Object} [oldCell]: Before modification, the cell information where the comment is located, such as:`{ r:0,c:2,v:{m:'233',v:'233'}}` - - {Object} [newCell]: After modification, the cell information where the comment is located, such as:`{ r:0,c:2,v:{m:'233',v:'233'}}` - ------------- - -## Pivot table - -### pivotTableEditBefore -- Type: Function -- Default: null -- Usage: Before modifying the PivotTable, operations such as dragging fields, etc. -- Parameter: - - {Object} [sheet]: Worksheet configuration where the pivot table is located - ------------- -### pivotTableEditAfter -- Type: Function -- Default: null -- Usage: After modifying the PivotTable, operations such as dragging fields, etc. -- Parameter: - - {Object} [oldSheet]: Before modification, the worksheet configuration where the pivot table is located - - {Object} [newSheet]: After modification, the worksheet configuration where the pivot table is located - ------------- - -## Freeze - -### frozenCreateBefore -- Type: Function -- Default: null -- Usage: Before setting freeze -- Parameter: - - {Object} [frozen]: Freeze type information - ------------- -### frozenCreateAfter -- Type: Function -- Default: null -- Usage: After setting freeze -- Parameter: - - {Object} [frozen]: Freeze type information - ------------- -### frozenCancelBefore -- Type: Function -- Default: null -- Usage: Before unfreezing -- Parameter: - - {Object} [frozen]: Freeze type information - ------------- -### frozenCancelAfter -- Type: Function -- Default: null -- Usage: After unfreezing -- Parameter: - - {Object} [frozen]: Freeze type information - ------------- - -#### Legacy Hook Function - -### fireMousedown -- Type: Function -- Default: null -- Usage: Customized method of drilling down cell data, note that this hook function is mounted under options: `options.fireMousedown` - ------------- - -## Pager - -### onTogglePager - -- Type: Function -- Default: null -- Usage: Click the page button to call back the function, return the current page number, refer to [sPage backFun](https://github.com/jvbei/sPage) -- Parameter: - - {Object} [page]: Return the current page object - ------------- \ No newline at end of file +# Overall configuration + +## Basic Structure + +When initializing the workbook, you can set an object configuration string ʻoptions` to customize the configuration of Luckysheet. + +The following is a simple configuration example: + +```js +// Configuration item +const options = { + container:'luckysheet', // set the id of the DOM container + title:'Luckysheet Demo', // set the name of the table + lang:'zh' // set language + + // More other settings... +} + +// Initialize the table +luckysheet.create(options) +``` + +The `options` configuration item here will affect the entire workbook. In particular, the configuration of a single worksheet needs to be set in the `options.data` array to set corresponding more detailed parameters. Refer to [Worksheet Configuration](/zh/guide/sheet.html) + +For personalized needs, in addition to allowing configuration information bar ([showinfobar](#showinfobar)), toolbar ([showtoolbar](#showtoolbar)), bottom sheet bar ([showsheetbar](#showsheetbar)), bottom count bar ([ShowstatisticBar](#showstatisticBar)), +Luckysheet has opened more detailed custom configuration options, which are as follows: + +- Customize the toolbar ([showtoolbarConfig](#showtoolbarConfig)) +- Customize the bottom sheet bar ([showsheetbarConfig](#showsheetbarConfig)) +- Customize the counting bar ([showstatisticBarConfig](#showstatisticBarConfig)) +- Custom cell right-click menu ([cellRightClickConfig](#cellRightClickConfig)) +- Customize the right-click menu of the bottom sheet bar ([sheetRightClickConfig](#sheetRightClickConfig)) + +## Configuration item + +The following are all supported setting parameters + +- Container ID [container](#container) +- Workbook name [title](#title) +- Language [lang](#lang) +- Unique key [gridKey](#gridKey) +- Load the entire workbook [loadUrl](#loadUrl) +- Load other worksheet celldata [loadSheetUrl](#loadSheetUrl) +- Allow updates [allowUpdate](#allowUpdate) +- Update address [updateUrl](#updateUrl) +- Thumbnail update address [updateImageUrl](#updateImageUrl) +- Worksheet configuration [data](#data) +- Plugins [plugins](#plugins) +- Number of columns [column](#column) +- Number of rows [row](#row) +- Billion format [autoFormatw](#autoFormatw) +- Accuracy [accuracy](#accuracy) +- Allow copying [allowCopy](#allowCopy) +- Toolbar [showtoolbar](#showtoolbar) +- Customize Toolbar [showtoolbarConfig](#showtoolbarConfig) +- Information bar [showinfobar](#showinfobar) +- Bottom sheet bar [showsheetbar](#showsheetbar) +- Customize the bottom sheet bar [showsheetbarConfig](#showsheetbarConfig) +- The bottom count bar [showstatisticBar](#showstatisticBar) +- Custom Count Bar [showstatisticBarConfig](#showstatisticBarConfig) +- Allow adding rows [enableAddRow](#enableAddRow) +- Allow back to top [enableAddBackTop](#enableAddBackTop) +- User Info [userInfo](#userInfo) +- User Information Menu [userMenuItem](#userMenuItem) +- Back button link [myFolderUrl](#myFolderUrl) +- Ratio [devicePixelRatio](#devicePixelRatio) +- Function Button [functionButton](#functionButton) +- Auto-indent interface [showConfigWindowResize](#showConfigWindowResize) +- Refresh formula [forceCalculation](#forceCalculation) +- Custom cell right-click menu [cellRightClickConfig](#cellRightClickConfig) +- Customize the right-click menu of the bottom sheet bar [sheetRightClickConfig](#sheetRightClickConfig) +- The width of the row header area [rowHeaderWidth](#rowHeaderWidth) +- The height of the column header area [columnHeaderHeight](#columnHeaderHeight) +- Whether to show the formula bar [sheetFormulaBar](#sheetFormulaBar) +- Initialize the default font size [defaultFontSize](#defaultFontSize) +- Pager [pager](#pager) + +### container +- Type: String +- Default: "luckysheet" +- Usage: Container ID + +------------ +### title +- Type: String +- Default: "Luckysheet Demo" +- Usage:Workbook name + +------------ +### lang +- Type: String +- Default: "en" +- Usage: Internationalization settings, allow to set the language of the table, support simplified Chinese ("zh"), English ("en") and traditional Chinese ("zh_tw") and Spanish ("es") + +------------ +### gridKey +- Type: String +- Default: "" +- Usage: Workbook unique identifier + +------------ +### loadUrl +- Type: String +- Default: "" +- Usage: Configure the address of `loadUrl` and use it in conjunction with `loadSheetUrl`, which is generally used when the amount of data is large. You can also not use the interface parameters provided by Luckysheet, and use the [data](#data) parameter to prepare all table data for initialization in advance. + + Luckysheet will request the entire workbook data through ajax, and load all `celldata` in the worksheet data with status 1 by default, and load all the fields except the `celldata` field in the rest of the worksheets. However, considering that some formulas, charts and pivot tables will reference data from other worksheets, the front end will add a judgment. If the current worksheet references data from other worksheets, it will request data through the interface address configured by `loadSheetUrl` , And load the data of the related worksheets. Because `loadUrl` is only responsible for the current worksheet data, it is also necessary to configure `loadSheetUrl` as an interface for asynchronously loading data. + +------------ +### loadSheetUrl +- Type: String +- Default: "" +- Usage: Configure the address of `loadSheetUrl`, the parameters are `gridKey` (workbook primary key) and `index` (worksheet primary key collection, the format is `["sheet_01","sheet_02","sheet_03"]`), the returned data is the `celldata` field data collection of the worksheet. In order to load performance considerations, except for the first load of the celldata data of the current worksheet, the data of the other worksheets will be requested only when the worksheet is switched to that worksheet. + +------------ +### allowUpdate +- Type: Boolean +- Default: false +- Usage: Whether to allow back-end update after operating the table, used in conjunction with `updateUrl` + +------------ +### updateUrl +- Type: String +- Default: "" +- Usage: The back-end update address after operating the workbook will be valid only when `allowUpdate` is `true`. This interface is also the interface address for shared editing. + +Note that you also need to configure `loadUrl` and `loadSheetUrl` to take effect. + +------------ +### updateImageUrl +- Type: String +- Default: "" +- Usage: Update address of thumbnail + +------------ +### data +- Type: Array +- Default: [{ "name": "Sheet1", color: "", "status": "1", "order": "0", "data": [], "config": {}, "index":0 }, { "name": "Sheet2", color: "", "status": "0", "order": "1", "data": [], "config": {}, "index":1 }, { "name": "Sheet3", color: "", "status": "0", "order": "2", "data": [], "config": {}, "index":2 }] +- Usage: When `loadUrl` and `loadSheetUrl` are not configured, you need to manually configure all the sheet data passed to the entire client `[shee1, sheet2, sheet3]`. For detailed parameter settings, please refer to [worksheet configuration](/zh/guide/sheet.html) + +------------ +### plugins +- Type: Array +- Default: [] +- Usage: Configure plug-in, support chart: "chart" + +------------ +### column +- Type: Number +- Default: 60 +- Usage: The default number of columns in an empty workbook + +------------ +### row +- Type: Number +- Default: 84 +- Usage: The default number of rows in an empty workbook + +------------ +### autoFormatw +- Type: Boolean +- Default: false +- Usage: Automatically format numbers with more than 4 digits into "billion format", for example: true or "true" or "TRUE" + +------------ +### accuracy +- Type: Number +- Default: undefined +- Usage: Set the precision, the number of digits after the decimal point. The parameter is a number or a string of numbers, for example: "0" or 0 + +------------ +### allowCopy +- Type: Boolean +- Default: true +- Usage: Whether to allow copy + +------------ +### showtoolbar +- Type: Boolean +- Default: true +- Usage: Whether to show the toolbar + +------------ +### showtoolbarConfig + +- Type: Object +- Default: {} +- Usage: Custom configuration toolbar,can be used in conjunction with `showtoolbar`, `showtoolbarConfig` has a higher priority. +- Format: + ```json + { + undoRedo: false, //Undo redo + paintFormat: false, //Format brush + currencyFormat: false, //currency format + percentageFormat: false, //Percentage format + numberDecrease: false, //'Decrease the number of decimal places' + numberIncrease: false, //'Increase the number of decimal places + moreFormats: false, //'More Formats' + font: false, //'font' + fontSize: false, //'Font size' + bold: false, //'Bold (Ctrl+B)' + italic: false, //'Italic (Ctrl+I)' + strikethrough: false, //'Strikethrough (Alt+Shift+5)' + underline: false, // 'Underline (Alt+Shift+6)' + textColor: false, //'Text color' + fillColor: false, //'Cell color' + border: false, //'border' + mergeCell: false, //'Merge cells' + horizontalAlignMode: false, //'Horizontal alignment' + verticalAlignMode: false, //'Vertical alignment' + textWrapMode: false, //'Wrap mode' + textRotateMode: false, //'Text Rotation Mode' + image:false, // 'Insert picture' + link:false, // 'Insert link' + chart: false, //'chart' (the icon is hidden, but if the chart plugin is configured, you can still create a new chart by right click) + postil: false, //'comment' + pivotTable: false, //'PivotTable' + function: false, //'formula' + frozenMode: false, //'freeze mode' + sortAndFilter: false, //'Sort and filter' + conditionalFormat: false, //'Conditional Format' + dataVerification: false, // 'Data Verification' + splitColumn: false, //'Split column' + screenshot: false, //'screenshot' + findAndReplace: false, //'Find and Replace' + protection:false, // 'Worksheet protection' + print:false, // 'Print' + } + ``` +- Example: + - Show only the `undo/redo` and `font` buttons: + + ```js + //options + { + showtoolbar: false, + showtoolbarConfig:{ + undoRedo: true, + font: true, + } + } + ``` + - Hide only the `image` and `print` buttons: + + ```js + //options + { + showtoolbar: true, // The default is true, you can leave it unset + showtoolbarConfig:{ + image: false, + print: false, + } + } + ``` + +------------ +### showinfobar +- Type: Boolean +- Default: true +- Usage: Whether to show the top information bar + +------------ +### showsheetbar +- Type: Boolean +- Default: true +- Usage: Whether to show the bottom sheet button + +------------ +### showsheetbarConfig + +- Type: Object +- Default: {} +- Usage: Custom configuration bottom sheet button, can be used in conjunction with `showsheetbar`, `showsheetbarConfig` has a higher priority. +- Format: + ```json + { + add: false, //Add worksheet + menu: false, //Worksheet management menu + sheet: false //Worksheet display + } + ``` +- Example: + - Only display the `Add worksheet` button: + + ```js + //options + { + showsheetbar: false, + showsheetbarConfig:{ + add: true, + } + } + ``` + - Only hide the `Add worksheet` and `Worksheet management menu` buttons: + + ```js + //options + { + showsheetbar: true, // The default is true, you can leave it unset + showsheetbarConfig:{ + add: false, + menu: false, + } + } + ``` + +------------ +### showstatisticBar +- Type: Boolean +- Default: true +- Usage: Whether to show the bottom count bar + +------------ +### showstatisticBarConfig + +- Type: Object +- Default: {} +- Usage: Customize the bottom count bar, can be used in conjunction with `showstatisticBar`, `showstatisticBarConfig` has a higher priority. +- Format: + ```json + { + count: false, // Count bar + view: false, // Print view + zoom: false // Zoom + } + ``` +- Example: + - Only display the `Zoom` button: + + ```js + //options + { + showstatisticBar: false, + showstatisticBarConfig:{ + zoom: true, + } + } + ``` + - Only hide the `print view` button: + + ```js + //options + { + showstatisticBar: true, // The default is true, you can leave it unset + showstatisticBarConfig:{ + view: false, + } + } + ``` +------------ +### enableAddRow +- Type: Boolean +- Default: true +- Usage: Allow additional rows + +------------ +### enableAddBackTop +- Type: Boolean +- Default: true +- Usage: Allow back to top + +------------ +### userInfo +- Type: String | Boolean | Object +- Default: false +- Usage: User information display style in the upper right corner,Support the following three formats + 1. HTML template string, such as: + + ```js + options:{ + // Other configuration + userInfo:' Lucky', + } + ``` + + Or an ordinary string, such as: + + ```js + options:{ + // Other configuration + userInfo:'Lucky', + } + ``` + + 2. Boolean type, such as: + + `false`: Do not show + ```js + options:{ + // Other configuration + userInfo:false, // Do not display user information + } + + ``` + `true`: Show the default string + ```js + options:{ + // Other configuration + userInfo:true, // Show HTML:' Lucky' + } + + ``` + 3. Object format, set `userImage`: user avatar address and `userName`: user name, such as: + ```js + options:{ + // Other configuration + userImage:'https://cdn.jsdelivr.net/npm/luckyresources@1.0.3/assets/img/logo/logo.png', // Avatar url + userName:'Lucky', // username + } + ``` + 4. Note that if set to `undefined` or not set, the same as setting `false` + +------------ +### userMenuItem +- Type: Array +- Default: `[{url:"www.baidu.com", "icon":'', "name":"我的表格"}, {url:"www.baidu.com", "icon":'', "name":"退出登陆"}]` +- Usage: Click the pop-up menu of user information in the upper right corner + +------------ +### myFolderUrl +- Type: String +- Default: "www.baidu.com" +- Usage: The link of the `<` back button in the upper left corner + +------------ +### devicePixelRatio +- Type: Number +- Default: window.devicePixelRatio +- Usage: Device ratio, the larger the ratio, the higher the resolution of the workbook + +------------ +### functionButton +- Type: String +- Default: "" +- Usage: Function buttons in the upper right corner, for example:`' '` + +------------ +### showConfigWindowResize +- Type: Boolean +- Default: true +- Usage: The configuration of the chart or pivot table will pop up on the right, set whether the workbook will be automatically indented after popping up + +------------ +### forceCalculation +- Type: Boolean +- Default: false +- Usage: Force refresh formula. + + By default, in order to improve loading performance, when the table is initialized, cells containing formulas will directly obtain `v` and `m` as data results by default without real-time calculation. + + If the data of the cell associated with the formula has changed, or the result of the cell data where the formula is located has changed, it will cause the calculated result of the associated cell to be inconsistent with the actual displayed result. This requires the formula refresh to be turned on to ensure the data The accuracy of real-time calculations. + + ⚠️Reminder, there will be performance problems when there are more formulas, use it with caution! + +------------ +### cellRightClickConfig + +- Type: Object +- Default: {} +- Usage: Custom configuration cell right-click menu +- Format: + ```json + { + copy: false, // copy + copyAs: false, // copy as + paste: false, // paste + insertRow: false, // insert row + insertColumn: false, // insert column + deleteRow: false, // delete the selected row + deleteColumn: false, // delete the selected column + deleteCell: false, // delete cell + hideRow: false, // hide the selected row and display the selected row + hideColumn: false, // hide the selected column and display the selected column + rowHeight: false, // row height + columnWidth: false, // column width + clear: false, // clear content + matrix: false, // matrix operation selection + sort: false, // sort selection + filter: false, // filter selection + chart: false, // chart generation + image: false, // insert picture + link: false, // insert link + data: false, // data verification + cellFormat: false // Set cell format + } + ``` + + In addition to the cells, the configuration here also includes the row header right-click menu, the column header right-click menu, and the column header drop-down arrow menu. The specific configuration relationships are as follows: + + |Right-click menu configuration|Cell|Row header|Column header|Column arrow| + | ------------ | ------------ | ------------ | ----------- | ------------ | + |copy|copy|copy|copy|copy| + |copyAs|copy as|copy as|copy as|copy as| + |paste|paste|paste|paste|paste| + |insertRow|Insert a row|Increase N rows upwards and N rows downwards|-|-| + |insertColumn|Insert Column|-|Add N columns to the left and N columns to the right|Add N columns to the left and N columns to the right| + |deleteRow|Delete selected row|Delete selected row|-|-| + |deleteColumn|Delete selected column|-|Delete selected column|Delete selected column| + |deleteCell|Delete cell|-|-|-| + |hideRow|-|Hide the selected row and show the selected row|-|-| + |hideColumn|-|-|Hide the selected column and show the selected column|Hide the selected column and show the selected column| + |rowHeight|-|row height|-|-| + |columnWidth|-|-|Column Width|Column Width| + |clear|clear content|clear content|clear content|-| + |matrix|Matrix Operation Selection|Matrix Operation Selection|Matrix Operation Selection|-| + |sort|Sort selection|Sort selection|Sort selection|A-Z sort and Z-A sort| + |filter|Filter selection|Filter selection|Filter selection|-| + |chart|chart generation|chart generation|chart generation|-| + |image|Insert Picture|Insert Picture|Insert Picture|-| + |link|Insert link|Insert link|Insert link|-| + |data|Data Verification|Data Verification|Data Verification|-| + |cellFormat|Set cell format|Set cell format|Set cell format|-| + +------------ +### sheetRightClickConfig + +- Type: Object +- Default: {} +- Usage: Customize the right-click menu of the bottom sheet bar +- Format: + ```json + { + delete: false, //Delete + copy: false, //Copy + rename: false, //Rename + color: false, //Change color + hide: false, //Hide, unhide + move: false, //Move to the left, move to the right + } + +------------ +### rowHeaderWidth +- Type: Number +- Default: 46 +- Usage: The width of the row header area, if set to 0, it means to hide the row header + +------------ +### columnHeaderHeight +- Type: Number +- Default: 20 +- Usage: The height of the column header area, if set to 0, it means hide the column header + +------------ +### sheetFormulaBar +- Type: Boolean +- Default: true +- Usage: Whether to show the formula bar + +------------ +### defaultFontSize +- Type:Number +- Default:11 +- Usage:Initialize the default font size + +------------ + +### limitSheetNameLength +- Type: Boolean +- Default: true +- Usage:Is the length of the sheet name limited in scenarios such as sheet renaming + +------------ + +### defaultSheetNameMaxLength +- Type:Number +- Default:31 +- Usage:Default maximum allowed sheet name length + +------------ + +### pager +- Type:Object +- Default:null +- Usage:Pager button settings, the first version of the solution is directly used jquery plug-in [sPage](https://github.com/jvbei/sPage) + Clicking the paging button will trigger the hook function `onTogglePager`, which returns the current page number, which is the same as the `backFun` method of `sPage`. This pager setting is only responsible for the UI part. For the specific data request and data rendering after switching paging, please enter the `onTogglePager` custom processing in the number of hook lines. + ```js + pager: { + pageIndex: 1, //Current page number + pageSize: 10, //How many rows of data are displayed on each page + total: 50, //Total number of rows of data + selectOption: [10, 20] //Options that allow setting the number of rows per page + } + ``` + +------------ + +## Hook Function (TODO) + +When the hook function is used in secondary development, hooks will be implanted in each common mouse or keyboard operation, and the function passed in by the developer will be called to expand the function of Luckysheet. + +The hook functions are uniformly configured under ʻoptions.hook`, and configuration hooks can be created separately for cells, sheet pages, and tables. + +## Cell + +### cellEditBefore + +- Type: Function +- Default: null +- Usage: Triggered before entering the cell editing mode. When a cell is selected and in the non-editing state, there are usually the following three conventional methods to trigger the edit mode + - Double click the cell + - Hit Enter + - Use API: enterEditMode +- Parameter: + - {Array} [range]: Current selection range + +------------ +### cellUpdateBefore + +- Type: Function +- Default: null +- Usage: Triggered before updating this cell value, `return false` will not perform subsequent updates. After modifying the cell in the editing state, this hook is triggered before exiting the editing mode and updating the data. +- Parameter: + - {Number} [r]: The row number of the cell + - {Number} [c]: The column number of the cell + - {Object | String | Number} [value]: The content of the cell to be modified + - {Boolean} [isRefresh]: Whether to refresh the entire table + +------------ +### cellUpdated + +- Type: Function +- Default: null +- Usage: Triggered after updating this cell +- Parameter: + - {Number} [r]: The row number of the cell + - {Number} [c]: The column number of the cell + - {Object} [oldValue]: Cell object before modification + - {Object} [newValue]: Modified cell object + - {Boolean} [isRefresh]: Whether to refresh the entire table + +------------ +### cellRenderBefore + +- Type: Function +- Default: null +- Usage: Triggered before the cell is rendered, `return false` will not render the cell +- Parameter: + - {Object} [cell]:Cell object + - {Object} [position]: + + {Number} [r]: The row number of the cell + + {Number} [c]: The column number of the cell + + {Number} [start_r]: The horizontal coordinate of the upper left corner of the cell + + {Number} [start_c]: The vertical coordinate of the upper left corner of the cell + + {Number} [end_r]: The horizontal coordinate of the lower right corner of the cell + + {Number} [end_c]: The vertical coordinate of the lower right corner of the cell + - {Object} [sheet]: Current sheet object + - {Object} [ctx]: The context of the current canvas + +------------ +### cellRenderAfter + +- Type: Function +- Default: null +- Usage: Triggered after the cell rendering ends, `return false` will not render the cell +- Parameter: + - {Object} [cell]: Cell object + - {Object} [position]: + + {Number} [r]: The row number of the cell + + {Number} [c]: The column number of the cell + + {Number} [start_r]: The horizontal coordinate of the upper left corner of the cell + + {Number} [start_c]: The vertical coordinate of the upper left corner of the cell + + {Number} [end_r]: The horizontal coordinate of the lower right corner of the cell + + {Number} [end_c]: The vertical coordinate of the lower right corner of the cell + - {Object} [sheet]: Current worksheet object + - {Object} [ctx]: The context of the current canvas + +- Example: + + A case of drawing two pictures in the upper left corner and lower right corner of cell D1 + :::::: details + ```js + luckysheet.create({ + hook: { + cellRenderAfter: function (cell, position, sheetFile, ctx) { + var r = position.r; + var c = position.c; + if (r === 0 && c === 3) { // Specify to process cell D1 + if (!window.storeUserImage) { + window.storeUserImage = {} + } + + if (!window.storeUserImage[r + '_' + c]) { + window.storeUserImage[r + '_' + c] = {} + } + + var img = null; + var imgRight = null; + + if (window.storeUserImage[r + '_' + c].image && window.storeUserImage[r + '_' + c].imgRight) { + + // Fetch directly after loading + img = window.storeUserImage[r + '_' + c].image; + imgRight = window.storeUserImage[r + '_' + c].imgRight; + + } else { + + img = new Image(); + imgRight = new Image(); + + img.src = 'https://www.dogedoge.com/favicon/developer.mozilla.org.ico'; + imgRight.src = 'https://www.dogedoge.com/static/icons/twemoji/svg/1f637.svg'; + + // The picture is cached in the memory, fetched directly next time, no need to reload + window.storeUserImage[r + '_' + c].image = img; + window.storeUserImage[r + '_' + c].imgRight = imgRight; + + } + + + if (img.complete) { //Direct rendering that has been loaded + ctx.drawImage(img, position.start_c, position.start_r, 10, 10); + } else { + img.onload = function () { + ctx.drawImage(img, position.start_c, position.start_r, 10, 10); + } + + } + + if (imgRight.complete) { + ctx.drawImage(imgRight, position.end_c - 10, position.end_r - 10, 10, 10); + } else { + + imgRight.onload = function () { + ctx.drawImage(imgRight, position.end_c - 10, position.end_r - 10, 10, 10); + } + } + + } + } + } + }) + ``` + ::: + +------------ +### cellAllRenderBefore + +- Type: Function +- Default: null +- Usage:The method executed before all cells are rendered. Internally, this method is added before `luckysheetDrawMain` renders the table. +- Parameter: + - {Object} [data]: Two-dimensional array data of the current worksheet + - {Object} [sheet]: Current worksheet object + - {Object} [ctx]: The context of the current canvas + +------------ +### rowTitleCellRenderBefore + +- Type: Function +- Default: null +- Usage: Triggered before the row header cell is rendered, `return false` will not render the row header +- Parameter: + - {String} [rowNum]: Row number + - {Object} [position]: + + {Number} [r]: The row number of the cell + + {Number} [top]: The vertical coordinate of the upper left corner of the cell + + {Number} [width]: Cell width + + {Number} [height]: Cell height + - {Object} [ctx]: The context of the current canvas + +------------ +### rowTitleCellRenderAfter + +- Type: Function +- Default: null +- Usage: Triggered after the row header cell is rendered, `return false` will not render the row header +- Parameter: + - {String} [rowNum]: Row number + - {Object} [position]: + + {Number} [r]: The row number of the cell + + {Number} [top]: The vertical coordinate of the upper left corner of the cell + + {Number} [width]: Cell width + + {Number} [height]: Cell height + - {Object} [ctx]: The context of the current canvas + +------------ +### columnTitleCellRenderBefore + +- Type: Function +- Default: null +- Usage: Triggered before the column header cell is rendered, `return false` will not render the column header +- Parameter: + - {Object} [columnAbc]: Column header characters + - {Object} [position]: + - {Number} [c]: The column number of the cell + - {Number} [left]: The horizontal coordinate of the upper left corner of the cell + - {Number} [width]: Cell width + - {Number} [height]: Cell height + - {Object} [ctx]: The context of the current canvas + +------------ +### columnTitleCellRenderAfter + +- Type: Function +- Default: null +- Usage: Triggered after the column header cell is rendered, `return false` will not render the column header +- Parameter: + - {Object} [columnAbc]: Column header characters + - {Object} [position]: + - {Number} [c]: The column number of the cell + - {Number} [left]: The horizontal coordinate of the upper left corner of the cell + - {Number} [width]: Cell width + - {Number} [height]: Cell height + - {Object} [ctx]: The context of the current canvas + +------------ + +## Selected area + +### rangeSelect +- Type: Function +- Default: null +- Usage: Frame selection or trigger after setting selection +- Parameter: + - {Object} [sheet]: Current worksheet object + - {Object | Array} [range]: Selection area, may be multiple selection areas + +------------ + +### rangeMoveBefore +- Type: Function +- Default: null +- Usage: Before moving the selection, include a single cell +- Parameter: + - {Array} [range]: The current selection area, can only be a single selection area + +------------ +### rangeMoveAfter +- Type: Function +- Default: null +- Usage: After moving the selection, include a single cell +- Parameter: + - {Array} [oldRange]: The current selection range before moving, can only be a single selection + - {Array} [newRange]: The current selection range after moving, can only be a single selection + +------------ +### rangeEditBefore +- Type: Function +- Default: null +- Usage: Before the selection +- Parameter: + - {Object | Array} [range]: Selection area, may be multiple selection areas + - {Object} [data]: Data corresponding to the selection area + +------------ +### rangeEditAfter +- Type: Function +- Default: null +- Usage: After the selection is modified +- Parameter: + - {Object | Array} [range]: Selection area, may be multiple selection areas + - {Object} [oldData]: Before modification, the data corresponding to the selection area + - {Object} [newData]: After modification, the data corresponding to the selection area + +------------ +### rangeCopyBefore +- Type: Function +- Default: null +- Usage: Before copying selection +- Parameter: + - {Object | Array} [range]: Selection area, may be multiple selection areas + - {Object} [data]: Data corresponding to the selection area + +------------ +### rangeCopyAfter +- Type: Function +- Default: null +- Usage: After copying selection +- Parameter: + - {Object | Array} [range]: Selection area, may be multiple selection areas + - {Object} [data]: Data corresponding to the selection area + +------------ +### rangePasteBefore +- Type: Function +- Default: null +- Usage: Before pasting the selection +- Parameter: + - {Object | Array} [range]: Selection area, may be multiple selection areas + - {Object} [data]: The data corresponding to the selection area to be pasted + +------------ +### rangePasteAfter +- Type: Function +- Default: null +- Usage: After pasting the selection +- Parameter: + - {Object | Array} [range]: Selection area, may be multiple selection areas + - {Object} [originData]: The data corresponding to the selection area to be pasted + - {Object} [pasteData]: Data to paste + +------------ +### rangeCutBefore +- Type: Function +- Default: null +- Usage: Before selection cut +- Parameter: + - {Array} [range]: Selection range, can only be a single range + - {Object} [data]: The data corresponding to the selection area to be cut + +------------ +### rangeCutAfter +- Type: Function +- Default: null +- Usage: After selection cut +- Parameter: + - {Array} [range]: Selection range, can only be a single range + - {Object} [data]: The data corresponding to the selection area to be cut + +------------ +### rangeDeleteBefore +- Type: Function +- Default: null +- Usage: Before the selection is deleted +- Parameter: + - {Array} [range]: Selection range, can only be a single range + - {Object} [data]: The data corresponding to the selection area to be deleted + +------------ +### rangeDeleteAfter +- Type: Function +- Default: null +- Usage: After the selection is deleted +- Parameter: + - {Array} [range]: Selection range, can only be a single range + - {Object} [data]: The data corresponding to the selection area to be deleted + +------------ +### rangeClearBefore +- Type: Function +- Default: null +- Usage: Before the selection is cleared +- Parameter: + - {Object | Array} [range]: Selection area, may be multiple selection areas + - {Object} [data]: The data corresponding to the selection area to be cleared + +------------ +### rangeClearAfter +- Type: Function +- Default: null +- Usage: After the selection is cleared +- Parameter: + - {Object | Array} [range]: Selection area, may be multiple selection areas + - {Object} [data]: The data corresponding to the selection area to be cleared + +------------ +### rangePullBefore +- Type: Function +- Default: null +- Usage: Before selection drop down +- Parameter: + - {Array} [range]: The current selection range, can only be a single range + +------------ +### rangePullAfter +- Type: Function +- Default: null +- Usage: After selection drop down +- Parameter: + - {Array} [range]: The selection range after the drop-down can only be a single range + +------------ + +## Worksheet + +### sheetCreatekBefore +(TODO) +- Type: Function +- Default: null +- Usage: Triggered before the worksheet is created, the new worksheet also includes the new pivot table + +------------ +### sheetCreateAfter +(TODO) +- Type: Function +- Default: null +- Usage: Triggered after the worksheet is created, the new worksheet also includes the new pivot table +- Parameter: + - {Object} [sheet]: The configuration of the newly created worksheet + +------------ +### sheetMoveBefore +(TODO) +- Type: Function +- Default: null +- Usage: Before the worksheet is moved +- Parameter: + - {Number} [i]: `index` of current worksheet + - {Number} [order]: `Order` of current worksheet + +------------ +### sheetMoveAfter +(TODO) +- Type: Function +- Default: null +- Usage: After the worksheet is moved +- Parameter: + - {Number} [i]: `index` of current worksheet + - {Number} [oldOrder]: Before modification, the `order` of the current worksheet + - {Number} [newOrder]: After modification, the `order` of the current worksheet + +------------ +### sheetDeleteBefore +(TODO) +- Type: Function +- Default: null +- Usage: Before the worksheet is deleted +- Parameter: + - {Object} [sheet]: Configuration of the worksheet to be deleted + +------------ +### sheetDeleteAfter +(TODO) +- Type: Function +- Default: null +- Usage: After the worksheet is deleted +- Parameter: + - {Object} [sheet]: Configuration of deleted worksheet + +------------ +### sheetEditNameBefore +(TODO) +- Type: Function +- Default: null +- Usage: Before changing the name of the worksheet +- Parameter: + - {Number} [i]: `index` of current worksheet + - {String} [name]: Current worksheet name + +------------ +### sheetEditNameAfter +(TODO) +- Type: Function +- Default: null +- Usage: After changing the name of the worksheet +- Parameter: + - {Number} [i]: `index` of current worksheet + - {String} [oldName]: Before modification, the current worksheet name + - {String} [newName]: After modification, the current worksheet name + +------------ +### sheetEditColorBefore +(TODO) +- Type: Function +- Default: null +- Usage: Before changing the color of the worksheet +- Parameter: + - {Number} [i]: `index` of current worksheet + - {String} [color]: Current worksheet color + +------------ +### sheetEditColorAfter +(TODO) +- Type: Function +- Default: null +- Usage: After changing the color of the worksheet +- Parameter: + - {Number} [i]: `index` of current worksheet + - {String} [oldColor]: Before modification, the current worksheet color + - {String} [newColor]: After modification, the current worksheet color + +------------ +### sheetZoomBefore +(TODO) +- Type: Function +- Default: null +- Usage: Before worksheet zoom +- Parameter: + - {Number} [i]: `index` of current worksheet + - {String} [zoom]: Current worksheet zoom ratio + +------------ +### sheetZoomAfter +(TODO) +- Type: Function +- Default: null +- Usage: After worksheet zoom +- Parameter: + - {Number} [i]: `index` of current worksheet + - {String} [oldZoom]: Before modification, the current worksheet zoom ratio + - {String} [newZoom]: After modification, the current worksheet zoom ratio + +------------ +### sheetActivateBefore +(TODO) +- Type: Function +- Default: null +- Usage:Before worksheet activate +- Parameter: + - {Number} [i]: `index` of current worksheet + +------------ +### sheetActivateAfter +(TODO) +- Type: Function +- Default: null +- Usage:After worksheet activate +- Parameter: + - {Number} [i]: `index` of current worksheet + +------------ +### sheetDeactivateBefore +(TODO) +- Type: Function +- Default: null +- Usage:Before the worksheet changes from active to inactive +- Parameter: + - {Number} [i]: `index` of current worksheet + +------------ +### sheetDeactivateAfter +(TODO) +- Type: Function +- Default: null +- Usage:After the worksheet is changed from active to inactive +- Parameter: + - {Number} [i]: `index` of current worksheet + +------------ + +## Workbook + +### workbookCreateBefore +- Type: Function +- Default: null +- Usage: Triggered before the worksheet is created. The old hook function is called `beforeCreateDom` +- Parameter: + - {Object} [book]:Configuration of the entire workbook (options) + +------------ +### workbookCreateAfter +- Type: Function +- Default: null +- Usage: Triggered after the workbook is created +- Parameter: + - {Object} [book]:Configuration of the entire workbook (options) + +------------ +### workbookDestroyBefore +- Type: Function +- Default: null +- Usage: Triggered before the workbook is destroyed +- Parameter: + - {Object} [book]:Configuration of the entire workbook (options) + +------------ +### workbookDestroyAfter +- Type: Function +- Default: null +- Usage: Triggered after the workbook is destroyed +- Parameter: + - {Object} [book]:Configuration of the entire workbook (options) + +------------ +### updated +- Type: Function +- Default: null +- Usage: The method executed after each operation is updated is executed after the canvas rendering, monitor changes in worksheet content, that is, every time the client performs a workbook operation, Luckysheet saves the operation in the history and triggers it. When undoing and redoing, it is also an operation, of course, the hook function will be triggered. +- Parameter: + - {Object} [operate]: The history information of this operation will have different history records according to different operations. Refer to the source code [History](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/controlHistory.js ) + +------------ +### resized +- Type: Function +- Default: null +- Usage: After resize is executed +- Parameter: + - {Object} [size]: The width and height of the entire workbook area + +------------ + +## Cooperative + +### cooperativeMessage + +- Type:Function +- Default:null +- Usage:Receive the cooperation message, secondary development. Expanding cooperative message instruction set +- Params: + - {Object} : Receives the entire collaboration message body object sent by the server + +## Image + +### imageInsertBefore +- Type: Function +- Default: null +- Usage: Before the picture is inserted +- Parameter: + - {Object} [url]: Picture address + +------------ +### imageInsertAfter +- Type: Function +- Default: null +- Usage: After the picture is inserted +- Parameter: + - {Object} [item]]: Picture address, width and height, location and other information + +------------ +### imageUpdateBefore +- Type: Function +- Default: null +- Usage: Before the picture is modified, the modified content includes operations such as width and height, position, and cropping +- Parameter: + - {Object} [item]]: Picture address, width and height, location and other information + +------------ +### imageUpdateAfter +- Type: Function +- Default: null +- Usage: After the picture is modified, the modified content includes operations such as width and height, position, and cropping +- Parameter: + - {Object} [oldItem]]: Before modification, the picture address, width and height, location and other information + - {Object} [newItem]]: After modification, the picture address, width and height, location and other information + +------------ +### imageDeleteBefore +- Type: Function +- Default: null +- Usage: Before the picture is deleted +- Parameter: + - {Object} [item]]: Picture address, width and height, location and other information + +------------ +### imageDeleteAfter +- Type: Function +- Default: null +- Usage: After the picture is deleted +- Parameter: + - {Object} [item]]: Picture address, width and height, location and other information + +------------ + +## Comment + +### commentInsertBefore +- Type: Function +- Default: null +- Usage: Before inserting comments +- Parameter: + - {Object} [cell]: The cell information of the comment to be inserted, such as:`{ r:0,c:2,v:{m:'233',v:'233'}}` + +------------ +### commentInsertAfter +- Type: Function +- Default: null +- Usage: After inserting comments +- Parameter: + - {Object} [cell]: The cell information where the comment is inserted, such as:`{ r:0,c:2,v:{m:'233',v:'233'}}`, contains comment information + +------------ +### commentDeleteBefore +- Type: Function +- Default: null +- Usage: Before deleting comments +- Parameter: + - {Object} [cell]: The cell information of the comment to be deleted, such as:`{ r:0,c:2,v:{m:'233',v:'233'}}` + +------------ +### commentDeleteAfter +- Type: Function +- Default: null +- Usage: After deleting the comment +- Parameter: + - {Object} [cell]: The cell information of the deleted comment, such as:`{ r:0,c:2,v:{m:'233',v:'233'}}` + +------------ +### commentUpdateBefore +- Type: Function +- Default: null +- Usage: Before modifying comments +- Parameter: + - {Object} [cell]: The cell information of the comment, such as:`{ r:0,c:2,v:{m:'233',v:'233'}}` + +------------ +### commentUpdateAfter +- Type: Function +- Default: null +- Usage: After modifying the comment +- Parameter: + - {Object} [oldCell]: Before modification, the cell information where the comment is located, such as:`{ r:0,c:2,v:{m:'233',v:'233'}}` + - {Object} [newCell]: After modification, the cell information where the comment is located, such as:`{ r:0,c:2,v:{m:'233',v:'233'}}` + +------------ + +## Pivot table + +### pivotTableEditBefore +- Type: Function +- Default: null +- Usage: Before modifying the PivotTable, operations such as dragging fields, etc. +- Parameter: + - {Object} [sheet]: Worksheet configuration where the pivot table is located + +------------ +### pivotTableEditAfter +- Type: Function +- Default: null +- Usage: After modifying the PivotTable, operations such as dragging fields, etc. +- Parameter: + - {Object} [oldSheet]: Before modification, the worksheet configuration where the pivot table is located + - {Object} [newSheet]: After modification, the worksheet configuration where the pivot table is located + +------------ + +## Freeze + +### frozenCreateBefore +- Type: Function +- Default: null +- Usage: Before setting freeze +- Parameter: + - {Object} [frozen]: Freeze type information + +------------ +### frozenCreateAfter +- Type: Function +- Default: null +- Usage: After setting freeze +- Parameter: + - {Object} [frozen]: Freeze type information + +------------ +### frozenCancelBefore +- Type: Function +- Default: null +- Usage: Before unfreezing +- Parameter: + - {Object} [frozen]: Freeze type information + +------------ +### frozenCancelAfter +- Type: Function +- Default: null +- Usage: After unfreezing +- Parameter: + - {Object} [frozen]: Freeze type information + +------------ + +#### Legacy Hook Function + +### fireMousedown +- Type: Function +- Default: null +- Usage: Customized method of drilling down cell data, note that this hook function is mounted under options: `options.fireMousedown` + +------------ + +## Pager + +### onTogglePager + +- Type: Function +- Default: null +- Usage: Click the page button to call back the function, return the current page number, refer to [sPage backFun](https://github.com/jvbei/sPage) +- Parameter: + - {Object} [page]: Return the current page object + +------------ diff --git a/docs/guide/contribute.md b/docs/guide/contribute.md index c832a8d14..a9a02731e 100644 --- a/docs/guide/contribute.md +++ b/docs/guide/contribute.md @@ -1,221 +1,221 @@ - -# Contribution guide - -welcome! We are very happy that you are here and look forward to your interest in participating in Luckysheet contributions. Of course, before you participate in the Luckysheet contribution, please make sure to read the following full text: - -## Our code of conduct - -1. We promise to respect all those who participated in the contribution, not limited to those who raised questions, contributed documents and code, resolved bugs and other contributions; - -2. We are obliged to abide by local laws and regulations, and we reject all behaviors with legal risks; -3. We oppose any participant's derogatory comments, personal attacks, harassment or insult to others, and other non-professional behaviors; -4. We have the right and responsibility to delete or edit content that does not comply with this code of conduct, not limited to code, issues, wikis, documents and others. Participants who do not comply with the code of conduct may be removed from the team; -5. We accept the supervision of anyone, and anyone can report to us the facts that are found to be inconsistent with this code of conduct through problem feedback. - -## How to participate in contributing? - -* Contributed documents: Browsing the document can deepen your understanding of Luckysheet. Once you find that the document is not clearly written or the logic is confusing, you can correct, modify, and supplement. You can go to [Google Forum](https://groups.google.com/g/luckysheet) to give feedback -* Contributing code: Welcome everyone to contribute code to the Luckysheet community, you are welcome to claim the Open state [Issues](https://github.com/mengshukeji/Luckysheet/issues) and unfinished features, submit a PR, and become one of the contributors If you find that some functions cannot meet your needs or have problems during use, please record in Issues -* Participate in the issue discussion: you can post your suggestions under any [Issues](https://github.com/mengshukeji/Luckysheet/issues) -* Review code: You can see PR submitted by all contributors on [Github](https://github.com/mengshukeji/Luckysheet), you can review their code and post your suggestions - -## How to submit issues - -Before you submit features/improvements, you should pay attention to the following points: - -* Please confirm whether the feature/improvement has been submitted by others -* An easy-to-understand title to explain the bug/submission feature/improvement you submitted -* If it is a bug, describe the cause of the bug in detail. If it can be reproduced, please try to provide complete reproduction steps -* If it is a feature, then the feature should have wide applicability, suitable for most users, and it is best to provide detailed design documents -* If it is an improvement, describe the benefits of this improvement as clearly as possible - -Specific steps: - -* Create [Issues](https://github.com/mengshukeji/Luckysheet/issues) and describe the issue clearly -* If you want to solve the issue, assign the issue to your own name. If you just submit a bug/feature/improvement and don’t have time to contribute code, set assignne to empty -* If it is a relatively large feature/improvement, try to output the design document first and follow the [Luckysheet RFC](https://github.com/mengshukeji/Luckysheet-rfcs) process for others to review - -## How to claim Issues - -In Luckysheet's [Issues](https://github.com/mengshukeji/Luckysheet/issues) list, there are many issues created by others that have not been repaired. If you are interested, you can claim these issues. The steps to claim are as follows: - -* Leave a message under the issue, express the idea of claiming the task, and specify **@I can solve it** -* If the submitter has no comments, assign the issue to your own name and update the progress in time -* If it is a relatively large feature, try to output the design document first and follow the [Luckysheet RFC](https://github.com/mengshukeji/Luckysheet-rfcs) process for others to review -* Develop the code and submit the code to github - -## How to submit code - -1. Fork to own warehouse - -Go to the Github page of [Luckysheet](https://github.com/mengshukeji/Luckysheet), and click the Fork button in the upper right corner to proceed. - -2. Git clone to local - -```shell -git clone https://github.com//Luckysheet.git -``` - -3. Establish a connection upstream - -```shell - -cd Luckysheet -gitremote add upstream https://github.com/mengshukeji/Luckysheet.git -``` - -4. Create a development branch - -```shell -git checkout -b dev -``` - -5. Modify the submission code - -```shell -git add. -npm run commit -git push origin dev -``` - -6. Sync code, synchronize the latest code to the local - -```shell -git fetch upstream -git rebase upstream/master -``` - -7. If there is a conflict (nothing can be ignored) - -```shell -git status # View conflict files and modify conflicts -git add. -git rebase --continue -``` -When submitting the git rebase --continue command, if vim prompts to edit the commit information, you can add your changes, then save and exit -> For vim commands, please refer to the [vim](https://www.runoob.com/linux/linux-vim.html) - -8. Submit branch code - -```shell -git push origin dev -``` - -If you are prompted to pull first, you can pull it before submitting -```shell -git pull origin dev -git push origin dev -``` -If the vim prompt to edit the commit information pops up, you can exit directly through the vim command -> For vim commands, please refer to [vim](https://www.runoob.com/linux/linux-vim.html) - -9. Submit pr -Go to the fork project in your github warehouse, switch to the branch you just created and modified, click new pull request, and add the corresponding description, and finally click Create pull request to submit - -## Code Specification - -> General code specification example - -* Keep the block depth to a minimum. Avoid nested If conditions as much as possible -```js -// CORRECT -if (!comparison) return - -if (variable) { - for (const item of items) {} -} else if (variable2) { - // Do something here -} - -// INCORRECT -if (comparison) { - if (variable) { - for (const item in items) {} - } else if (variable2) { - // Do something here - } -} else { - return -} -``` - -* Do not use operands for chain comparison -```js -// CORRECT - -if (cb) cb() -if (!cb || (cb === fn)) cb() - -// INCORRECT - -cb && cb() -(!cb || (cb === fn)) && cb() -``` - -* All variables should be declared at the beginning of the block in alphabetical order -```js -// CORRECT -function foo () { - const foo ='bar' - const bar ='foo' - - if (conditional) {} - - ... - - return foo -} - -// INCORRECT - -function foo () { - const foo ='bar' - - if (conditional) {} - - const bar ='foo' - - ... - - return foo -} -``` - -* Return as soon as possible -```js -// CORRECT -if (condition) return'foo' -if (condition2) return'bar' -// Return must have a blank line above -return'fizz' - -// INCORRECT -const variable ='' - -if (condition) { - variable ='foo' -} else if (condition2) { - variable ='bar' -} else { - variable ='fizz' -} - -return variable -``` - -## How to contribute documents - -## How to become Luckysheet Committer - -As long as anyone contributes to the Luckysheet project, you are the officially recognized Contributor of the Luckysheet project. There is no exact standard for growing from Contributor to Committer, and there is no expected timetable, but Committer candidates are generally A long-term active contributor, becoming Committer does not require a huge architectural improvement contribution, or how many lines of code contributions, contributing code, contributing documents, participating in mailing list discussions, helping to answer questions, etc., are all ways to increase their influence . - -List of potential contributions (in no particular order): - -* Submit the bugs, features, and improvements you found to the issue -* Update the official documents so that the project documents are the most recent, the best practices for writing Luckysheet, and various useful documents for the users -* Perform test and report test results, performance test and other MQ performance comparison test, etc. -* Review the work of others (including code and non-code) and publish your own suggestions -* Guide new contributors and be familiar with the community process -* Post a blog about Luckysheet -* Any contribution to the development of the Luckysheet community -* ...... + +# Contribution guide + +welcome! We are very happy that you are here and look forward to your interest in participating in Luckysheet contributions. Of course, before you participate in the Luckysheet contribution, please make sure to read the following full text: + +## Our code of conduct + +1. We promise to respect all those who participated in the contribution, not limited to those who raised questions, contributed documents and code, resolved bugs and other contributions; + +2. We are obliged to abide by local laws and regulations, and we reject all behaviors with legal risks; +3. We oppose any participant's derogatory comments, personal attacks, harassment or insult to others, and other non-professional behaviors; +4. We have the right and responsibility to delete or edit content that does not comply with this code of conduct, not limited to code, issues, wikis, documents and others. Participants who do not comply with the code of conduct may be removed from the team; +5. We accept the supervision of anyone, and anyone can report to us the facts that are found to be inconsistent with this code of conduct through problem feedback. + +## How to participate in contributing? + +* Contributed documents: Browsing the document can deepen your understanding of Luckysheet. Once you find that the document is not clearly written or the logic is confusing, you can correct, modify, and supplement. You can go to [Google Forum](https://groups.google.com/g/luckysheet) to give feedback +* Contributing code: Welcome everyone to contribute code to the Luckysheet community, you are welcome to claim the Open state [Issues](https://github.com/mengshukeji/Luckysheet/issues) and unfinished features, submit a PR, and become one of the contributors If you find that some functions cannot meet your needs or have problems during use, please record in Issues +* Participate in the issue discussion: you can post your suggestions under any [Issues](https://github.com/mengshukeji/Luckysheet/issues) +* Review code: You can see PR submitted by all contributors on [Github](https://github.com/mengshukeji/Luckysheet), you can review their code and post your suggestions + +## How to submit issues + +Before you submit features/improvements, you should pay attention to the following points: + +* Please confirm whether the feature/improvement has been submitted by others +* An easy-to-understand title to explain the bug/submission feature/improvement you submitted +* If it is a bug, describe the cause of the bug in detail. If it can be reproduced, please try to provide complete reproduction steps +* If it is a feature, then the feature should have wide applicability, suitable for most users, and it is best to provide detailed design documents +* If it is an improvement, describe the benefits of this improvement as clearly as possible + +Specific steps: + +* Create [Issues](https://github.com/mengshukeji/Luckysheet/issues) and describe the issue clearly +* If you want to solve the issue, assign the issue to your own name. If you just submit a bug/feature/improvement and don’t have time to contribute code, set assignne to empty +* If it is a relatively large feature/improvement, try to output the design document first and follow the [Luckysheet RFC](https://github.com/mengshukeji/Luckysheet-rfcs) process for others to review + +## How to claim Issues + +In Luckysheet's [Issues](https://github.com/mengshukeji/Luckysheet/issues) list, there are many issues created by others that have not been repaired. If you are interested, you can claim these issues. The steps to claim are as follows: + +* Leave a message under the issue, express the idea of claiming the task, and specify **@I can solve it** +* If the submitter has no comments, assign the issue to your own name and update the progress in time +* If it is a relatively large feature, try to output the design document first and follow the [Luckysheet RFC](https://github.com/mengshukeji/Luckysheet-rfcs) process for others to review +* Develop the code and submit the code to github + +## How to submit code + +1. Fork to own warehouse + +Go to the Github page of [Luckysheet](https://github.com/mengshukeji/Luckysheet), and click the Fork button in the upper right corner to proceed. + +2. Git clone to local + +```shell +git clone https://github.com//Luckysheet.git +``` + +3. Establish a connection upstream + +```shell + +cd Luckysheet +gitremote add upstream https://github.com/mengshukeji/Luckysheet.git +``` + +4. Create a development branch + +```shell +git checkout -b dev +``` + +5. Modify the submission code + +```shell +git add. +npm run commit +git push origin dev +``` + +6. Sync code, synchronize the latest code to the local + +```shell +git fetch upstream +git rebase upstream/master +``` + +7. If there is a conflict (nothing can be ignored) + +```shell +git status # View conflict files and modify conflicts +git add. +git rebase --continue +``` +When submitting the git rebase --continue command, if vim prompts to edit the commit information, you can add your changes, then save and exit +> For vim commands, please refer to the [vim](https://www.runoob.com/linux/linux-vim.html) + +8. Submit branch code + +```shell +git push origin dev +``` + +If you are prompted to pull first, you can pull it before submitting +```shell +git pull origin dev +git push origin dev +``` +If the vim prompt to edit the commit information pops up, you can exit directly through the vim command +> For vim commands, please refer to [vim](https://www.runoob.com/linux/linux-vim.html) + +9. Submit pr +Go to the fork project in your github warehouse, switch to the branch you just created and modified, click new pull request, and add the corresponding description, and finally click Create pull request to submit + +## Code Specification + +> General code specification example + +* Keep the block depth to a minimum. Avoid nested If conditions as much as possible +```js +// CORRECT +if (!comparison) return + +if (variable) { + for (const item of items) {} +} else if (variable2) { + // Do something here +} + +// INCORRECT +if (comparison) { + if (variable) { + for (const item in items) {} + } else if (variable2) { + // Do something here + } +} else { + return +} +``` + +* Do not use operands for chain comparison +```js +// CORRECT + +if (cb) cb() +if (!cb || (cb === fn)) cb() + +// INCORRECT + +cb && cb() +(!cb || (cb === fn)) && cb() +``` + +* All variables should be declared at the beginning of the block in alphabetical order +```js +// CORRECT +function foo () { + const foo ='bar' + const bar ='foo' + + if (conditional) {} + + ... + + return foo +} + +// INCORRECT + +function foo () { + const foo ='bar' + + if (conditional) {} + + const bar ='foo' + + ... + + return foo +} +``` + +* Return as soon as possible +```js +// CORRECT +if (condition) return'foo' +if (condition2) return'bar' +// Return must have a blank line above +return'fizz' + +// INCORRECT +const variable ='' + +if (condition) { + variable ='foo' +} else if (condition2) { + variable ='bar' +} else { + variable ='fizz' +} + +return variable +``` + +## How to contribute documents + +## How to become Luckysheet Committer + +As long as anyone contributes to the Luckysheet project, you are the officially recognized Contributor of the Luckysheet project. There is no exact standard for growing from Contributor to Committer, and there is no expected timetable, but Committer candidates are generally A long-term active contributor, becoming Committer does not require a huge architectural improvement contribution, or how many lines of code contributions, contributing code, contributing documents, participating in mailing list discussions, helping to answer questions, etc., are all ways to increase their influence . + +List of potential contributions (in no particular order): + +* Submit the bugs, features, and improvements you found to the issue +* Update the official documents so that the project documents are the most recent, the best practices for writing Luckysheet, and various useful documents for the users +* Perform test and report test results, performance test and other MQ performance comparison test, etc. +* Review the work of others (including code and non-code) and publish your own suggestions +* Guide new contributors and be familiar with the community process +* Post a blog about Luckysheet +* Any contribution to the development of the Luckysheet community +* ...... diff --git a/docs/guide/data.md b/docs/guide/data.md index bbd2c8931..9e8d41cad 100644 --- a/docs/guide/data.md +++ b/docs/guide/data.md @@ -1,809 +1,809 @@ -# Table Data - -## Get table data - -- **Configuration**: - - Configure the address of `updateUrl`, Luckysheet will request the table data through ajax. By default, all `data` in the sheet data with status 1 is loaded, and the rest of the sheet loads all fields except the `data` field. - -- **Format**: - Through the global method `luckysheet.getluckysheetfile()`, the configuration information of all worksheets can be obtained. - - The luckysheetfile example is as follows: - ```json - [ - { - "name": "Cell", //Worksheet name - "color": "", //Worksheet color - "index": "0", //Worksheet index - "status": "1", //Activation status - "order": "0", //The order of the worksheet - "hide": 0,//whether to hide - "row": 36, //number of rows - "column": 18, //Number of columns - "config": { - "merge":{}, //merged cells - "rowlen":{}, //Table row height - "columnlen":{}, //Table column width - "rowhidden":{}, //hidden rows - "colhidden":{}, //hidden columns - "borderInfo":{}, //borders - }, - "celldata": [], //initialize the cell data - "data": [], //Update and store the cell data - "scrollLeft": 0, //Left and right scroll bar position - "scrollTop": 315, //Up and down scroll bar position - "luckysheet_select_save": [], //selected area - "luckysheet_conditionformat_save": {},//Conditional format - "calcChain": [],//Formula chain - "isPivotTable":false,//Whether to pivot table - "pivotTable":{},//Pivot table configuration - "filter_select": null,//Filter range - "filter": null,//Filter configuration - "luckysheet_alternateformat_save": [], //Alternate colors - "luckysheet_alternateformat_save_modelCustom": [], //Customize alternate colors - "chart": [], //Chart configuration - "visibledatarow": [], //The position of all rows - "visibledatacolumn": [], //The position of all columns - "ch_width": 2322, //The width of the worksheet area - "rh_height": 949, //The height of the worksheet area - }, - { - "name": "Sheet2", - "color": "", - "status": "0", - "order": "1", - "data": [], - "config": {}, - "index": 1 - }, - { - "name": "Sheet3", - "color": "", - "status": "0", - "order": "2", - "data": [], - "config": {}, - "index": 2 - } - ] - ``` -- **Explanation**: - - ## name - - Type:String - - Default:"Sheet1" - - Usage:Worksheet name - - ------------ - ## color - - Type:String - - Default:"##f20e0e" - - Usage:Worksheet color, there will be a bottom border under the worksheet name - - ------------ - ## index - - Type:Number - - Default:0 - - Usage:Worksheet index, starting from 0 - - ------------ - ## status - - Type:Number - - Default:1 - - Usage:Active state, there is only one active worksheet which number will be 1 and the other worksheets are 0 - - ------------ - ## order - - Type:Number - - Default:0 - - Usage: The index of the worksheets is starting from 0. it will increase when a worksheet is added. - - ------------ - ## hide - - Type:Number - - Default:0 - - Usage: Whether to hide, `0` means not to hide, `1` means to hide - - ------------ - ## row - - Type:Number - - Default:36 - - Usage: The number of cell rows - - ------------ - ## column - - Type:Number - - Default:18 - - Usage: The number of cell columns - - ------------ - ## scrollLeft - - Type:Number - - Default:0 - - Usage: Left and right scroll bar position - - ------------ - ## scrollTop - - Type:Number - - Default:0 - - Usage: Up and down scroll bar position - - ------------ - ## config - - Type: Object - - Default: {} - - Usage: Table row height, column width, merged cells, borders, hidden rows and other settings - - ### config.merge - - Type:Object - - Default:{} - - Usage:Merge cell settings - - example: - ```js - { - "13_5": { - "r": 13, - "c": 5, - "rs": 3, - "cs": 1 - }, - "13_7": { - "r": 13, - "c": 7, - "rs": 3, - "cs": 2 - }, - "14_2": { - "r": 14, - "c": 2, - "rs": 1, - "cs": 2 - } - } - ``` - The `key` in the object is the spliced value of `r +'_' + c`, and the `value` is the cell information in the upper left corner: r: number of rows, c: number of columns, rs: number of merged rows, cs: merge Number of columns - - ### config.rowlen - - Type:Object - - Default:{} - - Usage:The row height of each cell - - example: - ```js - "rowlen": { - "0": 20, - "1": 20, - "2": 20 - } - ``` - - ### config.columnlen - - Type:Object - - Default:{} - - Usage:The column width of each cell - - example: - ```js - "columnlen": { - "0": 97, - "1": 115, - "2": 128 - } - ``` - - ### config.rowhidden - - Type:Object - - Default:{} - - Usage:Hidden row information, Rows:`rowhidden[Rows]: 0`, - - you should specify the number of rows by `key`,`value` is always `0` - - example: - ```js - "rowhidden": { - "30": 0, - "31": 0 - } - ``` - - ### config.colhidden - - Type:Object - - Default:{} - - Usage:Hidden column information, Columns:`colhidden[Columns]: 0`, - - `key` specify the number of columns,`value` is always `0` - - example: - ```js - "colhidden": { - "30": 0, - "31": 0 - } - ``` - - ### config.borderInfo - - Type:Array - - Default:{} - - Usage:The border information of the cell - - example: - ```js - "borderInfo": [{ - "rangeType": "cell", - "value": { - "row_index": 3, - "col_index": 3, - "l": { - "style": 10, - "color": "rgb(255, 0, 0)" - }, - "r": { - "style": 10, - "color": "rgb(255, 0, 0)" - }, - "t": { - "style": 10, - "color": "rgb(255, 0, 0)" - }, - "b": { - "style": 10, - "color": "rgb(255, 0, 0)" - } - } - }, - { - "rangeType": "range", - "borderType": "border-all", - "style": "3", - "color": "#0000ff", - "range": [{ - "row": [7, 8], - "column": [2, 3] - }] - }, { - "rangeType": "range", - "borderType": "border-inside", - "style": "3", - "color": "#0000ff", - "range": [{ - "row": [7, 8], - "column": [8, 9] - }] - }] - ``` - The range type can be divided into single cell and selected area - 1. selection `rangeType: "range"` - - + Border type `borderType:"border-left" | "border-right" | "border-top" | "border-bottom" | "border-all" | "border-outside" | "border-inside" | "border-horizontal" | "border-vertical" | "border-none"`, - + Border thickness `style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick` - + Border color `color: Hexadecimal color value` - + Selection area `range: Row and column information array` - - 2. Single cell `rangeType:"cell"` - + Number of rows and columns `value.row_index: number,value.col_index: number` - + Four border objects `value.l:Left border,value.r:Right border,value.t:Top border,value.b:Bottom border` - + Border thickness `value.l.style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick` - + Border color `value.l.color: Hexadecimal color value` - - - 示例 - + ```js - { - "rangeType": "range", - "borderType": "border-all", - "style": "3", - "color": "#0000ff", - "range": [{ - "row": [7, 8], - "column": [2, 3] - }] - } - ``` - Represents a selection with a setting range of `{"row": [7, 8], "column": [2, 3]}`, the type is all borders, the border thickness is `Dotted`, and the color is `"#0000ff"` - - + ```js - { - "rangeType": "cell", - "value": { - "row_index": 3, - "col_index": 3, - "l": { - "style": 10, - "color": "rgb(255, 0, 0)" - }, - "r": { - "style": 10, - "color": "rgb(255, 0, 0)" - }, - "t": { - "style": 10, - "color": "rgb(255, 0, 0)" - }, - "b": { - "style": 10, - "color": "rgb(255, 0, 0)" - } - } - } - ``` - Means to set the cell `"D4"`, the upper border/lower border/left border/right border are all border thicknesses `"MediumDashDot"`, color is `"rgb(255, 0, 0)"` - - ------------ - ## celldata - - Type:Array - - Default:[] - - Usage: The original cell data set is a set containing `{r:0,c:0,v:{m:"value",v:"value",ct: {fa: "General", t: "g"}} }`The one-dimensional array of format cell information is only used during initialization. After the table is initialized with celldata, the data is converted to the same level field data in the luckysheetfile, such as `luckysheetfile[0].data`, the subsequent operation of the table Data update will be updated to this data field, and celldata is no longer used. Example: - ```js - [{ - "r": 0, - "c": 0, - "v": { - ct: {fa: "General", t: "g"}, - m:"value1", - v:"value1" - } - }, { - "r": 0, - "c": 1, - "v": { - ct: {fa: "General", t: "g"}, - m:"value2", - v:"value2" - } - }] - ``` - - ------------ - ## luckysheet_select_save - - Type:Array - - Default:[] - - Usage: The selected area supports multiple selections and is a one-dimensional array containing multiple selection objects. Example: - ```js - [ - { - "left": 0, - "width": 97, - "top": 0, - "height": 20, - "left_move": 0, - "width_move": 97, - "top_move": 0, - "height_move": 41, - "row": [ 0, 1 ], - "column": [ 0, 0 ], - "row_focus": 0, - "column_focus": 0 - }, - { - "left": 98, - "width": 73, - "top": 63, - "height": 20, - "left_move": 98, - "width_move": 189, - "top_move": 63, - "height_move": 41, - "row": [ 3, 4 ], - "column": [ 1, 2 ], - "row_focus": 3, - "column_focus": 1 - }, - { - "left": 288, - "width": 128, - "top": 21, - "height": 20, - "left_move": 288, - "width_move": 128, - "top_move": 21, - "height_move": 62, - "row": [ 1, 3 ], - "column": [ 3, 3 ], - "row_focus": 1, - "column_focus": 3 - } - ] - ``` - - ------------ - ## luckysheet_conditionformat_save - - Type:Array - - Default:[] - - Usage: Conditional format configuration information, a one-dimensional array containing multiple conditional format configuration objects, - - type: "default": Highlight cell rules and project selection rules, - - "dataBar": Data bar, - - "icons": Icon set, - - "colorGradation": Color scale - - Example: - ```js - [ - { - "type": "default", - "cellrange": [ - { - "row": [ 2, 7 ], - "column": [ 2, 2 ] - } - ], - "format": { - "textColor": "#000000", - "cellColor": "#ff0000" - }, - "conditionName": "betweenness", - "conditionRange": [ - { - "row": [ 4, 4 ], - "column": [ 2, 2 ] - }, - { - "row": [ 6, 6 ], - "column": [ 2, 2 ] - } - ], - "conditionValue": [ 2, 4 - ] - }, - { - "type": "dataBar", - "cellrange": [ - { - "row": [ 10, 15 ], - "column": [ 10, 11 ] - } - ], - "format": [ - "#6aa84f", - "#ffffff" - ] - }, - { - "type": "icons", - "cellrange": [ - { - "row": [ 19, 23 ], - "column": [ 2, 2 ] - } - ], - "format": { - "len": "3", - "leftMin": "0", - "top": "0" - } - }, - { - "type": "colorGradation", - "cellrange": [ - { - "left": 422, - "width": 100, - "top": 210, - "height": 20, - "left_move": 422, - "width_move": 100, - "top_move": 210, - "height_move": 125, - "row": [ 10, 15 ], - "column": [ 6, 6 ], - "row_focus": 10, - "column_focus": 6 - } - ], - "format": [ - "rgb(99, 190, 123)", - "rgb(255, 235, 132)", - "rgb(248, 105, 107)" - ] - } - ] - ``` - - ------------ - ## calcChain - - Type:Array - - Default:[] - - Usage:Formula chain, used when the cell linked by the formula is changed, all formulas referencing this cell will be refreshed, example: - ```js - [{ - "r": 6, - "c": 3, - "index": 1, - "func": [true, 23.75, "=AVERAGE(D3:D6)"], - "color": "w", - "parent": null, - "chidren": {}, - "times": 0 - }, { - "r": 7, - "c": 3, - "index": 1, - "func": [true, 30, "=MAX(D3:D6)"], - "color": "w", - "parent": null, - "chidren": {}, - "times": 0 - }] - ``` - - ------------ - ## isPivotTable - - Type:Boolean - - Default:false - - Usage: Whether PivotTable - - ------------ - ## pivotTable - - Type:Object - - Default:{} - - Usage: Pivot table settings, example: - ```js - { - "pivot_select_save": { - "left": 0, - "width": 73, - "top": 0, - "height": 19, - "left_move": 0, - "width_move": 369, - "top_move": 0, - "height_move": 259, - "row": [0, 12], - "column": [0, 4], - "row_focus": 0, - "column_focus": 0 - }, - "pivotDataSheetIndex": 6, //The sheet index where the source data is located - "column": [{ - "index": 3, - "name": "subject", - "fullname": "subject" - }], - "row": [{ - "index": 1, - "name": "student", - "fullname": "student" - }], - "filter": [], - "values": [{ - "index": 4, - "name": "score", - "fullname": "count:score", - "sumtype": "COUNTA", - "nameindex": 0 - }], - "showType": "column", - "pivotDatas": [ - ["count:score", "science", "mathematics", "foreign language", "English", "total"], - ["Alex", 1, 1, 1, 1, 4], - ["Joy", 1, 1, 1, 1, 4], - ["Tim", 1, 1, 1, 1, 4], - ["total", 3, 3, 3, 3, 12] - ], - "drawPivotTable": false, - "pivotTableBoundary": [5, 6] - } - ``` - - ------------ - ## filter_select - - Type:Object - - Default:{} - - Usage:Filter range, a selection area, a sheet has only one filter range, similar to the `luckysheet_select_save` example: - ```js - { - "left": 74, - "width": 73, - "top": 40, - "height": 19, - "left_move": 74, - "width_move": 221, - "top_move": 40, - "height_move": 99, - "row": [ - 2, - 6 - ], - "column": [ - 1, - 3 - ], - "row_focus": 2, - "column_focus": 1 - } - ``` - - ------------ - ## filter - - Type:Object - - Default:{} - - Usage: Specific settings for filtering, examples: - ```js - { - "0": { - "caljs": {}, - "rowhidden": { - "3": 0, - "4": 0 - }, - "optionstate": true, - "str": 2, - "edr": 6, - "cindex": 1, - "stc": 1, - "edc": 3 - }, - "1": { - "caljs": {}, - "rowhidden": { - "6": 0 - }, - "optionstate": true, - "str": 2, - "edr": 6, - "cindex": 2, - "stc": 1, - "edc": 3 - } - } - ``` - - ------------ - ## luckysheet_alternateformat_save - - Type:Array - - Default:[] - - Usage: Alternating color configuration, example: - ```js - [{ - "cellrange": { - "row": [1, 6], - "column": [1, 5] - }, - "format": { - "head": { - "fc": "#000", - "bc": "#5ed593" - }, - "one": { - "fc": "#000", - "bc": "#ffffff" - }, - "two": { - "fc": "#000", - "bc": "#e5fbee" - }, - "foot": { - "fc": "#000", - "bc": "#a5efcc" - } - }, - "hasRowHeader": false, - "hasRowFooter": false - }, { - "cellrange": { - "row": [1, 6], - "column": [8, 12] - }, - "format": { - "head": { - "fc": "#000", - "bc": "#5599fc" - }, - "one": { - "fc": "#000", - "bc": "#ffffff" - }, - "two": { - "fc": "#000", - "bc": "#ecf2fe" - }, - "foot": { - "fc": "#000", - "bc": "#afcbfa" - } - }, - "hasRowHeader": false, - "hasRowFooter": false - }] - ``` - - ------------ - ## luckysheet_alternateformat_save_modelCustom - - Type:Array - - Default:[] - - Usage:Custom alternate colors, including multiple custom alternate colors configuration, example: - ```js - [{ - "head": { - "fc": "#6aa84f", - "bc": "#ffffff" - }, - "one": { - "fc": "#000", - "bc": "#ffffff" - }, - "two": { - "fc": "#000", - "bc": "#e5fbee" - }, - "foot": { - "fc": "#000", - "bc": "#a5efcc" - } - }] - ``` - - ------------ - ## chart - - Type:Array - - Default:[] - - Usage: Chart configuration (under development) - - ------------ - ## visibledatarow - - Type:Number - - Default:[] - - Usage: Position information of all rows, incremental row position data, No need to set up for initialization - - ------------ - ## visibledatacolumn - - Type:Number - - Default:[] - - Usage: Position information of all columns, incremental column position data, No need to set up for initialization - - ------------ - ## ch_width - - Type:Number - - Default:2322 - - Usage:The width of the entire worksheet area (the gray area including the border), No need to set up for initialization - - ------------ - ## rh_height - - Type:Number - - Default:2322 - - Usage:The height of the entire worksheet area (the gray area containing the border), No need to set up for initialization - - ------------ - -## Get sheet data - -- **Configuration**: - - Configure the address of `loadSheetUrl`, the parameters are `gridKey` (table primary key) and `index` (sheet primary key collection, format is `[1,2,3]`), the returned data is the `data` field set of sheet - -- **Format**: - - ```json - { - "1": [{r:0, c:1, v:"value 1"},{r:10, c:11, v:"value 2"}], - "2": [data], - "3": [data], - } - ``` -- **Explanation**: - - `r` stands for row, `c` stands for column, and `v` stands for the value of the cell. The value can be a character, number, or json string. - - The data will only be loaded once, generally speaking, there is only one primary key, but considering that some formulas, charts and pivot tables will refer to the data of other sheets, the front desk will add a judgment, if the current sheet refers to the data of other sheets, then complete the data of the referenced sheet together. - -## Update data - -- **Configuration**: - - Configure the address of `updateUrl`, and the parameter sent to the backend is a json string. - -- **Format**: - - ```json - { - compress: false, - gridKey:10004, - data: [update data] - } - ``` - -- **Explanation**: - - | Parameter | Explanation | Example | - | ------------ | ------------ | ------------ | - | compress | Luckysheet uses client pako for zlib parameter compression, which is true if the browser supports compression, otherwise false. The backend can decide whether to decompress the data content based on this parameter | The process of obtaining parameters on the server side: 1. Serialize json string 2. Decode the data field if the compress field is TRUE 3. Decode the data string URLDecoder.decode(utf-8) | - | gridKey | Luckysheet file identifier | none | - | data | An array containing updated data. For the parameter format in the array, please see the introduction below. In the example: `t` indicates the update type, `i` is the index of the sheet, `c` is the row number, `r` is the column number, and `v` is the value | `data: [{ t : 'cell', i:0, c : 0, r : 0 , v: 2 }]` | +# Table Data + +## Get table data + +- **Configuration**: + + Configure the address of `updateUrl`, Luckysheet will request the table data through ajax. By default, all `data` in the sheet data with status 1 is loaded, and the rest of the sheet loads all fields except the `data` field. + +- **Format**: + Through the global method `luckysheet.getluckysheetfile()`, the configuration information of all worksheets can be obtained. + + The luckysheetfile example is as follows: + ```json + [ + { + "name": "Cell", //Worksheet name + "color": "", //Worksheet color + "index": "0", //Worksheet index + "status": "1", //Activation status + "order": "0", //The order of the worksheet + "hide": 0,//whether to hide + "row": 36, //number of rows + "column": 18, //Number of columns + "config": { + "merge":{}, //merged cells + "rowlen":{}, //Table row height + "columnlen":{}, //Table column width + "rowhidden":{}, //hidden rows + "colhidden":{}, //hidden columns + "borderInfo":{}, //borders + }, + "celldata": [], //initialize the cell data + "data": [], //Update and store the cell data + "scrollLeft": 0, //Left and right scroll bar position + "scrollTop": 315, //Up and down scroll bar position + "luckysheet_select_save": [], //selected area + "luckysheet_conditionformat_save": {},//Conditional format + "calcChain": [],//Formula chain + "isPivotTable":false,//Whether to pivot table + "pivotTable":{},//Pivot table configuration + "filter_select": null,//Filter range + "filter": null,//Filter configuration + "luckysheet_alternateformat_save": [], //Alternate colors + "luckysheet_alternateformat_save_modelCustom": [], //Customize alternate colors + "chart": [], //Chart configuration + "visibledatarow": [], //The position of all rows + "visibledatacolumn": [], //The position of all columns + "ch_width": 2322, //The width of the worksheet area + "rh_height": 949, //The height of the worksheet area + }, + { + "name": "Sheet2", + "color": "", + "status": "0", + "order": "1", + "data": [], + "config": {}, + "index": 1 + }, + { + "name": "Sheet3", + "color": "", + "status": "0", + "order": "2", + "data": [], + "config": {}, + "index": 2 + } + ] + ``` +- **Explanation**: + + ## name + - Type:String + - Default:"Sheet1" + - Usage:Worksheet name + + ------------ + ## color + - Type:String + - Default:"##f20e0e" + - Usage:Worksheet color, there will be a bottom border under the worksheet name + + ------------ + ## index + - Type:Number + - Default:0 + - Usage:Worksheet index, starting from 0 + + ------------ + ## status + - Type:Number + - Default:1 + - Usage:Active state, there is only one active worksheet which number will be 1 and the other worksheets are 0 + + ------------ + ## order + - Type:Number + - Default:0 + - Usage: The index of the worksheets is starting from 0. it will increase when a worksheet is added. + + ------------ + ## hide + - Type:Number + - Default:0 + - Usage: Whether to hide, `0` means not to hide, `1` means to hide + + ------------ + ## row + - Type:Number + - Default:36 + - Usage: The number of cell rows + + ------------ + ## column + - Type:Number + - Default:18 + - Usage: The number of cell columns + + ------------ + ## scrollLeft + - Type:Number + - Default:0 + - Usage: Left and right scroll bar position + + ------------ + ## scrollTop + - Type:Number + - Default:0 + - Usage: Up and down scroll bar position + + ------------ + ## config + - Type: Object + - Default: {} + - Usage: Table row height, column width, merged cells, borders, hidden rows and other settings + + ### config.merge + - Type:Object + - Default:{} + - Usage:Merge cell settings + - example: + ```js + { + "13_5": { + "r": 13, + "c": 5, + "rs": 3, + "cs": 1 + }, + "13_7": { + "r": 13, + "c": 7, + "rs": 3, + "cs": 2 + }, + "14_2": { + "r": 14, + "c": 2, + "rs": 1, + "cs": 2 + } + } + ``` + The `key` in the object is the spliced value of `r +'_' + c`, and the `value` is the cell information in the upper left corner: r: number of rows, c: number of columns, rs: number of merged rows, cs: merge Number of columns + + ### config.rowlen + - Type:Object + - Default:{} + - Usage:The row height of each cell + - example: + ```js + "rowlen": { + "0": 20, + "1": 20, + "2": 20 + } + ``` + + ### config.columnlen + - Type:Object + - Default:{} + - Usage:The column width of each cell + - example: + ```js + "columnlen": { + "0": 97, + "1": 115, + "2": 128 + } + ``` + + ### config.rowhidden + - Type:Object + - Default:{} + - Usage:Hidden row information, Rows:`rowhidden[Rows]: 0`, + + you should specify the number of rows by `key`,`value` is always `0` + - example: + ```js + "rowhidden": { + "30": 0, + "31": 0 + } + ``` + + ### config.colhidden + - Type:Object + - Default:{} + - Usage:Hidden column information, Columns:`colhidden[Columns]: 0`, + + `key` specify the number of columns,`value` is always `0` + - example: + ```js + "colhidden": { + "30": 0, + "31": 0 + } + ``` + + ### config.borderInfo + - Type:Array + - Default:{} + - Usage:The border information of the cell + - example: + ```js + "borderInfo": [{ + "rangeType": "cell", + "value": { + "row_index": 3, + "col_index": 3, + "l": { + "style": 10, + "color": "rgb(255, 0, 0)" + }, + "r": { + "style": 10, + "color": "rgb(255, 0, 0)" + }, + "t": { + "style": 10, + "color": "rgb(255, 0, 0)" + }, + "b": { + "style": 10, + "color": "rgb(255, 0, 0)" + } + } + }, + { + "rangeType": "range", + "borderType": "border-all", + "style": "3", + "color": "#0000ff", + "range": [{ + "row": [7, 8], + "column": [2, 3] + }] + }, { + "rangeType": "range", + "borderType": "border-inside", + "style": "3", + "color": "#0000ff", + "range": [{ + "row": [7, 8], + "column": [8, 9] + }] + }] + ``` + The range type can be divided into single cell and selected area + 1. selection `rangeType: "range"` + + + Border type `borderType:"border-left" | "border-right" | "border-top" | "border-bottom" | "border-all" | "border-outside" | "border-inside" | "border-horizontal" | "border-vertical" | "border-none"`, + + Border thickness `style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick` + + Border color `color: Hexadecimal color value` + + Selection area `range: Row and column information array` + + 2. Single cell `rangeType:"cell"` + + Number of rows and columns `value.row_index: number,value.col_index: number` + + Four border objects `value.l:Left border,value.r:Right border,value.t:Top border,value.b:Bottom border` + + Border thickness `value.l.style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick` + + Border color `value.l.color: Hexadecimal color value` + + - 示例 + + ```js + { + "rangeType": "range", + "borderType": "border-all", + "style": "3", + "color": "#0000ff", + "range": [{ + "row": [7, 8], + "column": [2, 3] + }] + } + ``` + Represents a selection with a setting range of `{"row": [7, 8], "column": [2, 3]}`, the type is all borders, the border thickness is `Dotted`, and the color is `"#0000ff"` + + + ```js + { + "rangeType": "cell", + "value": { + "row_index": 3, + "col_index": 3, + "l": { + "style": 10, + "color": "rgb(255, 0, 0)" + }, + "r": { + "style": 10, + "color": "rgb(255, 0, 0)" + }, + "t": { + "style": 10, + "color": "rgb(255, 0, 0)" + }, + "b": { + "style": 10, + "color": "rgb(255, 0, 0)" + } + } + } + ``` + Means to set the cell `"D4"`, the upper border/lower border/left border/right border are all border thicknesses `"MediumDashDot"`, color is `"rgb(255, 0, 0)"` + + ------------ + ## celldata + - Type:Array + - Default:[] + - Usage: The original cell data set is a set containing `{r:0,c:0,v:{m:"value",v:"value",ct: {fa: "General", t: "g"}} }`The one-dimensional array of format cell information is only used during initialization. After the table is initialized with celldata, the data is converted to the same level field data in the luckysheetfile, such as `luckysheetfile[0].data`, the subsequent operation of the table Data update will be updated to this data field, and celldata is no longer used. Example: + ```js + [{ + "r": 0, + "c": 0, + "v": { + ct: {fa: "General", t: "g"}, + m:"value1", + v:"value1" + } + }, { + "r": 0, + "c": 1, + "v": { + ct: {fa: "General", t: "g"}, + m:"value2", + v:"value2" + } + }] + ``` + + ------------ + ## luckysheet_select_save + - Type:Array + - Default:[] + - Usage: The selected area supports multiple selections and is a one-dimensional array containing multiple selection objects. Example: + ```js + [ + { + "left": 0, + "width": 97, + "top": 0, + "height": 20, + "left_move": 0, + "width_move": 97, + "top_move": 0, + "height_move": 41, + "row": [ 0, 1 ], + "column": [ 0, 0 ], + "row_focus": 0, + "column_focus": 0 + }, + { + "left": 98, + "width": 73, + "top": 63, + "height": 20, + "left_move": 98, + "width_move": 189, + "top_move": 63, + "height_move": 41, + "row": [ 3, 4 ], + "column": [ 1, 2 ], + "row_focus": 3, + "column_focus": 1 + }, + { + "left": 288, + "width": 128, + "top": 21, + "height": 20, + "left_move": 288, + "width_move": 128, + "top_move": 21, + "height_move": 62, + "row": [ 1, 3 ], + "column": [ 3, 3 ], + "row_focus": 1, + "column_focus": 3 + } + ] + ``` + + ------------ + ## luckysheet_conditionformat_save + - Type:Array + - Default:[] + - Usage: Conditional format configuration information, a one-dimensional array containing multiple conditional format configuration objects, + + type: "default": Highlight cell rules and project selection rules, + + "dataBar": Data bar, + + "icons": Icon set, + + "colorGradation": Color scale + + Example: + ```js + [ + { + "type": "default", + "cellrange": [ + { + "row": [ 2, 7 ], + "column": [ 2, 2 ] + } + ], + "format": { + "textColor": "#000000", + "cellColor": "#ff0000" + }, + "conditionName": "betweenness", + "conditionRange": [ + { + "row": [ 4, 4 ], + "column": [ 2, 2 ] + }, + { + "row": [ 6, 6 ], + "column": [ 2, 2 ] + } + ], + "conditionValue": [ 2, 4 + ] + }, + { + "type": "dataBar", + "cellrange": [ + { + "row": [ 10, 15 ], + "column": [ 10, 11 ] + } + ], + "format": [ + "#6aa84f", + "#ffffff" + ] + }, + { + "type": "icons", + "cellrange": [ + { + "row": [ 19, 23 ], + "column": [ 2, 2 ] + } + ], + "format": { + "len": "3", + "leftMin": "0", + "top": "0" + } + }, + { + "type": "colorGradation", + "cellrange": [ + { + "left": 422, + "width": 100, + "top": 210, + "height": 20, + "left_move": 422, + "width_move": 100, + "top_move": 210, + "height_move": 125, + "row": [ 10, 15 ], + "column": [ 6, 6 ], + "row_focus": 10, + "column_focus": 6 + } + ], + "format": [ + "rgb(99, 190, 123)", + "rgb(255, 235, 132)", + "rgb(248, 105, 107)" + ] + } + ] + ``` + + ------------ + ## calcChain + - Type:Array + - Default:[] + - Usage:Formula chain, used when the cell linked by the formula is changed, all formulas referencing this cell will be refreshed, example: + ```js + [{ + "r": 6, + "c": 3, + "index": 1, + "func": [true, 23.75, "=AVERAGE(D3:D6)"], + "color": "w", + "parent": null, + "chidren": {}, + "times": 0 + }, { + "r": 7, + "c": 3, + "index": 1, + "func": [true, 30, "=MAX(D3:D6)"], + "color": "w", + "parent": null, + "chidren": {}, + "times": 0 + }] + ``` + + ------------ + ## isPivotTable + - Type:Boolean + - Default:false + - Usage: Whether PivotTable + + ------------ + ## pivotTable + - Type:Object + - Default:{} + - Usage: Pivot table settings, example: + ```js + { + "pivot_select_save": { + "left": 0, + "width": 73, + "top": 0, + "height": 19, + "left_move": 0, + "width_move": 369, + "top_move": 0, + "height_move": 259, + "row": [0, 12], + "column": [0, 4], + "row_focus": 0, + "column_focus": 0 + }, + "pivotDataSheetIndex": 6, //The sheet index where the source data is located + "column": [{ + "index": 3, + "name": "subject", + "fullname": "subject" + }], + "row": [{ + "index": 1, + "name": "student", + "fullname": "student" + }], + "filter": [], + "values": [{ + "index": 4, + "name": "score", + "fullname": "count:score", + "sumtype": "COUNTA", + "nameindex": 0 + }], + "showType": "column", + "pivotDatas": [ + ["count:score", "science", "mathematics", "foreign language", "English", "total"], + ["Alex", 1, 1, 1, 1, 4], + ["Joy", 1, 1, 1, 1, 4], + ["Tim", 1, 1, 1, 1, 4], + ["total", 3, 3, 3, 3, 12] + ], + "drawPivotTable": false, + "pivotTableBoundary": [5, 6] + } + ``` + + ------------ + ## filter_select + - Type:Object + - Default:{} + - Usage:Filter range, a selection area, a sheet has only one filter range, similar to the `luckysheet_select_save` example: + ```js + { + "left": 74, + "width": 73, + "top": 40, + "height": 19, + "left_move": 74, + "width_move": 221, + "top_move": 40, + "height_move": 99, + "row": [ + 2, + 6 + ], + "column": [ + 1, + 3 + ], + "row_focus": 2, + "column_focus": 1 + } + ``` + + ------------ + ## filter + - Type:Object + - Default:{} + - Usage: Specific settings for filtering, examples: + ```js + { + "0": { + "caljs": {}, + "rowhidden": { + "3": 0, + "4": 0 + }, + "optionstate": true, + "str": 2, + "edr": 6, + "cindex": 1, + "stc": 1, + "edc": 3 + }, + "1": { + "caljs": {}, + "rowhidden": { + "6": 0 + }, + "optionstate": true, + "str": 2, + "edr": 6, + "cindex": 2, + "stc": 1, + "edc": 3 + } + } + ``` + + ------------ + ## luckysheet_alternateformat_save + - Type:Array + - Default:[] + - Usage: Alternating color configuration, example: + ```js + [{ + "cellrange": { + "row": [1, 6], + "column": [1, 5] + }, + "format": { + "head": { + "fc": "#000", + "bc": "#5ed593" + }, + "one": { + "fc": "#000", + "bc": "#ffffff" + }, + "two": { + "fc": "#000", + "bc": "#e5fbee" + }, + "foot": { + "fc": "#000", + "bc": "#a5efcc" + } + }, + "hasRowHeader": false, + "hasRowFooter": false + }, { + "cellrange": { + "row": [1, 6], + "column": [8, 12] + }, + "format": { + "head": { + "fc": "#000", + "bc": "#5599fc" + }, + "one": { + "fc": "#000", + "bc": "#ffffff" + }, + "two": { + "fc": "#000", + "bc": "#ecf2fe" + }, + "foot": { + "fc": "#000", + "bc": "#afcbfa" + } + }, + "hasRowHeader": false, + "hasRowFooter": false + }] + ``` + + ------------ + ## luckysheet_alternateformat_save_modelCustom + - Type:Array + - Default:[] + - Usage:Custom alternate colors, including multiple custom alternate colors configuration, example: + ```js + [{ + "head": { + "fc": "#6aa84f", + "bc": "#ffffff" + }, + "one": { + "fc": "#000", + "bc": "#ffffff" + }, + "two": { + "fc": "#000", + "bc": "#e5fbee" + }, + "foot": { + "fc": "#000", + "bc": "#a5efcc" + } + }] + ``` + + ------------ + ## chart + - Type:Array + - Default:[] + - Usage: Chart configuration (under development) + + ------------ + ## visibledatarow + - Type:Number + - Default:[] + - Usage: Position information of all rows, incremental row position data, No need to set up for initialization + + ------------ + ## visibledatacolumn + - Type:Number + - Default:[] + - Usage: Position information of all columns, incremental column position data, No need to set up for initialization + + ------------ + ## ch_width + - Type:Number + - Default:2322 + - Usage:The width of the entire worksheet area (the gray area including the border), No need to set up for initialization + + ------------ + ## rh_height + - Type:Number + - Default:2322 + - Usage:The height of the entire worksheet area (the gray area containing the border), No need to set up for initialization + + ------------ + +## Get sheet data + +- **Configuration**: + + Configure the address of `loadSheetUrl`, the parameters are `gridKey` (table primary key) and `index` (sheet primary key collection, format is `[1,2,3]`), the returned data is the `data` field set of sheet + +- **Format**: + + ```json + { + "1": [{r:0, c:1, v:"value 1"},{r:10, c:11, v:"value 2"}], + "2": [data], + "3": [data], + } + ``` +- **Explanation**: + + `r` stands for row, `c` stands for column, and `v` stands for the value of the cell. The value can be a character, number, or json string. + + The data will only be loaded once, generally speaking, there is only one primary key, but considering that some formulas, charts and pivot tables will refer to the data of other sheets, the front desk will add a judgment, if the current sheet refers to the data of other sheets, then complete the data of the referenced sheet together. + +## Update data + +- **Configuration**: + + Configure the address of `updateUrl`, and the parameter sent to the backend is a json string. + +- **Format**: + + ```json + { + compress: false, + gridKey:10004, + data: [update data] + } + ``` + +- **Explanation**: + + | Parameter | Explanation | Example | + | ------------ | ------------ | ------------ | + | compress | Luckysheet uses client pako for zlib parameter compression, which is true if the browser supports compression, otherwise false. The backend can decide whether to decompress the data content based on this parameter | The process of obtaining parameters on the server side: 1. Serialize json string 2. Decode the data field if the compress field is TRUE 3. Decode the data string URLDecoder.decode(utf-8) | + | gridKey | Luckysheet file identifier | none | + | data | An array containing updated data. For the parameter format in the array, please see the introduction below. In the example: `t` indicates the update type, `i` is the index of the sheet, `c` is the row number, `r` is the column number, and `v` is the value | `data: [{ t : 'cell', i:0, c : 0, r : 0 , v: 2 }]` | diff --git a/docs/guide/operate.md b/docs/guide/operate.md index 77c58fd6a..9059daef7 100644 --- a/docs/guide/operate.md +++ b/docs/guide/operate.md @@ -1,903 +1,903 @@ -# Table Operation -`luckysheet` stores all operations in the history to `undo` and `redo`. If `allowupdate` is set to true and `updateURL` is available in initial, operations will be updated on the backend in real-time via webSocket. And every one can edit same sheet on the same time. - ->Source code [`src/controllers/server.js`] (https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/server.js) The module shows us the function of background saving. - -In general, shared editing(or collaborative editing) is controled by the account system created by developers to control permissions. - -The following are all types of operations that support transferring to the background. In this case, I use mongodb as a storage example to explain how front-end and back-end interacts with eachother. - -Pay attention, `i` in the object is the `index` of the sheet rather than `order`. -## Cell refresh -### single cell refresh -- **Format**: - - ```json - { - "t": "v", - "i": "Sheet_0554kKiKl4M7_1597974810804", - "v": { - "v": 233, - "ct": { "fa": "General", "t": "n" }, - "m": "233" - }, - "r": 0, - "c": 1 - } - ``` - -- **Explanation**: - - |Parameter|Explanation| - | ------------ | ------------ | - |t|Operation type symbol| - |i|The index value of the current sheet| - |v|Cell value, refer to [单元格属性表](/zh/guide/cell.html#基本单元格)| - |r|Row number of cell| - |c|The column number of the cell| - -- **Backend update**: - - The cell update is mainly to update the `luckysheetfile[i].celldata` parameter, which is an array: - ```json - [ - {r:0, c:1, v: "value1"}, - {r:10, c:11, v:"value2"}, - {r:10, c:11, v:{f:"=sum", v:"100"}} - ] - ``` - Store the values in all the cells in the sheet, Luckysheet will create a new table data according to the number of rows and columns in `luckysheetfile[i].row` and `luckysheetfile[i].column` when it is created, and then use `data[ r][c]=v` to fill the table data, empty data cells are represented by null. - - When saving the data posted by the frontend, the backend needs to convert the parameters to the format of `{r:0, c:1:v:100}` first, and then update the field of `luckysheetfile[i].celldata`, if the cell exists the cell is updated, if not, it is added, and if the cell exists but `v` is null, the cell is deleted. - -- **Frontend view**: - - You can modify the value of any cell, and then go to the chrome console to view the operation of `"t"=="v"`. - -## Config operation - -- **Format**: - - ```json - { - "t": "cg", - "i": 3, - "v": { - "7": 192 - }, - "k": "rowlen" - } - ``` - -- **Explanation**: - - |Parameter|Explanation| - | ------------ | ------------ | - |t|Operation type symbol| - |i|The index value of the current sheet| - |v|The internal key-value that needs to be updated| - |k|Operation key name| - -- **Backend update**: - - Update `luckysheetfile[i].config.[k][v.key] = v.value`, if `k` does not exist in `config`, then create a new `k` attribute and set it to empty, If there is no `v.key` in `k`, create a new `v.key` and update `v.value`. - - 1. Examples of modifying row height: - - Enter: `{"t":"cg","i":3,"v":{"3":10, "5":70, "10":100},"k":" rowlen"}` - - Update: `luckysheetfile[3].config.["rowlen"]["3"] = 10` - - 2. Examples of modifying column width: - - Enter: `{"t":"cg","i":1,"v":{"20":74, "15":170, "6":40},"k":" columnlen"}` - - Update: `luckysheetfile[1].config.["columnlen"]["20"] = 74` - - 3. Examples of merged cells: - - Enter: `{"t":"cg","i":1,"v":{"5_10":{row:[1,3], column:[3,5]},"k":" merge "}` - - Update: `luckysheetfile[1].config.["merge"]["5_10"] = {row:[1,3], column:[3,5]}` - -## General save - -- **Format**: - - ```json - { - "t": "all", - "i": 3, - "v": { - "v": 1, - "m":1, - }, - "k": "freezen", - "s": false - } - ``` - -- **Explanation**: - - |Parameter|Explanation| - | ------------ | ------------ | - |t|Operation type symbol| - |i|The index value of the current sheet| - |v|The internal key-value that needs to be updated| - |k|The `value` in the key-value that needs to be saved| - |s|If it is `true` then `v` is saved as a string, otherwise it is saved according to the object| - -- **Backend update**: - - `luckysheetfile[3].[k]= v` - If `s` is `true`, it is `luckysheetfile[3].[k]= JSON.stringify(v)` - - 1. Pivot table: - - Enter: `{"t":"all","i":1,"v":{………},"k":"pivotTable", "s": false}` - - Update: `luckysheetfile[1].["pivotTable"] = {………}` - - 2. Freeze rows and columns: - - Enter: `{"t":"all","i":3,"v":{………},"k":"freezen", "s": false}` - - Update: `luckysheetfile[3].["freezen"] = {………}` - - 3. Filter range: - - Enter: `{"t":"all","i":3,"v":{………},"k":"filter_select", "s": true }` - - Update: `luckysheetfile[3].["filter_select"] = JSON.stringify ({………})` - - 4. Sheet name: - - Enter: `{"t":"all","i":1,"v":"doc","k":"name", "s": false}` - - Update: `luckysheetfile[1].["name"] = "doc"` - - 5. Sheet color: - - Enter: `{"t":"all","i":2,"v":"#FFF000","k":"color", "s": false}` - - Update: `luckysheetfile[2].["color"] = "#FFF000"` - -## Function chain operation - -- **Format**: - - ```json - { - "t": "fc", - "i": 0, - "v": { - "r": 3, - "c": 7, - "index": 0, - "func": [ - true, - 187282, - "=SUM(E4:G4)" - ] - }, - "op": "add", - "pos": 0 - } - ``` - -- **Explanation**: - - |Parameter|Explanation| - | ------------ | ------------ | - |t|Operation type symbol| - |i|The index value of the current sheet| - |v|Object value, the internal fields of the object do not need to be updated separately, so save as text| - |op|Operation type, `add` is add, `update` is update, and `del` is delete| - |pos|Updated or deleted function location| - -- **Backend update**: - - calcChain is an array - - If the value of `op` is `add` then add to the end `luckysheetfile[i].calcChain.push (v)`, - - If the value of `op` is `update` then update `luckysheetfile[i].calcChain[pos]= v`, - - If the value of `op` is `del` then delete `luckysheetfile[i].calcChain.splice(pos, 1)`。 - -- **Frontend view**: - - You can modify the value of any cell, and then go to the chrome console to view the operation of `"t"=="v"`. - -## Row and column operations - -### Delete rows or columns - -- **Format**: - - ```json - { - "t": "drc", - "i": 3, - "v": { - "index": 6, - "len": 2 - }, - "rc": "r" - } - ``` - -- **Explanation**: - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterExplanation
tOperation type symbol
iThe index value of the current sheet
rcRow operation or column operation, the value `r` stands for row, and `c` stands for column
vindexDelete from which row or column
lenNumber of rows or columns deleted
- -- **Backend update**: - - If the value of `rc` is `'r'` then delete the row, if the value of `rc` is `'c'` then delete the column, eg `rc='r'`, `index=4`, `len= 5`, means to delete the next 5 lines (4, 5, 6, 7, 8) from the 4th line. - - Mainly operate on the cells in `luckysheetfile[i].celldata`, delete the qualified cells described in the parameters and update the row and column values of other cells. Taking the above as an example, first find the `r` in the cell Delete all the cells with values from 4 to 8, and then subtract the value of 5 from the original cell number 9 and later, and finally subtract 5 from `luckysheetfile[i].row`. - If the `v` value is `"#__qkdelete#"` (without quotes), then this is the cell to be deleted. - -- **Front view**: - - You can delete rows or columns, and then go to the chrome console to view the operation of `"t"=="drc"`. - -### Add rows or columns - -- **Format**: - - ```json - { - "t": "arc", - "i": 0, - "v": { - "index": 5, - "len": 10, - "data": [] - }, - "rc": "c" - } - ``` - -- **Explanation**: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterExplanation
tOperation type symbol
iThe index value of the current sheet
rcRow operation or column operation, the value `r` stands for row, and `c` stands for column
vindexStart from which row or column
lenHow many rows or columns to add
dataNew row or column content
- -- **Backend update**: - - If the value of `rc` is `r`, add a new row. If the value of `rc` is `c`, add a new column. For example, `rc=r, index=4, len=5` then it means increase 5 lines from line 4. If `data` is empty, add an empty line. If `data` is not empty, use the array in `data` to add a new line. - - Mainly operate on the cells in `luckysheetfile[i].celldata`. Taking the above as an example, first add 5 to `luckysheetfile[i].row`, and then add `r` greater than 4 to the entire cell`r `Value +5, if `data` is empty, add an empty line to end, if `data` is not empty, convert the two-dimensional array `data` to `{r:0,c:0,v:100}` Format and added to `celldata`, the pseudo code for conversion is as follows: - - ```javascript - var ret = []; - for(var r=0;r - - Parameter - Explanation - - - t - Operation type symbol - - - i - The index value of the current sheet - - - v - name - The index value of the sheet jumped after hiding - - - color - Sheet color - - - status - Active state - - - order - Sheet order - - - index - Sheet Index - - - celldata - Cell dataset - - - config - Setting - - - pivotTable - Pivot table settings - - - isPivotTable - Whether the pivot table - - - - -- **Backend update**: - - Add a line (a document) to the database. - -### Copy sheet - -- **Format**: - - ```json - { - "t": "shc", - "i": "New sheet location", - "v": { - "copyindex": "copyindex" - } - } - ``` - -- **Backend update**: - - Copy the sheet index value in the table, set it to `copyindex` and add it to the database, set the `index` of the new document to the value corresponding to `i`. - -### Delete sheet - -- **Format**: - - ```json - { - "t": "shd", - "i": null, - "v": { - "deleIndex": 0 - } - } - ``` - -- **Explanation**: - - - - - - - - - - - - - - - - -
ParameterExplanation
tOperation type symbol
vdeleIndexThe sheet index to be deleted
- -- **Backend update**: - - Delete the sheet whose index is the value corresponding to `deleIndex`. - -### restore from a deleted sheet - -- **format**: - - ```json - { - "t": "shre", - "i": null, - "v": { - "reIndex": "0" - } - } - ``` - -- **Explanation**: - - - - - - - - - - - - - - - - -
ParameterExplanation
tOperation type symbol
vdeleIndex需要恢复的sheet索引
- -- **Backend update**: - - restore the sheet whose index is the number of `reIndex`. - -### Position - -- **Format**: - - ```json - { - "t": "shr", - "i": null, - "v": { - "0": 1, - "1": 0, - "2": 2, - "3": 3, - "4": 4, - "5": 5, - "6": 6, - "7": 7, - "Sheet_6az6nei65t1i_1596209937084": 8 - } - } - ``` - -- **Explanation**: - - |Parameter|Explanation| - | ------------ | ------------ | - |t|Operation type symbol| - |v|Set the sorting of Sheet as a key-value pair, `key` represents the index of the sheet, and `value` represents the order value. The format is: `{"1": 3, "2":1, "0": 2, "3":0}`| - -- **Backend update**: - - For the page where the `index` of the sheet is equal to the `key`, set its `order` attribute to the `value`. Examples: - - `luckysheetfile[key1].order = value1` - `luckysheetfile[key2].order = value2` - `luckysheetfile[key3].order = value3` - -### switch to the specified sheet - -- **format**: - - ```json - { - "t": "shs", - "i": null, - "v": 1 - } - ``` - -- **Explanation**: - - |Parameter|Explanation| - | ------------ | ------------ | - |t|Operation type symbol| - |v|index of the specified sheet| - -- **Backend update**: - - setting the `status` = `1`, when the `index` of a sheet is eaqul to `v`: - - `luckysheetfile[v].status = 1` - -## Sheet attributes (hide or show) - -- **Format**: - - ```json - { - "t": "sh", - "i": 0, - "v": 1, - "op": " hide", - "cur": 2 - } - ``` - -- **Explanation**: - - |Parameter|Explanation| - | ------------ | ------------ | - |t|Operation type symbol| - |i|The index value of the current sheet| - |op|Operation options include hide and show| - |v|Hide if `hide` is `1`, show if `0` or empty| - |cur|After hiding, set sheet which index corresponding to the `cur` to the active state| - -- **Backend update**: - - The `hide` field of the root path of the sheet corresponding to `i` is updated to `v`. When hidden, the `status` value is `0`. When displayed, it is `1`. If hidden, the sheet which `cur` corresponds to `index`, its `status` is updated to `1`. - -## Table information change - -### Table name - -- **Format**: - - ```json - { - "t": "na", - "i": null, - "v": "Data" - } - ``` - -- **Explanation**: - - |Parameter|Explanation| - | ------------ | ------------ | - |t|Operation type symbol| - |v|The name of the table| - -- **Backend update**: - - Update the table name in the database according to gridkey. - -### Thumbnail - -- **Format**: - - ```json - { - "t": "thumb", - "img": "base64", - "curindex": "curindx" - } - ``` - -- **Explanation**: - - |Parameter|Explanation| - | ------------ | ------------ | - |t|Operation type symbol| - |img|Thumbnail of current table, base64 string| - |curindex|The current sheet opened by default| - -- **Backend update**: - - According to gridkey, update the thumbnail field of the table in mysql to the img value, and update the status field of the sheet whose index is the curindex value to 1, and set the status value of other sheets to 0. - -## Chart(TODO) - -There are four types of chart operations: add new chart -"add", move chart position-"xy", zoom chart-"wh", and update chart configuration-"update". - -### new chart - -- **format**: - - ```json - { - "t": "c", - "i": 0, - "op":"add", - "v": { - "chart_id": "chart_p145W6i73otw_1596209943446", - "width": 400, - "height": 250, - "left": 20, - "top": 120, - "sheetIndex": "Sheet_6az6nei65t1i_1596209937084", - "needRangeShow": true, - "chartOptions": { - "chart_id": "chart_p145W6i73otw_1596209943446", - "chartAllType": "echarts|line|default", - "rangeArray": [ { "row": [ 0, 4 ], "column": [ 0, 7 ] } ], - "rangeColCheck": { "exits": true, "range": [ 0, 0 ] }, - "rangeRowCheck": { "exits": true, "range": [ 0, 0 ] }, - "rangeConfigCheck": false, - "defaultOption": { - "title": { - "show": true, - "text": "default title" - } - } - }, - "isShow": true - } - } - ``` - -- **Explanation**: - - |Parameter|Explanation| - | ------------ | ------------ | - |t|Operation type symbol| - |i|The index value of the current sheet| - |op|Operation options include hide and show| - |v|configuration information of charts| - -- **Backend update**: - - update the chart settings in the current sheet,if`luckysheetfile[i].chart` is null,the array should be `[]` on initial. - - ```json - luckysheetfile[0].chart.push(v) - ``` - -### move chart position - -- **format**: - - ```json - { - "t": "c", - "i": 0, - "op":"xy", - "v": { - "chart_id": "chart_p145W6i73otw_1596209943446", - "left": 20, - "top": 120 - } - } - ``` - -- **Explanation**: - - |Parameter|Explanation| - | ------------ | ------------ | - |t|Operation type symbol| - |i|The index value of the current sheet| - |op|Operation options include hide and show| - |v|configuration information of charts| - -- **Backend update**: - - update the chart settings in the current sheet - - ```js - luckysheetfile[0].chart[v.chart_id].left = v.left; - luckysheetfile[0].chart[v.chart_id].top = v.top; - ``` - -### zoom chart - -- **format**: - - ```json - { - "t": "c", - "i": 0, - "op":"wh", - "v": { - "chart_id": "chart_p145W6i73otw_1596209943446", - "width": 400, - "height": 250, - "left": 20, - "top": 120 - } - } - ``` - -- **Explanation**: - - |Parameter|Explanation| - | ------------ | ------------ | - |t|Operation type symbol| - |i|The index value of the current sheet| - |op|Operation options include hide and show| - |v|configuration information of charts| - -- **Backend update**: - - update the chart settings in the current sheet - - ```js - luckysheetfile[0].chart[v.chart_id].left = v.left; - luckysheetfile[0].chart[v.chart_id].top = v.top; - luckysheetfile[0].chart[v.chart_id].width = v.width; - luckysheetfile[0].chart[v.chart_id].height = v.height; - ``` - -### change the configuration of charts - -- **format**: - - ```json - { - "t": "c", - "i": 0, - "op":"update", - "v": { - "chart_id": "chart_p145W6i73otw_1596209943446", - "width": 400, - "height": 250, - "left": 20, - "top": 120, - "sheetIndex": "Sheet_6az6nei65t1i_1596209937084", - "needRangeShow": true, - "chartOptions": { - "chart_id": "chart_p145W6i73otw_1596209943446", - "chartAllType": "echarts|line|default", - "rangeArray": [ { "row": [ 0, 4 ], "column": [ 0, 7 ] } ], - "rangeColCheck": { "exits": true, "range": [ 0, 0 ] }, - "rangeRowCheck": { "exits": true, "range": [ 0, 0 ] }, - "rangeConfigCheck": false, - "defaultOption": { - "title": { - "show": true, - "text": "default title" - } - } - }, - "isShow": true - } - } - ``` - -- **Explanation**: - - |Parameter|Explanation| - | ------------ | ------------ | - |t|Operation type symbol| - |i|The index value of the current sheet| - |op|Operation options include hide and show| - |v|configuration information of charts| - -- **Backend update**: - - update the chart settings in the current sheet - - ```js - luckysheetfile[0].chart[v.chart_id] = v; - ``` - -## Backend return format - -Data format returned by websocket backend -```js -{ - createTime: command sending time - data:{} modified command - id: "7a" websocket id - returnMessage: "success" - status: "0" 0 tells the front end to modify according to the data command 1 meaningless - type: 0: connection is successful, 1: send to the currently connected user, 2: send information to other users, 3: send selection location information, 999: user disconnected - username: username -} +# Table Operation +`luckysheet` stores all operations in the history to `undo` and `redo`. If `allowupdate` is set to true and `updateURL` is available in initial, operations will be updated on the backend in real-time via webSocket. And every one can edit same sheet on the same time. + +>Source code [`src/controllers/server.js`] (https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/server.js) The module shows us the function of background saving. + +In general, shared editing(or collaborative editing) is controled by the account system created by developers to control permissions. + +The following are all types of operations that support transferring to the background. In this case, I use mongodb as a storage example to explain how front-end and back-end interacts with eachother. + +Pay attention, `i` in the object is the `index` of the sheet rather than `order`. +## Cell refresh +### single cell refresh +- **Format**: + + ```json + { + "t": "v", + "i": "Sheet_0554kKiKl4M7_1597974810804", + "v": { + "v": 233, + "ct": { "fa": "General", "t": "n" }, + "m": "233" + }, + "r": 0, + "c": 1 + } + ``` + +- **Explanation**: + + |Parameter|Explanation| + | ------------ | ------------ | + |t|Operation type symbol| + |i|The index value of the current sheet| + |v|Cell value, refer to [单元格属性表](/zh/guide/cell.html#基本单元格)| + |r|Row number of cell| + |c|The column number of the cell| + +- **Backend update**: + + The cell update is mainly to update the `luckysheetfile[i].celldata` parameter, which is an array: + ```json + [ + {r:0, c:1, v: "value1"}, + {r:10, c:11, v:"value2"}, + {r:10, c:11, v:{f:"=sum", v:"100"}} + ] + ``` + Store the values in all the cells in the sheet, Luckysheet will create a new table data according to the number of rows and columns in `luckysheetfile[i].row` and `luckysheetfile[i].column` when it is created, and then use `data[ r][c]=v` to fill the table data, empty data cells are represented by null. + + When saving the data posted by the frontend, the backend needs to convert the parameters to the format of `{r:0, c:1:v:100}` first, and then update the field of `luckysheetfile[i].celldata`, if the cell exists the cell is updated, if not, it is added, and if the cell exists but `v` is null, the cell is deleted. + +- **Frontend view**: + + You can modify the value of any cell, and then go to the chrome console to view the operation of `"t"=="v"`. + +## Config operation + +- **Format**: + + ```json + { + "t": "cg", + "i": 3, + "v": { + "7": 192 + }, + "k": "rowlen" + } + ``` + +- **Explanation**: + + |Parameter|Explanation| + | ------------ | ------------ | + |t|Operation type symbol| + |i|The index value of the current sheet| + |v|The internal key-value that needs to be updated| + |k|Operation key name| + +- **Backend update**: + + Update `luckysheetfile[i].config.[k][v.key] = v.value`, if `k` does not exist in `config`, then create a new `k` attribute and set it to empty, If there is no `v.key` in `k`, create a new `v.key` and update `v.value`. + + 1. Examples of modifying row height: + - Enter: `{"t":"cg","i":3,"v":{"3":10, "5":70, "10":100},"k":" rowlen"}` + - Update: `luckysheetfile[3].config.["rowlen"]["3"] = 10` + + 2. Examples of modifying column width: + - Enter: `{"t":"cg","i":1,"v":{"20":74, "15":170, "6":40},"k":" columnlen"}` + - Update: `luckysheetfile[1].config.["columnlen"]["20"] = 74` + + 3. Examples of merged cells: + - Enter: `{"t":"cg","i":1,"v":{"5_10":{row:[1,3], column:[3,5]},"k":" merge "}` + - Update: `luckysheetfile[1].config.["merge"]["5_10"] = {row:[1,3], column:[3,5]}` + +## General save + +- **Format**: + + ```json + { + "t": "all", + "i": 3, + "v": { + "v": 1, + "m":1, + }, + "k": "freezen", + "s": false + } + ``` + +- **Explanation**: + + |Parameter|Explanation| + | ------------ | ------------ | + |t|Operation type symbol| + |i|The index value of the current sheet| + |v|The internal key-value that needs to be updated| + |k|The `value` in the key-value that needs to be saved| + |s|If it is `true` then `v` is saved as a string, otherwise it is saved according to the object| + +- **Backend update**: + + `luckysheetfile[3].[k]= v` + If `s` is `true`, it is `luckysheetfile[3].[k]= JSON.stringify(v)` + + 1. Pivot table: + - Enter: `{"t":"all","i":1,"v":{………},"k":"pivotTable", "s": false}` + - Update: `luckysheetfile[1].["pivotTable"] = {………}` + + 2. Freeze rows and columns: + - Enter: `{"t":"all","i":3,"v":{………},"k":"freezen", "s": false}` + - Update: `luckysheetfile[3].["freezen"] = {………}` + + 3. Filter range: + - Enter: `{"t":"all","i":3,"v":{………},"k":"filter_select", "s": true }` + - Update: `luckysheetfile[3].["filter_select"] = JSON.stringify ({………})` + + 4. Sheet name: + - Enter: `{"t":"all","i":1,"v":"doc","k":"name", "s": false}` + - Update: `luckysheetfile[1].["name"] = "doc"` + + 5. Sheet color: + - Enter: `{"t":"all","i":2,"v":"#FFF000","k":"color", "s": false}` + - Update: `luckysheetfile[2].["color"] = "#FFF000"` + +## Function chain operation + +- **Format**: + + ```json + { + "t": "fc", + "i": 0, + "v": { + "r": 3, + "c": 7, + "index": 0, + "func": [ + true, + 187282, + "=SUM(E4:G4)" + ] + }, + "op": "add", + "pos": 0 + } + ``` + +- **Explanation**: + + |Parameter|Explanation| + | ------------ | ------------ | + |t|Operation type symbol| + |i|The index value of the current sheet| + |v|Object value, the internal fields of the object do not need to be updated separately, so save as text| + |op|Operation type, `add` is add, `update` is update, and `del` is delete| + |pos|Updated or deleted function location| + +- **Backend update**: + + calcChain is an array + - If the value of `op` is `add` then add to the end `luckysheetfile[i].calcChain.push (v)`, + - If the value of `op` is `update` then update `luckysheetfile[i].calcChain[pos]= v`, + - If the value of `op` is `del` then delete `luckysheetfile[i].calcChain.splice(pos, 1)`。 + +- **Frontend view**: + + You can modify the value of any cell, and then go to the chrome console to view the operation of `"t"=="v"`. + +## Row and column operations + +### Delete rows or columns + +- **Format**: + + ```json + { + "t": "drc", + "i": 3, + "v": { + "index": 6, + "len": 2 + }, + "rc": "r" + } + ``` + +- **Explanation**: + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterExplanation
tOperation type symbol
iThe index value of the current sheet
rcRow operation or column operation, the value `r` stands for row, and `c` stands for column
vindexDelete from which row or column
lenNumber of rows or columns deleted
+ +- **Backend update**: + + If the value of `rc` is `'r'` then delete the row, if the value of `rc` is `'c'` then delete the column, eg `rc='r'`, `index=4`, `len= 5`, means to delete the next 5 lines (4, 5, 6, 7, 8) from the 4th line. + + Mainly operate on the cells in `luckysheetfile[i].celldata`, delete the qualified cells described in the parameters and update the row and column values of other cells. Taking the above as an example, first find the `r` in the cell Delete all the cells with values from 4 to 8, and then subtract the value of 5 from the original cell number 9 and later, and finally subtract 5 from `luckysheetfile[i].row`. + If the `v` value is `"#__qkdelete#"` (without quotes), then this is the cell to be deleted. + +- **Front view**: + + You can delete rows or columns, and then go to the chrome console to view the operation of `"t"=="drc"`. + +### Add rows or columns + +- **Format**: + + ```json + { + "t": "arc", + "i": 0, + "v": { + "index": 5, + "len": 10, + "data": [] + }, + "rc": "c" + } + ``` + +- **Explanation**: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterExplanation
tOperation type symbol
iThe index value of the current sheet
rcRow operation or column operation, the value `r` stands for row, and `c` stands for column
vindexStart from which row or column
lenHow many rows or columns to add
dataNew row or column content
+ +- **Backend update**: + + If the value of `rc` is `r`, add a new row. If the value of `rc` is `c`, add a new column. For example, `rc=r, index=4, len=5` then it means increase 5 lines from line 4. If `data` is empty, add an empty line. If `data` is not empty, use the array in `data` to add a new line. + + Mainly operate on the cells in `luckysheetfile[i].celldata`. Taking the above as an example, first add 5 to `luckysheetfile[i].row`, and then add `r` greater than 4 to the entire cell`r `Value +5, if `data` is empty, add an empty line to end, if `data` is not empty, convert the two-dimensional array `data` to `{r:0,c:0,v:100}` Format and added to `celldata`, the pseudo code for conversion is as follows: + + ```javascript + var ret = []; + for(var r=0;r + + Parameter + Explanation + + + t + Operation type symbol + + + i + The index value of the current sheet + + + v + name + The index value of the sheet jumped after hiding + + + color + Sheet color + + + status + Active state + + + order + Sheet order + + + index + Sheet Index + + + celldata + Cell dataset + + + config + Setting + + + pivotTable + Pivot table settings + + + isPivotTable + Whether the pivot table + + + + +- **Backend update**: + + Add a line (a document) to the database. + +### Copy sheet + +- **Format**: + + ```json + { + "t": "shc", + "i": "New sheet location", + "v": { + "copyindex": "copyindex" + } + } + ``` + +- **Backend update**: + + Copy the sheet index value in the table, set it to `copyindex` and add it to the database, set the `index` of the new document to the value corresponding to `i`. + +### Delete sheet + +- **Format**: + + ```json + { + "t": "shd", + "i": null, + "v": { + "deleIndex": 0 + } + } + ``` + +- **Explanation**: + + + + + + + + + + + + + + + + +
ParameterExplanation
tOperation type symbol
vdeleIndexThe sheet index to be deleted
+ +- **Backend update**: + + Delete the sheet whose index is the value corresponding to `deleIndex`. + +### restore from a deleted sheet + +- **format**: + + ```json + { + "t": "shre", + "i": null, + "v": { + "reIndex": "0" + } + } + ``` + +- **Explanation**: + + + + + + + + + + + + + + + + +
ParameterExplanation
tOperation type symbol
vdeleIndex需要恢复的sheet索引
+ +- **Backend update**: + + restore the sheet whose index is the number of `reIndex`. + +### Position + +- **Format**: + + ```json + { + "t": "shr", + "i": null, + "v": { + "0": 1, + "1": 0, + "2": 2, + "3": 3, + "4": 4, + "5": 5, + "6": 6, + "7": 7, + "Sheet_6az6nei65t1i_1596209937084": 8 + } + } + ``` + +- **Explanation**: + + |Parameter|Explanation| + | ------------ | ------------ | + |t|Operation type symbol| + |v|Set the sorting of Sheet as a key-value pair, `key` represents the index of the sheet, and `value` represents the order value. The format is: `{"1": 3, "2":1, "0": 2, "3":0}`| + +- **Backend update**: + + For the page where the `index` of the sheet is equal to the `key`, set its `order` attribute to the `value`. Examples: + + `luckysheetfile[key1].order = value1` + `luckysheetfile[key2].order = value2` + `luckysheetfile[key3].order = value3` + +### switch to the specified sheet + +- **format**: + + ```json + { + "t": "shs", + "i": null, + "v": 1 + } + ``` + +- **Explanation**: + + |Parameter|Explanation| + | ------------ | ------------ | + |t|Operation type symbol| + |v|index of the specified sheet| + +- **Backend update**: + + setting the `status` = `1`, when the `index` of a sheet is eaqul to `v`: + + `luckysheetfile[v].status = 1` + +## Sheet attributes (hide or show) + +- **Format**: + + ```json + { + "t": "sh", + "i": 0, + "v": 1, + "op": " hide", + "cur": 2 + } + ``` + +- **Explanation**: + + |Parameter|Explanation| + | ------------ | ------------ | + |t|Operation type symbol| + |i|The index value of the current sheet| + |op|Operation options include hide and show| + |v|Hide if `hide` is `1`, show if `0` or empty| + |cur|After hiding, set sheet which index corresponding to the `cur` to the active state| + +- **Backend update**: + + The `hide` field of the root path of the sheet corresponding to `i` is updated to `v`. When hidden, the `status` value is `0`. When displayed, it is `1`. If hidden, the sheet which `cur` corresponds to `index`, its `status` is updated to `1`. + +## Table information change + +### Table name + +- **Format**: + + ```json + { + "t": "na", + "i": null, + "v": "Data" + } + ``` + +- **Explanation**: + + |Parameter|Explanation| + | ------------ | ------------ | + |t|Operation type symbol| + |v|The name of the table| + +- **Backend update**: + + Update the table name in the database according to gridkey. + +### Thumbnail + +- **Format**: + + ```json + { + "t": "thumb", + "img": "base64", + "curindex": "curindx" + } + ``` + +- **Explanation**: + + |Parameter|Explanation| + | ------------ | ------------ | + |t|Operation type symbol| + |img|Thumbnail of current table, base64 string| + |curindex|The current sheet opened by default| + +- **Backend update**: + + According to gridkey, update the thumbnail field of the table in mysql to the img value, and update the status field of the sheet whose index is the curindex value to 1, and set the status value of other sheets to 0. + +## Chart(TODO) + +There are four types of chart operations: add new chart -"add", move chart position-"xy", zoom chart-"wh", and update chart configuration-"update". + +### new chart + +- **format**: + + ```json + { + "t": "c", + "i": 0, + "op":"add", + "v": { + "chart_id": "chart_p145W6i73otw_1596209943446", + "width": 400, + "height": 250, + "left": 20, + "top": 120, + "sheetIndex": "Sheet_6az6nei65t1i_1596209937084", + "needRangeShow": true, + "chartOptions": { + "chart_id": "chart_p145W6i73otw_1596209943446", + "chartAllType": "echarts|line|default", + "rangeArray": [ { "row": [ 0, 4 ], "column": [ 0, 7 ] } ], + "rangeColCheck": { "exits": true, "range": [ 0, 0 ] }, + "rangeRowCheck": { "exits": true, "range": [ 0, 0 ] }, + "rangeConfigCheck": false, + "defaultOption": { + "title": { + "show": true, + "text": "default title" + } + } + }, + "isShow": true + } + } + ``` + +- **Explanation**: + + |Parameter|Explanation| + | ------------ | ------------ | + |t|Operation type symbol| + |i|The index value of the current sheet| + |op|Operation options include hide and show| + |v|configuration information of charts| + +- **Backend update**: + + update the chart settings in the current sheet,if`luckysheetfile[i].chart` is null,the array should be `[]` on initial. + + ```json + luckysheetfile[0].chart.push(v) + ``` + +### move chart position + +- **format**: + + ```json + { + "t": "c", + "i": 0, + "op":"xy", + "v": { + "chart_id": "chart_p145W6i73otw_1596209943446", + "left": 20, + "top": 120 + } + } + ``` + +- **Explanation**: + + |Parameter|Explanation| + | ------------ | ------------ | + |t|Operation type symbol| + |i|The index value of the current sheet| + |op|Operation options include hide and show| + |v|configuration information of charts| + +- **Backend update**: + + update the chart settings in the current sheet + + ```js + luckysheetfile[0].chart[v.chart_id].left = v.left; + luckysheetfile[0].chart[v.chart_id].top = v.top; + ``` + +### zoom chart + +- **format**: + + ```json + { + "t": "c", + "i": 0, + "op":"wh", + "v": { + "chart_id": "chart_p145W6i73otw_1596209943446", + "width": 400, + "height": 250, + "left": 20, + "top": 120 + } + } + ``` + +- **Explanation**: + + |Parameter|Explanation| + | ------------ | ------------ | + |t|Operation type symbol| + |i|The index value of the current sheet| + |op|Operation options include hide and show| + |v|configuration information of charts| + +- **Backend update**: + + update the chart settings in the current sheet + + ```js + luckysheetfile[0].chart[v.chart_id].left = v.left; + luckysheetfile[0].chart[v.chart_id].top = v.top; + luckysheetfile[0].chart[v.chart_id].width = v.width; + luckysheetfile[0].chart[v.chart_id].height = v.height; + ``` + +### change the configuration of charts + +- **format**: + + ```json + { + "t": "c", + "i": 0, + "op":"update", + "v": { + "chart_id": "chart_p145W6i73otw_1596209943446", + "width": 400, + "height": 250, + "left": 20, + "top": 120, + "sheetIndex": "Sheet_6az6nei65t1i_1596209937084", + "needRangeShow": true, + "chartOptions": { + "chart_id": "chart_p145W6i73otw_1596209943446", + "chartAllType": "echarts|line|default", + "rangeArray": [ { "row": [ 0, 4 ], "column": [ 0, 7 ] } ], + "rangeColCheck": { "exits": true, "range": [ 0, 0 ] }, + "rangeRowCheck": { "exits": true, "range": [ 0, 0 ] }, + "rangeConfigCheck": false, + "defaultOption": { + "title": { + "show": true, + "text": "default title" + } + } + }, + "isShow": true + } + } + ``` + +- **Explanation**: + + |Parameter|Explanation| + | ------------ | ------------ | + |t|Operation type symbol| + |i|The index value of the current sheet| + |op|Operation options include hide and show| + |v|configuration information of charts| + +- **Backend update**: + + update the chart settings in the current sheet + + ```js + luckysheetfile[0].chart[v.chart_id] = v; + ``` + +## Backend return format + +Data format returned by websocket backend +```js +{ + createTime: command sending time + data:{} modified command + id: "7a" websocket id + returnMessage: "success" + status: "0" 0 tells the front end to modify according to the data command 1 meaningless + type: 0: connection is successful, 1: send to the currently connected user, 2: send information to other users, 3: send selection location information, 999: user disconnected + username: username +} ``` \ No newline at end of file diff --git a/docs/guide/resource.md b/docs/guide/resource.md index 12c972459..207608e4f 100644 --- a/docs/guide/resource.md +++ b/docs/guide/resource.md @@ -1,32 +1,33 @@ -# Tutorials and resources - -Open source software is inseparable from the contribution of the community. Here will be a list of tutorials, learning materials and supporting solutions provided by the community. - -If you have written or found an excellent tutorial and want to recommend it to us, please directly [edit this page](https://github.com/mengshukeji/Luckysheet/edit/master/docs/guide/resource.md) submit a PR. - -## Blog -- [How Luckysheet initializes the data with merged cells](https://www.cnblogs.com/DuShuSir/p/13272397.html)[Pending translation] -- [How Luckysheet saves the data in the table to the database](https://www.cnblogs.com/DuShuSir/p/13857874.html)[Pending translation] -- [Case of introducing Luckysheet into local HTML using CDN loading](https://www.cnblogs.com/DuShuSir/p/13859103.html)[Pending translation] -- [Basic usage of Luckysheet, use `loadUrl` to load server data](https://blog.csdn.net/DCDC2020/article/details/108486525) -- [Luckysheet import and export implementation-Java background processing](https://blog.csdn.net/u014632228/article/details/109738221) - -## Front-end case - -### Community Case -- [luckysheet-vue-importAndExport](https://github.com/oy-paddy/luckysheet-vue-importAndExport/tree/master/) - -## Back-end case - -### Official case -- [Java backend Luckysheet Server](https://github.com/mengshukeji/LuckysheetServer) - -### Community Case -- [Luckysheet save and restore](https://gitee.com/ichiva/luckysheet-saved-in-recovery) (Java version) -- [Online form for collaborative editing based on Luckysheet](https://github.com/DilemmaVi/ecsheet) (Java version) -- [Use .net core 3.1 and Npoi to make a basic export based on LuckSheet](https://gitee.com/xiong-kangli/luck-sheet_.-net-core) (.NET version) -- [Collaborative editing in go language version](https://github.com/fandypeng/excel2config)(Go version) - -## Learning Materials - -- [How to build a web data analysis report from 0 to 1](https://github.com/mengshukeji/LuckyResources/blob/master/ppt/%E5%A6%82%E4%BD%95%E4%BB%8E0%E5%88%B01%E6%90%AD%E5%BB%BA%20Web%20%E6%95%B0%E6%8D%AE%E5%88%86%E6%9E%90%E6%8A%A5%E8%A1%A8.pptx)[Pending translation] \ No newline at end of file +# Tutorials and resources + +Open source software is inseparable from the contribution of the community. Here will be a list of tutorials, learning materials and supporting solutions provided by the community. + +If you have written or found an excellent tutorial and want to recommend it to us, please directly [edit this page](https://github.com/mengshukeji/Luckysheet/edit/master/docs/guide/resource.md) submit a PR. + +## Blog +- [How Luckysheet initializes the data with merged cells](https://www.cnblogs.com/DuShuSir/p/13272397.html)[Pending translation] +- [How Luckysheet saves the data in the table to the database](https://www.cnblogs.com/DuShuSir/p/13857874.html)[Pending translation] +- [Case of introducing Luckysheet into local HTML using CDN loading](https://www.cnblogs.com/DuShuSir/p/13859103.html)[Pending translation] +- [Basic usage of Luckysheet, use `loadUrl` to load server data](https://blog.csdn.net/DCDC2020/article/details/108486525) +- [Luckysheet import and export implementation-Java background processing](https://blog.csdn.net/u014632228/article/details/109738221) + +## Front-end case + +### Community Case +- [luckysheet-vue-importAndExport](https://github.com/oy-paddy/luckysheet-vue-importAndExport/tree/master/) + +## Back-end case + +### Official case +- [Java backend Luckysheet Server](https://github.com/mengshukeji/LuckysheetServer) + +### Community Case +- [Luckysheet save and restore](https://gitee.com/ichiva/luckysheet-saved-in-recovery) (Java version) +- [Online form for collaborative editing based on Luckysheet](https://github.com/DilemmaVi/ecsheet) (Java version) +- [Simple Express.js server example template for individual use](https://github.com/TitanRGB/Luckysheet-ExpressReact-Example) (Node-Express version) +- [Use .net core 3.1 and Npoi to make a basic export based on LuckSheet](https://gitee.com/xiong-kangli/luck-sheet_.-net-core) (.NET version) +- [Collaborative editing in go language version](https://github.com/fandypeng/excel2config)(Go version) + +## Learning Materials + +- [How to build a web data analysis report from 0 to 1](https://github.com/mengshukeji/LuckyResources/blob/master/ppt/%E5%A6%82%E4%BD%95%E4%BB%8E0%E5%88%B01%E6%90%AD%E5%BB%BA%20Web%20%E6%95%B0%E6%8D%AE%E5%88%86%E6%9E%90%E6%8A%A5%E8%A1%A8.pptx)[Pending translation] diff --git a/docs/guide/sheet.md b/docs/guide/sheet.md index fa92bd4b9..1869f303e 100644 --- a/docs/guide/sheet.md +++ b/docs/guide/sheet.md @@ -1,1465 +1,1465 @@ -# Sheet Configuration - -## Initial -if you want to initial the `options`, you need to arrange every sheet data to `options.data` - -> when the initialization is done, you can use [`luckysheet.getAllSheets()`](/zh/guide/api.html#getAllSheets([setting])) to get all working sheet configurations. - -eg: options.data: -```json -[ - { - "name": "Cell", //Worksheet name - "color": "", //Worksheet color - "index": 0, //Worksheet index - "status": 1, //Worksheet active status - "order": 0, //The order of the worksheet - "hide": 0,//Whether worksheet hide - "row": 36, //the number of rows in a sheet - "column": 18, //the number of columns in a sheet - "defaultRowHeight": 19, //Customized default row height - "defaultColWidth": 73, //Customized default column width - "celldata": [], //Initial the cell data - "config": { - "merge":{}, //merged cells - "rowlen":{}, //Table row height - "columnlen":{}, //Table column width - "rowhidden":{}, //hidden rows - "colhidden":{}, //hidden columns - "borderInfo":{}, //borders - "authority":{}, //Worksheet protection - }, - "scrollLeft": 0, //Left and right scroll bar position - "scrollTop": 315, //Up and down scroll bar position - "luckysheet_select_save": [], //selected area - "calcChain": [],//Formula chain - "isPivotTable":false,//Whether is pivot table - "pivotTable":{},//Pivot table settings - "filter_select": {},//Filter range - "filter": null,//Filter configuration - "luckysheet_alternateformat_save": [], //Alternate colors - "luckysheet_alternateformat_save_modelCustom": [], //Customize alternate colors - "luckysheet_conditionformat_save": {},//condition format - "frozen": {}, //freeze row and column configuration - "chart": [], //Chart configuration - "zoomRatio":1, // zoom ratio - "image":[], //image - "showGridLines": 1, //Whether to show grid lines - }, - { - "name": "Sheet2", - "color": "", - "index": 1, - "status": 0, - "order": 1, - "celldata": [], - "config": {} - }, - { - "name": "Sheet3", - "color": "", - "index": 2, - "status": 0, - "order": 2, - "celldata": [], - "config": {}, - } -] -``` - -### name -- type:String -- default:"Sheet1" -- usage:the name of a sheet - ------------- -### color -- type:String -- default:"##f20e0e" -- usage:Sheet color, with a bottom border below the sheet name - ------------- -### index -- type:String -- default:"" -- usage:The worksheet index is used as a unique key value, and a random string is automatically assigned when a worksheet is added. Note that `index` is not the order of worksheets, and is distinguished from `order`. - ------------- -### status -- type:Number -- default:1 -- usage:Active state, there is only one active worksheet which number will be 1 and the other worksheets are 0 - ------------- -### order -- type:Number -- default:0 -- usage:The subscript of the worksheet represents the order in which the worksheet is displayed in the sheet bar at the bottom. It will increase when a worksheet is added, starting from 0 - ------------- -### hide -- type:Number -- default:0 -- usage: is the sheet is hidden. `0` means not to hide, `1` means hide - ------------- -### row -- type:Number -- default:36 -- usage: Number of cell rows - ------------- -### column -- type:Number -- default:18 -- usage: Number of cell columns - ------------- -### defaultRowHeight -- type:Number -- default:19 -- usage: Customized default row height, unit is px - ------------- -### defaultColWidth -- type:Number -- default:73 -- usage: Customized default column width, unit is px - ------------- -### celldata -- type:Array -- default:[] -- usage: The original cell data set is a set containing `{r:0,c:0,v:{m:"value",v:"value",ct: {fa: "General", t: "g"}} }`The one-dimensional array of format cell information is only used during initialization. - - `r` represents the row, `c` represents the column, and `v` represents the value of the cell. value could be string, number, or object - - The luckysheet creates a sheet data based on the number of `options.data[i].row` and `options.data[i].column`, then uses `data[r][c]=v` to fullfill tables. Empty data cells are represented as null. - - After initializing the table with celldata,the data is converted to the field [data](#data)in the luckyshetfile such as `luckysheetfile[i].data`. `data` stores the following update data and celldata will no longer be used. - -- example: - ```js - [{ - "r": 0, - "c": 0, - "v": { - ct: {fa: "General", t: "g"}, - m:"value1", - v:"value1" - } - }, { - "r": 0, - "c": 1, - "v": { - ct: {fa: "General", t: "g"}, - m:"value2", - v:"value2" - } - }] - ``` -> more detail [cell format](/zh/guide/cell.html) - ------------- -### config -- type:Object -- default:{} -- usage:Table row height, column width, merged cells, borders, hidden rows and other settings - please be careful, config must be empty object `{}`, rather than empty string `""` or `null` - - -#### config.merge -- type:Object -- default:{} -- usage:Merge cell settings -- example: - ```js - { - "13_5": { - "r": 13, - "c": 5, - "rs": 3, - "cs": 1 - }, - "13_7": { - "r": 13, - "c": 7, - "rs": 3, - "cs": 2 - }, - "14_2": { - "r": 14, - "c": 2, - "rs": 1, - "cs": 2 - } - } - ``` - The `key` in the object is the spliced value of `r +'_' + c`, and the `value` is the cell information in the upper left corner: r: number of rows, c: number of columns, rs: number of merged rows, cs: merge Number of columns - -#### config.rowlen -- type:Object -- default:{} -- usage:The row height of each cell -- example: - ```js - "rowlen": { - "0": 20, - "1": 20, - "2": 20 - } - ``` - -#### config.columnlen -- type:Object -- default:{} -- usage:The column width of each cell -- example: - ```js - "columnlen": { - "0": 97, - "1": 115, - "2": 128 - } - ``` - -#### config.rowhidden -- type:Object -- default:{} -- usage:Hidden row information, Rows:`rowhidden[Rows]: 0`, - - you should specify the number of rows by `key`,`value` is always `0` -- example: - ```js - "rowhidden": { - "30": 0, - "31": 0 - } - ``` - -#### config.colhidden -- type:Object -- default:{} -- usage:Hidden row information, Rows:`rowhidden[Rows]: 0`, - format:`colhidden[Cols]: 0`, - - `key` specify the number of columns,`value` is always `0` -- example: - ```js - "colhidden": { - "30": 0, - "31": 0 - } - ``` - -#### config.borderInfo -- type:Array -- default:{} -- usage:The border information of the cell -- example: - ```js - "borderInfo": [{ - "rangeType": "cell", - "value": { - "row_index": 3, - "col_index": 3, - "l": { - "style": 10, - "color": "rgb(255, 0, 0)" - }, - "r": { - "style": 10, - "color": "rgb(255, 0, 0)" - }, - "t": { - "style": 10, - "color": "rgb(255, 0, 0)" - }, - "b": { - "style": 10, - "color": "rgb(255, 0, 0)" - } - } - }, - { - "rangeType": "range", - "borderType": "border-all", - "style": "3", - "color": "#0000ff", - "range": [{ - "row": [7, 8], - "column": [2, 3] - }] - }, { - "rangeType": "range", - "borderType": "border-inside", - "style": "3", - "color": "#0000ff", - "range": [{ - "row": [7, 8], - "column": [8, 9] - }] - }] - ``` - The range type can be divided into single cell and selected area - 1. selection `rangeType: "range"` - - + Border type `borderType:"border-left" | "border-right" | "border-top" | "border-bottom" | "border-all" | "border-outside" | "border-inside" | "border-horizontal" | "border-vertical" | "border-none"`, - + Border thickness `style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick`, If it corresponds to the value of getLineStyle() of aspose.cells, you need to make a conversion yourself, refer to [aspose.cells](https://apireference.aspose.com/cells/net/aspose.cells/cellbordertype) - + Border color `color: Hexadecimal color value` - + Selection area `range: Row and column information array` - - 2. Single cell `rangeType:"cell"` - + Number of rows and columns `value.row_index: number,value.col_index: number` - + Four border objects `value.l:Left border,value.r:Right border,value.t:Top border,value.b:Bottom border` - + Border thickness `value.l.style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick` - + Border color `value.l.color: Hexadecimal color value` - - templates: - - + ```js - { - "rangeType": "range", - "borderType": "border-all", - "style": "3", - "color": "#0000ff", - "range": [{ - "row": [7, 8], - "column": [2, 3] - }] - } - ``` - Represents a selection with a setting range of `{"row": [7, 8], "column": [2, 3]}`, the type is all borders, the border thickness is `Dotted`, and the color is `"#0000ff"` - - + ```js - { - "rangeType": "cell", - "value": { - "row_index": 3, - "col_index": 3, - "l": { - "style": 10, - "color": "rgb(255, 0, 0)" - }, - "r": { - "style": 10, - "color": "rgb(255, 0, 0)" - }, - "t": { - "style": 10, - "color": "rgb(255, 0, 0)" - }, - "b": { - "style": 10, - "color": "rgb(255, 0, 0)" - } - } - } - ``` - Means to set the cell `"D4"`, the upper border/lower border/left border/right border are all border thicknesses `"MediumDashDot"`, color is `"rgb(255, 0, 0)"` - -#### config.authority -- type:Object -- default:{} -- usage:Worksheet protection, you can set that the entire worksheet is not allowed to be edited or some areas are not editable. If you want to apply for editing permission, you need to enter a password, and customize the types of operations that users can operate. -- example: - ```js - "authority":{//Permission configuration of the current worksheet -     selectLockedCells:1, //Select locked cells -     selectunLockedCells:1, //Select unlocked cells -     formatCells:1, //Format cells -     formatColumns:1, //Format columns -     formatRows:1, //Format rows -     insertColumns:1, //Insert columns -     insertRows:1, //Insert rows -     insertHyperlinks:1, //Insert hyperlinks -     deleteColumns:1, //Delete columns -     deleteRows:1, //Delete rows -     sort:1, //Sort -     filter:1, //Filter -     usePivotTablereports:1, //Use Pivot Table reports -     editObjects:1, //Edit objects -     editScenarios:1, //Edit scenarios    -     sheet:1, //If it is 1 or true, the worksheet is protected; if it is 0 or false, the worksheet is not protected. -     hintText:"", //The text of the pop-up prompt -     algorithmName:"None",//Encryption scheme: MD2,MD4,MD5,RIPEMD-128,RIPEMD-160,SHA-1,SHA-256,SHA-384,SHA-512,WHIRLPOOL -     saltValue:null, //The salt parameter for password decryption is a random value set by yourself -      -     allowRangeList:[{ //Range protection -         name:"area", //Name -         password:"1", //Password -         hintText:"", //Prompt text -         algorithmName:"None",//Encryption scheme: MD2,MD4,MD5,RIPEMD-128,RIPEMD-160,SHA-1,SHA-256,SHA-384,SHA-512,WHIRLPOOL -         saltValue:null, //The salt parameter for password decryption is a random value set by yourself -         sqref:"$C$1:$D$5" //Protected range -     }], - }, - ``` - ------------- -### scrollLeft -- type:Number -- default:0 -- usage: Left and right scroll bar position - ------------- -### scrollTop -- type:Number -- default:0 -- usage: Up and down scroll bar position - ------------- -### luckysheet_select_save -- type:Array -- default:[] -- usage: The selected area supports multiple selections and is a one-dimensional array containing multiple selection objects. -- example: - ```js - [ - { - "row": [ 0, 1 ], - "column": [ 0, 0 ] - }, - { - "row": [ 3, 4 ], - "column": [ 1, 2 ] - }, - { - "row": [ 1, 3 ], - "column": [ 3, 3 ] - } - ] - ``` - ------------- -### calcChain -- type:Array -- default:[] -- usage: Formula chain, used when the cell linked by the formula is changed, all formulas referencing this cell will be refreshed. -- example: - ```js - [{ - "r": 6, //the number of rows - "c": 3, //the number of columns - "index": 1, //sheet id - "func": [true, 23.75, "=AVERAGE(D3:D6)"], //Formula information, including formula calculation results and formula string - "color": "w", //"w":use Depth-First-Search "b":Normal search - "parent": null, - "chidren": {}, - "times": 0 - }, { - "r": 7, - "c": 3, - "index": 1, - "func": [true, 30, "=MAX(D3:D6)"], - "color": "w", - "parent": null, - "chidren": {}, - "times": 0 - }] - ``` - ------------- -### isPivotTable -- type:Boolean -- default:false -- usage: is PivotTable - ------------- -### pivotTable -- type:Object -- default:{} -- usage: Pivot table settings -- example: - ```js - { - "pivot_select_save": { - "row": [0, 12], - "column": [0, 4] - }, - "pivotDataSheetIndex": 6, //The sheet index where the source data is located - "column": [{ - "index": 3, - "name": "subject", - "fullname": "subject" - }], - "row": [{ - "index": 1, - "name": "student", - "fullname": "student" - }], - "filter": [], - "values": [{ - "index": 4, - "name": "score", - "fullname": "count:score", - "sumtype": "COUNTA", - "nameindex": 0 - }], - "showType": "column", - "pivotDatas": [ //Source data for PivotTable - ["count:score", "science", "mathematics", "foreign language", "English", "total"], - ["Alex", 1, 1, 1, 1, 4], - ["Joy", 1, 1, 1, 1, 4], - ["Tim", 1, 1, 1, 1, 4], - ["total", 3, 3, 3, 3, 12] - ], - "drawPivotTable": false, - "pivotTableBoundary": [5, 6] - } - ``` - ------------- -### filter_select -- type:Object -- default:{} -- usage:Filter range. A selection and a sheet have only one filter range, similar to `luckysheet_select_save`. If you just create a selection to turn on the filter function, you can configure this range. If you need to set further detailed filter conditions, you need to configure the [filter](#filter) property of the same level. -- example: - ```js - { - - "row": [ 2, 6 ], - "column": [ 1, 3 ] - } - ``` - ------------- -### filter -- type:Object -- default:{} -- usage:The specific settings of the filter match with the filter range of `filter_select`. When you create a filter area on the first sheet, you can also see the filter configuration information of the first sheet through `luckysheet.getLuckysheetfile()[0].filter`. - - The following is a complete filter configuration example - ```js - { - //"0" means the first column - "0": { - "caljs": { // Filter by condition - "value": "cellnull", // Filter type - "text": "Is empty", // Type description - "type": "0" // Filter categories - }, - "rowhidden": { "3": 0, "4": 0 }, // Hidden row information - "optionstate": true, // Whether to enable configuration - "cindex": 1, // The current range column order, here is the first column - "str": 2, // Range, start row - "edr": 6, // Range, end row - "stc": 1, // Range, start column - "edc": 3 // Range, end column - }, - //"1" means the second column - "1": { - "caljs": {}, - "rowhidden": { "1": 0}, - "optionstate": true, - "cindex": 2, // The current range column order, here is the second column - "str": 2, - "edr": 6, - "stc": 1, - "edc": 3 - } - } - ``` - 1. The `key` value of `filter[key]` means the column index, starting from 0, the `cindex` in the specific setting item starts from 1, which has the same meaning as the `key` here. - 2. `caljs` is used to set the filter type and the corresponding value. After the setting takes effect, the hidden row information will be calculated and stored in `rowhidden`. The following are all the types that can be set, among which `value1` and `value2` are the text information filled in by the user: - + `caljs:{value: null, text: "None", type: "0"}` - + `caljs:{value: "cellnull", text: "Is empty", type: "0"}` - + `caljs:{value: "cellnonull", text: "Is not empty", type: "0"}` - + `caljs:{value: "textinclude", text: "Text contains", type: "1", value1: "Lucky"}` - + `caljs:{value: "textnotinclude", text: "Text does not contain", type: "1", value1: "Lucky"}` - + `caljs:{value: "textstart", text: "Text starts with", type: "1", value1: "Lucky"}` - + `caljs:{value: "textend", text: "Text ends with", type: "1", value1: "Lucky"}` - + `caljs:{value: "textequal", text: "Text is exactly", type: "1", value1: "Lucky"}` - + `caljs:{value: "dateequal", text: "Date is", type: "1", value1: "2020-10-16"}` - + `caljs:{value: "datelessthan", text: "Date is before", type: "1", value1: "2020-10-16"}` - + `caljs:{value: "datemorethan", text: "Date is after", type: "1", value1: "2020-10-16"}` - + `caljs:{value: "morethan", text: "Greater than", type: "1", value1: "10"}` - + `caljs:{value: "moreequalthan", text: "Greater than or equal to", type: "1", value1: "10"}` - + `caljs:{value: "lessthan", text: "Less than", type: "1", value1: "10"}` - + `caljs:{value: "lessequalthan", text: "Less than or equal to", type: "1", value1: "10"}` - + `caljs:{value: "equal", text: "Is equal to", type: "1", value1: "10"}` - + `caljs:{value: "noequal", text: "Is not equal to", type: "1", value1: "10"}` - + `caljs:{value: "include", text: "Is between", type: "2", value1: "15", value2: "25"}` - + `caljs:{value: "noinclude", text: "Is not between", type: "2", value1: "15", value2: "25"}` - 3. `rowhidden` is stored hidden row information, but if `caljs` is not set to filter by conditions, it means that color filtering (if there is a color distinction between the rows) and filtering by value are set. So it can be seen that the priority of `caljs` is greater than that of `rowhidden`. - 4. `optionstate` indicates whether to enable the configuration, this is an internal flag, just set `true` directly. - 5. `cindex` represents the column order currently set, counting from 1 and corresponding to the `key` value of `filter[key]`, and the result is `key`+1. - 6. `str` is the start row, `edr` is the end row, `stc` is the start column, and `edc` is the end column. The four numbers represent the entire filter range, which should be consistent with the content of `filter_select`. - ------------- -### luckysheet_alternateformat_save -- type:Array -- default:[] -- usage: Alternating color configuration -- example: - ```js - [{ - "cellrange": { //cell range - "row": [1, 6], - "column": [1, 5] - }, - "format": { - "head": { //Header color - "fc": "#000", - "bc": "#5ed593" - }, - "one": { //The first color - "fc": "#000", - "bc": "#ffffff" - }, - "two": { //The second color - "fc": "#000", - "bc": "#e5fbee" - }, - "foot": { //Footers color - "fc": "#000", - "bc": "#a5efcc" - } - }, - "hasRowHeader": false, //is included header - "hasRowFooter": false //is included footer - }, { - "cellrange": { - "row": [1, 6], - "column": [8, 12] - }, - "format": { - "head": { - "fc": "#000", - "bc": "#5599fc" - }, - "one": { - "fc": "#000", - "bc": "#ffffff" - }, - "two": { - "fc": "#000", - "bc": "#ecf2fe" - }, - "foot": { - "fc": "#000", - "bc": "#afcbfa" - } - }, - "hasRowHeader": false, - "hasRowFooter": false - }] - ``` - ------------- -### luckysheet_alternateformat_save_modelCustom -- type:Array -- default:[] -- usage:Custom alternate colors, including multiple custom alternate colors configuration -- example: - ```js - [{ - "head": { //Header color - "fc": "#6aa84f", - "bc": "#ffffff" - }, - "one": { //The first color - "fc": "#000", - "bc": "#ffffff" - }, - "two": { //The second color - "fc": "#000", - "bc": "#e5fbee" - }, - "foot": { //The footer color - "fc": "#000", - "bc": "#a5efcc" - } - }] - ``` - ------------- -### luckysheet_conditionformat_save -- type:Array -- default:[] -- usage: Conditional format configuration information, a one-dimensional array containing multiple conditional format configuration objects, - - type: "default": Highlight cell rules and project selection rules, - - "dataBar":Data bar, - - "icons":Icon set, - - "colorGradation": Color scale - - You can get more detail in this API page[API setRangeConditionalFormat](/zh/guide/api.html) -- example: - ```js - [ - { - "type": "default", - "cellrange": [ //cell range - { - "row": [ 2, 7 ], - "column": [ 2, 2 ] - } - ], - "format": { //when type is default, you should set the text color and cell color - "textColor": "#000000", - "cellColor": "#ff0000" - }, - "conditionName": "betweenness", //type - "conditionRange": [ //condition value in the cell - { - "row": [ 4, 4 ], - "column": [ 2, 2 ] - }, - { - "row": [ 6, 6 ], - "column": [ 2, 2 ] - } - ], - "conditionValue": [ 2, 4 - ] //Customize the condition value - }, - { - "type": "dataBar", - "cellrange": [ - { - "row": [ 10, 15 ], - "column": [ 10, 11 ] - } - ], - "format": [ - "#6aa84f", - "#ffffff" - ] - }, - { - "type": "icons", - "cellrange": [ - { - "row": [ 19, 23 ], - "column": [ 2, 2 ] - } - ], - "format": { - "len": "3", - "leftMin": "0", - "top": "0" - } - }, - { - "type": "colorGradation", - "cellrange": [ - { - "row": [ 10, 15 ], - "column": [ 6, 6 ] - } - ], - "format": [ - "rgb(99, 190, 123)", - "rgb(255, 235, 132)", - "rgb(248, 105, 107)" - ] - } - ] - ``` - ------------- -### frozen -- type:Array -- default:[] -- usage: the settings of freeze row and column which is divided into 6 types - 1. "row": the first freeze row - 2. "column": the first freeze column - 3. "both": the freeze rows and columns - 4. "rangeRow": Freeze row to range - 5. "rangeColumn": Freeze column to range - 6. "rangeBoth": Freeze column and row to range - 7. "cancel": cancel freeze - - When setting the freezing to the selected area, you need to set the cell position to turn on the freezing. The format should like this`{ row_focus:0, column_focus:0 }`,which mean the rows and cols of an active cell. - - The new configuration property of sheet, which stores more semantic configuration, is used to initialize and pass to the server. - - Be careful, you can find `freezenhorizontaldata` in the luckysheetfile that used for freezen, however `freezenhorizontaldata` is only for local debugging。 - -- example: - - Freeze first line - ```json - { - type: 'row' - } - ``` - - Freeze row and column to `'A1'` - ```json - { - type: 'rangeRow', - range: {row_focus: 0, column_focus: 0} - } - ``` - - Freeze row and column to `'B2'` - ```json - { - type: 'rangeBoth', - range: {row_focus: 1, column_focus: 1} - } - ``` - ------------- -### chart -- type:Array -- default:[] -- usage: Chart configuration, plz refer to chartMix configuration. Allows you to set only the desired chart properties. -- example: - :::::: details - ```json - { - "chart_id": "chart_p145W6i73otw_1596209943446", - "width": 400, - "height": 250, - "left": 20, - "top": 120, - "sheetIndex": "Sheet_6az6nei65t1i_1596209937084", - "needRangeShow": true, - "chartOptions": { - "chart_id": "chart_p145W6i73otw_1596209943446", - "chartAllType": "echarts|line|default", - "rangeArray": [ { "row": [ 0, 4 ], "column": [ 0, 7 ] } ], - "rangeColCheck": { "exits": true, "range": [ 0, 0 ] }, - "rangeRowCheck": { "exits": true, "range": [ 0, 0 ] }, - "rangeConfigCheck": false, - "defaultOption": { - "title": { - "show": false, - "text": "default title", - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "position": { - "value": "left-top", - "offsetX": 40, - "offsetY": 50 - } - }, - "subtitle": { - "show": false, - "text": "", - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "distance": { - "value": "auto", - "cusGap": 40 - } - }, - "config": { - "color": "transparent", - "fontFamily": "Sans-serif", - "grid": { - "value": "normal", - "top": 5, - "left": 10, - "right": 20, - "bottom": 10 - } - }, - "legend": { - "show": true, - "selectMode": "multiple", - "selected": [ - { - "seriesName": "衣服", - "isShow": true - }, - { - "seriesName": "食材", - "isShow": true - }, - { - "seriesName": "图书", - "isShow": true - } - ], - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "position": { - "value": "left-top", - "offsetX": 40, - "offsetY": 50, - "direction": "horizontal" - }, - "width": { - "value": "auto", - "cusSize": 25 - }, - "height": { - "value": "auto", - "cusSize": 14 - }, - "distance": { - "value": "auto", - "cusGap": 10 - }, - "itemGap": 10, - "data": [ - "Mon", - "Tues", - "Wed", - "Thur", - "Fri", - "Sat", - "Sun" - ] - }, - "tooltip": { - "show": true, - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "backgroundColor": "rgba(50,50,50,0.7)", - "triggerOn": "mousemove", - "triggerType": "item", - "axisPointer": { - "type": "line", - "style": { - "color": "#555", - "width": "normal", - "type": "solid" - } - }, - "format": [ - { - "seriesName": "衣服", - "prefix": "", - "suffix": "", - "ratio": 1, - "digit": "auto" - }, - { - "seriesName": "食材", - "prefix": "", - "suffix": "", - "ratio": 1, - "digit": "auto" - }, - { - "seriesName": "图书", - "prefix": "", - "suffix": "", - "ratio": 1, - "digit": "auto" - } - ], - "position": "auto" - }, - "axis": { - "axisType": "xAxisDown", - "xAxisUp": { - "show": false, - "title": { - "showTitle": false, - "text": "", - "nameGap": 15, - "rotate": 0, - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "fzPosition": "end" - }, - "name": "显示X轴", - "inverse": false, - "tickLine": { - "show": true, - "width": 1, - "color": "auto" - }, - "tick": { - "show": true, - "position": "outside", - "length": 5, - "width": 1, - "color": "auto" - }, - "tickLabel": { - "show": true, - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "rotate": 0, - "prefix": "", - "suffix": "", - "optimize": 0, - "distance": 0, - "min": "auto", - "max": "auto", - "ratio": 1, - "digit": "auto" - }, - "netLine": { - "show": false, - "width": 1, - "type": "solid", - "color": "auto", - "interval": { - "value": "auto", - "cusNumber": 0 - } - }, - "netArea": { - "show": false, - "interval": { - "value": "auto", - "cusNumber": 0 - }, - "colorOne": "auto", - "colorTwo": "auto" - }, - "axisLine": { - "onZero": false - } - }, - "xAxisDown": { - "show": true, - "title": { - "showTitle": false, - "text": "", - "nameGap": 15, - "rotate": 0, - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "fzPosition": "end" - }, - "name": "显示X轴", - "inverse": false, - "tickLine": { - "show": true, - "width": 1, - "color": "auto" - }, - "tick": { - "show": true, - "position": "outside", - "length": 5, - "width": 1, - "color": "auto" - }, - "tickLabel": { - "show": true, - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "rotate": 0, - "prefix": "", - "suffix": "", - "optimize": 0, - "distance": 0, - "min": null, - "max": null, - "ratio": 1, - "digit": "auto" - }, - "netLine": { - "show": false, - "width": 1, - "type": "solid", - "color": "auto", - "interval": { - "value": "auto", - "cusNumber": 0 - } - }, - "netArea": { - "show": false, - "interval": { - "value": "auto", - "cusNumber": 0 - }, - "colorOne": "auto", - "colorTwo": "auto" - }, - "data": [ - "BUS", - "UBER", - "TAXI", - "SUBWAY" - ], - "type": "category" - }, - "yAxisLeft": { - "show": true, - "title": { - "showTitle": false, - "text": "", - "nameGap": 15, - "rotate": 0, - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "fzPosition": "end" - }, - "name": "显示Y轴", - "inverse": false, - "tickLine": { - "show": true, - "width": 1, - "color": "auto" - }, - "tick": { - "show": true, - "position": "outside", - "length": 5, - "width": 1, - "color": "auto" - }, - "tickLabel": { - "show": true, - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "rotate": 0, - "formatter": { - "prefix": "", - "suffix": "", - "ratio": 1, - "digit": "auto" - }, - "split": 5, - "min": null, - "max": null, - "prefix": "", - "suffix": "", - "ratio": 1, - "digit": "auto", - "distance": 0 - }, - "netLine": { - "show": false, - "width": 1, - "type": "solid", - "color": "auto", - "interval": { - "value": "auto", - "cusNumber": 0 - } - }, - "netArea": { - "show": false, - "interval": { - "value": "auto", - "cusNumber": 0 - }, - "colorOne": "auto", - "colorTwo": "auto" - }, - "type": "value" - }, - "yAxisRight": { - "show": false, - "title": { - "showTitle": false, - "text": "", - "nameGap": 15, - "rotate": 0, - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "fzPosition": "end" - }, - "name": "显示Y轴", - "inverse": false, - "tickLine": { - "show": true, - "width": 1, - "color": "auto" - }, - "tick": { - "show": true, - "position": "outside", - "length": 5, - "width": 1, - "color": "auto" - }, - "tickLabel": { - "show": true, - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "rotate": 0, - "formatter": { - "prefix": "", - "suffix": "", - "ratio": 1, - "digit": "auto" - }, - "split": 5, - "min": null, - "max": null, - "prefix": "", - "suffix": "", - "ratio": 1, - "digit": "auto", - "distance": 0 - }, - "netLine": { - "show": false, - "width": 1, - "type": "solid", - "color": "auto", - "interval": { - "value": "auto", - "cusNumber": 0 - } - }, - "netArea": { - "show": false, - "interval": { - "value": "auto", - "cusNumber": 0 - }, - "colorOne": "auto", - "colorTwo": "auto" - } - } - } - } - }, - "isShow": true - } - ``` - ::: - ------------- -### zoomRatio -- type:Number -- default:1 -- usage: the zoom ratio of a sheet, which is a two decimal digit between 0~1, like `0.1`、`0.56`. - ------------- -### image -- type:Array -- default:[] -- usage: Insert the picture information in the table, including picture address, width and height, position, cropping and other information -- example: - The following is an example of `imageItem`, usually there may be multiple images in a worksheet, so the format of `image` is array `[imageItem,imageItem,...]` - ```json - { - type: '3', //1 Move and resize the cell 2 Move and do not resize the cell 3 Don't move and resize the cell - src:'', //image url - originWidth: 1484, //The original width of the picture - originHeight: 834, //The original height of the picture - default: { - width: 293, //image width - height: 196, //image height - left: 409, //The position of the picture from the left of the table - top: 248, //The position of the picture from the top of the table - }, - crop: { - width: 293, //The width of the picture after cropping - height: 196, //The height of the picture after cropping - offsetLeft: 0, //Displacement from the left of the picture after cropping - offsetTop: 0, //Displacement from the left of the picture after cropping - }, - isFixedPos: false, //Fixed position - fixedLeft: 507, //Fixed position left displacement - fixedTop: 141, //fixed position right displacement - border: { - width: 0, //border width - radius: 0, //Border radius - style:'solid', //border type - color:'#000', //Border color - } - } - ``` ------------- -### showGridLines -- Type: Number -- Default: 1 -- Usage: Whether to show grid lines, `1` means show, `0` means hidden - ------------- - -## debug information -The parameters required for initialization will be designed as simple as possible, but the parameters stored locally are different. - -After initialization, Luckysheet stores more and more local data in luckysheetfile as local parameter. It means that we can realize the usage of Store data center. For example, the format of Freezen's parameters will also change. - -At this point, the lucky sheet file contains many local parameters that are not initialized and can be used to debug、analysis local status. you can use `luckysheet.getluckysheetfile()` to get more information: - -::: details -```json -[ - { - "name": "Cell", //Worksheet name - "color": "", //Worksheet color - "index": 0, //Worksheet index - "status": 1, //Worksheet active status - "order": 0, //The order of the worksheet - "hide": 0,//Whether worksheet hide - "row": 36, //The number of rows in a sheet - "column": 18, //The number of columns in a sheet - "celldata": [], //Initial the cell data - "config": { - "merge":{}, //Merged cells - "rowlen":{}, //Table row height - "columnlen":{}, //Table column width - "rowhidden":{}, //Hidden rows - "colhidden":{}, //Hidden columns - "borderInfo":{}, //Borders - "authority":{}, //Worksheet protection - }, - "scrollLeft": 0, //Left and right scroll bar position - "scrollTop": 315, //Up and down scroll bar position - "luckysheet_select_save": [], //Selected area - "calcChain": [],//Formula chain - "isPivotTable":false,//Whether is pivot table - "pivotTable":{},//Pivot table settings - "filter_select": {},//Filter range - "filter": null,//Filter configuration - "luckysheet_alternateformat_save": [], //Alternate colors - "luckysheet_alternateformat_save_modelCustom": [], //Customize alternate colors - "luckysheet_conditionformat_save": {},//Condition format - "frozen": {}, //Freeze row and column configuration - "freezen": {}, //Storage freeze row and column rendering data - "chart": [], //Chart configuration - "zoomRatio":1, // Zoom ratio - "image":[], //image - "showGridLines": 1, //Whether to show grid lines - - - "visibledatarow": [], //Positions of all rows - "visibledatacolumn": [], //Positions of all columns - "ch_width": 2322, //The width of a sheet - "rh_height": 949, //The heighSt of a sheet - "load": "1", //Check whether this sheed has been loaded - "data": [], // Store and update the cell data - }, - { - "name": "Sheet2", - "color": "", - "index": 1, - "status": 0, - "order": 1, - "celldata": [], - "config": {} - }, - { - "name": "Sheet3", - "color": "", - "index": 2, - "status": 0, - "order": 2, - "celldata": [], - "config": {}, - } -] -``` -::: - -### visibledatarow -- type:Number -- default:[] -- usage: Position information of all rows, incremental row position data, No need to set up for initialization - ------------- -### visibledatacolumn -- type:Number -- default:[] -- usage: Position information of all columns, incremental column position data, No need to set up for initialization - ------------- -### ch_width -- type:Number -- default:2322 -- usage: The width of the entire worksheet area (the gray area including the border), No need to set up for initialization - ------------- -### rh_height -- type:Number -- default:2322 -- usage: The height of the entire worksheet area (the gray area containing the border), No need to set up for initialization - ------------- -### load -- type:Number -- default:0 -- usage: Check whether the current sheet has been loaded, internal indicator, initialization does not need to be set - ------------- -### data -- type:Array -- default:[] -- usage: conveted from celldata in initialization stage. `data` will have the update operation data.Initialization does not need to be set -- example: - Here is a two row, two column data - ```json - [ - [{ - ct: {fa: "General", t: "g"}, - m:"value1", - v:"value1" - }, { - ct: {fa: "General", t: "g"}, - m:"value2", - v:"value2" - }], - [{ - ct: {fa: "General", t: "g"}, - m:"value3", - v:"value3" - }, { - ct: {fa: "General", t: "g"}, - m:"value4", - v:"value4" - }] - ] - - ``` - ------------- +# Sheet Configuration + +## Initial +if you want to initial the `options`, you need to arrange every sheet data to `options.data` + +> when the initialization is done, you can use [`luckysheet.getAllSheets()`](/zh/guide/api.html#getAllSheets([setting])) to get all working sheet configurations. + +eg: options.data: +```json +[ + { + "name": "Cell", //Worksheet name + "color": "", //Worksheet color + "index": 0, //Worksheet index + "status": 1, //Worksheet active status + "order": 0, //The order of the worksheet + "hide": 0,//Whether worksheet hide + "row": 36, //the number of rows in a sheet + "column": 18, //the number of columns in a sheet + "defaultRowHeight": 19, //Customized default row height + "defaultColWidth": 73, //Customized default column width + "celldata": [], //Initial the cell data + "config": { + "merge":{}, //merged cells + "rowlen":{}, //Table row height + "columnlen":{}, //Table column width + "rowhidden":{}, //hidden rows + "colhidden":{}, //hidden columns + "borderInfo":{}, //borders + "authority":{}, //Worksheet protection + }, + "scrollLeft": 0, //Left and right scroll bar position + "scrollTop": 315, //Up and down scroll bar position + "luckysheet_select_save": [], //selected area + "calcChain": [],//Formula chain + "isPivotTable":false,//Whether is pivot table + "pivotTable":{},//Pivot table settings + "filter_select": {},//Filter range + "filter": null,//Filter configuration + "luckysheet_alternateformat_save": [], //Alternate colors + "luckysheet_alternateformat_save_modelCustom": [], //Customize alternate colors + "luckysheet_conditionformat_save": {},//condition format + "frozen": {}, //freeze row and column configuration + "chart": [], //Chart configuration + "zoomRatio":1, // zoom ratio + "image":[], //image + "showGridLines": 1, //Whether to show grid lines + }, + { + "name": "Sheet2", + "color": "", + "index": 1, + "status": 0, + "order": 1, + "celldata": [], + "config": {} + }, + { + "name": "Sheet3", + "color": "", + "index": 2, + "status": 0, + "order": 2, + "celldata": [], + "config": {}, + } +] +``` + +### name +- type:String +- default:"Sheet1" +- usage:the name of a sheet + +------------ +### color +- type:String +- default:"##f20e0e" +- usage:Sheet color, with a bottom border below the sheet name + +------------ +### index +- type:String +- default:"" +- usage:The worksheet index is used as a unique key value, and a random string is automatically assigned when a worksheet is added. Note that `index` is not the order of worksheets, and is distinguished from `order`. + +------------ +### status +- type:Number +- default:1 +- usage:Active state, there is only one active worksheet which number will be 1 and the other worksheets are 0 + +------------ +### order +- type:Number +- default:0 +- usage:The subscript of the worksheet represents the order in which the worksheet is displayed in the sheet bar at the bottom. It will increase when a worksheet is added, starting from 0 + +------------ +### hide +- type:Number +- default:0 +- usage: is the sheet is hidden. `0` means not to hide, `1` means hide + +------------ +### row +- type:Number +- default:36 +- usage: Number of cell rows + +------------ +### column +- type:Number +- default:18 +- usage: Number of cell columns + +------------ +### defaultRowHeight +- type:Number +- default:19 +- usage: Customized default row height, unit is px + +------------ +### defaultColWidth +- type:Number +- default:73 +- usage: Customized default column width, unit is px + +------------ +### celldata +- type:Array +- default:[] +- usage: The original cell data set is a set containing `{r:0,c:0,v:{m:"value",v:"value",ct: {fa: "General", t: "g"}} }`The one-dimensional array of format cell information is only used during initialization. + + `r` represents the row, `c` represents the column, and `v` represents the value of the cell. value could be string, number, or object + + The luckysheet creates a sheet data based on the number of `options.data[i].row` and `options.data[i].column`, then uses `data[r][c]=v` to fullfill tables. Empty data cells are represented as null. + + After initializing the table with celldata,the data is converted to the field [data](#data)in the luckyshetfile such as `luckysheetfile[i].data`. `data` stores the following update data and celldata will no longer be used. + +- example: + ```js + [{ + "r": 0, + "c": 0, + "v": { + ct: {fa: "General", t: "g"}, + m:"value1", + v:"value1" + } + }, { + "r": 0, + "c": 1, + "v": { + ct: {fa: "General", t: "g"}, + m:"value2", + v:"value2" + } + }] + ``` +> more detail [cell format](/zh/guide/cell.html) + +------------ +### config +- type:Object +- default:{} +- usage:Table row height, column width, merged cells, borders, hidden rows and other settings + please be careful, config must be empty object `{}`, rather than empty string `""` or `null` + + +#### config.merge +- type:Object +- default:{} +- usage:Merge cell settings +- example: + ```js + { + "13_5": { + "r": 13, + "c": 5, + "rs": 3, + "cs": 1 + }, + "13_7": { + "r": 13, + "c": 7, + "rs": 3, + "cs": 2 + }, + "14_2": { + "r": 14, + "c": 2, + "rs": 1, + "cs": 2 + } + } + ``` + The `key` in the object is the spliced value of `r +'_' + c`, and the `value` is the cell information in the upper left corner: r: number of rows, c: number of columns, rs: number of merged rows, cs: merge Number of columns + +#### config.rowlen +- type:Object +- default:{} +- usage:The row height of each cell +- example: + ```js + "rowlen": { + "0": 20, + "1": 20, + "2": 20 + } + ``` + +#### config.columnlen +- type:Object +- default:{} +- usage:The column width of each cell +- example: + ```js + "columnlen": { + "0": 97, + "1": 115, + "2": 128 + } + ``` + +#### config.rowhidden +- type:Object +- default:{} +- usage:Hidden row information, Rows:`rowhidden[Rows]: 0`, + + you should specify the number of rows by `key`,`value` is always `0` +- example: + ```js + "rowhidden": { + "30": 0, + "31": 0 + } + ``` + +#### config.colhidden +- type:Object +- default:{} +- usage:Hidden row information, Rows:`rowhidden[Rows]: 0`, + format:`colhidden[Cols]: 0`, + + `key` specify the number of columns,`value` is always `0` +- example: + ```js + "colhidden": { + "30": 0, + "31": 0 + } + ``` + +#### config.borderInfo +- type:Array +- default:{} +- usage:The border information of the cell +- example: + ```js + "borderInfo": [{ + "rangeType": "cell", + "value": { + "row_index": 3, + "col_index": 3, + "l": { + "style": 10, + "color": "rgb(255, 0, 0)" + }, + "r": { + "style": 10, + "color": "rgb(255, 0, 0)" + }, + "t": { + "style": 10, + "color": "rgb(255, 0, 0)" + }, + "b": { + "style": 10, + "color": "rgb(255, 0, 0)" + } + } + }, + { + "rangeType": "range", + "borderType": "border-all", + "style": "3", + "color": "#0000ff", + "range": [{ + "row": [7, 8], + "column": [2, 3] + }] + }, { + "rangeType": "range", + "borderType": "border-inside", + "style": "3", + "color": "#0000ff", + "range": [{ + "row": [7, 8], + "column": [8, 9] + }] + }] + ``` + The range type can be divided into single cell and selected area + 1. selection `rangeType: "range"` + + + Border type `borderType:"border-left" | "border-right" | "border-top" | "border-bottom" | "border-all" | "border-outside" | "border-inside" | "border-horizontal" | "border-vertical" | "border-none"`, + + Border thickness `style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick`, If it corresponds to the value of getLineStyle() of aspose.cells, you need to make a conversion yourself, refer to [aspose.cells](https://apireference.aspose.com/cells/net/aspose.cells/cellbordertype) + + Border color `color: Hexadecimal color value` + + Selection area `range: Row and column information array` + + 2. Single cell `rangeType:"cell"` + + Number of rows and columns `value.row_index: number,value.col_index: number` + + Four border objects `value.l:Left border,value.r:Right border,value.t:Top border,value.b:Bottom border` + + Border thickness `value.l.style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick` + + Border color `value.l.color: Hexadecimal color value` + + templates: + + + ```js + { + "rangeType": "range", + "borderType": "border-all", + "style": "3", + "color": "#0000ff", + "range": [{ + "row": [7, 8], + "column": [2, 3] + }] + } + ``` + Represents a selection with a setting range of `{"row": [7, 8], "column": [2, 3]}`, the type is all borders, the border thickness is `Dotted`, and the color is `"#0000ff"` + + + ```js + { + "rangeType": "cell", + "value": { + "row_index": 3, + "col_index": 3, + "l": { + "style": 10, + "color": "rgb(255, 0, 0)" + }, + "r": { + "style": 10, + "color": "rgb(255, 0, 0)" + }, + "t": { + "style": 10, + "color": "rgb(255, 0, 0)" + }, + "b": { + "style": 10, + "color": "rgb(255, 0, 0)" + } + } + } + ``` + Means to set the cell `"D4"`, the upper border/lower border/left border/right border are all border thicknesses `"MediumDashDot"`, color is `"rgb(255, 0, 0)"` + +#### config.authority +- type:Object +- default:{} +- usage:Worksheet protection, you can set that the entire worksheet is not allowed to be edited or some areas are not editable. If you want to apply for editing permission, you need to enter a password, and customize the types of operations that users can operate. +- example: + ```js + "authority":{//Permission configuration of the current worksheet +     selectLockedCells:1, //Select locked cells +     selectunLockedCells:1, //Select unlocked cells +     formatCells:1, //Format cells +     formatColumns:1, //Format columns +     formatRows:1, //Format rows +     insertColumns:1, //Insert columns +     insertRows:1, //Insert rows +     insertHyperlinks:1, //Insert hyperlinks +     deleteColumns:1, //Delete columns +     deleteRows:1, //Delete rows +     sort:1, //Sort +     filter:1, //Filter +     usePivotTablereports:1, //Use Pivot Table reports +     editObjects:1, //Edit objects +     editScenarios:1, //Edit scenarios    +     sheet:1, //If it is 1 or true, the worksheet is protected; if it is 0 or false, the worksheet is not protected. +     hintText:"", //The text of the pop-up prompt +     algorithmName:"None",//Encryption scheme: MD2,MD4,MD5,RIPEMD-128,RIPEMD-160,SHA-1,SHA-256,SHA-384,SHA-512,WHIRLPOOL +     saltValue:null, //The salt parameter for password decryption is a random value set by yourself +      +     allowRangeList:[{ //Range protection +         name:"area", //Name +         password:"1", //Password +         hintText:"", //Prompt text +         algorithmName:"None",//Encryption scheme: MD2,MD4,MD5,RIPEMD-128,RIPEMD-160,SHA-1,SHA-256,SHA-384,SHA-512,WHIRLPOOL +         saltValue:null, //The salt parameter for password decryption is a random value set by yourself +         sqref:"$C$1:$D$5" //Protected range +     }], + }, + ``` + +------------ +### scrollLeft +- type:Number +- default:0 +- usage: Left and right scroll bar position + +------------ +### scrollTop +- type:Number +- default:0 +- usage: Up and down scroll bar position + +------------ +### luckysheet_select_save +- type:Array +- default:[] +- usage: The selected area supports multiple selections and is a one-dimensional array containing multiple selection objects. +- example: + ```js + [ + { + "row": [ 0, 1 ], + "column": [ 0, 0 ] + }, + { + "row": [ 3, 4 ], + "column": [ 1, 2 ] + }, + { + "row": [ 1, 3 ], + "column": [ 3, 3 ] + } + ] + ``` + +------------ +### calcChain +- type:Array +- default:[] +- usage: Formula chain, used when the cell linked by the formula is changed, all formulas referencing this cell will be refreshed. +- example: + ```js + [{ + "r": 6, //the number of rows + "c": 3, //the number of columns + "index": 1, //sheet id + "func": [true, 23.75, "=AVERAGE(D3:D6)"], //Formula information, including formula calculation results and formula string + "color": "w", //"w":use Depth-First-Search "b":Normal search + "parent": null, + "chidren": {}, + "times": 0 + }, { + "r": 7, + "c": 3, + "index": 1, + "func": [true, 30, "=MAX(D3:D6)"], + "color": "w", + "parent": null, + "chidren": {}, + "times": 0 + }] + ``` + +------------ +### isPivotTable +- type:Boolean +- default:false +- usage: is PivotTable + +------------ +### pivotTable +- type:Object +- default:{} +- usage: Pivot table settings +- example: + ```js + { + "pivot_select_save": { + "row": [0, 12], + "column": [0, 4] + }, + "pivotDataSheetIndex": 6, //The sheet index where the source data is located + "column": [{ + "index": 3, + "name": "subject", + "fullname": "subject" + }], + "row": [{ + "index": 1, + "name": "student", + "fullname": "student" + }], + "filter": [], + "values": [{ + "index": 4, + "name": "score", + "fullname": "count:score", + "sumtype": "COUNTA", + "nameindex": 0 + }], + "showType": "column", + "pivotDatas": [ //Source data for PivotTable + ["count:score", "science", "mathematics", "foreign language", "English", "total"], + ["Alex", 1, 1, 1, 1, 4], + ["Joy", 1, 1, 1, 1, 4], + ["Tim", 1, 1, 1, 1, 4], + ["total", 3, 3, 3, 3, 12] + ], + "drawPivotTable": false, + "pivotTableBoundary": [5, 6] + } + ``` + +------------ +### filter_select +- type:Object +- default:{} +- usage:Filter range. A selection and a sheet have only one filter range, similar to `luckysheet_select_save`. If you just create a selection to turn on the filter function, you can configure this range. If you need to set further detailed filter conditions, you need to configure the [filter](#filter) property of the same level. +- example: + ```js + { + + "row": [ 2, 6 ], + "column": [ 1, 3 ] + } + ``` + +------------ +### filter +- type:Object +- default:{} +- usage:The specific settings of the filter match with the filter range of `filter_select`. When you create a filter area on the first sheet, you can also see the filter configuration information of the first sheet through `luckysheet.getLuckysheetfile()[0].filter`. + + The following is a complete filter configuration example + ```js + { + //"0" means the first column + "0": { + "caljs": { // Filter by condition + "value": "cellnull", // Filter type + "text": "Is empty", // Type description + "type": "0" // Filter categories + }, + "rowhidden": { "3": 0, "4": 0 }, // Hidden row information + "optionstate": true, // Whether to enable configuration + "cindex": 1, // The current range column order, here is the first column + "str": 2, // Range, start row + "edr": 6, // Range, end row + "stc": 1, // Range, start column + "edc": 3 // Range, end column + }, + //"1" means the second column + "1": { + "caljs": {}, + "rowhidden": { "1": 0}, + "optionstate": true, + "cindex": 2, // The current range column order, here is the second column + "str": 2, + "edr": 6, + "stc": 1, + "edc": 3 + } + } + ``` + 1. The `key` value of `filter[key]` means the column index, starting from 0, the `cindex` in the specific setting item starts from 1, which has the same meaning as the `key` here. + 2. `caljs` is used to set the filter type and the corresponding value. After the setting takes effect, the hidden row information will be calculated and stored in `rowhidden`. The following are all the types that can be set, among which `value1` and `value2` are the text information filled in by the user: + + `caljs:{value: null, text: "None", type: "0"}` + + `caljs:{value: "cellnull", text: "Is empty", type: "0"}` + + `caljs:{value: "cellnonull", text: "Is not empty", type: "0"}` + + `caljs:{value: "textinclude", text: "Text contains", type: "1", value1: "Lucky"}` + + `caljs:{value: "textnotinclude", text: "Text does not contain", type: "1", value1: "Lucky"}` + + `caljs:{value: "textstart", text: "Text starts with", type: "1", value1: "Lucky"}` + + `caljs:{value: "textend", text: "Text ends with", type: "1", value1: "Lucky"}` + + `caljs:{value: "textequal", text: "Text is exactly", type: "1", value1: "Lucky"}` + + `caljs:{value: "dateequal", text: "Date is", type: "1", value1: "2020-10-16"}` + + `caljs:{value: "datelessthan", text: "Date is before", type: "1", value1: "2020-10-16"}` + + `caljs:{value: "datemorethan", text: "Date is after", type: "1", value1: "2020-10-16"}` + + `caljs:{value: "morethan", text: "Greater than", type: "1", value1: "10"}` + + `caljs:{value: "moreequalthan", text: "Greater than or equal to", type: "1", value1: "10"}` + + `caljs:{value: "lessthan", text: "Less than", type: "1", value1: "10"}` + + `caljs:{value: "lessequalthan", text: "Less than or equal to", type: "1", value1: "10"}` + + `caljs:{value: "equal", text: "Is equal to", type: "1", value1: "10"}` + + `caljs:{value: "noequal", text: "Is not equal to", type: "1", value1: "10"}` + + `caljs:{value: "include", text: "Is between", type: "2", value1: "15", value2: "25"}` + + `caljs:{value: "noinclude", text: "Is not between", type: "2", value1: "15", value2: "25"}` + 3. `rowhidden` is stored hidden row information, but if `caljs` is not set to filter by conditions, it means that color filtering (if there is a color distinction between the rows) and filtering by value are set. So it can be seen that the priority of `caljs` is greater than that of `rowhidden`. + 4. `optionstate` indicates whether to enable the configuration, this is an internal flag, just set `true` directly. + 5. `cindex` represents the column order currently set, counting from 1 and corresponding to the `key` value of `filter[key]`, and the result is `key`+1. + 6. `str` is the start row, `edr` is the end row, `stc` is the start column, and `edc` is the end column. The four numbers represent the entire filter range, which should be consistent with the content of `filter_select`. + +------------ +### luckysheet_alternateformat_save +- type:Array +- default:[] +- usage: Alternating color configuration +- example: + ```js + [{ + "cellrange": { //cell range + "row": [1, 6], + "column": [1, 5] + }, + "format": { + "head": { //Header color + "fc": "#000", + "bc": "#5ed593" + }, + "one": { //The first color + "fc": "#000", + "bc": "#ffffff" + }, + "two": { //The second color + "fc": "#000", + "bc": "#e5fbee" + }, + "foot": { //Footers color + "fc": "#000", + "bc": "#a5efcc" + } + }, + "hasRowHeader": false, //is included header + "hasRowFooter": false //is included footer + }, { + "cellrange": { + "row": [1, 6], + "column": [8, 12] + }, + "format": { + "head": { + "fc": "#000", + "bc": "#5599fc" + }, + "one": { + "fc": "#000", + "bc": "#ffffff" + }, + "two": { + "fc": "#000", + "bc": "#ecf2fe" + }, + "foot": { + "fc": "#000", + "bc": "#afcbfa" + } + }, + "hasRowHeader": false, + "hasRowFooter": false + }] + ``` + +------------ +### luckysheet_alternateformat_save_modelCustom +- type:Array +- default:[] +- usage:Custom alternate colors, including multiple custom alternate colors configuration +- example: + ```js + [{ + "head": { //Header color + "fc": "#6aa84f", + "bc": "#ffffff" + }, + "one": { //The first color + "fc": "#000", + "bc": "#ffffff" + }, + "two": { //The second color + "fc": "#000", + "bc": "#e5fbee" + }, + "foot": { //The footer color + "fc": "#000", + "bc": "#a5efcc" + } + }] + ``` + +------------ +### luckysheet_conditionformat_save +- type:Array +- default:[] +- usage: Conditional format configuration information, a one-dimensional array containing multiple conditional format configuration objects, + + type: "default": Highlight cell rules and project selection rules, + + "dataBar":Data bar, + + "icons":Icon set, + + "colorGradation": Color scale + + You can get more detail in this API page[API setRangeConditionalFormat](/zh/guide/api.html) +- example: + ```js + [ + { + "type": "default", + "cellrange": [ //cell range + { + "row": [ 2, 7 ], + "column": [ 2, 2 ] + } + ], + "format": { //when type is default, you should set the text color and cell color + "textColor": "#000000", + "cellColor": "#ff0000" + }, + "conditionName": "betweenness", //type + "conditionRange": [ //condition value in the cell + { + "row": [ 4, 4 ], + "column": [ 2, 2 ] + }, + { + "row": [ 6, 6 ], + "column": [ 2, 2 ] + } + ], + "conditionValue": [ 2, 4 + ] //Customize the condition value + }, + { + "type": "dataBar", + "cellrange": [ + { + "row": [ 10, 15 ], + "column": [ 10, 11 ] + } + ], + "format": [ + "#6aa84f", + "#ffffff" + ] + }, + { + "type": "icons", + "cellrange": [ + { + "row": [ 19, 23 ], + "column": [ 2, 2 ] + } + ], + "format": { + "len": "3", + "leftMin": "0", + "top": "0" + } + }, + { + "type": "colorGradation", + "cellrange": [ + { + "row": [ 10, 15 ], + "column": [ 6, 6 ] + } + ], + "format": [ + "rgb(99, 190, 123)", + "rgb(255, 235, 132)", + "rgb(248, 105, 107)" + ] + } + ] + ``` + +------------ +### frozen +- type:Array +- default:[] +- usage: the settings of freeze row and column which is divided into 6 types + 1. "row": the first freeze row + 2. "column": the first freeze column + 3. "both": the freeze rows and columns + 4. "rangeRow": Freeze row to range + 5. "rangeColumn": Freeze column to range + 6. "rangeBoth": Freeze column and row to range + 7. "cancel": cancel freeze + + When setting the freezing to the selected area, you need to set the cell position to turn on the freezing. The format should like this`{ row_focus:0, column_focus:0 }`,which mean the rows and cols of an active cell. + + The new configuration property of sheet, which stores more semantic configuration, is used to initialize and pass to the server. + + Be careful, you can find `freezenhorizontaldata` in the luckysheetfile that used for freezen, however `freezenhorizontaldata` is only for local debugging。 + +- example: + - Freeze first line + ```json + { + type: 'row' + } + ``` + - Freeze row and column to `'A1'` + ```json + { + type: 'rangeRow', + range: {row_focus: 0, column_focus: 0} + } + ``` + - Freeze row and column to `'B2'` + ```json + { + type: 'rangeBoth', + range: {row_focus: 1, column_focus: 1} + } + ``` + +------------ +### chart +- type:Array +- default:[] +- usage: Chart configuration, plz refer to chartMix configuration. Allows you to set only the desired chart properties. +- example: + :::::: details + ```json + { + "chart_id": "chart_p145W6i73otw_1596209943446", + "width": 400, + "height": 250, + "left": 20, + "top": 120, + "sheetIndex": "Sheet_6az6nei65t1i_1596209937084", + "needRangeShow": true, + "chartOptions": { + "chart_id": "chart_p145W6i73otw_1596209943446", + "chartAllType": "echarts|line|default", + "rangeArray": [ { "row": [ 0, 4 ], "column": [ 0, 7 ] } ], + "rangeColCheck": { "exits": true, "range": [ 0, 0 ] }, + "rangeRowCheck": { "exits": true, "range": [ 0, 0 ] }, + "rangeConfigCheck": false, + "defaultOption": { + "title": { + "show": false, + "text": "default title", + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "position": { + "value": "left-top", + "offsetX": 40, + "offsetY": 50 + } + }, + "subtitle": { + "show": false, + "text": "", + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "distance": { + "value": "auto", + "cusGap": 40 + } + }, + "config": { + "color": "transparent", + "fontFamily": "Sans-serif", + "grid": { + "value": "normal", + "top": 5, + "left": 10, + "right": 20, + "bottom": 10 + } + }, + "legend": { + "show": true, + "selectMode": "multiple", + "selected": [ + { + "seriesName": "衣服", + "isShow": true + }, + { + "seriesName": "食材", + "isShow": true + }, + { + "seriesName": "图书", + "isShow": true + } + ], + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "position": { + "value": "left-top", + "offsetX": 40, + "offsetY": 50, + "direction": "horizontal" + }, + "width": { + "value": "auto", + "cusSize": 25 + }, + "height": { + "value": "auto", + "cusSize": 14 + }, + "distance": { + "value": "auto", + "cusGap": 10 + }, + "itemGap": 10, + "data": [ + "Mon", + "Tues", + "Wed", + "Thur", + "Fri", + "Sat", + "Sun" + ] + }, + "tooltip": { + "show": true, + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "backgroundColor": "rgba(50,50,50,0.7)", + "triggerOn": "mousemove", + "triggerType": "item", + "axisPointer": { + "type": "line", + "style": { + "color": "#555", + "width": "normal", + "type": "solid" + } + }, + "format": [ + { + "seriesName": "衣服", + "prefix": "", + "suffix": "", + "ratio": 1, + "digit": "auto" + }, + { + "seriesName": "食材", + "prefix": "", + "suffix": "", + "ratio": 1, + "digit": "auto" + }, + { + "seriesName": "图书", + "prefix": "", + "suffix": "", + "ratio": 1, + "digit": "auto" + } + ], + "position": "auto" + }, + "axis": { + "axisType": "xAxisDown", + "xAxisUp": { + "show": false, + "title": { + "showTitle": false, + "text": "", + "nameGap": 15, + "rotate": 0, + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "fzPosition": "end" + }, + "name": "显示X轴", + "inverse": false, + "tickLine": { + "show": true, + "width": 1, + "color": "auto" + }, + "tick": { + "show": true, + "position": "outside", + "length": 5, + "width": 1, + "color": "auto" + }, + "tickLabel": { + "show": true, + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "rotate": 0, + "prefix": "", + "suffix": "", + "optimize": 0, + "distance": 0, + "min": "auto", + "max": "auto", + "ratio": 1, + "digit": "auto" + }, + "netLine": { + "show": false, + "width": 1, + "type": "solid", + "color": "auto", + "interval": { + "value": "auto", + "cusNumber": 0 + } + }, + "netArea": { + "show": false, + "interval": { + "value": "auto", + "cusNumber": 0 + }, + "colorOne": "auto", + "colorTwo": "auto" + }, + "axisLine": { + "onZero": false + } + }, + "xAxisDown": { + "show": true, + "title": { + "showTitle": false, + "text": "", + "nameGap": 15, + "rotate": 0, + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "fzPosition": "end" + }, + "name": "显示X轴", + "inverse": false, + "tickLine": { + "show": true, + "width": 1, + "color": "auto" + }, + "tick": { + "show": true, + "position": "outside", + "length": 5, + "width": 1, + "color": "auto" + }, + "tickLabel": { + "show": true, + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "rotate": 0, + "prefix": "", + "suffix": "", + "optimize": 0, + "distance": 0, + "min": null, + "max": null, + "ratio": 1, + "digit": "auto" + }, + "netLine": { + "show": false, + "width": 1, + "type": "solid", + "color": "auto", + "interval": { + "value": "auto", + "cusNumber": 0 + } + }, + "netArea": { + "show": false, + "interval": { + "value": "auto", + "cusNumber": 0 + }, + "colorOne": "auto", + "colorTwo": "auto" + }, + "data": [ + "BUS", + "UBER", + "TAXI", + "SUBWAY" + ], + "type": "category" + }, + "yAxisLeft": { + "show": true, + "title": { + "showTitle": false, + "text": "", + "nameGap": 15, + "rotate": 0, + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "fzPosition": "end" + }, + "name": "显示Y轴", + "inverse": false, + "tickLine": { + "show": true, + "width": 1, + "color": "auto" + }, + "tick": { + "show": true, + "position": "outside", + "length": 5, + "width": 1, + "color": "auto" + }, + "tickLabel": { + "show": true, + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "rotate": 0, + "formatter": { + "prefix": "", + "suffix": "", + "ratio": 1, + "digit": "auto" + }, + "split": 5, + "min": null, + "max": null, + "prefix": "", + "suffix": "", + "ratio": 1, + "digit": "auto", + "distance": 0 + }, + "netLine": { + "show": false, + "width": 1, + "type": "solid", + "color": "auto", + "interval": { + "value": "auto", + "cusNumber": 0 + } + }, + "netArea": { + "show": false, + "interval": { + "value": "auto", + "cusNumber": 0 + }, + "colorOne": "auto", + "colorTwo": "auto" + }, + "type": "value" + }, + "yAxisRight": { + "show": false, + "title": { + "showTitle": false, + "text": "", + "nameGap": 15, + "rotate": 0, + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "fzPosition": "end" + }, + "name": "显示Y轴", + "inverse": false, + "tickLine": { + "show": true, + "width": 1, + "color": "auto" + }, + "tick": { + "show": true, + "position": "outside", + "length": 5, + "width": 1, + "color": "auto" + }, + "tickLabel": { + "show": true, + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "rotate": 0, + "formatter": { + "prefix": "", + "suffix": "", + "ratio": 1, + "digit": "auto" + }, + "split": 5, + "min": null, + "max": null, + "prefix": "", + "suffix": "", + "ratio": 1, + "digit": "auto", + "distance": 0 + }, + "netLine": { + "show": false, + "width": 1, + "type": "solid", + "color": "auto", + "interval": { + "value": "auto", + "cusNumber": 0 + } + }, + "netArea": { + "show": false, + "interval": { + "value": "auto", + "cusNumber": 0 + }, + "colorOne": "auto", + "colorTwo": "auto" + } + } + } + } + }, + "isShow": true + } + ``` + ::: + +------------ +### zoomRatio +- type:Number +- default:1 +- usage: the zoom ratio of a sheet, which is a two decimal digit between 0~1, like `0.1`、`0.56`. + +------------ +### image +- type:Array +- default:[] +- usage: Insert the picture information in the table, including picture address, width and height, position, cropping and other information +- example: + The following is an example of `imageItem`, usually there may be multiple images in a worksheet, so the format of `image` is array `[imageItem,imageItem,...]` + ```json + { + type: '3', //1 Move and resize the cell 2 Move and do not resize the cell 3 Don't move and resize the cell + src:'', //image url + originWidth: 1484, //The original width of the picture + originHeight: 834, //The original height of the picture + default: { + width: 293, //image width + height: 196, //image height + left: 409, //The position of the picture from the left of the table + top: 248, //The position of the picture from the top of the table + }, + crop: { + width: 293, //The width of the picture after cropping + height: 196, //The height of the picture after cropping + offsetLeft: 0, //Displacement from the left of the picture after cropping + offsetTop: 0, //Displacement from the left of the picture after cropping + }, + isFixedPos: false, //Fixed position + fixedLeft: 507, //Fixed position left displacement + fixedTop: 141, //fixed position right displacement + border: { + width: 0, //border width + radius: 0, //Border radius + style:'solid', //border type + color:'#000', //Border color + } + } + ``` +------------ +### showGridLines +- Type: Number +- Default: 1 +- Usage: Whether to show grid lines, `1` means show, `0` means hidden + +------------ + +## debug information +The parameters required for initialization will be designed as simple as possible, but the parameters stored locally are different. + +After initialization, Luckysheet stores more and more local data in luckysheetfile as local parameter. It means that we can realize the usage of Store data center. For example, the format of Freezen's parameters will also change. + +At this point, the lucky sheet file contains many local parameters that are not initialized and can be used to debug、analysis local status. you can use `luckysheet.getluckysheetfile()` to get more information: + +::: details +```json +[ + { + "name": "Cell", //Worksheet name + "color": "", //Worksheet color + "index": 0, //Worksheet index + "status": 1, //Worksheet active status + "order": 0, //The order of the worksheet + "hide": 0,//Whether worksheet hide + "row": 36, //The number of rows in a sheet + "column": 18, //The number of columns in a sheet + "celldata": [], //Initial the cell data + "config": { + "merge":{}, //Merged cells + "rowlen":{}, //Table row height + "columnlen":{}, //Table column width + "rowhidden":{}, //Hidden rows + "colhidden":{}, //Hidden columns + "borderInfo":{}, //Borders + "authority":{}, //Worksheet protection + }, + "scrollLeft": 0, //Left and right scroll bar position + "scrollTop": 315, //Up and down scroll bar position + "luckysheet_select_save": [], //Selected area + "calcChain": [],//Formula chain + "isPivotTable":false,//Whether is pivot table + "pivotTable":{},//Pivot table settings + "filter_select": {},//Filter range + "filter": null,//Filter configuration + "luckysheet_alternateformat_save": [], //Alternate colors + "luckysheet_alternateformat_save_modelCustom": [], //Customize alternate colors + "luckysheet_conditionformat_save": {},//Condition format + "frozen": {}, //Freeze row and column configuration + "freezen": {}, //Storage freeze row and column rendering data + "chart": [], //Chart configuration + "zoomRatio":1, // Zoom ratio + "image":[], //image + "showGridLines": 1, //Whether to show grid lines + + + "visibledatarow": [], //Positions of all rows + "visibledatacolumn": [], //Positions of all columns + "ch_width": 2322, //The width of a sheet + "rh_height": 949, //The heighSt of a sheet + "load": "1", //Check whether this sheed has been loaded + "data": [], // Store and update the cell data + }, + { + "name": "Sheet2", + "color": "", + "index": 1, + "status": 0, + "order": 1, + "celldata": [], + "config": {} + }, + { + "name": "Sheet3", + "color": "", + "index": 2, + "status": 0, + "order": 2, + "celldata": [], + "config": {}, + } +] +``` +::: + +### visibledatarow +- type:Number +- default:[] +- usage: Position information of all rows, incremental row position data, No need to set up for initialization + +------------ +### visibledatacolumn +- type:Number +- default:[] +- usage: Position information of all columns, incremental column position data, No need to set up for initialization + +------------ +### ch_width +- type:Number +- default:2322 +- usage: The width of the entire worksheet area (the gray area including the border), No need to set up for initialization + +------------ +### rh_height +- type:Number +- default:2322 +- usage: The height of the entire worksheet area (the gray area containing the border), No need to set up for initialization + +------------ +### load +- type:Number +- default:0 +- usage: Check whether the current sheet has been loaded, internal indicator, initialization does not need to be set + +------------ +### data +- type:Array +- default:[] +- usage: conveted from celldata in initialization stage. `data` will have the update operation data.Initialization does not need to be set +- example: + Here is a two row, two column data + ```json + [ + [{ + ct: {fa: "General", t: "g"}, + m:"value1", + v:"value1" + }, { + ct: {fa: "General", t: "g"}, + m:"value2", + v:"value2" + }], + [{ + ct: {fa: "General", t: "g"}, + m:"value3", + v:"value3" + }, { + ct: {fa: "General", t: "g"}, + m:"value4", + v:"value4" + }] + ] + + ``` + +------------ diff --git a/docs/zh/README.md b/docs/zh/README.md index 67ac3339d..57ed7c34e 100644 --- a/docs/zh/README.md +++ b/docs/zh/README.md @@ -1,15 +1,15 @@ ---- -home: true -heroText: Luckysheet -tagline: 配置文档 · API · 教程 -actionText: 快速上手 → -actionLink: /zh/guide/ -features: -- title: 功能强大 - details: 包含大量常用电子表格功能,替代你的excel -- title: 配置简单 - details: 最少的配置就能开始上手使用 -- title: 完全开源 - details: 社区驱动,共同来完善你的想法 -footer: MIT Licensed | Copyright © 2020-present Mengshukeji +--- +home: true +heroText: Luckysheet +tagline: 配置文档 · API · 教程 +actionText: 快速上手 → +actionLink: /zh/guide/ +features: +- title: 功能强大 + details: 包含大量常用电子表格功能,替代你的excel +- title: 配置简单 + details: 最少的配置就能开始上手使用 +- title: 完全开源 + details: 社区驱动,共同来完善你的想法 +footer: MIT Licensed | Copyright © 2020-present Mengshukeji --- \ No newline at end of file diff --git a/docs/zh/about/README.md b/docs/zh/about/README.md index fa46a8f27..1b0552ca1 100644 --- a/docs/zh/about/README.md +++ b/docs/zh/about/README.md @@ -1,28 +1,28 @@ -# 认识团队 - -Luckysheet是由个人主导、几个志同道合的小伙伴一同开发的项目。 - -## 核心团队活跃成员 -- [@wbfsa](https://github.com/wbfsa) -- [@eiji-th](https://github.com/eiji-th) -- [@fly-95](https://github.com/fly-95) -- [@tonytonychopper123](https://github.com/tonytonychopper123) -- [@Dushusir](https://github.com/Dushusir) -- [@iamxuchen800117](https://github.com/iamxuchen800117) -- [@wpxp123456](https://github.com/wpxp123456) -- [@c19c19i](https://weibo.com/u/3884623955) -- [@zhangchen915](https://github.com/zhangchen915) -- [@jerry-f](https://github.com/jerry-f) -- [@flowerField](https://github.com/flowerField) - -## 社区伙伴 -- [@yiwasheng](https://github.com/yiwasheng) -- [@danielcai1987](https://github.com/danielcai1987) -- [@qq6690876](https://github.com/qq6690876) -- [@javahuang](https://github.com/javahuang) -- [@TimerGang](https://github.com/TimerGang) -- [@gsw945](https://github.com/gsw945) -- [@swen-xiong](https://github.com/swen-xiong) -- [@lzmch](https://github.com/lzmch) -- [@kdevilpf](https://github.com/kdevilpf) +# 认识团队 + +Luckysheet是由个人主导、几个志同道合的小伙伴一同开发的项目。 + +## 核心团队活跃成员 +- [@wbfsa](https://github.com/wbfsa) +- [@eiji-th](https://github.com/eiji-th) +- [@fly-95](https://github.com/fly-95) +- [@tonytonychopper123](https://github.com/tonytonychopper123) +- [@Dushusir](https://github.com/Dushusir) +- [@iamxuchen800117](https://github.com/iamxuchen800117) +- [@wpxp123456](https://github.com/wpxp123456) +- [@c19c19i](https://weibo.com/u/3884623955) +- [@zhangchen915](https://github.com/zhangchen915) +- [@jerry-f](https://github.com/jerry-f) +- [@flowerField](https://github.com/flowerField) + +## 社区伙伴 +- [@yiwasheng](https://github.com/yiwasheng) +- [@danielcai1987](https://github.com/danielcai1987) +- [@qq6690876](https://github.com/qq6690876) +- [@javahuang](https://github.com/javahuang) +- [@TimerGang](https://github.com/TimerGang) +- [@gsw945](https://github.com/gsw945) +- [@swen-xiong](https://github.com/swen-xiong) +- [@lzmch](https://github.com/lzmch) +- [@kdevilpf](https://github.com/kdevilpf) - [@WJWM0316](https://github.com/WJWM0316) \ No newline at end of file diff --git a/docs/zh/about/company.md b/docs/zh/about/company.md index 8e5ff6eb6..727ff2264 100644 --- a/docs/zh/about/company.md +++ b/docs/zh/about/company.md @@ -1,49 +1,49 @@ -# 社区案例 - -我们搜集到了很多来自社区的案例反馈,还发现了以前我们没有预想到的Luckysheet使用场景。 - -积极聆听社区的声音,在大家的支持和反馈中不断更新迭代,已是我们的责任。 - - -## 公司案例 - - - - - - - - - - - - - - - - +# 社区案例 + +我们搜集到了很多来自社区的案例反馈,还发现了以前我们没有预想到的Luckysheet使用场景。 + +积极聆听社区的声音,在大家的支持和反馈中不断更新迭代,已是我们的责任。 + + +## 公司案例 + +
- - - -

雄安智评云数字科技有限公司

-
- - - -

Code the Future

-
- - - -

吉客云

-
- - - -

华为

-
- - - -
+ + + + + + + + + + + + + +
+ + + +

雄安智评云数字科技有限公司

+
+ + + +

Code the Future

+
+ + + +

吉客云

+
+ + + +

华为

+
+ + + +
\ No newline at end of file diff --git a/docs/zh/about/sponsor.md b/docs/zh/about/sponsor.md index 987f90b54..e9f28a278 100644 --- a/docs/zh/about/sponsor.md +++ b/docs/zh/about/sponsor.md @@ -1,71 +1,156 @@ -# 赞助 - -## 为什么赞助 - -如果您经营一家企业并在盈利产品中使用Luckysheet,那么赞助Luckysheet开发将具有商业意义:它可确保您的产品所依赖的项目保持健康并得到积极维护。 它还可以帮助您在Luckysheet社区中曝光,使得更多的人关注您的产品。 - -当然,如果Luckysheet在您的工作或个人项目中为您提供了帮助,也欢迎请作者喝杯果汁😋。 - -## 赞助方式 - -Luckysheet是MIT许可的开源项目,其持续稳定的开发离不开这些优秀的 [**支持者**](#赞助者列表)。 如果您想加入他们,请考虑: - -- [成为Patreon的支持者或赞助商](https://www.patreon.com/mengshukeji) -- [成为Open Collective的支持者或赞助商](https://opencollective.com/luckysheet) -- 通过PayPal,微信或支付宝一次性捐赠 - -| PayPal | 微信 | 支付宝 | -|---|---|---| -| [Paypal Me](https://www.paypal.me/wbfsa) | | | - -### Patreon和OpenCollective有什么区别? - -通过Patreon捐赠的资金将直接用于支持menshshukeji在Luckysheet上的工作。 通过OpenCollective捐赠的资金由透明费用管理,将用于补偿核心团队成员的工作和费用或赞助社区活动。 通过在任一平台上捐款,您的姓名/徽标将得到适当的认可和曝光。 - -## 赞助者列表 - -(按时间顺序排列) -- *勇 ¥ 30 -- 虚我 ¥ 200 -- 甜党 ¥ 50 -- Alphabet(Google)-gcf ¥ 1 -- **平 ¥ 100 -- **东 ¥ 10 -- debugger ¥ 20 -- 烦了烦 ¥ 10 -- 文顶顶 ¥ 200 -- yangxshn ¥ 10 -- 爱乐 ¥ 100 -- 小李飞刀刀 ¥ 66 -- 张铭 ¥ 200 -- 曹治军 ¥ 1 -- *特 ¥ 10 -- **权 ¥ 9.9 -- **sdmq ¥ 20 -- *旭 ¥ 10 -- Quentin ¥ 20 -- 周宇凡 ¥ 100 -- *超 ¥ 10 -- 维宁 ¥ 100 -- hyy ¥ 20 -- 雨亭寒江月 ¥ 50 -- **功 ¥ 10 -- **光 ¥ 20 -- terrywan ¥ 100 -- 王晓洪 ¥ 10 -- Sun ¥ 10 -- 忧绣 ¥ 100 -- Jasonx ¥ 10 -- 国勇 ¥ 66.6 -- 郎志 ¥ 100 -- 匿名 ¥ 1 -- ni ¥ 100 -- 苏 ¥ 50 -- Mads_chan ¥ 1 -- LK ¥ 100 -- 智连方舟 李汪石 ¥ 168 -- **发 ¥ 260 -- *超 ¥ 10 -- *勇 ¥ 10 -- *腾 ¥ 15 -- 名字好难起 ¥ 20 \ No newline at end of file +# 赞助 + +## 为什么赞助 + +如果您经营一家企业并在盈利产品中使用Luckysheet,那么赞助Luckysheet开发将具有商业意义:它可确保您的产品所依赖的项目保持健康并得到积极维护。 它还可以帮助您在Luckysheet社区中曝光,使得更多的人关注您的产品。 + +当然,如果Luckysheet在您的工作或个人项目中为您提供了帮助,也欢迎请作者喝杯果汁😋。 + +## 赞助方式 + +Luckysheet是MIT许可的开源项目,其持续稳定的开发离不开这些优秀的 [**支持者**](#赞助者列表)。 如果您想加入他们,请考虑: + +- [成为Patreon的支持者或赞助商](https://www.patreon.com/mengshukeji) +- [成为Open Collective的支持者或赞助商](https://opencollective.com/luckysheet) +- 通过PayPal,微信或支付宝一次性捐赠 + +| PayPal | 微信 | 支付宝 | +|---|---|---| +| [Paypal Me](https://www.paypal.me/wbfsa) | | | + +### Patreon和OpenCollective有什么区别? + +通过Patreon捐赠的资金将直接用于支持menshshukeji在Luckysheet上的工作。 通过OpenCollective捐赠的资金由透明费用管理,将用于补偿核心团队成员的工作和费用或赞助社区活动。 通过在任一平台上捐款,您的姓名/徽标将得到适当的认可和曝光。 + +## 赞助者列表 + +(按时间顺序排列) +- *涛 ¥ 200 +- popo ¥ 1 +- 孔垂善 ¥ 5 +- Shawn文 ¥ 99 +- 幸运的小路易 ¥ 1 +- 冯启俊 ¥ 88 +- mxb ¥ 10 +- 祭阳 ¥ 20 +- *勇 ¥ 30 +- 虚我 ¥ 200 +- 甜党 ¥ 50 +- Alphabet(Google)-gcf ¥ 1 +- **平 ¥ 100 +- **东 ¥ 10 +- debugger ¥ 20 +- 烦了烦 ¥ 10 +- 文顶顶 ¥ 200 +- yangxshn ¥ 10 +- 爱乐 ¥ 100 +- 小李飞刀刀 ¥ 66 +- 张铭 ¥ 200 +- 曹治军 ¥ 1 +- *特 ¥ 10 +- **权 ¥ 9.9 +- **sdmq ¥ 20 +- *旭 ¥ 10 +- Quentin ¥ 20 +- 周宇凡 ¥ 100 +- *超 ¥ 10 +- 维宁 ¥ 100 +- hyy ¥ 20 +- 雨亭寒江月 ¥ 50 +- **功 ¥ 10 +- **光 ¥ 20 +- terrywan ¥ 100 +- 王晓洪 ¥ 10 +- Sun ¥ 10 +- 忧绣 ¥ 100 +- Jasonx ¥ 10 +- 国勇 ¥ 66.6 +- 郎志 ¥ 100 +- 匿名 ¥ 1 +- ni ¥ 100 +- 苏 ¥ 50 +- Mads_chan ¥ 1 +- LK ¥ 100 +- 智连方舟 李汪石 ¥ 168 +- **发 ¥ 260 +- *超 ¥ 10 +- *勇 ¥ 10 +- *腾 ¥ 15 +- 名字好难起 ¥ 20 +- 大山 ¥ 1 +- waiting ¥ 1000 +- **宇 ¥ 10.00 +- 刘小帅的哥哥 ¥ 20.00 +- 宁静致远 ¥ 10.00 +- Eleven ¥ 1.00 +- **帆 ¥ 188 +- henry ¥ 100 +- .波罗 ¥ 50 +- 花落有家 ¥ 50 +- 踏遍南水北山 ¥ 1 +- LC ¥ 5 +- **明 ¥ 8.80 +- *军 ¥ 20 +- 张彪 ¥ 50 +- 企业文档云@肖敏 ¥ 10 +- 匿名 ¥ 50 +- 逍遥行 ¥ 10 +- z.wasaki ¥ 50 +- Make Children ¥ 20 +- Foam ¥ 20 +- 奥特曼( o|o)ノ三 ¥ 50 +- **凯 ¥ 10 +- **兵 ¥ 20 +- **川 ¥ 1 +- 二万 ¥ 50 +- 蔚然成林 ¥ 10 +- 邹杰 ¥ 10 +- 张永强 ¥ 50 +- 鱼得水 ¥ 50 +- Ccther ¥ 1 +- Eric Cheng ¥ 10 +- 佚名 ¥ 1 +- 花叶 ¥ 50 +- GT ¥ 20 +- 菜菜心 ¥ 10 +- fisher ¥ 1 +- JC ¥ 5 +- 佚名 ¥ 20 +- 独孤一剑 ¥ 50 +- mxt ¥ 20 +- 一叶迷山 ¥ 100 +- Jeff ¥ 100 +- 八千多条狗🐶 ¥ 100 +- 晓峰 ¥ 10 +- 戒 ¥ 1 +- 浪里个浪 ¥ 1 +- 回调函数 ¥ 50 +- 赖瓜子 ¥ 5 +- Milo•J ¥ 20 +- 可道云 ¥ 200 +- *程 ¥ 10 +- 来一杯卡布酸奶 ¥ 5 +- 刘久胜 ¥ 100 +- 快意江湖 ¥ 50 +- *新 ¥ 9.9 +- **龙 ¥ 100 +- **江 ¥ 100 +- **威 ¥ 9.8 +- **涛 ¥ 500 +- **嘉 ¥ 10 +- *涛 ¥ 1 +- *兵 ¥ 5 +- *阳 ¥ 200 +- *辉 ¥ 1 +- *帆 ¥ 30 +- **旺 ¥ 10 +- **麟 ¥ 20 +- *霖 ¥ 9.9 +- *帅 ¥ 10 +- *鑫 ¥ 6.66 +- ~朴:shu ¥ 29.79 +- 未来 ¥ 1 +- 国勇 ¥ 0.1 +- 用心灵听雨 ¥ 10 +- 钊 ¥ 5 +- 星稀 ¥ 5 \ No newline at end of file diff --git a/docs/zh/guide/FAQ.md b/docs/zh/guide/FAQ.md index 60b130d2e..bdd430e75 100644 --- a/docs/zh/guide/FAQ.md +++ b/docs/zh/guide/FAQ.md @@ -1,326 +1,325 @@ -# 常见问题 - -本章内容搜集了大家反馈的常见问题,如果官方文档和此列表都不能解答您的疑问,推荐到[官方论坛](https://github.com/mengshukeji/Luckysheet/discussions)反馈 - -## luckysheetfile中的data和celldata有什么区别? - -**A**:表格初始化时使用一维数组格式的 [celldata](/zh/guide/sheet.html#celldata),初始化完成后转化为二维数组格式的data作为存储更新使用,celldata不再使用。 - -如果需要将`data`拿出来作为初始化数据,则需要执行 [transToCellData(data)](/zh/guide/api.html#transtocelldata-data-setting)转换为celldata数据。 -其中`{ r, c, v }`格式的celldata转换为二维数组使用的是[transToData(celldata)](/zh/guide/api.html#transtodata-celldata-setting) - -总结如下: -```js -// data => celldata 二维数组数据 转化成 {r, c, v}格式 一维数组 -luckysheet.transToCellData(data) - -// celldata => data 生成表格所需二维数组 -luckysheet.transToData(celldata) -``` - ------------- - -## 单元格的类型有哪些? - -**A**:参考[单元格格式列表](/zh/guide/cell.html),例举了可用的单元格格式 - ------------- - -## 如何在Vue/React项目中使用Luckysheet? - -**A**:参考 - -- Vue案例:[luckysheet-vue](https://github.com/mengshukeji/luckysheet-vue) -- React案例:[luckysheet-react](https://github.com/mengshukeji/luckysheet-react) - ------------- - -## 为什么初始化后表格里面的公式不会被触发? - -**A**:参考 [表格数据格式](/zh/guide/sheet.html#calcchain) ,设置单元格数据对应的calcChain即可。 - ------------- - -## 远端加载数据是loadUrl还是updateUrl? - -**A**:[loadUrl](/zh/guide/config.html#loadurl)。配置了loadUrl,Luckysheet会通过ajax请求整个表格数据,而updateUrl会作为协同编辑实时保存的接口地址。 -注意:初始化数据需要配置loadUrl参数,而协同编辑则在配置loadUrl、updateUrl和allowUpdate四个参数才能生效。 - ------------- - -## 每个sheet页的`index`和`order`有什么区别? - -**A**:每个sheet页都有一个唯一id,就是`index`,可以用数字递增,也可以使用随机字符串,而`order`是所有的sheet的排序情况,从0开始,只能为数字`0,1,2...`。 - ------------- - -## dist文件夹下为什么不能直接运行项目? - -**A**:需要启动本地服务器 - -- [Node搭建本地服务器](https://github.com/JacksonTian/anywhere) -- [Python搭建本地服务器](https://developer.mozilla.org/zh-CN/docs/Learn/Common_questions/set_up_a_local_testing_server) - ------------- - -## excel导入导出怎么做? - -**A**:配合Luckysheet开发的excel导入导出库-[Luckyexcel](https://github.com/mengshukeji/Luckyexcel)已经实现了excel导入功能,导出功能正在开发当中。现阶段excel导出可以参考这2篇博文: - -- [基于LuckySheet在线表格的Excel下载功能开发](https://www.cnblogs.com/recode-hyh/p/13168226.html) -- [使用exceljs导出luckysheet表格](https://blog.csdn.net/csdn_lsy/article/details/107179708) - ------------- - -## 初始化时合并单元格怎么做? - -**A**:参考以下案例 -- [Luckysheet如何初始化含合并单元格的数据](https://www.cnblogs.com/DuShuSir/p/13272397.html) - ------------- - -## Luckysheet如何把表格里的数据保存到数据库?有没有服务端存储和协作的解决方案? - -**A**:有两个方案: - -- 一是表格操作完成后,使用`luckysheet.getAllSheets()`方法获取到全部的工作表数据,全部发送到后台存储。 -- 二是开启协同编辑功能,实时传输数据给后端。 -具体的操作步骤参考这篇文章:[Luckysheet如何把表格里的数据保存到数据库](https://www.cnblogs.com/DuShuSir/p/13857874.html) - ------------- - -## 如何监听单元格hover或者点击事件?`cellRenderAfter`如何实时监听变化? - -**A**:我们搜集到需要针对单元格事件的二次开发需求,规划了单元格相关的钩子函数,参考[单元格钩子函数](/zh/guide/config.html#cellrenderafter)(显示的TODO的暂未开放) - ------------- - -## 顶部的工具栏不支持自定义配置? - -**A**: -顶部工具栏的自定义配置使用初始[options.showtoolbarconfig](/zh/guide/config.html#showtoolbarconfig)(如果标注TODO表示暂未开发) - ------------- - -## 项目使用了jQuery吗? - -**A**:是的。Luckysheet内部启动时间比开源的时间早很多,所以用到了jQuery。打包工具会把jQuery集成到打包目录的`./plugins/js/plugin.js`文件中。 - -如果您的项目中(比如React/Vue)也自己全局引用了jQuery,且造成了冲突,可以尝试去掉一个jQuery。 - -要想在Luckysheet里去除jQuery,需要在源码根目录下的`gulpfile.js`文件中找到打包jQuery的地方:[src/plugins/js/jquery.min.js](https://github.com/mengshukeji/Luckysheet/blob/master/gulpfile.js),删除jQuery相关的信息即可。 - ------------- - -## 如何为单元格对象新增字段? - -**A**:首先参考[单元格对象格式](/zh/guide/cell.html),然后参照源码批注的部分[src/controllers/postil.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/postil.js)。批注是一个加在单元格对象上的一个配置。 - ------------- - -## 工具栏图标加载不出来? - -**A**:工具栏及其他部分图标采用了iconfont图标,加载不出来是因为缺少了iconfont.css的引入,之前旧版官方文档未写清楚这一点对大家造成误导,很抱歉。 - -详细的Luckysheet使用教程参考已经更新的[官方文档](/zh/guide/#使用步骤) - ------------- - -## Luckyexcel打包后不动? - -**A**:打包的终端命令行不显示结束,但是如果`dist`文件夹内已经有了结果文件`luckyexcel.js`,则表明是正常的。 - -Luckyexcel是excel导入导出库,项目采用了gulp作为打包工具,旧版打包工具有点问题在命令行显示这块有些问题,问题已经修复。请还出现此问题的小伙伴做如下更新操作: -1. pull最新代码 -2. `npm i` -3. `npm run build` - -更多详细信息关注:[Luckyexcel](https://github.com/mengshukeji/Luckyexcel/) - ------------- - -## 单元格不可编辑如何控制?表格保护怎么操作? - -**A**:单元格不可编辑属于工作表保护的功能范畴,需要配置在每个sheet页中`config.authority`,最新的设置参数请参考[工作表保护](/zh/guide/sheet.html#config-authority)。 - -为了大家便于理解工作表保护的功能使用,下方的视频演示了如何让当前整个工作表不可编辑,但是允许某一列单元格可编辑的功能: - - - -跟着演示操作一下本地的工作表,然后打开浏览器控制台,使用`luckysheet.getLuckysheetfile()[0].config.authority`就可以获取到第一个工作表的工作表保护参数。 - ------------- - -## 数据验证怎么配置? - -**A**:最新文档已经提供了数据验证的配置信息,参考[数据验证配置](/zh/guide/sheet.html#dataVerification)。官方也提供了API方法 [setDataVerification](/zh/guide/api.html#setdataverification-optionitem-setting),用于动态设置数据验证功能。 - ------------- - -## Luckysheet通过引入CDN有案例吗? - -**A**:Luckysheet支持CDN方式引入,参考:[本地HTML采用cdn加载方式引入Luckysheet的案例](https://www.cnblogs.com/DuShuSir/p/13859103.html) - ------------- - -## 请问一下图片怎么限制在单元格里面自适应高度? - -**A**:首先需要对图片设置移动并调整单元格大小,然后有以下几种情况: - -- 如果图片位置完全在单元格内部时,当拉长单元格的宽度或高度的时候,图片不会随着单元格的变大而伸缩变大 -- 如果图片位置完全在单元格内部时,当拉短单元格的宽度或高度,贴到图片的边时,图片会随着单元格的变小而伸缩变小 -- 当这个图片超过单元格的边框时,图片可以跟随单元格大小变化 - -根据图片的第二个特性,可以操作得到图片位置信息,原理就是将图片的位置设置成和单元格边框重叠(源码中,需要重叠超过2px),以下演示视频展示了怎么将图片限制在单元格里面自适应宽高。 - - - ------------- - -## 如何获取工作表默认的行高列宽? - -**A**:有两种方式可以获取 - -- 一是使用`luckysheet.getLuckysheetfile()`获取到所有工作表配置后,在各个工作表的配置中直接取得默认行高`defaultRowHeight`和默认列宽`defaultColWidth`。 -- 二是开放了API可以获取到工作表默认的行高[getDefaultRowHeight](/zh/guide/api.html#getdefaultrowheight-setting)和列宽[getDefaultColWidth](/zh/guide/api.html#getdefaultcolwidth-setting) - ------------- - -## 如何隐藏工作表下方的添加行按钮和回到顶部按钮? - -**A**:已开放配置 -- 允许添加行 [enableAddRow](/zh/guide/config.html#enableaddrow) -- 允许回到顶部 [enableAddBackTop](/zh/guide/config.html#enableAddBackTop) - ------------- - -## 如何隐藏工作表的行标题和列标题? - -**A**:已开放配置 -- 行标题区域的宽度 [rowHeaderWidth](/zh/guide/config.html#rowheaderwidth) -- 列标题区域的高度 [columnHeaderHeight](/zh/guide/config.html#columnHeaderHeight) - ------------- - -## 调用什么方法能设置`config.merge`? - -**A**:三个方法 -- 界面操作 -- 用API:[setRangeMerge](/zh/guide/api.html#setrangemerge-type-setting) -- 手动组装merge参数 - ------------- - -## 为什么官方公布的新功能没有效果? - -**A**:第一步,检查下您是否使用了CDN的方式引入, - -Luckysheet教程里采用的CDN链接是 [jsdelivr](https://www.jsdelivr.com/package/npm/luckysheet) 提供的服务,代码是从 [npmjs.com](https://www.npmjs.com/) 自动同步过去的,不是从 [Github](https://github.com/mengshukeji/Luckysheet/) 同步过去的。因为我们新提交的代码,还需要经过一段时间的测试,所以不会立即发布到npm使用,导致了npm的代码稍滞后于Github。 - -如果需要尝试最新代码,我们强烈建议您从 [Luckysheet Github](https://github.com/mengshukeji/Luckysheet/) 主仓库拉取代码。后续我们版本稳定了,会考虑实时发布npm包。 - -第二步,如果是引用github仓库打包后的代码,测试判断是否有bug,您可以查找问题并尝试修复,再[提交PR](https://github.com/mengshukeji/Luckysheet/pulls),如果修复不了,请[提交issues](https://github.com/mengshukeji/Luckysheet/issues)。 - ------------- - -## `npm run dev`报错:`Error: Cannot find module 'rollup'`? - -**A**:可能是npm包安装问题,尝试以下步骤: -1. `npm cache clean --force` -2. `npm i rimraf -g` -3. `rimraf node_modules` -4. 删除package-lock.json文件 -5. `npm i` -6. `npm run dev` - -提示:大多数的其他npm安装问题,也可以尝试此步骤来解决。 - ------------- - -## 怎样在vue工程里对Luckysheet进行二次开发? - -**A**:[luckysheet-vue](https://github.com/mengshukeji/luckysheet-vue) 案例是提供一个应用集成的方案。 - -如果本地直接开发的话: -1. 把Luckysheet的工程和自己的Vue工程都启动起来,比如Luckysheet的工程在 `http://localhost:3001` -2. 在Vue工程里面通过 `http://localhost:3001` 引入Luckysheet使用 - -这样的话,Luckysheet实时修改后,Vue工程里是可以看到更改的 - ------------- - -## 创建图表时候报错`Store.createChart`? - -**A**:需要引入图表插件才能使用,工作簿初始化的时候应该配置图表插件使用,参考 - -- 插件配置 [plugins](/zh/guide/config.html#配置项) -- 或 官方demo [src/index.html](https://github.com/mengshukeji/Luckysheet/blob/master/src/index.html) - -通常,参考demo配置完后就可以和demo一样正常使用了,但是还是会偶现`chartmix is not defined`,这时需要在谷歌浏览器控制台的network里检查下图表的依赖是否都加载了,有5项依赖需要关注:`vue / vuex / element-ui / echarts / chartmix.umd.js`。 - ------------- - -## 单元格能增加自定义属性吗? - -**A**:直接赋值到单元格对象上的自定义属性会被过滤,要想使得自定义属性生效,需要二开去除过滤属性的代码。 - ------------- - -## 如何输入以`'='`开头的文本?例如`=currentDate('YYYY-MM-DD')`,它默认会去掉函数,函数怎么禁止? - -**A**:前面加一个单引号就行,会强制识别为字符串,和excel表现一致的。比如:`'=currentDate('YYYY-MM-DD')` - ------------- - -## create回调为什么没有效果? - -**A**:API 方法`luckysheet.create()`这个方法没有回调,但是Luckysheet提供了钩子函数用于在指定位置执行回调方法,比如: -- 表格创建之前触发 [workbookCreateBefore](/zh/guide/config.html#workbookcreatebefore) -- 表格创建之后触发 [workbookCreateAfter](/zh/guide/config.html#workbookcreateafter) - ------------- - -## create的时候默认选中第一个单元格,怎么去除? - -**A**:选中单元格时默认是高亮,把高亮去除即可,使用API: [setRangeShow](/zh/guide/api.html#setrangeshow-range-setting) - -```js -luckysheet.setRangeShow("A2",{show:false}) -``` - ------------- - -## 右键事件绑定在哪? - -**A**:在源码的 [src/controllers/hander.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/handler.js) 搜索`event.which == "3"`即可找到右键事件触发执行的代码。 - ------------- - -## 如何添加自定义工具栏? - -**A**:暂未提供配置,可以参照工具栏打印按钮的实现来修改源码: -1. 全局搜索 `luckysheet-icon-print`即可找到打印按钮的实现,在 [src/controllers/constant.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/constant.js) 中增加一个类似的模板字符串,需要自定义一个唯一id -2. 修改 [src/controllers/resize.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/resize.js) ,在toobarConfig对象中新增一条记录 -3. 修改 [src/controllers/menuButton.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/menuButton.js) ,新增一个事件监听 - ------------- - -## 如何添加自定义公式? - -**A**:需要修改两处源码: -1. 在 [src/function/functionImplementation.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/function/functionImplementation.js) 文件中的`functionImplementation`对象中增加一个公式,格式参考`SUM`/`AVERAGE`等公式 -2. 修改 [src/locale](https://github.com/mengshukeji/Luckysheet/blob/master/src/locale) 文件目录下所有的语言包,将自己新增的公式说明加到`functionlist`数组中。其中,`t`是函数的类别,`m`是参数的个数,最小参数个数和最大参数个数。 - ------------- - -## 有没有类似loadData接口,我想实现先加载10条记录,然后再动态加载数据,这些数据都追加到表格中? - -**A**:有的。我们`loadSheetUrl`提供了这个功能,初始化`options.enablePage = true`可以开启。 - -源码里搜索`enablePage`可以看到,有个`method.addDataAjax`方法,里面就有一个ajax请求,用来动态加载数据,这些数据会追加到表格中。 - -这个功能现在在文档上是隐藏的,是因为这个接口我们做的时候,接口参数是根据我们实际业务匹配的,可能不太通用,我们准备抽象后再放出来给大家用,如果您想自己用可以依据这个改下。 - -推荐您考虑自己写接口来加载数据,然后使用`setRangeValue`来在指定位置追加数据,这样的自定义程度更高。 - ------------- \ No newline at end of file +# 常见问题 + +本章内容搜集了大家反馈的常见问题,如果官方文档和此列表都不能解答您的疑问,推荐到[官方论坛](https://github.com/mengshukeji/Luckysheet/discussions)反馈 + +## luckysheetfile中的data和celldata有什么区别? + +**A**:表格初始化时使用一维数组格式的 [celldata](/zh/guide/sheet.html#celldata),初始化完成后转化为二维数组格式的data作为存储更新使用,celldata不再使用。 + +如果需要将`data`拿出来作为初始化数据,则需要执行 [transToCellData(data)](/zh/guide/api.html#transtocelldata-data-setting)转换为celldata数据。 +其中`{ r, c, v }`格式的celldata转换为二维数组使用的是[transToData(celldata)](/zh/guide/api.html#transtodata-celldata-setting) + +总结如下: +```js +// data => celldata 二维数组数据 转化成 {r, c, v}格式 一维数组 +luckysheet.transToCellData(data) + +// celldata => data 生成表格所需二维数组 +luckysheet.transToData(celldata) +``` + +------------ + +## 单元格的类型有哪些? + +**A**:参考[单元格格式列表](/zh/guide/cell.html),例举了可用的单元格格式 + +------------ + +## 如何在Vue/React项目中使用Luckysheet? + +**A**:参考 +- Vue案例:[luckysheet-vue](https://github.com/mengshukeji/luckysheet-vue) +- React案例:[luckysheet-react](https://github.com/mengshukeji/luckysheet-react) + +------------ + +## 为什么初始化后表格里面的公式不会被触发? + +**A**:参考 [表格数据格式](/zh/guide/sheet.html#calcchain) ,设置单元格数据对应的calcChain即可。 + +------------ + +## 远端加载数据是loadUrl还是updateUrl? + +**A**:[loadUrl](/zh/guide/config.html#loadurl)。配置了loadUrl,Luckysheet会通过ajax请求整个表格数据,而updateUrl会作为协同编辑实时保存的接口地址。 +注意:初始化数据需要配置loadUrl参数,而协同编辑则在配置loadUrl、updateUrl和allowUpdate四个参数才能生效。 + +------------ + +## 每个sheet页的`index`和`order`有什么区别? + +**A**:每个sheet页都有一个唯一id,就是`index`,可以用数字递增,也可以使用随机字符串,而`order`是所有的sheet的排序情况,从0开始,只能为数字`0,1,2...`。 + +------------ + +## dist文件夹下为什么不能直接运行项目? + +**A**:需要启动本地服务器 + +- [Node搭建本地服务器](https://github.com/JacksonTian/anywhere) +- [Python搭建本地服务器](https://developer.mozilla.org/zh-CN/docs/Learn/Common_questions/set_up_a_local_testing_server) + +------------ + +## excel导入导出怎么做? + +**A**:配合Luckysheet开发的excel导入导出库-[Luckyexcel](https://github.com/mengshukeji/Luckyexcel)已经实现了excel导入功能,导出功能正在开发当中。现阶段excel导出可以参考这2篇博文: + +- [基于LuckySheet在线表格的Excel下载功能开发](https://www.cnblogs.com/recode-hyh/p/13168226.html) +- [使用exceljs导出luckysheet表格](https://blog.csdn.net/csdn_lsy/article/details/107179708) + +------------ + +## 初始化时合并单元格怎么做? + +**A**:参考以下案例 +- [Luckysheet如何初始化含合并单元格的数据](https://www.cnblogs.com/DuShuSir/p/13272397.html) + +------------ + +## Luckysheet如何把表格里的数据保存到数据库?有没有服务端存储和协作的解决方案? + +**A**:有两个方案: + +- 一是表格操作完成后,使用`luckysheet.getAllSheets()`方法获取到全部的工作表数据,全部发送到后台存储。 +- 二是开启协同编辑功能,实时传输数据给后端。 +具体的操作步骤参考这篇文章:[Luckysheet如何把表格里的数据保存到数据库](https://www.cnblogs.com/DuShuSir/p/13857874.html) + +------------ + +## 如何监听单元格hover或者点击事件?`cellRenderAfter`如何实时监听变化? + +**A**:我们搜集到需要针对单元格事件的二次开发需求,规划了单元格相关的钩子函数,参考[单元格钩子函数](/zh/guide/config.html#cellrenderafter)(显示的TODO的暂未开放) + +------------ + +## 顶部的工具栏不支持自定义配置? + +**A**: +顶部工具栏的自定义配置使用初始[options.showtoolbarconfig](/zh/guide/config.html#showtoolbarconfig)(如果标注TODO表示暂未开发) + +------------ + +## 项目使用了jQuery吗? + +**A**:是的。Luckysheet内部启动时间比开源的时间早很多,所以用到了jQuery。打包工具会把jQuery集成到打包目录的`./plugins/js/plugin.js`文件中。 + +如果您的项目中(比如React/Vue)也自己全局引用了jQuery,且造成了冲突,可以尝试去掉一个jQuery。 + +要想在Luckysheet里去除jQuery,需要在源码根目录下的`gulpfile.js`文件中找到打包jQuery的地方:[src/plugins/js/jquery.min.js](https://github.com/mengshukeji/Luckysheet/blob/master/gulpfile.js),删除jQuery相关的信息即可。 + +------------ + +## 如何为单元格对象新增字段? + +**A**:首先参考[单元格对象格式](/zh/guide/cell.html),然后参照源码批注的部分[src/controllers/postil.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/postil.js)。批注是一个加在单元格对象上的一个配置。 + +------------ + +## 工具栏图标加载不出来? + +**A**:工具栏及其他部分图标采用了iconfont图标,加载不出来是因为缺少了iconfont.css的引入,之前旧版官方文档未写清楚这一点对大家造成误导,很抱歉。 + +详细的Luckysheet使用教程参考已经更新的[官方文档](/zh/guide/#使用步骤) + +------------ + +## Luckyexcel打包后不动? + +**A**:打包的终端命令行不显示结束,但是如果`dist`文件夹内已经有了结果文件`luckyexcel.js`,则表明是正常的。 + +Luckyexcel是excel导入导出库,项目采用了gulp作为打包工具,旧版打包工具有点问题在命令行显示这块有些问题,问题已经修复。请还出现此问题的小伙伴做如下更新操作: +1. pull最新代码 +2. `npm i` +3. `npm run build` + +更多详细信息关注:[Luckyexcel](https://github.com/mengshukeji/Luckyexcel/) + +------------ + +## 单元格不可编辑如何控制?表格保护怎么操作? + +**A**:单元格不可编辑属于工作表保护的功能范畴,需要配置在每个sheet页中`config.authority`,最新的设置参数请参考[工作表保护](/zh/guide/sheet.html#config-authority)。 + +为了大家便于理解工作表保护的功能使用,下方的视频演示了如何让当前整个工作表不可编辑,但是允许某一列单元格可编辑的功能: + + + +跟着演示操作一下本地的工作表,然后打开浏览器控制台,使用`luckysheet.getLuckysheetfile()[0].config.authority`就可以获取到第一个工作表的工作表保护参数。 + +------------ + +## 数据验证怎么配置? + +**A**:最新文档已经提供了数据验证的配置信息,参考[数据验证配置](/zh/guide/sheet.html#dataVerification)。官方也提供了API方法 [setDataVerification](/zh/guide/api.html#setdataverification-optionitem-setting),用于动态设置数据验证功能。 + +------------ + +## Luckysheet通过引入CDN有案例吗? + +**A**:Luckysheet支持CDN方式引入,参考:[本地HTML采用cdn加载方式引入Luckysheet的案例](https://www.cnblogs.com/DuShuSir/p/13859103.html) + +------------ + +## 请问一下图片怎么限制在单元格里面自适应高度? + +**A**:首先需要对图片设置移动并调整单元格大小,然后有以下几种情况: + +- 如果图片位置完全在单元格内部时,当拉长单元格的宽度或高度的时候,图片不会随着单元格的变大而伸缩变大 +- 如果图片位置完全在单元格内部时,当拉短单元格的宽度或高度,贴到图片的边时,图片会随着单元格的变小而伸缩变小 +- 当这个图片超过单元格的边框时,图片可以跟随单元格大小变化 + +根据图片的第二个特性,可以操作得到图片位置信息,原理就是将图片的位置设置成和单元格边框重叠(源码中,需要重叠超过2px),以下演示视频展示了怎么将图片限制在单元格里面自适应宽高。 + + + +------------ + +## 如何获取工作表默认的行高列宽? + +**A**:有两种方式可以获取 + +- 一是使用`luckysheet.getLuckysheetfile()`获取到所有工作表配置后,在各个工作表的配置中直接取得默认行高`defaultRowHeight`和默认列宽`defaultColWidth`。 +- 二是开放了API可以获取到工作表默认的行高[getDefaultRowHeight](/zh/guide/api.html#getdefaultrowheight-setting)和列宽[getDefaultColWidth](/zh/guide/api.html#getdefaultcolwidth-setting) + +------------ + +## 如何隐藏工作表下方的添加行按钮和回到顶部按钮? + +**A**:已开放配置 +- 允许添加行 [enableAddRow](/zh/guide/config.html#enableaddrow) +- 允许回到顶部 [enableAddBackTop](/zh/guide/config.html#enableAddBackTop) + +------------ + +## 如何隐藏工作表的行标题和列标题? + +**A**:已开放配置 +- 行标题区域的宽度 [rowHeaderWidth](/zh/guide/config.html#rowheaderwidth) +- 列标题区域的高度 [columnHeaderHeight](/zh/guide/config.html#columnHeaderHeight) + +------------ + +## 调用什么方法能设置`config.merge`? + +**A**:三个方法 +- 界面操作 +- 用API:[setRangeMerge](/zh/guide/api.html#setrangemerge-type-setting) +- 手动组装merge参数 + +------------ + +## 为什么官方公布的新功能没有效果? + +**A**:第一步,检查下您是否使用了CDN的方式引入, + +Luckysheet教程里采用的CDN链接是 [jsdelivr](https://www.jsdelivr.com/package/npm/luckysheet) 提供的服务,代码是从 [npmjs.com](https://www.npmjs.com/) 自动同步过去的,不是从 [Github](https://github.com/mengshukeji/Luckysheet/) 同步过去的。因为我们新提交的代码,还需要经过一段时间的测试,所以不会立即发布到npm使用,导致了npm的代码稍滞后于Github。 + +如果需要尝试最新代码,我们强烈建议您从 [Luckysheet Github](https://github.com/mengshukeji/Luckysheet/) 主仓库拉取代码。后续我们版本稳定了,会考虑实时发布npm包。 + +第二步,如果是引用github仓库打包后的代码,测试判断是否有bug,您可以查找问题并尝试修复,再[提交PR](https://github.com/mengshukeji/Luckysheet/pulls),如果修复不了,请[提交issues](https://github.com/mengshukeji/Luckysheet/issues)。 + +------------ + +## `npm run dev`报错:`Error: Cannot find module 'rollup'`? + +**A**:可能是npm包安装问题,尝试以下步骤: +1. `npm cache clean --force` +2. `npm i rimraf -g` +3. `rimraf node_modules` +4. 删除package-lock.json文件 +5. `npm i` +6. `npm run dev` + +提示:大多数的其他npm安装问题,也可以尝试此步骤来解决。 + +------------ + +## 怎样在vue工程里对Luckysheet进行二次开发? + +**A**:[luckysheet-vue](https://github.com/mengshukeji/luckysheet-vue) 案例是提供一个应用集成的方案。 + +如果本地直接开发的话: +1. 把Luckysheet的工程和自己的Vue工程都启动起来,比如Luckysheet的工程在 `http://localhost:3001` +2. 在Vue工程里面通过 `http://localhost:3001` 引入Luckysheet使用 + +这样的话,Luckysheet实时修改后,Vue工程里是可以看到更改的 + +------------ + +## 创建图表时候报错`Store.createChart`? + +**A**:需要引入图表插件才能使用,工作簿初始化的时候应该配置图表插件使用,参考 + +- 插件配置 [plugins](/zh/guide/config.html#配置项) +- 或 官方demo [src/index.html](https://github.com/mengshukeji/Luckysheet/blob/master/src/index.html) + +通常,参考demo配置完后就可以和demo一样正常使用了,但是还是会偶现`chartmix is not defined`,这时需要在谷歌浏览器控制台的network里检查下图表的依赖是否都加载了,有5项依赖需要关注:`vue / vuex / element-ui / echarts / chartmix.umd.js`。 + +------------ + +## 单元格能增加自定义属性吗? + +**A**:直接赋值到单元格对象上的自定义属性会被过滤,要想使得自定义属性生效,需要二开去除过滤属性的代码。 + +------------ + +## 如何输入以`'='`开头的文本?例如`=currentDate('YYYY-MM-DD')`,它默认会去掉函数,函数怎么禁止? + +**A**:前面加一个单引号就行,会强制识别为字符串,和excel表现一致的。比如:`'=currentDate('YYYY-MM-DD')` + +------------ + +## create回调为什么没有效果? + +**A**:API 方法`luckysheet.create()`这个方法没有回调,但是Luckysheet提供了钩子函数用于在指定位置执行回调方法,比如: +- 表格创建之前触发 [workbookCreateBefore](/zh/guide/config.html#workbookcreatebefore) +- 表格创建之后触发 [workbookCreateAfter](/zh/guide/config.html#workbookcreateafter) + +------------ + +## create的时候默认选中第一个单元格,怎么去除? + +**A**:选中单元格时默认是高亮,把高亮去除即可,使用API: [setRangeShow](/zh/guide/api.html#setrangeshow-range-setting) + +```js +luckysheet.setRangeShow("A2",{show:false}) +``` + +------------ + +## 右键事件绑定在哪? + +**A**:在源码的 [src/controllers/hander.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/handler.js) 搜索`event.which == "3"`即可找到右键事件触发执行的代码。 + +------------ + +## 如何添加自定义工具栏? + +**A**:暂未提供配置,可以参照工具栏打印按钮的实现来修改源码: +1. 全局搜索 `luckysheet-icon-print`即可找到打印按钮的实现,在 [src/controllers/constant.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/constant.js) 中增加一个类似的模板字符串,需要自定义一个唯一id +2. 修改 [src/controllers/resize.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/resize.js) ,在toobarConfig对象中新增一条记录 +3. 修改 [src/controllers/menuButton.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/menuButton.js) ,新增一个事件监听 + +------------ + +## 如何添加自定义公式? + +**A**:需要修改两处源码: +1. 在 [src/function/functionImplementation.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/function/functionImplementation.js) 文件中的`functionImplementation`对象中增加一个公式,格式参考`SUM`/`AVERAGE`等公式 +2. 修改 [src/locale](https://github.com/mengshukeji/Luckysheet/blob/master/src/locale) 文件目录下所有的语言包,将自己新增的公式说明加到`functionlist`数组中。其中,`t`是函数的类别,`m`是参数的个数,最小参数个数和最大参数个数。 + +------------ + +## 有没有类似loadData接口,我想实现先加载10条记录,然后再动态加载数据,这些数据都追加到表格中? + +**A**:有的。我们`loadSheetUrl`提供了这个功能,初始化`options.enablePage = true`可以开启。 + +源码里搜索`enablePage`可以看到,有个`method.addDataAjax`方法,里面就有一个ajax请求,用来动态加载数据,这些数据会追加到表格中。 + +这个功能现在在文档上是隐藏的,是因为这个接口我们做的时候,接口参数是根据我们实际业务匹配的,可能不太通用,我们准备抽象后再放出来给大家用,如果您想自己用可以依据这个改下。 + +推荐您考虑自己写接口来加载数据,然后使用`setRangeValue`来在指定位置追加数据,这样的自定义程度更高。 + +------------ diff --git a/docs/zh/guide/README.md b/docs/zh/guide/README.md index 565ddd6f3..e87e54824 100644 --- a/docs/zh/guide/README.md +++ b/docs/zh/guide/README.md @@ -1,279 +1,281 @@ -# 快速上手 - -## 基本介绍 -Luckysheet ,一款纯前端类似excel的在线表格,功能强大、配置简单、完全开源。 - -## Demo -[在线demo](https://mengshukeji.github.io/LuckysheetDemo/) - -![演示](/LuckysheetDocs/img/LuckysheetDemo.gif) - -## 在线案例 - -- [协同编辑Demo](http://luckysheet.lashuju.com/demo/) - -## 特性 - -### 🛠️格式设置 -+ **样式** (修改字体样式,字号,颜色或者其他通用的样式) -+ **条件格式** (突出显示所关注的单元格或单元格区域;强调异常值;使用数据栏、色阶和图标集(与数据中的特定变体对应)直观地显示数据) -+ **文本对齐及旋转** -+ **支持文本的截断、溢出、自动换行** -+ **数据类型** - + **货币, 百分比, 数字, 日期** - + **Custom** (和excel保持一致,例如: `##,###0.00` , `$1,234.56$##,###0.00_);[Red]($##,###0.00)`, `_($* ##,###0.00_);_(...($* "-"_);_(@_)`, `08-05 PM 01:30MM-dd AM/PM hh:mm` ) -+ **单元格内多样式** (Alt+Enter单元格内换行、上标、下标、单元格内可定义每个文字的不同样式) - -### 🧬单元格 -+ **拖拽选取来修改单元格** (对选区进行操作,可以拖动四边来移动选区,也可以在右下角对选区进行下拉填充操作) -+ **选区下拉填充** (对于一个1,2,3,4,5的序列,将会按照间隔为1进行下拉填充,而对2,4,6,8将会以2作为间隔。支持等差数列,等比数列,日期,周,天,月,年,中文数字填充) -+ **自动填充选项** (下拉填充后,会出现填充选项的菜单,支持选择复制,序列,仅格式,只填充格式,天,月,年的选择) -+ **多选区操作** (可以按住Ctrl键进行单元格多选操作,支持多选区的复制粘贴) -+ **查找和替换** (对内容进行查找替换,支持正则表达式,整词,大小写敏感) -+ **定位** (可以根据单元格的数据类型进行自动定位并选中,选中后可以批量进行格式等操作) -+ **合并单元格** -+ **数据验证(表单功能)** (支持Checkbox, drop-down list, datePicker) - -### 🖱️行和列操作 -+ **隐藏,插入,删除行或列** -+ **冻结行或列** (支持冻结首行和首列,冻结到选区,冻结调节杆可以进行拖动操作) -+ **文本分列** (可以把文本根据不同符号进行拆分,和excel的分列功能类似) - -### 🔨操作体验 -+ **撤销/重做** -+ **复制/粘贴/剪切操作** (支持Luckysheet到excel和excel到Luckysheet带格式的互相拷贝) -+ **快捷键支持** (快捷键操作保持与excel一致,如果有不同或者缺失请反馈给我们) -+ **格式刷** (与google sheet类似) -+ **任意选区拖拽** (选择单元格,输入公式,插入图表,会与选区相关,可以通过任意拖动和放大缩小选区来改变与之关联的参数) - -### ⚙️公式和函数 -+ **内置公式** - + 数学 (SUMIFS, AVERAGEIFS, SUMIF, SUM, etc.) - + 文本 (CONCATENATE, REGEXMATCH, MID) - + 日期 (DATEVALUE, DATEDIF, NOW, WEEKDAY, etc.) - + 财务 (PV, FV, IRR, NPV, etc.) - + 逻辑 (IF, AND, OR, IFERROR, etc.) - + 查找和引用 (VLOOKUP, HLOOkUP, INDIRECT, OFFSET, etc.) - + 动态数组 (Excel2019新函数,SORT,FILTER,UNIQUE,RANDARRAY,SEQUENCE) -+ **公式支持数组** (={1,2,3,4,5,6}, Crtl+Shift+Enter) -+ **远程公式** (DM_TEXT_TFIDF, DM_TEXT_TEXTRANK,DATA_CN_STOCK_CLOSE etc. Need remote interface, can realize complex calculation) -+ **自定义公式** (根据身份证识别年龄,性别,生日,省份,城市等. AGE_BY_IDCARD, SEX_BY_IDCARD, BIRTHDAY_BY_IDCARD, PROVINCE_BY_IDCARD, CITY_BY_IDCARD, etc. 可以任意加入自己的公式哦) - -### 📐表格操作 -+ **筛选** (支持颜色、数字、字符、日期的筛选) -+ **排序** (同时加入多个字段进行排序) - -### 📈数据透视表 -+ **字段拖拽** (操作方式与excel类似,拖动字段到行、列、数值、筛选等4个区域) -+ **聚合方式** (支持汇总、计数、去重计数、平均、最大、最小、中位数、协方差、标准差、方差等计算) -+ **筛选数据** (可对字段进行筛选后再进行汇总) -+ **数据透视表下钻** (双击数据透视表中的数据,可以下钻查看到明细,操作方式与excel一致) -+ **根据数据透视表新建图表** (数据透视表产生的数据也可以进行图表的制作) - -### 📊图表 -+ **支持的图表类型** (目前折线图、柱状图、面积图、条形图、饼图可以使用,散点图、雷达图、仪表盘、漏斗图正在接入,其他图表正在陆续开发中,请大家给予建议) -+ **关于图表插件** (图表使用了一个中间插件[ChartMix](https://github.com/mengshukeji/chartMix)(MIT协议): 目前支持ECharts,正在逐步接入Highcharts、阿里G2、amCharts、googleChart、chart.js) -+ **Sparklines小图** (以公式的形式进行设置和展示,目前支持:折线图、面积图、柱状图、累积图、条形图、离散图、三态图、饼图、箱线图等) - -### ✍️分享及写作 -+ **评论** (评论的删除、添加、修改、隐藏) -+ **共享编辑** (支持多用户共享编辑,内置API) - -### 📚插入对象 -+ **插入图片** (支持JPG,PNG,SVG的插入、修改和删除,并且随表格的变动而产生变化) - -### ⚡Luckysheet专有 -+ **矩阵计算** (通过右键菜单进行支持:对选区内的数据进行转置、旋转、数值计算) -+ **截图** (把选区的内容进行截图展示) -+ **复制到其他格式** (右键菜单的"复制为", 支持复制为json、array、对角线数据、去重等) -+ **EXCEL导入及导出** (专为Luckysheet打造的导入导出插件,支持密码、水印、公式等的本地导入导出,导出正在开发) - -### ⏱️未来开发计划 -+ **打印及设置** (像excel一样进行打印设置,并导出为图片或者PDF) -+ **树形菜单** (类似excel中的分级显示(分组)) -+ **表格新功能** (类似excel中表格的筛选器和切片器) -+ **CSV,TXT导入及导出** (专为Luckysheet打造的导入导出插件,支持密码、水印、公式等的本地导入导出) -+ **插入svg形状** (支持[Pen tool](https://github.com/mengshukeji/Pentool)的插入、修改和删除,并且随表格的变动而产生变化) -+ **文档** (完善文档和API) -+ **敬请期待...** (可以提出好的建议给我们) - -## 开发模式 - -### 环境 -[Node.js](https://nodejs.org/en/) Version >= 6 - -### 安装 -```shell -npm install -npm install gulp -g -``` - -### 开发 -```shell -npm run dev -``` - -### 打包 -```shell -npm run build -``` - -## 使用步骤 - -### 第一步 -引入依赖,有2种方式 - -#### CDN -```html - - - - - - -``` - -注意,`https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/luckysheet.umd.js`这个路径意思是会拉取到最新的luckysheet代码,但是如果Luckysheet刚刚发布,jsdelivr网站可能还没来得及从npm上同步过去,故而使用这个路径还是会拉到上一个版本,我们推荐您直接指定最新版本。 - -想要指定Luckysheet版本,请在所有的CDN依赖文件后面加上版本号,如:`https://cdn.jsdelivr.net/npm/luckysheet@2.1.12/dist/luckysheet.umd.js`。 - -> 如何知道最新版本是哪一版?查看最新 [release记录](https://github.com/mengshukeji/Luckysheet/releases) 或者 [package.json](https://github.com/mengshukeji/Luckysheet/blob/master/package.json) 的`version`字段。 - -如果不方便访问 jsdelivr.net,还可以采用本地方式引入 - -#### 本地引入 - -`npm run build`后`dist`文件夹下的所有文件复制到项目目录,然后通过相对路径引入 - -```html - - - - - - -``` -### 第二步 -指定一个表格容器 -```html -
-``` -### 第三步 -创建一个表格 -```javascript - -``` - -## 整体结构 - -### 格式 - -一个完整的Luckysheet表格文件的数据格式为:luckysheetfile,一个表格文件包含若干个sheet文件,对应excel的sheet0、sheet1等。 - -一个Luckysheet文件的示例如下,该表格包含3个sheet:` -luckysheetfile = [ {sheet1设置}, {sheet2设置}, {sheet3设置} ]` -相当于excel的3个sheet - -![excel sheet](/LuckysheetDocs/img/excel.png) - -文件中的一个sheet的数据`luckysheetfile[0]`的结构如下: -```json -{ - "name": "Cell", //工作表名称 - "color": "", //工作表颜色 - "index": "0", //工作表索引 - "status": "1", //激活状态 - "order": "0", //工作表的顺序 - "hide": 0,//是否隐藏 - "row": 36, //行数 - "column": 18, //列数 - "config": { - "merge":{}, //合并单元格 - "rowlen":{}, //表格行高 - "columnlen":{}, //表格列宽 - "rowhidden":{}, //隐藏行 - "colhidden":{}, //隐藏列 - "borderInfo":{}, //边框 - }, - "celldata": [], //初始化使用的单元格数据 - "data": [], //更新和存储使用的单元格数据 - "scrollLeft": 0, //左右滚动条位置 - "scrollTop": 315, //上下滚动条位置 - "luckysheet_select_save": [], //选中的区域 - "luckysheet_conditionformat_save": {},//条件格式 - "calcChain": [],//公式链 - "isPivotTable":false,//是否数据透视表 - "pivotTable":{},//数据透视表设置 - "filter_select": {},//筛选范围 - "filter": null,//筛选配置 - "luckysheet_alternateformat_save": [], //交替颜色 - "luckysheet_alternateformat_save_modelCustom": [], //自定义交替颜色 - "freezen": {}, //冻结行列 - "chart": [], //图表配置 - "visibledatarow": [], //所有行的位置 - "visibledatacolumn": [], //所有列的位置 - "ch_width": 2322, //工作表区域的宽度 - "rh_height": 949, //工作表区域的高度 - "load": "1", //已加载过此sheet的标识 -} -``` -### 查看方式 -在chrome的console中查看 -`luckysheet.getluckysheetfile()` -可以看到完整设置 -`[{shee1}, {sheet2}, {sheet3}]` - -## 快捷键 - -| 快捷键 | 功能 | -| ------------ | ------------ | -| CTRL + C | 复制单元格 | -| CTRL + V | 粘贴单元格 | -| CTRL + X | 剪切单元格 | -| CTRL + Z | 撤销 | -| CTRL + Y | 重做 | -| CTRL + A | 全选 | -| CTRL + B | 加粗 | -| CTRL + F | 查找 | -| CTRL + H | 替换 | -| CTRL + I | 斜体 | -| CTRL + UP/DOWN/LEFT/RIGHT | 快捷调整单元格选框 | -| SHIFT + UP/DOWN/LEFT/RIGHT | 调整选区 | -| CTRL + 鼠标左击 | 多选单元格 | -| SHIFT + 鼠标左击 | 调整选区 | -| UP/DOWN/LEFT/RIGHT | 移动单元格选框 | -| ENTER | 编辑单元格 | -| TAB | 向右移动单元格选框 | -| DELETE | 清除单元格数据 | - -## 指引 - -如果您使用Luckysheet遇到了问题,按以下步骤来寻找答案 - -1. 使用多吉或者Google搜索常见技术问题 -2. Luckysheet相关的问题优先查看[Luckysheet官方文档](https://mengshukeji.github.io/LuckysheetDocs/zh/)(注意标注TODO的功能暂未实现) -3. 搜索[常见问题列表](https://mengshukeji.github.io/LuckysheetDocs/zh/guide/FAQ.html) -4. 搜索[官方论坛](https://support.qq.com/product/288322),看看有没有人已经遇到过 -5. 尝试自己检查或试验以找到答案 -6. 请尝试阅读源代码以找到答案, - -如果以上方法都没有解决您的问题,可以考虑: - -- 去[官方论坛](https://support.qq.com/product/288322)提问 -- 去Luckysheet官方微信群或者QQ群提问 -- 发现有明显问题的或者需求无法满足的,直接提交[issues](https://github.com/mengshukeji/Luckysheet/issues) - -> 推荐阅读 [提问的智慧](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/master/README-zh_CN.md) - -同时,我们强烈推荐您帮助我们丰富Luckysheet社区 - -- 如果您发现文档或者代码有问题,您可以通过提交PR来贡献。所有合理的改动、优化、修正,或者文档的修正、更新相关的提交都会被接受 +# Luckysheet 已不再维护,推荐使用 [Univer](https://github.com/dream-num/univer) 替代 + +# 快速上手 + +## 基本介绍 +Luckysheet ,一款纯前端类似excel的在线表格,功能强大、配置简单、完全开源。 + +## Demo +[在线demo](https://dream-num.github.io/LuckysheetDemo/) + +![演示](/LuckysheetDocs/img/LuckysheetDemo.gif) + +## 在线案例 + +- [协同编辑Demo](http://luckysheet.lashuju.com/demo/) + +## 特性 + +### 🛠️格式设置 ++ **样式** (修改字体样式,字号,颜色或者其他通用的样式) ++ **条件格式** (突出显示所关注的单元格或单元格区域;强调异常值;使用数据栏、色阶和图标集(与数据中的特定变体对应)直观地显示数据) ++ **文本对齐及旋转** ++ **支持文本的截断、溢出、自动换行** ++ **数据类型** + + **货币, 百分比, 数字, 日期** + + **Custom** (和excel保持一致,例如: `##,###0.00` , `$1,234.56$##,###0.00_);[Red]($##,###0.00)`, `_($* ##,###0.00_);_(...($* "-"_);_(@_)`, `08-05 PM 01:30MM-dd AM/PM hh:mm` ) ++ **单元格内多样式** (Alt+Enter单元格内换行、上标、下标、单元格内可定义每个文字的不同样式) + +### 🧬单元格 ++ **拖拽选取来修改单元格** (对选区进行操作,可以拖动四边来移动选区,也可以在右下角对选区进行下拉填充操作) ++ **选区下拉填充** (对于一个1,2,3,4,5的序列,将会按照间隔为1进行下拉填充,而对2,4,6,8将会以2作为间隔。支持等差数列,等比数列,日期,周,天,月,年,中文数字填充) ++ **自动填充选项** (下拉填充后,会出现填充选项的菜单,支持选择复制,序列,仅格式,只填充格式,天,月,年的选择) ++ **多选区操作** (可以按住Ctrl键进行单元格多选操作,支持多选区的复制粘贴) ++ **查找和替换** (对内容进行查找替换,支持正则表达式,整词,大小写敏感) ++ **定位** (可以根据单元格的数据类型进行自动定位并选中,选中后可以批量进行格式等操作) ++ **合并单元格** ++ **数据验证(表单功能)** (支持Checkbox, drop-down list, datePicker) + +### 🖱️行和列操作 ++ **隐藏,插入,删除行或列** ++ **冻结行或列** (支持冻结首行和首列,冻结到选区,冻结调节杆可以进行拖动操作) ++ **文本分列** (可以把文本根据不同符号进行拆分,和excel的分列功能类似) + +### 🔨操作体验 ++ **撤销/重做** ++ **复制/粘贴/剪切操作** (支持Luckysheet到excel和excel到Luckysheet带格式的互相拷贝) ++ **快捷键支持** (快捷键操作保持与excel一致,如果有不同或者缺失请反馈给我们) ++ **格式刷** (与google sheet类似) ++ **任意选区拖拽** (选择单元格,输入公式,插入图表,会与选区相关,可以通过任意拖动和放大缩小选区来改变与之关联的参数) + +### ⚙️公式和函数 ++ **内置公式** + + 数学 (SUMIFS, AVERAGEIFS, SUMIF, SUM, etc.) + + 文本 (CONCATENATE, REGEXMATCH, MID) + + 日期 (DATEVALUE, DATEDIF, NOW, WEEKDAY, etc.) + + 财务 (PV, FV, IRR, NPV, etc.) + + 逻辑 (IF, AND, OR, IFERROR, etc.) + + 查找和引用 (VLOOKUP, HLOOkUP, INDIRECT, OFFSET, etc.) + + 动态数组 (Excel2019新函数,SORT,FILTER,UNIQUE,RANDARRAY,SEQUENCE) ++ **公式支持数组** (={1,2,3,4,5,6}, Crtl+Shift+Enter) ++ **远程公式** (DM_TEXT_TFIDF, DM_TEXT_TEXTRANK,DATA_CN_STOCK_CLOSE etc. Need remote interface, can realize complex calculation) ++ **自定义公式** (根据身份证识别年龄,性别,生日,省份,城市等. AGE_BY_IDCARD, SEX_BY_IDCARD, BIRTHDAY_BY_IDCARD, PROVINCE_BY_IDCARD, CITY_BY_IDCARD, etc. 可以任意加入自己的公式哦) + +### 📐表格操作 ++ **筛选** (支持颜色、数字、字符、日期的筛选) ++ **排序** (同时加入多个字段进行排序) + +### 📈数据透视表 ++ **字段拖拽** (操作方式与excel类似,拖动字段到行、列、数值、筛选等4个区域) ++ **聚合方式** (支持汇总、计数、去重计数、平均、最大、最小、中位数、协方差、标准差、方差等计算) ++ **筛选数据** (可对字段进行筛选后再进行汇总) ++ **数据透视表下钻** (双击数据透视表中的数据,可以下钻查看到明细,操作方式与excel一致) ++ **根据数据透视表新建图表** (数据透视表产生的数据也可以进行图表的制作) + +### 📊图表 ++ **支持的图表类型** (目前折线图、柱状图、面积图、条形图、饼图可以使用,散点图、雷达图、仪表盘、漏斗图正在接入,其他图表正在陆续开发中,请大家给予建议) ++ **关于图表插件** (图表使用了一个中间插件[ChartMix](https://github.com/mengshukeji/chartMix)(MIT协议): 目前支持ECharts,正在逐步接入Highcharts、阿里G2、amCharts、googleChart、chart.js) ++ **Sparklines小图** (以公式的形式进行设置和展示,目前支持:折线图、面积图、柱状图、累积图、条形图、离散图、三态图、饼图、箱线图等) + +### ✍️分享及写作 ++ **评论** (评论的删除、添加、修改、隐藏) ++ **共享编辑** (支持多用户共享编辑,内置API) + +### 📚插入对象 ++ **插入图片** (支持JPG,PNG,SVG的插入、修改和删除,并且随表格的变动而产生变化) + +### ⚡Luckysheet专有 ++ **矩阵计算** (通过右键菜单进行支持:对选区内的数据进行转置、旋转、数值计算) ++ **截图** (把选区的内容进行截图展示) ++ **复制到其他格式** (右键菜单的"复制为", 支持复制为json、array、对角线数据、去重等) ++ **EXCEL导入及导出** (专为Luckysheet打造的导入导出插件,支持密码、水印、公式等的本地导入导出,导出正在开发) + +### ⏱️未来开发计划 ++ **打印及设置** (像excel一样进行打印设置,并导出为图片或者PDF) ++ **树形菜单** (类似excel中的分级显示(分组)) ++ **表格新功能** (类似excel中表格的筛选器和切片器) ++ **CSV,TXT导入及导出** (专为Luckysheet打造的导入导出插件,支持密码、水印、公式等的本地导入导出) ++ **插入svg形状** (支持[Pen tool](https://github.com/mengshukeji/Pentool)的插入、修改和删除,并且随表格的变动而产生变化) ++ **文档** (完善文档和API) ++ **敬请期待...** (可以提出好的建议给我们) + +## 开发模式 + +### 环境 +[Node.js](https://nodejs.org/en/) Version >= 6 + +### 安装 +```shell +npm install +npm install gulp -g +``` + +### 开发 +```shell +npm run dev +``` + +### 打包 +```shell +npm run build +``` + +## 使用步骤 + +### 第一步 +引入依赖,有2种方式 + +#### CDN +```html + + + + + + +``` + +注意,`https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/luckysheet.umd.js`这个路径意思是会拉取到最新的luckysheet代码,但是如果Luckysheet刚刚发布,jsdelivr网站可能还没来得及从npm上同步过去,故而使用这个路径还是会拉到上一个版本,我们推荐您直接指定最新版本。 + +想要指定Luckysheet版本,请在所有的CDN依赖文件后面加上版本号,如:`https://cdn.jsdelivr.net/npm/luckysheet@2.1.12/dist/luckysheet.umd.js`。 + +> 如何知道最新版本是哪一版?查看最新 [release记录](https://github.com/mengshukeji/Luckysheet/releases) 或者 [package.json](https://github.com/mengshukeji/Luckysheet/blob/master/package.json) 的`version`字段。 + +如果不方便访问 jsdelivr.net,还可以采用本地方式引入 + +#### 本地引入 + +`npm run build`后`dist`文件夹下的所有文件复制到项目目录,然后通过相对路径引入 + +```html + + + + + + +``` +### 第二步 +指定一个表格容器 +```html +
+``` +### 第三步 +创建一个表格 +```javascript + +``` + +## 整体结构 + +### 格式 + +一个完整的Luckysheet表格文件的数据格式为:luckysheetfile,一个表格文件包含若干个sheet文件,对应excel的sheet0、sheet1等。 + +一个Luckysheet文件的示例如下,该表格包含3个sheet:` +luckysheetfile = [ {sheet1设置}, {sheet2设置}, {sheet3设置} ]` +相当于excel的3个sheet + +![excel sheet](/LuckysheetDocs/img/excel.png) + +文件中的一个sheet的数据`luckysheetfile[0]`的结构如下: +```json +{ + "name": "Cell", //工作表名称 + "color": "", //工作表颜色 + "index": "0", //工作表索引 + "status": "1", //激活状态 + "order": "0", //工作表的顺序 + "hide": 0,//是否隐藏 + "row": 36, //行数 + "column": 18, //列数 + "config": { + "merge":{}, //合并单元格 + "rowlen":{}, //表格行高 + "columnlen":{}, //表格列宽 + "rowhidden":{}, //隐藏行 + "colhidden":{}, //隐藏列 + "borderInfo":{}, //边框 + }, + "celldata": [], //初始化使用的单元格数据 + "data": [], //更新和存储使用的单元格数据 + "scrollLeft": 0, //左右滚动条位置 + "scrollTop": 315, //上下滚动条位置 + "luckysheet_select_save": [], //选中的区域 + "luckysheet_conditionformat_save": {},//条件格式 + "calcChain": [],//公式链 + "isPivotTable":false,//是否数据透视表 + "pivotTable":{},//数据透视表设置 + "filter_select": {},//筛选范围 + "filter": null,//筛选配置 + "luckysheet_alternateformat_save": [], //交替颜色 + "luckysheet_alternateformat_save_modelCustom": [], //自定义交替颜色 + "freezen": {}, //冻结行列 + "chart": [], //图表配置 + "visibledatarow": [], //所有行的位置 + "visibledatacolumn": [], //所有列的位置 + "ch_width": 2322, //工作表区域的宽度 + "rh_height": 949, //工作表区域的高度 + "load": "1", //已加载过此sheet的标识 +} +``` +### 查看方式 +在chrome的console中查看 +`luckysheet.getluckysheetfile()` +可以看到完整设置 +`[{shee1}, {sheet2}, {sheet3}]` + +## 快捷键 + +| 快捷键 | 功能 | +| ------------ | ------------ | +| CTRL + C | 复制单元格 | +| CTRL + V | 粘贴单元格 | +| CTRL + X | 剪切单元格 | +| CTRL + Z | 撤销 | +| CTRL + Y | 重做 | +| CTRL + A | 全选 | +| CTRL + B | 加粗 | +| CTRL + F | 查找 | +| CTRL + H | 替换 | +| CTRL + I | 斜体 | +| CTRL + UP/DOWN/LEFT/RIGHT | 快捷调整单元格选框 | +| SHIFT + UP/DOWN/LEFT/RIGHT | 调整选区 | +| CTRL + 鼠标左击 | 多选单元格 | +| SHIFT + 鼠标左击 | 调整选区 | +| UP/DOWN/LEFT/RIGHT | 移动单元格选框 | +| ENTER | 编辑单元格 | +| TAB | 向右移动单元格选框 | +| DELETE | 清除单元格数据 | + +## 指引 + +如果您使用Luckysheet遇到了问题,按以下步骤来寻找答案 + +1. 使用多吉或者Google搜索常见技术问题 +2. Luckysheet相关的问题优先查看[Luckysheet官方文档](https://dream-num.github.io/LuckysheetDocs/zh/)(注意标注TODO的功能暂未实现) +3. 搜索[常见问题列表](https://dream-num.github.io/LuckysheetDocs/zh/guide/FAQ.html) +4. 搜索[官方论坛](https://support.qq.com/product/288322),看看有没有人已经遇到过 +5. 尝试自己检查或试验以找到答案 +6. 请尝试阅读源代码以找到答案, + +如果以上方法都没有解决您的问题,可以考虑: + +- 去[官方论坛](https://support.qq.com/product/288322)提问 +- 去Luckysheet官方微信群或者QQ群提问 +- 发现有明显问题的或者需求无法满足的,直接提交[issues](https://github.com/mengshukeji/Luckysheet/issues) + +> 推荐阅读 [提问的智慧](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/master/README-zh_CN.md) + +同时,我们强烈推荐您帮助我们丰富Luckysheet社区 + +- 如果您发现文档或者代码有问题,您可以通过提交PR来贡献。所有合理的改动、优化、修正,或者文档的修正、更新相关的提交都会被接受 - 当您有了一部分使用或者二次开发Luckysheet的经验,我们鼓励您通过博文分享出来 \ No newline at end of file diff --git a/docs/zh/guide/api.md b/docs/zh/guide/api.md index 0e560ff40..de307b140 100644 --- a/docs/zh/guide/api.md +++ b/docs/zh/guide/api.md @@ -1,3022 +1,3028 @@ -# API - -Luckysheet针对常用的数据操作需求,开放了主要功能的API,开发者可以根据需要进行任意对接开发。 - -使用注意: -1. script全局引入时,所有API均挂载到window.luckysheet对象下面,可以在浏览器控制台打印看到;npm引入时,API也全部挂载在luckysheet对象下 -2. `success`回调函数第一个参数为API方法的返回值 -3. 需要新的API请到github [Issues](https://github.com/mengshukeji/Luckysheet/issues/new/choose)中提交,根据点赞数决定是否开放新API -4. API方法中所需的`order`参数为工作表对象中的`order`的值,而不是`index` - -## 单元格操作 - -### getCellValue(row, column [,setting])
- - -- **参数**: - - - {Number} [row]: 单元格所在行数;从0开始的整数,0表示第一行 - - {Number} [column]: 单元格所在列数;从0开始的整数,0表示第一列 - - {PlainObject} [setting]: 可选参数 - + {String} [type]: 单元格的值类型,可以设置为原始值`v`或者显示值`m`;默认值为`v`,表示获取单元格的实际值 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - -- **说明**: - - 获取单元格的值。 - - 特殊情况,单元格格式为`yyyy-MM-dd`,`type`为`'v'`时会强制取`'m'`显示值 - -- **示例**: - - - 返回当前工作表第1行第1列单元格的数据的v值 - - `luckysheet.getCellValue(0, 0)` - - - 返回指定data数据的第2行第2列单元格的原始值。 - - `luckysheet.getCellValue(1, 1, {type:"m"})` - ------------- - -### setCellValue(row, column, value [,setting]) - - -- **参数**: - - - {Number} [row]: 单元格所在行数;从0开始的整数,0表示第一行 - - {Number} [column]: 单元格所在列数;从0开始的整数,0表示第一列 - - {Object | String | Number} [value]: 要设置的值;可以为字符串或数字,或为符合Luckysheet单元格格式的对象,参考 [单元格属性表](/zh/guide/cell.html) - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Boolean} [isRefresh]: 是否刷新界面;默认为`true`;用于多个单元格赋值时候控制节流,前面单元格赋值的时候应设置为 `false`,最后一个单元格赋值时设置为`true`。 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 设置某个单元格的值,也可以设置整个单元格对象,用于同时设置多个单元格属性。 - - 如果需要更新公式,也可以在这里赋值,Luckysheet在内部会主动把这个公式做计算并加入到公式链中,最后重刷界面。 - -- **示例**: - - - 设置当前工作表"A1"单元格的值为"1" -     `luckysheet.setCellValue(0, 0, 1);` - - - 设置当前工作表"B1"单元格的值为公式"=sum(A1)" -     `luckysheet.setCellValue(0, 1, "=sum(A1)");` - - - 设置当前工作表"C1"单元格的值为公式"=sum(A1:B1",并带有红色背景,单元格对象可以不带`v`和`m`值,Luckysheet会根据公式信息自动计算结果,如果带了未更新或者是非公式结果的`v`和`m`值,Luckysheet也仍然会根据公式实际关联的数据计算出准备的结果。 -     `luckysheet.setCellValue(0, 2, {f: "=sum(A1:B1)", bg:"#FF0000"})` - - 再次设置"C1"单元格新的公式仍然可以生效 - - `luckysheet.setCellValue(0, 2, {f: "=sum(A1)", bg:"#00FF00"})` - ------------- - -### clearCell(row, column [,setting]) - - -- **参数**: - - - {Number} [row]: 单元格所在行数;从0开始的整数,0表示第一行 - - {Number} [column]: 单元格所在列数;从0开始的整数,0表示第一列 - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 清除指定工作表指定单元格的内容,返回清除掉的数据,不同于删除单元格的功能,不需要设定单元格移动情况 - -- **示例**: - - - 清空单元格`B2`内容 - `luckysheet.clearCell(1,1)` - ------------- - -### deleteCell(move, row, column [,setting]) - - -- **参数**: - - {String} [move]: 删除后,右侧还是下方的单元格移动 - - `move`可能的值有: - - + `"left"`: 右侧单元格左移 - + `"up"`: 下方单元格上移 - - - {Number} [row]: 单元格所在行数;从0开始的整数,0表示第一行 - - {Number} [column]: 单元格所在列数;从0开始的整数,0表示第一列 - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 删除指定工作表指定单元格,返回删除掉的数据,同时,指定是右侧单元格左移还是下方单元格上移 - -- **示例**: - - - 删除当前单元格并且在删除后,右侧单元格左移 - `luckysheet.deleteCell('left')` - ------------- - -### setCellFormat(row, column, attr, value [,setting]) - - -- **参数**: - - - {Number} [row]: 单元格所在行数;从0开始的整数,0表示第一行 - - {Number} [column]: 单元格所在列数;从0开始的整数,0表示第一列 - - {String} [attr]: 属性类型,参考 [单元格属性表](/zh/guide/cell.html)的属性值 - - {String | Number | Object} [value]: 具体的设置值,一个属性会对应多个值,参考 [单元格属性表](/zh/guide/cell.html)的值示例,如果属性类型`attr`是单元格格式`ct`,则设置值`value`应提供ct对象,如:`{fa:"General", t:"g"}`,比如设置A1单元格的格式为百分比格式: - - `luckysheet.setCellFormat(0, 0, "ct", {fa:"0.00%", t:"n"})` - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 设置某个单元格的属性,如果要设置单元格的值或者同时设置多个单元格属性,推荐使用`setCellValue` - - 特殊的设置 - - 边框设置时,attr为`"bd"`,value为一个key/value对象,需要同时设置边框类型:`borderType`/边框粗细:`style`/边框颜色:`color`,比如设置A1单元格的边框为所有/红色/细: - - `luckysheet.setCellFormat(0, 0, "bd", {borderType: "border-right",style: "1", color: "#ff0000"})` - - 完整可选的设置参数如下: - - + 边框类型 `borderType:"border-left" | "border-right" | "border-top" | "border-bottom" | "border-all" | "border-outside" | "border-inside" | "border-horizontal" | "border-vertical" | "border-none"`, - + 边框粗细 `style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick` - + 边框颜色 `color: 16进制颜色值` - -- **示例**: - - - 设置当前工作表A1单元格文本加粗 - `luckysheet.setCellFormat(0, 0, "bl", 1)` - - 设置第二个工作表的B2单元格背景为红色 - `luckysheet.setCellFormat(1, 1, "bg", "#ff0000", {order:1})` - - 设置当前工作表"A1"单元格的值为"abc" - `luckysheet.setCellFormat(0, 0, 'v', 'abc');` - ------------- - -### find(content [,setting]) - - -- **参数**: - - - {String} [content]: 要查找的内容 - - {PlainObject} [setting]: 可选参数 - + {Boolean} [isRegularExpression]: 是否正则表达式匹配;默认为 `false` - + {Boolean} [isWholeWord]: 是否整词匹配;默认为 `false` - + {Boolean} [isCaseSensitive]: 是否区分大小写匹配;默认为 `false` - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {String} [type]: 单元格属性;默认值为`"m"` - -- **说明**: - - 查找一个工作表中的指定内容,返回查找到的内容组成的单元格一位数组,数据格式同`celldata`。 - -- **示例**: - - - 当前工作表查找`"value"`字符串 - `luckysheet.find("value")` - - 当前工作表查找公式包含`"SUM"`的单元格 - `luckysheet.find("SUM",{type:"f"})` - ------------- - -### replace(content, replaceContent [,setting]) - - -- **参数**: - - - {String} [content]: 要查找的内容 - - {String} [replaceContent]: 要替换的内容 - - {PlainObject} [setting]: 可选参数 - + {Boolean} [isRegularExpression]: 是否正则表达式匹配;默认为 `false` - + {Boolean} [isWholeWord]: 是否整词匹配;默认为 `false` - + {Boolean} [isCaseSensitive]: 是否区分大小写匹配;默认为 `false` - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 查找一个工作表中的指定内容并替换成新的内容,返回替换后的内容组成的单元格一位数组,数据格式同`celldata`。 - -- **示例**: - - - 当前工作表查找`"value"`字符串并替换为`"out"` - `luckysheet.replace("value", "out")` - ------------- - -### exitEditMode([,setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 退出编辑模式。鼠标双击单元格后,会进入单元格编辑模式,编辑完成后,当鼠标再次点击别的地方输入框失焦的时候,则会退出编辑模式,随即单元格的值会进行保存。此Api就是自动退出编辑模式的操作,主要是为了触发自动保存单元格。 - -- **示例**: - - - 手动触发退出编辑模式 - `luckysheet.exitEditMode()` - ------------- - -## 行和列操作 - -### setHorizontalFrozen(isRange [,setting]) - - -- **参数**: - - - {Boolean} [isRange]: 是否冻结行到选区 - `isRange`可能的值有: - - + `"false"`: 冻结首行 - + `"true"`: 冻结行到选区 - - {PlainObject} [setting]: 可选参数 - + {Array | Object | String} [range]: `isRange`为`true`的时候设置,开启冻结的单元格位置,格式为`{ row_focus:0, column_focus:0 }`,意为当前激活的单元格的行数和列数;默认从当前选区最后的一个选区中取得 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 冻结行操作 - - 特别注意,只有在`isRange`设置为`true`的时候,才需要设置`setting`中的`range`,且与一般的range格式不同。 - -- **示例**: - - - 冻结首行 - - `luckysheet.setHorizontalFrozen(false)` - - - 冻结到`B5`选区 - - `luckysheet.setHorizontalFrozen(true, { range: 'B5' })` - ------------- - -### setVerticalFrozen(isRange [,setting]) - - -- **参数**: - - - {Boolean} [isRange]: 是否冻结列到选区 - `isRange`可能的值有: - - + `"false"`: 冻结首列 - + `"true"`: 冻结列到选区 - - {PlainObject} [setting]: 可选参数 - + {Array | Object | String} [range]: `isRange`为`true`的时候设置,开启冻结的单元格位置,格式为`{ row_focus:0, column_focus:0 }`,意为当前激活的单元格的行数和列数;默认从当前选区最后的一个选区中取得 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 冻结列操作 - - 特别注意,只有在`isRange`设置为`true`的时候,才需要设置`setting`中的`range`,且与一般的range格式不同。 - -- **示例**: - - - 冻结首列 - - `luckysheet.setVerticalFrozen(false)` - ------------- - -### setBothFrozen(isRange [,setting]) - - -- **参数**: - - - {Boolean} [isRange]: 是否冻结行列到选区 - `isRange`可能的值有: - - + `"false"`: 冻结行列 - + `"true"`: 冻结行列到选区 - - {PlainObject} [setting]: 可选参数 - + {Array | Object | String} [range]: `isRange`为`true`的时候设置,开启冻结的单元格位置,格式为`{ row_focus:0, column_focus:0 }`,意为当前激活的单元格的行数和列数;默认从当前选区最后的一个选区中取得 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 冻结行列操作 - - 特别注意,只有在`isRange`设置为`true`的时候,才需要设置`setting`中的`range`,且与一般的range格式不同。 - - 如果想在工作簿初始化后使用此API设置冻结,可以在工作簿创建后的钩子函数中执行,比如: - ```js - luckysheet.create({ - hook:{ - workbookCreateAfter:function(){ - luckysheet.setBothFrozen(false); - } - } - }); - - ``` - -- **示例**: - - - 冻结行列 - - `luckysheet.setBothFrozen(false)` - ------------- - -### cancelFrozen([setting]) - - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 取消冻结操作 - -- **示例**: - - - 取消冻结 - - `luckysheet.cancelFrozen()` - ------------- - -### insertRow(row [,setting]) - - -- **参数**: - - - {Number} [row]: 在第几行插入空白行,从0开始 - - - {PlainObject} [setting]: 可选参数 - + {Number} [number]: 插入的空白行数;默认为 1 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 在第`row`行的位置,插入`number`行空白行 - -- **示例**: - - - 在第2行的位置插入1行空白行 - - `luckysheet.insertRow(1)` - ------------- - -### insertColumn( column [,setting]) - - -- **参数**: - - - {Number} [column]: 在第几列插入空白列 - - - {PlainObject} [setting]: 可选参数 - + {Number} [number]: 插入的空白列数;默认为 1 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 在第`column`列的位置,插入`number`列空白列 - -- **示例**: - - - 在第1列的位置插入3行空白行 - - `luckysheet.insertColumn(0, { number: 3 })` - ------------- - -### deleteRow(rowStart, rowEnd [,setting]) - - -- **参数**: - - - {Number} [rowStart]: 要删除的起始行 - - {Number} [rowEnd]: 要删除的结束行 - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 删除指定的行 - - 特别提醒,删除行之后,行的序号并不会变化,下面的行会补充到上面,注意观察数据是否被正确删除即可。 - -- **示例**: - - - 删除2-4行 - - `luckysheet.deleteRow(1, 3)` - ------------- - -### deleteColumn(columnStart, columnEnd [,setting]) - -- **参数**: - - - {Number} [columnStart]: 要删除的起始列 - - {Number} [columnEnd]: 要删除的结束列 - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 删除指定的列 - - 特别提醒,删除列之后,列的序号并不会变化,右边的列会补充到左边,注意观察数据是否被正确删除即可。 - -- **示例**: - - - 删除2-4列 - - `luckysheet.deleteColumn(1, 3)` - ------------- - -### hideRow(rowStart, rowEnd [,setting]) - -- **参数**: - - - {Number} [rowStart]: 要隐藏的起始行 - - {Number} [rowEnd]: 要隐藏的结束行 - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 隐藏指定的行 - - 特别提醒,隐藏行之后,行的序号会变化。 - -- **示例**: - - - 隐藏2-4行 - - `luckysheet.hideRow(1, 3)` - ------------- - -### hideColumn(columnStart, columnEnd [,setting])(TODO) - -- **参数**: - - - {Number} [columnStart]: 要隐藏的起始列 - - {Number} [columnEnd]: 要隐藏的结束列 - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 隐藏指定的列 - - 特别提醒,隐藏列之后,列的序号会变化。 - -- **示例**: - - - 隐藏2-4列 - - `luckysheet.hideColumn(1, 3)` - ------------- - -### showRow(rowStart, rowEnd [,setting]) - -- **参数**: - - - {Number} [rowStart]: 要显示的起始行 - - {Number} [rowEnd]: 要显示的结束行 - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 显示指定的行 - -- **示例**: - - - 显示2-4行 - - `luckysheet.showRow(1, 3)` - ------------- - -### showColumn(columnStart, columnEnd [,setting])(TODO) - -- **参数**: - - - {Number} [columnStart]: 要显示的起始列 - - {Number} [columnEnd]: 要显示的结束列 - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 显示指定的列 - -- **示例**: - - - 显示2-4列 - - `luckysheet.showColumn(1, 3)` - ------------- - -### setRowHeight(rowInfo [,setting]) - -- **参数**: - - - {Object} [rowInfo]: 行数和高度对应关系 - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 设置指定行的高度 - -- **示例**: - - - 设置第一行高度为50px,第二行高度为60px - - `luckysheet.setRowHeight({0:50,1:60})` - ------------- - -### setColumnWidth(columnInfo [,setting]) - -- **参数**: - - - {Object} [columnInfo]: 列数和宽度对应关系 - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 设置指定列的宽度 - -- **示例**: - - - 设置第一列宽度为50px,第二列宽度为60px - - `luckysheet.setColumnWidth({0:50,1:60})` - ------------- - -### getRowHeight(rowInfo [,setting]) - -- **参数**: - - - {Array} [rowInfo]: 行号下标组成的数组;行号下标从0开始; - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 获取指定工作表指定行的高度,得到行号和高度对应关系的对象(第一行行号为0) - -- **示例**: - - - 第一行高度为50px,第二行高度为60px,获取这些值 - - `luckysheet.getRowHeight([0,1])` - 返回得到 - `{0:50,1:60}` - ------------- - -### getColumnWidth(columnInfo [,setting]) - -- **参数**: - - - {Array} [columnInfo]: 列号下标组成的数组;列号下标从0开始; - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 获取指定工作表指定列的宽度,得到列号和宽度对应关系的对象(第一列列号为0) - -- **示例**: - - - 第一列宽度为50px,第二列宽度为60px,获取这些值 - - `luckysheet.getColumnWidth([0,1])` - 返回得到 - `{0:50,1:60}` - ------------- - -### getDefaultRowHeight([,setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 获取工作表的默认行高 - -- **示例**: - - - 返回工作表的默认行高 - - `luckysheet.getDefaultRowHeight()` - 返回得到 - `19` - ------------- - -### getDefaultColWidth([,setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 获取工作表的默认列宽 - -- **示例**: - - - 返回工作表的默认列宽 - - `luckysheet.getDefaultColWidth()` - 返回得到 - `73` - ------------- - -## 选区操作 - -### getRange() - -- **说明**: - - 返回当前选区对象的数组,可能存在多个选区。每个选区的格式为row/column信息组成的对象`{row:[0,1],column:[0,1]}` - -- **示例**: - - - 当前选区为"A1:B2"和"B4:C5",执行 - - `luckysheet.getRange()` - - 则返回结果为: - ```json - [ - { "row": [0,1], "column": [0,1] }, - { "row": [3,4], "column": [1,2] } - ] - ``` - ------------- - -### getRangeWithFlatten() - -- **说明**: - - 返回表示指定区域内所有单元格位置的数组,区别getRange方法,该方法以cell单元格(而非某块连续的区域)为单位来组织选区的数据。 - -- **示例**: - - - 在表格中选择指定的区域,然后执行 - - `luckysheet.getRange()` - - 则返回结果为: - ```json - [ - {"row":[0,0],"column":[0,2]}, - {"row":[1,1],"column":[0,0]}, - {"row":[3,3],"column":[0,0]} - ] - ``` - 其中,{"row":[0,0],"column":[0,2]} 表示的是一整块连续的区域。 - - - 在表格中选择上面的区域,然后执行 - - `luckysheet.getRangeWithFlatten()` - - 则返回结果为: - ```json - [ - {"r":0,"c":0}, - {"r":0,"c":1}, - {"r":0,"c":2}, - {"r":1,"c":0}, - {"r":3,"c":0} - ] - ``` - ------------- - -### getRangeValuesWithFlatte() - -- **说明**: - - 返回表示指定区域内所有单元格内容的对象数组 - -- **示例**: - - - 在表格中选择指定的区域,然后执行 - - `luckysheet.getRange()` - - 则返回结果为: - ```json - [ - {"row":[0,0],"column":[0,2]}, - {"row":[1,1],"column":[0,0]}, - {"row":[3,3],"column":[0,0]} - ] - ``` - 其中,{"row":[0,0],"column":[0,2]} 表示的是一整块连续的区域。 - - - 在表格中选择上面的区域,然后执行 - - `luckysheet.getRangeValuesWithFlatte()` - - 则返回结果为: - ```json - [ - { - "bg": null, - "bl": 0, - "it": 0, - "ff": 0, - "fs": 11, - "fc": "rgb(51, 51, 51)", - "ht": 1, - "vt": 1, - "v": 1, - "ct": { - "fa": "General", - "t": "n" - }, - "m": "1" - }, - { - "bg": null, - "bl": 0, - "it": 0, - "ff": 0, - "fs": 11, - "fc": "rgb(51, 51, 51)", - "ht": 1, - "vt": 1, - "v": 2, - "ct": { - "fa": "General", - "t": "n" - }, - "m": "2" - }, - { - "bg": null, - "bl": 0, - "it": 0, - "ff": 0, - "fs": 11, - "fc": "rgb(51, 51, 51)", - "ht": 1, - "vt": 1, - "v": 3, - "ct": { - "fa": "General", - "t": "n" - }, - "m": "3" - }, - { - "v": "Background", - "ct": { - "fa": "General", - "t": "g" - }, - "m": "Background", - "bg": null, - "bl": 1, - "it": 0, - "ff": 0, - "fs": 11, - "fc": "rgb(51, 51, 51)", - "ht": 1, - "vt": 1 - }, - { - "v": "Border", - "ct": { - "fa": "General", - "t": "g" - }, - "m": "Border", - "bg": null, - "bl": 1, - "it": 0, - "ff": 0, - "fs": 11, - "fc": "rgb(51, 51, 51)", - "ht": 1, - "vt": 1 - } - ] - ``` ------------- - - -### getRangeAxis() - -- **说明**: - - 返回对应当前选区的坐标字符串数组,可能存在多个选区。每个选区可能是单个单元格(如 A1)或多个单元格组成的矩形区域(如 D9:E12) - -- **示例**: - - - 当前选区为"E10:E14"、"A7:B13"、"C4"、 "A3"和"C6:D9",执行 - - `luckysheet.getRangeAxis()` - - 则返回结果为: - ```json - ["E10:E14", "A7:B13", "C4", "A3", "C6:D9"] - ``` - ------------- - -### getRangeValue([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - -- **说明**: - - 返回指定工作表指定范围的单元格二维数组数据,每个单元格为一个对象。 - - [单元格对象格式参考](/zh/guide/cell.html) - -- **示例**: - - - 当前选区为"A1:B2",执行 - - `luckysheet.getRangeValue()` - - 则返回结果为: - ```json - [ - [ - { - "v": "vaule1", - "ct": { "fa": "General", "t": "g" }, - "m": "vaule1", - "bg": "rgba(255,255,255)", - "bl": 0, - "it": 0, - "ff": 1, - "fs": 11, - "fc": "rgb(51, 51, 51)", - "ht": 1, - "vt": 0 - }, - { - "v": "value3", - "ct": { "fa": "General", "t": "g" }, - "m": "value3", - "bg": "rgba(255,255,255)", - "bl": 0, - "it": 0, - "ff": 1, - "fs": 11, - "fc": "rgb(51, 51, 51)", - "ht": 1, - "vt": 0 - } - ], - [ - { - "v": "vaule2", - "ct": { "fa": "General", "t": "g" }, - "m": "vaule2", - "bg": "rgba(255,255,255)", - "bl": 0, - "it": 0, - "ff": 1, - "fs": 11, - "fc": "rgb(51, 51, 51)", - "ht": 1, - "vt": 0 - }, - { - "v": "value4", - "ct": { "fa": "General", "t": "g" }, - "m": "value4", - "bg": "rgba(255,255,255)", - "bl": 0, - "it": 0, - "ff": 1, - "fs": 11, - "fc": "rgb(51, 51, 51)", - "ht": 1, - "vt": 0 - } - ] - ] - ``` - ------------- - -### getRangeHtml([setting]) - - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,允许多个选区组成的数组;默认为当前选区 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - -- **说明**: - - 复制指定工作表指定单元格区域的数据,返回包含``html格式的数据,可用于粘贴到excel中保持单元格样式。 - - 特别注意,如果复制多个选区,这几个选区必须有相同的行或者相同的列才能复制,复制出的结果也会自动合并成衔接的数组,比如,多选`"C18:C20"` / `"E18:E20"` / `"G18:H20"`是允许的,但是多选`"C18:C20"` / `"E18:E21"`是不允许的 - -- **示例**: - - - 当前选区为"A1:B2",执行 - - `luckysheet.getRangeHtml()` - - 则返回结果为: - ```html -
- - - - - - - - - - - - -
- value1 - - value3 -
- value2 - - value4 -
- ``` - ------------- - -### getRangeJson(title [,setting]) - - -- **参数**: - - - {Boolean} [title]: 是否首行为标题 - - `title`可能的值有: - - + `"true"`: 首行为标题 - + `"false"`: 首行不为标题 - - {PlainObject} [setting]: 可选参数 - + {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - -- **说明**: - - 复制指定工作表指定单元格区域的数据,返回`json`格式的数据 - -- **示例**: - - - 当前选区为"A1:B2",首行为标题取得json - - `luckysheet.getRangeJson(true)` - - 则返回结果为: - ```json - [ - { "value1": "value2", "value3": "value4" } - ] - ``` - - - 当前选区为"A1:B2",首行不为标题取得json - - `luckysheet.getRangeJson(false)` - - 则返回结果为: - ```json - [ - { "A": "value1", "B": "value3" }, - { "A": "value2", "B": "value4" } - ] - ``` - ------------- - -### getRangeArray(dimensional [,setting]) - - -- **参数**: - - - {String} [dimensional]: 数组维度 - - `dimensional`可能的值有: - - + `"oneDimensional"`: 一维数组 - + `"twoDimensional"`: 二维数组 - - {PlainObject} [setting]: 可选参数 - + {Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - -- **说明**: - - 复制指定工作表指定单元格区域的数据,返回一维、二维或者自定义行列数的二维数组的数据。 - - 特别注意,只有在`dimensional`设置为`custom`的时候,才需要设置`setting`中的`row`和`column` - -- **示例**: - - - 当前选区为"A1:B2",一维数组 - - `luckysheet.getRangeArray('oneDimensional')` - - 则返回结果为: - ```json - ["value1","value3","value2","value4"] - ``` - - - 当前选区为"A1:B2",二维数组 - - `luckysheet.getRangeArray('twoDimensional')` - - 则返回结果为: - ```json - [ - [ "value1", "value3" ], - [ "value2", "value4" ] - ] - ``` - - - 当前选区为"A1:C5",由 'value1'到'value15'的值组成,得到3 行2列的二维数组数据 - - `luckysheet.getRangeArray('custom', { row: 3, column: 2 })` - - 则返回结果为: - ```json - [ - [ - { - "m": "value1", - "ct": { "fa": "General", "t": "g" }, - "v": "value1" - }, - { - "ct": { "fa": "General", "t": "g" }, - "v": "value6", - "m": "value6" - } - ], - [ - { - "ct": { "fa": "General", "t": "g" }, - "v": "value11", - "m": "value11" - }, - { - "m": "value2", - "ct": { "fa": "General", "t": "g" }, - "v": "value2" - } - ], - [ - { - "ct": { "fa": "General", "t": "g" }, - "v": "value7", - "m": "value7" - }, - { - "ct": { "fa": "General", "t": "g" }, - "v": "value12", - "m": "value12" - } - ] - ] - ``` - ------------- - -### getRangeDiagonal(type [,setting]) - - -- **参数**: - - - {String} [type]: 对角线还是对角线偏移 - - `type`可能的值有: - - + `"normal"`: 对角线 - + `"anti"`: 反对角线 - + `"offset"`: 对角线偏移 - - {PlainObject} [setting]: 可选参数 - - {Number} [column]: `type`为`offset`的时候设置,对角偏移的列数 - + {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - -- **说明**: - - 复制指定工作表指定单元格区域的数据,返回对角线或者对角线偏移`column`列后的数据。 - - 特别注意,只有在`type`设置为`offset`的时候,才需要设置`setting`中的`column`。 - -- **示例**: - - - 当前选区为"A1:B2",对角线 - - `luckysheet.getRangeDiagonal('normal')` - - 则返回结果为: - ```json - [ - { - "m": "value1", - "ct": { "fa": "General", "t": "g" }, - "v": "value1" - }, - { - "m": "value4", - "ct": { "fa": "General", "t": "g" }, - "v": "value4" - } - ] - ``` - - - 当前选区为"A1:B2",反对角线 - - `luckysheet.getRangeDiagonal('anti')` - - 则返回结果为: - ```json - [ - { - "m": "value3", - "ct": { "fa": "General", "t": "g" }, - "v": "value3" - }, - { - "m": "value2", - "ct": { "fa": "General", "t": "g" }, - "v": "value2" - } - ] - ``` - - 当前选区为"A1:B2",对角线偏移1列 - - `luckysheet.getRangeDiagonal('offset', { column: 1 })` - - 则返回结果为: - ```json - [ - { - "m": "value3", - "ct": { "fa": "General", "t": "g" }, - "v": "value3" - } - ] - ``` ------------- - -### getRangeBoolean([setting]) - - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - -- **说明**: - - 复制指定工作表指定单元格区域的数据,返回布尔值的数据 - -- **示例**: - - - 当前选区为"A1:B2" - - `luckysheet.getRangeBoolean()` - - 则返回结果为: - ```json - [ - [ false, false ], - [ false, false ] - ] - ``` - ------------- - -### setRangeShow(range [,setting])
- - -- **参数**: - - - {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,允许多个选区组成的数组;默认为当前选区 - - {PlainObject} [setting]: 可选参数 - + {Boolean} [show]: 是否显示高亮选中效果;默认值为 `true` - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 指定工作表选中一个或多个选区为选中状态并选择是否高亮,支持多种格式设置。 - - 特别提醒,Luckysheet中涉及到的选区范围设置都可以参考这个设置 - -- **示例**: - - + 设定当前工作表选区范围`A1:B2`: - - `luckysheet.setRangeShow("A1:B2")` - + 设定选区范围`A1:B2`: - - `luckysheet.setRangeShow(["A1:B2"])` - + 设定选区范围`A1:B2`: - - `luckysheet.setRangeShow({row:[0,1],column:[0,1]})` - + 设定选区范围`A1:B2`: - - `luckysheet.setRangeShow([{row:[0,1],column:[0,1]}])` - + 设定选区范围`A1:B2`和`C3:D4`: - - `luckysheet.setRangeShow(["A1:B2","C3:D4"])` - + 设定选区范围`A1:B2`和`D3`: - - `luckysheet.setRangeShow([{row:[0,1],column:[0,1]},{row:[2,2],column:[3,3]}])` - ------------- - -### setRangeValue(data [,setting]) - -- **参数**: - - - {Array} [data]: 要赋值的单元格二维数组数据,每个单元格的值,可以为字符串或数字,或为符合Luckysheet格式的对象,参考 [单元格属性表](/zh/guide/cell.html) - - {PlainObject} [setting]: 可选参数 - + {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Boolean} [isRefresh]: 是否刷新界面;默认为`true`;用于多个单元格赋值时候控制节流,前面单元格赋值的时候应设置为 `false`,最后一个单元格赋值时设置为`true`。 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 将一个单元格数组数据赋值到指定的区域,数据格式同`getRangeValue`方法取到的数据。 - - 注意一点,通常`getRangeValue`方法只是取得选区数据,但是不包含边框和合并单元格信息,当执行`setRangeValue`的时候,会动态判断上一步是否执行过`getRangeValue`,如果执行过,会将边框和合并单元格信息一并从Luckysheet配置中取得。 - -- **示例**: - - + 赋值到当前选区 - - ```js - const data = [ - [ - { - "m": "value1", - "ct": { - "fa": "General", - "t": "g" - }, - "v": "value1" - }, - { - "m": "value3", - "ct": { - "fa": "General", - "t": "g" - }, - "v": "value3" - } - ], - [ - { - "m": "value2", - "ct": { - "fa": "General", - "t": "g" - }, - "v": "value2" - }, - { - "m": "value4", - "ct": { - "fa": "General", - "t": "g" - }, - "v": "value4" - } - ] - ] - luckysheet.setRangeValue(data,{range:"A1:B2"}) - ``` - ------------- - -### setRangeFormat(attr, value [,setting]) - - -- **参数**: - - - {String} [attr]: 属性类型, - 参考 [单元格属性表](/zh/guide/cell.html)的属性值 - - {String | Number | Object} [value]: 具体的设置值,一个属性会对应多个值,参考 [单元格属性表](/zh/guide/cell.html)的值示例,特殊情况:如果属性类型`attr`是单元格格式`ct`,则设置值`value`应提供`ct.fa`,比如设置`"A1:B2"`单元格的格式为百分比格式: - - `luckysheet.setRangeFormat("ct", "0.00%", {range:"A1:B2"})` - - - {PlainObject} [setting]: 可选参数 - + {Object | String} [range]: 设置参数的目标选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,允许多个选区组成的数组;默认为当前选区 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 设置指定范围的单元格格式,一般用作处理格式,赋值操作推荐使用`setRangeValue`方法 - - 边框设置时,attr为`"bd"`,value为一个key/value对象,需要同时设置边框类型:`borderType`/边框粗细:`style`/边框颜色:`color`/,比如设置`"A1:B2"`单元格的边框为所有/红色/细: - - `luckysheet.setRangeFormat("bd", {borderType: "border-right",style: "1", color: "#ff0000"}, {range:["A1:B2"]})` - - 完整可选的设置参数如下: - - + 边框类型 `borderType:"border-left" | "border-right" | "border-top" | "border-bottom" | "border-all" | "border-outside" | "border-inside" | "border-horizontal" | "border-vertical" | "border-none"`, - + 边框粗细 `style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick` - + 边框颜色 `color: 16进制颜色值` - -- **示例**: - - - 设置当前工作表`"A1:B2"`范围的单元格文本加粗 - - `luckysheet.setRangeFormat("bl", 1, {range:"A1:B2"})` - - 设置第二个工作表的`"B2"`和`"C4:D5"`范围的单元格背景为红色 - - `luckysheet.setRangeFormat("bg", "#ff0000", {range:["B2","C4:D5"], order:1})` - ------------- - -### setRangeFilter(type [,setting]) - - -- **参数**: - - - {String} [type]: 打开还是关闭筛选功能 - - `type`可能的值有: - - + `"open"`: 打开筛选功能,返回当前筛选的范围对象 - + `"close"`: 关闭筛选功能,返回关闭前筛选的范围对象 - - {PlainObject} [setting]: 可选参数 - + {Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 为指定下标的工作表,选定的范围开启或关闭筛选功能 - -- **示例**: - - - 打开第二个工作表"A1:B2"范围的筛选功能 - `luckysheet.setRangeFilter("open",{range:"A1:B2",order:1})` - ------------- - -### setRangeMerge(type [,setting]) - - -- **参数**: - - - {String} [type]: 合并单元格类型 - - `type`可能的值有: - - + `"all"`: 全部合并,区域内所有单元格合并成一个大的单元格 - + `"horizontal"`: 水平合并,区域内在同一行的单元格合并成一个单元格 - + `"vertical"`: 垂直合并,区域内在同一列的单元格合并成一个单元格 - - - {PlainObject} [setting]: 可选参数 - + {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,允许多个选区组成的数组;默认为当前选区 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 为指定下标的工作表,选定的范围设定合并单元格 - -- **示例**: - - - 当前选区 'A1:B2' 设置为合并单元格,类型为全部合并 - - `luckysheet.setRangeMerge("all")` - 得到 'A1:B1' 的数据为: - ```json - [ - [ - { - "m": "value1", - "ct": { "fa": "General", "t": "g" }, - "v": "value1", - "mc": { "r": 0, "c": 0, "rs": 2, "cs": 2 } - }, - { - "mc": { "r": 0, "c": 0 } - } - ], - [ - { - "mc": { "r": 0, "c": 0 } - }, - { - "mc": { "r": 0, "c": 0 } - } - ] - ] - ``` - ------------- - -### cancelRangeMerge( [setting]) - - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,允许多个选区组成的数组;默认为当前选区 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 为指定下标的工作表,选定的范围取消合并单元格 - -- **示例**: - - - 当前选区 'A1:B2' 已为合并单元格,现在要取消合并 - - `luckysheet.cancelRangeMerge()` - ------------- - -### setRangeSort(type [,setting]) - - -- **参数**: - - - {String} [type]: 排序类型 - - `type`可能的值有: - - + `"asc"`: 升序 - + `"des"`: 降序 - - - {PlainObject} [setting]: 可选参数 - - + {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 为指定下标的工作表,选定的范围开启排序功能,返回选定范围排序后的数据。 - -- **示例**: - - - 设置当前工作表当前选区为升序 - `luckysheet.setRangeSort("asc")` - ------------- - -### setRangeSortMulti(title, sort [,setting]) - - -- **参数**: - - - {Boolean} [title]: 数据是否具有标题行 - - {Array} [sort]: 列设置,设置需要排序的列索引和排序方式,格式如:`[{ i:0,sort:'asc' },{ i:1,sort:'des' }]` - - {PlainObject} [setting]: 可选参数 - - + {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 为指定下标的工作表,选定的范围开启多列自定义排序功能,返回选定范围排序后的数据。 - -- **示例**: - - - 设置当前工作表当前选区为自定义排序,数据具有标题行,且按第一列升序第二列降序的规则进行排序 - `luckysheet.setRangeSortMulti(true,[{ i:0,sort:'asc' },{ i:1,sort:'des' }])` - ------------- - -### setRangeConditionalFormatDefault(conditionName, conditionValue [,setting]) - -- **参数**: - - - {String} [conditionName]: 条件格式规则类型 - - `conditionName`可能的值有: - - + `"greaterThan"`: 大于(conditionValue值为 数值或单元格范围) - + `"lessThan"`: 小于(conditionValue值为 数值或单元格范围) - + `"betweenness"`: 介于(conditionValue值为 数值或单元格范围) - + `"equal"`: 等于(conditionValue值为 数值或单元格范围) - + `"textContains"`: 文本包含(conditionValue值为 文本或单元格范围) - + `"occurrenceDate"`: 发生日期(conditionValue值为 日期) - + `"duplicateValue"`: 重复值(conditionValue值为 '0':重复值, '1':唯一值) - + `"top10"`: 前 N 项(conditionValue值为 1~1000) - + `"top10%"`: 前 N%(conditionValue值为 1~1000) - + `"last10"`: 后 N 项(conditionValue值为 1~1000) - + `"last10%"`: 后 N%(conditionValue值为 1~1000) - + `"AboveAverage"`: 高于平均值(conditionValue可为空数组) - + `"SubAverage"`: 低于平均值(conditionValue可为空数组) - - - {Array} [conditionValue]: 可以设置条件单元格或者条件值 - 取值规则 (条件值数组最少一个值,最多两个值) - ```js - [2] - ``` - 或者 (若值为单元格范围,则取左上角单元格值) - ```js - ['A1'] - ``` - - - {PlainObject} [setting]: 可选参数 - - + {Object} [format]: 颜色设置 - - * 设置文本颜色和单元格颜色;默认值为` { - "textColor": "#000000", - "cellColor": "#ff0000" - }` - + {Array | Object | String} [cellrange]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,允许多个选区组成的数组;默认为当前选区 - - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 为指定下标的工作表,选定的范围开启条件格式,根据设置的条件格式规则突出显示部分单元格,返回开启条件格式后的数据。 - -- **示例**: - - - 突出显示内容大于数字2的单元格 - `luckysheet.setRangeConditionalFormatDefault("greaterThan",{ type: 'value', content: [2] })` - - - 突出显示内容小于单元格A1内容的单元格 - `luckysheet.setRangeConditionalFormatDefault("lessThan",{ type: 'range', content: ['A1'] })` - - - 突出显示内容介于2和10之间的单元格 - `luckysheet.setRangeConditionalFormatDefault("betweenness",{ type: 'value', content: [2,10] })` - - - 突出显示内容等于单元格A1内容的单元格 - `luckysheet.setRangeConditionalFormatDefault("equal",{ type: 'range', content: ['A1'] })` - - - 突出显示内容包含单元格A1内容的单元格 - `luckysheet.setRangeConditionalFormatDefault("textContains",{ type: 'range', content: ['A1'] })` - - - 突出显示日期在 `2020/09/24 - 2020/10/15` 之间的单元格 - `luckysheet.setRangeConditionalFormatDefault("occurrenceDate",{ type: 'value', content: ['2020/09/24 - 2020/10/15'] })` - - - 突出显示重复值的单元格,content为0 - `luckysheet.setRangeConditionalFormatDefault("duplicateValue",{ type: 'value', content: [0] })` - - - 突出显示唯一值的单元格,content为1 - `luckysheet.setRangeConditionalFormatDefault("duplicateValue",{ type: 'value', content: [1] })` - - - 突出显示排名前20名的单元格 - `luckysheet.setRangeConditionalFormatDefault("top",{ type: 'value', content: [20] })` - - - 突出显示排名前30%的单元格 - `luckysheet.setRangeConditionalFormatDefault("topPercent",{ type: 'value', content: [30] })` - - - 突出显示排名后15名的单元格 - `luckysheet.setRangeConditionalFormatDefault("last",{ type: 'value', content: [15] })` - - - 突出显示排名后15%的单元格 - `luckysheet.setRangeConditionalFormatDefault("lastPercent",{ type: 'value', content: [15] })` - - - 突出显示高于平均值的单元格 - `luckysheet.setRangeConditionalFormatDefault("AboveAverage",{ type: 'value', content: ['AboveAverage'] })` - - - 突出显示低于平均值的单元格 - `luckysheet.setRangeConditionalFormatDefault("SubAverage",{ type: 'value', content: ['SubAverage'] })` - ------------- - -### setRangeConditionalFormat(type [,setting]) - -- **参数**: - - - {String} [type]: 条件格式规则类型 - - `type`可能的值有: - - + `"dataBar"`: 数据条 - + `"icons"`: 图标集 - + `"colorGradation"`: 色阶 - - - {PlainObject} [setting]: 可选参数 - - + {Array | String} [format]: 颜色设置 - - * `type`为`dataBar`时,应设置渐变色;默认值为蓝-白渐变` ["#638ec6", "#ffffff"]` - - 推荐的快捷取值: - ```js - ["#638ec6", "#ffffff"], //蓝-白渐变 数据条 - ["#63c384", "#ffffff"], //绿-白渐变 数据条 - ["#ff555a", "#ffffff"], //红-白渐变 数据条 - ["#ffb628", "#ffffff"], //橙-白渐变 数据条 - ["#008aef", "#ffffff"], //浅蓝-白渐变 数据条 - ["#d6007b", "#ffffff"], //紫-白渐变 数据条 - ["#638ec6"], //蓝色 数据条 - ["#63c384"], //绿色 数据条 - ["#ff555a"], //红色 数据条 - ["#ffb628"], //橙色 数据条 - ["#008aef"], //浅蓝色 数据条 - ["#d6007b"] //紫色 数据条 - ``` - - * `type`为`icons`时,应设置图标类型;默认值为"threeWayArrowMultiColor":三向箭头彩色, - - 可取值为: - - `threeWayArrowMultiColor`:三向箭头(彩色), - - `threeTriangles`:3个三角形, - - `fourWayArrowMultiColor`:四向箭头(彩色), - - `fiveWayArrowMultiColor`:五向箭头(彩色), - - `threeWayArrowGrayColor`:三向箭头(灰色), - - `fourWayArrowGrayColor`:四向箭头(灰色), - - `fiveWayArrowGrayColor`:五向箭头(灰色), - - `threeColorTrafficLightRimless`:三色交通灯(无边框), - - `threeSigns`:三标志, - - `greenRedBlackGradient`:绿-红-黑渐变, - - `threeColorTrafficLightBordered`:三色交通灯(有边框), - - `fourColorTrafficLight`:四色交通灯, - - `threeSymbolsCircled`:三个符号(有圆圈), - - `tricolorFlag`:三色旗, - - `threeSymbolsnoCircle`:三个符号(无圆圈), - - `threeStars`:3个星形, - - `fiveQuadrantDiagram`:五象限图, - - `fiveBoxes`:5个框, - - `grade4`:四等级, - - `grade5`:五等级, - - * `type`为`colorGradation`时,应设置色阶颜色值;默认值为绿-黄-红色阶` ["rgb(99, 190, 123)", "rgb(255, 235, 132)", "rgb(248, 105, 107)"]` - - 推荐的快捷取值: - ```js - ["rgb(99, 190, 123)", "rgb(255, 235, 132)", "rgb(248, 105, 107)"], //绿-黄-红色阶 - ["rgb(248, 105, 107)", "rgb(255, 235, 132)", "rgb(99, 190, 123)"], //红-黄-绿色阶 - - ["rgb(99, 190, 123)", "rgb(252, 252, 255)", "rgb(248, 105, 107)"], //绿-白-红色阶 - ["rgb(248, 105, 107)", "rgb(252, 252, 255)", "rgb(99, 190, 123)"], //红-白-绿色阶 - - ["rgb(90, 138, 198)", "rgb(252, 252, 255)", "rgb(248, 105, 107)"], //蓝-白-红色阶 - ["rgb(248, 105, 107)", "rgb(252, 252, 255)", "rgb(90, 138, 198)"], //红-白-蓝色阶 - - ["rgb(252, 252, 255)", "rgb(248, 105, 107)"], //白-红色阶 - ["rgb(248, 105, 107)", "rgb(252, 252, 255)"], //红-白色阶 - - ["rgb(99, 190, 123)", "rgb(252, 252, 255)"], //绿-白色阶 - ["rgb(252, 252, 255)", "rgb(99, 190, 123)"], //白-绿色阶 - - ["rgb(99, 190, 123)", "rgb(255, 235, 132)"], //绿-黄色阶 - ["rgb(255, 235, 132)", "rgb(99, 190, 123)"] //黄-绿色阶 - ``` - - + {Array | Object | String} [cellrange]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,允许多个选区组成的数组;默认为当前选区 - - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 为指定下标的工作表,选定的范围开启条件格式,返回开启条件格式后的数据。 - -- **示例**: - - - 当前选区范围开启条件格式,显示渐变色 - `luckysheet.setRangeConditionalFormat("dataBar", { format: ["#63c384", "#ffffff"] })` - ------------- - -### deleteRangeConditionalFormat(itemIndex [,setting]) - -- **参数**: - - - {Number} [itemIndex]: 条件格式规则索引 - - - {PlainObject} [setting]: 可选参数 - - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 为指定下标的工作表,删除条件格式规则,返回被删除的条件格式规则。 - -- **示例**: - - - 删除第三个条件格式规则 - `luckysheet.deleteRangeConditionalFormat(2)` - ------------- - -### clearRange([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Array | Object | String} [range]: 要清除的选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,允许多个选区组成的数组;默认为当前选区 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 清除指定工作表指定单元格区域的内容,不同于删除选区的功能,不需要设定单元格移动情况 - -- **示例**: - - - 清空当前选区内容 - `luckysheet.clearRange()` - ------------- - -### deleteRange(move [,setting]) - -- **参数**: - - - {String} [move]: 删除后,右侧还是下方的单元格移动 - - `move`可能的值有: - - + `"left"`: 右侧单元格左移 - + `"up"`: 下方单元格上移 - - - {PlainObject} [setting]: 可选参数 - + {Object | String} [range]: 要删除的选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`;默认为当前选区 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 删除指定工作表指定单元格区域,同时,指定是右侧单元格左移还是下方单元格上移 - -- **示例**: - - - 删除当前选区并且在删除后,右侧单元格左移 - `luckysheet.deleteRange('left')` - ------------- - -### insertRange(move [,setting]) - -[todo] - - -- **参数**: - - - {String} [move]: 活动单元格右移或者下移 - - `move`可能的值有: - - + `"right"`: 活动单元格右移 - + `"bottom"`: 活动单元格下移 - - - {PlainObject} [setting]: 可选参数 - + {Array} [data]: 赋值到range区域的单元格二维数组数据,[单元格对象格式参考](/zh/guide/cell.html);默认值为空数组,即插入空白的区域 - + {Array | Object | String} [range]: 要插入的位置,选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,默认为当前选区 - - 当未设置data数据时,允许多个选区组成的数组,插入的空白区域即为这些选区的区域, - - 当设置了data数据,只能为单个选区,并且会把data数据插入到当前选区的第一个单元格位置 - - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 在指定工作表指定单元格区域,赋值单元格数据,或者新建一块空白区域,返回data数据,同时,指定活动单元格右移或者下移 - -- **示例**: - - - 当前选区位置插入空白单元格,并且插入后当前选区单元格右移 - `luckysheet.insertRange('right')` - ------------- - -### matrixOperation(type [,setting]) - -- **参数**: - - - {String} [type]: 矩阵操作的类型 - - `type`可能的值有: - - + `"flipUpDown"`: 上下翻转 - + `"flipLeftRight"`: 左右翻转 - + `"flipClockwise"`: 顺时针旋转 - + `"flipCounterClockwise"`: 逆时针旋转api - + `"transpose"`: 转置 - + `"deleteZeroByRow"`: 按行删除两端0值 - + `"deleteZeroByColumn"`: 按列删除两端0值 - + `"removeDuplicateByRow"`: 按行删除重复值 - + `"removeDuplicateByColumn"`: 按列删除重复值 - + `"newMatrix"`: 生产新矩阵 - - {PlainObject} [setting]: 可选参数 - + {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 指定工作表指定单元格区域的数据进行矩阵操作,返回操作成功后的结果数据 - -- **示例**: - - - 当前选区上下翻转 - - `luckysheet.matrixOperation('flipUpDown')` - - 原来的选区复制为二维数组: - - `[["value1","value3"],["value2","value4"]]` - - 上下翻转后选区复制为二维数组: - - `[["value2","value4"],["value1","value3"]]` - ------------- - -### matrixCalculation(type, number [,setting]) - -- **参数**: - - {String} [type]: 计算方式 - - `type`可能的值有: - - + `"plus"`: 加 - + `"minus"`: 减 - + `"multiply"`: 乘 - + `"divided"`: 除 - + `"power"`: 次方 - + `"root"`: 次方根 - + `"log"`: log - - {Number} [number]: 计算数值,如: 2 - - {PlainObject} [setting]: 可选参数 - + {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 指定工作表指定单元格区域的数据进行矩阵计算,返回计算成功后的结果数据 - -- **示例**: - - - 当前选区所有单元格值加2 - - `luckysheet.matrixCalculation('plus', 2)` - - 原来的选区复制为二维数组: - - `[[1,2],[3,4]]` - - 加2后选区复制为二维数组: - - `[[3,4],[5,6]]` - ------------- - -## 工作表操作 - -### getAllSheets() - -- **说明**: - - 返回所有工作表配置,格式同工作表配置,得到的结果可用于表格初始化时作为options.data使用。 - - 所以此API适用于,手动操作配置完一个表格后,将所有工作表信息取出来自行保存,再用于其他地方的表格创建。如果想得到包括工作簿配置在内的所有工作簿数据,推荐使用 [toJson](#toJson()),并且可以直接用于初始化Luckysheet。 - -- **示例**: - - - 取得第一个工作表的所有基本信息 - `luckysheet.getAllSheets()[0]` - ------------- - -### getLuckysheetfile() - -- **说明**: - - 返回所有表格数据结构的一维数组`luckysheetfile`,不同于`getAllSheets`方法,此方法得到的工作表参数会包含很多内部使用变量,最明显的区别是表格数据操作会维护`luckysheetfile[i].data`,而初始化数据采用的是`options.data[i].celldata`,所以`luckysheetfile`可用于调试使用,但是不适用初始化表格。 - - 除此之外,加载过的工作表参数中会增加一个`load = 1`,这个参数在初始化数据的时候需要置为0才行。所以,将`getLuckysheetfile()`得到的数据拿来初始化工作簿,需要做两个工作: - - - celldata转为data,参考:[transToData](/zh/guide/api.html#transtodata-celldata-setting) - - load重置为0或者删除此字段 - - 现在已有`getAllSheets`来完成这个工作,无需再手动转化数据。 - -- **示例**: - - - 取得第一个工作表的所有调试信息 - `luckysheet.getLuckysheetfile()[0]` - ------------- - -### getSheet([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Number} [index]: 工作表索引;默认值为当前工作表索引 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Number} [name]: 工作表名称;默认值为当前工作表名称 - -- **说明**: - - 根据index/order/name,快捷返回指定工作表的配置,同 `luckysheetfile[i]`。如果设置多个参数,优先级为:index > order > name。 - ------------- - -### getSheetData([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - -- **说明**: - - 快捷返回指定工作表的数据,同 `luckysheetfile[i].data` - ------------- - -### getConfig([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - -- **说明**: - - 快捷返回指定工作表的config配置,同 `luckysheetfile[i].config` - ------------- - -### setConfig(cfg, [setting]) - -- **参数**: - - {Object} [cfg]: config配置 - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 快捷设置指定工作表config配置 - ------------- -### updataSheet([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Array} [data]: 需要更新的工作表配置,参考create这个API的option.data - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 根据所传的工作表配置,更新相应的工作表 - - ------------- -### setSheetAdd([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Object} [sheetObject]: 新增的工作表的数据;默认值为空对象,工作表数据格式参考[options.data](/zh/guide/sheet.html#初始化配置) - + {Number} [order]: 新增的工作表下标;默认值为最后一个下标位置 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 新增一个sheet,返回新增的工作表对象,`setting`中可选设置数据为 `sheetObject`,不传`sheetObject`则会新增一个空白的工作表。 - -- **示例**: - - - 在最后一个工作表下标位置新增一个空白的工作表 - `luckysheet.setSheetAdd()` - ------------- - -### setSheetDelete([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 删除指定下标的工作表,返回已删除的工作表对象 - -- **示例**: - - - 删除当前工作表 - `luckysheet.setSheetDelete()` - ------------- - -### setSheetCopy([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Number} [targetOrder]: 新复制的工作表目标下标位置;默认值为当前工作表下标的下一个下标位置(递增) - + {Number} [order]: 被复制的工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 复制指定下标的工作表到指定下标位置,在`setting`中可选设置指定下标位置`targetOrder`,返回新复制的工作表对象 - -- **示例**: - - - 复制当前工作表到下一个下标位置 - `luckysheet.setSheetCopy()` - ------------- - -### setSheetHide([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 被隐藏的工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 隐藏指定下标的工作表,返回被隐藏的工作表对象 - -- **示例**: - - - 隐藏当前工作表 - `luckysheet.setSheetHide()` - - 隐藏第三个工作表 - `luckysheet.setSheetHide({order:2})` - ------------- - -### setSheetShow([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 被取消隐藏的工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 取消隐藏指定下标的工作表,返回被取消隐藏的工作表对象 - -- **示例**: - - - 取消隐藏第三个工作表 - `luckysheet.setSheetShow({order:2})` - ------------- - -### setSheetActive(order [,setting]) - -- **参数**: - - - {Number} [order]: 要激活的工作表下标 - - {PlainObject} [setting]: 可选参数 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 设置指定下标的工作表为当前工作表(激活态),即切换到指定的工作表,返回被激活的工作表对象 - -- **示例**: - - - 切换到第二个工作表 - `luckysheet.setSheetActive(1)` - ------------- - -### setSheetName(name [,setting]) - -- **参数**: - - - {String} [name]: 新的工作表名称 - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 修改工作表名称 - -- **示例**: - - - 修改当前工作表名称为"CellSheet" - `luckysheet.setSheetName("CellSheet")` - ------------- - -### setSheetColor(color [,setting]) - -- **参数**: - - - {String} [color]: 工作表颜色 - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 设置工作表名称处的颜色 - -- **示例**: - - - 修改当前工作表名称处的颜色为红色 - `luckysheet.setSheetColor("#ff0000")` - ------------- - -### setSheetMove(type [,setting]) - -- **参数**: - - - {String | Number} [type]: 工作表移动方向或者移动的目标下标, - - `type`可能的值有: - - + `"left"`: 向左 - + `"right"`: 向右 - + `1`/`2`/`3`/...: 指定下标 - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 指定工作表向左边或右边移动一个位置,或者指定下标,返回指定的工作表对象 - -- **示例**: - - - 当前工作表向左移动一个位置 - `luckysheet.setSheetMove("left")` - - 第二个工作表移动到第四个工作表的下标位置 - `luckysheet.setSheetMove(3,{order:1})` - ------------- - -### setSheetOrder(orderList [,setting]) - -- **参数**: - - - {Array} [orderList]: 工作表顺序,设置工作表的index和order来指定位置,如: - - ```json - [ - {index:'sheet_01',order: 2}, - {index:'sheet_02',order: 1}, - {index:'sheet_03',order: 0}, - ] - ``` - 数组中顺序并不重要,关键是指定sheet index和order的对应关系。 - - - {PlainObject} [setting]: 可选参数 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 重新排序所有工作表的位置,指定工作表顺序的数组。 - - -- **示例**: - - - 重排工作表,此工作簿含有3个工作表 - ```js - luckysheet.setSheetOrder([ - {index:'sheet_01',order: 2}, - {index:'sheet_02',order: 1}, - {index:'sheet_03',order: 0}, - ]) - ``` - ------------- - -### setSheetZoom(zoom [,setting]) - -- **参数**: - - - {Number} [zoom]: 工作表缩放比例,值范围为0.1 ~ 4; - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 设置工作表缩放比例 - - -- **示例**: - - - 设置当前工作表缩放比例为0.5 - ```js - luckysheet.setSheetZoom(0.5) - ``` - ------------- - -### showGridLines([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 需要显示网格线的工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 显示指定下标工作表的网格线,返回操作的工作表对象 - -- **示例**: - - - 显示当前工作表的网格线 - `luckysheet.showGridLines()` - - 显示第三个工作表的网格线 - `luckysheet.showGridLines({order:2})` - ------------- - -### hideGridLines([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 需要隐藏网格线的工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 隐藏指定下标工作表的网格线,返回操作的工作表对象 - -- **示例**: - - - 隐藏当前工作表的网格线 - `luckysheet.hideGridLines()` - - 隐藏第三个工作表的网格线 - `luckysheet.hideGridLines({order:2})` - ------------- - -## 工作簿操作 - -### create(options) - -- **参数**: - - - {Object} [options]:表格的所有配置信息 - -- **说明**: - - 初始化一个Luckysheet,可包含多个工作表,参考 [配置列表](/zh/guide/config.html) - ------------- - -### refresh([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Function} [success]: 表格刷新成功后的回调函数 - -- **说明**: - - 刷新canvas - ------------- - -### scroll([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Number} [scrollLeft]:横向滚动值。默认为当前横向滚动位置。 - + {Number} [scrollTop]:纵向滚动值。默认为当前纵向滚动位置。 - + {Number} [targetRow]:纵向滚动到指定的行号。默认为当前纵向滚动位置。 - + {Number} [targetColumn]:横向滚动到指定的列号。默认为当前横向滚动位置。 - + {Function} [success]: 表格刷新成功后的回调函数 - -- **说明**: - - 滚动当前工作表位置 - ------------- - -### resize([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 根据窗口大小自动resize画布 - ------------- - -### destroy([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Function} [success]: 表格释放成功后的回调函数 - -- **说明**: - - 删除并释放表格 - ------------- - -### getScreenshot([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 - -- **说明**: - - 返回当前表格指定选区截图后生成的base64格式的图片 - ------------- - -### setWorkbookName(name [,setting]) - -- **参数**: - - - {String} [name]: 工作簿名称 - - {PlainObject} [setting]: 可选参数 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 设置工作簿名称 - ------------- - -### getWorkbookName([,setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 获取工作簿名称 - ------------- - -### undo([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 撤销当前操作,返回刚刚撤销的操作对象 - ------------- - -### redo([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 重做当前操作,返回刚刚重做的操作对象 - ------------- - -### refreshFormula([success]) - -- **参数**: - - - {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 强制刷新公式。当你直接修改了多个单元格的值,且没有触发刷新,且这些单元格跟公式相关联,则可以使用这个api最后强制触发一次公式刷新。 - ------------- - -### pagerInit([setting]) - -- **参数**: - - - {PlainObject} [setting]: 参数配置 - + {Number} [pageIndex]: 当前的页码(必填)。 - + {Number} [pageSize]: 每页显示多少条数据(必填)。 - + {Number} [total]: 总条数(必填)。 - + {Boolean} [showTotal]: 是否显示总数,默认关闭:false。 - + {Boolean} [showSkip]: 是否显示跳页,默认关闭:false。 - + {Boolean} [showPN]: 是否显示上下翻页,默认开启:true。 - + {Array} [selectOption]: 选择分页的条数。 - + {String} [prevPage]: 上翻页文字描述,默认"上一页"。 - + {String} [nextPage]: 下翻页文字描述,默认"下一页"。 - + {String} [totalTxt]: 数据总条数文字描述,默认"总共:{total}"。 - - - -- **说明**: - - 初始化分页器。ps:create阶段,可以直接配置options.pager参数,渲染阶段会将options.pager作为参数来初始化分页器,可通过钩子函数onTogglePager来监听页码的切换 - -### refreshMenuButtonFocus([data],[r],[c],[success]) - -- **参数**: - - - {Array} [data]: 操作数据 - - {Number} [r]: 指定的行 - - {Number} [c]: 指定的列 - - {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 刷新指定单元格的顶部状态栏状态。 - ------------- - -### checkTheStatusOfTheSelectedCells(type,status) - -- **参数**: - - - {String} type: 类型 - - {String} status: 目标状态值 - -- **说明**: - - 检查选区内所有cell指定类型的状态是否满足条件(主要是粗体、斜体、删除线和下划线等等)。 - ------------- - -## 图表 - -### insertChart([setting]) - -[todo] - - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Array | Object | String} [range]: 图表数据的选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 指定工作表指定选区范围生成一个图表,返回图表参数对象,包含图表唯一标识符chart id - ------------- - -### setChart(chartId, attr, value [,setting]) - -[todo] - - -- **参数**: - - - {String} [chartId]: 指定要修改的图表id - - {String} [attr]: 属性类型 - - `attr`可能的值有: - - + `"left"`: 左边到工作表边缘的距离 - + `"top"`: 上边到工作表边缘的距离 - + `"width"`: 图表外框的宽度 - + `"height"`: 图表外框的高度 - + `"chartOptions"`: 图表的详细设置项 - - - {Number | Object}} [value]: 属性值,当`attr`为`chartOptions`时,直接设置整个chart的配置对象 - - - {PlainObject} [setting]: 可选参数 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 修改指定id图表的参数,返回修改后的整个图表参数 - ------------- - -### getChart(chartId) - -[todo] - - -- **参数**: - - - {String} [chartId]: 指定要获取的图表id - -- **说明**: - - 获取指定id图表的参数 - ------------- - -### deleteChart(chartId [,setting]) - -[todo] - - -- **参数**: - - - {String} [chartId]: 要删除的图表id - - - {PlainObject} [setting]: 可选参数 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 删除指定id图表,返回被删除的图表的参数 - ------------- - -## 数据验证 - -### setDataVerification(optionItem, [setting]) - -- **参数**: - - - {Object} [optionItem]: 数据验证的配置信息,具体详细的配置信息参考[dataVerification](/zh/guide/sheet.html#dataVerification) - - - {PlainObject} [setting]: 可选参数 - + {Object | String} [range]: 数据验证的选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 指定工作表范围设置数据验证功能,并设置参数 - ------------- - -### deleteDataVerification([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Object | String} [range]: 数据验证的选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 指定工作表范围删除数据验证功能 - ------------- - -## 图片 - -### insertImage(src, [setting]) - -- **参数**: - - - {String} [src]: 图片src - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Number} [rowIndex]: 要插入图片的单元格行下标;默认为当前选区聚焦单元格行下标 || 0 - + {Number} [colIndex]: 要插入图片的单元格列下标;默认为当前选区聚焦单元格列下标 || 0 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 在指定的工作表中指定单元格位置插入图片 - -### deleteImage([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {String | Array} [idList]: 要删除图片的id集合,也可为字符串`"all"`,all为所有的字符串;默认为`"all"` - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 删除指定工作表中的图片 - -### getImageOption([setting]) - -- **参数**: - - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 获取指定工作表的图片配置 - -## 工作表保护 - - -### setProtection(option, [setting]) - -[todo] - -- **参数**: - - - {Object} [option]: 工作表保护的配置信息 - - {PlainObject} [setting]: 可选参数 - + {Number} [order]: 工作表下标;默认值为当前工作表下标 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - 指定工作表设置工作表保护功能 - ------------- - -## 工具方法 - -### transToCellData(data [,setting])
- -- **参数**: - - - {Array} [data]: data数据 - - - {PlainObject} [setting]: 可选参数 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - data => celldata ,data二维数组数据转化成 {r, c, v}格式一维数组 - ------------- - -### transToData(celldata [,setting])
- -- **参数**: - - - {Array} [celldata]: data数据 - - - {PlainObject} [setting]: 可选参数 - + {Function} [success]: 操作结束的回调函数 - -- **说明**: - - celldata => data ,celldata一维数组数据转化成表格所需二维数组 - ------------- - -### toJson() - - -- **说明**: - - 导出的json字符串可以直接当作`luckysheet.create(options)`初始化工作簿时的参数`options`使用,使用场景在用户自己操作表格后想要手动保存全部的参数,再去别处初始化这个表格使用,类似一个luckysheet专有格式的导入导出。 - ------------- - -### changLang([lang]) - -- **参数**: - - + {String} [lang]: 语言类型;暂支持`"zh"`、`"en"`、`"es"`;默认为`"zh"`; - -- **说明**: - - 传入目标语言,切换到对应的语言界面 - -### closeWebsocket() - -- **说明**: - - 关闭websocket连接 - -### getRangeByTxt([txt]) - -- **说明**: - - 将字符串格式的工作表范围转换为数组形式 - -- **参数**: - - + {String} [txt]: 选区范围,支持选区的格式为`"A1:B2"`或者指定工作表名称的写法`"sheetName!A1:B2"`,只支持单个选区;默认为当前最后一个选区 - -- **示例**: - - - 当前选区为`A1:B2`,`luckysheet.getRangeByTxt()`返回:`{column: (2) [0, 1],row: (2) [0, 1]}` - - `luckysheet.getRangeByTxt("A1:B2")`返回:`{column: (2) [0, 1],row: (2) [0, 1]}` - - `luckysheet.getRangeByTxt("Cell!A1:B2")`返回:`{column: (2) [0, 1],row: (2) [0, 1]}` - ------------- - -### getTxtByRange([range]) - -- **说明**: - - 将数组格式的工作表范围转换为字符串格式的形式 - -- **参数**: - - + {Array | Object} [range]: 选区范围,支持选区的格式为`{row:[0,1],column:[0,1]}`,允许多个选区组成的数组;默认为当前选区 - -- **示例**: - - - 当前选区为`A1:B3`,`luckysheet.getTxtByRange()`返回:当前选区`"A1:B3"` - - `luckysheet.getTxtByRange({column:[0,1],row:[0,2]})`返回:`"A1:B3"` - - `luckysheet.getTxtByRange([{column:[0,1],row:[0,2]}])`返回:`"A1:B3"` - - `luckysheet.getTxtByRange([{column:[0,1],row:[0,2]},{column:[1,1],row:[1,2]}])`返回:`"A1:B3,B2:B3"` - ------------- - - -## 旧版API - -::: warning -为保持兼容性,仍然支持旧版API,但是已不推荐使用。 -::: - -### getcellvalue([r] [,c] [,data] [,type]) - -- **参数**: - - - {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列单元格的原始值。 - - 特殊情况:单元格格式为yyyy-MM-dd,type为'v'时会强制取'm'显示值 - - > 推荐使用新API: getCellValue - ------------- - -### getluckysheetfile() - -- **说明**: - - 返回所有表格数据结构的一维数组`luckysheetfile` - - > 推荐使用新API: [getLuckysheetfile](#getLuckysheetfile()) - ------------- - -### getconfig() - -- **说明**: - - 快捷返回当前表格config配置,每个工作表的config信息仍然包含在luckysheetfile。 - - > 推荐使用新API: [getConfig](#getConfig([setting])) - ------------- - -### getluckysheet_select_save() - -- **说明**: - - 返回当前选区对象的数组,可能存在多个选区。 - - > 推荐使用新API: [getRange](#getRange()) - ------------- - -### getdatabyselection([range] [,sheetOrder]) - -- **参数**: - - - {Object} [range]:选区对象,`object: { row: [r1, r2], column: [c1, c2] }`;默认为当前第一个选区。 - - {Number} [sheetOrder]:表格下标,从0开始的整数,0表示第一个表格;默认为当前表格下标。 - -- **说明**: - - 返回某个表格第一个选区的数据。 - - `luckysheet.getdatabyselection()`: 返回当前工作表当前选区的数据 - - `luckysheet.getdatabyselection(null,1)`: 返回第2个工作表的当前选区的数据 - - > 推荐使用新API: [getRangeValue](#getRangeValue([setting])) - ------------- - -### luckysheetrefreshgrid(scrollWidth, scrollHeight) - -- **参数**: - - - {Number} [scrollWidth]:横向滚动值。默认为当前横向滚动位置。 - - {Number} [scrollHeight]:纵向滚动值。默认为当前纵向滚动位置。 - -- **说明**: - - 按照scrollWidth, scrollHeight刷新canvas展示数据。 - - > 推荐使用新API: [scroll](/zh/guide/api.html#scroll-setting) ------------- - -### setcellvalue(r, c, d, v) - -- **参数**: - - - {Number} [r]:单元格所在行数;从0开始的整数,0表示第一行。 - - {Number} [c]:单元格所在列数;从0开始的整数,0表示第一列。 - - {Array} [d]:表数据;可选值;二维数组。 - - {Object | String | Number} [v]:要设置的值;可为对象,对象是是要符合单元格对象格式。 - -- **说明**: - - 设置某个单元格的值。可配合`luckysheet.jfrefreshgrid()`刷新查看单元格值改变。 - - ```js - luckysheet.setcellvalue(0, 0, luckysheet.flowdata(), 'abc'); - luckysheet.jfrefreshgrid(); - ``` - ------------- - -### jfrefreshgrid() - -- **说明**: - - 刷新canvas - - > 推荐使用新API: [refresh](#refresh([setting])) - ------------- - -### setluckysheet_select_save(v) - -- **参数**: - - - {Array} [v]:要设置的选区值(数组)。符合选区格式规则,如`[{ row: [r1, r2], column: [c1, c2] }]`。 - -- **说明**: - - 设置当前表格选区的值。配合`luckysheet.selectHightlightShow()`可在界面查看选区改变。 - ```js - luckysheet.setluckysheet_select_save([{ row: [0, 1], column: [0, 1] }]); - luckysheet.selectHightlightShow(); - ``` - - > 推荐使用新API:setRangeShow - ------------- - -### selectHightlightShow() - -- **说明**: - - 高亮当前选区 - - > 推荐使用新API:setRangeShow - ------------- - -### flowdata() - -- **说明**: - - 快捷获取当前表格的数据 - - > 推荐使用新API:[getSheetData](#getSheetData()) - ------------- - -### buildGridData(file) - -- **参数**: - - - {Object} [file]:[luckysheetfile](/zh/guide/sheet.html) - -- **说明**: - - 生成表格可以识别的二维数组 - - > 推荐使用新API:transToData - ------------- - -### getGridData(data) - -- **参数**: - - - {Array} [data]:工作表的二维数组数据 - -- **说明**: - - 二维数组数据转化成 `{r, c, v}` 格式 一维数组 - - > 推荐使用新API:transToCellData +# API + +Luckysheet针对常用的数据操作需求,开放了主要功能的API,开发者可以根据需要进行任意对接开发。 + +使用注意: +1. script全局引入时,所有API均挂载到window.luckysheet对象下面,可以在浏览器控制台打印看到;npm引入时,API也全部挂载在luckysheet对象下 +2. `success`回调函数第一个参数为API方法的返回值 +3. 需要新的API请到github [Issues](https://github.com/mengshukeji/Luckysheet/issues/new/choose)中提交,根据点赞数决定是否开放新API +4. API方法中所需的`order`参数为工作表对象中的`order`的值,而不是`index` + +## 单元格操作 + +### getCellValue(row, column [,setting])
+ + +- **参数**: + + - {Number} [row]: 单元格所在行数;从0开始的整数,0表示第一行 + - {Number} [column]: 单元格所在列数;从0开始的整数,0表示第一列 + - {PlainObject} [setting]: 可选参数 + + {String} [type]: 单元格的值类型,可以设置为原始值`v`或者显示值`m`;默认值为`v`,表示获取单元格的实际值 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + +- **说明**: + + 获取单元格的值。 + + 特殊情况,单元格格式为`yyyy-MM-dd`,`type`为`'v'`时会强制取`'m'`显示值 + +- **示例**: + + - 返回当前工作表第1行第1列单元格的数据的v值 + + `luckysheet.getCellValue(0, 0)` + + - 返回指定data数据的第2行第2列单元格的显示值。 + + `luckysheet.getCellValue(1, 1, {type:"m"})` + +------------ + +### setCellValue(row, column, value [,setting]) + + +- **参数**: + + - {Number} [row]: 单元格所在行数;从0开始的整数,0表示第一行 + - {Number} [column]: 单元格所在列数;从0开始的整数,0表示第一列 + - {Object | String | Number} [value]: 要设置的值;可以为字符串或数字,或为符合Luckysheet单元格格式的对象,参考 [单元格属性表](/zh/guide/cell.html) + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Boolean} [isRefresh]: 是否刷新界面;默认为`true`;用于多个单元格赋值时候控制节流,前面单元格赋值的时候应设置为 `false`,最后一个单元格赋值时设置为`true`。 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 设置某个单元格的值,也可以设置整个单元格对象,用于同时设置多个单元格属性。 + + 如果需要更新公式,也可以在这里赋值,Luckysheet在内部会主动把这个公式做计算并加入到公式链中,最后重刷界面。 + +- **示例**: + + - 设置当前工作表"A1"单元格的值为"1" +     `luckysheet.setCellValue(0, 0, 1);` + + - 设置当前工作表"B1"单元格的值为公式"=sum(A1)" +     `luckysheet.setCellValue(0, 1, "=sum(A1)");` + + - 设置当前工作表"C1"单元格的值为公式"=sum(A1:B1",并带有红色背景,单元格对象可以不带`v`和`m`值,Luckysheet会根据公式信息自动计算结果,如果带了未更新或者是非公式结果的`v`和`m`值,Luckysheet也仍然会根据公式实际关联的数据计算出准备的结果。 +     `luckysheet.setCellValue(0, 2, {f: "=sum(A1:B1)", bg:"#FF0000"})` + + 再次设置"C1"单元格新的公式仍然可以生效 + + `luckysheet.setCellValue(0, 2, {f: "=sum(A1)", bg:"#00FF00"})` + +------------ + +### clearCell(row, column [,setting]) + + +- **参数**: + + - {Number} [row]: 单元格所在行数;从0开始的整数,0表示第一行 + - {Number} [column]: 单元格所在列数;从0开始的整数,0表示第一列 + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 清除指定工作表指定单元格的内容,返回清除掉的数据,不同于删除单元格的功能,不需要设定单元格移动情况 + +- **示例**: + + - 清空单元格`B2`内容 + `luckysheet.clearCell(1,1)` + +------------ + +### deleteCell(move, row, column [,setting]) + + +- **参数**: + - {String} [move]: 删除后,右侧还是下方的单元格移动 + + `move`可能的值有: + + + `"left"`: 右侧单元格左移 + + `"up"`: 下方单元格上移 + + - {Number} [row]: 单元格所在行数;从0开始的整数,0表示第一行 + - {Number} [column]: 单元格所在列数;从0开始的整数,0表示第一列 + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 删除指定工作表指定单元格,返回删除掉的数据,同时,指定是右侧单元格左移还是下方单元格上移 + +- **示例**: + + - 删除当前单元格并且在删除后,右侧单元格左移 + `luckysheet.deleteCell('left')` + +------------ + +### setCellFormat(row, column, attr, value [,setting]) + + +- **参数**: + + - {Number} [row]: 单元格所在行数;从0开始的整数,0表示第一行 + - {Number} [column]: 单元格所在列数;从0开始的整数,0表示第一列 + - {String} [attr]: 属性类型,参考 [单元格属性表](/zh/guide/cell.html)的属性值 + - {String | Number | Object} [value]: 具体的设置值,一个属性会对应多个值,参考 [单元格属性表](/zh/guide/cell.html)的值示例,如果属性类型`attr`是单元格格式`ct`,则设置值`value`应提供ct对象,如:`{fa:"General", t:"g"}`,比如设置A1单元格的格式为百分比格式: + + `luckysheet.setCellFormat(0, 0, "ct", {fa:"0.00%", t:"n"})` + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 设置某个单元格的属性,如果要设置单元格的值或者同时设置多个单元格属性,推荐使用`setCellValue` + + 特殊的设置 + + 边框设置时,attr为`"bd"`,value为一个key/value对象,需要同时设置边框类型:`borderType`/边框粗细:`style`/边框颜色:`color`,比如设置A1单元格的边框为所有/红色/细: + + `luckysheet.setCellFormat(0, 0, "bd", {borderType: "border-right",style: "1", color: "#ff0000"})` + + 完整可选的设置参数如下: + + + 边框类型 `borderType:"border-left" | "border-right" | "border-top" | "border-bottom" | "border-all" | "border-outside" | "border-inside" | "border-horizontal" | "border-vertical" | "border-none"`, + + 边框粗细 `style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick` + + 边框颜色 `color: 16进制颜色值` + +- **示例**: + + - 设置当前工作表A1单元格文本加粗 + `luckysheet.setCellFormat(0, 0, "bl", 1)` + - 设置第二个工作表的B2单元格背景为红色 + `luckysheet.setCellFormat(1, 1, "bg", "#ff0000", {order:1})` + - 设置当前工作表"A1"单元格的值为"abc" + `luckysheet.setCellFormat(0, 0, 'v', 'abc');` + +------------ + +### find(content [,setting]) + + +- **参数**: + + - {String} [content]: 要查找的内容 + - {PlainObject} [setting]: 可选参数 + + {Boolean} [isRegularExpression]: 是否正则表达式匹配;默认为 `false` + + {Boolean} [isWholeWord]: 是否整词匹配;默认为 `false` + + {Boolean} [isCaseSensitive]: 是否区分大小写匹配;默认为 `false` + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {String} [type]: 单元格属性;默认值为`"m"` + +- **说明**: + + 查找一个工作表中的指定内容,返回查找到的内容组成的单元格一位数组,数据格式同`celldata`。 + +- **示例**: + + - 当前工作表查找`"value"`字符串 + `luckysheet.find("value")` + - 当前工作表查找公式包含`"SUM"`的单元格 + `luckysheet.find("SUM",{type:"f"})` + +------------ + +### replace(content, replaceContent [,setting]) + + +- **参数**: + + - {String} [content]: 要查找的内容 + - {String} [replaceContent]: 要替换的内容 + - {PlainObject} [setting]: 可选参数 + + {Boolean} [isRegularExpression]: 是否正则表达式匹配;默认为 `false` + + {Boolean} [isWholeWord]: 是否整词匹配;默认为 `false` + + {Boolean} [isCaseSensitive]: 是否区分大小写匹配;默认为 `false` + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 查找一个工作表中的指定内容并替换成新的内容,返回替换后的内容组成的单元格一位数组,数据格式同`celldata`。 + +- **示例**: + + - 当前工作表查找`"value"`字符串并替换为`"out"` + `luckysheet.replace("value", "out")` + +------------ + +### exitEditMode([,setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 退出编辑模式。鼠标双击单元格后,会进入单元格编辑模式,编辑完成后,当鼠标再次点击别的地方输入框失焦的时候,则会退出编辑模式,随即单元格的值会进行保存。此Api就是自动退出编辑模式的操作,主要是为了触发自动保存单元格。 + +- **示例**: + + - 手动触发退出编辑模式 + `luckysheet.exitEditMode()` + +------------ + +## 行和列操作 + +### setHorizontalFrozen(isRange [,setting]) + + +- **参数**: + + - {Boolean} [isRange]: 是否冻结行到选区 + `isRange`可能的值有: + + + `"false"`: 冻结首行 + + `"true"`: 冻结行到选区 + - {PlainObject} [setting]: 可选参数 + + {Array | Object | String} [range]: `isRange`为`true`的时候设置,开启冻结的单元格位置,格式为`{ row_focus:0, column_focus:0 }`,意为当前激活的单元格的行数和列数;默认从当前选区最后的一个选区中取得 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 冻结行操作 + + 特别注意,只有在`isRange`设置为`true`的时候,才需要设置`setting`中的`range`,且与一般的range格式不同。 + +- **示例**: + + - 冻结首行 + + `luckysheet.setHorizontalFrozen(false)` + + - 冻结到`B5`选区 + + `luckysheet.setHorizontalFrozen(true, { range: 'B5' })` + +------------ + +### setVerticalFrozen(isRange [,setting]) + + +- **参数**: + + - {Boolean} [isRange]: 是否冻结列到选区 + `isRange`可能的值有: + + + `"false"`: 冻结首列 + + `"true"`: 冻结列到选区 + - {PlainObject} [setting]: 可选参数 + + {Array | Object | String} [range]: `isRange`为`true`的时候设置,开启冻结的单元格位置,格式为`{ row_focus:0, column_focus:0 }`,意为当前激活的单元格的行数和列数;默认从当前选区最后的一个选区中取得 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 冻结列操作 + + 特别注意,只有在`isRange`设置为`true`的时候,才需要设置`setting`中的`range`,且与一般的range格式不同。 + +- **示例**: + + - 冻结首列 + + `luckysheet.setVerticalFrozen(false)` + +------------ + +### setBothFrozen(isRange [,setting]) + + +- **参数**: + + - {Boolean} [isRange]: 是否冻结行列到选区 + `isRange`可能的值有: + + + `"false"`: 冻结行列 + + `"true"`: 冻结行列到选区 + - {PlainObject} [setting]: 可选参数 + + {Array | Object | String} [range]: `isRange`为`true`的时候设置,开启冻结的单元格位置,格式为`{ row_focus:0, column_focus:0 }`,意为当前激活的单元格的行数和列数;默认从当前选区最后的一个选区中取得 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 冻结行列操作 + + 特别注意,只有在`isRange`设置为`true`的时候,才需要设置`setting`中的`range`,且与一般的range格式不同。 + + 如果想在工作簿初始化后使用此API设置冻结,可以在工作簿创建后的钩子函数中执行,比如: + ```js + luckysheet.create({ + hook:{ + workbookCreateAfter:function(){ + luckysheet.setBothFrozen(false); + } + } + }); + + ``` + +- **示例**: + + - 冻结行列 + + `luckysheet.setBothFrozen(false)` + +------------ + +### cancelFrozen([setting]) + + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 取消冻结操作 + +- **示例**: + + - 取消冻结 + + `luckysheet.cancelFrozen()` + +------------ + +### insertRow(row [,setting]) + + +- **参数**: + + - {Number} [row]: 在第几行插入空白行,从0开始 + + - {PlainObject} [setting]: 可选参数 + + {Number} [number]: 插入的空白行数;默认为 1 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 在第`row`行的位置,插入`number`行空白行 + +- **示例**: + + - 在第2行的位置插入1行空白行 + + `luckysheet.insertRow(1)` + +------------ + +### insertColumn( column [,setting]) + + +- **参数**: + + - {Number} [column]: 在第几列插入空白列 + + - {PlainObject} [setting]: 可选参数 + + {Number} [number]: 插入的空白列数;默认为 1 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 在第`column`列的位置,插入`number`列空白列 + +- **示例**: + + - 在第1列的位置插入3行空白行 + + `luckysheet.insertColumn(0, { number: 3 })` + +------------ + +### deleteRow(rowStart, rowEnd [,setting]) + + +- **参数**: + + - {Number} [rowStart]: 要删除的起始行 + - {Number} [rowEnd]: 要删除的结束行 + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 删除指定的行 + + 特别提醒,删除行之后,行的序号并不会变化,下面的行会补充到上面,注意观察数据是否被正确删除即可。 + +- **示例**: + + - 删除2-4行 + + `luckysheet.deleteRow(1, 3)` + +------------ + +### deleteColumn(columnStart, columnEnd [,setting]) + +- **参数**: + + - {Number} [columnStart]: 要删除的起始列 + - {Number} [columnEnd]: 要删除的结束列 + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 删除指定的列 + + 特别提醒,删除列之后,列的序号并不会变化,右边的列会补充到左边,注意观察数据是否被正确删除即可。 + +- **示例**: + + - 删除2-4列 + + `luckysheet.deleteColumn(1, 3)` + +------------ + +### hideRow(rowStart, rowEnd [,setting]) + +- **参数**: + + - {Number} [rowStart]: 要隐藏的起始行 + - {Number} [rowEnd]: 要隐藏的结束行 + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 隐藏指定的行 + + 特别提醒,隐藏行之后,行的序号会变化。 + +- **示例**: + + - 隐藏2-4行 + + `luckysheet.hideRow(1, 3)` + +------------ + +### hideColumn(columnStart, columnEnd [,setting])(TODO) + +- **参数**: + + - {Number} [columnStart]: 要隐藏的起始列 + - {Number} [columnEnd]: 要隐藏的结束列 + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 隐藏指定的列 + + 特别提醒,隐藏列之后,列的序号会变化。 + +- **示例**: + + - 隐藏2-4列 + + `luckysheet.hideColumn(1, 3)` + +------------ + +### showRow(rowStart, rowEnd [,setting]) + +- **参数**: + + - {Number} [rowStart]: 要显示的起始行 + - {Number} [rowEnd]: 要显示的结束行 + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 显示指定的行 + +- **示例**: + + - 显示2-4行 + + `luckysheet.showRow(1, 3)` + +------------ + +### showColumn(columnStart, columnEnd [,setting])(TODO) + +- **参数**: + + - {Number} [columnStart]: 要显示的起始列 + - {Number} [columnEnd]: 要显示的结束列 + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 显示指定的列 + +- **示例**: + + - 显示2-4列 + + `luckysheet.showColumn(1, 3)` + +------------ + +### setRowHeight(rowInfo [,setting]) + +- **参数**: + + - {Object} [rowInfo]: 行数和高度对应关系 + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 设置指定行的高度 + +- **示例**: + + - 设置第一行高度为50px,第二行高度为60px + + `luckysheet.setRowHeight({0:50,1:60})` + +------------ + +### setColumnWidth(columnInfo [,setting]) + +- **参数**: + + - {Object} [columnInfo]: 列数和宽度对应关系 + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 设置指定列的宽度 + +- **示例**: + + - 设置第一列宽度为50px,第二列宽度为60px + + `luckysheet.setColumnWidth({0:50,1:60})` + +------------ + +### getRowHeight(rowInfo [,setting]) + +- **参数**: + + - {Array} [rowInfo]: 行号下标组成的数组;行号下标从0开始; + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 获取指定工作表指定行的高度,得到行号和高度对应关系的对象(第一行行号为0) + +- **示例**: + + - 第一行高度为50px,第二行高度为60px,获取这些值 + + `luckysheet.getRowHeight([0,1])` + 返回得到 + `{0:50,1:60}` + +------------ + +### getColumnWidth(columnInfo [,setting]) + +- **参数**: + + - {Array} [columnInfo]: 列号下标组成的数组;列号下标从0开始; + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 获取指定工作表指定列的宽度,得到列号和宽度对应关系的对象(第一列列号为0) + +- **示例**: + + - 第一列宽度为50px,第二列宽度为60px,获取这些值 + + `luckysheet.getColumnWidth([0,1])` + 返回得到 + `{0:50,1:60}` + +------------ + +### getDefaultRowHeight([,setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 获取工作表的默认行高 + +- **示例**: + + - 返回工作表的默认行高 + + `luckysheet.getDefaultRowHeight()` + 返回得到 + `19` + +------------ + +### getDefaultColWidth([,setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 获取工作表的默认列宽 + +- **示例**: + + - 返回工作表的默认列宽 + + `luckysheet.getDefaultColWidth()` + 返回得到 + `73` + +------------ + +## 选区操作 + +### getRange() + +- **说明**: + + 返回当前选区对象的数组,可能存在多个选区。每个选区的格式为row/column信息组成的对象`{row:[0,1],column:[0,1]}` + +- **示例**: + + - 当前选区为"A1:B2"和"B4:C5",执行 + + `luckysheet.getRange()` + + 则返回结果为: + ```json + [ + { "row": [0,1], "column": [0,1] }, + { "row": [3,4], "column": [1,2] } + ] + ``` + +------------ + +### getRangeWithFlatten() + +- **说明**: + + 返回表示指定区域内所有单元格位置的数组,区别getRange方法,该方法以cell单元格(而非某块连续的区域)为单位来组织选区的数据。 + +- **示例**: + + - 在表格中选择指定的区域,然后执行 + + `luckysheet.getRange()` + + 则返回结果为: + ```json + [ + {"row":[0,0],"column":[0,2]}, + {"row":[1,1],"column":[0,0]}, + {"row":[3,3],"column":[0,0]} + ] + ``` + 其中,{"row":[0,0],"column":[0,2]} 表示的是一整块连续的区域。 + + - 在表格中选择上面的区域,然后执行 + + `luckysheet.getRangeWithFlatten()` + + 则返回结果为: + ```json + [ + {"r":0,"c":0}, + {"r":0,"c":1}, + {"r":0,"c":2}, + {"r":1,"c":0}, + {"r":3,"c":0} + ] + ``` + +------------ + +### getRangeValuesWithFlatte() + +- **说明**: + + 返回表示指定区域内所有单元格内容的对象数组 + +- **示例**: + + - 在表格中选择指定的区域,然后执行 + + `luckysheet.getRange()` + + 则返回结果为: + ```json + [ + {"row":[0,0],"column":[0,2]}, + {"row":[1,1],"column":[0,0]}, + {"row":[3,3],"column":[0,0]} + ] + ``` + 其中,{"row":[0,0],"column":[0,2]} 表示的是一整块连续的区域。 + + - 在表格中选择上面的区域,然后执行 + + `luckysheet.getRangeValuesWithFlatte()` + + 则返回结果为: + ```json + [ + { + "bg": null, + "bl": 0, + "it": 0, + "ff": 0, + "fs": 11, + "fc": "rgb(51, 51, 51)", + "ht": 1, + "vt": 1, + "v": 1, + "ct": { + "fa": "General", + "t": "n" + }, + "m": "1" + }, + { + "bg": null, + "bl": 0, + "it": 0, + "ff": 0, + "fs": 11, + "fc": "rgb(51, 51, 51)", + "ht": 1, + "vt": 1, + "v": 2, + "ct": { + "fa": "General", + "t": "n" + }, + "m": "2" + }, + { + "bg": null, + "bl": 0, + "it": 0, + "ff": 0, + "fs": 11, + "fc": "rgb(51, 51, 51)", + "ht": 1, + "vt": 1, + "v": 3, + "ct": { + "fa": "General", + "t": "n" + }, + "m": "3" + }, + { + "v": "Background", + "ct": { + "fa": "General", + "t": "g" + }, + "m": "Background", + "bg": null, + "bl": 1, + "it": 0, + "ff": 0, + "fs": 11, + "fc": "rgb(51, 51, 51)", + "ht": 1, + "vt": 1 + }, + { + "v": "Border", + "ct": { + "fa": "General", + "t": "g" + }, + "m": "Border", + "bg": null, + "bl": 1, + "it": 0, + "ff": 0, + "fs": 11, + "fc": "rgb(51, 51, 51)", + "ht": 1, + "vt": 1 + } + ] + ``` +------------ + + +### getRangeAxis() + +- **说明**: + + 返回对应当前选区的坐标字符串数组,可能存在多个选区。每个选区可能是单个单元格(如 A1)或多个单元格组成的矩形区域(如 D9:E12) + +- **示例**: + + - 当前选区为"E10:E14"、"A7:B13"、"C4"、 "A3"和"C6:D9",执行 + + `luckysheet.getRangeAxis()` + + 则返回结果为: + ```json + ["E10:E14", "A7:B13", "C4", "A3", "C6:D9"] + ``` + +------------ + +### getRangeValue([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + +- **说明**: + + 返回指定工作表指定范围的单元格二维数组数据,每个单元格为一个对象。 + + [单元格对象格式参考](/zh/guide/cell.html) + +- **示例**: + + - 当前选区为"A1:B2",执行 + + `luckysheet.getRangeValue()` + + 则返回结果为: + ```json + [ + [ + { + "v": "vaule1", + "ct": { "fa": "General", "t": "g" }, + "m": "vaule1", + "bg": "rgba(255,255,255)", + "bl": 0, + "it": 0, + "ff": 1, + "fs": 11, + "fc": "rgb(51, 51, 51)", + "ht": 1, + "vt": 0 + }, + { + "v": "value3", + "ct": { "fa": "General", "t": "g" }, + "m": "value3", + "bg": "rgba(255,255,255)", + "bl": 0, + "it": 0, + "ff": 1, + "fs": 11, + "fc": "rgb(51, 51, 51)", + "ht": 1, + "vt": 0 + } + ], + [ + { + "v": "vaule2", + "ct": { "fa": "General", "t": "g" }, + "m": "vaule2", + "bg": "rgba(255,255,255)", + "bl": 0, + "it": 0, + "ff": 1, + "fs": 11, + "fc": "rgb(51, 51, 51)", + "ht": 1, + "vt": 0 + }, + { + "v": "value4", + "ct": { "fa": "General", "t": "g" }, + "m": "value4", + "bg": "rgba(255,255,255)", + "bl": 0, + "it": 0, + "ff": 1, + "fs": 11, + "fc": "rgb(51, 51, 51)", + "ht": 1, + "vt": 0 + } + ] + ] + ``` + +------------ + +### getRangeHtml([setting]) + + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,允许多个选区组成的数组;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + +- **说明**: + + 复制指定工作表指定单元格区域的数据,返回包含``html格式的数据,可用于粘贴到excel中保持单元格样式。 + + 特别注意,如果复制多个选区,这几个选区必须有相同的行或者相同的列才能复制,复制出的结果也会自动合并成衔接的数组,比如,多选`"C18:C20"` / `"E18:E20"` / `"G18:H20"`是允许的,但是多选`"C18:C20"` / `"E18:E21"`是不允许的 + +- **示例**: + + - 当前选区为"A1:B2",执行 + + `luckysheet.getRangeHtml()` + + 则返回结果为: + ```html +
+ + + + + + + + + + + + +
+ value1 + + value3 +
+ value2 + + value4 +
+ ``` + +------------ + +### getRangeJson(title [,setting]) + + +- **参数**: + + - {Boolean} [title]: 是否首行为标题 + + `title`可能的值有: + + + `"true"`: 首行为标题 + + `"false"`: 首行不为标题 + - {PlainObject} [setting]: 可选参数 + + {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + +- **说明**: + + 复制指定工作表指定单元格区域的数据,返回`json`格式的数据 + +- **示例**: + + - 当前选区为"A1:B2",首行为标题取得json + + `luckysheet.getRangeJson(true)` + + 则返回结果为: + ```json + [ + { "value1": "value2", "value3": "value4" } + ] + ``` + + - 当前选区为"A1:B2",首行不为标题取得json + + `luckysheet.getRangeJson(false)` + + 则返回结果为: + ```json + [ + { "A": "value1", "B": "value3" }, + { "A": "value2", "B": "value4" } + ] + ``` + +------------ + +### getRangeArray(dimensional [,setting]) + + +- **参数**: + + - {String} [dimensional]: 数组维度 + + `dimensional`可能的值有: + + + `"oneDimensional"`: 一维数组 + + `"twoDimensional"`: 二维数组 + - {PlainObject} [setting]: 可选参数 + + {Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + +- **说明**: + + 复制指定工作表指定单元格区域的数据,返回一维、二维或者自定义行列数的二维数组的数据。 + + 特别注意,只有在`dimensional`设置为`custom`的时候,才需要设置`setting`中的`row`和`column` + +- **示例**: + + - 当前选区为"A1:B2",一维数组 + + `luckysheet.getRangeArray('oneDimensional')` + + 则返回结果为: + ```json + ["value1","value3","value2","value4"] + ``` + + - 当前选区为"A1:B2",二维数组 + + `luckysheet.getRangeArray('twoDimensional')` + + 则返回结果为: + ```json + [ + [ "value1", "value3" ], + [ "value2", "value4" ] + ] + ``` + + - 当前选区为"A1:C5",由 'value1'到'value15'的值组成,得到3 行2列的二维数组数据 + + `luckysheet.getRangeArray('custom', { row: 3, column: 2 })` + + 则返回结果为: + ```json + [ + [ + { + "m": "value1", + "ct": { "fa": "General", "t": "g" }, + "v": "value1" + }, + { + "ct": { "fa": "General", "t": "g" }, + "v": "value6", + "m": "value6" + } + ], + [ + { + "ct": { "fa": "General", "t": "g" }, + "v": "value11", + "m": "value11" + }, + { + "m": "value2", + "ct": { "fa": "General", "t": "g" }, + "v": "value2" + } + ], + [ + { + "ct": { "fa": "General", "t": "g" }, + "v": "value7", + "m": "value7" + }, + { + "ct": { "fa": "General", "t": "g" }, + "v": "value12", + "m": "value12" + } + ] + ] + ``` + +------------ + +### getRangeDiagonal(type [,setting]) + + +- **参数**: + + - {String} [type]: 对角线还是对角线偏移 + + `type`可能的值有: + + + `"normal"`: 对角线 + + `"anti"`: 反对角线 + + `"offset"`: 对角线偏移 + - {PlainObject} [setting]: 可选参数 + - {Number} [column]: `type`为`offset`的时候设置,对角偏移的列数 + + {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + +- **说明**: + + 复制指定工作表指定单元格区域的数据,返回对角线或者对角线偏移`column`列后的数据。 + + 特别注意,只有在`type`设置为`offset`的时候,才需要设置`setting`中的`column`。 + +- **示例**: + + - 当前选区为"A1:B2",对角线 + + `luckysheet.getRangeDiagonal('normal')` + + 则返回结果为: + ```json + [ + { + "m": "value1", + "ct": { "fa": "General", "t": "g" }, + "v": "value1" + }, + { + "m": "value4", + "ct": { "fa": "General", "t": "g" }, + "v": "value4" + } + ] + ``` + + - 当前选区为"A1:B2",反对角线 + + `luckysheet.getRangeDiagonal('anti')` + + 则返回结果为: + ```json + [ + { + "m": "value3", + "ct": { "fa": "General", "t": "g" }, + "v": "value3" + }, + { + "m": "value2", + "ct": { "fa": "General", "t": "g" }, + "v": "value2" + } + ] + ``` + - 当前选区为"A1:B2",对角线偏移1列 + + `luckysheet.getRangeDiagonal('offset', { column: 1 })` + + 则返回结果为: + ```json + [ + { + "m": "value3", + "ct": { "fa": "General", "t": "g" }, + "v": "value3" + } + ] + ``` +------------ + +### getRangeBoolean([setting]) + + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + +- **说明**: + + 复制指定工作表指定单元格区域的数据,返回布尔值的数据 + +- **示例**: + + - 当前选区为"A1:B2" + + `luckysheet.getRangeBoolean()` + + 则返回结果为: + ```json + [ + [ false, false ], + [ false, false ] + ] + ``` + +------------ + +### setRangeShow(range [,setting])
+ + +- **参数**: + + - {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,允许多个选区组成的数组;默认为当前选区 + - {PlainObject} [setting]: 可选参数 + + {Boolean} [show]: 是否显示高亮选中效果;默认值为 `true` + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 指定工作表选中一个或多个选区为选中状态并选择是否高亮,支持多种格式设置。 + + 特别提醒,Luckysheet中涉及到的选区范围设置都可以参考这个设置 + +- **示例**: + + + 设定当前工作表选区范围`A1:B2`: + + `luckysheet.setRangeShow("A1:B2")` + + 设定选区范围`A1:B2`: + + `luckysheet.setRangeShow(["A1:B2"])` + + 设定选区范围`A1:B2`: + + `luckysheet.setRangeShow({row:[0,1],column:[0,1]})` + + 设定选区范围`A1:B2`: + + `luckysheet.setRangeShow([{row:[0,1],column:[0,1]}])` + + 设定选区范围`A1:B2`和`C3:D4`: + + `luckysheet.setRangeShow(["A1:B2","C3:D4"])` + + 设定选区范围`A1:B2`和`D3`: + + `luckysheet.setRangeShow([{row:[0,1],column:[0,1]},{row:[2,2],column:[3,3]}])` + +------------ + +### setRangeValue(data [,setting]) + +- **参数**: + + - {Array} [data]: 要赋值的单元格二维数组数据,每个单元格的值,可以为字符串或数字,或为符合Luckysheet格式的对象,参考 [单元格属性表](/zh/guide/cell.html) + - {PlainObject} [setting]: 可选参数 + + {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Boolean} [isRefresh]: 是否刷新界面;默认为`true`;用于多个单元格赋值时候控制节流,前面单元格赋值的时候应设置为 `false`,最后一个单元格赋值时设置为`true`。 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 将一个单元格数组数据赋值到指定的区域,数据格式同`getRangeValue`方法取到的数据。 + + 注意一点,通常`getRangeValue`方法只是取得选区数据,但是不包含边框和合并单元格信息,当执行`setRangeValue`的时候,会动态判断上一步是否执行过`getRangeValue`,如果执行过,会将边框和合并单元格信息一并从Luckysheet配置中取得。 + +- **示例**: + + + 赋值到当前选区 + + ```js + const data = [ + [ + { + "m": "value1", + "ct": { + "fa": "General", + "t": "g" + }, + "v": "value1" + }, + { + "m": "value3", + "ct": { + "fa": "General", + "t": "g" + }, + "v": "value3" + } + ], + [ + { + "m": "value2", + "ct": { + "fa": "General", + "t": "g" + }, + "v": "value2" + }, + { + "m": "value4", + "ct": { + "fa": "General", + "t": "g" + }, + "v": "value4" + } + ] + ] + luckysheet.setRangeValue(data,{range:"A1:B2"}) + ``` + +------------ + +### setRangeFormat(attr, value [,setting]) + + +- **参数**: + + - {String} [attr]: 属性类型, + 参考 [单元格属性表](/zh/guide/cell.html)的属性值 + - {String | Number | Object} [value]: 具体的设置值,一个属性会对应多个值,参考 [单元格属性表](/zh/guide/cell.html)的值示例,特殊情况:如果属性类型`attr`是单元格格式`ct`,则设置值`value`应提供`ct.fa`,比如设置`"A1:B2"`单元格的格式为百分比格式: + + `luckysheet.setRangeFormat("ct", "0.00%", {range:"A1:B2"})` + + - {PlainObject} [setting]: 可选参数 + + {Object | String} [range]: 设置参数的目标选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,允许多个选区组成的数组;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 设置指定范围的单元格格式,一般用作处理格式,赋值操作推荐使用`setRangeValue`方法 + + 边框设置时,attr为`"bd"`,value为一个key/value对象,需要同时设置边框类型:`borderType`/边框粗细:`style`/边框颜色:`color`/,比如设置`"A1:B2"`单元格的边框为所有/红色/细: + + `luckysheet.setRangeFormat("bd", {borderType: "border-right",style: "1", color: "#ff0000"}, {range:["A1:B2"]})` + + 完整可选的设置参数如下: + + + 边框类型 `borderType:"border-left" | "border-right" | "border-top" | "border-bottom" | "border-all" | "border-outside" | "border-inside" | "border-horizontal" | "border-vertical" | "border-none"`, + + 边框粗细 `style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick` + + 边框颜色 `color: 16进制颜色值` + +- **示例**: + + - 设置当前工作表`"A1:B2"`范围的单元格文本加粗 + + `luckysheet.setRangeFormat("bl", 1, {range:"A1:B2"})` + - 设置第二个工作表的`"B2"`和`"C4:D5"`范围的单元格背景为红色 + + `luckysheet.setRangeFormat("bg", "#ff0000", {range:["B2","C4:D5"], order:1})` + +------------ + +### setRangeFilter(type [,setting]) + + +- **参数**: + + - {String} [type]: 打开还是关闭筛选功能 + + `type`可能的值有: + + + `"open"`: 打开筛选功能,返回当前筛选的范围对象 + + `"close"`: 关闭筛选功能,返回关闭前筛选的范围对象 + - {PlainObject} [setting]: 可选参数 + + {Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 为指定下标的工作表,选定的范围开启或关闭筛选功能 + +- **示例**: + + - 打开第二个工作表"A1:B2"范围的筛选功能 + `luckysheet.setRangeFilter("open",{range:"A1:B2",order:1})` + +------------ + +### setRangeMerge(type [,setting]) + + +- **参数**: + + - {String} [type]: 合并单元格类型 + + `type`可能的值有: + + + `"all"`: 全部合并,区域内所有单元格合并成一个大的单元格 + + `"horizontal"`: 水平合并,区域内在同一行的单元格合并成一个单元格 + + `"vertical"`: 垂直合并,区域内在同一列的单元格合并成一个单元格 + + - {PlainObject} [setting]: 可选参数 + + {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,允许多个选区组成的数组;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 为指定下标的工作表,选定的范围设定合并单元格 + +- **示例**: + + - 当前选区 'A1:B2' 设置为合并单元格,类型为全部合并 + + `luckysheet.setRangeMerge("all")` + 得到 'A1:B1' 的数据为: + ```json + [ + [ + { + "m": "value1", + "ct": { "fa": "General", "t": "g" }, + "v": "value1", + "mc": { "r": 0, "c": 0, "rs": 2, "cs": 2 } + }, + { + "mc": { "r": 0, "c": 0 } + } + ], + [ + { + "mc": { "r": 0, "c": 0 } + }, + { + "mc": { "r": 0, "c": 0 } + } + ] + ] + ``` + +------------ + +### cancelRangeMerge( [setting]) + + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,允许多个选区组成的数组;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 为指定下标的工作表,选定的范围取消合并单元格 + +- **示例**: + + - 当前选区 'A1:B2' 已为合并单元格,现在要取消合并 + + `luckysheet.cancelRangeMerge()` + +------------ + +### setRangeSort(type [,setting]) + + +- **参数**: + + - {String} [type]: 排序类型 + + `type`可能的值有: + + + `"asc"`: 升序 + + `"des"`: 降序 + + - {PlainObject} [setting]: 可选参数 + + + {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 为指定下标的工作表,选定的范围开启排序功能,返回选定范围排序后的数据。 + +- **示例**: + + - 设置当前工作表当前选区为升序 + `luckysheet.setRangeSort("asc")` + +------------ + +### setRangeSortMulti(title, sort [,setting]) + + +- **参数**: + + - {Boolean} [title]: 数据是否具有标题行 + - {Array} [sort]: 列设置,设置需要排序的列索引和排序方式,格式如:`[{ i:0,sort:'asc' },{ i:1,sort:'des' }]` + - {PlainObject} [setting]: 可选参数 + + + {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 为指定下标的工作表,选定的范围开启多列自定义排序功能,返回选定范围排序后的数据。 + +- **示例**: + + - 设置当前工作表当前选区为自定义排序,数据具有标题行,且按第一列升序第二列降序的规则进行排序 + `luckysheet.setRangeSortMulti(true,[{ i:0,sort:'asc' },{ i:1,sort:'des' }])` + +------------ + +### setRangeConditionalFormatDefault(conditionName, conditionValue [,setting]) + +- **参数**: + + - {String} [conditionName]: 条件格式规则类型 + + `conditionName`可能的值有: + + + `"greaterThan"`: 大于(conditionValue值为 数值或单元格范围) + + `"lessThan"`: 小于(conditionValue值为 数值或单元格范围) + + `"betweenness"`: 介于(conditionValue值为 数值或单元格范围) + + `"equal"`: 等于(conditionValue值为 数值或单元格范围) + + `"textContains"`: 文本包含(conditionValue值为 文本或单元格范围) + + `"occurrenceDate"`: 发生日期(conditionValue值为 日期) + + `"duplicateValue"`: 重复值(conditionValue值为 '0':重复值, '1':唯一值) + + `"top10"`: 前 N 项(conditionValue值为 1~1000) + + `"top10%"`: 前 N%(conditionValue值为 1~1000) + + `"last10"`: 后 N 项(conditionValue值为 1~1000) + + `"last10%"`: 后 N%(conditionValue值为 1~1000) + + `"AboveAverage"`: 高于平均值(conditionValue可为空数组) + + `"SubAverage"`: 低于平均值(conditionValue可为空数组) + + - {Array} [conditionValue]: 可以设置条件单元格或者条件值 + 取值规则 (条件值数组最少一个值,最多两个值) + ```js + [2] + ``` + 或者 (若值为单元格范围,则取左上角单元格值) + ```js + ['A1'] + ``` + + - {PlainObject} [setting]: 可选参数 + + + {Object} [format]: 颜色设置 + + * 设置文本颜色和单元格颜色;默认值为` { + "textColor": "#000000", + "cellColor": "#ff0000" + }` + + {Array | Object | String} [cellrange]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,允许多个选区组成的数组;默认为当前选区 + + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 为指定下标的工作表,选定的范围开启条件格式,根据设置的条件格式规则突出显示部分单元格,返回开启条件格式后的数据。 + +- **示例**: + + - 突出显示内容大于数字2的单元格 + `luckysheet.setRangeConditionalFormatDefault("greaterThan",{ type: 'value', content: [2] })` + + - 突出显示内容小于单元格A1内容的单元格 + `luckysheet.setRangeConditionalFormatDefault("lessThan",{ type: 'range', content: ['A1'] })` + + - 突出显示内容介于2和10之间的单元格 + `luckysheet.setRangeConditionalFormatDefault("betweenness",{ type: 'value', content: [2,10] })` + + - 突出显示内容等于单元格A1内容的单元格 + `luckysheet.setRangeConditionalFormatDefault("equal",{ type: 'range', content: ['A1'] })` + + - 突出显示内容包含单元格A1内容的单元格 + `luckysheet.setRangeConditionalFormatDefault("textContains",{ type: 'range', content: ['A1'] })` + + - 突出显示日期在 `2020/09/24 - 2020/10/15` 之间的单元格 + `luckysheet.setRangeConditionalFormatDefault("occurrenceDate",{ type: 'value', content: ['2020/09/24 - 2020/10/15'] })` + + - 突出显示重复值的单元格,content为0 + `luckysheet.setRangeConditionalFormatDefault("duplicateValue",{ type: 'value', content: [0] })` + + - 突出显示唯一值的单元格,content为1 + `luckysheet.setRangeConditionalFormatDefault("duplicateValue",{ type: 'value', content: [1] })` + + - 突出显示排名前20名的单元格 + `luckysheet.setRangeConditionalFormatDefault("top",{ type: 'value', content: [20] })` + + - 突出显示排名前30%的单元格 + `luckysheet.setRangeConditionalFormatDefault("topPercent",{ type: 'value', content: [30] })` + + - 突出显示排名后15名的单元格 + `luckysheet.setRangeConditionalFormatDefault("last",{ type: 'value', content: [15] })` + + - 突出显示排名后15%的单元格 + `luckysheet.setRangeConditionalFormatDefault("lastPercent",{ type: 'value', content: [15] })` + + - 突出显示高于平均值的单元格 + `luckysheet.setRangeConditionalFormatDefault("AboveAverage",{ type: 'value', content: ['AboveAverage'] })` + + - 突出显示低于平均值的单元格 + `luckysheet.setRangeConditionalFormatDefault("SubAverage",{ type: 'value', content: ['SubAverage'] })` + +------------ + +### setRangeConditionalFormat(type [,setting]) + +- **参数**: + + - {String} [type]: 条件格式规则类型 + + `type`可能的值有: + + + `"dataBar"`: 数据条 + + `"icons"`: 图标集 + + `"colorGradation"`: 色阶 + + - {PlainObject} [setting]: 可选参数 + + + {Array | String} [format]: 颜色设置 + + * `type`为`dataBar`时,应设置渐变色;默认值为蓝-白渐变` ["#638ec6", "#ffffff"]` + + 推荐的快捷取值: + ```js + ["#638ec6", "#ffffff"], //蓝-白渐变 数据条 + ["#63c384", "#ffffff"], //绿-白渐变 数据条 + ["#ff555a", "#ffffff"], //红-白渐变 数据条 + ["#ffb628", "#ffffff"], //橙-白渐变 数据条 + ["#008aef", "#ffffff"], //浅蓝-白渐变 数据条 + ["#d6007b", "#ffffff"], //紫-白渐变 数据条 + ["#638ec6"], //蓝色 数据条 + ["#63c384"], //绿色 数据条 + ["#ff555a"], //红色 数据条 + ["#ffb628"], //橙色 数据条 + ["#008aef"], //浅蓝色 数据条 + ["#d6007b"] //紫色 数据条 + ``` + + * `type`为`icons`时,应设置图标类型;默认值为"threeWayArrowMultiColor":三向箭头彩色, + + 可取值为: + + `threeWayArrowMultiColor`:三向箭头(彩色), + + `threeTriangles`:3个三角形, + + `fourWayArrowMultiColor`:四向箭头(彩色), + + `fiveWayArrowMultiColor`:五向箭头(彩色), + + `threeWayArrowGrayColor`:三向箭头(灰色), + + `fourWayArrowGrayColor`:四向箭头(灰色), + + `fiveWayArrowGrayColor`:五向箭头(灰色), + + `threeColorTrafficLightRimless`:三色交通灯(无边框), + + `threeSigns`:三标志, + + `greenRedBlackGradient`:绿-红-黑渐变, + + `threeColorTrafficLightBordered`:三色交通灯(有边框), + + `fourColorTrafficLight`:四色交通灯, + + `threeSymbolsCircled`:三个符号(有圆圈), + + `tricolorFlag`:三色旗, + + `threeSymbolsnoCircle`:三个符号(无圆圈), + + `threeStars`:3个星形, + + `fiveQuadrantDiagram`:五象限图, + + `fiveBoxes`:5个框, + + `grade4`:四等级, + + `grade5`:五等级, + + * `type`为`colorGradation`时,应设置色阶颜色值;默认值为绿-黄-红色阶` ["rgb(99, 190, 123)", "rgb(255, 235, 132)", "rgb(248, 105, 107)"]` + + 推荐的快捷取值: + ```js + ["rgb(99, 190, 123)", "rgb(255, 235, 132)", "rgb(248, 105, 107)"], //绿-黄-红色阶 + ["rgb(248, 105, 107)", "rgb(255, 235, 132)", "rgb(99, 190, 123)"], //红-黄-绿色阶 + + ["rgb(99, 190, 123)", "rgb(252, 252, 255)", "rgb(248, 105, 107)"], //绿-白-红色阶 + ["rgb(248, 105, 107)", "rgb(252, 252, 255)", "rgb(99, 190, 123)"], //红-白-绿色阶 + + ["rgb(90, 138, 198)", "rgb(252, 252, 255)", "rgb(248, 105, 107)"], //蓝-白-红色阶 + ["rgb(248, 105, 107)", "rgb(252, 252, 255)", "rgb(90, 138, 198)"], //红-白-蓝色阶 + + ["rgb(252, 252, 255)", "rgb(248, 105, 107)"], //白-红色阶 + ["rgb(248, 105, 107)", "rgb(252, 252, 255)"], //红-白色阶 + + ["rgb(99, 190, 123)", "rgb(252, 252, 255)"], //绿-白色阶 + ["rgb(252, 252, 255)", "rgb(99, 190, 123)"], //白-绿色阶 + + ["rgb(99, 190, 123)", "rgb(255, 235, 132)"], //绿-黄色阶 + ["rgb(255, 235, 132)", "rgb(99, 190, 123)"] //黄-绿色阶 + ``` + + + {Array | Object | String} [cellrange]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,允许多个选区组成的数组;默认为当前选区 + + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 为指定下标的工作表,选定的范围开启条件格式,返回开启条件格式后的数据。 + +- **示例**: + + - 当前选区范围开启条件格式,显示渐变色 + `luckysheet.setRangeConditionalFormat("dataBar", { format: ["#63c384", "#ffffff"] })` + +------------ + +### deleteRangeConditionalFormat(itemIndex [,setting]) + +- **参数**: + + - {Number} [itemIndex]: 条件格式规则索引 + + - {PlainObject} [setting]: 可选参数 + + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 为指定下标的工作表,删除条件格式规则,返回被删除的条件格式规则。 + +- **示例**: + + - 删除第三个条件格式规则 + `luckysheet.deleteRangeConditionalFormat(2)` + +------------ + +### clearRange([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Array | Object | String} [range]: 要清除的选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,允许多个选区组成的数组;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 清除指定工作表指定单元格区域的内容,不同于删除选区的功能,不需要设定单元格移动情况 + +- **示例**: + + - 清空当前选区内容 + `luckysheet.clearRange()` + +------------ + +### deleteRange(move [,setting]) + +- **参数**: + + - {String} [move]: 删除后,右侧还是下方的单元格移动 + + `move`可能的值有: + + + `"left"`: 右侧单元格左移 + + `"up"`: 下方单元格上移 + + - {PlainObject} [setting]: 可选参数 + + {Object | String} [range]: 要删除的选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 删除指定工作表指定单元格区域,同时,指定是右侧单元格左移还是下方单元格上移 + +- **示例**: + + - 删除当前选区并且在删除后,右侧单元格左移 + `luckysheet.deleteRange('left')` + +------------ + +### insertRange(move [,setting]) + +[todo] + + +- **参数**: + + - {String} [move]: 活动单元格右移或者下移 + + `move`可能的值有: + + + `"right"`: 活动单元格右移 + + `"bottom"`: 活动单元格下移 + + - {PlainObject} [setting]: 可选参数 + + {Array} [data]: 赋值到range区域的单元格二维数组数据,[单元格对象格式参考](/zh/guide/cell.html);默认值为空数组,即插入空白的区域 + + {Array | Object | String} [range]: 要插入的位置,选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,默认为当前选区 + + 当未设置data数据时,允许多个选区组成的数组,插入的空白区域即为这些选区的区域, + + 当设置了data数据,只能为单个选区,并且会把data数据插入到当前选区的第一个单元格位置 + + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 在指定工作表指定单元格区域,赋值单元格数据,或者新建一块空白区域,返回data数据,同时,指定活动单元格右移或者下移 + +- **示例**: + + - 当前选区位置插入空白单元格,并且插入后当前选区单元格右移 + `luckysheet.insertRange('right')` + +------------ + +### matrixOperation(type [,setting]) + +- **参数**: + + - {String} [type]: 矩阵操作的类型 + + `type`可能的值有: + + + `"flipUpDown"`: 上下翻转 + + `"flipLeftRight"`: 左右翻转 + + `"flipClockwise"`: 顺时针旋转 + + `"flipCounterClockwise"`: 逆时针旋转api + + `"transpose"`: 转置 + + `"deleteZeroByRow"`: 按行删除两端0值 + + `"deleteZeroByColumn"`: 按列删除两端0值 + + `"removeDuplicateByRow"`: 按行删除重复值 + + `"removeDuplicateByColumn"`: 按列删除重复值 + + `"newMatrix"`: 生产新矩阵 + - {PlainObject} [setting]: 可选参数 + + {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 指定工作表指定单元格区域的数据进行矩阵操作,返回操作成功后的结果数据 + +- **示例**: + + - 当前选区上下翻转 + + `luckysheet.matrixOperation('flipUpDown')` + + 原来的选区复制为二维数组: + + `[["value1","value3"],["value2","value4"]]` + + 上下翻转后选区复制为二维数组: + + `[["value2","value4"],["value1","value3"]]` + +------------ + +### matrixCalculation(type, number [,setting]) + +- **参数**: + - {String} [type]: 计算方式 + + `type`可能的值有: + + + `"plus"`: 加 + + `"minus"`: 减 + + `"multiply"`: 乘 + + `"divided"`: 除 + + `"power"`: 次方 + + `"root"`: 次方根 + + `"log"`: log + - {Number} [number]: 计算数值,如: 2 + - {PlainObject} [setting]: 可选参数 + + {Array | Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 指定工作表指定单元格区域的数据进行矩阵计算,返回计算成功后的结果数据 + +- **示例**: + + - 当前选区所有单元格值加2 + + `luckysheet.matrixCalculation('plus', 2)` + + 原来的选区复制为二维数组: + + `[[1,2],[3,4]]` + + 加2后选区复制为二维数组: + + `[[3,4],[5,6]]` + +------------ + +## 工作表操作 + +### getAllSheets() + +- **说明**: + + 返回所有工作表配置,格式同工作表配置,得到的结果可用于表格初始化时作为options.data使用。 + + 所以此API适用于,手动操作配置完一个表格后,将所有工作表信息取出来自行保存,再用于其他地方的表格创建。如果想得到包括工作簿配置在内的所有工作簿数据,推荐使用 [toJson](#toJson()),并且可以直接用于初始化Luckysheet。 + +- **示例**: + + - 取得第一个工作表的所有基本信息 + `luckysheet.getAllSheets()[0]` + +------------ + +### getLuckysheetfile() + +- **说明**: + + 返回所有表格数据结构的一维数组`luckysheetfile`,不同于`getAllSheets`方法,此方法得到的工作表参数会包含很多内部使用变量,最明显的区别是表格数据操作会维护`luckysheetfile[i].data`,而初始化数据采用的是`options.data[i].celldata`,所以`luckysheetfile`可用于调试使用,但是不适用初始化表格。 + + 除此之外,加载过的工作表参数中会增加一个`load = 1`,这个参数在初始化数据的时候需要置为0才行。所以,将`getLuckysheetfile()`得到的数据拿来初始化工作簿,需要做两个工作: + + - celldata转为data,参考:[transToData](/zh/guide/api.html#transtodata-celldata-setting) + - load重置为0或者删除此字段 + + 现在已有`getAllSheets`来完成这个工作,无需再手动转化数据。 + +- **示例**: + + - 取得第一个工作表的所有调试信息 + `luckysheet.getLuckysheetfile()[0]` + +------------ + +### getSheet([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Number} [index]: 工作表索引;默认值为当前工作表索引 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Number} [name]: 工作表名称;默认值为当前工作表名称 + +- **说明**: + + 根据index/order/name,快捷返回指定工作表的配置,同 `luckysheetfile[i]`。如果设置多个参数,优先级为:index > order > name。 + +------------ + +### getSheetData([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + +- **说明**: + + 快捷返回指定工作表的数据,同 `luckysheetfile[i].data` + +------------ + +### getConfig([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + +- **说明**: + + 快捷返回指定工作表的config配置,同 `luckysheetfile[i].config` + +------------ + +### setConfig(cfg, [setting]) + +- **参数**: + - {Object} [cfg]: config配置 + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 快捷设置指定工作表config配置 + +------------ +### updataSheet([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Array} [data]: 需要更新的工作表配置,参考create这个API的option.data + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 根据所传的工作表配置,更新相应的工作表 + + +------------ +### setSheetAdd([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Object} [sheetObject]: 新增的工作表的数据;默认值为空对象,工作表数据格式参考[options.data](/zh/guide/sheet.html#初始化配置) + + {Number} [order]: 新增的工作表下标;默认值为最后一个下标位置 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 新增一个sheet,返回新增的工作表对象,`setting`中可选设置数据为 `sheetObject`,不传`sheetObject`则会新增一个空白的工作表。 + +- **示例**: + + - 在最后一个工作表下标位置新增一个空白的工作表 + `luckysheet.setSheetAdd()` + +------------ + +### setSheetDelete([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 删除指定下标的工作表,返回已删除的工作表对象 + +- **示例**: + + - 删除当前工作表 + `luckysheet.setSheetDelete()` + +------------ + +### setSheetCopy([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Number} [targetOrder]: 新复制的工作表目标下标位置;默认值为当前工作表下标的下一个下标位置(递增) + + {Number} [order]: 被复制的工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 复制指定下标的工作表到指定下标位置,在`setting`中可选设置指定下标位置`targetOrder`,返回新复制的工作表对象 + +- **示例**: + + - 复制当前工作表到下一个下标位置 + `luckysheet.setSheetCopy()` + +------------ + +### setSheetHide([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 被隐藏的工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 隐藏指定下标的工作表,返回被隐藏的工作表对象 + +- **示例**: + + - 隐藏当前工作表 + `luckysheet.setSheetHide()` + - 隐藏第三个工作表 + `luckysheet.setSheetHide({order:2})` + +------------ + +### setSheetShow([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 被取消隐藏的工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 取消隐藏指定下标的工作表,返回被取消隐藏的工作表对象 + +- **示例**: + + - 取消隐藏第三个工作表 + `luckysheet.setSheetShow({order:2})` + +------------ + +### setSheetActive(order [,setting]) + +- **参数**: + + - {Number} [order]: 要激活的工作表下标 + - {PlainObject} [setting]: 可选参数 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 设置指定下标的工作表为当前工作表(激活态),即切换到指定的工作表,返回被激活的工作表对象 + +- **示例**: + + - 切换到第二个工作表 + `luckysheet.setSheetActive(1)` + +------------ + +### setSheetName(name [,setting]) + +- **参数**: + + - {String} [name]: 新的工作表名称 + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 修改工作表名称 + +- **示例**: + + - 修改当前工作表名称为"CellSheet" + `luckysheet.setSheetName("CellSheet")` + +------------ + +### setSheetColor(color [,setting]) + +- **参数**: + + - {String} [color]: 工作表颜色 + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 设置工作表名称处的颜色 + +- **示例**: + + - 修改当前工作表名称处的颜色为红色 + `luckysheet.setSheetColor("#ff0000")` + +------------ + +### setSheetMove(type [,setting]) + +- **参数**: + + - {String | Number} [type]: 工作表移动方向或者移动的目标下标, + + `type`可能的值有: + + + `"left"`: 向左 + + `"right"`: 向右 + + `1`/`2`/`3`/...: 指定下标 + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 指定工作表向左边或右边移动一个位置,或者指定下标,返回指定的工作表对象 + +- **示例**: + + - 当前工作表向左移动一个位置 + `luckysheet.setSheetMove("left")` + - 第二个工作表移动到第四个工作表的下标位置 + `luckysheet.setSheetMove(3,{order:1})` + +------------ + +### setSheetOrder(orderList [,setting]) + +- **参数**: + + - {Array} [orderList]: 工作表顺序,设置工作表的index和order来指定位置,如: + + ```json + [ + {index:'sheet_01',order: 2}, + {index:'sheet_02',order: 1}, + {index:'sheet_03',order: 0}, + ] + ``` + 数组中顺序并不重要,关键是指定sheet index和order的对应关系。 + + - {PlainObject} [setting]: 可选参数 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 重新排序所有工作表的位置,指定工作表顺序的数组。 + + +- **示例**: + + - 重排工作表,此工作簿含有3个工作表 + ```js + luckysheet.setSheetOrder([ + {index:'sheet_01',order: 2}, + {index:'sheet_02',order: 1}, + {index:'sheet_03',order: 0}, + ]) + ``` + +------------ + +### setSheetZoom(zoom [,setting]) + +- **参数**: + + - {Number} [zoom]: 工作表缩放比例,值范围为0.1 ~ 4; + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 设置工作表缩放比例 + + +- **示例**: + + - 设置当前工作表缩放比例为0.5 + ```js + luckysheet.setSheetZoom(0.5) + ``` + +------------ + +### showGridLines([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 需要显示网格线的工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 显示指定下标工作表的网格线,返回操作的工作表对象 + +- **示例**: + + - 显示当前工作表的网格线 + `luckysheet.showGridLines()` + - 显示第三个工作表的网格线 + `luckysheet.showGridLines({order:2})` + +------------ + +### hideGridLines([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 需要隐藏网格线的工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 隐藏指定下标工作表的网格线,返回操作的工作表对象 + +- **示例**: + + - 隐藏当前工作表的网格线 + `luckysheet.hideGridLines()` + - 隐藏第三个工作表的网格线 + `luckysheet.hideGridLines({order:2})` + +------------ + +## 工作簿操作 + +### create(options) + +- **参数**: + + - {Object} [options]:表格的所有配置信息 + +- **说明**: + + 初始化一个Luckysheet,可包含多个工作表,参考 [配置列表](/zh/guide/config.html) + +------------ + +### refresh([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Function} [success]: 表格刷新成功后的回调函数 + +- **说明**: + + 刷新canvas + +------------ + +### scroll([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Number} [scrollLeft]:横向滚动值。默认为当前横向滚动位置。 + + {Number} [scrollTop]:纵向滚动值。默认为当前纵向滚动位置。 + + {Number} [targetRow]:纵向滚动到指定的行号。默认为当前纵向滚动位置。 + + {Number} [targetColumn]:横向滚动到指定的列号。默认为当前横向滚动位置。 + + {Function} [success]: 表格刷新成功后的回调函数 + +- **说明**: + + 滚动当前工作表位置 + +------------ + +### resize([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 根据窗口大小自动resize画布 + +------------ + +### destroy([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Function} [success]: 表格释放成功后的回调函数 + +- **说明**: + + 删除并释放表格 + +------------ + +### getScreenshot([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Object | String} [range]: 选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 + +- **说明**: + + 返回当前表格指定选区截图后生成的base64格式的图片 + +------------ + +### setWorkbookName(name [,setting]) + +- **参数**: + + - {String} [name]: 工作簿名称 + - {PlainObject} [setting]: 可选参数 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 设置工作簿名称 + +------------ + +### getWorkbookName([,setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 获取工作簿名称 + +------------ + +### undo([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 撤销当前操作,返回刚刚撤销的操作对象 + +------------ + +### redo([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 重做当前操作,返回刚刚重做的操作对象 + +------------ + +### refreshFormula([success]) + +- **参数**: + + - {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 强制刷新公式。当你直接修改了多个单元格的值,且没有触发刷新,且这些单元格跟公式相关联,则可以使用这个api最后强制触发一次公式刷新。 + +------------ + +### pagerInit([setting]) + +- **参数**: + + - {PlainObject} [setting]: 参数配置 + + {Number} [pageIndex]: 当前的页码(必填)。 + + {Number} [pageSize]: 每页显示多少条数据(必填)。 + + {Number} [total]: 总条数(必填)。 + + {Boolean} [showTotal]: 是否显示总数,默认关闭:false。 + + {Boolean} [showSkip]: 是否显示跳页,默认关闭:false。 + + {Boolean} [showPN]: 是否显示上下翻页,默认开启:true。 + + {Array} [selectOption]: 选择分页的条数。 + + {String} [prevPage]: 上翻页文字描述,默认"上一页"。 + + {String} [nextPage]: 下翻页文字描述,默认"下一页"。 + + {String} [totalTxt]: 数据总条数文字描述,默认"总共:{total}"。 + + + +- **说明**: + + 初始化分页器。ps:create阶段,可以直接配置options.pager参数,渲染阶段会将options.pager作为参数来初始化分页器,可通过钩子函数onTogglePager来监听页码的切换 + +### refreshMenuButtonFocus([data],[r],[c],[success]) + +- **参数**: + + - {Array} [data]: 操作数据 + - {Number} [r]: 指定的行 + - {Number} [c]: 指定的列 + - {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 刷新指定单元格的顶部状态栏状态。 + +------------ + +### checkTheStatusOfTheSelectedCells(type,status) + +- **参数**: + + - {String} type: 类型 + - {String} status: 目标状态值 + +- **说明**: + + 检查选区内所有cell指定类型的状态是否满足条件(主要是粗体、斜体、删除线和下划线等等)。 + +------------ + +## 图表 + +### insertChart([setting]) + +[todo] + + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Array | Object | String} [range]: 图表数据的选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 指定工作表指定选区范围生成一个图表,返回图表参数对象,包含图表唯一标识符chart id + +------------ + +### setChart(chartId, attr, value [,setting]) + +[todo] + + +- **参数**: + + - {String} [chartId]: 指定要修改的图表id + - {String} [attr]: 属性类型 + + `attr`可能的值有: + + + `"left"`: 左边到工作表边缘的距离 + + `"top"`: 上边到工作表边缘的距离 + + `"width"`: 图表外框的宽度 + + `"height"`: 图表外框的高度 + + `"chartOptions"`: 图表的详细设置项 + + - {Number | Object}} [value]: 属性值,当`attr`为`chartOptions`时,直接设置整个chart的配置对象 + + - {PlainObject} [setting]: 可选参数 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 修改指定id图表的参数,返回修改后的整个图表参数 + +------------ + +### getChart(chartId) + +[todo] + + +- **参数**: + + - {String} [chartId]: 指定要获取的图表id + +- **说明**: + + 获取指定id图表的参数 + +------------ + +### deleteChart(chartId [,setting]) + +[todo] + + +- **参数**: + + - {String} [chartId]: 要删除的图表id + + - {PlainObject} [setting]: 可选参数 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 删除指定id图表,返回被删除的图表的参数 + +------------ + +## 数据验证 + +### setDataVerification(optionItem, [setting]) + +- **参数**: + + - {Object} [optionItem]: 数据验证的配置信息,具体详细的配置信息参考[dataVerification](/zh/guide/sheet.html#dataVerification) + + - {PlainObject} [setting]: 可选参数 + + {Object | String} [range]: 数据验证的选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 指定工作表范围设置数据验证功能,并设置参数 + +------------ + +### deleteDataVerification([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Object | String} [range]: 数据验证的选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 指定工作表范围删除数据验证功能 + +------------ + +## 图片 + +### insertImage(src, [setting]) + +- **参数**: + + - {String} [src]: 图片src + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Number} [rowIndex]: 要插入图片的单元格行下标;默认为当前选区聚焦单元格行下标 || 0 + + {Number} [colIndex]: 要插入图片的单元格列下标;默认为当前选区聚焦单元格列下标 || 0 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 在指定的工作表中指定单元格位置插入图片 + +### deleteImage([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {String | Array} [idList]: 要删除图片的id集合,也可为字符串`"all"`,all为所有的字符串;默认为`"all"` + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 删除指定工作表中的图片 + +### getImageOption([setting]) + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 获取指定工作表的图片配置 + +## 工作表保护 + + +### setProtection(option, [setting]) + +[todo] + +- **参数**: + + - {Object} [option]: 工作表保护的配置信息 + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 指定工作表设置工作表保护功能 + +------------ + +## 工具方法 + +### transToCellData(data [,setting])
+ +- **参数**: + + - {Array} [data]: data数据 + + - {PlainObject} [setting]: 可选参数 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + data => celldata ,data二维数组数据转化成 {r, c, v}格式一维数组 + +------------ + +### transToData(celldata [,setting])
+ +- **参数**: + + - {Array} [celldata]: data数据 + + - {PlainObject} [setting]: 可选参数 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + celldata => data ,celldata一维数组数据转化成表格所需二维数组 + +------------ + +### toJson() + + +- **说明**: + + 导出的json字符串可以直接当作`luckysheet.create(options)`初始化工作簿时的参数`options`使用,使用场景在用户自己操作表格后想要手动保存全部的参数,再去别处初始化这个表格使用,类似一个luckysheet专有格式的导入导出。 + +------------ + +### changLang([lang]) + +- **参数**: + + + {String} [lang]: 语言类型;暂支持`"zh"`、`"en"`、`"es"`;默认为`"zh"`; + +- **说明**: + + 传入目标语言,切换到对应的语言界面 + +### closeWebsocket() + +- **说明**: + + 关闭websocket连接 + +### openSearchDialog() + +- **说明**: + + 打开搜索/替换弹窗 + +### getRangeByTxt([txt]) + +- **说明**: + + 将字符串格式的工作表范围转换为数组形式 + +- **参数**: + + + {String} [txt]: 选区范围,支持选区的格式为`"A1:B2"`或者指定工作表名称的写法`"sheetName!A1:B2"`,只支持单个选区;默认为当前最后一个选区 + +- **示例**: + + - 当前选区为`A1:B2`,`luckysheet.getRangeByTxt()`返回:`{column: (2) [0, 1],row: (2) [0, 1]}` + - `luckysheet.getRangeByTxt("A1:B2")`返回:`{column: (2) [0, 1],row: (2) [0, 1]}` + - `luckysheet.getRangeByTxt("Cell!A1:B2")`返回:`{column: (2) [0, 1],row: (2) [0, 1]}` + +------------ + +### getTxtByRange([range]) + +- **说明**: + + 将数组格式的工作表范围转换为字符串格式的形式 + +- **参数**: + + + {Array | Object} [range]: 选区范围,支持选区的格式为`{row:[0,1],column:[0,1]}`,允许多个选区组成的数组;默认为当前选区 + +- **示例**: + + - 当前选区为`A1:B3`,`luckysheet.getTxtByRange()`返回:当前选区`"A1:B3"` + - `luckysheet.getTxtByRange({column:[0,1],row:[0,2]})`返回:`"A1:B3"` + - `luckysheet.getTxtByRange([{column:[0,1],row:[0,2]}])`返回:`"A1:B3"` + - `luckysheet.getTxtByRange([{column:[0,1],row:[0,2]},{column:[1,1],row:[1,2]}])`返回:`"A1:B3,B2:B3"` + +------------ + + +## 旧版API + +::: warning +为保持兼容性,仍然支持旧版API,但是已不推荐使用。 +::: + +### getcellvalue([r] [,c] [,data] [,type]) + +- **参数**: + + - {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列单元格的原始值。 + + 特殊情况:单元格格式为yyyy-MM-dd,type为'v'时会强制取'm'显示值 + + > 推荐使用新API: getCellValue + +------------ + +### getluckysheetfile() + +- **说明**: + + 返回所有表格数据结构的一维数组`luckysheetfile` + + > 推荐使用新API: [getLuckysheetfile](#getLuckysheetfile()) + +------------ + +### getconfig() + +- **说明**: + + 快捷返回当前表格config配置,每个工作表的config信息仍然包含在luckysheetfile。 + + > 推荐使用新API: [getConfig](#getConfig([setting])) + +------------ + +### getluckysheet_select_save() + +- **说明**: + + 返回当前选区对象的数组,可能存在多个选区。 + + > 推荐使用新API: [getRange](#getRange()) + +------------ + +### getdatabyselection([range] [,sheetOrder]) + +- **参数**: + + - {Object} [range]:选区对象,`object: { row: [r1, r2], column: [c1, c2] }`;默认为当前第一个选区。 + - {Number} [sheetOrder]:表格下标,从0开始的整数,0表示第一个表格;默认为当前表格下标。 + +- **说明**: + + 返回某个表格第一个选区的数据。 + - `luckysheet.getdatabyselection()`: 返回当前工作表当前选区的数据 + - `luckysheet.getdatabyselection(null,1)`: 返回第2个工作表的当前选区的数据 + + > 推荐使用新API: [getRangeValue](#getRangeValue([setting])) + +------------ + +### luckysheetrefreshgrid(scrollWidth, scrollHeight) + +- **参数**: + + - {Number} [scrollWidth]:横向滚动值。默认为当前横向滚动位置。 + - {Number} [scrollHeight]:纵向滚动值。默认为当前纵向滚动位置。 + +- **说明**: + + 按照scrollWidth, scrollHeight刷新canvas展示数据。 + + > 推荐使用新API: [scroll](/zh/guide/api.html#scroll-setting) +------------ + +### setcellvalue(r, c, d, v) + +- **参数**: + + - {Number} [r]:单元格所在行数;从0开始的整数,0表示第一行。 + - {Number} [c]:单元格所在列数;从0开始的整数,0表示第一列。 + - {Array} [d]:表数据;可选值;二维数组。 + - {Object | String | Number} [v]:要设置的值;可为对象,对象是是要符合单元格对象格式。 + +- **说明**: + + 设置某个单元格的值。可配合`luckysheet.jfrefreshgrid()`刷新查看单元格值改变。 + + ```js + luckysheet.setcellvalue(0, 0, luckysheet.flowdata(), 'abc'); + luckysheet.jfrefreshgrid(); + ``` + +------------ + +### jfrefreshgrid() + +- **说明**: + + 刷新canvas + + > 推荐使用新API: [refresh](#refresh([setting])) + +------------ + +### setluckysheet_select_save(v) + +- **参数**: + + - {Array} [v]:要设置的选区值(数组)。符合选区格式规则,如`[{ row: [r1, r2], column: [c1, c2] }]`。 + +- **说明**: + + 设置当前表格选区的值。配合`luckysheet.selectHightlightShow()`可在界面查看选区改变。 + ```js + luckysheet.setluckysheet_select_save([{ row: [0, 1], column: [0, 1] }]); + luckysheet.selectHightlightShow(); + ``` + + > 推荐使用新API:setRangeShow + +------------ + +### selectHightlightShow() + +- **说明**: + + 高亮当前选区 + + > 推荐使用新API:setRangeShow + +------------ + +### flowdata() + +- **说明**: + + 快捷获取当前表格的数据 + + > 推荐使用新API:[getSheetData](#getSheetData()) + +------------ + +### buildGridData(file) + +- **参数**: + + - {Object} [file]:[luckysheetfile](/zh/guide/sheet.html) + +- **说明**: + + 生成表格可以识别的二维数组 + + > 推荐使用新API:transToData + +------------ + +### getGridData(data) + +- **参数**: + + - {Array} [data]:工作表的二维数组数据 + +- **说明**: + + 二维数组数据转化成 `{r, c, v}` 格式 一维数组 + + > 推荐使用新API:transToCellData diff --git a/docs/zh/guide/cell.md b/docs/zh/guide/cell.md index 78bd3a172..93bec5148 100644 --- a/docs/zh/guide/cell.md +++ b/docs/zh/guide/cell.md @@ -1,614 +1,614 @@ -# 单元格 - -## 基本单元格 - -单元格是Luckysheet中最基本的单位,每个单元格都会保存为一个对象,一个工作表的数据则会保存为一个由单元格对象组成的二维数组,并存入当前工作表的 `luckysheetfile[i].data`中。 - -单元格对象包含以下单元格属性 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
属性值全称
说明
值示例Aspose方法或者属性
ctcelltype单元格值格式:文本、时间等{ - "fa": "General", - "t": "g" - }单元格值格式
bgbackground背景颜色#fff000setBackgroundColor
fffontfamily字体0 Times New Roman、 1 Arial、2 Tahoma 、3 Verdana、4 微软雅黑、5 宋体(Song)、6 黑体(ST Heiti)、7 楷体(ST Kaiti)、 8 仿宋(ST FangSong)、9 新宋体(ST Song)、10 华文新魏、11 华文行楷、12 华文隶书Style.Font object's Name property.
fcfontcolor字体颜色#fff000Style.Font object's Color property
blbold粗体0 常规 、 1加粗Style.Font object's IsBold property to true.
ititalic斜体0 常规 、 1 斜体
fsfontsize字体大小14Style.Font object's Size property.
clcancelline删除线0 常规 、 1 删除线Style.Font object's Underline property
ununderline下划线0 无 、 1 有
vtverticaltype垂直对齐0 中间、1 上、2下setVerticalAlignment
hthorizontaltype水平对齐0 居中、1 左、2右setHorizontalAlignment
mcmergecell合并单元格主单元格{ r:0, c:0, rs: 2, cs:2 },辅单元格{ r:0, c:0 },合并单元格案例Merge
trtextrotate竖排文字3setRotationAngle
rtrotatetext文字旋转角度介于0~180之间的整数,包含0和180setRotationAngle
tbtextbeak文本换行0 截断、1溢出、2 自动换行2:setTextWrapped
0和1:IsTextWrapped = true
vvalue原始值
mmonitor显示值
ffunction公式setFormula
setArrayFormula
workbook.calculateFormula();
pscomment批注 - - {
- height: 140,//批注框高度
- width: 73,//批注框宽度
- left: 75,//批注框距离左边工作表边缘位置
- top: 22,//批注框距离上边工作表边缘位置
- isshow: true,//是否显示批注
- value: "jhbk"//批注内容
- } -
-
- -一个规范的单元格对象如下: - -```json -{ - "ct": { //单元格值格式 - "fa": "General", //格式名称为自动格式 - "t": "n" //格式类型为数字类型 - }, - "v": 233, //内容的原始值为 233 - "m": 233, //内容的显示值为 233 - "bg": "#f6b26b", //背景为 "#f6b26b" - "ff": 1, // 字体为 "Arial" - "fc": "#990000", //字体颜色为 "#990000" - "bl": 1, //字体加粗 - "it": 1, //字体斜体 - "fs": 9, //字体大小为 9px - "cl": 1, //启用删除线 - "ht": 0, //水平居中 - "vt": 0, //垂直居中 - "tr": 2, //文字旋转 -45° - "tb": 2, //文本自动换行 - "ps": { //批注 - "left": 92, //批注框左边距 - "top": 10, //批注框上边距 - "width": 91, //批注框宽度 - "height": 48, //批注框高度 - "value": "I am a comment", //批准内容 - "isshow": true //批注框为显示状态 - }, - "f": "=SUM(233)" //单元格是一个求和公式 -} -``` - -### 为什么会有原始值 `v` 和显示值 `m` 的区分? - -Luckysheet在存储数字类型的内容时,支持多种格式转换,所以需要保留原始值来做更多处理,比如同样一个数字`1`,设置成百分比格式就是`"100%"`,设置成两位小数数字就是`"1.00"`, - -还有一个原因是日期和时间格式的内容原始值会存储为一个数字,默认情况下,Luckysheet把`1900-1-1 0:00:00`存储为`1`,把`1900-1-1 0:00:00`以后的每一个时刻存储为该时刻与`1900-1-1 0:00:00`这个时刻的差值(以天为单位)。比如`44127`就表示`2020-10-23`这一天。 - -以下是特殊格式的例子: - -百分比 `100%` -```json -{ - "ct": { - "fa": "0%", - "t": "n" - }, - "v": 1, - "m": "100%" -} -``` - -小数 `1.00` -```json -{ - "ct": { - "fa": "##0.00", - "t": "n" - }, - "v": 1, - "m": "1.00" -} -``` - -日期 `2020-10-23` -```json -{ - "ct": { - "fa": "yyyy-MM-dd", - "t": "d" - }, - "v": 44127, - "m": "2020-10-23" -} -``` - -## 合并单元格
- -设置一个合并单元格,需要处理两个地方,一是单元格对象中设置`mc`属性,二是在`config`中设置`merge`。 - -比如,将"A1:B2"单元格合并为一个单元格 - -- 第一步:先设置四个单元格的参数 - ```json - [ - [{ - "m": "merge cell", - "ct": { - "fa": "General", - "t": "g" - }, - "v": "merge cell", - "mc": { //合并单元格必备属性 - "r": 0, //主单元格的行号 - "c": 0, //主单元格的列号 - "rs": 2, //合并单元格占的行数 - "cs": 2 //合并单元格占的列数 - } - }, { - "mc": { - "r": 0, //主单元格的行号 - "c": 0, //主单元格的列号 - } - }], - [{ - "mc": { - "r": 0, //主单元格的行号 - "c": 0, //主单元格的列号 - } - }, { - "mc": { - "r": 0, //主单元格的行号 - "c": 0, //主单元格的列号 - } - }] - ] - ``` - - 合并单元格的关键属性是`mc`,主单元格是选区范围中左上角的单元格,包含4个属性 r/c/rs/cs ,分别表示 row/column/rowspan/columnspan,在这里,就表示从主单元格A1(row 0 column 0)开始到右边2行下方2列的单元格进行合并,选区范围中的其他单元格则只需要设置主单元格位置即可。 - -- 第二步:再设置`config.merge` - ```json - { - "0_0": { - "r": 0, - "c": 0, - "rs": 2, - "cs": 2 - } - } - ``` - 对象中的key为 `r + '_' + c` 的拼接值,value同主单元格的`mc`设置: r:行数,c:列数,rs:合并的行数,cs:合并的列数 - -> merge 详细参考:[表格数据config](/zh/guide/data.html#config) - -## 含边框单元格 - -单元格的边框设置与合并单元格类似,需要在`config`中设置`borderInfo`,区别在于不需要设置单元格对象。 -加入 - -比如,将"A1"单元格设置一个黑色细实线的全部边框 - -设置`config.borderInfo`为 -```json -{ - "rangeType": "range", - "borderType": "border-all", - "color": "#000", - "style": "1", - "range": [ - { - "row": [ 0, 0 ], - "column": [0, 0] - } - ] -} -``` -而其单元格对象不需要增加设置,如下只是基础的内容和格式设置 -```json -[ - [ - { - "m": "borderCell", - "ct": { - "fa": "General", - "t": "g" - }, - "v": "borderCell" - } - ] -] -``` - -> borderInfo 详细参考:[config.borderInfo](/zh/guide/sheet.html#config-borderinfo) - -## 简化的单元格数据 - -特别强调的是,表格初始化的时候,采用的是`r/c/v`对象组成的一维数组格式,其中`v`的值一般是设置为单元格对象。为了节约后台的存储空间,`v`的值支持简写格式,直接写为一个字符串即可,渲染进Luckysheet后自动识别为自动格式即,`"ct": { "fa": "General", "t": "n" }` - -以下为初始化3个单元格信息,第三个单元格即为简写格式: - -```json -[ - { - "r": 0, - "c": 0, - "v": { - "f": "=MAX(A7:A9)", - "ct": { - "fa": "General", - "t": "n" - }, - "v": 100, - "m": "100" - } - }, - { - "r": 0, - "c": 1, - "v": { - "f": "=SUM(A2)", - "bg": "#fff000", - "v": 12, - "m": "12" - } - }, - { - "r": 0, - "c": 2, - "v": "value 2" - } -] -``` -> 了解 [celldata的使用](/zh/guide/data.html#celldata) - -## 单元格值格式
- -值格式即为单元格对象中 `ct` 的设置, - -如下为自动格式的单元格 - -```json -{ - "ct": { - "fa": "General", - "t": "g" - }, - "m": "2424", - "v": 2424 -} -``` - -|参数|说明|值| -| ------------ | ------------ | ------------ | -|fa|Format格式的定义串| 如"General"| -|t|Type类型|如"g"| - - -### 可选择的设置如下 - -| 格式 | ct.fa | ct.t | m 值示例 |备注 | -|----------|----------|-------------------------|------------------------- |------------------------- | -| 自动 | General | g/n | Luckysheet |自动格式,也是默认的格式;单元格内容为数字时,`m`的值为`'n'`| -| 纯文本 | @ | s | Luckysheet || -|


**数字格式** | | | | | -| 整数 | 0 | n | 1235 | 0位小数 || -| 数字一位小数 | 0.0 | n | 1234.6 | 点后面0的个数就代表小数位数,如果原始数字位数大,设置位数小时会做四舍五入 | -| 数字两位小数 | 0.00 | n | 1234.56 || -| 百分比整数 | 0% | n | 123456% |也支持 #0% 的用法| -| 百分比 | 0.00% | n | 123456.00% |也支持 #0.00% 的用法,点后面0的个数就代表小数位数| -| 科学计数 | 0.00E+00 | n | 1.23E+03 || -| 科学计数 | ##0.0E+0 | n | 1.2E+3 || -| 分数 | # ?/? | n | 1234 5/9 || -| 分数 | # ??/?? | n | 1234 14/25 || -| 万元 | w | n |12万3456|| -| 万元2位小数 | w0.00 | n |12万3456.00|| -| 会计 | ¥(0.00) | n || -| 更多数字格式 | #,##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 || - -以上配置参考了[Aspose.Cells](https://docs.aspose.com/display/cellsnet/List+of+Supported+Number+Formats#ListofSupportedNumberFormats-Aspose.Cells) \ No newline at end of file +# 单元格 + +## 基本单元格 + +单元格是Luckysheet中最基本的单位,每个单元格都会保存为一个对象,一个工作表的数据则会保存为一个由单元格对象组成的二维数组,并存入当前工作表的 `luckysheetfile[i].data`中。 + +单元格对象包含以下单元格属性 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
属性值全称
说明
值示例Aspose方法或者属性
ctcelltype单元格值格式:文本、时间等{ + "fa": "General", + "t": "g" + }单元格值格式
bgbackground背景颜色#fff000setBackgroundColor
fffontfamily字体0 Times New Roman、 1 Arial、2 Tahoma 、3 Verdana、4 微软雅黑、5 宋体(Song)、6 黑体(ST Heiti)、7 楷体(ST Kaiti)、 8 仿宋(ST FangSong)、9 新宋体(ST Song)、10 华文新魏、11 华文行楷、12 华文隶书Style.Font object's Name property.
fcfontcolor字体颜色#fff000Style.Font object's Color property
blbold粗体0 常规 、 1加粗Style.Font object's IsBold property to true.
ititalic斜体0 常规 、 1 斜体
fsfontsize字体大小14Style.Font object's Size property.
clcancelline删除线0 常规 、 1 删除线Style.Font object's Underline property
ununderline下划线0 无 、 1 有
vtverticaltype垂直对齐0 中间、1 上、2下setVerticalAlignment
hthorizontaltype水平对齐0 居中、1 左、2右setHorizontalAlignment
mcmergecell合并单元格主单元格{ r:0, c:0, rs: 2, cs:2 },辅单元格{ r:0, c:0 },合并单元格案例Merge
trtextrotate竖排文字3setRotationAngle
rtrotatetext文字旋转角度介于0~180之间的整数,包含0和180setRotationAngle
tbtextbeak文本换行0 截断、1溢出、2 自动换行2:setTextWrapped
0和1:IsTextWrapped = true
vvalue原始值
mmonitor显示值
ffunction公式setFormula
setArrayFormula
workbook.calculateFormula();
pscomment批注 + + {
+ height: 140,//批注框高度
+ width: 73,//批注框宽度
+ left: 75,//批注框距离左边工作表边缘位置
+ top: 22,//批注框距离上边工作表边缘位置
+ isshow: true,//是否显示批注
+ value: "jhbk"//批注内容
+ } +
+
+ +一个规范的单元格对象如下: + +```json +{ + "ct": { //单元格值格式 + "fa": "General", //格式名称为自动格式 + "t": "n" //格式类型为数字类型 + }, + "v": 233, //内容的原始值为 233 + "m": 233, //内容的显示值为 233 + "bg": "#f6b26b", //背景为 "#f6b26b" + "ff": 1, // 字体为 "Arial" + "fc": "#990000", //字体颜色为 "#990000" + "bl": 1, //字体加粗 + "it": 1, //字体斜体 + "fs": 9, //字体大小为 9px + "cl": 1, //启用删除线 + "ht": 0, //水平居中 + "vt": 0, //垂直居中 + "tr": 2, //文字旋转 -45° + "tb": 2, //文本自动换行 + "ps": { //批注 + "left": 92, //批注框左边距 + "top": 10, //批注框上边距 + "width": 91, //批注框宽度 + "height": 48, //批注框高度 + "value": "I am a comment", //批注内容 + "isshow": true //批注框为显示状态 + }, + "f": "=SUM(233)" //单元格是一个求和公式 +} +``` + +### 为什么会有原始值 `v` 和显示值 `m` 的区分? + +Luckysheet在存储数字类型的内容时,支持多种格式转换,所以需要保留原始值来做更多处理,比如同样一个数字`1`,设置成百分比格式就是`"100%"`,设置成两位小数数字就是`"1.00"`, + +还有一个原因是日期和时间格式的内容原始值会存储为一个数字,默认情况下,Luckysheet把`1900-1-1 0:00:00`存储为`1`,把`1900-1-1 0:00:00`以后的每一个时刻存储为该时刻与`1900-1-1 0:00:00`这个时刻的差值(以天为单位)。比如`44127`就表示`2020-10-23`这一天。 + +以下是特殊格式的例子: + +百分比 `100%` +```json +{ + "ct": { + "fa": "0%", + "t": "n" + }, + "v": 1, + "m": "100%" +} +``` + +小数 `1.00` +```json +{ + "ct": { + "fa": "##0.00", + "t": "n" + }, + "v": 1, + "m": "1.00" +} +``` + +日期 `2020-10-23` +```json +{ + "ct": { + "fa": "yyyy-MM-dd", + "t": "d" + }, + "v": 44127, + "m": "2020-10-23" +} +``` + +## 合并单元格
+ +设置一个合并单元格,需要处理两个地方,一是单元格对象中设置`mc`属性,二是在`config`中设置`merge`。 + +比如,将"A1:B2"单元格合并为一个单元格 + +- 第一步:先设置四个单元格的参数 + ```json + [ + [{ + "m": "merge cell", + "ct": { + "fa": "General", + "t": "g" + }, + "v": "merge cell", + "mc": { //合并单元格必备属性 + "r": 0, //主单元格的行号 + "c": 0, //主单元格的列号 + "rs": 2, //合并单元格占的行数 + "cs": 2 //合并单元格占的列数 + } + }, { + "mc": { + "r": 0, //主单元格的行号 + "c": 0, //主单元格的列号 + } + }], + [{ + "mc": { + "r": 0, //主单元格的行号 + "c": 0, //主单元格的列号 + } + }, { + "mc": { + "r": 0, //主单元格的行号 + "c": 0, //主单元格的列号 + } + }] + ] + ``` + + 合并单元格的关键属性是`mc`,主单元格是选区范围中左上角的单元格,包含4个属性 r/c/rs/cs ,分别表示 row/column/rowspan/columnspan,在这里,就表示从主单元格A1(row 0 column 0)开始到右边2行下方2列的单元格进行合并,选区范围中的其他单元格则只需要设置主单元格位置即可。 + +- 第二步:再设置`config.merge` + ```json + { + "0_0": { + "r": 0, + "c": 0, + "rs": 2, + "cs": 2 + } + } + ``` + 对象中的key为 `r + '_' + c` 的拼接值,value同主单元格的`mc`设置: r:行数,c:列数,rs:合并的行数,cs:合并的列数 + +> merge 详细参考:[表格数据config](/zh/guide/data.html#config) + +## 含边框单元格 + +单元格的边框设置与合并单元格类似,需要在`config`中设置`borderInfo`,区别在于不需要设置单元格对象。 +加入 + +比如,将"A1"单元格设置一个黑色细实线的全部边框 + +设置`config.borderInfo`为 +```json +{ + "rangeType": "range", + "borderType": "border-all", + "color": "#000", + "style": "1", + "range": [ + { + "row": [ 0, 0 ], + "column": [0, 0] + } + ] +} +``` +而其单元格对象不需要增加设置,如下只是基础的内容和格式设置 +```json +[ + [ + { + "m": "borderCell", + "ct": { + "fa": "General", + "t": "g" + }, + "v": "borderCell" + } + ] +] +``` + +> borderInfo 详细参考:[config.borderInfo](/zh/guide/sheet.html#config-borderinfo) + +## 简化的单元格数据 + +特别强调的是,表格初始化的时候,采用的是`r/c/v`对象组成的一维数组格式,其中`v`的值一般是设置为单元格对象。为了节约后台的存储空间,`v`的值支持简写格式,直接写为一个字符串即可,渲染进Luckysheet后自动识别为自动格式即,`"ct": { "fa": "General", "t": "n" }` + +以下为初始化3个单元格信息,第三个单元格即为简写格式: + +```json +[ + { + "r": 0, + "c": 0, + "v": { + "f": "=MAX(A7:A9)", + "ct": { + "fa": "General", + "t": "n" + }, + "v": 100, + "m": "100" + } + }, + { + "r": 0, + "c": 1, + "v": { + "f": "=SUM(A2)", + "bg": "#fff000", + "v": 12, + "m": "12" + } + }, + { + "r": 0, + "c": 2, + "v": "value 2" + } +] +``` +> 了解 [celldata的使用](/zh/guide/data.html#celldata) + +## 单元格值格式
+ +值格式即为单元格对象中 `ct` 的设置, + +如下为自动格式的单元格 + +```json +{ + "ct": { + "fa": "General", + "t": "g" + }, + "m": "2424", + "v": 2424 +} +``` + +|参数|说明|值| +| ------------ | ------------ | ------------ | +|fa|Format格式的定义串| 如"General"| +|t|Type类型|如"g"| + + +### 可选择的设置如下 + +| 格式 | ct.fa | ct.t | m 值示例 |备注 | +|----------|----------|-------------------------|------------------------- |------------------------- | +| 自动 | General | g/n | Luckysheet |自动格式,也是默认的格式;单元格内容为数字时,`m`的值为`'n'`| +| 纯文本 | @ | s | Luckysheet || +|


**数字格式** | | | | | +| 整数 | 0 | n | 1235 | 0位小数 || +| 数字一位小数 | 0.0 | n | 1234.6 | 点后面0的个数就代表小数位数,如果原始数字位数大,设置位数小时会做四舍五入 | +| 数字两位小数 | 0.00 | n | 1234.56 || +| 百分比整数 | 0% | n | 123456% |也支持 #0% 的用法| +| 百分比 | 0.00% | n | 123456.00% |也支持 #0.00% 的用法,点后面0的个数就代表小数位数| +| 科学计数 | 0.00E+00 | n | 1.23E+03 || +| 科学计数 | ##0.0E+0 | n | 1.2E+3 || +| 分数 | # ?/? | n | 1234 5/9 || +| 分数 | # ??/?? | n | 1234 14/25 || +| 万元 | w | n |12万3456|| +| 万元2位小数 | w0.00 | n |12万3456.00|| +| 会计 | ¥(0.00) | n || +| 更多数字格式 | #,##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 || + +以上配置参考了[Aspose.Cells](https://docs.aspose.com/display/cellsnet/List+of+Supported+Number+Formats#ListofSupportedNumberFormats-Aspose.Cells) diff --git a/docs/zh/guide/config.md b/docs/zh/guide/config.md index 029e88dd7..2bd03e0de 100644 --- a/docs/zh/guide/config.md +++ b/docs/zh/guide/config.md @@ -1,1763 +1,1867 @@ -# 整体配置 - -## 基础结构 - -初始化表格时,可以设置一个对象配置串`options`来自定义配置Luckysheet表格。 - -如下是一个简洁的配置案例: - -```js -// 配置项 -const options = { - container: 'luckysheet', // 设定DOM容器的id - title: 'Luckysheet Demo', // 设定表格名称 - lang: 'zh' // 设定表格语言 - - // 更多其他设置... -} - -// 初始化表格 -luckysheet.create(options) -``` - -这里的`options`配置项会作用于整个表格,特别的,单个sheet的配置则需要在`options.data`数组中,分别设置对应更详细的参数,参考[工作表配置](/zh/guide/sheet.html) - -针对个性化的需求,除了允许配置信息栏([showinfobar](#showinfobar))、工具栏([showtoolbar](#showtoolbar))、底部sheet页([showsheetbar](#showsheetbar))、底部计数栏([showstatisticBar](#showstatisticBar))之外, -Luckysheet开放了更细致的自定义配置选项,分别有 - -- 自定义工具栏([showtoolbarConfig](#showtoolbarConfig)) -- 自定义底部sheet页([showsheetbarConfig](#showsheetbarConfig)) -- 自定义计数栏([showstatisticBarConfig](#showstatisticBarConfig)) -- 自定义单元格右键菜单([cellRightClickConfig](#cellRightClickConfig)) -- 自定义底部sheet页右击菜单([sheetRightClickConfig](#sheetRightClickConfig)) - - -## 配置项 - -以下为所有支持的设置参数 - -- 容器ID [container](#container) -- 工作簿名称 [title](#title) -- 语言 [lang](#lang) -- 唯一key [gridKey](#gridKey) -- 加载整个工作簿 [loadUrl](#loadUrl) -- 加载其它页celldata [loadSheetUrl](#loadSheetUrl) -- 允许更新 [allowUpdate](#allowUpdate) -- 更新地址 [updateUrl](#updateUrl) -- 缩略图更新地址 [updateImageUrl](#updateImageUrl) -- 工作表配置 [data](#data) -- 插件 [plugins](#plugins) -- 列数 [column](#column) -- 行数 [row](#row) -- 亿万格式 [autoFormatw](#autoFormatw) -- 精度 [accuracy](#accuracy) -- 允许复制 [allowCopy](#allowCopy) -- 工具栏 [showtoolbar](#showtoolbar) -- 自定义工具栏[showtoolbarConfig](#showtoolbarConfig) -- 信息栏 [showinfobar](#showinfobar) -- 底部sheet页 [showsheetbar](#showsheetbar) -- 自定义底部sheet页 [showsheetbarConfig](#showsheetbarConfig) -- 底部计数栏 [showstatisticBar](#showstatisticBar) -- 自定义计数栏 [showstatisticBarConfig](#showstatisticBarConfig) -- 允许添加行 [enableAddRow](#enableAddRow) -- 默认添加行的数目 [addRowCount](#addRowCount) -- 允许回到顶部 [enableAddBackTop](#enableAddBackTop) -- 用户信息 [userInfo](#userInfo) -- 用户信息菜单 [userMenuItem](#userMenuItem) -- 返回按钮链接 [myFolderUrl](#myFolderUrl) -- 比例 [devicePixelRatio](#devicePixelRatio) -- 功能按钮 [functionButton](#functionButton) -- 自动缩进界面 [showConfigWindowResize](#showConfigWindowResize) -- 刷新公式 [forceCalculation](#forceCalculation) -- 自定义单元格右键菜单 [cellRightClickConfig](#cellRightClickConfig) -- 自定义sheet页右击菜单 [sheetRightClickConfig](#sheetRightClickConfig) -- 行标题区域的宽度 [rowHeaderWidth](#rowHeaderWidth) -- 列标题区域的高度 [columnHeaderHeight](#columnHeaderHeight) -- 是否显示公式栏 [sheetFormulaBar](#sheetFormulaBar) -- 初始化默认字体大小 [defaultFontSize](#defaultFontSize) -- 是否限制工作表名长度 [limitSheetNameLength](#limitSheetNameLength) -- 默认允许工作表名的最大长度 [defaultSheetNameMaxLength](#defaultSheetNameMaxLength) -- 分页器 [pager](#pager) - -### container -- 类型:String -- 默认值:"luckysheet" -- 作用:容器的ID - ------------- -### title -- 类型:String -- 默认值:"Luckysheet Demo" -- 作用:工作簿名称 - ------------- -### lang -- 类型:String -- 默认值:"en" -- 作用:国际化设置,允许设置表格的语言,支持简体中文("zh")、英文("en")、繁体中文("zh_tw")和西班牙文("es") - ------------- -### gridKey -- 类型:String -- 默认值:"" -- 作用:表格唯一标识符 - ------------- -### loadUrl -- 类型:String -- 默认值:"" -- 作用:配置`loadUrl`接口地址,加载所有工作表的配置,并包含当前页单元格数据,与`loadSheetUrl`配合使用。参数为`gridKey`(表格主键)。 - - 源码的请求写法是: - ```js - $.post(loadurl, {"gridKey" : server.gridKey}, function (d) {}) - ``` - > 参见源码 [`src/core.js`](https://github.com/mengshukeji/Luckysheet/blob/master/src/core.js) - - Luckysheet会通过ajax请求(POST)整个表格的数据,默认载入status为1的sheet数据中的`celldata`,其余的sheet载入除`celldata`字段外的所有配置字段。特别是在数据量大的时候,`loadUrl`只负责当前页单元格数据,配置`loadSheetUrl`作为其它工作表异步加载单元格数据的接口,可以提高性能。 - - 一个合格的接口返回的json字符串数据为: - - ```js - "[ - //status为1的sheet页,重点是需要提供初始化的数据celldata - { - "name": "Cell", - "index": "sheet_01", - "order": 0, - "status": 1, - "celldata": [{"r":0,"c":0,"v":{"v":1,"m":"1","ct":{"fa":"General","t":"n"}}}] - }, - //其他status为0的sheet页,无需提供celldata,只需要配置项即可 - { - "name": "Data", - "index": "sheet_02", - "order": 1, - "status": 0 - }, - { - "name": "Picture", - "index": "sheet_03", - "order": 2, - "status": 0 - } - ]" - ``` - 有几个注意点 - + 这是一个字符串,类似于JSON.stringify()处理后的json数据,压缩后的数据便于传输 - + loadUrl是一个post请求,也是为了支持大数据量 - + 考虑到一些公式、图表及数据透视表会引用其他sheet的数据,所以前台会加一个判断,如果该当前sheet引用了其他sheet的数据则会通过`loadSheetUrl`配置的接口地址请求数据,把引用到的sheet的数据一并补全,而不用等切换到其它页的时候再请求 - + 当数据量小的时候,也可以不用Luckysheet提供的此接口,直接使用[data](#data)参数可以提前准备好所有表格数据用于初始化 - ------------- -### loadSheetUrl -- 类型:String -- 默认值:"" -- 作用:配置`loadSheetUrl`接口地址,用于异步加载其它单元格数据。参数为`gridKey`(表格主键) 和 `index`(sheet主键合集,格式为`["sheet_01","sheet_02","sheet_03"]`)。 - - 源码的请求写法是: - ```js - $.post(loadSheetUrl, {"gridKey" : server.gridKey, "index": sheetindex.join(",")}, function (d) {}) - ``` - > 参见源码 [`src/controllers/sheetmanage.js`](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/sheetmanage.js) - - 返回的数据为sheet的`celldata`字段数据集合。 - - 一个合格的接口返回的json字符串数据为: - - ```js - "{ - "sheet_01": [ - { - "r": 0, - "c": 0, - "v": { "v": 1, "m": "1", "ct": { "fa": "General", "t": "n" } } - } - ], - "sheet_02": [ - { - "r": 0, - "c": 0, - "v": { "v": 1, "m": "1", "ct": { "fa": "General", "t": "n" } } - } - ], - "sheet_03": [ - { - "r": 0, - "c": 0, - "v": { "v": 1, "m": "1", "ct": { "fa": "General", "t": "n" } } - } - ] - }" - ``` - 同`loadUrl`类似,`loadSheetUrl`也要注意这几点: - + 这是一个字符串格式数据 - + 这是一个post请求 - + 这个接口会在两种情况下自动调用,一是在`loadUrl`加载的当前页数据时发现当前工作表引用了其他工作表,二是切换到一个未曾加载过数据的工作表时 - ------------- -### allowUpdate -- 类型:Boolean -- 默认值:false -- 作用:是否允许操作表格后的后台更新,与`updateUrl`配合使用。如果要开启共享编辑,此参数必须设置为`true`。 - ------------- -### updateUrl -- 类型:String -- 默认值:"" -- 作用:操作表格后,实时保存数据的websocket地址,此接口也是共享编辑的接口地址。 - - 有个注意点,要想开启共享编辑,必须满足以下3个条件: - + `allowUpdate`为`true` - + 配置了`loadUrl` - + 配置了`updateUrl` - - 注意,发送给后端的数据默认是经过pako压缩过后的。后台拿到数据需要先解压。 - - 通过共享编辑功能,可以实现Luckysheet实时保存数据和多人同步数据,每一次操作都会发送不同的参数到后台,具体的操作类型和参数参见[表格操作](/zh/guide/operate.html) - ------------- -### updateImageUrl -- 类型:String -- 默认值:"" -- 作用:缩略图的更新地址 - ------------- -### data -- 类型:Array -- 默认值:[{ "name": "Sheet1", color: "", "status": "1", "order": "0", "data": [], "config": {}, "index":0 }, { "name": "Sheet2", color: "", "status": "0", "order": "1", "data": [], "config": {}, "index":1 }, { "name": "Sheet3", color: "", "status": "0", "order": "2", "data": [], "config": {}, "index":2 }] -- 作用:当未配置`loadUrl`和`loadSheetUrl`的时候,需要手动配置传入整个客户端所有sheet数据`[shee1, sheet2, sheet3]`,详细参数设置参见[工作表配置](/zh/guide/sheet.html) - ------------- -### plugins -- 类型:Array -- 默认值:[] -- 作用:配置插件,支持图表:"chart" - ------------- -### column -- 类型:Number -- 默认值:60 -- 作用:空表格默认的列数量 - ------------- -### row -- 类型:Number -- 默认值:84 -- 作用:空表格默认的行数据量 - ------------- -### autoFormatw -- 类型:Boolean -- 默认值:false -- 作用:自动格式化超过4位数的数字为‘亿万格式’,例:true or "true" or "TRUE" - ------------- -### accuracy -- 类型:Number -- 默认值:undefined -- 作用:设置精度,小数点后的位数。传参数为数字或数字字符串,例: "0" 或 0 - ------------- -### allowCopy -- 类型:Boolean -- 默认值:true -- 作用:是否允许拷贝 - ------------- -### showtoolbar -- 类型:Boolean -- 默认值:true -- 作用:是否显示工具栏 - ------------- -### showtoolbarConfig - -- 类型:Object -- 默认值:{} -- 作用:自定义配置工具栏,可以与showtoolbar配合使用,`showtoolbarConfig`拥有更高的优先级。 -- 格式1: - ```json - { - undoRedo: false, //撤销重做,注意撤消重做是两个按钮,由这一个配置决定显示还是隐藏 - paintFormat: false, //格式刷 - currencyFormat: false, //货币格式 - percentageFormat: false, //百分比格式 - numberDecrease: false, // '减少小数位数' - numberIncrease: false, // '增加小数位数 - moreFormats: false, // '更多格式' - font: false, // '字体' - fontSize: false, // '字号大小' - bold: false, // '粗体 (Ctrl+B)' - italic: false, // '斜体 (Ctrl+I)' - strikethrough: false, // '删除线 (Alt+Shift+5)' - underline: false, // '下划线 (Alt+Shift+6)' - textColor: false, // '文本颜色' - fillColor: false, // '单元格颜色' - border: false, // '边框' - mergeCell: false, // '合并单元格' - horizontalAlignMode: false, // '水平对齐方式' - verticalAlignMode: false, // '垂直对齐方式' - textWrapMode: false, // '换行方式' - textRotateMode: false, // '文本旋转方式' - image:false, // '插入图片' - link:false, // '插入链接' - chart: false, // '图表'(图标隐藏,但是如果配置了chart插件,右击仍然可以新建图表) - postil: false, //'批注' - pivotTable: false, //'数据透视表' - function: false, // '公式' - frozenMode: false, // '冻结方式' - sortAndFilter: false, // '排序和筛选' - conditionalFormat: false, // '条件格式' - dataVerification: false, // '数据验证' - splitColumn: false, // '分列' - screenshot: false, // '截图' - findAndReplace: false, // '查找替换' - protection:false, // '工作表保护' - print:false, // '打印' - } - ``` -- 示例1: - - 仅显示撤消重做和字体按钮: - - ```js - //options - { - showtoolbar: false, - showtoolbarConfig:{ - undoRedo: true, - font: true, - } - } - ``` - - 仅隐藏图片和打印按钮: - - ```js - //options - { - showtoolbar: true, // 默认就是true,可以不设置 - showtoolbarConfig:{ - image: false, - print: false, - } - } - ``` -- 格式2: - 对象格式可以很方便控制显示隐藏,使用数组形式可轻松控制按钮顺序和位置, 以下为工具栏按钮和分隔符的默认配置。 - ```json - [ - "undo", "redo", "paintFormat", "|", - "currencyFormat", "percentageFormat", "numberDecrease", "numberIncrease", "moreFormats", "|", - "font", "|", - "fontSize", "|", - "bold", "italic", "strikethrough", "underline", "textColor", "|", - "fillColor", "border", "mergeCell", "|", - "horizontalAlignMode", "verticalAlignMode", "textWrapMode", "textRotateMode", "|", - "image", "link", "chart", "postil", "pivotTable", "|", - "function", "frozenMode", "sortAndFilter", "conditionalFormat", "dataVerification", "splitColumn", "screenshot", "findAndReplace", "protection", "print" - ] - ``` -- 示例2: - - 自定义按钮和位置, 保护放到最前面, 只要字体样式相关按钮。 - ```json - { - "showtoolbarConfig": [ - "protection", "|", - "font", "|", - "fontSize", "|", - "bold", "italic", "strikethrough", "underline", "textColor" - ] - } - ``` ------------- -### showinfobar -- 类型:Boolean -- 默认值:true -- 作用:是否显示顶部信息栏 - ------------- -### showsheetbar -- 类型:Boolean -- 默认值:true -- 作用:是否显示底部sheet页按钮 - ------------- -### showsheetbarConfig - -- 类型:Object -- 默认值:{} -- 作用:自定义配置底部sheet页按钮,可以与showsheetbar配合使用,`showsheetbarConfig`拥有更高的优先级。 -- 格式: - ```json - { - add: false, //新增sheet - menu: false, //sheet管理菜单 - sheet: false //sheet页显示 - } - ``` -- 示例: - - 仅显示新增sheet按钮: - - ```js - //options - { - showsheetbar: false, - showsheetbarConfig:{ - add: true, - } - } - ``` - - 仅隐藏新增sheet和管理按钮: - - ```js - //options - { - showsheetbar: true, // 默认就是true,可以不设置 - showsheetbarConfig:{ - add: false, - menu: false, - } - } - ``` - ------------- -### showstatisticBar -- 类型:Boolean -- 默认值:true -- 作用:是否显示底部计数栏 - ------------- -### showstatisticBarConfig - -- 类型:Object -- 默认值:{} -- 作用:自定义配置底部计数栏,可以与showstatisticBar配合使用,`showstatisticBarConfig`拥有更高的优先级。 -- 格式: - ```json - { - count: false, // 计数栏 - view: false, // 打印视图 - zoom: false, // 缩放 - } - ``` -- 示例: - - 仅显示缩放按钮: - - ```js - //options - { - showstatisticBar: false, - showstatisticBarConfig:{ - zoom: true, - } - } - ``` - - 仅隐藏打印视图按钮: - - ```js - //options - { - showstatisticBar: true, // 默认就是true,可以不设置 - showstatisticBarConfig:{ - view: false, - } - } - ``` - ------------- -### enableAddRow -- 类型:Boolean -- 默认值:true -- 作用:允许添加行 - -### addRowCount -- Number -- 默认值:100 -- 作用:配置新增行处默认新增的行数目 - ------------- -### enableAddBackTop -- 类型:Boolean -- 默认值:true -- 作用:允许回到顶部 - ------------- -### userInfo -- 类型:String | Boolean | Object -- 默认值:false -- 作用:右上角的用户信息展示样式,支持以下三种形式 - 1. HTML模板字符串,如: - - ```js - options:{ - // 其他配置 - userInfo:' Lucky', - } - ``` - - 或者一个普通字符串,如: - - ```js - options:{ - // 其他配置 - userInfo:'Lucky', - } - ``` - - 2. Boolean类型,如: - - `false`:不展示 - ```js - options:{ - // 其他配置 - userInfo:false, // 不展示用户信息 - } - - ``` - `ture`:展示默认的字符串 - ```js - options:{ - // 其他配置 - userInfo:true, // 展示HTML:' Lucky' - } - - ``` - 3. 对象格式,设置 `userImage`:用户头像地址 和 `userName`:用户名,如: - ```js - options:{ - // 其他配置 - userImage:'https://cdn.jsdelivr.net/npm/luckyresources@1.0.3/assets/img/logo/logo.png', // 头像url - userName:'Lucky', // 用户名 - } - ``` - - 4. 注意,设置为`undefined`或者不设置,同设置`false` - ------------- -### userMenuItem -- 类型:Array -- 默认值:`[{url:"www.baidu.com", "icon":'', "name":"我的表格"}, {url:"www.baidu.com", "icon":'', "name":"退出登陆"}]` -- 作用:点击右上角的用户信息弹出的菜单 - ------------- -### myFolderUrl -- 类型:String -- 默认值:"www.baidu.com" -- 作用:左上角<返回按钮的链接 - ------------- -### devicePixelRatio -- 类型:Number -- 默认值:window.devicePixelRatio -- 作用:设备比例,比例越大表格分辨率越高 - ------------- -### functionButton -- 类型:String -- 默认值:"" -- 作用:右上角功能按钮,例如`' '` - ------------- -### showConfigWindowResize -- 类型:Boolean -- 默认值:true -- 作用:图表或数据透视表的配置会在右侧弹出,设置弹出后表格是否会自动缩进 - ------------- -### forceCalculation -- 类型:Boolean -- 默认值:false -- 作用:强制刷新公式。 - - 默认情况下,为提高加载性能,表格初始化的时候,含有公式的单元格会默认直接取得`v`和`m`作为数据结果,而不做实时计算。 - - 如果公式关联到的单元格数据已经变化,或者公式所在的单元格数据结果改变了,则会导致关联单元格应该计算得出的结果和实际显示结果不一致,这是就需要开启公式刷新,保证数据实时计算的准确性。 - - ⚠️提醒,公式较多时会有性能问题,慎用! - ------------- -### cellRightClickConfig - -- 类型:Object -- 默认值:{} -- 作用:自定义配置单元格右击菜单 -- 格式: - ```json - { - copy: false, // 复制 - copyAs: false, // 复制为 - paste: false, // 粘贴 - insertRow: false, // 插入行 - insertColumn: false, // 插入列 - deleteRow: false, // 删除选中行 - deleteColumn: false, // 删除选中列 - deleteCell: false, // 删除单元格 - hideRow: false, // 隐藏选中行和显示选中行 - hideColumn: false, // 隐藏选中列和显示选中列 - rowHeight: false, // 行高 - columnWidth: false, // 列宽 - clear: false, // 清除内容 - matrix: false, // 矩阵操作选区 - sort: false, // 排序选区 - filter: false, // 筛选选区 - chart: false, // 图表生成 - image: false, // 插入图片 - link: false, // 插入链接 - data: false, // 数据验证 - cellFormat: false // 设置单元格格式 - } - ``` - 除了单元格,这里的配置还包括行标题右击菜单、列标题右击菜单和列标题下拉箭头的菜单,具体配置关系如下表格: - - |右击菜单配置|单元格|行标题|列标题|列箭头| - | ------------ | ------------ | ------------ | ------------ | ------------ | - |copy|复制|复制|复制|复制| - |copyAs|复制为|复制为|复制为|复制为| - |paste|粘贴|粘贴|粘贴|粘贴| - |insertRow|插入行|向上增加N行,向下增加N行|-|-| - |insertColumn|插入列|-|向左增加N列,向右增加N列|向左增加N列,向右增加N列| - |deleteRow|删除选中行|删除选中行|-|-| - |deleteColumn|删除选中列|-|删除选中列|删除选中列| - |deleteCell|删除单元格|-|-|-| - |hideRow|-|隐藏选中行和显示选中行|-|-| - |hideColumn|-|-|隐藏选中列和显示选中列|隐藏选中列和显示选中列| - |rowHeight|-|行高|-|-| - |columnWidth|-|-|列宽|列宽| - |clear|清除内容|清除内容|清除内容|-| - |matrix|矩阵操作选区|矩阵操作选区|矩阵操作选区|-| - |sort|排序选区|排序选区|排序选区|A-Z排序和Z-A排序| - |filter|筛选选区|筛选选区|筛选选区|-| - |chart|图表生成|图表生成|图表生成|-| - |image|插入图片|插入图片|插入图片|-| - |link|插入链接|插入链接|插入链接|-| - |data|数据验证|数据验证|数据验证|-| - |cellFormat|设置单元格格式|设置单元格格式|设置单元格格式|-| - - ------------- -### sheetRightClickConfig - -- 类型:Object -- 默认值:{} -- 作用:自定义配置sheet页右击菜单 -- 格式: - ```json - { - delete: false, // 删除 - copy: false, // 复制 - rename: false, //重命名 - color: false, //更改颜色 - hide: false, //隐藏,取消隐藏 - move: false, //向左移,向右移 - } - ------------- -### rowHeaderWidth - -- 类型:Number -- 默认值:46 -- 作用:行标题区域的宽度,如果设置为0,则表示隐藏行标题 - ------------- -### columnHeaderHeight - -- 类型:Number -- 默认值:20 -- 作用:列标题区域的高度,如果设置为0,则表示隐藏列标题 - ------------- -### sheetFormulaBar - -- 类型:Boolean -- 默认值:true -- 作用:是否显示公式栏 - ------------- -### defaultFontSize -- 类型:Number -- 默认值:11 -- 作用:初始化默认字体大小 - ------------- - -### limitSheetNameLength -- 类型:Boolean -- 默认值:true -- 作用:工作表重命名等场景下是否限制工作表名称的长度 - ------------- - -### defaultSheetNameMaxLength -- 类型:Number -- 默认值:31 -- 作用:默认允许的工作表名最大长度 - ------------- - -### pager -- 类型:Object -- 默认值:null -- 作用:分页器按钮设置,初版方案是直接使用的jquery插件 [sPage](https://github.com/jvbei/sPage) - 点击分页按钮会触发钩子函数 `onTogglePager`,返回当前页码,同`sPage`的`backFun`方法,此分页器设置只负责UI部分,具体切换分页后的数据请求和数据渲染,请在`onTogglePager`钩子行数里自定义处理。 - ```js - pager: { - pageIndex: 1, //当前页码,必填 - total: 100, //数据总条数,必填 - selectOption: [10, 20, 30], // 选择每页的行数, - pageSize: 10, //每页显示多少条数据,默认10条 - showTotal: false, // 是否显示总数,默认关闭:false - showSkip: false, //是否显示跳页,默认关闭:false - showPN: false, //是否显示上下翻页,默认开启:true - prevPage: '', //上翻页文字描述,默认"上一页" - nextPage: '', //下翻页文字描述,默认"下一页" - totalTxt: '', // 数据总条数文字描述,默认"总共:{total}" - } - ``` - ------------- - -## 钩子函数 - -钩子函数应用于二次开发时,会在各个常用鼠标或者键盘操作时植入钩子,调用开发者传入的函数,起到扩展Luckysheet功能的作用。 - -钩子函数统一配置在`options.hook`下,可以分别针对单元格、sheet页、表格创建配置hook。 - -> 使用案例可参考源码 [src/index.html](https://github.com/mengshukeji/Luckysheet/blob/master/src/index.html) - -## 单元格 - -### cellEditBefore - -- 类型:Function -- 默认值:null -- 作用:进入单元格编辑模式之前触发。在选中了某个单元格且在非编辑状态下,通常有以下三种常规方法触发进入编辑模式 - - - 双击单元格 - - 敲Enter键 - - 使用API:enterEditMode - -- 参数: - - {Array} [range]: 当前选区范围 - ------------- -### cellUpdateBefore - -- 类型:Function -- 默认值:null -- 作用:更新这个单元格值之前触发,`return false` 则不执行后续的更新。在编辑状态下修改了单元格之后,退出编辑模式并进行数据更新之前触发这个钩子。 -- 参数: - - {Number} [r]: 单元格所在行数 - - {Number} [c]: 单元格所在列数 - - {Object | String | Number} [value]: 要修改的单元格内容 - - {Boolean} [isRefresh]: 是否刷新整个表格 - ------------- -### cellUpdated - -- 类型:Function -- 默认值:null -- 作用:更新这个单元格后触发 -- 参数: - - {Number} [r]: 单元格所在行数 - - {Number} [c]: 单元格所在列数 - - {Object} [oldValue]: 修改前的单元格对象 - - {Object} [newValue]: 修改后的单元格对象 - - {Boolean} [isRefresh]: 是否刷新整个表格 - ------------- -### cellRenderBefore - -- 类型:Function -- 默认值:null -- 作用:单元格渲染前触发,`return false` 则不渲染该单元格 -- 参数: - - {Object} [cell]:单元格对象 - - {Object} [position]: - + {Number} [r]:单元格所在行号 - + {Number} [c]:单元格所在列号 - + {Number} [start_r]:单元格左上角的垂直坐标 - + {Number} [start_c]:单元格左上角的水平坐标 - + {Number} [end_r]:单元格右下角的垂直坐标 - + {Number} [end_c]:单元格右下角的水平坐标 - - {Object} [sheet]:当前sheet对象 - - {Object} [ctx]: 当前画布的context - ------------- -### cellRenderAfter - -- 类型:Function -- 默认值:null -- 作用:单元格渲染结束后触发,`return false` 则不渲染该单元格 -- 参数: - - {Object} [cell]:单元格对象 - - {Object} [position]: - + {Number} [r]:单元格所在行号 - + {Number} [c]:单元格所在列号 - + {Number} [start_r]:单元格左上角的垂直坐标 - + {Number} [start_c]:单元格左上角的水平坐标 - + {Number} [end_r]:单元格右下角的垂直坐标 - + {Number} [end_c]:单元格右下角的水平坐标 - - {Object} [sheet]:当前sheet对象 - - {Object} [ctx]: 当前画布的context - -- 示例: - - 一个在D1单元格的左上角和右下角分别绘制两张图的案例 - :::::: details - ```js - luckysheet.create({ - hook: { - cellRenderAfter: function (cell, position, sheetFile, ctx) { - var r = position.r; - var c = position.c; - if (r === 0 && c === 3) { // 指定处理D1单元格 - if (!window.storeUserImage) { - window.storeUserImage = {} - } - - if (!window.storeUserImage[r + '_' + c]) { - window.storeUserImage[r + '_' + c] = {} - } - - var img = null; - var imgRight = null; - - if (window.storeUserImage[r + '_' + c].image && window.storeUserImage[r + '_' + c].imgRight) { - - // 加载过直接取 - img = window.storeUserImage[r + '_' + c].image; - imgRight = window.storeUserImage[r + '_' + c].imgRight; - - } else { - - img = new Image(); - imgRight = new Image(); - - img.src = 'https://www.dogedoge.com/favicon/developer.mozilla.org.ico'; - imgRight.src = 'https://www.dogedoge.com/static/icons/twemoji/svg/1f637.svg'; - - // 图片缓存到内存,下次直接取,不用再重新加载 - window.storeUserImage[r + '_' + c].image = img; - window.storeUserImage[r + '_' + c].imgRight = imgRight; - - } - - - if (img.complete) { // 已经加载完成的直接渲染 - ctx.drawImage(img, position.start_c, position.start_r, 10, 10); - } else { - img.onload = function () { - ctx.drawImage(img, position.start_c, position.start_r, 10, 10); - } - - } - - if (imgRight.complete) { - ctx.drawImage(imgRight, position.end_c - 10, position.end_r - 10, 10, 10); - } else { - - imgRight.onload = function () { - ctx.drawImage(imgRight, position.end_c - 10, position.end_r - 10, 10, 10); - } - } - - } - } - } - }) - ``` - ::: - ------------- -### cellAllRenderBefore - -- 类型:Function -- 默认值:null -- 作用:所有单元格渲染之前执行的方法。在内部,这个方法加在了`luckysheetDrawMain`渲染表格之前。 -- 参数: - - {Object} [data]: 当前工作表二维数组数据 - - {Object} [sheet]:当前sheet对象 - - {Object} [ctx]: 当前画布的context - ------------- -### rowTitleCellRenderBefore - -- 类型:Function -- 默认值:null -- 作用:行标题单元格渲染前触发,`return false` 则不渲染行标题 -- 参数: - - {String} [rowNum]:行号 - - {Object} [position]: - + {Number} [r]:单元格所在行号 - + {Number} [top]:单元格左上角的垂直坐标 - + {Number} [width]:单元格宽度 - + {Number} [height]:单元格高度 - - {Object} [ctx]: 当前画布的context - ------------- -### rowTitleCellRenderAfter - -- 类型:Function -- 默认值:null -- 作用:行标题单元格渲染后触发,`return false` 则不渲染行标题 -- 参数: - - {String} [rowNum]:行号 - - {Object} [position]: - + {Number} [r]:单元格所在行号 - + {Number} [top]:单元格左上角的垂直坐标 - + {Number} [width]:单元格宽度 - + {Number} [height]:单元格高度 - - {Object} [ctx]: 当前画布的context - ------------- -### columnTitleCellRenderBefore - -- 类型:Function -- 默认值:null -- 作用:列标题单元格渲染前触发,`return false` 则不渲染列标题 -- 参数: - - {Object} [columnAbc]:列标题字符 - - {Object} [position]: - - {Number} [c]:单元格所在列号 - - {Number} [left]:单元格左上角的水平坐标 - - {Number} [width]:单元格宽度 - - {Number} [height]:单元格高度 - - {Object} [ctx]: 当前画布的context - ------------- -### columnTitleCellRenderAfter - -- 类型:Function -- 默认值:null -- 作用:列标题单元格渲染后触发,`return false` 则不渲染列标题 -- 参数: - - {Object} [columnAbc]:列标题字符 - - {Object} [position]: - - {Number} [c]:单元格所在列号 - - {Number} [left]:单元格左上角的水平坐标 - - {Number} [width]:单元格宽度 - - {Number} [height]:单元格高度 - - {Object} [ctx]: 当前画布的context - ------------- - -## 鼠标钩子 - -### cellMousedownBefore - -- 类型:Function -- 默认值:null -- 作用:单元格点击前的事件,`return false`则终止之后的点击操作 -- 参数: - - {Object} [cell]:单元格对象 - - {Object} [position]: - + {Number} [r]:单元格所在行号 - + {Number} [c]:单元格所在列号 - + {Number} [start_r]:单元格左上角的垂直坐标 - + {Number} [start_c]:单元格左上角的水平坐标 - + {Number} [end_r]:单元格右下角的垂直坐标 - + {Number} [end_c]:单元格右下角的水平坐标 - - {Object} [sheet]:当前sheet对象 - - {Object} [ctx]: 当前画布的context - ------------- -### cellMousedown - -- 类型:Function -- 默认值:null -- 作用:单元格点击后的事件,`return false`则终止之后的点击操作 -- 参数: - - {Object} [cell]:单元格对象 - - {Object} [position]: - + {Number} [r]:单元格所在行号 - + {Number} [c]:单元格所在列号 - + {Number} [start_r]:单元格左上角的垂直坐标 - + {Number} [start_c]:单元格左上角的水平坐标 - + {Number} [end_r]:单元格右下角的垂直坐标 - + {Number} [end_c]:单元格右下角的水平坐标 - - {Object} [sheet]:当前sheet对象 - - {Object} [ctx]: 当前画布的context - ------------- -### sheetMousemove - -- 类型:Function -- 默认值:null -- 作用:鼠标移动事件,可通过cell判断鼠标停留在哪个单元格 -- 参数: - - {Object} [cell]:单元格对象 - - {Object} [position]: - + {Number} [r]:单元格所在行号 - + {Number} [c]:单元格所在列号 - + {Number} [start_r]:单元格左上角的垂直坐标 - + {Number} [start_c]:单元格左上角的水平坐标 - + {Number} [end_r]:单元格右下角的垂直坐标 - + {Number} [end_c]:单元格右下角的水平坐标 - - {Object} [sheet]:当前sheet对象 - - {Object} [moveState]:鼠标移动状态,可判断现在鼠标操作的对象,false和true - + {Boolean} [functionResizeStatus]:工具栏拖动 - + {Boolean} [horizontalmoveState]:水平冻结分割栏拖动 - + {Boolean} [verticalmoveState]:垂直冻结分割栏拖动 - + {Boolean} [pivotTableMoveState]:数据透视表字段拖动 - + {Boolean} [sheetMoveStatus]:sheet改变你位置拖动 - + {Boolean} [scrollStatus]:鼠标触发了滚动条移动 - + {Boolean} [selectStatus]:鼠标移动框选数据 - + {Boolean} [rowsSelectedStatus]:通过行标题来选择整行操作 - + {Boolean} [colsSelectedStatus]:通过列标题来选择整列操作 - + {Boolean} [cellSelectedMove]:选框的移动 - + {Boolean} [cellSelectedExtend]:选框下拉填充 - + {Boolean} [colsChangeSize]:拖拽改变列宽 - + {Boolean} [rowsChangeSize]:拖拽改变行高 - + {Boolean} [chartMove]:图表移动 - + {Boolean} [chartResize]:图表改变大小 - + {Boolean} [rangeResize]:公式参数高亮选区的大小拖拽 - + {Boolean} [rangeMove]:公式参数高亮选区的位置拖拽 - - {Object} [ctx]: 当前画布的context - ------------- -### sheetMouseup - -- 类型:Function -- 默认值:null -- 作用:鼠标按钮释放事件,可通过cell判断鼠标停留在哪个单元格 -- 参数: - - {Object} [cell]:单元格对象 - - {Object} [position]: - + {Number} [r]:单元格所在行号 - + {Number} [c]:单元格所在列号 - + {Number} [start_r]:单元格左上角的垂直坐标 - + {Number} [start_c]:单元格左上角的水平坐标 - + {Number} [end_r]:单元格右下角的垂直坐标 - + {Number} [end_c]:单元格右下角的水平坐标 - - {Object} [sheet]:当前sheet对象 - - {Object} [moveState]:鼠标移动状态,可判断现在鼠标操作的对象,false和true - + {Boolean} [functionResizeStatus]:工具栏拖动 - + {Boolean} [horizontalmoveState]:水平冻结分割栏拖动 - + {Boolean} [verticalmoveState]:垂直冻结分割栏拖动 - + {Boolean} [pivotTableMoveState]:数据透视表字段拖动 - + {Boolean} [sheetMoveStatus]:sheet改变你位置拖动 - + {Boolean} [scrollStatus]:鼠标触发了滚动条移动 - + {Boolean} [selectStatus]:鼠标移动框选数据 - + {Boolean} [rowsSelectedStatus]:通过行标题来选择整行操作 - + {Boolean} [colsSelectedStatus]:通过列标题来选择整列操作 - + {Boolean} [cellSelectedMove]:选框的移动 - + {Boolean} [cellSelectedExtend]:选框下拉填充 - + {Boolean} [colsChangeSize]:拖拽改变列宽 - + {Boolean} [rowsChangeSize]:拖拽改变行高 - + {Boolean} [chartMove]:图表移动 - + {Boolean} [chartResize]:图表改变大小 - + {Boolean} [rangeResize]:公式参数高亮选区的大小拖拽 - + {Boolean} [rangeMove]:公式参数高亮选区的位置拖拽 - + {Boolean} [cellRightClick]:单元格右击 - + {Boolean} [rowTitleRightClick]:行标题右击 - + {Boolean} [columnTitleRightClick]:列标题右击 - + {Boolean} [sheetRightClick]:底部sheet页右击 - + {Boolean} [hyperlinkClick]:点击超链接 - - {Object} [ctx]: 当前画布的context - ------------- -### scroll - -- 类型:Function -- 默认值:null -- 作用:鼠标滚动事件 -- 参数: - - {Object} [position]: - + {Number} [scrollLeft]:横向滚动条的位置 - + {Number} [scrollTop]:垂直滚动条的位置 - + {Number} [canvasHeight]:canvas高度 - ------------- -### cellDragStop - -- 类型:Function -- 默认值:null -- 作用:鼠标拖拽文件到Luckysheet内部的结束事件 -- 参数: - - {Object} [cell]:单元格对象 - - {Object} [position]: - + {Number} [r]:单元格所在行号 - + {Number} [c]:单元格所在列号 - + {Number} [start_r]:单元格左上角的垂直坐标 - + {Number} [start_c]:单元格左上角的水平坐标 - + {Number} [end_r]:单元格右下角的垂直坐标 - + {Number} [end_c]:单元格右下角的水平坐标 - - {Object} [sheet]:当前sheet对象 - - {Object} [ctx]: 当前画布的context - - {Object} [event]: 当前事件对象 - ------------- - -## 选区操作(包括单元格) - -### rangeSelect - -- 类型:Function -- 默认值:null -- 作用:框选或者设置选区后触发 -- 参数: - - {Object} [sheet]:当前sheet对象 - - {Object | Array} [range]: 选区范围,可能为多个选区 - ------------- -### rangeMoveBefore -(TODO) -- 类型:Function -- 默认值:null -- 作用:移动选区前,包括单个单元格 -- 参数: - - {Array} [range]: 当前选区范围,只能为单个选区 - ------------- -### rangeMoveAfter -(TODO) -- 类型:Function -- 默认值:null -- 作用:移动选区后,包括单个单元格 -- 参数: - - {Array} [oldRange]: 移动前当前选区范围,只能为单个选区 - - {Array} [newRange]: 移动后当前选区范围,只能为单个选区 - ------------- -### rangeEditBefore -(TODO) -- 类型:Function -- 默认值:null -- 作用:选区修改前 -- 参数: - - {Object | Array} [range]: 选区范围,可能为多个选区 - - {Object} [data]: 选区范围所对应的数据 - ------------- -### rangeEditAfter -(TODO) -- 类型:Function -- 默认值:null -- 作用:选区修改后 -- 参数: - - {Object | Array} [range]: 选区范围,可能为多个选区 - - {Object} [oldData]: 修改前选区范围所对应的数据 - - {Object} [newData]: 修改后选区范围所对应的数据 - ------------- -### rangeCopyBefore -(TODO) -- 类型:Function -- 默认值:null -- 作用:选区复制前 -- 参数: - - {Object | Array} [range]: 选区范围,可能为多个选区 - - {Object} [data]: 选区范围所对应的数据 - ------------- -### rangeCopyAfter -(TODO) -- 类型:Function -- 默认值:null -- 作用:选区复制后 -- 参数: - - {Object | Array} [range]: 选区范围,可能为多个选区 - - {Object} [data]: 选区范围所对应的数据 - ------------- -### rangePasteBefore - -- 类型:Function -- 默认值:null -- 作用:选区粘贴前 -- 参数: - - {Object | Array} [range]: 选区范围,可能为多个选区 - - {Object} [data]: 要被粘贴的选区范围所对应的数据 - ------------- -### rangePasteAfter -(TODO) -- 类型:Function -- 默认值:null -- 作用:选区粘贴后 -- 参数: - - {Object | Array} [range]: 选区范围,可能为多个选区 - - {Object} [originData]: 要被粘贴的选区范围所对应的数据 - - {Object} [pasteData]: 要粘贴的数据 - ------------- -### rangeCutBefore -(TODO) -- 类型:Function -- 默认值:null -- 作用:选区剪切前 -- 参数: - - {Array} [range]: 选区范围,只能为单个范围 - - {Object} [data]: 要被剪切的选区范围所对应的数据 - ------------- -### rangeCutAfter -(TODO) -- 类型:Function -- 默认值:null -- 作用:选区剪切后 -- 参数: - - {Array} [range]: 选区范围,只能为单个范围 - - {Object} [data]: 被剪切的选区范围所对应的数据 - ------------- -### rangeDeleteBefore -(TODO) -- 类型:Function -- 默认值:null -- 作用:选区删除前 -- 参数: - - {Array} [range]: 选区范围,只能为单个范围 - - {Object} [data]: 要被删除的选区范围所对应的数据 - ------------- -### rangeDeleteAfter -(TODO) -- 类型:Function -- 默认值:null -- 作用:选区删除后 -- 参数: - - {Array} [range]: 选区范围,只能为单个范围 - - {Object} [data]: 被删除的选区范围所对应的数据 - ------------- -### rangeClearBefore -(TODO) -- 类型:Function -- 默认值:null -- 作用:选区清除前 -- 参数: - - {Object | Array} [range]: 选区范围,可能为多个选区 - - {Object} [data]: 要被清除的选区范围所对应的数据 - ------------- -### rangeClearAfter -(TODO) -- 类型:Function -- 默认值:null -- 作用:选区清除后 -- 参数: - - {Object | Array} [range]: 选区范围,可能为多个选区 - - {Object} [data]: 被清除的选区范围所对应的数据 - ------------- -### rangePullBefore -(TODO) -- 类型:Function -- 默认值:null -- 作用:选区下拉前 -- 参数: - - {Array} [range]: 当前选区范围,只能为单个范围 - ------------- -### rangePullAfter -(TODO) -- 类型:Function -- 默认值:null -- 作用:选区下拉后 -- 参数: - - {Array} [range]: 下拉后的选区范围,只能为单个范围 - ------------- - -## 工作表 - -### sheetCreateBefore - -- 类型:Function -- 默认值:null -- 作用:创建sheet页前触发,sheet页新建也包含数据透视表新建 - ------------- -### sheetCreateAfter - -- 类型:Function -- 默认值:null -- 作用:创建sheet页后触发,sheet页新建也包含数据透视表新建 -- 参数: - - {Object} [sheet]: 当前新创建的sheet页的配置 - ------------- -### sheetCopyBefore - -- 类型:Function -- 默认值:null -- 作用:拷贝创建sheet页前触发,sheet页新建也包含数据透视表新建 -- 参数: - - {Object} [targetSheet]: 被拷贝的sheet页配置 - - {Object} [copySheet]: 拷贝得到的sheet页的配置 ------------- -### sheetCopyAfter - -- 类型:Function -- 默认值:null -- 作用:拷贝创建sheet页后触发,sheet页新建也包含数据透视表新建 -- 参数: - - {Object} [sheet]: 当前创建的sheet页的配置 - ------------- -### sheetHideBefore - -- 类型:Function -- 默认值:null -- 作用:隐藏sheet页前触发 -- 参数: - - {Object} [sheet]: 将要隐藏的sheet页的配置 - ------------- -### sheetHideAfter - -- 类型:Function -- 默认值:null -- 作用:隐藏sheet页后触发 -- 参数: - - {Object} [sheet]: 要隐藏的sheet页的配置 - ------------- -### sheetShowBefore - -- 类型:Function -- 默认值:null -- 作用:显示sheet页前触发 -- 参数: - - {Object} [sheet]: 将要显示的sheet页的配置 - ------------- -### sheetShowAfter - -- 类型:Function -- 默认值:null -- 作用:显示sheet页后触发 -- 参数: - - {Object} [sheet]: 要显示的sheet页的配置 - ------------- -### sheetMoveBefore -(TODO) -- 类型:Function -- 默认值:null -- 作用:sheet移动前 -- 参数: - - {Number} [i]: 当前sheet页的`index` - - {Number} [order]: 当前sheet页`order` - ------------- -### sheetMoveAfter -(TODO) -- 类型:Function -- 默认值:null -- 作用:sheet移动后 -- 参数: - - {Number} [i]: 当前sheet页的`index` - - {Number} [oldOrder]: 修改前当前sheet页`order` - - {Number} [newOrder]: 修改后当前sheet页`order` - ------------- -### sheetDeleteBefore - -- 类型:Function -- 默认值:null -- 作用:sheet删除前 -- 参数: - - {Object} [sheet]: 要被删除sheet页的配置 - ------------- -### sheetDeleteAfter - -- 类型:Function -- 默认值:null -- 作用:sheet删除后 -- 参数: - - {Object} [sheet]: 已被删除sheet页的配置 - ------------- -### sheetEditNameBefore - -- 类型:Function -- 默认值:null -- 作用:sheet修改名称前 -- 参数: - - {Number} [i]: sheet页的`index` - - {String} [name]: 当前sheet页名称 - ------------- -### sheetEditNameAfter - -- 类型:Function -- 默认值:null -- 作用:sheet修改名称后 -- 参数: - - {Number} [i]: sheet页的index - - {String} [oldName]: 修改前当前sheet页名称 - - {String} [newName]: 修改后当前sheet页名称 - ------------- -### sheetEditColorBefore -(TODO) -- 类型:Function -- 默认值:null -- 作用:sheet修改颜色前 -- 参数: - - {Number} [i]: sheet页的`index` - - {String} [color]: 当前sheet页颜色 - ------------- -### sheetEditColorAfter -(TODO) -- 类型:Function -- 默认值:null -- 作用:sheet修改颜色后 -- 参数: - - {Number} [i]: sheet页的`index` - - {String} [oldColor]: 修改前当前sheet页颜色 - - {String} [newColor]: 修改后当前sheet页颜色 - ------------- -### sheetZoomBefore -(TODO) -- 类型:Function -- 默认值:null -- 作用:sheet缩放前 -- 参数: - - {Number} [i]: sheet页的`index` - - {String} [zoom]: 当前sheet页缩放比例 - ------------- -### sheetZoomAfter -(TODO) -- 类型:Function -- 默认值:null -- 作用:sheet缩放后 -- 参数: - - {Number} [i]: sheet页的`index` - - {String} [oldZoom]: 修改前当前sheet页缩放比例 - - {String} [newZoom]: 修改后当前sheet页缩放比例 - ------------- -### sheetActivate - -- 类型:Function -- 默认值:null -- 作用:激活工作表前 -- 参数: - - {Number} [i]: sheet页的`index` - - {Boolean} [isPivotInitial]: 是否切换到了数据透视表页 - - {Boolean} [isNewSheet]: 是否新建了sheet页 - ------------- -### sheetDeactivateBefore -(TODO) -- 类型:Function -- 默认值:null -- 作用:工作表从活动状态转为非活动状态前 -- 参数: - - {Number} [i]: sheet页的`index` - ------------- -### sheetDeactivateAfter -(TODO) -- 类型:Function -- 默认值:null -- 作用:工作表从活动状态转为非活动状态后 -- 参数: - - {Number} [i]: sheet页的`index` - ------------- - -## 工作簿 - -### workbookCreateBefore - -- 类型:Function -- 默认值:null -- 作用:表格创建之前触发。旧的钩子函数叫做`beforeCreateDom` -- 参数: - - {Object} [book]: 整个工作簿的配置(options) - ------------- -### workbookCreateAfter - -- 类型:Function -- 默认值:null -- 作用:表格创建之后触发 -- 参数: - - {Object} [book]: 整个工作簿的配置(options) - ------------- -### workbookDestroyBefore -(TODO) -- 类型:Function -- 默认值:null -- 作用:表格销毁之前触发 -- 参数: - - {Object} [book]: 整个工作簿的配置(options) - ------------- -### workbookDestroyAfter -(TODO) -- 类型:Function -- 默认值:null -- 作用:表格销毁之后触发 -- 参数: - - {Object} [book]: 整个工作簿的配置(options) - ------------- -### updated - -- 类型:Function -- 默认值:null -- 作用:协同编辑中的每次操作后执行的方法,监听表格内容变化,即客户端每执行一次表格操作,Luckysheet将这次操作存到历史记录中后触发,撤销重做时因为也算一次操作,也会触发此钩子函数。 -- 参数: - - {Object} [operate]: 本次操作的历史记录信息,根据不同的操作,会有不同的历史记录,参考源码 [历史记录](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/controlHistory.js) - ------------- -### resized -(TODO) -- 类型:Function -- 默认值:null -- 作用:resize执行之后 -- 参数: - - {Object} [size]: 整个工作簿区域的宽高 - ------------- -### scroll -- 类型:Function -- 默认值:null -- 作用:监听表格滚动值 -- 参数: - - {Number} [scrollLeft]: 水平方向滚动值 - - {Number} [scrollTop]: 垂直方向滚动值 - - {Number} [canvasHeight]: 滚动容器的高度 - ------------- - - -## 协作消息 - -### cooperativeMessage - -- 类型:Function -- 默认值:null -- 作用:接受协作消息,二次开发。拓展协作消息指令集 -- 参数: - - {Object} : 收到服务器发送的整个协作消息体对象 - -## 图片 - -### imageInsertBefore -(TODO) -- 类型:Function -- 默认值:null -- 作用:图片插入之前 -- 参数: - - {Object} [url]: 图片地址 - ------------- -### imageInsertAfter -(TODO) -- 类型:Function -- 默认值:null -- 作用:图片插入之后 -- 参数: - - {Object} [item]]: 图片地址、宽高、位置等信息 - ------------- -### imageUpdateBefore -(TODO) -- 类型:Function -- 默认值:null -- 作用:图片修改之前,修改的内容包括宽高、位置、裁剪等操作 -- 参数: - - {Object} [item]]: 图片地址、宽高、位置等信息 - ------------- -### imageUpdateAfter -(TODO) -- 类型:Function -- 默认值:null -- 作用:图片修改之后,修改的内容包括宽高、位置、裁剪等操作 -- 参数: - - {Object} [oldItem]]: 修改前图片地址、宽高、位置等信息 - - {Object} [newItem]]: 修改后图片地址、宽高、位置等信息 - ------------- -### imageDeleteBefore -(TODO) -- 类型:Function -- 默认值:null -- 作用:图片删除之前 -- 参数: - - {Object} [item]]: 图片地址、宽高、位置等信息 - ------------- -### imageDeleteAfter -(TODO) -- 类型:Function -- 默认值:null -- 作用:图片删除之后 -- 参数: - - {Object} [item]]: 图片地址、宽高、位置等信息 - ------------- - -## 批注 - -### commentInsertBefore - -- 类型:Function -- 默认值:null -- 作用:插入批注之前,`return false` 则不插入批注 -- 参数: - - {Number} [r]:单元格所在行号 - - {Number} [c]:单元格所在列号 - ------------- -### commentInsertAfter - -- 类型:Function -- 默认值:null -- 作用:插入批注之后 -- 参数: - - {Number} [r]:单元格所在行号 - - {Number} [c]:单元格所在列号 - - {Object} [cell]: 被插入批注所在的单元格信息,如:`{ r:0,c:2,v:{m:'233',v:'233'}}`,包含批注信息 - ------------- -### commentDeleteBefore - -- 类型:Function -- 默认值:null -- 作用:删除批注之前,`return false` 则不删除批注 -- 参数: - - {Number} [r]:单元格所在行号 - - {Number} [c]:单元格所在列号 - - {Object} [cell]: 要删除的批注所在的单元格信息,如:`{ r:0,c:2,v:{m:'233',v:'233'}}`,可以看到批注信息 - ------------- -### commentDeleteAfter - -- 类型:Function -- 默认值:null -- 作用:删除批注之后 -- 参数: - - {Number} [r]:单元格所在行号 - - {Number} [c]:单元格所在列号 - - {Object} [cell]: 被删除批注所在的单元格信息,如:`{ r:0,c:2,v:{m:'233',v:'233'}}`,可以看到批注已被删除 - ------------- -### commentUpdateBefore - -- 类型:Function -- 默认值:null -- 作用:修改批注之前,`return false` 则不修改批注 -- 参数: - - {Number} [r]:单元格所在行号 - - {Number} [c]:单元格所在列号 - - {String} [value]: 新的批注内容 - ------------- -### commentUpdateAfter - -- 类型:Function -- 默认值:null -- 作用:修改批注之后 -- 参数: - - {Number} [r]:单元格所在行号 - - {Number} [c]:单元格所在列号 - - {Object} [oldCell]: 修改前批注所在的单元格信息,如:`{ r:0,c:2,v:{m:'233',v:'233'}}` - - {Object} [newCell]: 修改后批注所在的单元格信息,如:`{ r:0,c:2,v:{m:'233',v:'233'}}` - ------------- - -## 数据透视表 - -### pivotTableEditBefore -(TODO) -- 类型:Function -- 默认值:null -- 作用:修改数据透视表之前,操作如:拖动字段等 -- 参数: - - {Object} [sheet]: 数据透视表所在sheet页配置 - ------------- -### pivotTableEditAfter -(TODO) -- 类型:Function -- 默认值:null -- 作用:修改数据透视表之后,操作如:拖动字段等 -- 参数: - - {Object} [oldSheet]: 修改前数据透视表所在sheet页配置 - - {Object} [newSheet]: 修改后数据透视表所在sheet页配置 - ------------- - -## 冻结 - -### frozenCreateBefore -(TODO) -- 类型:Function -- 默认值:null -- 作用:设置冻结前 -- 参数: - - {Object} [frozen]: 冻结类型信息 - ------------- -### frozenCreateAfter -(TODO) -- 类型:Function -- 默认值:null -- 作用:设置冻结后 -- 参数: - - {Object} [frozen]: 冻结类型信息 - ------------- -### frozenCancelBefore -(TODO) -- 类型:Function -- 默认值:null -- 作用:取消冻结前 -- 参数: - - {Object} [frozen]: 冻结类型信息 - ------------- -### frozenCancelAfter -(TODO) -- 类型:Function -- 默认值:null -- 作用:取消冻结后 -- 参数: - - {Object} [frozen]: 冻结类型信息 - ------------- - -## 打印 - -### printBefore -(TODO) -- 类型:Function -- 默认值:null -- 作用:打印前 - ------------- - -## 旧版钩子函数 - -### fireMousedown - -- 类型:Function -- 默认值:null -- 作用:单元格数据下钻自定义方法,注意此钩子函数是挂载在options下:`options.fireMousedown` - ------------- - -## 分页器 - -### onTogglePager - -- 类型:Function -- 默认值:null -- 作用:点击分页按钮回调函数,返回当前页码,具体参数参照[sPage backFun](https://github.com/jvbei/sPage) -- 参数: - - {Object} [page]: 返回当前分页对象 - ------------- \ No newline at end of file +# 整体配置 + +## 基础结构 + +初始化表格时,可以设置一个对象配置串`options`来自定义配置Luckysheet表格。 + +如下是一个简洁的配置案例: + +```js +// 配置项 +const options = { + container: 'luckysheet', // 设定DOM容器的id + title: 'Luckysheet Demo', // 设定表格名称 + lang: 'zh' // 设定表格语言 + + // 更多其他设置... +} + +// 初始化表格 +luckysheet.create(options) +``` + +这里的`options`配置项会作用于整个表格,特别的,单个sheet的配置则需要在`options.data`数组中,分别设置对应更详细的参数,参考[工作表配置](/zh/guide/sheet.html) + +针对个性化的需求,除了允许配置信息栏([showinfobar](#showinfobar))、工具栏([showtoolbar](#showtoolbar))、底部sheet页([showsheetbar](#showsheetbar))、底部计数栏([showstatisticBar](#showstatisticBar))之外, +Luckysheet开放了更细致的自定义配置选项,分别有 + +- 自定义工具栏([showtoolbarConfig](#showtoolbarConfig)) +- 自定义底部sheet页([showsheetbarConfig](#showsheetbarConfig)) +- 自定义计数栏([showstatisticBarConfig](#showstatisticBarConfig)) +- 自定义单元格右键菜单([cellRightClickConfig](#cellRightClickConfig)) +- 自定义底部sheet页右击菜单([sheetRightClickConfig](#sheetRightClickConfig)) + + +## 配置项 + +以下为所有支持的设置参数 + +- 容器ID [container](#container) +- 工作簿名称 [title](#title) +- 语言 [lang](#lang) +- 唯一key [gridKey](#gridKey) +- 加载整个工作簿 [loadUrl](#loadUrl) +- 加载其它页celldata [loadSheetUrl](#loadSheetUrl) +- 允许更新 [allowUpdate](#allowUpdate) +- 更新地址 [updateUrl](#updateUrl) +- 缩略图更新地址 [updateImageUrl](#updateImageUrl) +- 工作表配置 [data](#data) +- 插件 [plugins](#plugins) +- 列数 [column](#column) +- 行数 [row](#row) +- 亿万格式 [autoFormatw](#autoFormatw) +- 精度 [accuracy](#accuracy) +- 允许复制 [allowCopy](#allowCopy) +- 工具栏 [showtoolbar](#showtoolbar) +- 自定义工具栏[showtoolbarConfig](#showtoolbarConfig) +- 信息栏 [showinfobar](#showinfobar) +- 底部sheet页 [showsheetbar](#showsheetbar) +- 自定义底部sheet页 [showsheetbarConfig](#showsheetbarConfig) +- 底部计数栏 [showstatisticBar](#showstatisticBar) +- 自定义计数栏 [showstatisticBarConfig](#showstatisticBarConfig) +- 允许添加行 [enableAddRow](#enableAddRow) +- 默认添加行的数目 [addRowCount](#addRowCount) +- 允许回到顶部 [enableAddBackTop](#enableAddBackTop) +- 用户信息 [userInfo](#userInfo) +- 用户信息菜单 [userMenuItem](#userMenuItem) +- 返回按钮链接 [myFolderUrl](#myFolderUrl) +- 比例 [devicePixelRatio](#devicePixelRatio) +- 功能按钮 [functionButton](#functionButton) +- 自动缩进界面 [showConfigWindowResize](#showConfigWindowResize) +- 刷新公式 [forceCalculation](#forceCalculation) +- 自定义单元格右键菜单 [cellRightClickConfig](#cellRightClickConfig) +- 自定义sheet页右击菜单 [sheetRightClickConfig](#sheetRightClickConfig) +- 行标题区域的宽度 [rowHeaderWidth](#rowHeaderWidth) +- 列标题区域的高度 [columnHeaderHeight](#columnHeaderHeight) +- 是否显示公式栏 [sheetFormulaBar](#sheetFormulaBar) +- 初始化默认字体大小 [defaultFontSize](#defaultFontSize) +- 是否限制工作表名长度 [limitSheetNameLength](#limitSheetNameLength) +- 默认允许工作表名的最大长度 [defaultSheetNameMaxLength](#defaultSheetNameMaxLength) +- 分页器 [pager](#pager) +- 自定义图片上传 [uploadImage](#uploadImage) +- 自定义图片地址处理 [imageUrlHandle](#imageUrlHandle) + +### container +- 类型:String +- 默认值:"luckysheet" +- 作用:容器的ID + +------------ +### title +- 类型:String +- 默认值:"Luckysheet Demo" +- 作用:工作簿名称 + +------------ +### lang +- 类型:String +- 默认值:"en" +- 作用:国际化设置,允许设置表格的语言,支持简体中文("zh")、英文("en")、繁体中文("zh_tw")和西班牙文("es") + +------------ +### gridKey +- 类型:String +- 默认值:"" +- 作用:表格唯一标识符 + +------------ +### loadUrl +- 类型:String +- 默认值:"" +- 作用:配置`loadUrl`接口地址,加载所有工作表的配置,并包含当前页单元格数据,与`loadSheetUrl`配合使用。参数为`gridKey`(表格主键)。 + + 源码的请求写法是: + ```js + $.post(loadurl, {"gridKey" : server.gridKey}, function (d) {}) + ``` + > 参见源码 [`src/core.js`](https://github.com/mengshukeji/Luckysheet/blob/master/src/core.js) + + Luckysheet会通过ajax请求(POST)整个表格的数据,默认载入status为1的sheet数据中的`celldata`,其余的sheet载入除`celldata`字段外的所有配置字段。特别是在数据量大的时候,`loadUrl`只负责当前页单元格数据,配置`loadSheetUrl`作为其它工作表异步加载单元格数据的接口,可以提高性能。 + + 一个合格的接口返回的json字符串数据为: + + ```js + "[ + //status为1的sheet页,重点是需要提供初始化的数据celldata + { + "name": "Cell", + "index": "sheet_01", + "order": 0, + "status": 1, + "celldata": [{"r":0,"c":0,"v":{"v":1,"m":"1","ct":{"fa":"General","t":"n"}}}] + }, + //其他status为0的sheet页,无需提供celldata,只需要配置项即可 + { + "name": "Data", + "index": "sheet_02", + "order": 1, + "status": 0 + }, + { + "name": "Picture", + "index": "sheet_03", + "order": 2, + "status": 0 + } + ]" + ``` + 有几个注意点 + + 这是一个字符串,类似于JSON.stringify()处理后的json数据,压缩后的数据便于传输 + + loadUrl是一个post请求,也是为了支持大数据量 + + 考虑到一些公式、图表及数据透视表会引用其他sheet的数据,所以前台会加一个判断,如果该当前sheet引用了其他sheet的数据则会通过`loadSheetUrl`配置的接口地址请求数据,把引用到的sheet的数据一并补全,而不用等切换到其它页的时候再请求 + + 当数据量小的时候,也可以不用Luckysheet提供的此接口,直接使用[data](#data)参数可以提前准备好所有表格数据用于初始化 + +------------ +### loadSheetUrl +- 类型:String +- 默认值:"" +- 作用:配置`loadSheetUrl`接口地址,用于异步加载其它单元格数据。参数为`gridKey`(表格主键) 和 `index`(sheet主键合集,格式为`["sheet_01","sheet_02","sheet_03"]`)。 + + 源码的请求写法是: + ```js + $.post(loadSheetUrl, {"gridKey" : server.gridKey, "index": sheetindex.join(",")}, function (d) {}) + ``` + > 参见源码 [`src/controllers/sheetmanage.js`](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/sheetmanage.js) + + 返回的数据为sheet的`celldata`字段数据集合。 + + 一个合格的接口返回的json字符串数据为: + + ```js + "{ + "sheet_01": [ + { + "r": 0, + "c": 0, + "v": { "v": 1, "m": "1", "ct": { "fa": "General", "t": "n" } } + } + ], + "sheet_02": [ + { + "r": 0, + "c": 0, + "v": { "v": 1, "m": "1", "ct": { "fa": "General", "t": "n" } } + } + ], + "sheet_03": [ + { + "r": 0, + "c": 0, + "v": { "v": 1, "m": "1", "ct": { "fa": "General", "t": "n" } } + } + ] + }" + ``` + 同`loadUrl`类似,`loadSheetUrl`也要注意这几点: + + 这是一个字符串格式数据 + + 这是一个post请求 + + 这个接口会在两种情况下自动调用,一是在`loadUrl`加载的当前页数据时发现当前工作表引用了其他工作表,二是切换到一个未曾加载过数据的工作表时 + +------------ +### allowUpdate +- 类型:Boolean +- 默认值:false +- 作用:是否允许操作表格后的后台更新,与`updateUrl`配合使用。如果要开启共享编辑,此参数必须设置为`true`。 + +------------ +### updateUrl +- 类型:String +- 默认值:"" +- 作用:操作表格后,实时保存数据的websocket地址,此接口也是共享编辑的接口地址。 + + 有个注意点,要想开启共享编辑,必须满足以下3个条件: + + `allowUpdate`为`true` + + 配置了`loadUrl` + + 配置了`updateUrl` + + 注意,发送给后端的数据默认是经过pako压缩过后的。后台拿到数据需要先解压。 + + 通过共享编辑功能,可以实现Luckysheet实时保存数据和多人同步数据,每一次操作都会发送不同的参数到后台,具体的操作类型和参数参见[表格操作](/zh/guide/operate.html) + +------------ +### updateImageUrl +- 类型:String +- 默认值:"" +- 作用:缩略图的更新地址 + +------------ +### data +- 类型:Array +- 默认值:[{ "name": "Sheet1", color: "", "status": "1", "order": "0", "data": [], "config": {}, "index":0 }, { "name": "Sheet2", color: "", "status": "0", "order": "1", "data": [], "config": {}, "index":1 }, { "name": "Sheet3", color: "", "status": "0", "order": "2", "data": [], "config": {}, "index":2 }] +- 作用:当未配置`loadUrl`和`loadSheetUrl`的时候,需要手动配置传入整个客户端所有sheet数据`[shee1, sheet2, sheet3]`,详细参数设置参见[工作表配置](/zh/guide/sheet.html) + +------------ +### plugins +- 类型:Array +- 默认值:[] +- 作用:配置插件,支持图表:"chart" + +------------ +### column +- 类型:Number +- 默认值:60 +- 作用:空表格默认的列数量 + +------------ +### row +- 类型:Number +- 默认值:84 +- 作用:空表格默认的行数据量 + +------------ +### autoFormatw +- 类型:Boolean +- 默认值:false +- 作用:自动格式化超过4位数的数字为‘亿万格式’,例:true or "true" or "TRUE" + +------------ +### accuracy +- 类型:Number +- 默认值:undefined +- 作用:设置精度,小数点后的位数。传参数为数字或数字字符串,例: "0" 或 0 + +------------ +### allowCopy +- 类型:Boolean +- 默认值:true +- 作用:是否允许拷贝 + +------------ +### showtoolbar +- 类型:Boolean +- 默认值:true +- 作用:是否显示工具栏 + +------------ +### showtoolbarConfig + +- 类型:Object +- 默认值:{} +- 作用:自定义配置工具栏,可以与showtoolbar配合使用,`showtoolbarConfig`拥有更高的优先级。 +- 格式1: + ```json + { + undoRedo: false, //撤销重做,注意撤消重做是两个按钮,由这一个配置决定显示还是隐藏 + paintFormat: false, //格式刷 + currencyFormat: false, //货币格式 + percentageFormat: false, //百分比格式 + numberDecrease: false, // '减少小数位数' + numberIncrease: false, // '增加小数位数 + moreFormats: false, // '更多格式' + font: false, // '字体' + fontSize: false, // '字号大小' + bold: false, // '粗体 (Ctrl+B)' + italic: false, // '斜体 (Ctrl+I)' + strikethrough: false, // '删除线 (Alt+Shift+5)' + underline: false, // '下划线 (Alt+Shift+6)' + textColor: false, // '文本颜色' + fillColor: false, // '单元格颜色' + border: false, // '边框' + mergeCell: false, // '合并单元格' + horizontalAlignMode: false, // '水平对齐方式' + verticalAlignMode: false, // '垂直对齐方式' + textWrapMode: false, // '换行方式' + textRotateMode: false, // '文本旋转方式' + image:false, // '插入图片' + link:false, // '插入链接' + chart: false, // '图表'(图标隐藏,但是如果配置了chart插件,右击仍然可以新建图表) + postil: false, //'批注' + pivotTable: false, //'数据透视表' + function: false, // '公式' + frozenMode: false, // '冻结方式' + sortAndFilter: false, // '排序和筛选' + conditionalFormat: false, // '条件格式' + dataVerification: false, // '数据验证' + splitColumn: false, // '分列' + screenshot: false, // '截图' + findAndReplace: false, // '查找替换' + protection:false, // '工作表保护' + print:false, // '打印' + } + ``` +- 示例1: + - 仅显示撤消重做和字体按钮: + + ```js + //options + { + showtoolbar: false, + showtoolbarConfig:{ + undoRedo: true, + font: true, + } + } + ``` + - 仅隐藏图片和打印按钮: + + ```js + //options + { + showtoolbar: true, // 默认就是true,可以不设置 + showtoolbarConfig:{ + image: false, + print: false, + } + } + ``` +- 格式2: + 对象格式可以很方便控制显示隐藏,使用数组形式可轻松控制按钮顺序和位置, 以下为工具栏按钮和分隔符的默认配置。 + ```json + [ + "undo", "redo", "paintFormat", "|", + "currencyFormat", "percentageFormat", "numberDecrease", "numberIncrease", "moreFormats", "|", + "font", "|", + "fontSize", "|", + "bold", "italic", "strikethrough", "underline", "textColor", "|", + "fillColor", "border", "mergeCell", "|", + "horizontalAlignMode", "verticalAlignMode", "textWrapMode", "textRotateMode", "|", + "image", "link", "chart", "postil", "pivotTable", "|", + "function", "frozenMode", "sortAndFilter", "conditionalFormat", "dataVerification", "splitColumn", "screenshot", "findAndReplace", "protection", "print" + ] + ``` +- 示例2: + - 自定义按钮和位置, 保护放到最前面, 只要字体样式相关按钮。 + ```json + { + "showtoolbarConfig": [ + "protection", "|", + "font", "|", + "fontSize", "|", + "bold", "italic", "strikethrough", "underline", "textColor" + ] + } + ``` +------------ +### showinfobar +- 类型:Boolean +- 默认值:true +- 作用:是否显示顶部信息栏 + +------------ +### showsheetbar +- 类型:Boolean +- 默认值:true +- 作用:是否显示底部sheet页按钮 + +------------ +### showsheetbarConfig + +- 类型:Object +- 默认值:{} +- 作用:自定义配置底部sheet页按钮,可以与showsheetbar配合使用,`showsheetbarConfig`拥有更高的优先级。 +- 格式: + ```json + { + add: false, //新增sheet + menu: false, //sheet管理菜单 + sheet: false //sheet页显示 + } + ``` +- 示例: + - 仅显示新增sheet按钮: + + ```js + //options + { + showsheetbar: false, + showsheetbarConfig:{ + add: true, + } + } + ``` + - 仅隐藏新增sheet和管理按钮: + + ```js + //options + { + showsheetbar: true, // 默认就是true,可以不设置 + showsheetbarConfig:{ + add: false, + menu: false, + } + } + ``` + +------------ +### showstatisticBar +- 类型:Boolean +- 默认值:true +- 作用:是否显示底部计数栏 + +------------ +### showstatisticBarConfig + +- 类型:Object +- 默认值:{} +- 作用:自定义配置底部计数栏,可以与showstatisticBar配合使用,`showstatisticBarConfig`拥有更高的优先级。 +- 格式: + ```json + { + count: false, // 计数栏 + view: false, // 打印视图 + zoom: false, // 缩放 + } + ``` +- 示例: + - 仅显示缩放按钮: + + ```js + //options + { + showstatisticBar: false, + showstatisticBarConfig:{ + zoom: true, + } + } + ``` + - 仅隐藏打印视图按钮: + + ```js + //options + { + showstatisticBar: true, // 默认就是true,可以不设置 + showstatisticBarConfig:{ + view: false, + } + } + ``` + +------------ +### enableAddRow +- 类型:Boolean +- 默认值:true +- 作用:允许添加行 + +### addRowCount +- Number +- 默认值:100 +- 作用:配置新增行处默认新增的行数目 + +------------ +### enableAddBackTop +- 类型:Boolean +- 默认值:true +- 作用:允许回到顶部 + +------------ +### userInfo +- 类型:String | Boolean | Object +- 默认值:false +- 作用:右上角的用户信息展示样式,支持以下三种形式 + 1. HTML模板字符串,如: + + ```js + options:{ + // 其他配置 + userInfo:' Lucky', + } + ``` + + 或者一个普通字符串,如: + + ```js + options:{ + // 其他配置 + userInfo:'Lucky', + } + ``` + + 2. Boolean类型,如: + + `false`:不展示 + ```js + options:{ + // 其他配置 + userInfo:false, // 不展示用户信息 + } + + ``` + `true`:展示默认的字符串 + ```js + options:{ + // 其他配置 + userInfo:true, // 展示HTML:' Lucky' + } + + ``` + 3. 对象格式,设置 `userImage`:用户头像地址 和 `userName`:用户名,如: + ```js + options:{ + // 其他配置 + userInfo: { + userImage:'https://cdn.jsdelivr.net/npm/luckyresources@1.0.3/assets/img/logo/logo.png', // 头像url + userName:'Lucky' // 用户名 + } + } + ``` + + 4. 注意,设置为`undefined`或者不设置,同设置`false` + +------------ +### userMenuItem +- 类型:Array +- 默认值:`[{url:"www.baidu.com", "icon":'', "name":"我的表格"}, {url:"www.baidu.com", "icon":'', "name":"退出登陆"}]` +- 作用:点击右上角的用户信息弹出的菜单 + +------------ +### myFolderUrl +- 类型:String +- 默认值:"www.baidu.com" +- 作用:左上角<返回按钮的链接 + +------------ +### devicePixelRatio +- 类型:Number +- 默认值:window.devicePixelRatio +- 作用:设备比例,比例越大表格分辨率越高 + +------------ +### functionButton +- 类型:String +- 默认值:"" +- 作用:右上角功能按钮,例如`' '` + +------------ +### showConfigWindowResize +- 类型:Boolean +- 默认值:true +- 作用:图表或数据透视表的配置会在右侧弹出,设置弹出后表格是否会自动缩进 + +------------ +### forceCalculation +- 类型:Boolean +- 默认值:false +- 作用:强制刷新公式。 + + 默认情况下,为提高加载性能,表格初始化的时候,含有公式的单元格会默认直接取得`v`和`m`作为数据结果,而不做实时计算。 + + 如果公式关联到的单元格数据已经变化,或者公式所在的单元格数据结果改变了,则会导致关联单元格应该计算得出的结果和实际显示结果不一致,这是就需要开启公式刷新,保证数据实时计算的准确性。 + + ⚠️提醒,公式较多时会有性能问题,慎用! + +------------ +### cellRightClickConfig + +- 类型:Object +- 默认值:{} +- 作用:自定义配置单元格右击菜单 +- 格式: + ```json + { + copy: false, // 复制 + copyAs: false, // 复制为 + paste: false, // 粘贴 + insertRow: false, // 插入行 + insertColumn: false, // 插入列 + deleteRow: false, // 删除选中行 + deleteColumn: false, // 删除选中列 + deleteCell: false, // 删除单元格 + hideRow: false, // 隐藏选中行和显示选中行 + hideColumn: false, // 隐藏选中列和显示选中列 + rowHeight: false, // 行高 + columnWidth: false, // 列宽 + clear: false, // 清除内容 + matrix: false, // 矩阵操作选区 + sort: false, // 排序选区 + filter: false, // 筛选选区 + chart: false, // 图表生成 + image: false, // 插入图片 + link: false, // 插入链接 + data: false, // 数据验证 + cellFormat: false // 设置单元格格式 + } + ``` + 除了单元格,这里的配置还包括行标题右击菜单、列标题右击菜单和列标题下拉箭头的菜单,具体配置关系如下表格: + + |右击菜单配置|单元格|行标题|列标题|列箭头| + | ------------ | ------------ | ------------ | ------------ | ------------ | + |copy|复制|复制|复制|复制| + |copyAs|复制为|复制为|复制为|复制为| + |paste|粘贴|粘贴|粘贴|粘贴| + |insertRow|插入行|向上增加N行,向下增加N行|-|-| + |insertColumn|插入列|-|向左增加N列,向右增加N列|向左增加N列,向右增加N列| + |deleteRow|删除选中行|删除选中行|-|-| + |deleteColumn|删除选中列|-|删除选中列|删除选中列| + |deleteCell|删除单元格|-|-|-| + |hideRow|-|隐藏选中行和显示选中行|-|-| + |hideColumn|-|-|隐藏选中列和显示选中列|隐藏选中列和显示选中列| + |rowHeight|-|行高|-|-| + |columnWidth|-|-|列宽|列宽| + |clear|清除内容|清除内容|清除内容|-| + |matrix|矩阵操作选区|矩阵操作选区|矩阵操作选区|-| + |sort|排序选区|排序选区|排序选区|A-Z排序和Z-A排序| + |filter|筛选选区|筛选选区|筛选选区|-| + |chart|图表生成|图表生成|图表生成|-| + |image|插入图片|插入图片|插入图片|-| + |link|插入链接|插入链接|插入链接|-| + |data|数据验证|数据验证|数据验证|-| + |cellFormat|设置单元格格式|设置单元格格式|设置单元格格式|-| + + +------------ +### sheetRightClickConfig + +- 类型:Object +- 默认值:{} +- 作用:自定义配置sheet页右击菜单 +- 格式: + ```json + { + delete: false, // 删除 + copy: false, // 复制 + rename: false, //重命名 + color: false, //更改颜色 + hide: false, //隐藏,取消隐藏 + move: false, //向左移,向右移 + } + +------------ +### rowHeaderWidth + +- 类型:Number +- 默认值:46 +- 作用:行标题区域的宽度,如果设置为0,则表示隐藏行标题 + +------------ +### columnHeaderHeight + +- 类型:Number +- 默认值:20 +- 作用:列标题区域的高度,如果设置为0,则表示隐藏列标题 + +------------ +### sheetFormulaBar + +- 类型:Boolean +- 默认值:true +- 作用:是否显示公式栏 + +------------ +### defaultFontSize +- 类型:Number +- 默认值:11 +- 作用:初始化默认字体大小 + +------------ + +### limitSheetNameLength +- 类型:Boolean +- 默认值:true +- 作用:工作表重命名等场景下是否限制工作表名称的长度 + +------------ + +### defaultSheetNameMaxLength +- 类型:Number +- 默认值:31 +- 作用:默认允许的工作表名最大长度 + +------------ + +### pager +- 类型:Object +- 默认值:null +- 作用:分页器按钮设置,初版方案是直接使用的jquery插件 [sPage](https://github.com/jvbei/sPage) + 点击分页按钮会触发钩子函数 `onTogglePager`,返回当前页码,同`sPage`的`backFun`方法,此分页器设置只负责UI部分,具体切换分页后的数据请求和数据渲染,请在`onTogglePager`钩子行数里自定义处理。 + ```js + pager: { + pageIndex: 1, //当前页码,必填 + total: 100, //数据总条数,必填 + selectOption: [10, 20, 30], // 选择每页的行数, + pageSize: 10, //每页显示多少条数据,默认10条 + showTotal: false, // 是否显示总数,默认关闭:false + showSkip: false, //是否显示跳页,默认关闭:false + showPN: false, //是否显示上下翻页,默认开启:true + prevPage: '', //上翻页文字描述,默认"上一页" + nextPage: '', //下翻页文字描述,默认"下一页" + totalTxt: '', // 数据总条数文字描述,默认"总共:{total}" + } + ``` + +### uploadImage + +用于自定义图片的上传,默认情况下,插入的图片是以base64的形式放入sheet数据中,如果需要单独上传图片,仅在sheet中引用图片地址可使用此配置。 + +- 类型: `function (file) => Promise(imgUrl)`,接受file对象,返回Promise,值为上传完成的图片url +- 默认值: `undefined` + +:::details 查看示例配置 + +```js +{ + uploadImage: function (file) { + return new Promise(function (resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open('POST', 'http://192.168.210.159/miniuiServer/imageUploader.php'); + + // 额外的请求头 + var headers = {}; + if (headers) { + Object.keys(headers).forEach(function (k) { + xhr.setRequestHeader(k, headers[k]); + }); + } + var data = new FormData(); + // 要上传的图片文件 + data.append('file', file, file.name || ''); + + xhr.send(data); + xhr.onreadystatechange = function () { + if (xhr.readyState === 4) { + if (xhr.status === 200) { + var res = JSON.parse(xhr.responseText); + var url = res.downloadUrl; + if (url) { + resolve(url); // 给上传的后的地址 + } else { + reject('image upload error'); + } + } else { + reject('image upload error'); + } + } + }; + }); + } +} + +``` + +::: + +### imageUrlHandle + +图片上传的路径处理函数,和 [uploadImage](#uploadImage) 相关,一般只有使用自定义图片上传才需要此配置。 + +- 类型: `function (string) => string`,接受原始路径,返回新路径 +- 默认值: `undefined` +- 作用,处理图片显示时的路径。 + 如上传返回地址为接口地址,如: `rest/attach/[fileguid]`, 则需要处理为 `http://localhost:8080/xxx/rest/attach/[fileguid]` 才能显示,但将前面域名信息写入数据,后续使用可能会有问题,因此可使用此方法处理路径,全路径仅在展示使用,数据内仅存储 `rest/attach/[fileguid]` + +```js +{ + // 处理上传图片的地址 + imageUrlHandle: function (url) { + // 已经是 // http data 开头则不处理 + if (/^(?:\/\/|(?:http|https|data):)/i.test(url)) { + return url; + } + return location.origin + url; + } +} +``` + +------------ + +## 钩子函数 + +钩子函数应用于二次开发时,会在各个常用鼠标或者键盘操作时植入钩子,调用开发者传入的函数,起到扩展Luckysheet功能的作用。 + +钩子函数统一配置在`options.hook`下,可以分别针对单元格、sheet页、表格创建配置hook。 + +> 使用案例可参考源码 [src/index.html](https://github.com/mengshukeji/Luckysheet/blob/master/src/index.html) + +## 单元格 + +### cellEditBefore + +- 类型:Function +- 默认值:null +- 作用:进入单元格编辑模式之前触发。在选中了某个单元格且在非编辑状态下,通常有以下三种常规方法触发进入编辑模式 + + - 双击单元格 + - 敲Enter键 + - 使用API:enterEditMode + +- 参数: + - {Array} [range]: 当前选区范围 + +------------ +### cellUpdateBefore + +- 类型:Function +- 默认值:null +- 作用:更新这个单元格值之前触发,`return false` 则不执行后续的更新。在编辑状态下修改了单元格之后,退出编辑模式并进行数据更新之前触发这个钩子。 +- 参数: + - {Number} [r]: 单元格所在行数 + - {Number} [c]: 单元格所在列数 + - {Object | String | Number} [value]: 要修改的单元格内容 + - {Boolean} [isRefresh]: 是否刷新整个表格 + +------------ +### cellUpdated + +- 类型:Function +- 默认值:null +- 作用:更新这个单元格后触发 +- 参数: + - {Number} [r]: 单元格所在行数 + - {Number} [c]: 单元格所在列数 + - {Object} [oldValue]: 修改前的单元格对象 + - {Object} [newValue]: 修改后的单元格对象 + - {Boolean} [isRefresh]: 是否刷新整个表格 + +------------ +### cellRenderBefore + +- 类型:Function +- 默认值:null +- 作用:单元格渲染前触发,`return false` 则不渲染该单元格 +- 参数: + - {Object} [cell]:单元格对象 + - {Object} [position]: + + {Number} [r]:单元格所在行号 + + {Number} [c]:单元格所在列号 + + {Number} [start_r]:单元格左上角的垂直坐标 + + {Number} [start_c]:单元格左上角的水平坐标 + + {Number} [end_r]:单元格右下角的垂直坐标 + + {Number} [end_c]:单元格右下角的水平坐标 + - {Object} [sheet]:当前sheet对象 + - {Object} [ctx]: 当前画布的context + +------------ +### cellRenderAfter + +- 类型:Function +- 默认值:null +- 作用:单元格渲染结束后触发,`return false` 则不渲染该单元格 +- 参数: + - {Object} [cell]:单元格对象 + - {Object} [position]: + + {Number} [r]:单元格所在行号 + + {Number} [c]:单元格所在列号 + + {Number} [start_r]:单元格左上角的垂直坐标 + + {Number} [start_c]:单元格左上角的水平坐标 + + {Number} [end_r]:单元格右下角的垂直坐标 + + {Number} [end_c]:单元格右下角的水平坐标 + - {Object} [sheet]:当前sheet对象 + - {Object} [ctx]: 当前画布的context + +- 示例: + + 一个在D1单元格的左上角和右下角分别绘制两张图的案例 + :::::: details + ```js + luckysheet.create({ + hook: { + cellRenderAfter: function (cell, position, sheetFile, ctx) { + var r = position.r; + var c = position.c; + if (r === 0 && c === 3) { // 指定处理D1单元格 + if (!window.storeUserImage) { + window.storeUserImage = {} + } + + if (!window.storeUserImage[r + '_' + c]) { + window.storeUserImage[r + '_' + c] = {} + } + + var img = null; + var imgRight = null; + + if (window.storeUserImage[r + '_' + c].image && window.storeUserImage[r + '_' + c].imgRight) { + + // 加载过直接取 + img = window.storeUserImage[r + '_' + c].image; + imgRight = window.storeUserImage[r + '_' + c].imgRight; + + } else { + + img = new Image(); + imgRight = new Image(); + + img.src = 'https://www.dogedoge.com/favicon/developer.mozilla.org.ico'; + imgRight.src = 'https://www.dogedoge.com/static/icons/twemoji/svg/1f637.svg'; + + // 图片缓存到内存,下次直接取,不用再重新加载 + window.storeUserImage[r + '_' + c].image = img; + window.storeUserImage[r + '_' + c].imgRight = imgRight; + + } + + + if (img.complete) { // 已经加载完成的直接渲染 + ctx.drawImage(img, position.start_c, position.start_r, 10, 10); + } else { + img.onload = function () { + ctx.drawImage(img, position.start_c, position.start_r, 10, 10); + } + + } + + if (imgRight.complete) { + ctx.drawImage(imgRight, position.end_c - 10, position.end_r - 10, 10, 10); + } else { + + imgRight.onload = function () { + ctx.drawImage(imgRight, position.end_c - 10, position.end_r - 10, 10, 10); + } + } + + } + } + } + }) + ``` + ::: + +------------ +### cellAllRenderBefore + +- 类型:Function +- 默认值:null +- 作用:所有单元格渲染之前执行的方法。在内部,这个方法加在了`luckysheetDrawMain`渲染表格之前。 +- 参数: + - {Object} [data]: 当前工作表二维数组数据 + - {Object} [sheet]:当前sheet对象 + - {Object} [ctx]: 当前画布的context + +------------ +### rowTitleCellRenderBefore + +- 类型:Function +- 默认值:null +- 作用:行标题单元格渲染前触发,`return false` 则不渲染行标题 +- 参数: + - {String} [rowNum]:行号 + - {Object} [position]: + + {Number} [r]:单元格所在行号 + + {Number} [top]:单元格左上角的垂直坐标 + + {Number} [width]:单元格宽度 + + {Number} [height]:单元格高度 + - {Object} [ctx]: 当前画布的context + +------------ +### rowTitleCellRenderAfter + +- 类型:Function +- 默认值:null +- 作用:行标题单元格渲染后触发,`return false` 则不渲染行标题 +- 参数: + - {String} [rowNum]:行号 + - {Object} [position]: + + {Number} [r]:单元格所在行号 + + {Number} [top]:单元格左上角的垂直坐标 + + {Number} [width]:单元格宽度 + + {Number} [height]:单元格高度 + - {Object} [ctx]: 当前画布的context + +------------ +### columnTitleCellRenderBefore + +- 类型:Function +- 默认值:null +- 作用:列标题单元格渲染前触发,`return false` 则不渲染列标题 +- 参数: + - {Object} [columnAbc]:列标题字符 + - {Object} [position]: + - {Number} [c]:单元格所在列号 + - {Number} [left]:单元格左上角的水平坐标 + - {Number} [width]:单元格宽度 + - {Number} [height]:单元格高度 + - {Object} [ctx]: 当前画布的context + +------------ +### columnTitleCellRenderAfter + +- 类型:Function +- 默认值:null +- 作用:列标题单元格渲染后触发,`return false` 则不渲染列标题 +- 参数: + - {Object} [columnAbc]:列标题字符 + - {Object} [position]: + - {Number} [c]:单元格所在列号 + - {Number} [left]:单元格左上角的水平坐标 + - {Number} [width]:单元格宽度 + - {Number} [height]:单元格高度 + - {Object} [ctx]: 当前画布的context + +------------ + +## 鼠标钩子 + +### cellMousedownBefore + +- 类型:Function +- 默认值:null +- 作用:单元格点击前的事件,`return false`则终止之后的点击操作 +- 参数: + - {Object} [cell]:单元格对象 + - {Object} [position]: + + {Number} [r]:单元格所在行号 + + {Number} [c]:单元格所在列号 + + {Number} [start_r]:单元格左上角的垂直坐标 + + {Number} [start_c]:单元格左上角的水平坐标 + + {Number} [end_r]:单元格右下角的垂直坐标 + + {Number} [end_c]:单元格右下角的水平坐标 + - {Object} [sheet]:当前sheet对象 + - {Object} [ctx]: 当前画布的context + +------------ +### cellMousedown + +- 类型:Function +- 默认值:null +- 作用:单元格点击后的事件,`return false`则终止之后的点击操作 +- 参数: + - {Object} [cell]:单元格对象 + - {Object} [position]: + + {Number} [r]:单元格所在行号 + + {Number} [c]:单元格所在列号 + + {Number} [start_r]:单元格左上角的垂直坐标 + + {Number} [start_c]:单元格左上角的水平坐标 + + {Number} [end_r]:单元格右下角的垂直坐标 + + {Number} [end_c]:单元格右下角的水平坐标 + - {Object} [sheet]:当前sheet对象 + - {Object} [ctx]: 当前画布的context + +------------ +### sheetMousemove + +- 类型:Function +- 默认值:null +- 作用:鼠标移动事件,可通过cell判断鼠标停留在哪个单元格 +- 参数: + - {Object} [cell]:单元格对象 + - {Object} [position]: + + {Number} [r]:单元格所在行号 + + {Number} [c]:单元格所在列号 + + {Number} [start_r]:单元格左上角的垂直坐标 + + {Number} [start_c]:单元格左上角的水平坐标 + + {Number} [end_r]:单元格右下角的垂直坐标 + + {Number} [end_c]:单元格右下角的水平坐标 + - {Object} [sheet]:当前sheet对象 + - {Object} [moveState]:鼠标移动状态,可判断现在鼠标操作的对象,false和true + + {Boolean} [functionResizeStatus]:工具栏拖动 + + {Boolean} [horizontalmoveState]:水平冻结分割栏拖动 + + {Boolean} [verticalmoveState]:垂直冻结分割栏拖动 + + {Boolean} [pivotTableMoveState]:数据透视表字段拖动 + + {Boolean} [sheetMoveStatus]:sheet改变你位置拖动 + + {Boolean} [scrollStatus]:鼠标触发了滚动条移动 + + {Boolean} [selectStatus]:鼠标移动框选数据 + + {Boolean} [rowsSelectedStatus]:通过行标题来选择整行操作 + + {Boolean} [colsSelectedStatus]:通过列标题来选择整列操作 + + {Boolean} [cellSelectedMove]:选框的移动 + + {Boolean} [cellSelectedExtend]:选框下拉填充 + + {Boolean} [colsChangeSize]:拖拽改变列宽 + + {Boolean} [rowsChangeSize]:拖拽改变行高 + + {Boolean} [chartMove]:图表移动 + + {Boolean} [chartResize]:图表改变大小 + + {Boolean} [rangeResize]:公式参数高亮选区的大小拖拽 + + {Boolean} [rangeMove]:公式参数高亮选区的位置拖拽 + - {Object} [ctx]: 当前画布的context + +------------ +### sheetMouseup + +- 类型:Function +- 默认值:null +- 作用:鼠标按钮释放事件,可通过cell判断鼠标停留在哪个单元格 +- 参数: + - {Object} [cell]:单元格对象 + - {Object} [position]: + + {Number} [r]:单元格所在行号 + + {Number} [c]:单元格所在列号 + + {Number} [start_r]:单元格左上角的垂直坐标 + + {Number} [start_c]:单元格左上角的水平坐标 + + {Number} [end_r]:单元格右下角的垂直坐标 + + {Number} [end_c]:单元格右下角的水平坐标 + - {Object} [sheet]:当前sheet对象 + - {Object} [moveState]:鼠标移动状态,可判断现在鼠标操作的对象,false和true + + {Boolean} [functionResizeStatus]:工具栏拖动 + + {Boolean} [horizontalmoveState]:水平冻结分割栏拖动 + + {Boolean} [verticalmoveState]:垂直冻结分割栏拖动 + + {Boolean} [pivotTableMoveState]:数据透视表字段拖动 + + {Boolean} [sheetMoveStatus]:sheet改变你位置拖动 + + {Boolean} [scrollStatus]:鼠标触发了滚动条移动 + + {Boolean} [selectStatus]:鼠标移动框选数据 + + {Boolean} [rowsSelectedStatus]:通过行标题来选择整行操作 + + {Boolean} [colsSelectedStatus]:通过列标题来选择整列操作 + + {Boolean} [cellSelectedMove]:选框的移动 + + {Boolean} [cellSelectedExtend]:选框下拉填充 + + {Boolean} [colsChangeSize]:拖拽改变列宽 + + {Boolean} [rowsChangeSize]:拖拽改变行高 + + {Boolean} [chartMove]:图表移动 + + {Boolean} [chartResize]:图表改变大小 + + {Boolean} [rangeResize]:公式参数高亮选区的大小拖拽 + + {Boolean} [rangeMove]:公式参数高亮选区的位置拖拽 + + {Boolean} [cellRightClick]:单元格右击 + + {Boolean} [rowTitleRightClick]:行标题右击 + + {Boolean} [columnTitleRightClick]:列标题右击 + + {Boolean} [sheetRightClick]:底部sheet页右击 + + {Boolean} [hyperlinkClick]:点击超链接 + - {Object} [ctx]: 当前画布的context + +------------ +### scroll + +- 类型:Function +- 默认值:null +- 作用:鼠标滚动事件 +- 参数: + - {Object} [position]: + + {Number} [scrollLeft]:横向滚动条的位置 + + {Number} [scrollTop]:垂直滚动条的位置 + + {Number} [canvasHeight]:canvas高度 + +------------ +### cellDragStop + +- 类型:Function +- 默认值:null +- 作用:鼠标拖拽文件到Luckysheet内部的结束事件 +- 参数: + - {Object} [cell]:单元格对象 + - {Object} [position]: + + {Number} [r]:单元格所在行号 + + {Number} [c]:单元格所在列号 + + {Number} [start_r]:单元格左上角的垂直坐标 + + {Number} [start_c]:单元格左上角的水平坐标 + + {Number} [end_r]:单元格右下角的垂直坐标 + + {Number} [end_c]:单元格右下角的水平坐标 + - {Object} [sheet]:当前sheet对象 + - {Object} [ctx]: 当前画布的context + - {Object} [event]: 当前事件对象 + +------------ + +## 选区操作(包括单元格) + +### rangeSelect + +- 类型:Function +- 默认值:null +- 作用:框选或者设置选区后触发 +- 参数: + - {Object} [sheet]:当前sheet对象 + - {Object | Array} [range]: 选区范围,可能为多个选区 + +------------ +### rangeMoveBefore +(TODO) +- 类型:Function +- 默认值:null +- 作用:移动选区前,包括单个单元格 +- 参数: + - {Array} [range]: 当前选区范围,只能为单个选区 + +------------ +### rangeMoveAfter +(TODO) +- 类型:Function +- 默认值:null +- 作用:移动选区后,包括单个单元格 +- 参数: + - {Array} [oldRange]: 移动前当前选区范围,只能为单个选区 + - {Array} [newRange]: 移动后当前选区范围,只能为单个选区 + +------------ +### rangeEditBefore +(TODO) +- 类型:Function +- 默认值:null +- 作用:选区修改前 +- 参数: + - {Object | Array} [range]: 选区范围,可能为多个选区 + - {Object} [data]: 选区范围所对应的数据 + +------------ +### rangeEditAfter +(TODO) +- 类型:Function +- 默认值:null +- 作用:选区修改后 +- 参数: + - {Object | Array} [range]: 选区范围,可能为多个选区 + - {Object} [oldData]: 修改前选区范围所对应的数据 + - {Object} [newData]: 修改后选区范围所对应的数据 + +------------ +### rangeCopyBefore +(TODO) +- 类型:Function +- 默认值:null +- 作用:选区复制前 +- 参数: + - {Object | Array} [range]: 选区范围,可能为多个选区 + - {Object} [data]: 选区范围所对应的数据 + +------------ +### rangeCopyAfter +(TODO) +- 类型:Function +- 默认值:null +- 作用:选区复制后 +- 参数: + - {Object | Array} [range]: 选区范围,可能为多个选区 + - {Object} [data]: 选区范围所对应的数据 + +------------ +### rangePasteBefore + +- 类型:Function +- 默认值:null +- 作用:选区粘贴前 +- 参数: + - {Object | Array} [range]: 选区范围,可能为多个选区 + - {Object} [data]: 要被粘贴的选区范围所对应的数据 + +------------ +### rangePasteAfter +(TODO) +- 类型:Function +- 默认值:null +- 作用:选区粘贴后 +- 参数: + - {Object | Array} [range]: 选区范围,可能为多个选区 + - {Object} [originData]: 要被粘贴的选区范围所对应的数据 + - {Object} [pasteData]: 要粘贴的数据 + +------------ +### rangeCutBefore +(TODO) +- 类型:Function +- 默认值:null +- 作用:选区剪切前 +- 参数: + - {Array} [range]: 选区范围,只能为单个范围 + - {Object} [data]: 要被剪切的选区范围所对应的数据 + +------------ +### rangeCutAfter +(TODO) +- 类型:Function +- 默认值:null +- 作用:选区剪切后 +- 参数: + - {Array} [range]: 选区范围,只能为单个范围 + - {Object} [data]: 被剪切的选区范围所对应的数据 + +------------ +### rangeDeleteBefore +(TODO) +- 类型:Function +- 默认值:null +- 作用:选区删除前 +- 参数: + - {Array} [range]: 选区范围,只能为单个范围 + - {Object} [data]: 要被删除的选区范围所对应的数据 + +------------ +### rangeDeleteAfter +(TODO) +- 类型:Function +- 默认值:null +- 作用:选区删除后 +- 参数: + - {Array} [range]: 选区范围,只能为单个范围 + - {Object} [data]: 被删除的选区范围所对应的数据 + +------------ +### rangeClearBefore +(TODO) +- 类型:Function +- 默认值:null +- 作用:选区清除前 +- 参数: + - {Object | Array} [range]: 选区范围,可能为多个选区 + - {Object} [data]: 要被清除的选区范围所对应的数据 + +------------ +### rangeClearAfter +(TODO) +- 类型:Function +- 默认值:null +- 作用:选区清除后 +- 参数: + - {Object | Array} [range]: 选区范围,可能为多个选区 + - {Object} [data]: 被清除的选区范围所对应的数据 + +------------ +### rangePullBefore +(TODO) +- 类型:Function +- 默认值:null +- 作用:选区下拉前 +- 参数: + - {Array} [range]: 当前选区范围,只能为单个范围 + +------------ +### rangePullAfter +(TODO) +- 类型:Function +- 默认值:null +- 作用:选区下拉后 +- 参数: + - {Array} [range]: 下拉后的选区范围,只能为单个范围 + +------------ + +## 工作表 + +### sheetCreateBefore + +- 类型:Function +- 默认值:null +- 作用:创建sheet页前触发,sheet页新建也包含数据透视表新建 + +------------ +### sheetCreateAfter + +- 类型:Function +- 默认值:null +- 作用:创建sheet页后触发,sheet页新建也包含数据透视表新建 +- 参数: + - {Object} [sheet]: 当前新创建的sheet页的配置 + +------------ +### sheetCopyBefore + +- 类型:Function +- 默认值:null +- 作用:拷贝创建sheet页前触发,sheet页新建也包含数据透视表新建 +- 参数: + - {Object} [targetSheet]: 被拷贝的sheet页配置 + - {Object} [copySheet]: 拷贝得到的sheet页的配置 +------------ +### sheetCopyAfter + +- 类型:Function +- 默认值:null +- 作用:拷贝创建sheet页后触发,sheet页新建也包含数据透视表新建 +- 参数: + - {Object} [sheet]: 当前创建的sheet页的配置 + +------------ +### sheetHideBefore + +- 类型:Function +- 默认值:null +- 作用:隐藏sheet页前触发 +- 参数: + - {Object} [sheet]: 将要隐藏的sheet页的配置 + +------------ +### sheetHideAfter + +- 类型:Function +- 默认值:null +- 作用:隐藏sheet页后触发 +- 参数: + - {Object} [sheet]: 要隐藏的sheet页的配置 + +------------ +### sheetShowBefore + +- 类型:Function +- 默认值:null +- 作用:显示sheet页前触发 +- 参数: + - {Object} [sheet]: 将要显示的sheet页的配置 + +------------ +### sheetShowAfter + +- 类型:Function +- 默认值:null +- 作用:显示sheet页后触发 +- 参数: + - {Object} [sheet]: 要显示的sheet页的配置 + +------------ +### sheetMoveBefore +(TODO) +- 类型:Function +- 默认值:null +- 作用:sheet移动前 +- 参数: + - {Number} [i]: 当前sheet页的`index` + - {Number} [order]: 当前sheet页`order` + +------------ +### sheetMoveAfter +(TODO) +- 类型:Function +- 默认值:null +- 作用:sheet移动后 +- 参数: + - {Number} [i]: 当前sheet页的`index` + - {Number} [oldOrder]: 修改前当前sheet页`order` + - {Number} [newOrder]: 修改后当前sheet页`order` + +------------ +### sheetDeleteBefore + +- 类型:Function +- 默认值:null +- 作用:sheet删除前 +- 参数: + - {Object} [sheet]: 要被删除sheet页的配置 + +------------ +### sheetDeleteAfter + +- 类型:Function +- 默认值:null +- 作用:sheet删除后 +- 参数: + - {Object} [sheet]: 已被删除sheet页的配置 + +------------ +### sheetEditNameBefore + +- 类型:Function +- 默认值:null +- 作用:sheet修改名称前 +- 参数: + - {Number} [i]: sheet页的`index` + - {String} [name]: 当前sheet页名称 + +------------ +### sheetEditNameAfter + +- 类型:Function +- 默认值:null +- 作用:sheet修改名称后 +- 参数: + - {Number} [i]: sheet页的index + - {String} [oldName]: 修改前当前sheet页名称 + - {String} [newName]: 修改后当前sheet页名称 + +------------ +### sheetEditColorBefore +(TODO) +- 类型:Function +- 默认值:null +- 作用:sheet修改颜色前 +- 参数: + - {Number} [i]: sheet页的`index` + - {String} [color]: 当前sheet页颜色 + +------------ +### sheetEditColorAfter +(TODO) +- 类型:Function +- 默认值:null +- 作用:sheet修改颜色后 +- 参数: + - {Number} [i]: sheet页的`index` + - {String} [oldColor]: 修改前当前sheet页颜色 + - {String} [newColor]: 修改后当前sheet页颜色 + +------------ +### sheetZoomBefore +(TODO) +- 类型:Function +- 默认值:null +- 作用:sheet缩放前 +- 参数: + - {Number} [i]: sheet页的`index` + - {String} [zoom]: 当前sheet页缩放比例 + +------------ +### sheetZoomAfter +(TODO) +- 类型:Function +- 默认值:null +- 作用:sheet缩放后 +- 参数: + - {Number} [i]: sheet页的`index` + - {String} [oldZoom]: 修改前当前sheet页缩放比例 + - {String} [newZoom]: 修改后当前sheet页缩放比例 + +------------ +### sheetActivate + +- 类型:Function +- 默认值:null +- 作用:激活工作表前 +- 参数: + - {Number} [i]: sheet页的`index` + - {Boolean} [isPivotInitial]: 是否切换到了数据透视表页 + - {Boolean} [isNewSheet]: 是否新建了sheet页 + +------------ +### sheetDeactivateBefore +(TODO) +- 类型:Function +- 默认值:null +- 作用:工作表从活动状态转为非活动状态前 +- 参数: + - {Number} [i]: sheet页的`index` + +------------ +### sheetDeactivateAfter +(TODO) +- 类型:Function +- 默认值:null +- 作用:工作表从活动状态转为非活动状态后 +- 参数: + - {Number} [i]: sheet页的`index` + +### imageDeleteBefore + +- 类型:Function +- 默认值:null +- 作用:图片删除前触发 +- 参数: + - {Object} [imageItem]: 要删除的图片配置对象 + +### imageDeleteAfter + +- 类型:Function +- 默认值:null +- 作用:图片删除后触发,如果自定义了图片上传,可在此处发请求删除图片 +- 参数: + - {Object} [imageItem]: 删除的图片配置对象 + +```js +{ + hook: { + imageDeleteAfter: function (imageItem) { + var src = imgItem.src; + $.post('/rest/file/deletebyurl', {downloadUrl: src}); + } + } +} +``` + +------------ + +## 工作簿 + +### workbookCreateBefore + +- 类型:Function +- 默认值:null +- 作用:表格创建之前触发。旧的钩子函数叫做`beforeCreateDom` +- 参数: + - {Object} [book]: 整个工作簿的配置(options) + +------------ +### workbookCreateAfter + +- 类型:Function +- 默认值:null +- 作用:表格创建之后触发 +- 参数: + - {Object} [book]: 整个工作簿的配置(options) + +------------ +### workbookDestroyBefore +(TODO) +- 类型:Function +- 默认值:null +- 作用:表格销毁之前触发 +- 参数: + - {Object} [book]: 整个工作簿的配置(options) + +------------ +### workbookDestroyAfter +(TODO) +- 类型:Function +- 默认值:null +- 作用:表格销毁之后触发 +- 参数: + - {Object} [book]: 整个工作簿的配置(options) + +------------ +### updated + +- 类型:Function +- 默认值:null +- 作用:协同编辑中的每次操作后执行的方法,监听表格内容变化,即客户端每执行一次表格操作,Luckysheet将这次操作存到历史记录中后触发,撤销重做时因为也算一次操作,也会触发此钩子函数。 +- 参数: + - {Object} [operate]: 本次操作的历史记录信息,根据不同的操作,会有不同的历史记录,参考源码 [历史记录](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/controlHistory.js) + +------------ +### resized +(TODO) +- 类型:Function +- 默认值:null +- 作用:resize执行之后 +- 参数: + - {Object} [size]: 整个工作簿区域的宽高 + +------------ +### scroll +- 类型:Function +- 默认值:null +- 作用:监听表格滚动值 +- 参数: + - {Number} [scrollLeft]: 水平方向滚动值 + - {Number} [scrollTop]: 垂直方向滚动值 + - {Number} [canvasHeight]: 滚动容器的高度 + +------------ + + +## 协作消息 + +### cooperativeMessage + +- 类型:Function +- 默认值:null +- 作用:接受协作消息,二次开发。拓展协作消息指令集 +- 参数: + - {Object} : 收到服务器发送的整个协作消息体对象 + +## 图片 + +### imageInsertBefore +(TODO) +- 类型:Function +- 默认值:null +- 作用:图片插入之前 +- 参数: + - {Object} [url]: 图片地址 + +------------ +### imageInsertAfter +(TODO) +- 类型:Function +- 默认值:null +- 作用:图片插入之后 +- 参数: + - {Object} [item]]: 图片地址、宽高、位置等信息 + +------------ +### imageUpdateBefore +(TODO) +- 类型:Function +- 默认值:null +- 作用:图片修改之前,修改的内容包括宽高、位置、裁剪等操作 +- 参数: + - {Object} [item]]: 图片地址、宽高、位置等信息 + +------------ +### imageUpdateAfter +(TODO) +- 类型:Function +- 默认值:null +- 作用:图片修改之后,修改的内容包括宽高、位置、裁剪等操作 +- 参数: + - {Object} [oldItem]]: 修改前图片地址、宽高、位置等信息 + - {Object} [newItem]]: 修改后图片地址、宽高、位置等信息 + +------------ +### imageDeleteBefore +(TODO) +- 类型:Function +- 默认值:null +- 作用:图片删除之前 +- 参数: + - {Object} [item]]: 图片地址、宽高、位置等信息 + +------------ +### imageDeleteAfter +(TODO) +- 类型:Function +- 默认值:null +- 作用:图片删除之后 +- 参数: + - {Object} [item]]: 图片地址、宽高、位置等信息 + +------------ + +## 批注 + +### commentInsertBefore + +- 类型:Function +- 默认值:null +- 作用:插入批注之前,`return false` 则不插入批注 +- 参数: + - {Number} [r]:单元格所在行号 + - {Number} [c]:单元格所在列号 + +------------ +### commentInsertAfter + +- 类型:Function +- 默认值:null +- 作用:插入批注之后 +- 参数: + - {Number} [r]:单元格所在行号 + - {Number} [c]:单元格所在列号 + - {Object} [cell]: 被插入批注所在的单元格信息,如:`{ r:0,c:2,v:{m:'233',v:'233'}}`,包含批注信息 + +------------ +### commentDeleteBefore + +- 类型:Function +- 默认值:null +- 作用:删除批注之前,`return false` 则不删除批注 +- 参数: + - {Number} [r]:单元格所在行号 + - {Number} [c]:单元格所在列号 + - {Object} [cell]: 要删除的批注所在的单元格信息,如:`{ r:0,c:2,v:{m:'233',v:'233'}}`,可以看到批注信息 + +------------ +### commentDeleteAfter + +- 类型:Function +- 默认值:null +- 作用:删除批注之后 +- 参数: + - {Number} [r]:单元格所在行号 + - {Number} [c]:单元格所在列号 + - {Object} [cell]: 被删除批注所在的单元格信息,如:`{ r:0,c:2,v:{m:'233',v:'233'}}`,可以看到批注已被删除 + +------------ +### commentUpdateBefore + +- 类型:Function +- 默认值:null +- 作用:修改批注之前,`return false` 则不修改批注 +- 参数: + - {Number} [r]:单元格所在行号 + - {Number} [c]:单元格所在列号 + - {String} [value]: 新的批注内容 + +------------ +### commentUpdateAfter + +- 类型:Function +- 默认值:null +- 作用:修改批注之后 +- 参数: + - {Number} [r]:单元格所在行号 + - {Number} [c]:单元格所在列号 + - {Object} [oldCell]: 修改前批注所在的单元格信息,如:`{ r:0,c:2,v:{m:'233',v:'233'}}` + - {Object} [newCell]: 修改后批注所在的单元格信息,如:`{ r:0,c:2,v:{m:'233',v:'233'}}` + +------------ + +## 数据透视表 + +### pivotTableEditBefore +(TODO) +- 类型:Function +- 默认值:null +- 作用:修改数据透视表之前,操作如:拖动字段等 +- 参数: + - {Object} [sheet]: 数据透视表所在sheet页配置 + +------------ +### pivotTableEditAfter +(TODO) +- 类型:Function +- 默认值:null +- 作用:修改数据透视表之后,操作如:拖动字段等 +- 参数: + - {Object} [oldSheet]: 修改前数据透视表所在sheet页配置 + - {Object} [newSheet]: 修改后数据透视表所在sheet页配置 + +------------ + +## 冻结 + +### frozenCreateBefore +(TODO) +- 类型:Function +- 默认值:null +- 作用:设置冻结前 +- 参数: + - {Object} [frozen]: 冻结类型信息 + +------------ +### frozenCreateAfter +(TODO) +- 类型:Function +- 默认值:null +- 作用:设置冻结后 +- 参数: + - {Object} [frozen]: 冻结类型信息 + +------------ +### frozenCancelBefore +(TODO) +- 类型:Function +- 默认值:null +- 作用:取消冻结前 +- 参数: + - {Object} [frozen]: 冻结类型信息 + +------------ +### frozenCancelAfter +(TODO) +- 类型:Function +- 默认值:null +- 作用:取消冻结后 +- 参数: + - {Object} [frozen]: 冻结类型信息 + +------------ + +## 打印 + +### printBefore +(TODO) +- 类型:Function +- 默认值:null +- 作用:打印前 + +------------ + +## 旧版钩子函数 + +### fireMousedown + +- 类型:Function +- 默认值:null +- 作用:单元格数据下钻自定义方法,注意此钩子函数是挂载在options下:`options.fireMousedown` + +------------ + +## 分页器 + +### onTogglePager + +- 类型:Function +- 默认值:null +- 作用:点击分页按钮回调函数,返回当前页码,具体参数参照[sPage backFun](https://github.com/jvbei/sPage) +- 参数: + - {Object} [page]: 返回当前分页对象 + +------------ diff --git a/docs/zh/guide/contribute.md b/docs/zh/guide/contribute.md index 18ef20ede..164c9ab34 100644 --- a/docs/zh/guide/contribute.md +++ b/docs/zh/guide/contribute.md @@ -1,222 +1,222 @@ - -# 贡献指南 - - 欢迎!我们很高兴您能来到这里,并非常期待您能有兴趣参与 Luckysheet 贡献。当然,在您参与 Luckysheet 贡献之前,请确保通读以下全文: - -## 我们的行为准则 - -1. 我们保证尊重所有参与贡献的人,不限于提出问题、文档和代码贡献、解决bug以及其它贡献的人; - -2. 我们有义务遵守当地法律法规,所有的附带法律风险的行为我们都是拒绝的; -3. 我们反对任何参与者存在贬损评论、人身攻击、骚扰或侮辱他人以及其他非专业行为; -4. 我们有权并有责任删除或编辑与此行为准则不符的内容,不限于代码、Issues、wiki、文档以及其它。不遵守行为准则的参与者可能会被移除团队; -5. 我们接受任何人的监督,任何人可通过问题反馈,向我们报告发现的与此行为准则不符的事实存在。 - -## 如何参与贡献? - -* 贡献文档:浏览文档可以加深您对 Luckysheet 的了解,一旦发现文档写得不清晰或逻辑混乱的地方,可以订正、修改、补充,您可以通过 [中文论坛](https://support.qq.com/products/288322)或者 [谷歌论坛](https://groups.google.com/g/luckysheet)给予反馈 -* 贡献代码:欢迎大家为 Luckysheet 社区贡献代码,欢迎您认领Open状态的 [Issues](https://github.com/mengshukeji/Luckysheet/issues) 和未完成的特性,提交PR,成为贡献者之一如果您在使用过程中发现有些功能无法满足您的需求或出现问题,请在Issues中记录 -* 参与Issue讨论:您可以在任一 [Issues](https://github.com/mengshukeji/Luckysheet/issues) 下发表您的建议 -* Review代码:您可以在 [Github](https://github.com/mengshukeji/Luckysheet)上看到所有贡献者提交的PR,您可以Review他们的代码并发表您的建议 - - -## 如何提交 Issues - -在您提交特性/改进前,应该注意以下几点: - -* 请先确认该特性/改进是否被其他人已经提交 -* 一个通俗易懂的标题来阐述你提交的Bug/提交特性/改进 -* 如果是Bug则详细描述该bug产生的原因,如果能够复现,请尽量提供完整的重现步骤 -* 如果是特性,那么该特性应该有广泛的适用性,适用于大部分用户,最好能够提供详尽的设计文档 -* 如果是改进,尽可能描述清楚此改进所带来的益处 - -具体步骤: - -* 创建 [Issues](https://github.com/mengshukeji/Luckysheet/issues) ,描述清楚问题 -* 如果你要解决该issue则将issue assign到自己名下,如果你仅仅是提交Bug/特性/改进,并没有时间去贡献代码,则assignne设置为空 -* 如果是比较大的特性/改进,尽量先输出设计文档,走 [Luckysheet RFC](https://github.com/mengshukeji/Luckysheet-rfcs) 流程,供其他人review - -## 如何认领 Issues - -在 Luckysheet 的 [Issues](https://github.com/mengshukeji/Luckysheet/issues) 列表中,有很多由其他人创建的issue并未被修复,如果你感兴趣的话,可以认领这些issue。认领步骤如下: - -* 在该issue下留言,表达想认领该任务的想法,另注明 **@I can solve it** 即可 -* 如果提交者没有意见,则将该issue assign到自己名下并及时更新进度 -* 如果是比较大的特性,尽量先输出设计文档,走 [Luckysheet RFC](https://github.com/mengshukeji/Luckysheet-rfcs) 流程,供其他人review -* 开发代码并提交代码至github - - -## 如何提交代码 - -1. fork 到自己的仓库 - -进入  [Luckysheet](https://github.com/mengshukeji/Luckysheet)  的Github页面 ,点击右上角按钮 Fork 进行 Fork。 - -2. git clone 到本地 - -```shell -git clone https://github.com//Luckysheet.git -``` - -3. 上游建立连接 - -```shell - -cd Luckysheet -git remote add upstream https://github.com/mengshukeji/Luckysheet.git -``` -4. 创建开发分支 - -```shell -git checkout -b dev -``` - -5. 修改提交代码 - -```shell -git add .  -npm run commit -git push origin dev -``` - -6. 同步代码,将最新代码同步到本地 - -```shell -git fetch upstream  -git rebase upstream/master -``` - -7. 如果有冲突(没有可以忽略) - -```shell -git status # 查看冲突文件,并修改冲突 -git add . -git rebase --continue -``` -提交git rebase --continue命令的时候,如果弹出vim提示编辑commit信息,则可以添加你的修改,然后保存退出 -> vim命令请参考阅读[vim](https://www.runoob.com/linux/linux-vim.html) - -8. 提交分支代码 - -```shell -git push origin dev -``` - -如果提示需要先pull 可以先拉取在提交 -```shell -git pull origin dev -git push origin dev -``` -若弹出vim提示编辑commit信息,可以直接通过vim命令退出 -> vim命令请参考阅读[vim](https://www.runoob.com/linux/linux-vim.html) - -9. 提交pr -去自己github仓库对应fork的项目,切换到刚刚创建修改的分支,点击new pull request,并添加上对应的描述,最后点击Create pull request进行提交 - -## 代码规范 - -> 一般性的代码规范示例 - -* 保持块深度最小。尽可能避免嵌套If条件 -```js -// CORRECT -if (!comparison) return - -if (variable) { - for (const item of items) {} -} else if (variable2) { - // Do something here -} - -// INCORRECT -if (comparison) { - if (variable) { - for (const item in items) {} - } else if (variable2) { - // Do something here - } -} else { - return -} -``` - -* 不要使用操作数进行链比较 -```js -// CORRECT - -if (cb) cb() -if (!cb || (cb === fn)) cb() - -// INCORRECT - -cb && cb() -(!cb || (cb === fn)) && cb() -``` - -* 所有变量都应该按字母顺序在块的开头声明 -```js -// CORRECT -function foo () { - const foo = 'bar' - const bar = 'foo' - - if (conditional) {} - - ... - - return foo -} - -// INCORRECT - -function foo () { - const foo = 'bar' - - if (conditional) {} - - const bar = 'foo' - - ... - - return foo -} -``` - -* 尽快返回 -```js -// CORRECT -if (condition) return 'foo' -if (condition2) return 'bar' -// Return must have a blank line above -return 'fizz' - -// INCORRECT -const variable = '' - -if (condition) { - variable = 'foo' -} else if (condition2) { - variable = 'bar' -} else { - variable = 'fizz' -} - -return variable -``` - -## 如何贡献文档 - -## 如何成为Luckysheet Committer - -任何人只要对 Luckysheet 项目做了贡献,那您就是官方承认的 Luckysheet 项目的Contributor了,从Contributor成长为Committer并没有一个确切的标准, 也没有任何预期的时间表,但是Committer的候选人一般都是长期活跃的贡献者,成为Committer并没有要求必须有巨大的架构改进贡献, 或者多少行的代码贡献,贡献代码、贡献文档、参与邮件列表的讨论、帮助回答问题等等都提升自己影响力的方式。 - -潜在贡献清单(无特定顺序): - -* 提交自己发现的Bug、特性、改进到issue -* 更新官方文档使项目的文档是最近的、撰写 Luckysheet 的最佳实践、特性剖析的各种对用户有用的文档 -* 执行测试并报告测试结果,性能测试与其他MQ的性能对比测试等 -* 审查(Review)其他人的工作(包括代码和非代码)并发表你自己的建议 -* 指导新加入的贡献者,熟悉社区流程 -* 发表关于 Luckysheet 的博客 -* 有利于 Luckysheet 社区发展的任何贡献 -* ...... + +# 贡献指南 + + 欢迎!我们很高兴您能来到这里,并非常期待您能有兴趣参与 Luckysheet 贡献。当然,在您参与 Luckysheet 贡献之前,请确保通读以下全文: + +## 我们的行为准则 + +1. 我们保证尊重所有参与贡献的人,不限于提出问题、文档和代码贡献、解决bug以及其它贡献的人; + +2. 我们有义务遵守当地法律法规,所有的附带法律风险的行为我们都是拒绝的; +3. 我们反对任何参与者存在贬损评论、人身攻击、骚扰或侮辱他人以及其他非专业行为; +4. 我们有权并有责任删除或编辑与此行为准则不符的内容,不限于代码、Issues、wiki、文档以及其它。不遵守行为准则的参与者可能会被移除团队; +5. 我们接受任何人的监督,任何人可通过问题反馈,向我们报告发现的与此行为准则不符的事实存在。 + +## 如何参与贡献? + +* 贡献文档:浏览文档可以加深您对 Luckysheet 的了解,一旦发现文档写得不清晰或逻辑混乱的地方,可以订正、修改、补充,您可以通过 [中文论坛](https://support.qq.com/products/288322)或者 [谷歌论坛](https://groups.google.com/g/luckysheet)给予反馈 +* 贡献代码:欢迎大家为 Luckysheet 社区贡献代码,欢迎您认领Open状态的 [Issues](https://github.com/mengshukeji/Luckysheet/issues) 和未完成的特性,提交PR,成为贡献者之一如果您在使用过程中发现有些功能无法满足您的需求或出现问题,请在Issues中记录 +* 参与Issue讨论:您可以在任一 [Issues](https://github.com/mengshukeji/Luckysheet/issues) 下发表您的建议 +* Review代码:您可以在 [Github](https://github.com/mengshukeji/Luckysheet)上看到所有贡献者提交的PR,您可以Review他们的代码并发表您的建议 + + +## 如何提交 Issues + +在您提交特性/改进前,应该注意以下几点: + +* 请先确认该特性/改进是否被其他人已经提交 +* 一个通俗易懂的标题来阐述你提交的Bug/提交特性/改进 +* 如果是Bug则详细描述该bug产生的原因,如果能够复现,请尽量提供完整的重现步骤 +* 如果是特性,那么该特性应该有广泛的适用性,适用于大部分用户,最好能够提供详尽的设计文档 +* 如果是改进,尽可能描述清楚此改进所带来的益处 + +具体步骤: + +* 创建 [Issues](https://github.com/mengshukeji/Luckysheet/issues) ,描述清楚问题 +* 如果你要解决该issue则将issue assign到自己名下,如果你仅仅是提交Bug/特性/改进,并没有时间去贡献代码,则assignne设置为空 +* 如果是比较大的特性/改进,尽量先输出设计文档,走 [Luckysheet RFC](https://github.com/mengshukeji/Luckysheet-rfcs) 流程,供其他人review + +## 如何认领 Issues + +在 Luckysheet 的 [Issues](https://github.com/mengshukeji/Luckysheet/issues) 列表中,有很多由其他人创建的issue并未被修复,如果你感兴趣的话,可以认领这些issue。认领步骤如下: + +* 在该issue下留言,表达想认领该任务的想法,另注明 **@I can solve it** 即可 +* 如果提交者没有意见,则将该issue assign到自己名下并及时更新进度 +* 如果是比较大的特性,尽量先输出设计文档,走 [Luckysheet RFC](https://github.com/mengshukeji/Luckysheet-rfcs) 流程,供其他人review +* 开发代码并提交代码至github + + +## 如何提交代码 + +1. fork 到自己的仓库 + +进入  [Luckysheet](https://github.com/mengshukeji/Luckysheet)  的Github页面 ,点击右上角按钮 Fork 进行 Fork。 + +2. git clone 到本地 + +```shell +git clone https://github.com//Luckysheet.git +``` + +3. 上游建立连接 + +```shell + +cd Luckysheet +git remote add upstream https://github.com/mengshukeji/Luckysheet.git +``` +4. 创建开发分支 + +```shell +git checkout -b dev +``` + +5. 修改提交代码 + +```shell +git add .  +npm run commit +git push origin dev +``` + +6. 同步代码,将最新代码同步到本地 + +```shell +git fetch upstream  +git rebase upstream/master +``` + +7. 如果有冲突(没有可以忽略) + +```shell +git status # 查看冲突文件,并修改冲突 +git add . +git rebase --continue +``` +提交git rebase --continue命令的时候,如果弹出vim提示编辑commit信息,则可以添加你的修改,然后保存退出 +> vim命令请参考阅读[vim](https://www.runoob.com/linux/linux-vim.html) + +8. 提交分支代码 + +```shell +git push origin dev +``` + +如果提示需要先pull 可以先拉取在提交 +```shell +git pull origin dev +git push origin dev +``` +若弹出vim提示编辑commit信息,可以直接通过vim命令退出 +> vim命令请参考阅读[vim](https://www.runoob.com/linux/linux-vim.html) + +9. 提交pr +去自己github仓库对应fork的项目,切换到刚刚创建修改的分支,点击new pull request,并添加上对应的描述,最后点击Create pull request进行提交 + +## 代码规范 + +> 一般性的代码规范示例 + +* 保持块深度最小。尽可能避免嵌套If条件 +```js +// CORRECT +if (!comparison) return + +if (variable) { + for (const item of items) {} +} else if (variable2) { + // Do something here +} + +// INCORRECT +if (comparison) { + if (variable) { + for (const item in items) {} + } else if (variable2) { + // Do something here + } +} else { + return +} +``` + +* 不要使用操作数进行链比较 +```js +// CORRECT + +if (cb) cb() +if (!cb || (cb === fn)) cb() + +// INCORRECT + +cb && cb() +(!cb || (cb === fn)) && cb() +``` + +* 所有变量都应该按字母顺序在块的开头声明 +```js +// CORRECT +function foo () { + const foo = 'bar' + const bar = 'foo' + + if (conditional) {} + + ... + + return foo +} + +// INCORRECT + +function foo () { + const foo = 'bar' + + if (conditional) {} + + const bar = 'foo' + + ... + + return foo +} +``` + +* 尽快返回 +```js +// CORRECT +if (condition) return 'foo' +if (condition2) return 'bar' +// Return must have a blank line above +return 'fizz' + +// INCORRECT +const variable = '' + +if (condition) { + variable = 'foo' +} else if (condition2) { + variable = 'bar' +} else { + variable = 'fizz' +} + +return variable +``` + +## 如何贡献文档 + +## 如何成为Luckysheet Committer + +任何人只要对 Luckysheet 项目做了贡献,那您就是官方承认的 Luckysheet 项目的Contributor了,从Contributor成长为Committer并没有一个确切的标准, 也没有任何预期的时间表,但是Committer的候选人一般都是长期活跃的贡献者,成为Committer并没有要求必须有巨大的架构改进贡献, 或者多少行的代码贡献,贡献代码、贡献文档、参与邮件列表的讨论、帮助回答问题等等都提升自己影响力的方式。 + +潜在贡献清单(无特定顺序): + +* 提交自己发现的Bug、特性、改进到issue +* 更新官方文档使项目的文档是最近的、撰写 Luckysheet 的最佳实践、特性剖析的各种对用户有用的文档 +* 执行测试并报告测试结果,性能测试与其他MQ的性能对比测试等 +* 审查(Review)其他人的工作(包括代码和非代码)并发表你自己的建议 +* 指导新加入的贡献者,熟悉社区流程 +* 发表关于 Luckysheet 的博客 +* 有利于 Luckysheet 社区发展的任何贡献 +* ...... diff --git a/docs/zh/guide/operate.md b/docs/zh/guide/operate.md index 8e428fe9f..6372eb457 100644 --- a/docs/zh/guide/operate.md +++ b/docs/zh/guide/operate.md @@ -1,1283 +1,1283 @@ -# 表格操作 - -每一次操作都会保存历史记录,用于撤销和重做,如果在表格初始化的时候开启了[共享编辑](/zh/guide/config.html#updateurl)功能,则会通过websocket将操作实时更新到后台。 - -> 源码 [`src/controllers/server.js`](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/server.js) 模块实现了后台保存功能 - -通常,共享编辑(或者叫协同编辑)是需要和账户系统配合来控制权限的,开发者可以根据已有功能,配合自己的账户管理功能自行实现权限控制。 - -以下为所有的支持传输到后台的操作类型,并且以MongoDB做存储示例,讲解如何做前后端交互。 - -注意一点,对象中的i为当前sheet的index值,而不是order。 - -## 单元格刷新 - -### 单个单元格刷新 - -- **格式**: - - ```json - { - "t": "v", - "i": "Sheet_0554kKiKl4M7_1597974810804", - "v": { - "v": 233, - "ct": { "fa": "General", "t": "n" }, - "m": "233" - }, - "r": 0, - "c": 1 - } - ``` - -- **说明**: - - |参数|说明| - | ------------ | ------------ | - |t|操作类型表示符号| - |i|当前sheet的index值| - |v|单元格的值,数字、字符串或着对象格式,对象参考 [单元格属性表](/zh/guide/cell.html#基本单元格)| - |r|单元格的行号| - |c|单元格的列号| - -- **后台更新**: - - 前端维护luckysheetfile[i].data,而单元格更新到后台,继续维护`luckysheetfile[i].celldata` 参数,celldata是一个一维数组: - ```json - [ - {r:0, c:1, v: "值1"}, - {r:10, c:11, v:"值2"}, - {r:10, c:11, v:{f:"=sum", v:"100"}} - ] - ``` - 后台在保存前台推送的数据时,会更新 `luckysheetfile[i].celldata` 字段,如果存在该单元格则更新,如果没有则添加,如果存在该单元格但是`v`为null则删除该单元格。 - - -### 范围单元格刷新 - -- **格式**: - - ```json - { - "t": "rv", - "i": "Sheet_ahKdzaNC65iL_1598343160744", - "v": [ - [ - { "v": 3, "ct": { "fa": "General", "t": "n" }, "m": "3" } - ], - [ - { "v": 4, "ct": { "fa": "General", "t": "n" }, "m": "4" } - ] - ], - "range": { - "row": [ 1, 2 ], - "column": [ 1, 1 ] - } - } - ``` - -- **说明**: - - |参数|说明| - | ------------ | ------------ | - |t|操作类型表示符号| - |i|当前sheet的索引值| - |v|范围二维数组,单元格对象参考 [单元格属性表](/zh/guide/cell.html#基本单元格)| - |range|范围行列数| - -- **后台更新**: - - 前端维护luckysheetfile[i].data,而单元格更新到后台,继续维护`luckysheetfile[i].celldata` 参数,需要将指定位置`range`的所有单元格数据替换为新的数据 - -## config操作 - -- **格式**: - - ```json - { - "t": "cg", - "i": "Sheet_0554kKiKl4M7_1597974810804", - "v": [ { - "rangeType": "range", - "borderType": "border-all", - "color": "#000", - "style": "1", - "range": [ {"row": [ 0, 1 ], "column": [ 1, 1 ] } ] - } ], - "k": "borderInfo" - } - ``` - -- **说明**: - - |参数|说明| - | ------------ | ------------ | - |t|操作类型表示符号| - |i|当前sheet的index值| - |v|需要更新value值| - |k|操作的key值,可选 边框:`'borderInfo'` / :行隐藏:`'rowhidden'` / 列隐藏:`'colhidden'` / 行高:`'rowlen'` / 列宽:`'columnlen'` | - -- **后台更新**: - - 更新 `luckysheetfile[i].config[k] = v` ,如果`config`中不存在`k`,则新建一个`k`属性并设置为空。 - - 注意一点,修改config中的某个配置时,会把这个配置全部传输到后台,比如修改borderInfo,本来已经有一个含边框的单元格了,再新设置一个单元格边框,这时候会把这两个单元格边框信息都传输到后台,而不做更细颗粒的操作。 - - 1. 行隐藏: - - 发送到后台: - ```json - { - "t": "cg", - "i": "Sheet_0554kKiKl4M7_1597974810804", - "v": { "5": 0, "6": 0, "13": 0, "14": 0 }, // 包含所有隐藏行信息 - "k": "rowhidden" - } - ``` - - 后台更新:`luckysheetfile["Sheet_0554kKiKl4M7_1597974810804"].config["rowhidden"] = { "5": 0, "6": 0, "13": 0, "14": 0 }` - - 2. 修改行高: - - 发送到后台: - ```json - { - "t": "cg", - "i": "Sheet_0554kKiKl4M7_1597974810804", - "v": { "9": 20, "11": 71, "15": 58 }, // 包含所有修改过高度的单元格信息 - "k": "rowlen" - } - ``` - - 后台更新:`luckysheetfile["Sheet_0554kKiKl4M7_1597974810804"].config["rowlen"] = { "9": 20, "11": 71, "15": 58 }` - - 3. 修改列宽: - - 发送到后台: - ```json - { - "t": "cg", - "i": "Sheet_0554kKiKl4M7_1597974810804", - "v": { "2": 135 }, - "k": "columnlen" - } - ``` - - 后台更新:`luckysheetfile["Sheet_0554kKiKl4M7_1597974810804"].config["columnlen"] = { "2": 135 }` - -## 通用保存 - -- **格式**: - - ```json - { - "t": "all", - "i": 0, - "v": { - "type": "rangeRow", - "range": { "row_focus": 1, "column_focus": 1 } - }, - "k": "frozen" - } - ``` - -- **说明**: - - |参数|说明| - | ------------ | ------------ | - |t|操作类型表示符号| - |i|当前sheet的index值| - |v|需要更新value值| - |k|操作的key值| - -- **后台更新**: - - 更新 `luckysheetfile[i][k] = v` ,如果`luckysheetfile[i]`中不存在`k`,则新建一个`k`属性并设置为空。 - - 1. 冻结行列: - - 发送到后台: - ```json - { - "t": "all", - "i": 0, - "v": { - "type": "rangeRow", - "range": { "row_focus": 1, "column_focus": 1 } - }, - "k": "frozen" - } - ``` - - 后台更新: - ```js - luckysheetfile[0]["frozen"] = { - "type": "rangeRow", - "range": { "row_focus": 1, "column_focus": 1 } - } - ``` - - 2. 修改工作表名称: - - 发送到后台: - ```json - { - "t": "all", - "i": 0, - "v": "Cell22", - "k": "name" - } - ``` - - 后台更新:`luckysheetfile[0]["name"] = "Cell22"` - - 3. 修改工作表颜色: - - 发送到后台: - ```json - { - "t": "all", - "i": 0, - "v": "#f02323", - "k": "color" - } - ``` - - 后台更新:`luckysheetfile[0]["color"] = "#f02323"` - - 4. 合并单元格: - - 发送到后台: - ```json - { - "t": "all", - "i": "Sheet_aheLt0Waf1lk_1598248231626", - "v": { - "merge": { - "0_0": { "r": 0, "c": 0, "rs": 2, "cs": 1 } - }, - "rowlen": {} - }, - "k": "config" - } - ``` - - 后台更新: - ```js - luckysheetfile["Sheet_aheLt0Waf1lk_1598248231626"]["config"] = { - "merge": { - "0_0": { "r": 0, "c": 0, "rs": 2, "cs": 1 } - }, - "rowlen": {} - } - ``` - - 注意,合并单元格的更新比较特殊,要求把整个config传输到后台,因为合并单元格可能会影响到其他参数。 - - 5. 筛选范围: - - 发送到后台: - ```json - { - "t": "all", - "i": 0, - "v": { - "row": [ 16, 21 ], - "column": [ 2, 3 ] - }, - "k": "filter_select" - } - ``` - - 后台更新: - ```js - luckysheetfile[0]["filter_select"] = { - "row": [ 16, 21 ], - "column": [ 2, 3 ] - } - ``` - - 6. 筛选的具体设置: - - 发送到后台: - ```json - { - "t": "all", - "i": "0", - "v": { - "0": { - "caljs": { - "value": "textinclude", - "text": "Text contains", - "type": "1", - "value1": "Lucky" - }, - "rowhidden": { - "18": 0 - }, - "optionstate": true, - "str": 17, - "edr": 19, - "cindex": 2, - "stc": 2, - "edc": 3 - } - }, - "k": "filter" - } - ``` - - 后台更新: - ```js - luckysheetfile[0]["filter"] = { - "0": { - "caljs": { - "value": "textinclude", - "text": "Text contains", - "type": "1", - "value1": "Lucky" - }, - "rowhidden": { - "18": 0 - }, - "optionstate": true, - "str": 17, - "edr": 19, - "cindex": 2, - "stc": 2, - "edc": 3 - } - } - ``` - - 7. 交替颜色: - - 发送到后台: - ```json - { - "t": "all", - "i": "Sheet_4N45tpMd0ni4_1598250591760", - "v": [ - { - "cellrange": { - "row": [ 2, 6 ], - "column": [ 1, 4 ] - }, - "format": { - "head": { - "fc": "#000", - "bc": "#f6cb4b" - }, - "one": { - "fc": "#000", - "bc": "#ffffff" - }, - "two": { - "fc": "#000", - "bc": "#fff9e7" - }, - "foot": { - "fc": "#000", - "bc": "#ffebac" - } - }, - "hasRowHeader": true, - "hasRowFooter": true - } - ], - "k": "luckysheet_alternateformat_save" - } - ``` - - 后台更新: - ```js - luckysheetfile["Sheet_4N45tpMd0ni4_1598250591760"]["luckysheet_alternateformat_save"] = [ - { - "cellrange": { - "row": [ 2, 6 ], - "column": [ 1, 4 ] - }, - "format": { - "head": { - "fc": "#000", - "bc": "#f6cb4b" - }, - "one": { - "fc": "#000", - "bc": "#ffffff" - }, - "two": { - "fc": "#000", - "bc": "#fff9e7" - }, - "foot": { - "fc": "#000", - "bc": "#ffebac" - } - }, - "hasRowHeader": true, - "hasRowFooter": true - } - ] - ``` - - 8. 条件格式: - - 发送到后台: - ```json - { - "t": "all", - "i": "Sheet_545W7w03kLkC_1598251927583", - "v": [ - { - "type": "default", - "cellrange": [ - { - "row": [ 2, 6 ], - "column": [ 1, 3 ] - } - ], - "format": { - "textColor": "#9c0006", - "cellColor": "#ffc7ce" - }, - "conditionName": "greaterThan", - "conditionRange": [], - "conditionValue": [ "3" ] - } - ], - "k": "luckysheet_conditionformat_save" - } - ``` - - 后台更新: - ```js - luckysheetfile["Sheet_545W7w03kLkC_1598251927583"]["luckysheet_conditionformat_save"] = [ - { - "type": "default", - "cellrange": [ - { - "row": [ 2, 6 ], - "column": [ 1, 3 ] - } - ], - "format": { - "textColor": "#9c0006", - "cellColor": "#ffc7ce" - }, - "conditionName": "greaterThan", - "conditionRange": [], - "conditionValue": [ "3" ] - } - ] - ``` - - 9. 数据透视表: - - 发送到后台: - ```json - { - "t": "all", - "i": "Sheet_r3Cz5bbxipL3_1598252547290", - "v": { - "pivot_select_save": { - "row": [ 0, 2 ], - "column": [ 0, 2 ] - }, - "pivotDataSheetIndex": "Sheet_31ikLMip330K_1598252536645", - "column": [], - "row": [], - "filter": [], - "values": [], - "showType": "column" - }, - "k": "pivotTable" - } - ``` - - 后台更新: - ```js - luckysheetfile["Sheet_r3Cz5bbxipL3_1598252547290"]["pivotTable"] = { - "pivot_select_save": { - "row": [ 0, 2 ], - "column": [ 0, 2 ] - }, - "pivotDataSheetIndex": "Sheet_31ikLMip330K_1598252536645", - "column": [], - "row": [], - "filter": [], - "values": [], - "showType": "column" - } - ``` - - 注意,虽然数据透视表的格式是这个,但是当你选择一个范围之后,点击生产数据透视表时,Luckysheet会先执行新建sheet页和切换到该sheet页的操作,才能在新建的sheet页加上数据透视表。 - - 10. 动态数组: - - 发送到后台: - ```json - { - "t": "all", - "i": "Sheet_r3Cz5bbxipL3_1598252547290", - "v": [ - { - "r": 4, - "c": 5, - "f": "=UNIQUE(B2:E9)", - "data": [ - [ 1, 2, 3, 4 ], - [ 2, 3, 4, 5 ], - [ 3, 4, 5, 6 ], - [ 4, 5, 6, 7 ], - [ 5, 6, 7, 8 ], - [ 6, 7, 8, 9 ], - [ 7, 8, 9, 10 ], - [ 8, 9, 10, 11 ] - ] - } - ], - "k": "dynamicArray" - } - ``` - - 后台更新: - ```js - luckysheetfile["Sheet_r3Cz5bbxipL3_1598252547290"]["dynamicArray"] = [ - { - "r": 4, - "c": 5, - "f": "=UNIQUE(B2:E9)", - "data": [ - [ 1, 2, 3, 4 ], - [ 2, 3, 4, 5 ], - [ 3, 4, 5, 6 ], - [ 4, 5, 6, 7 ], - [ 5, 6, 7, 8 ], - [ 6, 7, 8, 9 ], - [ 7, 8, 9, 10 ], - [ 8, 9, 10, 11 ] - ] - } - ] - ``` - -## 函数链操作 - -- **格式**: - - ```json - - { - "t": "fc", - "i": "0", - "v": "{\"r\":1,\"c\":1,\"index\":\"0\",\"func\":[true,3,\"=sum(A1:B1)\"]}", - "op": "add", - "pos": 1 - } - - ``` - -- **说明**: - - |参数|说明| - | ------------ | ------------ | - |t|操作类型表示符号| - |i|当前sheet的index值| - |v|对象值,这里对象的内部字段不需要单独更新,所以存为文本即可| - |op|操作类型,`add`为新增,`update`为更新,`del`为删除| - |pos|更新或者删除的函数位置| - -- **后台更新**: - - calcChain为一个数组 - - 如果`op`的值为`add`则添加到末尾 `luckysheetfile[0].calcChain.push(v)`, - - 如果`op`的值为`update`,格式为: - ```json - { - "t": "fc", - "i": "0", - "v": "{\"r\":0,\"c\":3,\"index\":\"0\",\"func\":[true,1,\"=Formula!A1+Formula!B1+1\"],\"color\":\"w\",\"parent\":null,\"chidren\":{},\"times\":0}", - "op": "update", - "pos": 0 - } - ``` - 更新 `luckysheetfile[0].calcChain[pos] = v`, - - 如果`op`的值为`del`则删除,格式为: - ```json - { - "t": "fc", - "i": 0, - "v": null, - "op": "del", - "pos": 0 - } - ``` - `luckysheetfile[0].calcChain.splice(pos, 1)`。 - -## 行列操作 - -### 删除行或列 - -- **格式**: - - ```json - { - "t": "drc", - "i": 3, - "v": { - "index": 6, - "len": 2 - }, - "rc": "r" - } - ``` - -- **说明**: - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
参数说明
t操作类型表示符号
i当前sheet的index值
rc行操作还是列操作,值`r`代表行,`c`代表列
vindex从第几行或者列开始删除
len删除多少行或者列
- -- **后台更新**: - - 如果`rc`的值是`'r'`删除行, 如果`rc`的值为`'c'`则删除列, 例如`rc='r'`,`index=4`,`len=5`,则代表从第4行开始删除之后的5行(4、5、6、7、8)。 - - 主要是对 `luckysheetfile[i].celldata` 中的单元格进行操作,删除参数中所描述符合条件的单元格并且更新其他单元格的行列值,以上述为例,首先查找单元格中`r`值在4到8的所有单元格并删除,然后把本来行号9以后的单元格的`r`值减去5,最后把 `luckysheetfile[i].row` 减去5。 - 如果`v`值为 `"#__qkdelete#"`(不含引号),则此处为需要删除的单元格。 - -### 增加行或列 - -- **格式**: - - ```json - { - "t": "arc", - "i": "0", - "v": { - "index": 1, - "len": 1, - "direction": "lefttop", - "data": [] - }, - "rc": "r" - } - ``` - -- **说明**: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
参数说明
t操作类型表示符号
i当前sheet的index值
rc行操作还是列操作,值`r`代表行,`c`代表列
vindex从第几行或者列开始新增
len增加多少行或者列
direction方向
data新增行或者列的内容
- -- **后台更新**: - - 如果`rc`的值是`r`新增行, 如果`rc`的值为`c`则新增列, 例如`rc=r,index=4,len=5`,则代表从第4行开始增加5行,如果`data`为空则增加空行,如果`data`不为空则用`data`中的数组添加新增的行中。 - - 主要是对 `luckysheetfile[i].celldata` 中的单元格进行操作,以上述为例,首先 `luckysheetfile[i].row` 加5,然后把`r`大于4的单元格的整体的`r`值+5,如果`data`为空则增加空行则结束,如果`data`不为空则把二维数组`data`转换为 `{r:0,c:0,v:100}` 的格式并添加到`celldata`中,转换的伪代码如下: - - ```javascript - var ret = []; - for(var r=0;r - - 参数 - 说明 - - - t - 操作类型表示符号 - - - i - 当前sheet的index值 - - - v - name - 隐藏后跳转的sheet的index值 - - - color - Sheet颜色 - - - status - 激活状态 - - - order - Sheet摆放顺序 - - - index - Index索引 - - - celldata - 单元格数据集 - - - row - 行数 - - - column - 列数 - - - config - 设置 - - - pivotTable - 数据透视表设置 - - - isPivotTable - 是否数据透视表 - - - - -- **后台更新**: - - 添加一行(一个文档)到数据库中。 - `luckysheetfile.push(json)` - - -### 复制sheet - -- **格式**: - - ```json - { - "t": "shc", - "i": "Sheet_e5pKTeloilhe_1598332166630", - "v": { - "copyindex": 0, - "name": "Cell(Copy)" - } - } - ``` - -- **后台更新**: - - 复制表格中的sheet索引值为`copyindex`并添加到数据库中,添加的设置该新文档的`index`为`i`对应的值。 - -### 删除sheet - -- **格式**: - - ```json - { - "t": "shd", - "i": null, - "v": { - "deleIndex": 0 - } - } - ``` - -- **说明**: - - - - - - - - - - - - - - - - -
参数说明
t操作类型表示符号
vdeleIndex需要删除的sheet索引
- -- **后台更新**: - - 删除索引为`deleIndex`对应值的sheet。 - -### 删除sheet后恢复操作 - -- **格式**: - - ```json - { - "t": "shre", - "i": null, - "v": { - "reIndex": "0" - } - } - ``` - -- **说明**: - - - - - - - - - - - - - - - - -
参数说明
t操作类型表示符号
vdeleIndex需要恢复的sheet索引
- -- **后台更新**: - - 恢复索引为`reIndex`对应值的sheet。 - -### 调整sheet位置 - -- **格式**: - - ```json - { - "t": "shr", - "i": null, - "v": { - "0": 1, - "1": 0, - "2": 2, - "3": 3, - "4": 4, - "5": 5, - "6": 6, - "7": 7, - "Sheet_6az6nei65t1i_1596209937084": 8 - } - } - ``` - -- **说明**: - - |参数|说明| - | ------------ | ------------ | - |t|操作类型表示符号| - |v|设置Sheet的排序,为一个键值对,`key`代表sheet的`index`,`value`代表`order`值。格式为:`{"1": 3, "2":1, "0": 2, "3":0}`| - -- **后台更新**: - - 对sheet的`index`等于`key`的页,设置其`order`属性为`value`值。示例: - - `luckysheetfile[key1].order = value1` - `luckysheetfile[key2].order = value2` - `luckysheetfile[key3].order = value3` - -### 切换到指定sheet - -- **格式**: - - ```json - { - "t": "shs", - "i": null, - "v": 1 - } - ``` - -- **说明**: - - |参数|说明| - | ------------ | ------------ | - |t|操作类型表示符号| - |v|要切换到的sheet页索引| - -- **后台更新**: - - 对sheet的`index`等于`v`的页,设置其`status`属性为`1`值。示例: - - `luckysheetfile[v].status = 1` - -## sheet属性(隐藏或显示) - -- **格式**: - - ```json - { - "t": "sh", - "i": 0, - "v": 1, - "op": "hide", - "cur": 1 - } - - ``` - -- **说明**: - - |参数|说明| - | ------------ | ------------ | - |t|操作类型表示符号| - |i|当前sheet的index值| - |op|操作选项,有hide、show| - |v|如果`hide`为`1`则隐藏,为`0`或者空则为显示| - |cur|隐藏后设置索引对应`cur`的sheet为激活状态| - -- **后台更新**: - - 更新`i`对应sheet的根路径`hide`字段为`v` - - 当隐藏时`status`值为`0`,更新`index`对应`cur`的sheet的`status`状态为`1` - - `luckysheetfile[0].hide = 1` - `luckysheetfile[0].status = 0` - `luckysheetfile[1].status = 1` - - 显示某个sheet页时,json为 - ```json - { - "t": "sh", - "i": 6, - "v": 0, - "op": "show" - } - ``` - `status`值为`1`,上一个激活sheet的`status`状态为`0` - - `luckysheetfile[6].hide = 0` - `luckysheetfile[6].status = 1` - `luckysheetfile[old_cur].status = 0` - -## 表格信息更改 - -### 修改工作簿名称 - -- **格式**: - - ```json - { - "t": "na", - "i": null, - "v": "Luckysheet Demo1" - } - ``` - -- **说明**: - - |参数|说明| - | ------------ | ------------ | - |t|操作类型表示符号| - |v|工作簿名称| - -- **后台更新**: - - Luckysheet配置,修改title为`"Luckysheet Demo1"` - -## 图表(TODO) - -图表操作类型有4种,分别为新增图表"add"、移动图表位置"xy"、缩放图表"wh"、修改图表配置"update" - -### 新增图表 - -- **格式**: - - ```json - { - "t": "c", - "i": 0, - "op":"add", - "v": { - "chart_id": "chart_p145W6i73otw_1596209943446", - "width": 400, - "height": 250, - "left": 20, - "top": 120, - "sheetIndex": "Sheet_6az6nei65t1i_1596209937084", - "needRangeShow": true, - "chartOptions": { - "chart_id": "chart_p145W6i73otw_1596209943446", - "chartAllType": "echarts|line|default", - "rangeArray": [ { "row": [ 0, 4 ], "column": [ 0, 7 ] } ], - "rangeColCheck": { "exits": true, "range": [ 0, 0 ] }, - "rangeRowCheck": { "exits": true, "range": [ 0, 0 ] }, - "rangeConfigCheck": false, - "defaultOption": { - "title": { - "show": true, - "text": "默认标题" - } - } - }, - "isShow": true - } - } - ``` - -- **说明**: - - |参数|说明| - | ------------ | ------------ | - |t|操作类型表示符号| - |i|当前sheet的index值| - |op|操作选项| - |v|图表的配置信息| - -- **后台更新**: - - 更新对应sheet页中的图表设置,如果`luckysheetfile[i].chart`为null,则初始化为空数组 `[]` - - ```json - luckysheetfile[0].chart.push(v) - ``` - -### 移动图表位置 - -- **格式**: - - ```json - { - "t": "c", - "i": 0, - "op":"xy", - "v": { - "chart_id": "chart_p145W6i73otw_1596209943446", - "left": 20, - "top": 120 - } - } - ``` - -- **说明**: - - |参数|说明| - | ------------ | ------------ | - |t|操作类型表示符号| - |i|当前sheet的index值| - |op|操作选项| - |v|图表的配置信息| - -- **后台更新**: - - 更新对应sheet页中的图表设置 - - ```js - luckysheetfile[0].chart[v.chart_id].left = v.left; - luckysheetfile[0].chart[v.chart_id].top = v.top; - ``` - -### 缩放图表 - -- **格式**: - - ```json - { - "t": "c", - "i": 0, - "op":"wh", - "v": { - "chart_id": "chart_p145W6i73otw_1596209943446", - "width": 400, - "height": 250, - "left": 20, - "top": 120 - } - } - ``` - -- **说明**: - - |参数|说明| - | ------------ | ------------ | - |t|操作类型表示符号| - |i|当前sheet的index值| - |op|操作选项| - |v|图表的配置信息| - -- **后台更新**: - - 更新对应sheet页中的图表设置 - - ```js - luckysheetfile[0].chart[v.chart_id].left = v.left; - luckysheetfile[0].chart[v.chart_id].top = v.top; - luckysheetfile[0].chart[v.chart_id].width = v.width; - luckysheetfile[0].chart[v.chart_id].height = v.height; - ``` - -### 修改图表配置 - -- **格式**: - - ```json - { - "t": "c", - "i": 0, - "op":"update", - "v": { - "chart_id": "chart_p145W6i73otw_1596209943446", - "width": 400, - "height": 250, - "left": 20, - "top": 120, - "sheetIndex": "Sheet_6az6nei65t1i_1596209937084", - "needRangeShow": true, - "chartOptions": { - "chart_id": "chart_p145W6i73otw_1596209943446", - "chartAllType": "echarts|line|default", - "rangeArray": [ { "row": [ 0, 4 ], "column": [ 0, 7 ] } ], - "rangeColCheck": { "exits": true, "range": [ 0, 0 ] }, - "rangeRowCheck": { "exits": true, "range": [ 0, 0 ] }, - "rangeConfigCheck": false, - "defaultOption": { - "title": { - "show": true, - "text": "默认标题" - } - } - }, - "isShow": true - } - } - ``` - -- **说明**: - - |参数|说明| - | ------------ | ------------ | - |t|操作类型表示符号| - |i|当前sheet的index值| - |op|操作选项| - |v|图表的配置信息| - -- **后台更新**: - - 更新对应sheet页中的图表设置 - - ```js - luckysheetfile[0].chart[v.chart_id] = v; - ``` - -## 后端返回格式 - -websocket 后端返回的数据格式 -```js -{ - createTime: 命令发送时间 - data:{} 修改的命令 - id: "7a" websocket的id - returnMessage: "success" - status: "0" 0告诉前端需要根据data的命令修改 1无意义 - type: 0:连接成功,1:发送给当前连接的用户,2:发送信息给其他用户,3:发送选区位置信息,999:用户连接断开 - username: 用户名 -} +# 表格操作 + +每一次操作都会保存历史记录,用于撤销和重做,如果在表格初始化的时候开启了[共享编辑](/zh/guide/config.html#updateurl)功能,则会通过websocket将操作实时更新到后台。 + +> 源码 [`src/controllers/server.js`](https://github.com/mengshukeji/Luckysheet/blob/master/src/controllers/server.js) 模块实现了后台保存功能 + +通常,共享编辑(或者叫协同编辑)是需要和账户系统配合来控制权限的,开发者可以根据已有功能,配合自己的账户管理功能自行实现权限控制。 + +以下为所有的支持传输到后台的操作类型,并且以MongoDB做存储示例,讲解如何做前后端交互。 + +注意一点,对象中的i为当前sheet的index值,而不是order。 + +## 单元格刷新 + +### 单个单元格刷新 + +- **格式**: + + ```json + { + "t": "v", + "i": "Sheet_0554kKiKl4M7_1597974810804", + "v": { + "v": 233, + "ct": { "fa": "General", "t": "n" }, + "m": "233" + }, + "r": 0, + "c": 1 + } + ``` + +- **说明**: + + |参数|说明| + | ------------ | ------------ | + |t|操作类型表示符号| + |i|当前sheet的index值| + |v|单元格的值,数字、字符串或着对象格式,对象参考 [单元格属性表](/zh/guide/cell.html#基本单元格)| + |r|单元格的行号| + |c|单元格的列号| + +- **后台更新**: + + 前端维护luckysheetfile[i].data,而单元格更新到后台,继续维护`luckysheetfile[i].celldata` 参数,celldata是一个一维数组: + ```json + [ + {r:0, c:1, v: "值1"}, + {r:10, c:11, v:"值2"}, + {r:10, c:11, v:{f:"=sum", v:"100"}} + ] + ``` + 后台在保存前台推送的数据时,会更新 `luckysheetfile[i].celldata` 字段,如果存在该单元格则更新,如果没有则添加,如果存在该单元格但是`v`为null则删除该单元格。 + + +### 范围单元格刷新 + +- **格式**: + + ```json + { + "t": "rv", + "i": "Sheet_ahKdzaNC65iL_1598343160744", + "v": [ + [ + { "v": 3, "ct": { "fa": "General", "t": "n" }, "m": "3" } + ], + [ + { "v": 4, "ct": { "fa": "General", "t": "n" }, "m": "4" } + ] + ], + "range": { + "row": [ 1, 2 ], + "column": [ 1, 1 ] + } + } + ``` + +- **说明**: + + |参数|说明| + | ------------ | ------------ | + |t|操作类型表示符号| + |i|当前sheet的索引值| + |v|范围二维数组,单元格对象参考 [单元格属性表](/zh/guide/cell.html#基本单元格)| + |range|范围行列数| + +- **后台更新**: + + 前端维护luckysheetfile[i].data,而单元格更新到后台,继续维护`luckysheetfile[i].celldata` 参数,需要将指定位置`range`的所有单元格数据替换为新的数据 + +## config操作 + +- **格式**: + + ```json + { + "t": "cg", + "i": "Sheet_0554kKiKl4M7_1597974810804", + "v": [ { + "rangeType": "range", + "borderType": "border-all", + "color": "#000", + "style": "1", + "range": [ {"row": [ 0, 1 ], "column": [ 1, 1 ] } ] + } ], + "k": "borderInfo" + } + ``` + +- **说明**: + + |参数|说明| + | ------------ | ------------ | + |t|操作类型表示符号| + |i|当前sheet的index值| + |v|需要更新value值| + |k|操作的key值,可选 边框:`'borderInfo'` / :行隐藏:`'rowhidden'` / 列隐藏:`'colhidden'` / 行高:`'rowlen'` / 列宽:`'columnlen'` | + +- **后台更新**: + + 更新 `luckysheetfile[i].config[k] = v` ,如果`config`中不存在`k`,则新建一个`k`属性并设置为空。 + + 注意一点,修改config中的某个配置时,会把这个配置全部传输到后台,比如修改borderInfo,本来已经有一个含边框的单元格了,再新设置一个单元格边框,这时候会把这两个单元格边框信息都传输到后台,而不做更细颗粒的操作。 + + 1. 行隐藏: + - 发送到后台: + ```json + { + "t": "cg", + "i": "Sheet_0554kKiKl4M7_1597974810804", + "v": { "5": 0, "6": 0, "13": 0, "14": 0 }, // 包含所有隐藏行信息 + "k": "rowhidden" + } + ``` + - 后台更新:`luckysheetfile["Sheet_0554kKiKl4M7_1597974810804"].config["rowhidden"] = { "5": 0, "6": 0, "13": 0, "14": 0 }` + + 2. 修改行高: + - 发送到后台: + ```json + { + "t": "cg", + "i": "Sheet_0554kKiKl4M7_1597974810804", + "v": { "9": 20, "11": 71, "15": 58 }, // 包含所有修改过高度的单元格信息 + "k": "rowlen" + } + ``` + - 后台更新:`luckysheetfile["Sheet_0554kKiKl4M7_1597974810804"].config["rowlen"] = { "9": 20, "11": 71, "15": 58 }` + + 3. 修改列宽: + - 发送到后台: + ```json + { + "t": "cg", + "i": "Sheet_0554kKiKl4M7_1597974810804", + "v": { "2": 135 }, + "k": "columnlen" + } + ``` + - 后台更新:`luckysheetfile["Sheet_0554kKiKl4M7_1597974810804"].config["columnlen"] = { "2": 135 }` + +## 通用保存 + +- **格式**: + + ```json + { + "t": "all", + "i": 0, + "v": { + "type": "rangeRow", + "range": { "row_focus": 1, "column_focus": 1 } + }, + "k": "frozen" + } + ``` + +- **说明**: + + |参数|说明| + | ------------ | ------------ | + |t|操作类型表示符号| + |i|当前sheet的index值| + |v|需要更新value值| + |k|操作的key值| + +- **后台更新**: + + 更新 `luckysheetfile[i][k] = v` ,如果`luckysheetfile[i]`中不存在`k`,则新建一个`k`属性并设置为空。 + + 1. 冻结行列: + - 发送到后台: + ```json + { + "t": "all", + "i": 0, + "v": { + "type": "rangeRow", + "range": { "row_focus": 1, "column_focus": 1 } + }, + "k": "frozen" + } + ``` + - 后台更新: + ```js + luckysheetfile[0]["frozen"] = { + "type": "rangeRow", + "range": { "row_focus": 1, "column_focus": 1 } + } + ``` + + 2. 修改工作表名称: + - 发送到后台: + ```json + { + "t": "all", + "i": 0, + "v": "Cell22", + "k": "name" + } + ``` + - 后台更新:`luckysheetfile[0]["name"] = "Cell22"` + + 3. 修改工作表颜色: + - 发送到后台: + ```json + { + "t": "all", + "i": 0, + "v": "#f02323", + "k": "color" + } + ``` + - 后台更新:`luckysheetfile[0]["color"] = "#f02323"` + + 4. 合并单元格: + - 发送到后台: + ```json + { + "t": "all", + "i": "Sheet_aheLt0Waf1lk_1598248231626", + "v": { + "merge": { + "0_0": { "r": 0, "c": 0, "rs": 2, "cs": 1 } + }, + "rowlen": {} + }, + "k": "config" + } + ``` + - 后台更新: + ```js + luckysheetfile["Sheet_aheLt0Waf1lk_1598248231626"]["config"] = { + "merge": { + "0_0": { "r": 0, "c": 0, "rs": 2, "cs": 1 } + }, + "rowlen": {} + } + ``` + + 注意,合并单元格的更新比较特殊,要求把整个config传输到后台,因为合并单元格可能会影响到其他参数。 + + 5. 筛选范围: + - 发送到后台: + ```json + { + "t": "all", + "i": 0, + "v": { + "row": [ 16, 21 ], + "column": [ 2, 3 ] + }, + "k": "filter_select" + } + ``` + - 后台更新: + ```js + luckysheetfile[0]["filter_select"] = { + "row": [ 16, 21 ], + "column": [ 2, 3 ] + } + ``` + + 6. 筛选的具体设置: + - 发送到后台: + ```json + { + "t": "all", + "i": "0", + "v": { + "0": { + "caljs": { + "value": "textinclude", + "text": "Text contains", + "type": "1", + "value1": "Lucky" + }, + "rowhidden": { + "18": 0 + }, + "optionstate": true, + "str": 17, + "edr": 19, + "cindex": 2, + "stc": 2, + "edc": 3 + } + }, + "k": "filter" + } + ``` + - 后台更新: + ```js + luckysheetfile[0]["filter"] = { + "0": { + "caljs": { + "value": "textinclude", + "text": "Text contains", + "type": "1", + "value1": "Lucky" + }, + "rowhidden": { + "18": 0 + }, + "optionstate": true, + "str": 17, + "edr": 19, + "cindex": 2, + "stc": 2, + "edc": 3 + } + } + ``` + + 7. 交替颜色: + - 发送到后台: + ```json + { + "t": "all", + "i": "Sheet_4N45tpMd0ni4_1598250591760", + "v": [ + { + "cellrange": { + "row": [ 2, 6 ], + "column": [ 1, 4 ] + }, + "format": { + "head": { + "fc": "#000", + "bc": "#f6cb4b" + }, + "one": { + "fc": "#000", + "bc": "#ffffff" + }, + "two": { + "fc": "#000", + "bc": "#fff9e7" + }, + "foot": { + "fc": "#000", + "bc": "#ffebac" + } + }, + "hasRowHeader": true, + "hasRowFooter": true + } + ], + "k": "luckysheet_alternateformat_save" + } + ``` + - 后台更新: + ```js + luckysheetfile["Sheet_4N45tpMd0ni4_1598250591760"]["luckysheet_alternateformat_save"] = [ + { + "cellrange": { + "row": [ 2, 6 ], + "column": [ 1, 4 ] + }, + "format": { + "head": { + "fc": "#000", + "bc": "#f6cb4b" + }, + "one": { + "fc": "#000", + "bc": "#ffffff" + }, + "two": { + "fc": "#000", + "bc": "#fff9e7" + }, + "foot": { + "fc": "#000", + "bc": "#ffebac" + } + }, + "hasRowHeader": true, + "hasRowFooter": true + } + ] + ``` + + 8. 条件格式: + - 发送到后台: + ```json + { + "t": "all", + "i": "Sheet_545W7w03kLkC_1598251927583", + "v": [ + { + "type": "default", + "cellrange": [ + { + "row": [ 2, 6 ], + "column": [ 1, 3 ] + } + ], + "format": { + "textColor": "#9c0006", + "cellColor": "#ffc7ce" + }, + "conditionName": "greaterThan", + "conditionRange": [], + "conditionValue": [ "3" ] + } + ], + "k": "luckysheet_conditionformat_save" + } + ``` + - 后台更新: + ```js + luckysheetfile["Sheet_545W7w03kLkC_1598251927583"]["luckysheet_conditionformat_save"] = [ + { + "type": "default", + "cellrange": [ + { + "row": [ 2, 6 ], + "column": [ 1, 3 ] + } + ], + "format": { + "textColor": "#9c0006", + "cellColor": "#ffc7ce" + }, + "conditionName": "greaterThan", + "conditionRange": [], + "conditionValue": [ "3" ] + } + ] + ``` + + 9. 数据透视表: + - 发送到后台: + ```json + { + "t": "all", + "i": "Sheet_r3Cz5bbxipL3_1598252547290", + "v": { + "pivot_select_save": { + "row": [ 0, 2 ], + "column": [ 0, 2 ] + }, + "pivotDataSheetIndex": "Sheet_31ikLMip330K_1598252536645", + "column": [], + "row": [], + "filter": [], + "values": [], + "showType": "column" + }, + "k": "pivotTable" + } + ``` + - 后台更新: + ```js + luckysheetfile["Sheet_r3Cz5bbxipL3_1598252547290"]["pivotTable"] = { + "pivot_select_save": { + "row": [ 0, 2 ], + "column": [ 0, 2 ] + }, + "pivotDataSheetIndex": "Sheet_31ikLMip330K_1598252536645", + "column": [], + "row": [], + "filter": [], + "values": [], + "showType": "column" + } + ``` + + 注意,虽然数据透视表的格式是这个,但是当你选择一个范围之后,点击生产数据透视表时,Luckysheet会先执行新建sheet页和切换到该sheet页的操作,才能在新建的sheet页加上数据透视表。 + + 10. 动态数组: + - 发送到后台: + ```json + { + "t": "all", + "i": "Sheet_r3Cz5bbxipL3_1598252547290", + "v": [ + { + "r": 4, + "c": 5, + "f": "=UNIQUE(B2:E9)", + "data": [ + [ 1, 2, 3, 4 ], + [ 2, 3, 4, 5 ], + [ 3, 4, 5, 6 ], + [ 4, 5, 6, 7 ], + [ 5, 6, 7, 8 ], + [ 6, 7, 8, 9 ], + [ 7, 8, 9, 10 ], + [ 8, 9, 10, 11 ] + ] + } + ], + "k": "dynamicArray" + } + ``` + - 后台更新: + ```js + luckysheetfile["Sheet_r3Cz5bbxipL3_1598252547290"]["dynamicArray"] = [ + { + "r": 4, + "c": 5, + "f": "=UNIQUE(B2:E9)", + "data": [ + [ 1, 2, 3, 4 ], + [ 2, 3, 4, 5 ], + [ 3, 4, 5, 6 ], + [ 4, 5, 6, 7 ], + [ 5, 6, 7, 8 ], + [ 6, 7, 8, 9 ], + [ 7, 8, 9, 10 ], + [ 8, 9, 10, 11 ] + ] + } + ] + ``` + +## 函数链操作 + +- **格式**: + + ```json + + { + "t": "fc", + "i": "0", + "v": "{\"r\":1,\"c\":1,\"index\":\"0\",\"func\":[true,3,\"=sum(A1:B1)\"]}", + "op": "add", + "pos": 1 + } + + ``` + +- **说明**: + + |参数|说明| + | ------------ | ------------ | + |t|操作类型表示符号| + |i|当前sheet的index值| + |v|对象值,这里对象的内部字段不需要单独更新,所以存为文本即可| + |op|操作类型,`add`为新增,`update`为更新,`del`为删除| + |pos|更新或者删除的函数位置| + +- **后台更新**: + + calcChain为一个数组 + - 如果`op`的值为`add`则添加到末尾 `luckysheetfile[0].calcChain.push(v)`, + - 如果`op`的值为`update`,格式为: + ```json + { + "t": "fc", + "i": "0", + "v": "{\"r\":0,\"c\":3,\"index\":\"0\",\"func\":[true,1,\"=Formula!A1+Formula!B1+1\"],\"color\":\"w\",\"parent\":null,\"chidren\":{},\"times\":0}", + "op": "update", + "pos": 0 + } + ``` + 更新 `luckysheetfile[0].calcChain[pos] = v`, + - 如果`op`的值为`del`则删除,格式为: + ```json + { + "t": "fc", + "i": 0, + "v": null, + "op": "del", + "pos": 0 + } + ``` + `luckysheetfile[0].calcChain.splice(pos, 1)`。 + +## 行列操作 + +### 删除行或列 + +- **格式**: + + ```json + { + "t": "drc", + "i": 3, + "v": { + "index": 6, + "len": 2 + }, + "rc": "r" + } + ``` + +- **说明**: + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
参数说明
t操作类型表示符号
i当前sheet的index值
rc行操作还是列操作,值`r`代表行,`c`代表列
vindex从第几行或者列开始删除
len删除多少行或者列
+ +- **后台更新**: + + 如果`rc`的值是`'r'`删除行, 如果`rc`的值为`'c'`则删除列, 例如`rc='r'`,`index=4`,`len=5`,则代表从第4行开始删除之后的5行(4、5、6、7、8)。 + + 主要是对 `luckysheetfile[i].celldata` 中的单元格进行操作,删除参数中所描述符合条件的单元格并且更新其他单元格的行列值,以上述为例,首先查找单元格中`r`值在4到8的所有单元格并删除,然后把本来行号9以后的单元格的`r`值减去5,最后把 `luckysheetfile[i].row` 减去5。 + 如果`v`值为 `"#__qkdelete#"`(不含引号),则此处为需要删除的单元格。 + +### 增加行或列 + +- **格式**: + + ```json + { + "t": "arc", + "i": "0", + "v": { + "index": 1, + "len": 1, + "direction": "lefttop", + "data": [] + }, + "rc": "r" + } + ``` + +- **说明**: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
参数说明
t操作类型表示符号
i当前sheet的index值
rc行操作还是列操作,值`r`代表行,`c`代表列
vindex从第几行或者列开始新增
len增加多少行或者列
direction方向
data新增行或者列的内容
+ +- **后台更新**: + + 如果`rc`的值是`r`新增行, 如果`rc`的值为`c`则新增列, 例如`rc=r,index=4,len=5`,则代表从第4行开始增加5行,如果`data`为空则增加空行,如果`data`不为空则用`data`中的数组添加新增的行中。 + + 主要是对 `luckysheetfile[i].celldata` 中的单元格进行操作,以上述为例,首先 `luckysheetfile[i].row` 加5,然后把`r`大于4的单元格的整体的`r`值+5,如果`data`为空则增加空行则结束,如果`data`不为空则把二维数组`data`转换为 `{r:0,c:0,v:100}` 的格式并添加到`celldata`中,转换的伪代码如下: + + ```javascript + var ret = []; + for(var r=0;r + + 参数 + 说明 + + + t + 操作类型表示符号 + + + i + 当前sheet的index值 + + + v + name + 隐藏后跳转的sheet的index值 + + + color + Sheet颜色 + + + status + 激活状态 + + + order + Sheet摆放顺序 + + + index + Index索引 + + + celldata + 单元格数据集 + + + row + 行数 + + + column + 列数 + + + config + 设置 + + + pivotTable + 数据透视表设置 + + + isPivotTable + 是否数据透视表 + + + + +- **后台更新**: + + 添加一行(一个文档)到数据库中。 + `luckysheetfile.push(json)` + + +### 复制sheet + +- **格式**: + + ```json + { + "t": "shc", + "i": "Sheet_e5pKTeloilhe_1598332166630", + "v": { + "copyindex": 0, + "name": "Cell(Copy)" + } + } + ``` + +- **后台更新**: + + 复制表格中的sheet索引值为`copyindex`并添加到数据库中,添加的设置该新文档的`index`为`i`对应的值。 + +### 删除sheet + +- **格式**: + + ```json + { + "t": "shd", + "i": null, + "v": { + "deleIndex": 0 + } + } + ``` + +- **说明**: + + + + + + + + + + + + + + + + +
参数说明
t操作类型表示符号
vdeleIndex需要删除的sheet索引
+ +- **后台更新**: + + 删除索引为`deleIndex`对应值的sheet。 + +### 删除sheet后恢复操作 + +- **格式**: + + ```json + { + "t": "shre", + "i": null, + "v": { + "reIndex": "0" + } + } + ``` + +- **说明**: + + + + + + + + + + + + + + + + +
参数说明
t操作类型表示符号
vdeleIndex需要恢复的sheet索引
+ +- **后台更新**: + + 恢复索引为`reIndex`对应值的sheet。 + +### 调整sheet位置 + +- **格式**: + + ```json + { + "t": "shr", + "i": null, + "v": { + "0": 1, + "1": 0, + "2": 2, + "3": 3, + "4": 4, + "5": 5, + "6": 6, + "7": 7, + "Sheet_6az6nei65t1i_1596209937084": 8 + } + } + ``` + +- **说明**: + + |参数|说明| + | ------------ | ------------ | + |t|操作类型表示符号| + |v|设置Sheet的排序,为一个键值对,`key`代表sheet的`index`,`value`代表`order`值。格式为:`{"1": 3, "2":1, "0": 2, "3":0}`| + +- **后台更新**: + + 对sheet的`index`等于`key`的页,设置其`order`属性为`value`值。示例: + + `luckysheetfile[key1].order = value1` + `luckysheetfile[key2].order = value2` + `luckysheetfile[key3].order = value3` + +### 切换到指定sheet + +- **格式**: + + ```json + { + "t": "shs", + "i": null, + "v": 1 + } + ``` + +- **说明**: + + |参数|说明| + | ------------ | ------------ | + |t|操作类型表示符号| + |v|要切换到的sheet页索引| + +- **后台更新**: + + 对sheet的`index`等于`v`的页,设置其`status`属性为`1`值。示例: + + `luckysheetfile[v].status = 1` + +## sheet属性(隐藏或显示) + +- **格式**: + + ```json + { + "t": "sh", + "i": 0, + "v": 1, + "op": "hide", + "cur": 1 + } + + ``` + +- **说明**: + + |参数|说明| + | ------------ | ------------ | + |t|操作类型表示符号| + |i|当前sheet的index值| + |op|操作选项,有hide、show| + |v|如果`hide`为`1`则隐藏,为`0`或者空则为显示| + |cur|隐藏后设置索引对应`cur`的sheet为激活状态| + +- **后台更新**: + + 更新`i`对应sheet的根路径`hide`字段为`v` + + 当隐藏时`status`值为`0`,更新`index`对应`cur`的sheet的`status`状态为`1` + + `luckysheetfile[0].hide = 1` + `luckysheetfile[0].status = 0` + `luckysheetfile[1].status = 1` + + 显示某个sheet页时,json为 + ```json + { + "t": "sh", + "i": 6, + "v": 0, + "op": "show" + } + ``` + `status`值为`1`,上一个激活sheet的`status`状态为`0` + + `luckysheetfile[6].hide = 0` + `luckysheetfile[6].status = 1` + `luckysheetfile[old_cur].status = 0` + +## 表格信息更改 + +### 修改工作簿名称 + +- **格式**: + + ```json + { + "t": "na", + "i": null, + "v": "Luckysheet Demo1" + } + ``` + +- **说明**: + + |参数|说明| + | ------------ | ------------ | + |t|操作类型表示符号| + |v|工作簿名称| + +- **后台更新**: + + Luckysheet配置,修改title为`"Luckysheet Demo1"` + +## 图表(TODO) + +图表操作类型有4种,分别为新增图表"add"、移动图表位置"xy"、缩放图表"wh"、修改图表配置"update" + +### 新增图表 + +- **格式**: + + ```json + { + "t": "c", + "i": 0, + "op":"add", + "v": { + "chart_id": "chart_p145W6i73otw_1596209943446", + "width": 400, + "height": 250, + "left": 20, + "top": 120, + "sheetIndex": "Sheet_6az6nei65t1i_1596209937084", + "needRangeShow": true, + "chartOptions": { + "chart_id": "chart_p145W6i73otw_1596209943446", + "chartAllType": "echarts|line|default", + "rangeArray": [ { "row": [ 0, 4 ], "column": [ 0, 7 ] } ], + "rangeColCheck": { "exits": true, "range": [ 0, 0 ] }, + "rangeRowCheck": { "exits": true, "range": [ 0, 0 ] }, + "rangeConfigCheck": false, + "defaultOption": { + "title": { + "show": true, + "text": "默认标题" + } + } + }, + "isShow": true + } + } + ``` + +- **说明**: + + |参数|说明| + | ------------ | ------------ | + |t|操作类型表示符号| + |i|当前sheet的index值| + |op|操作选项| + |v|图表的配置信息| + +- **后台更新**: + + 更新对应sheet页中的图表设置,如果`luckysheetfile[i].chart`为null,则初始化为空数组 `[]` + + ```json + luckysheetfile[0].chart.push(v) + ``` + +### 移动图表位置 + +- **格式**: + + ```json + { + "t": "c", + "i": 0, + "op":"xy", + "v": { + "chart_id": "chart_p145W6i73otw_1596209943446", + "left": 20, + "top": 120 + } + } + ``` + +- **说明**: + + |参数|说明| + | ------------ | ------------ | + |t|操作类型表示符号| + |i|当前sheet的index值| + |op|操作选项| + |v|图表的配置信息| + +- **后台更新**: + + 更新对应sheet页中的图表设置 + + ```js + luckysheetfile[0].chart[v.chart_id].left = v.left; + luckysheetfile[0].chart[v.chart_id].top = v.top; + ``` + +### 缩放图表 + +- **格式**: + + ```json + { + "t": "c", + "i": 0, + "op":"wh", + "v": { + "chart_id": "chart_p145W6i73otw_1596209943446", + "width": 400, + "height": 250, + "left": 20, + "top": 120 + } + } + ``` + +- **说明**: + + |参数|说明| + | ------------ | ------------ | + |t|操作类型表示符号| + |i|当前sheet的index值| + |op|操作选项| + |v|图表的配置信息| + +- **后台更新**: + + 更新对应sheet页中的图表设置 + + ```js + luckysheetfile[0].chart[v.chart_id].left = v.left; + luckysheetfile[0].chart[v.chart_id].top = v.top; + luckysheetfile[0].chart[v.chart_id].width = v.width; + luckysheetfile[0].chart[v.chart_id].height = v.height; + ``` + +### 修改图表配置 + +- **格式**: + + ```json + { + "t": "c", + "i": 0, + "op":"update", + "v": { + "chart_id": "chart_p145W6i73otw_1596209943446", + "width": 400, + "height": 250, + "left": 20, + "top": 120, + "sheetIndex": "Sheet_6az6nei65t1i_1596209937084", + "needRangeShow": true, + "chartOptions": { + "chart_id": "chart_p145W6i73otw_1596209943446", + "chartAllType": "echarts|line|default", + "rangeArray": [ { "row": [ 0, 4 ], "column": [ 0, 7 ] } ], + "rangeColCheck": { "exits": true, "range": [ 0, 0 ] }, + "rangeRowCheck": { "exits": true, "range": [ 0, 0 ] }, + "rangeConfigCheck": false, + "defaultOption": { + "title": { + "show": true, + "text": "默认标题" + } + } + }, + "isShow": true + } + } + ``` + +- **说明**: + + |参数|说明| + | ------------ | ------------ | + |t|操作类型表示符号| + |i|当前sheet的index值| + |op|操作选项| + |v|图表的配置信息| + +- **后台更新**: + + 更新对应sheet页中的图表设置 + + ```js + luckysheetfile[0].chart[v.chart_id] = v; + ``` + +## 后端返回格式 + +websocket 后端返回的数据格式 +```js +{ + createTime: 命令发送时间 + data:{} 修改的命令 + id: "7a" websocket的id + returnMessage: "success" + status: "0" 0告诉前端需要根据data的命令修改 1无意义 + type: 0:连接成功,1:发送给当前连接的用户,2:发送信息给其他用户,3:发送选区位置信息,999:用户连接断开 + username: 用户名 +} ``` \ No newline at end of file diff --git a/docs/zh/guide/resource.md b/docs/zh/guide/resource.md index 74a7a08a6..f82831e64 100644 --- a/docs/zh/guide/resource.md +++ b/docs/zh/guide/resource.md @@ -1,32 +1,33 @@ -# 教程与资源 - -开源软件离不开社区的贡献,这里将会列举出社区提供的教程、学习资料及配套解决方案。 - -如果您写了或者发现了优秀的教程想要推荐给我们,请直接[编辑此页](https://github.com/mengshukeji/Luckysheet/edit/master/docs/zh/guide/resource.md)提交PR。 - -## 博客 -- [Luckysheet如何初始化含合并单元格的数据](https://www.cnblogs.com/DuShuSir/p/13272397.html) -- [Luckysheet如何把表格里的数据保存到数据库](https://www.cnblogs.com/DuShuSir/p/13857874.html) -- [本地HTML采用cdn加载方式引入Luckysheet的案例](https://www.cnblogs.com/DuShuSir/p/13859103.html) -- [Luckysheet基础用法,使用loadUrl加载服务端数据](https://blog.csdn.net/DCDC2020/article/details/108486525) -- [Luckysheet 导入与导出实现 - Java后台处理](https://blog.csdn.net/u014632228/article/details/109738221) - -## 前端案例 - -### 社区案例 -- [luckysheet-vue-importAndExport](https://github.com/oy-paddy/luckysheet-vue-importAndExport/tree/master/) - -## 后端案例 - -### 官方案例 -- [Java 后台 Luckysheet Server](https://github.com/mengshukeji/LuckysheetServer) - -### 社区案例 -- [Luckysheet保存与恢复](https://gitee.com/ichiva/luckysheet-saved-in-recovery)(Java版) -- [基于Luckysheet实现的协同编辑在线表格](https://github.com/DilemmaVi/ecsheet)(Java版) -- [使用.net core 3.1和Npoi 制作基于LuckSheet的基础导出](https://gitee.com/xiong-kangli/luck-sheet_.-net-core)(.NET 版本) -- [go语言版本的协同编辑](https://github.com/fandypeng/excel2config)(Go 版本) - -## 学习资料 - -- [如何从0到1搭建 Web 数据分析报表](https://github.com/mengshukeji/LuckyResources/blob/master/ppt/%E5%A6%82%E4%BD%95%E4%BB%8E0%E5%88%B01%E6%90%AD%E5%BB%BA%20Web%20%E6%95%B0%E6%8D%AE%E5%88%86%E6%9E%90%E6%8A%A5%E8%A1%A8.pptx) \ No newline at end of file +# 教程与资源 + +开源软件离不开社区的贡献,这里将会列举出社区提供的教程、学习资料及配套解决方案。 + +如果您写了或者发现了优秀的教程想要推荐给我们,请直接[编辑此页](https://github.com/mengshukeji/Luckysheet/edit/master/docs/zh/guide/resource.md)提交PR。 + +## 博客 +- [Luckysheet如何初始化含合并单元格的数据](https://www.cnblogs.com/DuShuSir/p/13272397.html) +- [Luckysheet如何把表格里的数据保存到数据库](https://www.cnblogs.com/DuShuSir/p/13857874.html) +- [本地HTML采用cdn加载方式引入Luckysheet的案例](https://www.cnblogs.com/DuShuSir/p/13859103.html) +- [Luckysheet基础用法,使用loadUrl加载服务端数据](https://blog.csdn.net/DCDC2020/article/details/108486525) +- [Luckysheet 导入与导出实现 - Java后台处理](https://blog.csdn.net/u014632228/article/details/109738221) + +## 前端案例 + +### 社区案例 +- [luckysheet-vue-importAndExport](https://github.com/oy-paddy/luckysheet-vue-importAndExport/tree/master/) + +## 后端案例 + +### 官方案例 +- [Java 后台 Luckysheet Server](https://github.com/mengshukeji/LuckysheetServer) + +### 社区案例 +- [Luckysheet保存与恢复](https://gitee.com/ichiva/luckysheet-saved-in-recovery)(Java版) +- [基于Luckysheet实现的协同编辑在线表格](https://github.com/DilemmaVi/ecsheet)(Java版) +- [简易的Express服务端示例 个人应用模板](https://github.com/TitanRGB/Luckysheet-ExpressReact-Example) (Node-Express版) +- [使用.net core 3.1和Npoi 制作基于LuckSheet的基础导出](https://gitee.com/xiong-kangli/luck-sheet_.-net-core)(.NET 版本) +- [go语言版本的协同编辑](https://github.com/fandypeng/excel2config)(Go 版本) + +## 学习资料 + +- [如何从0到1搭建 Web 数据分析报表](https://github.com/mengshukeji/LuckyResources/blob/master/ppt/%E5%A6%82%E4%BD%95%E4%BB%8E0%E5%88%B01%E6%90%AD%E5%BB%BA%20Web%20%E6%95%B0%E6%8D%AE%E5%88%86%E6%9E%90%E6%8A%A5%E8%A1%A8.pptx) diff --git a/docs/zh/guide/sheet.md b/docs/zh/guide/sheet.md index 9fb6cae38..a2ed27baa 100644 --- a/docs/zh/guide/sheet.md +++ b/docs/zh/guide/sheet.md @@ -1,1529 +1,1529 @@ -# 工作表配置 - -## 初始化配置 -表格初始化配置`options`时,需要配置一个由每个工作表参数组成的一维数组,赋给`options.data`。 - -> 表格初始化完成之后,通过方法[`luckysheet.getAllSheets()`](/zh/guide/api.html#getAllSheets([setting]))可以获取所有工作表的配置信息。 - -options.data示例如下: -```json -[ - { - "name": "Cell", //工作表名称 - "color": "", //工作表颜色 - "index": 0, //工作表索引 - "status": 1, //激活状态 - "order": 0, //工作表的下标 - "hide": 0,//是否隐藏 - "row": 36, //行数 - "column": 18, //列数 - "defaultRowHeight": 19, //自定义行高 - "defaultColWidth": 73, //自定义列宽 - "celldata": [], //初始化使用的单元格数据 - "config": { - "merge":{}, //合并单元格 - "rowlen":{}, //表格行高 - "columnlen":{}, //表格列宽 - "rowhidden":{}, //隐藏行 - "colhidden":{}, //隐藏列 - "borderInfo":{}, //边框 - "authority":{}, //工作表保护 - - }, - "scrollLeft": 0, //左右滚动条位置 - "scrollTop": 315, //上下滚动条位置 - "luckysheet_select_save": [], //选中的区域 - "calcChain": [],//公式链 - "isPivotTable":false,//是否数据透视表 - "pivotTable":{},//数据透视表设置 - "filter_select": {},//筛选范围 - "filter": null,//筛选配置 - "luckysheet_alternateformat_save": [], //交替颜色 - "luckysheet_alternateformat_save_modelCustom": [], //自定义交替颜色 - "luckysheet_conditionformat_save": {},//条件格式 - "frozen": {}, //冻结行列配置 - "chart": [], //图表配置 - "zoomRatio":1, // 缩放比例 - "image":[], //图片 - "showGridLines": 1, //是否显示网格线 - "dataVerification":{} //数据验证配置 - }, - { - "name": "Sheet2", - "color": "", - "index": 1, - "status": 0, - "order": 1, - "celldata": [], - "config": {} - }, - { - "name": "Sheet3", - "color": "", - "index": 2, - "status": 0, - "order": 2, - "celldata": [], - "config": {}, - } -] -``` - -### name -- 类型:String -- 默认值:"Sheet1" -- 作用:工作表名称 - ------------- -### color -- 类型:String -- 默认值:"##f20e0e" -- 作用:工作表颜色,工作表名称下方会有一条底部边框 - ------------- -### index -- 类型:String -- 默认值:"" -- 作用:工作表索引,作为唯一key值使用,新增工作表时会自动赋值一个随机字符串。注意`index`不是工作表顺序,和`order`区分开。 - ------------- -### status -- 类型:Number -- 默认值:1 -- 作用: 激活状态,仅有一个激活状态的工作表,其他工作表为 0 - ------------- -### order -- 类型:Number -- 默认值:0 -- 作用: 工作表的下标,代表工作表在底部sheet栏展示的顺序,新增工作表时会递增,从0开始 - ------------- -### hide -- 类型:Number -- 默认值:0 -- 作用: 是否隐藏,`0`为不隐藏,`1`为隐藏 - ------------- -### row -- 类型:Number -- 默认值:36 -- 作用: 单元格行数 - ------------- -### column -- 类型:Number -- 默认值:18 -- 作用: 单元格列数 - ------------- -### defaultRowHeight -- 类型:Number -- 默认值:19 -- 作用: 自定义的默认行高,单位为px - ------------- -### defaultColWidth -- 类型:Number -- 默认值:73 -- 作用: 自定义的默认列宽,单位为px - ------------- -### celldata -- 类型:Array -- 默认值:[] -- 作用: 原始单元格数据集,存储sheet中所有单元格中的值,是一个包含`{r:0,c:0,v:{m:"value",v:"value",ct: {fa: "General", t: "g"}}}`格式单元格信息的一维数组,只在初始化的时候使用。 - - r代表行,c代表列,v代表该单元格的值,值可以是字符、数字或者对象。 - - Luckysheet在建立的时候会根据 `options.data[i].row` 和 `options.data[i].column` 的行列数量大小新建一个表格data,然后再使用 `data[r][c]=v` 的方式填充表格数据,空数据单元格以null表示。 - - 使用celldata初始化完表格后,数据转换为luckysheetfile中的字段[data](#data),如`luckysheetfile[i].data`,后续操作表格的数据更新,会更新到这个data字段中,celldata不再使用。 - -- 示例: - ```js - [{ - "r": 0, - "c": 0, - "v": { - ct: {fa: "General", t: "g"}, - m:"value1", - v:"value1" - } - }, { - "r": 0, - "c": 1, - "v": { - ct: {fa: "General", t: "g"}, - m:"value2", - v:"value2" - } - }] - ``` -> 详细了解 [单元格格式](/zh/guide/cell.html) - ------------- -### config -- 类型:Object -- 默认值:{} -- 作用:表格行高、列宽、合并单元格、边框、隐藏行等设置 - - 注意,config如果为空,必须为空对象`{}`,不能为字符串或者null - -#### config.merge -- 类型:Object -- 默认值:{} -- 作用:合并单元格设置 -- 示例: - ```js - { - "13_5": { - "r": 13, - "c": 5, - "rs": 3, - "cs": 1 - }, - "13_7": { - "r": 13, - "c": 7, - "rs": 3, - "cs": 2 - }, - "14_2": { - "r": 14, - "c": 2, - "rs": 1, - "cs": 2 - } - } - ``` - 对象中的`key`为`r + '_' + c`的拼接值,`value`为左上角单元格信息: r:行数,c:列数,rs:合并的行数,cs:合并的列数 - -#### config.rowlen -- 类型:Object -- 默认值:{} -- 作用:每个单元格的行高 -- 示例: - ```js - "rowlen": { - "0": 20, - "1": 20, - "2": 20 - } - ``` - -#### config.columnlen -- 类型:Object -- 默认值:{} -- 作用:每个单元格的列宽 -- 示例: - ```js - "columnlen": { - "0": 97, - "1": 115, - "2": 128 - } - ``` - -#### config.rowhidden -- 类型:Object -- 默认值:{} -- 作用:隐藏行信息,格式为:`rowhidden[行数]: 0`, - - `key`指定行数即可,`value`总是为`0` -- 示例: - ```js - "rowhidden": { - "30": 0, - "31": 0 - } - ``` - -#### config.colhidden -- 类型:Object -- 默认值:{} -- 作用:隐藏列 - 格式为:`colhidden[列数]: 0`, - - `key`指定列数即可,`value`总是为`0` -- 示例: - ```js - "colhidden": { - "30": 0, - "31": 0 - } - ``` - -#### config.borderInfo -- 类型:Array -- 默认值:{} -- 作用:单元格的边框信息 -- 示例: - ```js - "borderInfo": [{ - "rangeType": "cell", - "value": { - "row_index": 3, - "col_index": 3, - "l": { - "style": 10, - "color": "rgb(255, 0, 0)" - }, - "r": { - "style": 10, - "color": "rgb(255, 0, 0)" - }, - "t": { - "style": 10, - "color": "rgb(255, 0, 0)" - }, - "b": { - "style": 10, - "color": "rgb(255, 0, 0)" - } - } - }, - { - "rangeType": "range", - "borderType": "border-all", - "style": "3", - "color": "#0000ff", - "range": [{ - "row": [7, 8], - "column": [2, 3] - }] - }, { - "rangeType": "range", - "borderType": "border-inside", - "style": "3", - "color": "#0000ff", - "range": [{ - "row": [7, 8], - "column": [8, 9] - }] - }] - ``` - 范围类型分单个单元格和选区两种情况 - 1. 选区 `rangeType: "range"` - - + 边框类型 `borderType:"border-left" | "border-right" | "border-top" | "border-bottom" | "border-all" | "border-outside" | "border-inside" | "border-horizontal" | "border-vertical" | "border-none"`, - + 边框粗细 `style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick`,和aspose.cells的getLineStyle()的值对应的话,需要自己做个转换,参考 [aspose.cells](https://apireference.aspose.com/cells/net/aspose.cells/cellbordertype) - + 边框颜色 `color: 16进制颜色值` - + 选区范围 `range: 行列信息数组` - - 2. 单个单元格 `rangeType:"cell"` - + 单元格的行数和列数索引 `value.row_index: 数字,value.col_index: 数字` - + 四个边框对象 `value.l:左边框,value.r:右边框,value.t:上边框,value.b:下边框` - + 边框粗细 `value.l.style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick` - + 边框颜色 `value.l.color: 16进制颜色值` - - 更多模板: - - + ```js - { - "rangeType": "range", - "borderType": "border-all", - "style": "3", - "color": "#0000ff", - "range": [{ - "row": [7, 8], - "column": [2, 3] - }] - } - ``` - 表示设置范围为`{"row": [7, 8],"column": [2, 3]}`的选区,类型为所有边框,边框粗细为`Dotted`,颜色为`"#0000ff"` - - + ```js - { - "rangeType": "cell", - "value": { - "row_index": 3, - "col_index": 3, - "l": { - "style": 10, - "color": "rgb(255, 0, 0)" - }, - "r": { - "style": 10, - "color": "rgb(255, 0, 0)" - }, - "t": { - "style": 10, - "color": "rgb(255, 0, 0)" - }, - "b": { - "style": 10, - "color": "rgb(255, 0, 0)" - } - } - } - ``` - 表示设置单元格`"D4"`,上边框/下边框/左边框/右边框都是边框粗细为`"MediumDashDot"`,颜色为`"rgb(255, 0, 0)"` - -#### config.authority -- 类型:Object -- 默认值:{} -- 作用:工作表保护,可以设置当前整个工作表不允许编辑或者部分区域不可编辑,如果要申请编辑权限需要输入密码,自定义配置用户可以操作的类型等。 -- 示例: - ```js - "authority":{//当前工作表的权限配置 -     selectLockedCells:1, //选定锁定单元格 -     selectunLockedCells:1, //选定解除锁定的单元格 -     formatCells:1, //设置单元格格式 -     formatColumns:1, //设置列格式 -     formatRows:1, //设置行格式 -     insertColumns:1, //插入列 -     insertRows:1, //插入行 -     insertHyperlinks:1, //插入超链接 -     deleteColumns:1, //删除列 -     deleteRows:1, //删除行 -     sort:1, //排序 -     filter:1, //使用自动筛选 -     usePivotTablereports:1, //使用数据透视表和报表 -     editObjects:1, //编辑对象 -     editScenarios:1, //编辑方案     -     sheet:1, //如果为1或true,则该工作表受到保护;如果为0或false,则该工作表不受保护。 -     hintText:"", //弹窗提示的文字 -     algorithmName:"None",//加密方案:MD2,MD4,MD5,RIPEMD-128,RIPEMD-160,SHA-1,SHA-256,SHA-384,SHA-512,WHIRLPOOL -     saltValue:null, //密码解密的盐参数,为一个自己定的随机数值 -      -     allowRangeList:[{ //区域保护 -         name:"area", //名称 -         password:"1", //密码 -         hintText:"", //提示文字 -         algorithmName:"None",//加密方案:MD2,MD4,MD5,RIPEMD-128,RIPEMD-160,SHA-1,SHA-256,SHA-384,SHA-512,WHIRLPOOL -         saltValue:null, //密码解密的盐参数,为一个自己定的随机数值 -         sqref:"$C$1:$D$5" //区域范围 -     }], - }, - ``` - ------------- -### scrollLeft -- 类型:Number -- 默认值:0 -- 作用: 左右滚动条位置 - ------------- -### scrollTop -- 类型:Number -- 默认值:0 -- 作用: 上下滚动条位置 - ------------- -### luckysheet_select_save -- 类型:Array -- 默认值:[] -- 作用: 选中的区域,支持多选,是一个包含多个选区对象的一维数组 -- 示例: - ```js - [ - { - "row": [ 0, 1 ], - "column": [ 0, 0 ] - }, - { - "row": [ 3, 4 ], - "column": [ 1, 2 ] - }, - { - "row": [ 1, 3 ], - "column": [ 3, 3 ] - } - ] - ``` - ------------- -### calcChain -- 类型:Array -- 默认值:[] -- 作用: 公式链是一个由用户指定顺序排列的公式信息数组,Luckysheet会根据此顺序来决定公式执行的顺序。 - - 注意,在初始化工作簿的时候,如果有单元格包含公式,请务必添加对应单元格位置的公式链,否则Luckysheet无法识别公式。 - -- 示例: - ```js - [{ - "r": 6, //行数 - "c": 3, //列数 - "index": 1, //工作表id - "func": [true, 23.75, "=AVERAGE(D3:D6)"], //公式信息,包含公式计算结果和公式字符串 - "color": "w", //"w":采用深度优先算法 "b":普通计算 - "parent": null, - "chidren": {}, - "times": 0 - }, { - "r": 7, - "c": 3, - "index": 1, - "func": [true, 30, "=MAX(D3:D6)"], - "color": "w", - "parent": null, - "chidren": {}, - "times": 0 - }] - ``` - ------------- -### isPivotTable -- 类型:Boolean -- 默认值:false -- 作用: 是否数据透视表 - ------------- -### pivotTable -- 类型:Object -- 默认值:{} -- 作用: 数据透视表设置 -- 示例: - ```js - { - "pivot_select_save": { - "row": [0, 12], - "column": [0, 4] - }, - "pivotDataSheetIndex": 6, //源数据所在的sheet页 - "column": [{ - "index": 3, - "name": "subject", - "fullname": "subject" - }], - "row": [{ - "index": 1, - "name": "student", - "fullname": "student" - }], - "filter": [], - "values": [{ - "index": 4, - "name": "score", - "fullname": "count:score", - "sumtype": "COUNTA", - "nameindex": 0 - }], - "showType": "column", - "pivotDatas": [ //数据透视表的源数据 - ["count:score", "science", "mathematics", "foreign language", "English", "total"], - ["Alex", 1, 1, 1, 1, 4], - ["Joy", 1, 1, 1, 1, 4], - ["Tim", 1, 1, 1, 1, 4], - ["total", 3, 3, 3, 3, 12] - ], - "drawPivotTable": false, - "pivotTableBoundary": [5, 6] - } - ``` - ------------- -### filter_select -- 类型:Object -- 默认值:{} -- 作用: 筛选范围。一个选区,一个sheet只有一个筛选范围,类似`luckysheet_select_save`。如果仅仅只是创建一个选区打开筛选功能,则配置这个范围即可,如果还需要进一步设置详细的筛选条件,则需要另外配置同级的 [filter](#filter) 属性。 -- 示例: - ```js - { - - "row": [ 2, 6 ], - "column": [ 1, 3 ] - } - ``` - ------------- -### filter -- 类型:Object -- 默认值:{} -- 作用: 筛选的具体设置,跟`filter_select`筛选范围是互相搭配的。当你在第一个sheet页创建了一个筛选区域,通过`luckysheet.getLuckysheetfile()[0].filter`也可以看到第一个sheet的筛选配置信息。 - - 以下是一个完整的筛选配置案例 - ```js - { - //"0"表示第一列 - "0": { - "caljs": { // 按条件筛选 - "value": "cellnull", // 筛选类型 - "text": "Is empty", // 类型说明 - "type": "0" // 筛选大类 - }, - "rowhidden": { "3": 0, "4": 0 }, // 隐藏行信息 - "optionstate": true, // 是否开启配置 - "cindex": 1, // 当前范围列顺序,这里表示第一列 - "str": 2, // 范围,起始行 - "edr": 6, // 范围,结束行 - "stc": 1, // 范围,起始列 - "edc": 3 // 范围,结束列 - }, - //"1"表示第二列 - "1": { - "caljs": {}, - "rowhidden": { "1": 0}, - "optionstate": true, - "cindex": 2, // 当前范围列顺序,这里表示第二列 - "str": 2, - "edr": 6, - "stc": 1, - "edc": 3 - } - } - ``` - 1. `filter[key]`的`key`值,表示是列索引,从0开始,具体设置项中的`cindex`是从1开始,和这里的`key`是同一个意思。 - 2. `caljs`用来设置按条件筛选的类型和对应的值,设置生效后,会计算隐藏行信息存储在`rowhidden`中。以下是全部的可设置的类型,其中`value1`和`value2`就是用户自己填的文本信息: - + `caljs:{value: null, text: "无", type: "0"}` - + `caljs:{value: "cellnull", text: "单元格为空", type: "0"}` - + `caljs:{value: "cellnonull", text: "单元格有数据", type: "0"}` - + `caljs:{value: "textinclude", text: "文本包含", type: "1", value1: "Lucky"}` - + `caljs:{value: "textnotinclude", text: "文本不包含", type: "1", value1: "Lucky"}` - + `caljs:{value: "textstart", text: "文本开头为", type: "1", value1: "Lucky"}` - + `caljs:{value: "textend", text: "文本结尾为", type: "1", value1: "Lucky"}` - + `caljs:{value: "textequal", text: "文本等于", type: "1", value1: "Lucky"}` - + `caljs:{value: "dateequal", text: "日期等于", type: "1", value1: "2020-10-16"}` - + `caljs:{value: "datelessthan", text: "日期早于", type: "1", value1: "2020-10-16"}` - + `caljs:{value: "datemorethan", text: "日期晚于", type: "1", value1: "2020-10-16"}` - + `caljs:{value: "morethan", text: "大于", type: "1", value1: "10"}` - + `caljs:{value: "moreequalthan", text: "大于等于", type: "1", value1: "10"}` - + `caljs:{value: "lessthan", text: "小于", type: "1", value1: "10"}` - + `caljs:{value: "lessequalthan", text: "小于等于", type: "1", value1: "10"}` - + `caljs:{value: "equal", text: "等于", type: "1", value1: "10"}` - + `caljs:{value: "noequal", text: "不等于", type: "1", value1: "10"}` - + `caljs:{value: "include", text: "介于", type: "2", value1: "15", value2: "25"}` - + `caljs:{value: "noinclude", text: "不在其中", type: "2", value1: "15", value2: "25"}` - 3. `rowhidden`是存储的隐藏行信息,但是如果没有设置`caljs`按条件筛选,则表明是设置了按颜色筛选(如果行之间有颜色区分的话)和按值进行筛选。所以可以看出,`caljs`的优先级大于`rowhidden`。 - 4. `optionstate`表示是否开启配置,这是一个内部标识,直接设置`true`即可。 - 5. `cindex`表示当前设置的列顺序,从1开始计数,和`filter[key]`的`key`值形成对应,结果是`key`+1。 - 6. `str`是起始行,`edr`是结束行,`stc`是起始列,`edc`是结束列,四个数字代表整个筛选范围,与`filter_select`的内容保持一致即可。 - ------------- -### luckysheet_alternateformat_save -- 类型:Array -- 默认值:[] -- 作用: 交替颜色配置 -- 示例: - ```js - [{ - "cellrange": { //单元格范围 - "row": [1, 6], - "column": [1, 5] - }, - "format": { - "head": { //页眉颜色 - "fc": "#000", - "bc": "#5ed593" - }, - "one": { //第一种颜色 - "fc": "#000", - "bc": "#ffffff" - }, - "two": { //第二种颜色 - "fc": "#000", - "bc": "#e5fbee" - }, - "foot": { //页脚颜色 - "fc": "#000", - "bc": "#a5efcc" - } - }, - "hasRowHeader": false, //含有页眉 - "hasRowFooter": false //含有页脚 - }, { - "cellrange": { - "row": [1, 6], - "column": [8, 12] - }, - "format": { - "head": { - "fc": "#000", - "bc": "#5599fc" - }, - "one": { - "fc": "#000", - "bc": "#ffffff" - }, - "two": { - "fc": "#000", - "bc": "#ecf2fe" - }, - "foot": { - "fc": "#000", - "bc": "#afcbfa" - } - }, - "hasRowHeader": false, - "hasRowFooter": false - }] - ``` - ------------- -### luckysheet_alternateformat_save_modelCustom -- 类型:Array -- 默认值:[] -- 作用:自定义交替颜色,包含多个自定义交替颜色的配置 -- 示例: - ```js - [{ - "head": { //页眉颜色 - "fc": "#6aa84f", - "bc": "#ffffff" - }, - "one": { //第一种颜色 - "fc": "#000", - "bc": "#ffffff" - }, - "two": { //第二种颜色 - "fc": "#000", - "bc": "#e5fbee" - }, - "foot": { //页脚颜色 - "fc": "#000", - "bc": "#a5efcc" - } - }] - ``` - ------------- -### luckysheet_conditionformat_save -- 类型:Array -- 默认值:[] -- 作用: 条件格式配置信息,包含多个条件格式配置对象的一维数组, - - type: "default": 突出显示单元格规则和项目选区规则, - - "dataBar":数据条, - - "icons":图标集, - - "colorGradation": 色阶 - - API中对此设置也有介绍[API setRangeConditionalFormat](/zh/guide/api.html) -- 示例: - ```js - [ - { - "type": "default", - "cellrange": [ //应用的范围 - { - "row": [ 2, 7 ], - "column": [ 2, 2 ] - } - ], - "format": { //type 为 default 时 应设置文本颜色和单元格颜色 - "textColor": "#000000", - "cellColor": "#ff0000" - }, - "conditionName": "betweenness", //类型 - "conditionRange": [ //条件值所在单元格 - { - "row": [ 4, 4 ], - "column": [ 2, 2 ] - }, - { - "row": [ 6, 6 ], - "column": [ 2, 2 ] - } - ], - "conditionValue": [ 2, 4 - ] //自定义传入的条件值 - }, - { - "type": "dataBar", - "cellrange": [ - { - "row": [ 10, 15 ], - "column": [ 10, 11 ] - } - ], - "format": [ - "#6aa84f", - "#ffffff" - ] - }, - { - "type": "icons", - "cellrange": [ - { - "row": [ 19, 23 ], - "column": [ 2, 2 ] - } - ], - "format": { - "len": "3", - "leftMin": "0", - "top": "0" - } - }, - { - "type": "colorGradation", - "cellrange": [ - { - "row": [ 10, 15 ], - "column": [ 6, 6 ] - } - ], - "format": [ - "rgb(99, 190, 123)", - "rgb(255, 235, 132)", - "rgb(248, 105, 107)" - ] - } - ] - ``` - ------------- -### frozen -- 类型:Array -- 默认值:[] -- 作用: 冻结行列设置,分为6种类型 - 1. "row": 冻结首行 - 2. "column": 冻结首列 - 3. "both": 冻结行列 - 4. "rangeRow": 冻结行到选区 - 5. "rangeColumn": 冻结列到选区 - 6. "rangeBoth": 冻结行列到选区 - 7. "cancel": 取消冻结 - - 当设置冻结到选区的时候,需要设置开启冻结的单元格位置,格式为`{ row_focus:0, column_focus:0 }`,意为当前激活的单元格的行数和列数。 - - sheet新的配置属性,存储更语义化的配置,用于初始化和传给后端。 - - 注意一点,luckysheetfile中还有一个配置freezen,其中的freezenhorizontaldata仍然用作本地数据,但是不发给后台存储,只做本地调试。 - -- 示例: - - 冻结首行 - ```json - { - type: 'row' - } - ``` - - 冻结行到`'A1'`选区 - ```json - { - type: 'rangeRow', - range: {row_focus: 0, column_focus: 0} - } - ``` - - 冻结行列到`'B2'`选区 - ```json - { - type: 'rangeBoth', - range: {row_focus: 1, column_focus: 1} - } - ``` - ------------- -### chart -- 类型:Array -- 默认值:[] -- 作用: 图表配置,参照chartMix的配置格式,允许只设置想要的图表属性,一个完整的配置案例如下。 -- 示例: - :::::: details - ```json - { - "chart_id": "chart_p145W6i73otw_1596209943446", - "width": 400, - "height": 250, - "left": 20, - "top": 120, - "sheetIndex": "Sheet_6az6nei65t1i_1596209937084", - "needRangeShow": true, - "chartOptions": { - "chart_id": "chart_p145W6i73otw_1596209943446", - "chartAllType": "echarts|line|default", - "rangeArray": [ { "row": [ 0, 4 ], "column": [ 0, 7 ] } ], - "rangeColCheck": { "exits": true, "range": [ 0, 0 ] }, - "rangeRowCheck": { "exits": true, "range": [ 0, 0 ] }, - "rangeConfigCheck": false, - "defaultOption": { - "title": { - "show": false, - "text": "默认标题", - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "position": { - "value": "left-top", - "offsetX": 40, - "offsetY": 50 - } - }, - "subtitle": { - "show": false, - "text": "", - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "distance": { - "value": "auto", - "cusGap": 40 - } - }, - "config": { - "color": "transparent", - "fontFamily": "Sans-serif", - "grid": { - "value": "normal", - "top": 5, - "left": 10, - "right": 20, - "bottom": 10 - } - }, - "legend": { - "show": true, - "selectMode": "multiple", - "selected": [ - { - "seriesName": "衣服", - "isShow": true - }, - { - "seriesName": "食材", - "isShow": true - }, - { - "seriesName": "图书", - "isShow": true - } - ], - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "position": { - "value": "left-top", - "offsetX": 40, - "offsetY": 50, - "direction": "horizontal" - }, - "width": { - "value": "auto", - "cusSize": 25 - }, - "height": { - "value": "auto", - "cusSize": 14 - }, - "distance": { - "value": "auto", - "cusGap": 10 - }, - "itemGap": 10, - "data": [ - "Mon", - "Tues", - "Wed", - "Thur", - "Fri", - "Sat", - "Sun" - ] - }, - "tooltip": { - "show": true, - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "backgroundColor": "rgba(50,50,50,0.7)", - "triggerOn": "mousemove", - "triggerType": "item", - "axisPointer": { - "type": "line", - "style": { - "color": "#555", - "width": "normal", - "type": "solid" - } - }, - "format": [ - { - "seriesName": "衣服", - "prefix": "", - "suffix": "", - "ratio": 1, - "digit": "auto" - }, - { - "seriesName": "食材", - "prefix": "", - "suffix": "", - "ratio": 1, - "digit": "auto" - }, - { - "seriesName": "图书", - "prefix": "", - "suffix": "", - "ratio": 1, - "digit": "auto" - } - ], - "position": "auto" - }, - "axis": { - "axisType": "xAxisDown", - "xAxisUp": { - "show": false, - "title": { - "showTitle": false, - "text": "", - "nameGap": 15, - "rotate": 0, - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "fzPosition": "end" - }, - "name": "显示X轴", - "inverse": false, - "tickLine": { - "show": true, - "width": 1, - "color": "auto" - }, - "tick": { - "show": true, - "position": "outside", - "length": 5, - "width": 1, - "color": "auto" - }, - "tickLabel": { - "show": true, - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "rotate": 0, - "prefix": "", - "suffix": "", - "optimize": 0, - "distance": 0, - "min": "auto", - "max": "auto", - "ratio": 1, - "digit": "auto" - }, - "netLine": { - "show": false, - "width": 1, - "type": "solid", - "color": "auto", - "interval": { - "value": "auto", - "cusNumber": 0 - } - }, - "netArea": { - "show": false, - "interval": { - "value": "auto", - "cusNumber": 0 - }, - "colorOne": "auto", - "colorTwo": "auto" - }, - "axisLine": { - "onZero": false - } - }, - "xAxisDown": { - "show": true, - "title": { - "showTitle": false, - "text": "", - "nameGap": 15, - "rotate": 0, - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "fzPosition": "end" - }, - "name": "显示X轴", - "inverse": false, - "tickLine": { - "show": true, - "width": 1, - "color": "auto" - }, - "tick": { - "show": true, - "position": "outside", - "length": 5, - "width": 1, - "color": "auto" - }, - "tickLabel": { - "show": true, - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "rotate": 0, - "prefix": "", - "suffix": "", - "optimize": 0, - "distance": 0, - "min": null, - "max": null, - "ratio": 1, - "digit": "auto" - }, - "netLine": { - "show": false, - "width": 1, - "type": "solid", - "color": "auto", - "interval": { - "value": "auto", - "cusNumber": 0 - } - }, - "netArea": { - "show": false, - "interval": { - "value": "auto", - "cusNumber": 0 - }, - "colorOne": "auto", - "colorTwo": "auto" - }, - "data": [ - "BUS", - "UBER", - "TAXI", - "SUBWAY" - ], - "type": "category" - }, - "yAxisLeft": { - "show": true, - "title": { - "showTitle": false, - "text": "", - "nameGap": 15, - "rotate": 0, - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "fzPosition": "end" - }, - "name": "显示Y轴", - "inverse": false, - "tickLine": { - "show": true, - "width": 1, - "color": "auto" - }, - "tick": { - "show": true, - "position": "outside", - "length": 5, - "width": 1, - "color": "auto" - }, - "tickLabel": { - "show": true, - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "rotate": 0, - "formatter": { - "prefix": "", - "suffix": "", - "ratio": 1, - "digit": "auto" - }, - "split": 5, - "min": null, - "max": null, - "prefix": "", - "suffix": "", - "ratio": 1, - "digit": "auto", - "distance": 0 - }, - "netLine": { - "show": false, - "width": 1, - "type": "solid", - "color": "auto", - "interval": { - "value": "auto", - "cusNumber": 0 - } - }, - "netArea": { - "show": false, - "interval": { - "value": "auto", - "cusNumber": 0 - }, - "colorOne": "auto", - "colorTwo": "auto" - }, - "type": "value" - }, - "yAxisRight": { - "show": false, - "title": { - "showTitle": false, - "text": "", - "nameGap": 15, - "rotate": 0, - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "fzPosition": "end" - }, - "name": "显示Y轴", - "inverse": false, - "tickLine": { - "show": true, - "width": 1, - "color": "auto" - }, - "tick": { - "show": true, - "position": "outside", - "length": 5, - "width": 1, - "color": "auto" - }, - "tickLabel": { - "show": true, - "label": { - "fontSize": 12, - "color": "#333", - "fontFamily": "sans-serif", - "fontGroup": [], - "cusFontSize": 12 - }, - "rotate": 0, - "formatter": { - "prefix": "", - "suffix": "", - "ratio": 1, - "digit": "auto" - }, - "split": 5, - "min": null, - "max": null, - "prefix": "", - "suffix": "", - "ratio": 1, - "digit": "auto", - "distance": 0 - }, - "netLine": { - "show": false, - "width": 1, - "type": "solid", - "color": "auto", - "interval": { - "value": "auto", - "cusNumber": 0 - } - }, - "netArea": { - "show": false, - "interval": { - "value": "auto", - "cusNumber": 0 - }, - "colorOne": "auto", - "colorTwo": "auto" - } - } - } - } - }, - "isShow": true - } - ``` - ::: - ------------- -### zoomRatio -- 类型:Number -- 默认值:1 -- 作用: 此sheet页的缩放比例,为0~1之间的二位小数数字。比如`0.1`、`0.56` - ------------- -### image -- 类型:Array -- 默认值:[] -- 作用: 插入表格中图片信息,包含图片地址、宽高、位置、裁剪等信息 -- 示例: - 以下为一个`imageItem`案例,通常一个工作表中可能存在多个图片,所以`image`的格式为数组`[imageItem,imageItem,...]` - ```json - { - type: '3', //1移动并调整单元格大小 2移动并且不调整单元格的大小 3不要移动单元格并调整其大小 - src: '', //图片url - originWidth: 1484, //图片原始宽度 - originHeight: 834, //图片原始高度 - default: { - width: 293, //图片 宽度 - height: 196, //图片 高度 - left: 409, //图片离表格左边的 位置 - top: 248, //图片离表格顶部的 位置 - }, - crop: { - width: 293, //图片裁剪后 宽度 - height: 196, //图片裁剪后 高度 - offsetLeft: 0, //图片裁剪后离未裁剪时 左边的位移 - offsetTop: 0, //图片裁剪后离未裁剪时 顶部的位移 - }, - isFixedPos: false, //固定位置 - fixedLeft: 507, //固定位置 左位移 - fixedTop: 141, //固定位置 右位移 - border: { - width: 0, //边框宽度 - radius: 0, //边框半径 - style: 'solid', //边框类型 - color: '#000', //边框颜色 - } - } - ``` ------------- -### showGridLines -- 类型:Number -- 默认值:1 -- 作用:是否显示网格线,`1`表示显示,`0`表示隐藏 - ------------- -### dataVerification -- 类型:Object -- 默认值:{} -- 作用:数据验证的配置信息。以下列出了所有需要设置的详细字段: - + {String} [type]: 类型;值可为 - + `"dropdown"`(下拉列表) - + `"checkbox"`(复选框) - + `"number"`(数字) - + `"number_integer"`(数字-整数) - + `"number_decimal"`(数字-小数) - + `"text_content"`(文本-内容) - + `"text_length"`(文本-长度) - + `"date"`(日期) - + `"validity"`(有效性); - + {String | Null} [type2]: 条件类型; - + 类型`type`值为`"checkbox"`时,`type2`值可为 - + `null`; - + 类型`type`值为`"dropdown"`时,`type2`值可为 - + `true` (多选) `false` (单选) - + 类型`type`值为`"number"/"number_integer"/"number_decimal"/"text_length"`时,`type2`值可为 - + `"bw"`(介于) - + `"nb"`(不介于) - + `"eq"`(等于) - + `"ne"`(不等于) - + `"gt"`(大于) - + `"lt"`(小于) - + `"gte"`(大于等于) - + `"lte"`(小于等于) - + 类型`type`值为`"text_content"`时,`type2`值可为 - + `"include"`(包括) - + `"exclude"`(不包括) - + `"equal"`(等于) - + 类型`type`值为`"date"`时,`type2`值可为 - + `"bw"`(介于) - + `"nb"`(不介于) - + `"eq"`(等于) - + `"ne"`(不等于) - + `"bf"`(早于) - + `"nbf"`(不早于) - + `"af"`(晚于) - + `"naf"`(不晚于) - + 类型`type`值为`"validity"`时,`type2`值可为 - + `"card"`(身份证号码) - + `"phone"`(手机号); - + {String | Number} [value1]: 条件值1; - + 类型`type`值为`"dropdown"`时,`value1`值可为选区或以英文逗号隔开的字符串,如`"1,2,3"`或者`"A1:B2"`; - + 类型`type`值为`"validity"`时,`value1`值可为空; - + 其他类型时`value1`值为数值或字符串; - + {String | Number} [value2]: 条件值2; - + 类型`type`值为`"checkbox"`或者条件类型`type2`值为`"bw"`、`"nb"`时有`value2`值,条件值为数值或日期时,条件值2要大于等于条件值1;其它情况可为空; - + {Boolean} [remote]: 自动远程获取选项;默认为`false`; - + {Boolean} [prohibitInput]: 输入数据无效时禁止输入;默认为`false`; - + {Boolean} [hintShow]: 选中单元格时显示提示语;默认为`false`; - + {String} [hintText]: 提示语文本;`hintShow`为`true`时需配置; - + {Boolean} [checked]: 是否勾选中复选框;`type`为`checkbox`时需配置; - - 一个完整的配置案例请参考源码DEMO示例 [/src/demoData/sheetDataVerification.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/demoData/sheetDataVerification.js) ------------- -## 调试信息 - -初始化所需要的参数,会从简洁的角度出发来考虑设计,但是本地存储的参数则不同。 - -Luckysheet在初始化完成之后进行的一系列操作,会将更多本地参数存储在luckysheetfile中,作为本地使用的参数,实现一些类似Store数据中心的作用。比如,freezen的参数格式也会变化。 - -此时的luckysheetfile包含很多非初始化使用的本地参数,可用于调试代码、本地状态分析。如下展示了更丰富luckysheetfile信息,可通过方法 `luckysheet.getluckysheetfile()`获得: - -::: details -```json -[ - { - "name": "Cell", //工作表名称 - "color": "", //工作表颜色 - "index": 0, //工作表索引 - "status": 1, //激活状态 - "order": 0, //工作表的下标 - "hide": 0,//是否隐藏 - "row": 36, //行数 - "column": 18, //列数 - "celldata": [], //初始化使用的单元格数据 - "config": { - "merge":{}, //合并单元格 - "rowlen":{}, //表格行高 - "columnlen":{}, //表格列宽 - "rowhidden":{}, //隐藏行 - "colhidden":{}, //隐藏列 - "borderInfo":{}, //边框 - "authority":{}, //工作表保护 - }, - "scrollLeft": 0, //左右滚动条位置 - "scrollTop": 315, //上下滚动条位置 - "luckysheet_select_save": [], //选中的区域 - "calcChain": [],//公式链 - "isPivotTable":false,//是否数据透视表 - "pivotTable":{},//数据透视表设置 - "filter_select": {},//筛选范围 - "filter": null,//筛选配置 - "luckysheet_alternateformat_save": [], //交替颜色 - "luckysheet_alternateformat_save_modelCustom": [], //自定义交替颜色 - "luckysheet_conditionformat_save": {},//条件格式 - "frozen": {}, //冻结行列配置 - "freezen": {}, //冻结行列的渲染数据存储 - "chart": [], //图表配置 - "zoomRatio":1, // 缩放比例 - "image":[], //图片 - "showGridLines": 1, //是否显示网格线 - "dataVerification":{} //数据验证配置 - - - "visibledatarow": [], //所有行的位置 - "visibledatacolumn": [], //所有列的位置 - "ch_width": 2322, //工作表区域的宽度 - "rh_height": 949, //工作表区域的高度 - "load": "1", //已加载过此sheet的标识 - "data": [], //更新和存储使用的单元格数据 - }, - { - "name": "Sheet2", - "color": "", - "index": 1, - "status": 0, - "order": 1, - "celldata": [], - "config": {} - }, - { - "name": "Sheet3", - "color": "", - "index": 2, - "status": 0, - "order": 2, - "celldata": [], - "config": {}, - } -] -``` -::: - -### visibledatarow -- 类型:Number -- 默认值:[] -- 作用: 所有行的位置信息,递增的行位置数据,初始化无需设置 - ------------- -### visibledatacolumn -- 类型:Number -- 默认值:[] -- 作用: 所有列的位置信息,递增的列位置数据,初始化无需设置 - ------------- -### ch_width -- 类型:Number -- 默认值:2322 -- 作用: 整个工作表区域的宽度(包含边界的灰色区域),初始化无需设置 - ------------- -### rh_height -- 类型:Number -- 默认值:2322 -- 作用: 整个工作表区域的高度(包含边界的灰色区域),初始化无需设置 - ------------- -### load -- 类型:Number -- 默认值:0 -- 作用: 当前sheet是否加载过,内部标识,初始化无需设置 - ------------- -### data -- 类型:Array -- 默认值:[] -- 作用: 初始化时从celldata转换而来,后续操作表格的数据更新,会更新到这个data字段中,初始化无需设置 -- 示例: - 以下是一个二行二列的数据 - ```json - [ - [{ - ct: {fa: "General", t: "g"}, - m:"value1", - v:"value1" - }, { - ct: {fa: "General", t: "g"}, - m:"value2", - v:"value2" - }], - [{ - ct: {fa: "General", t: "g"}, - m:"value3", - v:"value3" - }, { - ct: {fa: "General", t: "g"}, - m:"value4", - v:"value4" - }] - ] - - ``` - ------------- +# 工作表配置 + +## 初始化配置 +表格初始化配置`options`时,需要配置一个由每个工作表参数组成的一维数组,赋给`options.data`。 + +> 表格初始化完成之后,通过方法[`luckysheet.getAllSheets()`](/zh/guide/api.html#getAllSheets([setting]))可以获取所有工作表的配置信息。 + +options.data示例如下: +```json +[ + { + "name": "Cell", //工作表名称 + "color": "", //工作表颜色 + "index": 0, //工作表索引 + "status": 1, //激活状态 + "order": 0, //工作表的下标 + "hide": 0,//是否隐藏 + "row": 36, //行数 + "column": 18, //列数 + "defaultRowHeight": 19, //自定义行高 + "defaultColWidth": 73, //自定义列宽 + "celldata": [], //初始化使用的单元格数据 + "config": { + "merge":{}, //合并单元格 + "rowlen":{}, //表格行高 + "columnlen":{}, //表格列宽 + "rowhidden":{}, //隐藏行 + "colhidden":{}, //隐藏列 + "borderInfo":{}, //边框 + "authority":{}, //工作表保护 + + }, + "scrollLeft": 0, //左右滚动条位置 + "scrollTop": 315, //上下滚动条位置 + "luckysheet_select_save": [], //选中的区域 + "calcChain": [],//公式链 + "isPivotTable":false,//是否数据透视表 + "pivotTable":{},//数据透视表设置 + "filter_select": {},//筛选范围 + "filter": null,//筛选配置 + "luckysheet_alternateformat_save": [], //交替颜色 + "luckysheet_alternateformat_save_modelCustom": [], //自定义交替颜色 + "luckysheet_conditionformat_save": {},//条件格式 + "frozen": {}, //冻结行列配置 + "chart": [], //图表配置 + "zoomRatio":1, // 缩放比例 + "image":[], //图片 + "showGridLines": 1, //是否显示网格线 + "dataVerification":{} //数据验证配置 + }, + { + "name": "Sheet2", + "color": "", + "index": 1, + "status": 0, + "order": 1, + "celldata": [], + "config": {} + }, + { + "name": "Sheet3", + "color": "", + "index": 2, + "status": 0, + "order": 2, + "celldata": [], + "config": {}, + } +] +``` + +### name +- 类型:String +- 默认值:"Sheet1" +- 作用:工作表名称 + +------------ +### color +- 类型:String +- 默认值:"##f20e0e" +- 作用:工作表颜色,工作表名称下方会有一条底部边框 + +------------ +### index +- 类型:String +- 默认值:"" +- 作用:工作表索引,作为唯一key值使用,新增工作表时会自动赋值一个随机字符串。注意`index`不是工作表顺序,和`order`区分开。 + +------------ +### status +- 类型:Number +- 默认值:1 +- 作用: 激活状态,仅有一个激活状态的工作表,其他工作表为 0 + +------------ +### order +- 类型:Number +- 默认值:0 +- 作用: 工作表的下标,代表工作表在底部sheet栏展示的顺序,新增工作表时会递增,从0开始 + +------------ +### hide +- 类型:Number +- 默认值:0 +- 作用: 是否隐藏,`0`为不隐藏,`1`为隐藏 + +------------ +### row +- 类型:Number +- 默认值:36 +- 作用: 单元格行数 + +------------ +### column +- 类型:Number +- 默认值:18 +- 作用: 单元格列数 + +------------ +### defaultRowHeight +- 类型:Number +- 默认值:19 +- 作用: 自定义的默认行高,单位为px + +------------ +### defaultColWidth +- 类型:Number +- 默认值:73 +- 作用: 自定义的默认列宽,单位为px + +------------ +### celldata +- 类型:Array +- 默认值:[] +- 作用: 原始单元格数据集,存储sheet中所有单元格中的值,是一个包含`{r:0,c:0,v:{m:"value",v:"value",ct: {fa: "General", t: "g"}}}`格式单元格信息的一维数组,只在初始化的时候使用。 + + r代表行,c代表列,v代表该单元格的值,值可以是字符、数字或者对象。 + + Luckysheet在建立的时候会根据 `options.data[i].row` 和 `options.data[i].column` 的行列数量大小新建一个表格data,然后再使用 `data[r][c]=v` 的方式填充表格数据,空数据单元格以null表示。 + + 使用celldata初始化完表格后,数据转换为luckysheetfile中的字段[data](#data),如`luckysheetfile[i].data`,后续操作表格的数据更新,会更新到这个data字段中,celldata不再使用。 + +- 示例: + ```js + [{ + "r": 0, + "c": 0, + "v": { + ct: {fa: "General", t: "g"}, + m:"value1", + v:"value1" + } + }, { + "r": 0, + "c": 1, + "v": { + ct: {fa: "General", t: "g"}, + m:"value2", + v:"value2" + } + }] + ``` +> 详细了解 [单元格格式](/zh/guide/cell.html) + +------------ +### config +- 类型:Object +- 默认值:{} +- 作用:表格行高、列宽、合并单元格、边框、隐藏行等设置 + + 注意,config如果为空,必须为空对象`{}`,不能为字符串或者null + +#### config.merge +- 类型:Object +- 默认值:{} +- 作用:合并单元格设置 +- 示例: + ```js + { + "13_5": { + "r": 13, + "c": 5, + "rs": 3, + "cs": 1 + }, + "13_7": { + "r": 13, + "c": 7, + "rs": 3, + "cs": 2 + }, + "14_2": { + "r": 14, + "c": 2, + "rs": 1, + "cs": 2 + } + } + ``` + 对象中的`key`为`r + '_' + c`的拼接值,`value`为左上角单元格信息: r:行数,c:列数,rs:合并的行数,cs:合并的列数 + +#### config.rowlen +- 类型:Object +- 默认值:{} +- 作用:每个单元格的行高 +- 示例: + ```js + "rowlen": { + "0": 20, + "1": 20, + "2": 20 + } + ``` + +#### config.columnlen +- 类型:Object +- 默认值:{} +- 作用:每个单元格的列宽 +- 示例: + ```js + "columnlen": { + "0": 97, + "1": 115, + "2": 128 + } + ``` + +#### config.rowhidden +- 类型:Object +- 默认值:{} +- 作用:隐藏行信息,格式为:`rowhidden[行数]: 0`, + + `key`指定行数即可,`value`总是为`0` +- 示例: + ```js + "rowhidden": { + "30": 0, + "31": 0 + } + ``` + +#### config.colhidden +- 类型:Object +- 默认值:{} +- 作用:隐藏列 + 格式为:`colhidden[列数]: 0`, + + `key`指定列数即可,`value`总是为`0` +- 示例: + ```js + "colhidden": { + "30": 0, + "31": 0 + } + ``` + +#### config.borderInfo +- 类型:Array +- 默认值:{} +- 作用:单元格的边框信息 +- 示例: + ```js + "borderInfo": [{ + "rangeType": "cell", + "value": { + "row_index": 3, + "col_index": 3, + "l": { + "style": 10, + "color": "rgb(255, 0, 0)" + }, + "r": { + "style": 10, + "color": "rgb(255, 0, 0)" + }, + "t": { + "style": 10, + "color": "rgb(255, 0, 0)" + }, + "b": { + "style": 10, + "color": "rgb(255, 0, 0)" + } + } + }, + { + "rangeType": "range", + "borderType": "border-all", + "style": "3", + "color": "#0000ff", + "range": [{ + "row": [7, 8], + "column": [2, 3] + }] + }, { + "rangeType": "range", + "borderType": "border-inside", + "style": "3", + "color": "#0000ff", + "range": [{ + "row": [7, 8], + "column": [8, 9] + }] + }] + ``` + 范围类型分单个单元格和选区两种情况 + 1. 选区 `rangeType: "range"` + + + 边框类型 `borderType:"border-left" | "border-right" | "border-top" | "border-bottom" | "border-all" | "border-outside" | "border-inside" | "border-horizontal" | "border-vertical" | "border-none"`, + + 边框粗细 `style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick`,和aspose.cells的getLineStyle()的值对应的话,需要自己做个转换,参考 [aspose.cells](https://apireference.aspose.com/cells/net/aspose.cells/cellbordertype) + + 边框颜色 `color: 16进制颜色值` + + 选区范围 `range: 行列信息数组` + + 2. 单个单元格 `rangeType:"cell"` + + 单元格的行数和列数索引 `value.row_index: 数字,value.col_index: 数字` + + 四个边框对象 `value.l:左边框,value.r:右边框,value.t:上边框,value.b:下边框` + + 边框粗细 `value.l.style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick` + + 边框颜色 `value.l.color: 16进制颜色值` + + 更多模板: + + + ```js + { + "rangeType": "range", + "borderType": "border-all", + "style": "3", + "color": "#0000ff", + "range": [{ + "row": [7, 8], + "column": [2, 3] + }] + } + ``` + 表示设置范围为`{"row": [7, 8],"column": [2, 3]}`的选区,类型为所有边框,边框粗细为`Dotted`,颜色为`"#0000ff"` + + + ```js + { + "rangeType": "cell", + "value": { + "row_index": 3, + "col_index": 3, + "l": { + "style": 10, + "color": "rgb(255, 0, 0)" + }, + "r": { + "style": 10, + "color": "rgb(255, 0, 0)" + }, + "t": { + "style": 10, + "color": "rgb(255, 0, 0)" + }, + "b": { + "style": 10, + "color": "rgb(255, 0, 0)" + } + } + } + ``` + 表示设置单元格`"D4"`,上边框/下边框/左边框/右边框都是边框粗细为`"MediumDashDot"`,颜色为`"rgb(255, 0, 0)"` + +#### config.authority +- 类型:Object +- 默认值:{} +- 作用:工作表保护,可以设置当前整个工作表不允许编辑或者部分区域不可编辑,如果要申请编辑权限需要输入密码,自定义配置用户可以操作的类型等。 +- 示例: + ```js + "authority":{//当前工作表的权限配置 +     selectLockedCells:1, //选定锁定单元格 +     selectunLockedCells:1, //选定解除锁定的单元格 +     formatCells:1, //设置单元格格式 +     formatColumns:1, //设置列格式 +     formatRows:1, //设置行格式 +     insertColumns:1, //插入列 +     insertRows:1, //插入行 +     insertHyperlinks:1, //插入超链接 +     deleteColumns:1, //删除列 +     deleteRows:1, //删除行 +     sort:1, //排序 +     filter:1, //使用自动筛选 +     usePivotTablereports:1, //使用数据透视表和报表 +     editObjects:1, //编辑对象 +     editScenarios:1, //编辑方案     +     sheet:1, //如果为1或true,则该工作表受到保护;如果为0或false,则该工作表不受保护。 +     hintText:"", //弹窗提示的文字 +     algorithmName:"None",//加密方案:MD2,MD4,MD5,RIPEMD-128,RIPEMD-160,SHA-1,SHA-256,SHA-384,SHA-512,WHIRLPOOL +     saltValue:null, //密码解密的盐参数,为一个自己定的随机数值 +      +     allowRangeList:[{ //区域保护 +         name:"area", //名称 +         password:"1", //密码 +         hintText:"", //提示文字 +         algorithmName:"None",//加密方案:MD2,MD4,MD5,RIPEMD-128,RIPEMD-160,SHA-1,SHA-256,SHA-384,SHA-512,WHIRLPOOL +         saltValue:null, //密码解密的盐参数,为一个自己定的随机数值 +         sqref:"$C$1:$D$5" //区域范围 +     }], + }, + ``` + +------------ +### scrollLeft +- 类型:Number +- 默认值:0 +- 作用: 左右滚动条位置 + +------------ +### scrollTop +- 类型:Number +- 默认值:0 +- 作用: 上下滚动条位置 + +------------ +### luckysheet_select_save +- 类型:Array +- 默认值:[] +- 作用: 选中的区域,支持多选,是一个包含多个选区对象的一维数组 +- 示例: + ```js + [ + { + "row": [ 0, 1 ], + "column": [ 0, 0 ] + }, + { + "row": [ 3, 4 ], + "column": [ 1, 2 ] + }, + { + "row": [ 1, 3 ], + "column": [ 3, 3 ] + } + ] + ``` + +------------ +### calcChain +- 类型:Array +- 默认值:[] +- 作用: 公式链是一个由用户指定顺序排列的公式信息数组,Luckysheet会根据此顺序来决定公式执行的顺序。 + + 注意,在初始化工作簿的时候,如果有单元格包含公式,请务必添加对应单元格位置的公式链,否则Luckysheet无法识别公式。 + +- 示例: + ```js + [{ + "r": 6, //行数 + "c": 3, //列数 + "index": 1, //工作表id + "func": [true, 23.75, "=AVERAGE(D3:D6)"], //公式信息,包含公式计算结果和公式字符串 + "color": "w", //"w":采用深度优先算法 "b":普通计算 + "parent": null, + "chidren": {}, + "times": 0 + }, { + "r": 7, + "c": 3, + "index": 1, + "func": [true, 30, "=MAX(D3:D6)"], + "color": "w", + "parent": null, + "chidren": {}, + "times": 0 + }] + ``` + +------------ +### isPivotTable +- 类型:Boolean +- 默认值:false +- 作用: 是否数据透视表 + +------------ +### pivotTable +- 类型:Object +- 默认值:{} +- 作用: 数据透视表设置 +- 示例: + ```js + { + "pivot_select_save": { + "row": [0, 12], + "column": [0, 4] + }, + "pivotDataSheetIndex": 6, //源数据所在的sheet页 + "column": [{ + "index": 3, + "name": "subject", + "fullname": "subject" + }], + "row": [{ + "index": 1, + "name": "student", + "fullname": "student" + }], + "filter": [], + "values": [{ + "index": 4, + "name": "score", + "fullname": "count:score", + "sumtype": "COUNTA", + "nameindex": 0 + }], + "showType": "column", + "pivotDatas": [ //数据透视表的源数据 + ["count:score", "science", "mathematics", "foreign language", "English", "total"], + ["Alex", 1, 1, 1, 1, 4], + ["Joy", 1, 1, 1, 1, 4], + ["Tim", 1, 1, 1, 1, 4], + ["total", 3, 3, 3, 3, 12] + ], + "drawPivotTable": false, + "pivotTableBoundary": [5, 6] + } + ``` + +------------ +### filter_select +- 类型:Object +- 默认值:{} +- 作用: 筛选范围。一个选区,一个sheet只有一个筛选范围,类似`luckysheet_select_save`。如果仅仅只是创建一个选区打开筛选功能,则配置这个范围即可,如果还需要进一步设置详细的筛选条件,则需要另外配置同级的 [filter](#filter) 属性。 +- 示例: + ```js + { + + "row": [ 2, 6 ], + "column": [ 1, 3 ] + } + ``` + +------------ +### filter +- 类型:Object +- 默认值:{} +- 作用: 筛选的具体设置,跟`filter_select`筛选范围是互相搭配的。当你在第一个sheet页创建了一个筛选区域,通过`luckysheet.getLuckysheetfile()[0].filter`也可以看到第一个sheet的筛选配置信息。 + + 以下是一个完整的筛选配置案例 + ```js + { + //"0"表示第一列 + "0": { + "caljs": { // 按条件筛选 + "value": "cellnull", // 筛选类型 + "text": "Is empty", // 类型说明 + "type": "0" // 筛选大类 + }, + "rowhidden": { "3": 0, "4": 0 }, // 隐藏行信息 + "optionstate": true, // 是否开启配置 + "cindex": 1, // 当前范围列顺序,这里表示第一列 + "str": 2, // 范围,起始行 + "edr": 6, // 范围,结束行 + "stc": 1, // 范围,起始列 + "edc": 3 // 范围,结束列 + }, + //"1"表示第二列 + "1": { + "caljs": {}, + "rowhidden": { "1": 0}, + "optionstate": true, + "cindex": 2, // 当前范围列顺序,这里表示第二列 + "str": 2, + "edr": 6, + "stc": 1, + "edc": 3 + } + } + ``` + 1. `filter[key]`的`key`值,表示是列索引,从0开始,具体设置项中的`cindex`是从1开始,和这里的`key`是同一个意思。 + 2. `caljs`用来设置按条件筛选的类型和对应的值,设置生效后,会计算隐藏行信息存储在`rowhidden`中。以下是全部的可设置的类型,其中`value1`和`value2`就是用户自己填的文本信息: + + `caljs:{value: null, text: "无", type: "0"}` + + `caljs:{value: "cellnull", text: "单元格为空", type: "0"}` + + `caljs:{value: "cellnonull", text: "单元格有数据", type: "0"}` + + `caljs:{value: "textinclude", text: "文本包含", type: "1", value1: "Lucky"}` + + `caljs:{value: "textnotinclude", text: "文本不包含", type: "1", value1: "Lucky"}` + + `caljs:{value: "textstart", text: "文本开头为", type: "1", value1: "Lucky"}` + + `caljs:{value: "textend", text: "文本结尾为", type: "1", value1: "Lucky"}` + + `caljs:{value: "textequal", text: "文本等于", type: "1", value1: "Lucky"}` + + `caljs:{value: "dateequal", text: "日期等于", type: "1", value1: "2020-10-16"}` + + `caljs:{value: "datelessthan", text: "日期早于", type: "1", value1: "2020-10-16"}` + + `caljs:{value: "datemorethan", text: "日期晚于", type: "1", value1: "2020-10-16"}` + + `caljs:{value: "morethan", text: "大于", type: "1", value1: "10"}` + + `caljs:{value: "moreequalthan", text: "大于等于", type: "1", value1: "10"}` + + `caljs:{value: "lessthan", text: "小于", type: "1", value1: "10"}` + + `caljs:{value: "lessequalthan", text: "小于等于", type: "1", value1: "10"}` + + `caljs:{value: "equal", text: "等于", type: "1", value1: "10"}` + + `caljs:{value: "noequal", text: "不等于", type: "1", value1: "10"}` + + `caljs:{value: "include", text: "介于", type: "2", value1: "15", value2: "25"}` + + `caljs:{value: "noinclude", text: "不在其中", type: "2", value1: "15", value2: "25"}` + 3. `rowhidden`是存储的隐藏行信息,但是如果没有设置`caljs`按条件筛选,则表明是设置了按颜色筛选(如果行之间有颜色区分的话)和按值进行筛选。所以可以看出,`caljs`的优先级大于`rowhidden`。 + 4. `optionstate`表示是否开启配置,这是一个内部标识,直接设置`true`即可。 + 5. `cindex`表示当前设置的列顺序,从1开始计数,和`filter[key]`的`key`值形成对应,结果是`key`+1。 + 6. `str`是起始行,`edr`是结束行,`stc`是起始列,`edc`是结束列,四个数字代表整个筛选范围,与`filter_select`的内容保持一致即可。 + +------------ +### luckysheet_alternateformat_save +- 类型:Array +- 默认值:[] +- 作用: 交替颜色配置 +- 示例: + ```js + [{ + "cellrange": { //单元格范围 + "row": [1, 6], + "column": [1, 5] + }, + "format": { + "head": { //页眉颜色 + "fc": "#000", + "bc": "#5ed593" + }, + "one": { //第一种颜色 + "fc": "#000", + "bc": "#ffffff" + }, + "two": { //第二种颜色 + "fc": "#000", + "bc": "#e5fbee" + }, + "foot": { //页脚颜色 + "fc": "#000", + "bc": "#a5efcc" + } + }, + "hasRowHeader": false, //含有页眉 + "hasRowFooter": false //含有页脚 + }, { + "cellrange": { + "row": [1, 6], + "column": [8, 12] + }, + "format": { + "head": { + "fc": "#000", + "bc": "#5599fc" + }, + "one": { + "fc": "#000", + "bc": "#ffffff" + }, + "two": { + "fc": "#000", + "bc": "#ecf2fe" + }, + "foot": { + "fc": "#000", + "bc": "#afcbfa" + } + }, + "hasRowHeader": false, + "hasRowFooter": false + }] + ``` + +------------ +### luckysheet_alternateformat_save_modelCustom +- 类型:Array +- 默认值:[] +- 作用:自定义交替颜色,包含多个自定义交替颜色的配置 +- 示例: + ```js + [{ + "head": { //页眉颜色 + "fc": "#6aa84f", + "bc": "#ffffff" + }, + "one": { //第一种颜色 + "fc": "#000", + "bc": "#ffffff" + }, + "two": { //第二种颜色 + "fc": "#000", + "bc": "#e5fbee" + }, + "foot": { //页脚颜色 + "fc": "#000", + "bc": "#a5efcc" + } + }] + ``` + +------------ +### luckysheet_conditionformat_save +- 类型:Array +- 默认值:[] +- 作用: 条件格式配置信息,包含多个条件格式配置对象的一维数组, + + type: "default": 突出显示单元格规则和项目选区规则, + + "dataBar":数据条, + + "icons":图标集, + + "colorGradation": 色阶 + + API中对此设置也有介绍[API setRangeConditionalFormat](/zh/guide/api.html) +- 示例: + ```js + [ + { + "type": "default", + "cellrange": [ //应用的范围 + { + "row": [ 2, 7 ], + "column": [ 2, 2 ] + } + ], + "format": { //type 为 default 时 应设置文本颜色和单元格颜色 + "textColor": "#000000", + "cellColor": "#ff0000" + }, + "conditionName": "betweenness", //类型 + "conditionRange": [ //条件值所在单元格 + { + "row": [ 4, 4 ], + "column": [ 2, 2 ] + }, + { + "row": [ 6, 6 ], + "column": [ 2, 2 ] + } + ], + "conditionValue": [ 2, 4 + ] //自定义传入的条件值 + }, + { + "type": "dataBar", + "cellrange": [ + { + "row": [ 10, 15 ], + "column": [ 10, 11 ] + } + ], + "format": [ + "#6aa84f", + "#ffffff" + ] + }, + { + "type": "icons", + "cellrange": [ + { + "row": [ 19, 23 ], + "column": [ 2, 2 ] + } + ], + "format": { + "len": "3", + "leftMin": "0", + "top": "0" + } + }, + { + "type": "colorGradation", + "cellrange": [ + { + "row": [ 10, 15 ], + "column": [ 6, 6 ] + } + ], + "format": [ + "rgb(99, 190, 123)", + "rgb(255, 235, 132)", + "rgb(248, 105, 107)" + ] + } + ] + ``` + +------------ +### frozen +- 类型:Array +- 默认值:[] +- 作用: 冻结行列设置,分为6种类型 + 1. "row": 冻结首行 + 2. "column": 冻结首列 + 3. "both": 冻结行列 + 4. "rangeRow": 冻结行到选区 + 5. "rangeColumn": 冻结列到选区 + 6. "rangeBoth": 冻结行列到选区 + 7. "cancel": 取消冻结 + + 当设置冻结到选区的时候,需要设置开启冻结的单元格位置,格式为`{ row_focus:0, column_focus:0 }`,意为当前激活的单元格的行数和列数。 + + sheet新的配置属性,存储更语义化的配置,用于初始化和传给后端。 + + 注意一点,luckysheetfile中还有一个配置freezen,其中的freezenhorizontaldata仍然用作本地数据,但是不发给后台存储,只做本地调试。 + +- 示例: + - 冻结首行 + ```json + { + type: 'row' + } + ``` + - 冻结行到`'A1'`选区 + ```json + { + type: 'rangeRow', + range: {row_focus: 0, column_focus: 0} + } + ``` + - 冻结行列到`'B2'`选区 + ```json + { + type: 'rangeBoth', + range: {row_focus: 1, column_focus: 1} + } + ``` + +------------ +### chart +- 类型:Array +- 默认值:[] +- 作用: 图表配置,参照chartMix的配置格式,允许只设置想要的图表属性,一个完整的配置案例如下。 +- 示例: + :::::: details + ```json + { + "chart_id": "chart_p145W6i73otw_1596209943446", + "width": 400, + "height": 250, + "left": 20, + "top": 120, + "sheetIndex": "Sheet_6az6nei65t1i_1596209937084", + "needRangeShow": true, + "chartOptions": { + "chart_id": "chart_p145W6i73otw_1596209943446", + "chartAllType": "echarts|line|default", + "rangeArray": [ { "row": [ 0, 4 ], "column": [ 0, 7 ] } ], + "rangeColCheck": { "exits": true, "range": [ 0, 0 ] }, + "rangeRowCheck": { "exits": true, "range": [ 0, 0 ] }, + "rangeConfigCheck": false, + "defaultOption": { + "title": { + "show": false, + "text": "默认标题", + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "position": { + "value": "left-top", + "offsetX": 40, + "offsetY": 50 + } + }, + "subtitle": { + "show": false, + "text": "", + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "distance": { + "value": "auto", + "cusGap": 40 + } + }, + "config": { + "color": "transparent", + "fontFamily": "Sans-serif", + "grid": { + "value": "normal", + "top": 5, + "left": 10, + "right": 20, + "bottom": 10 + } + }, + "legend": { + "show": true, + "selectMode": "multiple", + "selected": [ + { + "seriesName": "衣服", + "isShow": true + }, + { + "seriesName": "食材", + "isShow": true + }, + { + "seriesName": "图书", + "isShow": true + } + ], + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "position": { + "value": "left-top", + "offsetX": 40, + "offsetY": 50, + "direction": "horizontal" + }, + "width": { + "value": "auto", + "cusSize": 25 + }, + "height": { + "value": "auto", + "cusSize": 14 + }, + "distance": { + "value": "auto", + "cusGap": 10 + }, + "itemGap": 10, + "data": [ + "Mon", + "Tues", + "Wed", + "Thur", + "Fri", + "Sat", + "Sun" + ] + }, + "tooltip": { + "show": true, + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "backgroundColor": "rgba(50,50,50,0.7)", + "triggerOn": "mousemove", + "triggerType": "item", + "axisPointer": { + "type": "line", + "style": { + "color": "#555", + "width": "normal", + "type": "solid" + } + }, + "format": [ + { + "seriesName": "衣服", + "prefix": "", + "suffix": "", + "ratio": 1, + "digit": "auto" + }, + { + "seriesName": "食材", + "prefix": "", + "suffix": "", + "ratio": 1, + "digit": "auto" + }, + { + "seriesName": "图书", + "prefix": "", + "suffix": "", + "ratio": 1, + "digit": "auto" + } + ], + "position": "auto" + }, + "axis": { + "axisType": "xAxisDown", + "xAxisUp": { + "show": false, + "title": { + "showTitle": false, + "text": "", + "nameGap": 15, + "rotate": 0, + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "fzPosition": "end" + }, + "name": "显示X轴", + "inverse": false, + "tickLine": { + "show": true, + "width": 1, + "color": "auto" + }, + "tick": { + "show": true, + "position": "outside", + "length": 5, + "width": 1, + "color": "auto" + }, + "tickLabel": { + "show": true, + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "rotate": 0, + "prefix": "", + "suffix": "", + "optimize": 0, + "distance": 0, + "min": "auto", + "max": "auto", + "ratio": 1, + "digit": "auto" + }, + "netLine": { + "show": false, + "width": 1, + "type": "solid", + "color": "auto", + "interval": { + "value": "auto", + "cusNumber": 0 + } + }, + "netArea": { + "show": false, + "interval": { + "value": "auto", + "cusNumber": 0 + }, + "colorOne": "auto", + "colorTwo": "auto" + }, + "axisLine": { + "onZero": false + } + }, + "xAxisDown": { + "show": true, + "title": { + "showTitle": false, + "text": "", + "nameGap": 15, + "rotate": 0, + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "fzPosition": "end" + }, + "name": "显示X轴", + "inverse": false, + "tickLine": { + "show": true, + "width": 1, + "color": "auto" + }, + "tick": { + "show": true, + "position": "outside", + "length": 5, + "width": 1, + "color": "auto" + }, + "tickLabel": { + "show": true, + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "rotate": 0, + "prefix": "", + "suffix": "", + "optimize": 0, + "distance": 0, + "min": null, + "max": null, + "ratio": 1, + "digit": "auto" + }, + "netLine": { + "show": false, + "width": 1, + "type": "solid", + "color": "auto", + "interval": { + "value": "auto", + "cusNumber": 0 + } + }, + "netArea": { + "show": false, + "interval": { + "value": "auto", + "cusNumber": 0 + }, + "colorOne": "auto", + "colorTwo": "auto" + }, + "data": [ + "BUS", + "UBER", + "TAXI", + "SUBWAY" + ], + "type": "category" + }, + "yAxisLeft": { + "show": true, + "title": { + "showTitle": false, + "text": "", + "nameGap": 15, + "rotate": 0, + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "fzPosition": "end" + }, + "name": "显示Y轴", + "inverse": false, + "tickLine": { + "show": true, + "width": 1, + "color": "auto" + }, + "tick": { + "show": true, + "position": "outside", + "length": 5, + "width": 1, + "color": "auto" + }, + "tickLabel": { + "show": true, + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "rotate": 0, + "formatter": { + "prefix": "", + "suffix": "", + "ratio": 1, + "digit": "auto" + }, + "split": 5, + "min": null, + "max": null, + "prefix": "", + "suffix": "", + "ratio": 1, + "digit": "auto", + "distance": 0 + }, + "netLine": { + "show": false, + "width": 1, + "type": "solid", + "color": "auto", + "interval": { + "value": "auto", + "cusNumber": 0 + } + }, + "netArea": { + "show": false, + "interval": { + "value": "auto", + "cusNumber": 0 + }, + "colorOne": "auto", + "colorTwo": "auto" + }, + "type": "value" + }, + "yAxisRight": { + "show": false, + "title": { + "showTitle": false, + "text": "", + "nameGap": 15, + "rotate": 0, + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "fzPosition": "end" + }, + "name": "显示Y轴", + "inverse": false, + "tickLine": { + "show": true, + "width": 1, + "color": "auto" + }, + "tick": { + "show": true, + "position": "outside", + "length": 5, + "width": 1, + "color": "auto" + }, + "tickLabel": { + "show": true, + "label": { + "fontSize": 12, + "color": "#333", + "fontFamily": "sans-serif", + "fontGroup": [], + "cusFontSize": 12 + }, + "rotate": 0, + "formatter": { + "prefix": "", + "suffix": "", + "ratio": 1, + "digit": "auto" + }, + "split": 5, + "min": null, + "max": null, + "prefix": "", + "suffix": "", + "ratio": 1, + "digit": "auto", + "distance": 0 + }, + "netLine": { + "show": false, + "width": 1, + "type": "solid", + "color": "auto", + "interval": { + "value": "auto", + "cusNumber": 0 + } + }, + "netArea": { + "show": false, + "interval": { + "value": "auto", + "cusNumber": 0 + }, + "colorOne": "auto", + "colorTwo": "auto" + } + } + } + } + }, + "isShow": true + } + ``` + ::: + +------------ +### zoomRatio +- 类型:Number +- 默认值:1 +- 作用: 此sheet页的缩放比例,为0~1之间的二位小数数字。比如`0.1`、`0.56` + +------------ +### image +- 类型:Array +- 默认值:[] +- 作用: 插入表格中图片信息,包含图片地址、宽高、位置、裁剪等信息 +- 示例: + 以下为一个`imageItem`案例,通常一个工作表中可能存在多个图片,所以`image`的格式为数组`[imageItem,imageItem,...]` + ```json + { + type: '3', //1移动并调整单元格大小 2移动并且不调整单元格的大小 3不要移动单元格并调整其大小 + src: '', //图片url + originWidth: 1484, //图片原始宽度 + originHeight: 834, //图片原始高度 + default: { + width: 293, //图片 宽度 + height: 196, //图片 高度 + left: 409, //图片离表格左边的 位置 + top: 248, //图片离表格顶部的 位置 + }, + crop: { + width: 293, //图片裁剪后 宽度 + height: 196, //图片裁剪后 高度 + offsetLeft: 0, //图片裁剪后离未裁剪时 左边的位移 + offsetTop: 0, //图片裁剪后离未裁剪时 顶部的位移 + }, + isFixedPos: false, //固定位置 + fixedLeft: 507, //固定位置 左位移 + fixedTop: 141, //固定位置 右位移 + border: { + width: 0, //边框宽度 + radius: 0, //边框半径 + style: 'solid', //边框类型 + color: '#000', //边框颜色 + } + } + ``` +------------ +### showGridLines +- 类型:Number +- 默认值:1 +- 作用:是否显示网格线,`1`表示显示,`0`表示隐藏 + +------------ +### dataVerification +- 类型:Object +- 默认值:{} +- 作用:数据验证的配置信息。以下列出了所有需要设置的详细字段: + + {String} [type]: 类型;值可为 + + `"dropdown"`(下拉列表) + + `"checkbox"`(复选框) + + `"number"`(数字) + + `"number_integer"`(数字-整数) + + `"number_decimal"`(数字-小数) + + `"text_content"`(文本-内容) + + `"text_length"`(文本-长度) + + `"date"`(日期) + + `"validity"`(有效性); + + {String | Null} [type2]: 条件类型; + + 类型`type`值为`"checkbox"`时,`type2`值可为 + + `null`; + + 类型`type`值为`"dropdown"`时,`type2`值可为 + + `true` (多选) `false` (单选) + + 类型`type`值为`"number"/"number_integer"/"number_decimal"/"text_length"`时,`type2`值可为 + + `"bw"`(介于) + + `"nb"`(不介于) + + `"eq"`(等于) + + `"ne"`(不等于) + + `"gt"`(大于) + + `"lt"`(小于) + + `"gte"`(大于等于) + + `"lte"`(小于等于) + + 类型`type`值为`"text_content"`时,`type2`值可为 + + `"include"`(包括) + + `"exclude"`(不包括) + + `"equal"`(等于) + + 类型`type`值为`"date"`时,`type2`值可为 + + `"bw"`(介于) + + `"nb"`(不介于) + + `"eq"`(等于) + + `"ne"`(不等于) + + `"bf"`(早于) + + `"nbf"`(不早于) + + `"af"`(晚于) + + `"naf"`(不晚于) + + 类型`type`值为`"validity"`时,`type2`值可为 + + `"card"`(身份证号码) + + `"phone"`(手机号); + + {String | Number} [value1]: 条件值1; + + 类型`type`值为`"dropdown"`时,`value1`值可为选区或以英文逗号隔开的字符串,如`"1,2,3"`或者`"A1:B2"`; + + 类型`type`值为`"validity"`时,`value1`值可为空; + + 其他类型时`value1`值为数值或字符串; + + {String | Number} [value2]: 条件值2; + + 类型`type`值为`"checkbox"`或者条件类型`type2`值为`"bw"`、`"nb"`时有`value2`值,条件值为数值或日期时,条件值2要大于等于条件值1;其它情况可为空; + + {Boolean} [remote]: 自动远程获取选项;默认为`false`; + + {Boolean} [prohibitInput]: 输入数据无效时禁止输入;默认为`false`; + + {Boolean} [hintShow]: 选中单元格时显示提示语;默认为`false`; + + {String} [hintText]: 提示语文本;`hintShow`为`true`时需配置; + + {Boolean} [checked]: 是否勾选中复选框;`type`为`checkbox`时需配置; + + 一个完整的配置案例请参考源码DEMO示例 [/src/demoData/sheetDataVerification.js](https://github.com/mengshukeji/Luckysheet/blob/master/src/demoData/sheetDataVerification.js) +------------ +## 调试信息 + +初始化所需要的参数,会从简洁的角度出发来考虑设计,但是本地存储的参数则不同。 + +Luckysheet在初始化完成之后进行的一系列操作,会将更多本地参数存储在luckysheetfile中,作为本地使用的参数,实现一些类似Store数据中心的作用。比如,freezen的参数格式也会变化。 + +此时的luckysheetfile包含很多非初始化使用的本地参数,可用于调试代码、本地状态分析。如下展示了更丰富luckysheetfile信息,可通过方法 `luckysheet.getluckysheetfile()`获得: + +::: details +```json +[ + { + "name": "Cell", //工作表名称 + "color": "", //工作表颜色 + "index": 0, //工作表索引 + "status": 1, //激活状态 + "order": 0, //工作表的下标 + "hide": 0,//是否隐藏 + "row": 36, //行数 + "column": 18, //列数 + "celldata": [], //初始化使用的单元格数据 + "config": { + "merge":{}, //合并单元格 + "rowlen":{}, //表格行高 + "columnlen":{}, //表格列宽 + "rowhidden":{}, //隐藏行 + "colhidden":{}, //隐藏列 + "borderInfo":{}, //边框 + "authority":{}, //工作表保护 + }, + "scrollLeft": 0, //左右滚动条位置 + "scrollTop": 315, //上下滚动条位置 + "luckysheet_select_save": [], //选中的区域 + "calcChain": [],//公式链 + "isPivotTable":false,//是否数据透视表 + "pivotTable":{},//数据透视表设置 + "filter_select": {},//筛选范围 + "filter": null,//筛选配置 + "luckysheet_alternateformat_save": [], //交替颜色 + "luckysheet_alternateformat_save_modelCustom": [], //自定义交替颜色 + "luckysheet_conditionformat_save": {},//条件格式 + "frozen": {}, //冻结行列配置 + "freezen": {}, //冻结行列的渲染数据存储 + "chart": [], //图表配置 + "zoomRatio":1, // 缩放比例 + "image":[], //图片 + "showGridLines": 1, //是否显示网格线 + "dataVerification":{} //数据验证配置 + + + "visibledatarow": [], //所有行的位置 + "visibledatacolumn": [], //所有列的位置 + "ch_width": 2322, //工作表区域的宽度 + "rh_height": 949, //工作表区域的高度 + "load": "1", //已加载过此sheet的标识 + "data": [], //更新和存储使用的单元格数据 + }, + { + "name": "Sheet2", + "color": "", + "index": 1, + "status": 0, + "order": 1, + "celldata": [], + "config": {} + }, + { + "name": "Sheet3", + "color": "", + "index": 2, + "status": 0, + "order": 2, + "celldata": [], + "config": {}, + } +] +``` +::: + +### visibledatarow +- 类型:Number +- 默认值:[] +- 作用: 所有行的位置信息,递增的行位置数据,初始化无需设置 + +------------ +### visibledatacolumn +- 类型:Number +- 默认值:[] +- 作用: 所有列的位置信息,递增的列位置数据,初始化无需设置 + +------------ +### ch_width +- 类型:Number +- 默认值:2322 +- 作用: 整个工作表区域的宽度(包含边界的灰色区域),初始化无需设置 + +------------ +### rh_height +- 类型:Number +- 默认值:2322 +- 作用: 整个工作表区域的高度(包含边界的灰色区域),初始化无需设置 + +------------ +### load +- 类型:Number +- 默认值:0 +- 作用: 当前sheet是否加载过,内部标识,初始化无需设置 + +------------ +### data +- 类型:Array +- 默认值:[] +- 作用: 初始化时从celldata转换而来,后续操作表格的数据更新,会更新到这个data字段中,初始化无需设置 +- 示例: + 以下是一个二行二列的数据 + ```json + [ + [{ + ct: {fa: "General", t: "g"}, + m:"value1", + v:"value1" + }, { + ct: {fa: "General", t: "g"}, + m:"value2", + v:"value2" + }], + [{ + ct: {fa: "General", t: "g"}, + m:"value3", + v:"value3" + }, { + ct: {fa: "General", t: "g"}, + m:"value4", + v:"value4" + }] + ] + + ``` + +------------ diff --git a/gulpfile.js b/gulpfile.js index f7823fd44..4dfc1fcac 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,303 +1,302 @@ -const gulp = require('gulp'); -// gulp core function -const { src, dest, series, parallel, watch } = require('gulp'); -// gulp compress js -const uglify = require('gulp-uglify'); -// gulp judgment -const gulpif = require('gulp-if'); -// gulp compress css -const cleanCSS = require('gulp-clean-css'); -// Delete Files -const del = require('delete'); -// Refresh the browser in real time -const browserSync = require('browser-sync').create(); -const reload = browserSync.reload; -// proxy -const { createProxyMiddleware } = require('http-proxy-middleware'); -// According to html reference, files are merged -// const useref = require('gulp-useref'); -// File merge -const concat = require('gulp-concat'); -// rollup packaging, processing es6 modules -const { rollup } = require('rollup'); -// rollup looks for node_modules module -const { nodeResolve } = require('@rollup/plugin-node-resolve'); -// rollup converts commonjs module to es6 module -const commonjs = require('@rollup/plugin-commonjs'); -// rollup code compression -const terser = require('rollup-plugin-terser').terser; -// rollup babel plugin, support the latest ES grammar -const babel = require('@rollup/plugin-babel').default; -// const gulpBabel = require('gulp-babel'); -// Distinguish development and production environments -const production = process.env.NODE_ENV === 'production' ? true : false; - -const pkg = require('./package.json'); -const banner = `/*! @preserve - * ${pkg.name} - * version: ${pkg.version} - * https://github.com/mengshukeji/Luckysheet - */`; - -// uglify js Compression configuration https://github.com/mishoo/UglifyJS#minify-options -const uglifyOptions = { - compress: { - drop_console: true - } -} - -// babel config -const babelConfig = { - compact:false, - babelHelpers: 'bundled', - exclude: 'node_modules/**', // Only compile our source code - plugins: [ - ], - presets: [ - ['@babel/preset-env', { - useBuiltIns: 'usage', - corejs: 3, - targets: { - chrome: 58, - ie: 11 - } - }] - ] -}; - -// file handler paths -const paths = { - // static resources,contains index.html, fonts and images,and extension plugins dependency - staticHtml: ['src/*.html'], - staticFonts: ['src/fonts/**'], - staticAssets: ['src/assets/**'], - staticImages: ['src/plugins/images/*.png'], - staticExpendPlugins: ['src/expendPlugins/**', '!src/expendPlugins/**/plugin.js'], - staticDemoData: ['src/demoData/*.js'], - staticCssImages: ['src/css/**','!src/css/*.css'], - - // static resources dest - destStaticHtml: ['dist'], - destStaticFonts: ['dist/fonts'], - destStaticAssets: ['dist/assets'], - destStaticImages: ['dist/plugins/images'], - destStaticExpendPlugins: ['dist/expendPlugins'], - destStaticDemoData: ['dist/demoData'], - destStaticCssImages: ['dist/css'], - - //core es module - core: ['src/**/*.js','!src/demoData/*.js','src/expendPlugins/**/plugin.js','!src/plugins/js/*.js'], - - //plugins src - pluginsCss: ['src/plugins/css/*.css'], - plugins: ['src/plugins/*.css'], - css:['src/css/*.css','node_modules/flatpickr/dist/themes/light.css'], - pluginsJs:[ - 'node_modules/jquery/dist/jquery.min.js', - 'node_modules/uuid/dist/umd/uuid.min.js', - 'src/plugins/js/clipboard.min.js', - 'src/plugins/js/spectrum.min.js', - 'src/plugins/js/jquery-ui.min.js', - 'src/plugins/js/jquery.mousewheel.min.js', - // 'src/plugins/js/numeral.min.js', - 'src/plugins/js/html2canvas.min.js', - 'src/plugins/js/localforage.min.js', - 'src/plugins/js/lodash.min.js', - 'src/plugins/js/jstat.min.js', - 'src/plugins/js/crypto-api.min.js', - 'src/plugins/js/jquery.sPage.min.js' - ], - - //plugins concat - concatPluginsCss: 'pluginsCss.css', - concatPlugins: 'plugins.css', - concatCss: 'luckysheet.css', - concatPluginsJs: 'plugin.js', - - //plugins dest - destPluginsCss: ['dist/plugins/css'], - destPlugins: ['dist/plugins'], - destCss: ['dist/css'], - destPluginsJs: ['dist/plugins/js'], - - // Package directory - dist: 'dist', -}; - -// Clear the dist directory -function clean() { - return del([paths.dist]); -} - -// proxy middleware -const apiProxy = createProxyMiddleware('/luckysheet/', { - target: 'http://luckysheet.lashuju.com/', // set your server address - changeOrigin: true, // for vhosted sites - ws: true, // proxy websockets -}); - -// Static server -function serve(done) { - browserSync.init({ - server: { - baseDir: paths.dist, - middleware: [apiProxy],//proxy - }, - ghostMode: false, //默认true,滚动和表单在任何设备上输入将被镜像到所有设备里,会影响本地的协同编辑消息,故关闭 - }, done) -} - -// Monitoring file changes -function watcher(done) { - watch(paths.core,{ delay: 500 }, series(core, reloadBrowser)); - - // watch plugins and css - watch(paths.pluginsCss,{ delay: 500 }, series(pluginsCss, reloadBrowser)); - watch(paths.plugins,{ delay: 500 }, series(plugins, reloadBrowser)); - watch(paths.css,{ delay: 500 }, series(css, reloadBrowser)); - watch(paths.pluginsJs,{ delay: 500 }, series(pluginsJs, reloadBrowser)); - - // watch static - watch(paths.staticHtml,{ delay: 500 }, series(copyStaticHtml, reloadBrowser)); - watch(paths.staticFonts,{ delay: 500 }, series(copyStaticFonts, reloadBrowser)); - watch(paths.staticAssets,{ delay: 500 }, series(copyStaticAssets, reloadBrowser)); - watch(paths.staticImages,{ delay: 500 }, series(copyStaticImages, reloadBrowser)); - watch(paths.staticExpendPlugins,{ delay: 500 }, series(copyStaticExpendPlugins, reloadBrowser)); - watch(paths.staticDemoData,{ delay: 500 }, series(copyStaticDemoData, reloadBrowser)); - watch(paths.staticCssImages,{ delay: 500 }, series(copyStaticCssImages, reloadBrowser)); - - done(); -} - -// Refresh browser -function reloadBrowser(done) { - reload(); - - done(); -} - -//Package the core code -async function core_rollup() { - const bundle = await rollup({ - input: 'src/index.js', - plugins: [ - nodeResolve(), // tells Rollup how to find date-fns in node_modules - commonjs(), // converts date-fns to ES modules - // postcss({ - // plugins: [], - // extract: true, - // // minimize: isProductionEnv, - // }), - production && terser(), // minify, but only in production - babel(babelConfig) - ], - }); - - bundle.write({ - file: 'dist/luckysheet.umd.js', - format: 'umd', - name: 'luckysheet', - sourcemap: true, - inlineDynamicImports:true, - banner: banner - }); - - if(production){ - bundle.write({ - file: 'dist/luckysheet.esm.js', - format: 'esm', - name: 'luckysheet', - sourcemap: true, - inlineDynamicImports:true, - banner: banner - }); - } - -} - -async function core() { - - await require('esbuild').buildSync({ - format: 'iife', - globalName: 'luckysheet', - entryPoints: ['src/index.js'], - bundle: true, - minify: production, - banner: { js: banner }, - target: ['es2015'], - sourcemap: true, - outfile: 'dist/luckysheet.umd.js', - logLevel: 'error', - }) -} - -// According to the build tag in html, package js and css -function pluginsCss() { - return src(paths.pluginsCss) - .pipe(concat(paths.concatPluginsCss)) - .pipe(gulpif(production, cleanCSS())) - .pipe(dest(paths.destPluginsCss)) - -} - -function plugins() { - return src(paths.plugins) - .pipe(concat(paths.concatPlugins)) - .pipe(gulpif(production, cleanCSS())) - .pipe(dest(paths.destPlugins)); -} - -function css() { - return src(paths.css) - .pipe(concat(paths.concatCss)) - .pipe(gulpif(production, cleanCSS())) - .pipe(dest(paths.destCss)); -} - -function pluginsJs() { - return src(paths.pluginsJs) - .pipe(concat(paths.concatPluginsJs)) - .pipe(gulpif(production, uglify(uglifyOptions))) - .pipe(dest(paths.destPluginsJs)); -} - -// Copy static resources -function copyStaticHtml(){ - return src(paths.staticHtml) - .pipe(dest(paths.destStaticHtml)); -} -function copyStaticFonts(){ - return src(paths.staticFonts) - .pipe(dest(paths.destStaticFonts)); -} -function copyStaticAssets(){ - return src(paths.staticAssets) - .pipe(dest(paths.destStaticAssets)); -} -function copyStaticImages(){ - return src(paths.staticImages) - .pipe(dest(paths.destStaticImages)); -} -function copyStaticExpendPlugins(){ - return src(paths.staticExpendPlugins) - .pipe(dest(paths.destStaticExpendPlugins)); -} -function copyStaticDemoData(){ - return src(paths.staticDemoData) - .pipe(dest(paths.destStaticDemoData)); - // .pipe(gulpBabel({ - // presets: ['@babel/env'] - // })) - // .pipe(gulp.dest('dist')); -} -function copyStaticCssImages(){ - return src(paths.staticCssImages) - .pipe(dest(paths.destStaticCssImages)); -} - -const dev = series(clean, parallel(pluginsCss, plugins, css, pluginsJs, copyStaticHtml, copyStaticFonts, copyStaticAssets, copyStaticImages, copyStaticExpendPlugins, copyStaticDemoData, copyStaticCssImages, core), watcher, serve); -const build = series(clean, parallel(pluginsCss, plugins, css, pluginsJs, copyStaticHtml, copyStaticFonts, copyStaticAssets, copyStaticImages, copyStaticExpendPlugins, copyStaticDemoData, copyStaticCssImages, core)); - -exports.dev = dev; -exports.build = build; -exports.default = dev; +const gulp = require('gulp'); +// gulp core function +const { src, dest, series, parallel, watch } = require('gulp'); +// gulp compress js +const uglify = require('gulp-uglify'); +// gulp judgment +const gulpif = require('gulp-if'); +// gulp compress css +const cleanCSS = require('gulp-clean-css'); +// Delete Files +const del = require('delete'); +// Refresh the browser in real time +const browserSync = require('browser-sync').create(); +const reload = browserSync.reload; +// proxy +const { createProxyMiddleware } = require('http-proxy-middleware'); +// According to html reference, files are merged +// const useref = require('gulp-useref'); +// File merge +const concat = require('gulp-concat'); +// rollup packaging, processing es6 modules +const { rollup } = require('rollup'); +// rollup looks for node_modules module +const { nodeResolve } = require('@rollup/plugin-node-resolve'); +// rollup converts commonjs module to es6 module +const commonjs = require('@rollup/plugin-commonjs'); +// rollup code compression +const terser = require('rollup-plugin-terser').terser; +// rollup babel plugin, support the latest ES grammar +const babel = require('@rollup/plugin-babel').default; +// const gulpBabel = require('gulp-babel'); +// Distinguish development and production environments +const production = process.env.NODE_ENV === 'production' ? true : false; + +const pkg = require('./package.json'); +const banner = `/*! @preserve + * ${pkg.name} + * version: ${pkg.version} + * https://github.com/mengshukeji/Luckysheet + */`; + +// uglify js Compression configuration https://github.com/mishoo/UglifyJS#minify-options +const uglifyOptions = { + compress: { + drop_console: true + } +} + +// babel config +const babelConfig = { + compact:false, + babelHelpers: 'bundled', + exclude: 'node_modules/**', // Only compile our source code + plugins: [ + ], + presets: [ + ['@babel/preset-env', { + useBuiltIns: 'usage', + corejs: 3, + targets: { + chrome: 58, + ie: 11 + } + }] + ] +}; + +// file handler paths +const paths = { + // static resources,contains index.html, fonts and images,and extension plugins dependency + staticHtml: ['src/*.html'], + staticFonts: ['src/fonts/**'], + staticAssets: ['src/assets/**'], + staticImages: ['src/plugins/images/*.png'], + staticExpendPlugins: ['src/expendPlugins/**', '!src/expendPlugins/**/plugin.js'], + staticDemoData: ['src/demoData/*.js'], + staticCssImages: ['src/css/**','!src/css/*.css'], + + // static resources dest + destStaticHtml: ['dist'], + destStaticFonts: ['dist/fonts'], + destStaticAssets: ['dist/assets'], + destStaticImages: ['dist/plugins/images'], + destStaticExpendPlugins: ['dist/expendPlugins'], + destStaticDemoData: ['dist/demoData'], + destStaticCssImages: ['dist/css'], + + //core es module + core: ['src/**/*.js','!src/demoData/*.js','src/expendPlugins/**/plugin.js','!src/plugins/js/*.js'], + + //plugins src + pluginsCss: ['src/plugins/css/*.css'], + plugins: ['src/plugins/*.css'], + css:['src/css/*.css','node_modules/flatpickr/dist/themes/light.css'], + pluginsJs:[ + 'node_modules/jquery/dist/jquery.min.js', + 'node_modules/uuid/dist/umd/uuid.min.js', + 'src/plugins/js/clipboard.min.js', + 'src/plugins/js/spectrum.min.js', + 'src/plugins/js/jquery-ui.min.js', + 'src/plugins/js/jquery.mousewheel.min.js', + // 'src/plugins/js/numeral.min.js', + 'src/plugins/js/html2canvas.min.js', + 'src/plugins/js/localforage.min.js', + 'src/plugins/js/lodash.min.js', + 'src/plugins/js/jstat.min.js', + 'src/plugins/js/crypto-api.min.js', + 'src/plugins/js/jquery.sPage.min.js' + ], + + //plugins concat + concatPluginsCss: 'pluginsCss.css', + concatPlugins: 'plugins.css', + concatCss: 'luckysheet.css', + concatPluginsJs: 'plugin.js', + + //plugins dest + destPluginsCss: ['dist/plugins/css'], + destPlugins: ['dist/plugins'], + destCss: ['dist/css'], + destPluginsJs: ['dist/plugins/js'], + + // Package directory + dist: 'dist', +}; + +// Clear the dist directory +function clean() { + return del([paths.dist]); +} + +// proxy middleware +const apiProxy = createProxyMiddleware('/luckysheet/', { + target: 'http://luckysheet.lashuju.com/', // set your server address + changeOrigin: true, // for vhosted sites + ws: true, // proxy websockets +}); + +// Static server +function serve(done) { + browserSync.init({ + server: { + baseDir: paths.dist, + middleware: [apiProxy],//proxy + }, + ghostMode: false, //默认true,滚动和表单在任何设备上输入将被镜像到所有设备里,会影响本地的协同编辑消息,故关闭 + }, done) +} + +// Monitoring file changes +function watcher(done) { + watch(paths.core,{ delay: 500 }, series(core, reloadBrowser)); + + // watch plugins and css + watch(paths.pluginsCss,{ delay: 500 }, series(pluginsCss, reloadBrowser)); + watch(paths.plugins,{ delay: 500 }, series(plugins, reloadBrowser)); + watch(paths.css,{ delay: 500 }, series(css, reloadBrowser)); + watch(paths.pluginsJs,{ delay: 500 }, series(pluginsJs, reloadBrowser)); + + // watch static + watch(paths.staticHtml,{ delay: 500 }, series(copyStaticHtml, reloadBrowser)); + watch(paths.staticFonts,{ delay: 500 }, series(copyStaticFonts, reloadBrowser)); + watch(paths.staticAssets,{ delay: 500 }, series(copyStaticAssets, reloadBrowser)); + watch(paths.staticImages,{ delay: 500 }, series(copyStaticImages, reloadBrowser)); + watch(paths.staticExpendPlugins,{ delay: 500 }, series(copyStaticExpendPlugins, reloadBrowser)); + watch(paths.staticDemoData,{ delay: 500 }, series(copyStaticDemoData, reloadBrowser)); + watch(paths.staticCssImages,{ delay: 500 }, series(copyStaticCssImages, reloadBrowser)); + + done(); +} + +// Refresh browser +function reloadBrowser(done) { + reload(); + + done(); +} + +//Package the core code +async function core_rollup() { + const bundle = await rollup({ + input: 'src/index.js', + plugins: [ + nodeResolve(), // tells Rollup how to find date-fns in node_modules + commonjs(), // converts date-fns to ES modules + // postcss({ + // plugins: [], + // extract: true, + // // minimize: isProductionEnv, + // }), + production && terser(), // minify, but only in production + babel(babelConfig) + ], + }); + + bundle.write({ + file: 'dist/luckysheet.umd.js', + format: 'umd', + name: 'luckysheet', + sourcemap: true, + inlineDynamicImports:true, + banner: banner + }); + + if(production){ + bundle.write({ + file: 'dist/luckysheet.esm.js', + format: 'esm', + name: 'luckysheet', + sourcemap: true, + inlineDynamicImports:true, + banner: banner + }); + } + +} + +async function core() { + + await require('esbuild').buildSync({ + format: 'iife', + globalName: 'luckysheet', + entryPoints: ['src/index.js'], + bundle: true, + minify: production, + banner: { js: banner }, + target: ['es2015'], + sourcemap: true, + outfile: 'dist/luckysheet.umd.js', + }) +} + +// According to the build tag in html, package js and css +function pluginsCss() { + return src(paths.pluginsCss) + .pipe(concat(paths.concatPluginsCss)) + .pipe(gulpif(production, cleanCSS())) + .pipe(dest(paths.destPluginsCss)) + +} + +function plugins() { + return src(paths.plugins) + .pipe(concat(paths.concatPlugins)) + .pipe(gulpif(production, cleanCSS())) + .pipe(dest(paths.destPlugins)); +} + +function css() { + return src(paths.css) + .pipe(concat(paths.concatCss)) + .pipe(gulpif(production, cleanCSS())) + .pipe(dest(paths.destCss)); +} + +function pluginsJs() { + return src(paths.pluginsJs) + .pipe(concat(paths.concatPluginsJs)) + .pipe(gulpif(production, uglify(uglifyOptions))) + .pipe(dest(paths.destPluginsJs)); +} + +// Copy static resources +function copyStaticHtml(){ + return src(paths.staticHtml) + .pipe(dest(paths.destStaticHtml)); +} +function copyStaticFonts(){ + return src(paths.staticFonts) + .pipe(dest(paths.destStaticFonts)); +} +function copyStaticAssets(){ + return src(paths.staticAssets) + .pipe(dest(paths.destStaticAssets)); +} +function copyStaticImages(){ + return src(paths.staticImages) + .pipe(dest(paths.destStaticImages)); +} +function copyStaticExpendPlugins(){ + return src(paths.staticExpendPlugins) + .pipe(dest(paths.destStaticExpendPlugins)); +} +function copyStaticDemoData(){ + return src(paths.staticDemoData) + .pipe(dest(paths.destStaticDemoData)); + // .pipe(gulpBabel({ + // presets: ['@babel/env'] + // })) + // .pipe(gulp.dest('dist')); +} +function copyStaticCssImages(){ + return src(paths.staticCssImages) + .pipe(dest(paths.destStaticCssImages)); +} + +const dev = series(clean, parallel(pluginsCss, plugins, css, pluginsJs, copyStaticHtml, copyStaticFonts, copyStaticAssets, copyStaticImages, copyStaticExpendPlugins, copyStaticDemoData, copyStaticCssImages, core), watcher, serve); +const build = series(clean, parallel(pluginsCss, plugins, css, pluginsJs, copyStaticHtml, copyStaticFonts, copyStaticAssets, copyStaticImages, copyStaticExpendPlugins, copyStaticDemoData, copyStaticCssImages, core)); + +exports.dev = dev; +exports.build = build; +exports.default = dev; diff --git a/package.json b/package.json index 5dd4d6ed2..dd4efa1f3 100644 --- a/package.json +++ b/package.json @@ -1,63 +1,67 @@ -{ - "name": "luckysheet", - "version": "2.1.13", - "main": "dist/luckysheet.cjs.js", - "module": "dist/luckysheet.esm.js", - "browser": "dist/luckysheet.umd.js", - "devDependencies": { - "@babel/core": "^7.12.3", - "@babel/preset-env": "^7.12.1", - "@babel/runtime-corejs3": "^7.12.1", - "@commitlint/cli": "^9.1.1", - "@commitlint/config-conventional": "^9.1.1", - "@rollup/plugin-babel": "^5.2.1", - "@rollup/plugin-commonjs": "^13.0.0", - "@rollup/plugin-node-resolve": "^8.0.1", - "browser-sync": "^2.26.7", - "commitizen": "^4.1.2", - "cross-env": "^7.0.2", - "delete": "^1.1.0", - "gulp": "^4.0.2", - "gulp-babel": "^8.0.0", - "gulp-clean-css": "^4.3.0", - "gulp-concat": "^2.6.1", - "gulp-if": "^3.0.0", - "gulp-uglify": "^3.0.2", - "gulp-useref": "^4.0.1", - "http-proxy-middleware": "^1.0.6", - "rollup": "^2.32.1", - "rollup-plugin-terser": "^6.1.0", - "standard-version": "^8.0.2", - "uuid": "^8.3.2", - "vuepress": "^1.5.0", - "vuepress-plugin-baidu-autopush": "^1.0.1", - "vuepress-plugin-code-copy": "^1.0.6", - "vuepress-plugin-seo": "^0.1.4", - "vuepress-plugin-sitemap": "^2.3.1" - }, - "dependencies": { - "@babel/runtime": "^7.12.1", - "dayjs": "^1.9.6", - "esbuild": "^0.11.6", - "flatpickr": "^4.6.6", - "jquery": "^2.2.4", - "numeral": "^2.0.6", - "pako": "^1.0.11" - }, - "scripts": { - "build": "cross-env NODE_ENV=production gulp build", - "dev": "cross-env NODE_ENV=development gulp dev", - "docs:dev": "vuepress dev docs", - "docs:build": "vuepress build docs", - "commit": "git-cz", - "release": "standard-version" - }, - "files": [ - "dist" - ], - "config": { - "commitizen": { - "path": "./node_modules/cz-conventional-changelog" - } - } -} +{ + "name": "luckysheet", + "version": "2.1.13", + "main": "dist/luckysheet.cjs.js", + "module": "dist/luckysheet.esm.js", + "browser": "dist/luckysheet.umd.js", + "devDependencies": { + "@babel/core": "^7.12.3", + "@babel/preset-env": "^7.12.1", + "@babel/runtime-corejs3": "^7.12.1", + "@commitlint/cli": "^9.1.1", + "@commitlint/config-conventional": "^9.1.1", + "@rollup/plugin-babel": "^5.2.1", + "@rollup/plugin-commonjs": "^13.0.0", + "@rollup/plugin-node-resolve": "^8.0.1", + "browser-sync": "^2.26.7", + "commitizen": "^4.1.2", + "cross-env": "^7.0.2", + "delete": "^1.1.0", + "gulp": "^4.0.2", + "gulp-babel": "^8.0.0", + "gulp-clean-css": "^4.3.0", + "gulp-concat": "^2.6.1", + "gulp-if": "^3.0.0", + "gulp-uglify": "^3.0.2", + "gulp-useref": "^4.0.1", + "http-proxy-middleware": "^1.0.6", + "prettier": "2.8.8", + "rollup": "^2.32.1", + "rollup-plugin-terser": "^6.1.0", + "standard-version": "^8.0.2", + "uuid": "^8.3.2", + "vuepress": "^1.5.0", + "vuepress-plugin-baidu-autopush": "^1.0.1", + "vuepress-plugin-code-copy": "^1.0.6", + "vuepress-plugin-seo": "^0.1.4", + "vuepress-plugin-sitemap": "^2.3.1" + }, + "dependencies": { + "@babel/runtime": "^7.12.1", + "dayjs": "^1.9.6", + "esbuild": "^0.11.6", + "escape-html": "^1.0.3", + "flatpickr": "^4.6.6", + "jquery": "^2.2.4", + "numeral": "^2.0.6", + "pako": "^1.0.11" + }, + "scripts": { + "build": "cross-env NODE_ENV=production gulp build", + "dev": "cross-env NODE_ENV=development gulp dev", + "docs:dev": "vuepress dev docs", + "docs:build": "vuepress build docs", + "commit": "git-cz", + "release": "standard-version", + "prettier": "npx prettier --check .", + "prettier:fix": "npx prettier -w ." + }, + "files": [ + "dist" + ], + "config": { + "commitizen": { + "path": "./node_modules/cz-conventional-changelog" + } + } +} diff --git a/src/assets/iconfont/demo.css b/src/assets/iconfont/demo.css index a67054a0a..a2b02ad45 100644 --- a/src/assets/iconfont/demo.css +++ b/src/assets/iconfont/demo.css @@ -1,539 +1,539 @@ -/* Logo 字体 */ -@font-face { - font-family: "iconfont logo"; - src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834'); - src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834#iefix') format('embedded-opentype'), - url('https://at.alicdn.com/t/font_985780_km7mi63cihi.woff?t=1545807318834') format('woff'), - url('https://at.alicdn.com/t/font_985780_km7mi63cihi.ttf?t=1545807318834') format('truetype'), - url('https://at.alicdn.com/t/font_985780_km7mi63cihi.svg?t=1545807318834#iconfont') format('svg'); -} - -.logo { - font-family: "iconfont logo"; - font-size: 160px; - font-style: normal; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -/* tabs */ -.nav-tabs { - position: relative; -} - -.nav-tabs .nav-more { - position: absolute; - right: 0; - bottom: 0; - height: 42px; - line-height: 42px; - color: #666; -} - -#tabs { - border-bottom: 1px solid #eee; -} - -#tabs li { - cursor: pointer; - width: 100px; - height: 40px; - line-height: 40px; - text-align: center; - font-size: 16px; - border-bottom: 2px solid transparent; - position: relative; - z-index: 1; - margin-bottom: -1px; - color: #666; -} - - -#tabs .active { - border-bottom-color: #f00; - color: #222; -} - -.tab-container .content { - display: none; -} - -/* 页面布局 */ -.main { - padding: 30px 100px; - width: 960px; - margin: 0 auto; -} - -.main .logo { - color: #333; - text-align: left; - margin-bottom: 30px; - line-height: 1; - height: 110px; - margin-top: -50px; - overflow: hidden; - *zoom: 1; -} - -.main .logo a { - font-size: 160px; - color: #333; -} - -.helps { - margin-top: 40px; -} - -.helps pre { - padding: 20px; - margin: 10px 0; - border: solid 1px #e7e1cd; - background-color: #fffdef; - overflow: auto; -} - -.icon_lists { - width: 100% !important; - overflow: hidden; - *zoom: 1; -} - -.icon_lists li { - width: 100px; - margin-bottom: 10px; - margin-right: 20px; - text-align: center; - list-style: none !important; - cursor: default; -} - -.icon_lists li .code-name { - line-height: 1.2; -} - -.icon_lists .icon { - display: block; - height: 100px; - line-height: 100px; - font-size: 42px; - margin: 10px auto; - color: #333; - -webkit-transition: font-size 0.25s linear, width 0.25s linear; - -moz-transition: font-size 0.25s linear, width 0.25s linear; - transition: font-size 0.25s linear, width 0.25s linear; -} - -.icon_lists .icon:hover { - font-size: 100px; -} - -.icon_lists .svg-icon { - /* 通过设置 font-size 来改变图标大小 */ - width: 1em; - /* 图标和文字相邻时,垂直对齐 */ - vertical-align: -0.15em; - /* 通过设置 color 来改变 SVG 的颜色/fill */ - fill: currentColor; - /* path 和 stroke 溢出 viewBox 部分在 IE 下会显示 - normalize.css 中也包含这行 */ - overflow: hidden; -} - -.icon_lists li .name, -.icon_lists li .code-name { - color: #666; -} - -/* markdown 样式 */ -.markdown { - color: #666; - font-size: 14px; - line-height: 1.8; -} - -.highlight { - line-height: 1.5; -} - -.markdown img { - vertical-align: middle; - max-width: 100%; -} - -.markdown h1 { - color: #404040; - font-weight: 500; - line-height: 40px; - margin-bottom: 24px; -} - -.markdown h2, -.markdown h3, -.markdown h4, -.markdown h5, -.markdown h6 { - color: #404040; - margin: 1.6em 0 0.6em 0; - font-weight: 500; - clear: both; -} - -.markdown h1 { - font-size: 28px; -} - -.markdown h2 { - font-size: 22px; -} - -.markdown h3 { - font-size: 16px; -} - -.markdown h4 { - font-size: 14px; -} - -.markdown h5 { - font-size: 12px; -} - -.markdown h6 { - font-size: 12px; -} - -.markdown hr { - height: 1px; - border: 0; - background: #e9e9e9; - margin: 16px 0; - clear: both; -} - -.markdown p { - margin: 1em 0; -} - -.markdown>p, -.markdown>blockquote, -.markdown>.highlight, -.markdown>ol, -.markdown>ul { - width: 80%; -} - -.markdown ul>li { - list-style: circle; -} - -.markdown>ul li, -.markdown blockquote ul>li { - margin-left: 20px; - padding-left: 4px; -} - -.markdown>ul li p, -.markdown>ol li p { - margin: 0.6em 0; -} - -.markdown ol>li { - list-style: decimal; -} - -.markdown>ol li, -.markdown blockquote ol>li { - margin-left: 20px; - padding-left: 4px; -} - -.markdown code { - margin: 0 3px; - padding: 0 5px; - background: #eee; - border-radius: 3px; -} - -.markdown strong, -.markdown b { - font-weight: 600; -} - -.markdown>table { - border-collapse: collapse; - border-spacing: 0px; - empty-cells: show; - border: 1px solid #e9e9e9; - width: 95%; - margin-bottom: 24px; -} - -.markdown>table th { - white-space: nowrap; - color: #333; - font-weight: 600; -} - -.markdown>table th, -.markdown>table td { - border: 1px solid #e9e9e9; - padding: 8px 16px; - text-align: left; -} - -.markdown>table th { - background: #F7F7F7; -} - -.markdown blockquote { - font-size: 90%; - color: #999; - border-left: 4px solid #e9e9e9; - padding-left: 0.8em; - margin: 1em 0; -} - -.markdown blockquote p { - margin: 0; -} - -.markdown .anchor { - opacity: 0; - transition: opacity 0.3s ease; - margin-left: 8px; -} - -.markdown .waiting { - color: #ccc; -} - -.markdown h1:hover .anchor, -.markdown h2:hover .anchor, -.markdown h3:hover .anchor, -.markdown h4:hover .anchor, -.markdown h5:hover .anchor, -.markdown h6:hover .anchor { - opacity: 1; - display: inline-block; -} - -.markdown>br, -.markdown>p>br { - clear: both; -} - - -.hljs { - display: block; - background: white; - padding: 0.5em; - color: #333333; - overflow-x: auto; -} - -.hljs-comment, -.hljs-meta { - color: #969896; -} - -.hljs-string, -.hljs-variable, -.hljs-template-variable, -.hljs-strong, -.hljs-emphasis, -.hljs-quote { - color: #df5000; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-type { - color: #a71d5d; -} - -.hljs-literal, -.hljs-symbol, -.hljs-bullet, -.hljs-attribute { - color: #0086b3; -} - -.hljs-section, -.hljs-name { - color: #63a35c; -} - -.hljs-tag { - color: #333333; -} - -.hljs-title, -.hljs-attr, -.hljs-selector-id, -.hljs-selector-class, -.hljs-selector-attr, -.hljs-selector-pseudo { - color: #795da3; -} - -.hljs-addition { - color: #55a532; - background-color: #eaffea; -} - -.hljs-deletion { - color: #bd2c00; - background-color: #ffecec; -} - -.hljs-link { - text-decoration: underline; -} - -/* 代码高亮 */ -/* PrismJS 1.15.0 -https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript */ -/** - * prism.js default theme for JavaScript, CSS and HTML - * Based on dabblet (http://dabblet.com) - * @author Lea Verou - */ -code[class*="language-"], -pre[class*="language-"] { - color: black; - background: none; - text-shadow: 0 1px white; - font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - word-wrap: normal; - line-height: 1.5; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -pre[class*="language-"]::-moz-selection, -pre[class*="language-"] ::-moz-selection, -code[class*="language-"]::-moz-selection, -code[class*="language-"] ::-moz-selection { - text-shadow: none; - background: #b3d4fc; -} - -pre[class*="language-"]::selection, -pre[class*="language-"] ::selection, -code[class*="language-"]::selection, -code[class*="language-"] ::selection { - text-shadow: none; - background: #b3d4fc; -} - -@media print { - - code[class*="language-"], - pre[class*="language-"] { - text-shadow: none; - } -} - -/* Code blocks */ -pre[class*="language-"] { - padding: 1em; - margin: .5em 0; - overflow: auto; -} - -:not(pre)>code[class*="language-"], -pre[class*="language-"] { - background: #f5f2f0; -} - -/* Inline code */ -:not(pre)>code[class*="language-"] { - padding: .1em; - border-radius: .3em; - white-space: normal; -} - -.token.comment, -.token.prolog, -.token.doctype, -.token.cdata { - color: slategray; -} - -.token.punctuation { - color: #999; -} - -.namespace { - opacity: .7; -} - -.token.property, -.token.tag, -.token.boolean, -.token.number, -.token.constant, -.token.symbol, -.token.deleted { - color: #905; -} - -.token.selector, -.token.attr-name, -.token.string, -.token.char, -.token.builtin, -.token.inserted { - color: #690; -} - -.token.operator, -.token.entity, -.token.url, -.language-css .token.string, -.style .token.string { - color: #9a6e3a; - background: hsla(0, 0%, 100%, .5); -} - -.token.atrule, -.token.attr-value, -.token.keyword { - color: #07a; -} - -.token.function, -.token.class-name { - color: #DD4A68; -} - -.token.regex, -.token.important, -.token.variable { - color: #e90; -} - -.token.important, -.token.bold { - font-weight: bold; -} - -.token.italic { - font-style: italic; -} - -.token.entity { - cursor: help; -} +/* Logo 字体 */ +@font-face { + font-family: "iconfont logo"; + src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834'); + src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834#iefix') format('embedded-opentype'), + url('https://at.alicdn.com/t/font_985780_km7mi63cihi.woff?t=1545807318834') format('woff'), + url('https://at.alicdn.com/t/font_985780_km7mi63cihi.ttf?t=1545807318834') format('truetype'), + url('https://at.alicdn.com/t/font_985780_km7mi63cihi.svg?t=1545807318834#iconfont') format('svg'); +} + +.logo { + font-family: "iconfont logo"; + font-size: 160px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +/* tabs */ +.nav-tabs { + position: relative; +} + +.nav-tabs .nav-more { + position: absolute; + right: 0; + bottom: 0; + height: 42px; + line-height: 42px; + color: #666; +} + +#tabs { + border-bottom: 1px solid #eee; +} + +#tabs li { + cursor: pointer; + width: 100px; + height: 40px; + line-height: 40px; + text-align: center; + font-size: 16px; + border-bottom: 2px solid transparent; + position: relative; + z-index: 1; + margin-bottom: -1px; + color: #666; +} + + +#tabs .active { + border-bottom-color: #f00; + color: #222; +} + +.tab-container .content { + display: none; +} + +/* 页面布局 */ +.main { + padding: 30px 100px; + width: 960px; + margin: 0 auto; +} + +.main .logo { + color: #333; + text-align: left; + margin-bottom: 30px; + line-height: 1; + height: 110px; + margin-top: -50px; + overflow: hidden; + *zoom: 1; +} + +.main .logo a { + font-size: 160px; + color: #333; +} + +.helps { + margin-top: 40px; +} + +.helps pre { + padding: 20px; + margin: 10px 0; + border: solid 1px #e7e1cd; + background-color: #fffdef; + overflow: auto; +} + +.icon_lists { + width: 100% !important; + overflow: hidden; + *zoom: 1; +} + +.icon_lists li { + width: 100px; + margin-bottom: 10px; + margin-right: 20px; + text-align: center; + list-style: none !important; + cursor: default; +} + +.icon_lists li .code-name { + line-height: 1.2; +} + +.icon_lists .icon { + display: block; + height: 100px; + line-height: 100px; + font-size: 42px; + margin: 10px auto; + color: #333; + -webkit-transition: font-size 0.25s linear, width 0.25s linear; + -moz-transition: font-size 0.25s linear, width 0.25s linear; + transition: font-size 0.25s linear, width 0.25s linear; +} + +.icon_lists .icon:hover { + font-size: 100px; +} + +.icon_lists .svg-icon { + /* 通过设置 font-size 来改变图标大小 */ + width: 1em; + /* 图标和文字相邻时,垂直对齐 */ + vertical-align: -0.15em; + /* 通过设置 color 来改变 SVG 的颜色/fill */ + fill: currentColor; + /* path 和 stroke 溢出 viewBox 部分在 IE 下会显示 + normalize.css 中也包含这行 */ + overflow: hidden; +} + +.icon_lists li .name, +.icon_lists li .code-name { + color: #666; +} + +/* markdown 样式 */ +.markdown { + color: #666; + font-size: 14px; + line-height: 1.8; +} + +.highlight { + line-height: 1.5; +} + +.markdown img { + vertical-align: middle; + max-width: 100%; +} + +.markdown h1 { + color: #404040; + font-weight: 500; + line-height: 40px; + margin-bottom: 24px; +} + +.markdown h2, +.markdown h3, +.markdown h4, +.markdown h5, +.markdown h6 { + color: #404040; + margin: 1.6em 0 0.6em 0; + font-weight: 500; + clear: both; +} + +.markdown h1 { + font-size: 28px; +} + +.markdown h2 { + font-size: 22px; +} + +.markdown h3 { + font-size: 16px; +} + +.markdown h4 { + font-size: 14px; +} + +.markdown h5 { + font-size: 12px; +} + +.markdown h6 { + font-size: 12px; +} + +.markdown hr { + height: 1px; + border: 0; + background: #e9e9e9; + margin: 16px 0; + clear: both; +} + +.markdown p { + margin: 1em 0; +} + +.markdown>p, +.markdown>blockquote, +.markdown>.highlight, +.markdown>ol, +.markdown>ul { + width: 80%; +} + +.markdown ul>li { + list-style: circle; +} + +.markdown>ul li, +.markdown blockquote ul>li { + margin-left: 20px; + padding-left: 4px; +} + +.markdown>ul li p, +.markdown>ol li p { + margin: 0.6em 0; +} + +.markdown ol>li { + list-style: decimal; +} + +.markdown>ol li, +.markdown blockquote ol>li { + margin-left: 20px; + padding-left: 4px; +} + +.markdown code { + margin: 0 3px; + padding: 0 5px; + background: #eee; + border-radius: 3px; +} + +.markdown strong, +.markdown b { + font-weight: 600; +} + +.markdown>table { + border-collapse: collapse; + border-spacing: 0px; + empty-cells: show; + border: 1px solid #e9e9e9; + width: 95%; + margin-bottom: 24px; +} + +.markdown>table th { + white-space: nowrap; + color: #333; + font-weight: 600; +} + +.markdown>table th, +.markdown>table td { + border: 1px solid #e9e9e9; + padding: 8px 16px; + text-align: left; +} + +.markdown>table th { + background: #F7F7F7; +} + +.markdown blockquote { + font-size: 90%; + color: #999; + border-left: 4px solid #e9e9e9; + padding-left: 0.8em; + margin: 1em 0; +} + +.markdown blockquote p { + margin: 0; +} + +.markdown .anchor { + opacity: 0; + transition: opacity 0.3s ease; + margin-left: 8px; +} + +.markdown .waiting { + color: #ccc; +} + +.markdown h1:hover .anchor, +.markdown h2:hover .anchor, +.markdown h3:hover .anchor, +.markdown h4:hover .anchor, +.markdown h5:hover .anchor, +.markdown h6:hover .anchor { + opacity: 1; + display: inline-block; +} + +.markdown>br, +.markdown>p>br { + clear: both; +} + + +.hljs { + display: block; + background: white; + padding: 0.5em; + color: #333333; + overflow-x: auto; +} + +.hljs-comment, +.hljs-meta { + color: #969896; +} + +.hljs-string, +.hljs-variable, +.hljs-template-variable, +.hljs-strong, +.hljs-emphasis, +.hljs-quote { + color: #df5000; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-type { + color: #a71d5d; +} + +.hljs-literal, +.hljs-symbol, +.hljs-bullet, +.hljs-attribute { + color: #0086b3; +} + +.hljs-section, +.hljs-name { + color: #63a35c; +} + +.hljs-tag { + color: #333333; +} + +.hljs-title, +.hljs-attr, +.hljs-selector-id, +.hljs-selector-class, +.hljs-selector-attr, +.hljs-selector-pseudo { + color: #795da3; +} + +.hljs-addition { + color: #55a532; + background-color: #eaffea; +} + +.hljs-deletion { + color: #bd2c00; + background-color: #ffecec; +} + +.hljs-link { + text-decoration: underline; +} + +/* 代码高亮 */ +/* PrismJS 1.15.0 +https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript */ +/** + * prism.js default theme for JavaScript, CSS and HTML + * Based on dabblet (http://dabblet.com) + * @author Lea Verou + */ +code[class*="language-"], +pre[class*="language-"] { + color: black; + background: none; + text-shadow: 0 1px white; + font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + line-height: 1.5; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +pre[class*="language-"]::-moz-selection, +pre[class*="language-"] ::-moz-selection, +code[class*="language-"]::-moz-selection, +code[class*="language-"] ::-moz-selection { + text-shadow: none; + background: #b3d4fc; +} + +pre[class*="language-"]::selection, +pre[class*="language-"] ::selection, +code[class*="language-"]::selection, +code[class*="language-"] ::selection { + text-shadow: none; + background: #b3d4fc; +} + +@media print { + + code[class*="language-"], + pre[class*="language-"] { + text-shadow: none; + } +} + +/* Code blocks */ +pre[class*="language-"] { + padding: 1em; + margin: .5em 0; + overflow: auto; +} + +:not(pre)>code[class*="language-"], +pre[class*="language-"] { + background: #f5f2f0; +} + +/* Inline code */ +:not(pre)>code[class*="language-"] { + padding: .1em; + border-radius: .3em; + white-space: normal; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: slategray; +} + +.token.punctuation { + color: #999; +} + +.namespace { + opacity: .7; +} + +.token.property, +.token.tag, +.token.boolean, +.token.number, +.token.constant, +.token.symbol, +.token.deleted { + color: #905; +} + +.token.selector, +.token.attr-name, +.token.string, +.token.char, +.token.builtin, +.token.inserted { + color: #690; +} + +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string { + color: #9a6e3a; + background: hsla(0, 0%, 100%, .5); +} + +.token.atrule, +.token.attr-value, +.token.keyword { + color: #07a; +} + +.token.function, +.token.class-name { + color: #DD4A68; +} + +.token.regex, +.token.important, +.token.variable { + color: #e90; +} + +.token.important, +.token.bold { + font-weight: bold; +} + +.token.italic { + font-style: italic; +} + +.token.entity { + cursor: help; +} diff --git a/src/assets/iconfont/demo_index.html b/src/assets/iconfont/demo_index.html index b24698ab6..ea1e223bd 100644 --- a/src/assets/iconfont/demo_index.html +++ b/src/assets/iconfont/demo_index.html @@ -1,2700 +1,2700 @@ - - - - - IconFont Demo - - - - - - - - - - - -
-

- -
-
-
    - -
  • - -
    链接
    -
    &#xe7f8;
    -
  • - -
  • - -
    打印区域
    -
    &#xe7f5;
    -
  • - -
  • - -
    打印页面配置
    -
    &#xe7f6;
    -
  • - -
  • - -
    打印标题
    -
    &#xe7f7;
    -
  • - -
  • - -
    分页预览
    -
    &#xe7f2;
    -
  • - -
  • - -
    普通
    -
    &#xe7f3;
    -
  • - -
  • - -
    页面布局
    -
    &#xe7f4;
    -
  • - -
  • - -
    表格锁定
    -
    &#xe7ee;
    -
  • - -
  • - -
    转到
    -
    &#xe7f1;
    -
  • - -
  • - -
    右箭头
    -
    &#xe7ed;
    -
  • - -
  • - -
    菜单
    -
    &#xe7ef;
    -
  • - -
  • - -
    替换
    -
    &#xe7f0;
    -
  • - -
  • - -
    冻结
    -
    &#xe7e1;
    -
  • - -
  • - -
    -
    &#xe7e2;
    -
  • - -
  • - -
    -
    &#xe7e3;
    -
  • - -
  • - -
    溢出
    -
    &#xe7e4;
    -
  • - -
  • - -
    升序
    -
    &#xe7e5;
    -
  • - -
  • - -
    内框线
    -
    &#xe7e6;
    -
  • - -
  • - -
    清除筛选
    -
    &#xe7e7;
    -
  • - -
  • - -
    文本向上
    -
    &#xe7e8;
    -
  • - -
  • - -
    降序
    -
    &#xe7e9;
    -
  • - -
  • - -
    内框横线
    -
    &#xe7ea;
    -
  • - -
  • - -
    内框竖线
    -
    &#xe7eb;
    -
  • - -
  • - -
    自定义排序
    -
    &#xe7ec;
    -
  • - -
  • - -
    logo2
    -
    &#xe7df;
    -
  • - -
  • - -
    logo
    -
    &#xe7e0;
    -
  • - -
  • - -
    文本倾斜
    -
    &#xe7de;
    -
  • - -
  • - -
    加粗
    -
    &#xe7d9;
    -
  • - -
  • - -
    搜索
    -
    &#xe78a;
    -
  • - -
  • - -
    关闭
    -
    &#xe78b;
    -
  • - -
  • - -
    下一个
    -
    &#xe78c;
    -
  • - -
  • - -
    下拉
    -
    &#xe78d;
    -
  • - -
  • - -
    文本颜色
    -
    &#xe78e;
    -
  • - -
  • - -
    上一个
    -
    &#xe78f;
    -
  • - -
  • - -
    数据透视
    -
    &#xe790;
    -
  • - -
  • - -
    填充
    -
    &#xe791;
    -
  • - -
  • - -
    增加小数位
    -
    &#xe792;
    -
  • - -
  • - -
    编辑2
    -
    &#xe793;
    -
  • - -
  • - -
    截屏
    -
    &#xe794;
    -
  • - -
  • - -
    减小小数位
    -
    &#xe796;
    -
  • - -
  • - -
    菜单
    -
    &#xe797;
    -
  • - -
  • - -
    数据库
    -
    &#xe798;
    -
  • - -
  • - -
    无边框
    -
    &#xe799;
    -
  • - -
  • - -
    编辑
    -
    &#xe79a;
    -
  • - -
  • - -
    清除样式
    -
    &#xe79b;
    -
  • - -
  • - -
    删除
    -
    &#xe79c;
    -
  • - -
  • - -
    文本居中对齐
    -
    &#xe79d;
    -
  • - -
  • - -
    打印
    -
    &#xe79e;
    -
  • - -
  • - -
    文本分割
    -
    &#xe79f;
    -
  • - -
  • - -
    函数‘
    -
    &#xe7a0;
    -
  • - -
  • - -
    降序
    -
    &#xe7a1;
    -
  • - -
  • - -
    顶部对齐
    -
    &#xe7a2;
    -
  • - -
  • - -
    图片
    -
    &#xe7a3;
    -
  • - -
  • - -
    向下90
    -
    &#xe7a4;
    -
  • - -
  • - -
    竖排文字
    -
    &#xe7a5;
    -
  • - -
  • - -
    全加边框
    -
    &#xe7a6;
    -
  • - -
  • - -
    升序
    -
    &#xe7a7;
    -
  • - -
  • - -
    裁剪
    -
    &#xe7a8;
    -
  • - -
  • - -
    金额
    -
    &#xe7a9;
    -
  • - -
  • - -
    菜单1
    -
    &#xe7aa;
    -
  • - -
  • - -
    取消合并
    -
    &#xe7ab;
    -
  • - -
  • - -
    文本下划线
    -
    &#xe7ac;
    -
  • - -
  • - -
    上边框
    -
    &#xe7ad;
    -
  • - -
  • - -
    定位
    -
    &#xe7ae;
    -
  • - -
  • - -
    四周加边框
    -
    &#xe7af;
    -
  • - -
  • - -
    侧边栏收起
    -
    &#xe7b0;
    -
  • - -
  • - -
    合并
    -
    &#xe7b1;
    -
  • - -
  • - -
    向上倾斜
    -
    &#xe7b2;
    -
  • - -
  • - -
    水平对齐
    -
    &#xe7b3;
    -
  • - -
  • - -
    文本删除线
    -
    &#xe7b4;
    -
  • - -
  • - -
    文本右对齐
    -
    &#xe7b5;
    -
  • - -
  • - -
    前进
    -
    &#xe7b6;
    -
  • - -
  • - -
    图表
    -
    &#xe7b7;
    -
  • - -
  • - -
    右边框
    -
    &#xe7b8;
    -
  • - -
  • - -
    百分号
    -
    &#xe7b9;
    -
  • - -
  • - -
    格式刷
    -
    &#xe7ba;
    -
  • - -
  • - -
    保存
    -
    &#xe7bb;
    -
  • - -
  • - -
    数据验证
    -
    &#xe7bc;
    -
  • - -
  • - -
    截断
    -
    &#xe7bd;
    -
  • - -
  • - -
    格式条件
    -
    &#xe7be;
    -
  • - -
  • - -
    自动换行
    -
    &#xe7bf;
    -
  • - -
  • - -
    侧边栏展开
    -
    &#xe7c0;
    -
  • - -
  • - -
    筛选2
    -
    &#xe7c1;
    -
  • - -
  • - -
    向下倾斜
    -
    &#xe7c2;
    -
  • - -
  • - -
    溢出
    -
    &#xe7c3;
    -
  • - -
  • - -
    垂直合并
    -
    &#xe7c4;
    -
  • - -
  • - -
    文本分散对齐
    -
    &#xe7c5;
    -
  • - -
  • - -
    左边框
    -
    &#xe7c6;
    -
  • - -
  • - -
    分页查看
    -
    &#xe7c7;
    -
  • - -
  • - -
    运行
    -
    &#xe7c8;
    -
  • - -
  • - -
    -
    &#xe7c9;
    -
  • - -
  • - -
    全屏
    -
    &#xe7ca;
    -
  • - -
  • - -
    筛选
    -
    &#xe7cb;
    -
  • - -
  • - -
    更新
    -
    &#xe7cc;
    -
  • - -
  • - -
    清除
    -
    &#xe7cd;
    -
  • - -
  • - -
    -
    &#xe7ce;
    -
  • - -
  • - -
    注释
    -
    &#xe7cf;
    -
  • - -
  • - -
    -
    &#xe7d0;
    -
  • - -
  • - -
    计算
    -
    &#xe7d1;
    -
  • - -
  • - -
    -
    &#xe7d2;
    -
  • - -
  • - -
    底部对齐
    -
    &#xe7d3;
    -
  • - -
  • - -
    向上90
    -
    &#xe7d4;
    -
  • - -
  • - -
    无选装
    -
    &#xe7d5;
    -
  • - -
  • - -
    显示隐藏网格
    -
    &#xe7d6;
    -
  • - -
  • - -
    冻结
    -
    &#xe7d7;
    -
  • - -
  • - -
    文本左对齐
    -
    &#xe7d8;
    -
  • - -
  • - -
    后退
    -
    &#xe7da;
    -
  • - -
  • - -
    水平合并
    -
    &#xe7db;
    -
  • - -
  • - -
    下边框
    -
    &#xe7dc;
    -
  • - -
  • - -
    设置
    -
    &#xe7dd;
    -
  • - -
-
-

Unicode 引用

-
- -

Unicode 是字体在网页端最原始的应用方式,特点是:

-
    -
  • 兼容性最好,支持 IE6+,及所有现代浏览器。
  • -
  • 支持按字体的方式去动态调整图标大小,颜色等等。
  • -
  • 但是因为是字体,所以不支持多色。只能使用平台里单色的图标,就算项目里有多色图标也会自动去色。
  • -
-
-

注意:新版 iconfont 支持多色图标,这些多色图标在 Unicode 模式下将不能使用,如果有需求建议使用symbol 的引用方式

-
-

Unicode 使用步骤如下:

-

第一步:拷贝项目下面生成的 @font-face

-
@font-face {
-  font-family: 'iconfont';
-  src: url('http://github.com/iconfont.eot');
-  src: url('http://github.com/iconfont.eot?#iefix') format('embedded-opentype'),
-      url('http://github.com/iconfont.woff2') format('woff2'),
-      url('http://github.com/iconfont.woff') format('woff'),
-      url('http://github.com/iconfont.ttf') format('truetype'),
-      url('http://github.com/iconfont.svg#iconfont') format('svg');
-}
-
-

第二步:定义使用 iconfont 的样式

-
.iconfont {
-  font-family: "iconfont" !important;
-  font-size: 16px;
-  font-style: normal;
-  -webkit-font-smoothing: antialiased;
-  -moz-osx-font-smoothing: grayscale;
-}
-
-

第三步:挑选相应图标并获取字体编码,应用于页面

-
-<span class="iconfont">&#x33;</span>
-
-
-

"iconfont" 是你项目下的 font-family。可以通过编辑项目查看,默认是 "iconfont"。

-
-
-
-
-
    - -
  • - -
    - 链接 -
    -
    .luckysheet-iconfont-lianjie -
    -
  • - -
  • - -
    - 打印区域 -
    -
    .luckysheet-iconfont-dayinquyu -
    -
  • - -
  • - -
    - 打印页面配置 -
    -
    .luckysheet-iconfont-dayinyemianpeizhi -
    -
  • - -
  • - -
    - 打印标题 -
    -
    .luckysheet-iconfont-dayinbiaoti -
    -
  • - -
  • - -
    - 分页预览 -
    -
    .luckysheet-iconfont-fenyeyulan -
    -
  • - -
  • - -
    - 普通 -
    -
    .luckysheet-iconfont-putong -
    -
  • - -
  • - -
    - 页面布局 -
    -
    .luckysheet-iconfont-yemianbuju -
    -
  • - -
  • - -
    - 表格锁定 -
    -
    .luckysheet-iconfont-biaogesuoding -
    -
  • - -
  • - -
    - 转到 -
    -
    .luckysheet-iconfont-zhuandao1 -
    -
  • - -
  • - -
    - 右箭头 -
    -
    .luckysheet-iconfont-youjiantou -
    -
  • - -
  • - -
    - 菜单 -
    -
    .luckysheet-iconfont-caidan2 -
    -
  • - -
  • - -
    - 替换 -
    -
    .luckysheet-iconfont-tihuan -
    -
  • - -
  • - -
    - 冻结 -
    -
    .luckysheet-iconfont-dongjie1 -
    -
  • - -
  • - -
    - 剪 -
    -
    .luckysheet-iconfont-jian1 -
    -
  • - -
  • - -
    - 加 -
    -
    .luckysheet-iconfont-jia1 -
    -
  • - -
  • - -
    - 溢出 -
    -
    .luckysheet-iconfont-yichu1 -
    -
  • - -
  • - -
    - 升序 -
    -
    .luckysheet-iconfont-shengxu1 -
    -
  • - -
  • - -
    - 内框线 -
    -
    .luckysheet-iconfont-neikuangxian -
    -
  • - -
  • - -
    - 清除筛选 -
    -
    .luckysheet-iconfont-qingchushaixuan -
    -
  • - -
  • - -
    - 文本向上 -
    -
    .luckysheet-iconfont-wenbenxiangshang -
    -
  • - -
  • - -
    - 降序 -
    -
    .luckysheet-iconfont-jiangxu1 -
    -
  • - -
  • - -
    - 内框横线 -
    -
    .luckysheet-iconfont-neikuanghengxian -
    -
  • - -
  • - -
    - 内框竖线 -
    -
    .luckysheet-iconfont-neikuangshuxian -
    -
  • - -
  • - -
    - 自定义排序 -
    -
    .luckysheet-iconfont-zidingyipaixu -
    -
  • - -
  • - -
    - logo2 -
    -
    .luckysheet-iconfont-logo2 -
    -
  • - -
  • - -
    - logo -
    -
    .luckysheet-iconfont-logo -
    -
  • - -
  • - -
    - 文本倾斜 -
    -
    .luckysheet-iconfont-wenbenqingxie1 -
    -
  • - -
  • - -
    - 加粗 -
    -
    .luckysheet-iconfont-jiacu -
    -
  • - -
  • - -
    - 搜索 -
    -
    .luckysheet-iconfont-sousuo -
    -
  • - -
  • - -
    - 关闭 -
    -
    .luckysheet-iconfont-guanbi -
    -
  • - -
  • - -
    - 下一个 -
    -
    .luckysheet-iconfont-xiayige -
    -
  • - -
  • - -
    - 下拉 -
    -
    .luckysheet-iconfont-xiala -
    -
  • - -
  • - -
    - 文本颜色 -
    -
    .luckysheet-iconfont-wenbenyanse -
    -
  • - -
  • - -
    - 上一个 -
    -
    .luckysheet-iconfont-shangyige -
    -
  • - -
  • - -
    - 数据透视 -
    -
    .luckysheet-iconfont-shujutoushi -
    -
  • - -
  • - -
    - 填充 -
    -
    .luckysheet-iconfont-tianchong -
    -
  • - -
  • - -
    - 增加小数位 -
    -
    .luckysheet-iconfont-zengjiaxiaoshuwei -
    -
  • - -
  • - -
    - 编辑2 -
    -
    .luckysheet-iconfont-bianji2 -
    -
  • - -
  • - -
    - 截屏 -
    -
    .luckysheet-iconfont-jieping -
    -
  • - -
  • - -
    - 减小小数位 -
    -
    .luckysheet-iconfont-jianxiaoxiaoshuwei -
    -
  • - -
  • - -
    - 菜单 -
    -
    .luckysheet-iconfont-caidan -
    -
  • - -
  • - -
    - 数据库 -
    -
    .luckysheet-iconfont-shujuku -
    -
  • - -
  • - -
    - 无边框 -
    -
    .luckysheet-iconfont-wubiankuang -
    -
  • - -
  • - -
    - 编辑 -
    -
    .luckysheet-iconfont-bianji -
    -
  • - -
  • - -
    - 清除样式 -
    -
    .luckysheet-iconfont-qingchuyangshi -
    -
  • - -
  • - -
    - 删除 -
    -
    .luckysheet-iconfont-shanchu -
    -
  • - -
  • - -
    - 文本居中对齐 -
    -
    .luckysheet-iconfont-wenbenjuzhongduiqi -
    -
  • - -
  • - -
    - 打印 -
    -
    .luckysheet-iconfont-dayin -
    -
  • - -
  • - -
    - 文本分割 -
    -
    .luckysheet-iconfont-wenbenfenge -
    -
  • - -
  • - -
    - 函数‘ -
    -
    .luckysheet-iconfont-hanshu -
    -
  • - -
  • - -
    - 降序 -
    -
    .luckysheet-iconfont-jiangxu -
    -
  • - -
  • - -
    - 顶部对齐 -
    -
    .luckysheet-iconfont-dingbuduiqi -
    -
  • - -
  • - -
    - 图片 -
    -
    .luckysheet-iconfont-tupian -
    -
  • - -
  • - -
    - 向下90 -
    -
    .luckysheet-iconfont-xiangxia90 -
    -
  • - -
  • - -
    - 竖排文字 -
    -
    .luckysheet-iconfont-shupaiwenzi -
    -
  • - -
  • - -
    - 全加边框 -
    -
    .luckysheet-iconfont-quanjiabiankuang -
    -
  • - -
  • - -
    - 升序 -
    -
    .luckysheet-iconfont-shengxu -
    -
  • - -
  • - -
    - 裁剪 -
    -
    .luckysheet-iconfont-caijian -
    -
  • - -
  • - -
    - 金额 -
    -
    .luckysheet-iconfont-jine -
    -
  • - -
  • - -
    - 菜单1 -
    -
    .luckysheet-iconfont-caidan1 -
    -
  • - -
  • - -
    - 取消合并 -
    -
    .luckysheet-iconfont-quxiaohebing -
    -
  • - -
  • - -
    - 文本下划线 -
    -
    .luckysheet-iconfont-wenbenxiahuaxian -
    -
  • - -
  • - -
    - 上边框 -
    -
    .luckysheet-iconfont-shangbiankuang -
    -
  • - -
  • - -
    - 定位 -
    -
    .luckysheet-iconfont-dingwei -
    -
  • - -
  • - -
    - 四周加边框 -
    -
    .luckysheet-iconfont-sizhoujiabiankuang -
    -
  • - -
  • - -
    - 侧边栏收起 -
    -
    .luckysheet-iconfont-cebianlanshouqi -
    -
  • - -
  • - -
    - 合并 -
    -
    .luckysheet-iconfont-hebing -
    -
  • - -
  • - -
    - 向上倾斜 -
    -
    .luckysheet-iconfont-xiangshangqingxie -
    -
  • - -
  • - -
    - 水平对齐 -
    -
    .luckysheet-iconfont-shuipingduiqi -
    -
  • - -
  • - -
    - 文本删除线 -
    -
    .luckysheet-iconfont-wenbenshanchuxian -
    -
  • - -
  • - -
    - 文本右对齐 -
    -
    .luckysheet-iconfont-wenbenyouduiqi -
    -
  • - -
  • - -
    - 前进 -
    -
    .luckysheet-iconfont-qianjin -
    -
  • - -
  • - -
    - 图表 -
    -
    .luckysheet-iconfont-tubiao -
    -
  • - -
  • - -
    - 右边框 -
    -
    .luckysheet-iconfont-youbiankuang -
    -
  • - -
  • - -
    - 百分号 -
    -
    .luckysheet-iconfont-baifenhao -
    -
  • - -
  • - -
    - 格式刷 -
    -
    .luckysheet-iconfont-geshishua -
    -
  • - -
  • - -
    - 保存 -
    -
    .luckysheet-iconfont-baocun -
    -
  • - -
  • - -
    - 数据验证 -
    -
    .luckysheet-iconfont-shujuyanzheng -
    -
  • - -
  • - -
    - 截断 -
    -
    .luckysheet-iconfont-jieduan -
    -
  • - -
  • - -
    - 格式条件 -
    -
    .luckysheet-iconfont-geshitiaojian -
    -
  • - -
  • - -
    - 自动换行 -
    -
    .luckysheet-iconfont-zidonghuanhang -
    -
  • - -
  • - -
    - 侧边栏展开 -
    -
    .luckysheet-iconfont-cebianlanzhankai -
    -
  • - -
  • - -
    - 筛选2 -
    -
    .luckysheet-iconfont-shaixuan2 -
    -
  • - -
  • - -
    - 向下倾斜 -
    -
    .luckysheet-iconfont-xiangxiaqingxie -
    -
  • - -
  • - -
    - 溢出 -
    -
    .luckysheet-iconfont-yichu -
    -
  • - -
  • - -
    - 垂直合并 -
    -
    .luckysheet-iconfont-chuizhihebing -
    -
  • - -
  • - -
    - 文本分散对齐 -
    -
    .luckysheet-iconfont-wenbenfensanduiqi -
    -
  • - -
  • - -
    - 左边框 -
    -
    .luckysheet-iconfont-zuobiankuang -
    -
  • - -
  • - -
    - 分页查看 -
    -
    .luckysheet-iconfont-fenyechakan -
    -
  • - -
  • - -
    - 运行 -
    -
    .luckysheet-iconfont-yunhang -
    -
  • - -
  • - -
    - 列 -
    -
    .luckysheet-iconfont-lie -
    -
  • - -
  • - -
    - 全屏 -
    -
    .luckysheet-iconfont-quanping -
    -
  • - -
  • - -
    - 筛选 -
    -
    .luckysheet-iconfont-shaixuan -
    -
  • - -
  • - -
    - 更新 -
    -
    .luckysheet-iconfont-gengxin -
    -
  • - -
  • - -
    - 清除 -
    -
    .luckysheet-iconfont-qingchu -
    -
  • - -
  • - -
    - 行 -
    -
    .luckysheet-iconfont-hang -
    -
  • - -
  • - -
    - 注释 -
    -
    .luckysheet-iconfont-zhushi -
    -
  • - -
  • - -
    - 剪 -
    -
    .luckysheet-iconfont-jian -
    -
  • - -
  • - -
    - 计算 -
    -
    .luckysheet-iconfont-jisuan -
    -
  • - -
  • - -
    - 加 -
    -
    .luckysheet-iconfont-jia -
    -
  • - -
  • - -
    - 底部对齐 -
    -
    .luckysheet-iconfont-dibuduiqi -
    -
  • - -
  • - -
    - 向上90 -
    -
    .luckysheet-iconfont-xiangshang90 -
    -
  • - -
  • - -
    - 无选装 -
    -
    .luckysheet-iconfont-wuxuanzhuang -
    -
  • - -
  • - -
    - 显示隐藏网格 -
    -
    .luckysheet-iconfont-xianshiyincangwangge -
    -
  • - -
  • - -
    - 冻结 -
    -
    .luckysheet-iconfont-dongjie -
    -
  • - -
  • - -
    - 文本左对齐 -
    -
    .luckysheet-iconfont-wenbenzuoduiqi -
    -
  • - -
  • - -
    - 后退 -
    -
    .luckysheet-iconfont-houtui -
    -
  • - -
  • - -
    - 水平合并 -
    -
    .luckysheet-iconfont-shuipinghebing -
    -
  • - -
  • - -
    - 下边框 -
    -
    .luckysheet-iconfont-xiabiankuang -
    -
  • - -
  • - -
    - 设置 -
    -
    .luckysheet-iconfont-shezhi -
    -
  • - -
-
-

font-class 引用

-
- -

font-class 是 Unicode 使用方式的一种变种,主要是解决 Unicode 书写不直观,语意不明确的问题。

-

与 Unicode 使用方式相比,具有如下特点:

-
    -
  • 兼容性良好,支持 IE8+,及所有现代浏览器。
  • -
  • 相比于 Unicode 语意明确,书写更直观。可以很容易分辨这个 icon 是什么。
  • -
  • 因为使用 class 来定义图标,所以当要替换图标时,只需要修改 class 里面的 Unicode 引用。
  • -
  • 不过因为本质上还是使用的字体,所以多色图标还是不支持的。
  • -
-

使用步骤如下:

-

第一步:引入项目下面生成的 fontclass 代码:

-
<link rel="stylesheet" href="http://github.com/iconfont.css">
-
-

第二步:挑选相应图标并获取类名,应用于页面:

-
<span class="iconfont luckysheet-iconfont-xxx"></span>
-
-
-

" - iconfont" 是你项目下的 font-family。可以通过编辑项目查看,默认是 "iconfont"。

-
-
-
-
-
    - -
  • - -
    链接
    -
    #luckysheet-iconfont-lianjie
    -
  • - -
  • - -
    打印区域
    -
    #luckysheet-iconfont-dayinquyu
    -
  • - -
  • - -
    打印页面配置
    -
    #luckysheet-iconfont-dayinyemianpeizhi
    -
  • - -
  • - -
    打印标题
    -
    #luckysheet-iconfont-dayinbiaoti
    -
  • - -
  • - -
    分页预览
    -
    #luckysheet-iconfont-fenyeyulan
    -
  • - -
  • - -
    普通
    -
    #luckysheet-iconfont-putong
    -
  • - -
  • - -
    页面布局
    -
    #luckysheet-iconfont-yemianbuju
    -
  • - -
  • - -
    表格锁定
    -
    #luckysheet-iconfont-biaogesuoding
    -
  • - -
  • - -
    转到
    -
    #luckysheet-iconfont-zhuandao1
    -
  • - -
  • - -
    右箭头
    -
    #luckysheet-iconfont-youjiantou
    -
  • - -
  • - -
    菜单
    -
    #luckysheet-iconfont-caidan2
    -
  • - -
  • - -
    替换
    -
    #luckysheet-iconfont-tihuan
    -
  • - -
  • - -
    冻结
    -
    #luckysheet-iconfont-dongjie1
    -
  • - -
  • - -
    -
    #luckysheet-iconfont-jian1
    -
  • - -
  • - -
    -
    #luckysheet-iconfont-jia1
    -
  • - -
  • - -
    溢出
    -
    #luckysheet-iconfont-yichu1
    -
  • - -
  • - -
    升序
    -
    #luckysheet-iconfont-shengxu1
    -
  • - -
  • - -
    内框线
    -
    #luckysheet-iconfont-neikuangxian
    -
  • - -
  • - -
    清除筛选
    -
    #luckysheet-iconfont-qingchushaixuan
    -
  • - -
  • - -
    文本向上
    -
    #luckysheet-iconfont-wenbenxiangshang
    -
  • - -
  • - -
    降序
    -
    #luckysheet-iconfont-jiangxu1
    -
  • - -
  • - -
    内框横线
    -
    #luckysheet-iconfont-neikuanghengxian
    -
  • - -
  • - -
    内框竖线
    -
    #luckysheet-iconfont-neikuangshuxian
    -
  • - -
  • - -
    自定义排序
    -
    #luckysheet-iconfont-zidingyipaixu
    -
  • - -
  • - -
    logo2
    -
    #luckysheet-iconfont-logo2
    -
  • - -
  • - -
    logo
    -
    #luckysheet-iconfont-logo
    -
  • - -
  • - -
    文本倾斜
    -
    #luckysheet-iconfont-wenbenqingxie1
    -
  • - -
  • - -
    加粗
    -
    #luckysheet-iconfont-jiacu
    -
  • - -
  • - -
    搜索
    -
    #luckysheet-iconfont-sousuo
    -
  • - -
  • - -
    关闭
    -
    #luckysheet-iconfont-guanbi
    -
  • - -
  • - -
    下一个
    -
    #luckysheet-iconfont-xiayige
    -
  • - -
  • - -
    下拉
    -
    #luckysheet-iconfont-xiala
    -
  • - -
  • - -
    文本颜色
    -
    #luckysheet-iconfont-wenbenyanse
    -
  • - -
  • - -
    上一个
    -
    #luckysheet-iconfont-shangyige
    -
  • - -
  • - -
    数据透视
    -
    #luckysheet-iconfont-shujutoushi
    -
  • - -
  • - -
    填充
    -
    #luckysheet-iconfont-tianchong
    -
  • - -
  • - -
    增加小数位
    -
    #luckysheet-iconfont-zengjiaxiaoshuwei
    -
  • - -
  • - -
    编辑2
    -
    #luckysheet-iconfont-bianji2
    -
  • - -
  • - -
    截屏
    -
    #luckysheet-iconfont-jieping
    -
  • - -
  • - -
    减小小数位
    -
    #luckysheet-iconfont-jianxiaoxiaoshuwei
    -
  • - -
  • - -
    菜单
    -
    #luckysheet-iconfont-caidan
    -
  • - -
  • - -
    数据库
    -
    #luckysheet-iconfont-shujuku
    -
  • - -
  • - -
    无边框
    -
    #luckysheet-iconfont-wubiankuang
    -
  • - -
  • - -
    编辑
    -
    #luckysheet-iconfont-bianji
    -
  • - -
  • - -
    清除样式
    -
    #luckysheet-iconfont-qingchuyangshi
    -
  • - -
  • - -
    删除
    -
    #luckysheet-iconfont-shanchu
    -
  • - -
  • - -
    文本居中对齐
    -
    #luckysheet-iconfont-wenbenjuzhongduiqi
    -
  • - -
  • - -
    打印
    -
    #luckysheet-iconfont-dayin
    -
  • - -
  • - -
    文本分割
    -
    #luckysheet-iconfont-wenbenfenge
    -
  • - -
  • - -
    函数‘
    -
    #luckysheet-iconfont-hanshu
    -
  • - -
  • - -
    降序
    -
    #luckysheet-iconfont-jiangxu
    -
  • - -
  • - -
    顶部对齐
    -
    #luckysheet-iconfont-dingbuduiqi
    -
  • - -
  • - -
    图片
    -
    #luckysheet-iconfont-tupian
    -
  • - -
  • - -
    向下90
    -
    #luckysheet-iconfont-xiangxia90
    -
  • - -
  • - -
    竖排文字
    -
    #luckysheet-iconfont-shupaiwenzi
    -
  • - -
  • - -
    全加边框
    -
    #luckysheet-iconfont-quanjiabiankuang
    -
  • - -
  • - -
    升序
    -
    #luckysheet-iconfont-shengxu
    -
  • - -
  • - -
    裁剪
    -
    #luckysheet-iconfont-caijian
    -
  • - -
  • - -
    金额
    -
    #luckysheet-iconfont-jine
    -
  • - -
  • - -
    菜单1
    -
    #luckysheet-iconfont-caidan1
    -
  • - -
  • - -
    取消合并
    -
    #luckysheet-iconfont-quxiaohebing
    -
  • - -
  • - -
    文本下划线
    -
    #luckysheet-iconfont-wenbenxiahuaxian
    -
  • - -
  • - -
    上边框
    -
    #luckysheet-iconfont-shangbiankuang
    -
  • - -
  • - -
    定位
    -
    #luckysheet-iconfont-dingwei
    -
  • - -
  • - -
    四周加边框
    -
    #luckysheet-iconfont-sizhoujiabiankuang
    -
  • - -
  • - -
    侧边栏收起
    -
    #luckysheet-iconfont-cebianlanshouqi
    -
  • - -
  • - -
    合并
    -
    #luckysheet-iconfont-hebing
    -
  • - -
  • - -
    向上倾斜
    -
    #luckysheet-iconfont-xiangshangqingxie
    -
  • - -
  • - -
    水平对齐
    -
    #luckysheet-iconfont-shuipingduiqi
    -
  • - -
  • - -
    文本删除线
    -
    #luckysheet-iconfont-wenbenshanchuxian
    -
  • - -
  • - -
    文本右对齐
    -
    #luckysheet-iconfont-wenbenyouduiqi
    -
  • - -
  • - -
    前进
    -
    #luckysheet-iconfont-qianjin
    -
  • - -
  • - -
    图表
    -
    #luckysheet-iconfont-tubiao
    -
  • - -
  • - -
    右边框
    -
    #luckysheet-iconfont-youbiankuang
    -
  • - -
  • - -
    百分号
    -
    #luckysheet-iconfont-baifenhao
    -
  • - -
  • - -
    格式刷
    -
    #luckysheet-iconfont-geshishua
    -
  • - -
  • - -
    保存
    -
    #luckysheet-iconfont-baocun
    -
  • - -
  • - -
    数据验证
    -
    #luckysheet-iconfont-shujuyanzheng
    -
  • - -
  • - -
    截断
    -
    #luckysheet-iconfont-jieduan
    -
  • - -
  • - -
    格式条件
    -
    #luckysheet-iconfont-geshitiaojian
    -
  • - -
  • - -
    自动换行
    -
    #luckysheet-iconfont-zidonghuanhang
    -
  • - -
  • - -
    侧边栏展开
    -
    #luckysheet-iconfont-cebianlanzhankai
    -
  • - -
  • - -
    筛选2
    -
    #luckysheet-iconfont-shaixuan2
    -
  • - -
  • - -
    向下倾斜
    -
    #luckysheet-iconfont-xiangxiaqingxie
    -
  • - -
  • - -
    溢出
    -
    #luckysheet-iconfont-yichu
    -
  • - -
  • - -
    垂直合并
    -
    #luckysheet-iconfont-chuizhihebing
    -
  • - -
  • - -
    文本分散对齐
    -
    #luckysheet-iconfont-wenbenfensanduiqi
    -
  • - -
  • - -
    左边框
    -
    #luckysheet-iconfont-zuobiankuang
    -
  • - -
  • - -
    分页查看
    -
    #luckysheet-iconfont-fenyechakan
    -
  • - -
  • - -
    运行
    -
    #luckysheet-iconfont-yunhang
    -
  • - -
  • - -
    -
    #luckysheet-iconfont-lie
    -
  • - -
  • - -
    全屏
    -
    #luckysheet-iconfont-quanping
    -
  • - -
  • - -
    筛选
    -
    #luckysheet-iconfont-shaixuan
    -
  • - -
  • - -
    更新
    -
    #luckysheet-iconfont-gengxin
    -
  • - -
  • - -
    清除
    -
    #luckysheet-iconfont-qingchu
    -
  • - -
  • - -
    -
    #luckysheet-iconfont-hang
    -
  • - -
  • - -
    注释
    -
    #luckysheet-iconfont-zhushi
    -
  • - -
  • - -
    -
    #luckysheet-iconfont-jian
    -
  • - -
  • - -
    计算
    -
    #luckysheet-iconfont-jisuan
    -
  • - -
  • - -
    -
    #luckysheet-iconfont-jia
    -
  • - -
  • - -
    底部对齐
    -
    #luckysheet-iconfont-dibuduiqi
    -
  • - -
  • - -
    向上90
    -
    #luckysheet-iconfont-xiangshang90
    -
  • - -
  • - -
    无选装
    -
    #luckysheet-iconfont-wuxuanzhuang
    -
  • - -
  • - -
    显示隐藏网格
    -
    #luckysheet-iconfont-xianshiyincangwangge
    -
  • - -
  • - -
    冻结
    -
    #luckysheet-iconfont-dongjie
    -
  • - -
  • - -
    文本左对齐
    -
    #luckysheet-iconfont-wenbenzuoduiqi
    -
  • - -
  • - -
    后退
    -
    #luckysheet-iconfont-houtui
    -
  • - -
  • - -
    水平合并
    -
    #luckysheet-iconfont-shuipinghebing
    -
  • - -
  • - -
    下边框
    -
    #luckysheet-iconfont-xiabiankuang
    -
  • - -
  • - -
    设置
    -
    #luckysheet-iconfont-shezhi
    -
  • - -
-
-

Symbol 引用

-
- -

这是一种全新的使用方式,应该说这才是未来的主流,也是平台目前推荐的用法。相关介绍可以参考这篇文章 - 这种用法其实是做了一个 SVG 的集合,与另外两种相比具有如下特点:

-
    -
  • 支持多色图标了,不再受单色限制。
  • -
  • 通过一些技巧,支持像字体那样,通过 font-size, color 来调整样式。
  • -
  • 兼容性较差,支持 IE9+,及现代浏览器。
  • -
  • 浏览器渲染 SVG 的性能一般,还不如 png。
  • -
-

使用步骤如下:

-

第一步:引入项目下面生成的 symbol 代码:

-
<script src="http://github.com/iconfont.js"></script>
-
-

第二步:加入通用 CSS 代码(引入一次就行):

-
<style>
-.icon {
-  width: 1em;
-  height: 1em;
-  vertical-align: -0.15em;
-  fill: currentColor;
-  overflow: hidden;
-}
-</style>
-
-

第三步:挑选相应图标并获取类名,应用于页面:

-
<svg class="icon" aria-hidden="true">
-  <use xlink:href="#icon-xxx"></use>
-</svg>
-
-
-
- -
-
- - - + + + + + IconFont Demo + + + + + + + + + + + +
+

+ +
+
+
    + +
  • + +
    链接
    +
    &#xe7f8;
    +
  • + +
  • + +
    打印区域
    +
    &#xe7f5;
    +
  • + +
  • + +
    打印页面配置
    +
    &#xe7f6;
    +
  • + +
  • + +
    打印标题
    +
    &#xe7f7;
    +
  • + +
  • + +
    分页预览
    +
    &#xe7f2;
    +
  • + +
  • + +
    普通
    +
    &#xe7f3;
    +
  • + +
  • + +
    页面布局
    +
    &#xe7f4;
    +
  • + +
  • + +
    表格锁定
    +
    &#xe7ee;
    +
  • + +
  • + +
    转到
    +
    &#xe7f1;
    +
  • + +
  • + +
    右箭头
    +
    &#xe7ed;
    +
  • + +
  • + +
    菜单
    +
    &#xe7ef;
    +
  • + +
  • + +
    替换
    +
    &#xe7f0;
    +
  • + +
  • + +
    冻结
    +
    &#xe7e1;
    +
  • + +
  • + +
    +
    &#xe7e2;
    +
  • + +
  • + +
    +
    &#xe7e3;
    +
  • + +
  • + +
    溢出
    +
    &#xe7e4;
    +
  • + +
  • + +
    升序
    +
    &#xe7e5;
    +
  • + +
  • + +
    内框线
    +
    &#xe7e6;
    +
  • + +
  • + +
    清除筛选
    +
    &#xe7e7;
    +
  • + +
  • + +
    文本向上
    +
    &#xe7e8;
    +
  • + +
  • + +
    降序
    +
    &#xe7e9;
    +
  • + +
  • + +
    内框横线
    +
    &#xe7ea;
    +
  • + +
  • + +
    内框竖线
    +
    &#xe7eb;
    +
  • + +
  • + +
    自定义排序
    +
    &#xe7ec;
    +
  • + +
  • + +
    logo2
    +
    &#xe7df;
    +
  • + +
  • + +
    logo
    +
    &#xe7e0;
    +
  • + +
  • + +
    文本倾斜
    +
    &#xe7de;
    +
  • + +
  • + +
    加粗
    +
    &#xe7d9;
    +
  • + +
  • + +
    搜索
    +
    &#xe78a;
    +
  • + +
  • + +
    关闭
    +
    &#xe78b;
    +
  • + +
  • + +
    下一个
    +
    &#xe78c;
    +
  • + +
  • + +
    下拉
    +
    &#xe78d;
    +
  • + +
  • + +
    文本颜色
    +
    &#xe78e;
    +
  • + +
  • + +
    上一个
    +
    &#xe78f;
    +
  • + +
  • + +
    数据透视
    +
    &#xe790;
    +
  • + +
  • + +
    填充
    +
    &#xe791;
    +
  • + +
  • + +
    增加小数位
    +
    &#xe792;
    +
  • + +
  • + +
    编辑2
    +
    &#xe793;
    +
  • + +
  • + +
    截屏
    +
    &#xe794;
    +
  • + +
  • + +
    减小小数位
    +
    &#xe796;
    +
  • + +
  • + +
    菜单
    +
    &#xe797;
    +
  • + +
  • + +
    数据库
    +
    &#xe798;
    +
  • + +
  • + +
    无边框
    +
    &#xe799;
    +
  • + +
  • + +
    编辑
    +
    &#xe79a;
    +
  • + +
  • + +
    清除样式
    +
    &#xe79b;
    +
  • + +
  • + +
    删除
    +
    &#xe79c;
    +
  • + +
  • + +
    文本居中对齐
    +
    &#xe79d;
    +
  • + +
  • + +
    打印
    +
    &#xe79e;
    +
  • + +
  • + +
    文本分割
    +
    &#xe79f;
    +
  • + +
  • + +
    函数‘
    +
    &#xe7a0;
    +
  • + +
  • + +
    降序
    +
    &#xe7a1;
    +
  • + +
  • + +
    顶部对齐
    +
    &#xe7a2;
    +
  • + +
  • + +
    图片
    +
    &#xe7a3;
    +
  • + +
  • + +
    向下90
    +
    &#xe7a4;
    +
  • + +
  • + +
    竖排文字
    +
    &#xe7a5;
    +
  • + +
  • + +
    全加边框
    +
    &#xe7a6;
    +
  • + +
  • + +
    升序
    +
    &#xe7a7;
    +
  • + +
  • + +
    裁剪
    +
    &#xe7a8;
    +
  • + +
  • + +
    金额
    +
    &#xe7a9;
    +
  • + +
  • + +
    菜单1
    +
    &#xe7aa;
    +
  • + +
  • + +
    取消合并
    +
    &#xe7ab;
    +
  • + +
  • + +
    文本下划线
    +
    &#xe7ac;
    +
  • + +
  • + +
    上边框
    +
    &#xe7ad;
    +
  • + +
  • + +
    定位
    +
    &#xe7ae;
    +
  • + +
  • + +
    四周加边框
    +
    &#xe7af;
    +
  • + +
  • + +
    侧边栏收起
    +
    &#xe7b0;
    +
  • + +
  • + +
    合并
    +
    &#xe7b1;
    +
  • + +
  • + +
    向上倾斜
    +
    &#xe7b2;
    +
  • + +
  • + +
    水平对齐
    +
    &#xe7b3;
    +
  • + +
  • + +
    文本删除线
    +
    &#xe7b4;
    +
  • + +
  • + +
    文本右对齐
    +
    &#xe7b5;
    +
  • + +
  • + +
    前进
    +
    &#xe7b6;
    +
  • + +
  • + +
    图表
    +
    &#xe7b7;
    +
  • + +
  • + +
    右边框
    +
    &#xe7b8;
    +
  • + +
  • + +
    百分号
    +
    &#xe7b9;
    +
  • + +
  • + +
    格式刷
    +
    &#xe7ba;
    +
  • + +
  • + +
    保存
    +
    &#xe7bb;
    +
  • + +
  • + +
    数据验证
    +
    &#xe7bc;
    +
  • + +
  • + +
    截断
    +
    &#xe7bd;
    +
  • + +
  • + +
    格式条件
    +
    &#xe7be;
    +
  • + +
  • + +
    自动换行
    +
    &#xe7bf;
    +
  • + +
  • + +
    侧边栏展开
    +
    &#xe7c0;
    +
  • + +
  • + +
    筛选2
    +
    &#xe7c1;
    +
  • + +
  • + +
    向下倾斜
    +
    &#xe7c2;
    +
  • + +
  • + +
    溢出
    +
    &#xe7c3;
    +
  • + +
  • + +
    垂直合并
    +
    &#xe7c4;
    +
  • + +
  • + +
    文本分散对齐
    +
    &#xe7c5;
    +
  • + +
  • + +
    左边框
    +
    &#xe7c6;
    +
  • + +
  • + +
    分页查看
    +
    &#xe7c7;
    +
  • + +
  • + +
    运行
    +
    &#xe7c8;
    +
  • + +
  • + +
    +
    &#xe7c9;
    +
  • + +
  • + +
    全屏
    +
    &#xe7ca;
    +
  • + +
  • + +
    筛选
    +
    &#xe7cb;
    +
  • + +
  • + +
    更新
    +
    &#xe7cc;
    +
  • + +
  • + +
    清除
    +
    &#xe7cd;
    +
  • + +
  • + +
    +
    &#xe7ce;
    +
  • + +
  • + +
    注释
    +
    &#xe7cf;
    +
  • + +
  • + +
    +
    &#xe7d0;
    +
  • + +
  • + +
    计算
    +
    &#xe7d1;
    +
  • + +
  • + +
    +
    &#xe7d2;
    +
  • + +
  • + +
    底部对齐
    +
    &#xe7d3;
    +
  • + +
  • + +
    向上90
    +
    &#xe7d4;
    +
  • + +
  • + +
    无选装
    +
    &#xe7d5;
    +
  • + +
  • + +
    显示隐藏网格
    +
    &#xe7d6;
    +
  • + +
  • + +
    冻结
    +
    &#xe7d7;
    +
  • + +
  • + +
    文本左对齐
    +
    &#xe7d8;
    +
  • + +
  • + +
    后退
    +
    &#xe7da;
    +
  • + +
  • + +
    水平合并
    +
    &#xe7db;
    +
  • + +
  • + +
    下边框
    +
    &#xe7dc;
    +
  • + +
  • + +
    设置
    +
    &#xe7dd;
    +
  • + +
+
+

Unicode 引用

+
+ +

Unicode 是字体在网页端最原始的应用方式,特点是:

+
    +
  • 兼容性最好,支持 IE6+,及所有现代浏览器。
  • +
  • 支持按字体的方式去动态调整图标大小,颜色等等。
  • +
  • 但是因为是字体,所以不支持多色。只能使用平台里单色的图标,就算项目里有多色图标也会自动去色。
  • +
+
+

注意:新版 iconfont 支持多色图标,这些多色图标在 Unicode 模式下将不能使用,如果有需求建议使用symbol 的引用方式

+
+

Unicode 使用步骤如下:

+

第一步:拷贝项目下面生成的 @font-face

+
@font-face {
+  font-family: 'iconfont';
+  src: url('http://github.com/iconfont.eot');
+  src: url('http://github.com/iconfont.eot?#iefix') format('embedded-opentype'),
+      url('http://github.com/iconfont.woff2') format('woff2'),
+      url('http://github.com/iconfont.woff') format('woff'),
+      url('http://github.com/iconfont.ttf') format('truetype'),
+      url('http://github.com/iconfont.svg#iconfont') format('svg');
+}
+
+

第二步:定义使用 iconfont 的样式

+
.iconfont {
+  font-family: "iconfont" !important;
+  font-size: 16px;
+  font-style: normal;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+}
+
+

第三步:挑选相应图标并获取字体编码,应用于页面

+
+<span class="iconfont">&#x33;</span>
+
+
+

"iconfont" 是你项目下的 font-family。可以通过编辑项目查看,默认是 "iconfont"。

+
+
+
+
+
    + +
  • + +
    + 链接 +
    +
    .luckysheet-iconfont-lianjie +
    +
  • + +
  • + +
    + 打印区域 +
    +
    .luckysheet-iconfont-dayinquyu +
    +
  • + +
  • + +
    + 打印页面配置 +
    +
    .luckysheet-iconfont-dayinyemianpeizhi +
    +
  • + +
  • + +
    + 打印标题 +
    +
    .luckysheet-iconfont-dayinbiaoti +
    +
  • + +
  • + +
    + 分页预览 +
    +
    .luckysheet-iconfont-fenyeyulan +
    +
  • + +
  • + +
    + 普通 +
    +
    .luckysheet-iconfont-putong +
    +
  • + +
  • + +
    + 页面布局 +
    +
    .luckysheet-iconfont-yemianbuju +
    +
  • + +
  • + +
    + 表格锁定 +
    +
    .luckysheet-iconfont-biaogesuoding +
    +
  • + +
  • + +
    + 转到 +
    +
    .luckysheet-iconfont-zhuandao1 +
    +
  • + +
  • + +
    + 右箭头 +
    +
    .luckysheet-iconfont-youjiantou +
    +
  • + +
  • + +
    + 菜单 +
    +
    .luckysheet-iconfont-caidan2 +
    +
  • + +
  • + +
    + 替换 +
    +
    .luckysheet-iconfont-tihuan +
    +
  • + +
  • + +
    + 冻结 +
    +
    .luckysheet-iconfont-dongjie1 +
    +
  • + +
  • + +
    + 剪 +
    +
    .luckysheet-iconfont-jian1 +
    +
  • + +
  • + +
    + 加 +
    +
    .luckysheet-iconfont-jia1 +
    +
  • + +
  • + +
    + 溢出 +
    +
    .luckysheet-iconfont-yichu1 +
    +
  • + +
  • + +
    + 升序 +
    +
    .luckysheet-iconfont-shengxu1 +
    +
  • + +
  • + +
    + 内框线 +
    +
    .luckysheet-iconfont-neikuangxian +
    +
  • + +
  • + +
    + 清除筛选 +
    +
    .luckysheet-iconfont-qingchushaixuan +
    +
  • + +
  • + +
    + 文本向上 +
    +
    .luckysheet-iconfont-wenbenxiangshang +
    +
  • + +
  • + +
    + 降序 +
    +
    .luckysheet-iconfont-jiangxu1 +
    +
  • + +
  • + +
    + 内框横线 +
    +
    .luckysheet-iconfont-neikuanghengxian +
    +
  • + +
  • + +
    + 内框竖线 +
    +
    .luckysheet-iconfont-neikuangshuxian +
    +
  • + +
  • + +
    + 自定义排序 +
    +
    .luckysheet-iconfont-zidingyipaixu +
    +
  • + +
  • + +
    + logo2 +
    +
    .luckysheet-iconfont-logo2 +
    +
  • + +
  • + +
    + logo +
    +
    .luckysheet-iconfont-logo +
    +
  • + +
  • + +
    + 文本倾斜 +
    +
    .luckysheet-iconfont-wenbenqingxie1 +
    +
  • + +
  • + +
    + 加粗 +
    +
    .luckysheet-iconfont-jiacu +
    +
  • + +
  • + +
    + 搜索 +
    +
    .luckysheet-iconfont-sousuo +
    +
  • + +
  • + +
    + 关闭 +
    +
    .luckysheet-iconfont-guanbi +
    +
  • + +
  • + +
    + 下一个 +
    +
    .luckysheet-iconfont-xiayige +
    +
  • + +
  • + +
    + 下拉 +
    +
    .luckysheet-iconfont-xiala +
    +
  • + +
  • + +
    + 文本颜色 +
    +
    .luckysheet-iconfont-wenbenyanse +
    +
  • + +
  • + +
    + 上一个 +
    +
    .luckysheet-iconfont-shangyige +
    +
  • + +
  • + +
    + 数据透视 +
    +
    .luckysheet-iconfont-shujutoushi +
    +
  • + +
  • + +
    + 填充 +
    +
    .luckysheet-iconfont-tianchong +
    +
  • + +
  • + +
    + 增加小数位 +
    +
    .luckysheet-iconfont-zengjiaxiaoshuwei +
    +
  • + +
  • + +
    + 编辑2 +
    +
    .luckysheet-iconfont-bianji2 +
    +
  • + +
  • + +
    + 截屏 +
    +
    .luckysheet-iconfont-jieping +
    +
  • + +
  • + +
    + 减小小数位 +
    +
    .luckysheet-iconfont-jianxiaoxiaoshuwei +
    +
  • + +
  • + +
    + 菜单 +
    +
    .luckysheet-iconfont-caidan +
    +
  • + +
  • + +
    + 数据库 +
    +
    .luckysheet-iconfont-shujuku +
    +
  • + +
  • + +
    + 无边框 +
    +
    .luckysheet-iconfont-wubiankuang +
    +
  • + +
  • + +
    + 编辑 +
    +
    .luckysheet-iconfont-bianji +
    +
  • + +
  • + +
    + 清除样式 +
    +
    .luckysheet-iconfont-qingchuyangshi +
    +
  • + +
  • + +
    + 删除 +
    +
    .luckysheet-iconfont-shanchu +
    +
  • + +
  • + +
    + 文本居中对齐 +
    +
    .luckysheet-iconfont-wenbenjuzhongduiqi +
    +
  • + +
  • + +
    + 打印 +
    +
    .luckysheet-iconfont-dayin +
    +
  • + +
  • + +
    + 文本分割 +
    +
    .luckysheet-iconfont-wenbenfenge +
    +
  • + +
  • + +
    + 函数‘ +
    +
    .luckysheet-iconfont-hanshu +
    +
  • + +
  • + +
    + 降序 +
    +
    .luckysheet-iconfont-jiangxu +
    +
  • + +
  • + +
    + 顶部对齐 +
    +
    .luckysheet-iconfont-dingbuduiqi +
    +
  • + +
  • + +
    + 图片 +
    +
    .luckysheet-iconfont-tupian +
    +
  • + +
  • + +
    + 向下90 +
    +
    .luckysheet-iconfont-xiangxia90 +
    +
  • + +
  • + +
    + 竖排文字 +
    +
    .luckysheet-iconfont-shupaiwenzi +
    +
  • + +
  • + +
    + 全加边框 +
    +
    .luckysheet-iconfont-quanjiabiankuang +
    +
  • + +
  • + +
    + 升序 +
    +
    .luckysheet-iconfont-shengxu +
    +
  • + +
  • + +
    + 裁剪 +
    +
    .luckysheet-iconfont-caijian +
    +
  • + +
  • + +
    + 金额 +
    +
    .luckysheet-iconfont-jine +
    +
  • + +
  • + +
    + 菜单1 +
    +
    .luckysheet-iconfont-caidan1 +
    +
  • + +
  • + +
    + 取消合并 +
    +
    .luckysheet-iconfont-quxiaohebing +
    +
  • + +
  • + +
    + 文本下划线 +
    +
    .luckysheet-iconfont-wenbenxiahuaxian +
    +
  • + +
  • + +
    + 上边框 +
    +
    .luckysheet-iconfont-shangbiankuang +
    +
  • + +
  • + +
    + 定位 +
    +
    .luckysheet-iconfont-dingwei +
    +
  • + +
  • + +
    + 四周加边框 +
    +
    .luckysheet-iconfont-sizhoujiabiankuang +
    +
  • + +
  • + +
    + 侧边栏收起 +
    +
    .luckysheet-iconfont-cebianlanshouqi +
    +
  • + +
  • + +
    + 合并 +
    +
    .luckysheet-iconfont-hebing +
    +
  • + +
  • + +
    + 向上倾斜 +
    +
    .luckysheet-iconfont-xiangshangqingxie +
    +
  • + +
  • + +
    + 水平对齐 +
    +
    .luckysheet-iconfont-shuipingduiqi +
    +
  • + +
  • + +
    + 文本删除线 +
    +
    .luckysheet-iconfont-wenbenshanchuxian +
    +
  • + +
  • + +
    + 文本右对齐 +
    +
    .luckysheet-iconfont-wenbenyouduiqi +
    +
  • + +
  • + +
    + 前进 +
    +
    .luckysheet-iconfont-qianjin +
    +
  • + +
  • + +
    + 图表 +
    +
    .luckysheet-iconfont-tubiao +
    +
  • + +
  • + +
    + 右边框 +
    +
    .luckysheet-iconfont-youbiankuang +
    +
  • + +
  • + +
    + 百分号 +
    +
    .luckysheet-iconfont-baifenhao +
    +
  • + +
  • + +
    + 格式刷 +
    +
    .luckysheet-iconfont-geshishua +
    +
  • + +
  • + +
    + 保存 +
    +
    .luckysheet-iconfont-baocun +
    +
  • + +
  • + +
    + 数据验证 +
    +
    .luckysheet-iconfont-shujuyanzheng +
    +
  • + +
  • + +
    + 截断 +
    +
    .luckysheet-iconfont-jieduan +
    +
  • + +
  • + +
    + 格式条件 +
    +
    .luckysheet-iconfont-geshitiaojian +
    +
  • + +
  • + +
    + 自动换行 +
    +
    .luckysheet-iconfont-zidonghuanhang +
    +
  • + +
  • + +
    + 侧边栏展开 +
    +
    .luckysheet-iconfont-cebianlanzhankai +
    +
  • + +
  • + +
    + 筛选2 +
    +
    .luckysheet-iconfont-shaixuan2 +
    +
  • + +
  • + +
    + 向下倾斜 +
    +
    .luckysheet-iconfont-xiangxiaqingxie +
    +
  • + +
  • + +
    + 溢出 +
    +
    .luckysheet-iconfont-yichu +
    +
  • + +
  • + +
    + 垂直合并 +
    +
    .luckysheet-iconfont-chuizhihebing +
    +
  • + +
  • + +
    + 文本分散对齐 +
    +
    .luckysheet-iconfont-wenbenfensanduiqi +
    +
  • + +
  • + +
    + 左边框 +
    +
    .luckysheet-iconfont-zuobiankuang +
    +
  • + +
  • + +
    + 分页查看 +
    +
    .luckysheet-iconfont-fenyechakan +
    +
  • + +
  • + +
    + 运行 +
    +
    .luckysheet-iconfont-yunhang +
    +
  • + +
  • + +
    + 列 +
    +
    .luckysheet-iconfont-lie +
    +
  • + +
  • + +
    + 全屏 +
    +
    .luckysheet-iconfont-quanping +
    +
  • + +
  • + +
    + 筛选 +
    +
    .luckysheet-iconfont-shaixuan +
    +
  • + +
  • + +
    + 更新 +
    +
    .luckysheet-iconfont-gengxin +
    +
  • + +
  • + +
    + 清除 +
    +
    .luckysheet-iconfont-qingchu +
    +
  • + +
  • + +
    + 行 +
    +
    .luckysheet-iconfont-hang +
    +
  • + +
  • + +
    + 注释 +
    +
    .luckysheet-iconfont-zhushi +
    +
  • + +
  • + +
    + 剪 +
    +
    .luckysheet-iconfont-jian +
    +
  • + +
  • + +
    + 计算 +
    +
    .luckysheet-iconfont-jisuan +
    +
  • + +
  • + +
    + 加 +
    +
    .luckysheet-iconfont-jia +
    +
  • + +
  • + +
    + 底部对齐 +
    +
    .luckysheet-iconfont-dibuduiqi +
    +
  • + +
  • + +
    + 向上90 +
    +
    .luckysheet-iconfont-xiangshang90 +
    +
  • + +
  • + +
    + 无选装 +
    +
    .luckysheet-iconfont-wuxuanzhuang +
    +
  • + +
  • + +
    + 显示隐藏网格 +
    +
    .luckysheet-iconfont-xianshiyincangwangge +
    +
  • + +
  • + +
    + 冻结 +
    +
    .luckysheet-iconfont-dongjie +
    +
  • + +
  • + +
    + 文本左对齐 +
    +
    .luckysheet-iconfont-wenbenzuoduiqi +
    +
  • + +
  • + +
    + 后退 +
    +
    .luckysheet-iconfont-houtui +
    +
  • + +
  • + +
    + 水平合并 +
    +
    .luckysheet-iconfont-shuipinghebing +
    +
  • + +
  • + +
    + 下边框 +
    +
    .luckysheet-iconfont-xiabiankuang +
    +
  • + +
  • + +
    + 设置 +
    +
    .luckysheet-iconfont-shezhi +
    +
  • + +
+
+

font-class 引用

+
+ +

font-class 是 Unicode 使用方式的一种变种,主要是解决 Unicode 书写不直观,语意不明确的问题。

+

与 Unicode 使用方式相比,具有如下特点:

+
    +
  • 兼容性良好,支持 IE8+,及所有现代浏览器。
  • +
  • 相比于 Unicode 语意明确,书写更直观。可以很容易分辨这个 icon 是什么。
  • +
  • 因为使用 class 来定义图标,所以当要替换图标时,只需要修改 class 里面的 Unicode 引用。
  • +
  • 不过因为本质上还是使用的字体,所以多色图标还是不支持的。
  • +
+

使用步骤如下:

+

第一步:引入项目下面生成的 fontclass 代码:

+
<link rel="stylesheet" href="http://github.com/iconfont.css">
+
+

第二步:挑选相应图标并获取类名,应用于页面:

+
<span class="iconfont-luckysheet luckysheet-iconfont-xxx"></span>
+
+
+

" + iconfont" 是你项目下的 font-family。可以通过编辑项目查看,默认是 "iconfont"。

+
+
+
+
+
    + +
  • + +
    链接
    +
    #luckysheet-iconfont-lianjie
    +
  • + +
  • + +
    打印区域
    +
    #luckysheet-iconfont-dayinquyu
    +
  • + +
  • + +
    打印页面配置
    +
    #luckysheet-iconfont-dayinyemianpeizhi
    +
  • + +
  • + +
    打印标题
    +
    #luckysheet-iconfont-dayinbiaoti
    +
  • + +
  • + +
    分页预览
    +
    #luckysheet-iconfont-fenyeyulan
    +
  • + +
  • + +
    普通
    +
    #luckysheet-iconfont-putong
    +
  • + +
  • + +
    页面布局
    +
    #luckysheet-iconfont-yemianbuju
    +
  • + +
  • + +
    表格锁定
    +
    #luckysheet-iconfont-biaogesuoding
    +
  • + +
  • + +
    转到
    +
    #luckysheet-iconfont-zhuandao1
    +
  • + +
  • + +
    右箭头
    +
    #luckysheet-iconfont-youjiantou
    +
  • + +
  • + +
    菜单
    +
    #luckysheet-iconfont-caidan2
    +
  • + +
  • + +
    替换
    +
    #luckysheet-iconfont-tihuan
    +
  • + +
  • + +
    冻结
    +
    #luckysheet-iconfont-dongjie1
    +
  • + +
  • + +
    +
    #luckysheet-iconfont-jian1
    +
  • + +
  • + +
    +
    #luckysheet-iconfont-jia1
    +
  • + +
  • + +
    溢出
    +
    #luckysheet-iconfont-yichu1
    +
  • + +
  • + +
    升序
    +
    #luckysheet-iconfont-shengxu1
    +
  • + +
  • + +
    内框线
    +
    #luckysheet-iconfont-neikuangxian
    +
  • + +
  • + +
    清除筛选
    +
    #luckysheet-iconfont-qingchushaixuan
    +
  • + +
  • + +
    文本向上
    +
    #luckysheet-iconfont-wenbenxiangshang
    +
  • + +
  • + +
    降序
    +
    #luckysheet-iconfont-jiangxu1
    +
  • + +
  • + +
    内框横线
    +
    #luckysheet-iconfont-neikuanghengxian
    +
  • + +
  • + +
    内框竖线
    +
    #luckysheet-iconfont-neikuangshuxian
    +
  • + +
  • + +
    自定义排序
    +
    #luckysheet-iconfont-zidingyipaixu
    +
  • + +
  • + +
    logo2
    +
    #luckysheet-iconfont-logo2
    +
  • + +
  • + +
    logo
    +
    #luckysheet-iconfont-logo
    +
  • + +
  • + +
    文本倾斜
    +
    #luckysheet-iconfont-wenbenqingxie1
    +
  • + +
  • + +
    加粗
    +
    #luckysheet-iconfont-jiacu
    +
  • + +
  • + +
    搜索
    +
    #luckysheet-iconfont-sousuo
    +
  • + +
  • + +
    关闭
    +
    #luckysheet-iconfont-guanbi
    +
  • + +
  • + +
    下一个
    +
    #luckysheet-iconfont-xiayige
    +
  • + +
  • + +
    下拉
    +
    #luckysheet-iconfont-xiala
    +
  • + +
  • + +
    文本颜色
    +
    #luckysheet-iconfont-wenbenyanse
    +
  • + +
  • + +
    上一个
    +
    #luckysheet-iconfont-shangyige
    +
  • + +
  • + +
    数据透视
    +
    #luckysheet-iconfont-shujutoushi
    +
  • + +
  • + +
    填充
    +
    #luckysheet-iconfont-tianchong
    +
  • + +
  • + +
    增加小数位
    +
    #luckysheet-iconfont-zengjiaxiaoshuwei
    +
  • + +
  • + +
    编辑2
    +
    #luckysheet-iconfont-bianji2
    +
  • + +
  • + +
    截屏
    +
    #luckysheet-iconfont-jieping
    +
  • + +
  • + +
    减小小数位
    +
    #luckysheet-iconfont-jianxiaoxiaoshuwei
    +
  • + +
  • + +
    菜单
    +
    #luckysheet-iconfont-caidan
    +
  • + +
  • + +
    数据库
    +
    #luckysheet-iconfont-shujuku
    +
  • + +
  • + +
    无边框
    +
    #luckysheet-iconfont-wubiankuang
    +
  • + +
  • + +
    编辑
    +
    #luckysheet-iconfont-bianji
    +
  • + +
  • + +
    清除样式
    +
    #luckysheet-iconfont-qingchuyangshi
    +
  • + +
  • + +
    删除
    +
    #luckysheet-iconfont-shanchu
    +
  • + +
  • + +
    文本居中对齐
    +
    #luckysheet-iconfont-wenbenjuzhongduiqi
    +
  • + +
  • + +
    打印
    +
    #luckysheet-iconfont-dayin
    +
  • + +
  • + +
    文本分割
    +
    #luckysheet-iconfont-wenbenfenge
    +
  • + +
  • + +
    函数‘
    +
    #luckysheet-iconfont-hanshu
    +
  • + +
  • + +
    降序
    +
    #luckysheet-iconfont-jiangxu
    +
  • + +
  • + +
    顶部对齐
    +
    #luckysheet-iconfont-dingbuduiqi
    +
  • + +
  • + +
    图片
    +
    #luckysheet-iconfont-tupian
    +
  • + +
  • + +
    向下90
    +
    #luckysheet-iconfont-xiangxia90
    +
  • + +
  • + +
    竖排文字
    +
    #luckysheet-iconfont-shupaiwenzi
    +
  • + +
  • + +
    全加边框
    +
    #luckysheet-iconfont-quanjiabiankuang
    +
  • + +
  • + +
    升序
    +
    #luckysheet-iconfont-shengxu
    +
  • + +
  • + +
    裁剪
    +
    #luckysheet-iconfont-caijian
    +
  • + +
  • + +
    金额
    +
    #luckysheet-iconfont-jine
    +
  • + +
  • + +
    菜单1
    +
    #luckysheet-iconfont-caidan1
    +
  • + +
  • + +
    取消合并
    +
    #luckysheet-iconfont-quxiaohebing
    +
  • + +
  • + +
    文本下划线
    +
    #luckysheet-iconfont-wenbenxiahuaxian
    +
  • + +
  • + +
    上边框
    +
    #luckysheet-iconfont-shangbiankuang
    +
  • + +
  • + +
    定位
    +
    #luckysheet-iconfont-dingwei
    +
  • + +
  • + +
    四周加边框
    +
    #luckysheet-iconfont-sizhoujiabiankuang
    +
  • + +
  • + +
    侧边栏收起
    +
    #luckysheet-iconfont-cebianlanshouqi
    +
  • + +
  • + +
    合并
    +
    #luckysheet-iconfont-hebing
    +
  • + +
  • + +
    向上倾斜
    +
    #luckysheet-iconfont-xiangshangqingxie
    +
  • + +
  • + +
    水平对齐
    +
    #luckysheet-iconfont-shuipingduiqi
    +
  • + +
  • + +
    文本删除线
    +
    #luckysheet-iconfont-wenbenshanchuxian
    +
  • + +
  • + +
    文本右对齐
    +
    #luckysheet-iconfont-wenbenyouduiqi
    +
  • + +
  • + +
    前进
    +
    #luckysheet-iconfont-qianjin
    +
  • + +
  • + +
    图表
    +
    #luckysheet-iconfont-tubiao
    +
  • + +
  • + +
    右边框
    +
    #luckysheet-iconfont-youbiankuang
    +
  • + +
  • + +
    百分号
    +
    #luckysheet-iconfont-baifenhao
    +
  • + +
  • + +
    格式刷
    +
    #luckysheet-iconfont-geshishua
    +
  • + +
  • + +
    保存
    +
    #luckysheet-iconfont-baocun
    +
  • + +
  • + +
    数据验证
    +
    #luckysheet-iconfont-shujuyanzheng
    +
  • + +
  • + +
    截断
    +
    #luckysheet-iconfont-jieduan
    +
  • + +
  • + +
    格式条件
    +
    #luckysheet-iconfont-geshitiaojian
    +
  • + +
  • + +
    自动换行
    +
    #luckysheet-iconfont-zidonghuanhang
    +
  • + +
  • + +
    侧边栏展开
    +
    #luckysheet-iconfont-cebianlanzhankai
    +
  • + +
  • + +
    筛选2
    +
    #luckysheet-iconfont-shaixuan2
    +
  • + +
  • + +
    向下倾斜
    +
    #luckysheet-iconfont-xiangxiaqingxie
    +
  • + +
  • + +
    溢出
    +
    #luckysheet-iconfont-yichu
    +
  • + +
  • + +
    垂直合并
    +
    #luckysheet-iconfont-chuizhihebing
    +
  • + +
  • + +
    文本分散对齐
    +
    #luckysheet-iconfont-wenbenfensanduiqi
    +
  • + +
  • + +
    左边框
    +
    #luckysheet-iconfont-zuobiankuang
    +
  • + +
  • + +
    分页查看
    +
    #luckysheet-iconfont-fenyechakan
    +
  • + +
  • + +
    运行
    +
    #luckysheet-iconfont-yunhang
    +
  • + +
  • + +
    +
    #luckysheet-iconfont-lie
    +
  • + +
  • + +
    全屏
    +
    #luckysheet-iconfont-quanping
    +
  • + +
  • + +
    筛选
    +
    #luckysheet-iconfont-shaixuan
    +
  • + +
  • + +
    更新
    +
    #luckysheet-iconfont-gengxin
    +
  • + +
  • + +
    清除
    +
    #luckysheet-iconfont-qingchu
    +
  • + +
  • + +
    +
    #luckysheet-iconfont-hang
    +
  • + +
  • + +
    注释
    +
    #luckysheet-iconfont-zhushi
    +
  • + +
  • + +
    +
    #luckysheet-iconfont-jian
    +
  • + +
  • + +
    计算
    +
    #luckysheet-iconfont-jisuan
    +
  • + +
  • + +
    +
    #luckysheet-iconfont-jia
    +
  • + +
  • + +
    底部对齐
    +
    #luckysheet-iconfont-dibuduiqi
    +
  • + +
  • + +
    向上90
    +
    #luckysheet-iconfont-xiangshang90
    +
  • + +
  • + +
    无选装
    +
    #luckysheet-iconfont-wuxuanzhuang
    +
  • + +
  • + +
    显示隐藏网格
    +
    #luckysheet-iconfont-xianshiyincangwangge
    +
  • + +
  • + +
    冻结
    +
    #luckysheet-iconfont-dongjie
    +
  • + +
  • + +
    文本左对齐
    +
    #luckysheet-iconfont-wenbenzuoduiqi
    +
  • + +
  • + +
    后退
    +
    #luckysheet-iconfont-houtui
    +
  • + +
  • + +
    水平合并
    +
    #luckysheet-iconfont-shuipinghebing
    +
  • + +
  • + +
    下边框
    +
    #luckysheet-iconfont-xiabiankuang
    +
  • + +
  • + +
    设置
    +
    #luckysheet-iconfont-shezhi
    +
  • + +
+
+

Symbol 引用

+
+ +

这是一种全新的使用方式,应该说这才是未来的主流,也是平台目前推荐的用法。相关介绍可以参考这篇文章 + 这种用法其实是做了一个 SVG 的集合,与另外两种相比具有如下特点:

+
    +
  • 支持多色图标了,不再受单色限制。
  • +
  • 通过一些技巧,支持像字体那样,通过 font-size, color 来调整样式。
  • +
  • 兼容性较差,支持 IE9+,及现代浏览器。
  • +
  • 浏览器渲染 SVG 的性能一般,还不如 png。
  • +
+

使用步骤如下:

+

第一步:引入项目下面生成的 symbol 代码:

+
<script src="http://github.com/iconfont.js"></script>
+
+

第二步:加入通用 CSS 代码(引入一次就行):

+
<style>
+.icon {
+  width: 1em;
+  height: 1em;
+  vertical-align: -0.15em;
+  fill: currentColor;
+  overflow: hidden;
+}
+</style>
+
+

第三步:挑选相应图标并获取类名,应用于页面:

+
<svg class="icon" aria-hidden="true">
+  <use xlink:href="#icon-xxx"></use>
+</svg>
+
+
+
+ +
+
+ + + diff --git a/src/assets/iconfont/iconfont.css b/src/assets/iconfont/iconfont.css index d76bed697..7b242c617 100644 --- a/src/assets/iconfont/iconfont.css +++ b/src/assets/iconfont/iconfont.css @@ -1,457 +1,457 @@ -@font-face {font-family: "iconfont"; - src: url('http://github.com/iconfont.eot?t=1605236775724'); /* IE9 */ - src: url('http://github.com/iconfont.eot?t=1605236775724#iefix') format('embedded-opentype'), /* IE6-IE8 */ - url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAACJQAAsAAAAAVKgAACH9AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCObgqBghDoEwE2AiQDgygLgVYABCAFhG0HimMbCkZ1hhxsHACQvM8iooIUIPv/vyU3hoisQDP7oxQspFSOEhyEI964SGdpHgbZQdChvkX9Xd97nQ+VaIq7d5noG8yfVj6tSWbtWNLPqLzFBpnESCbt5xn252+nSxLNW5sNpeTh+f39/481976wz7uPRtUHGDrbrw4ZrEQ+o9sQS7AOLVwR9wAYHufsX4sltIw2UGCOWN/DZAYtWnRGXhjMYFsLlBOm6ZgkU7ixOUVm3hSYSZmdcy3Ttndf4ESBU8/fv9PPcyR7254j2T+y/RCTRQgUIXDBiWYbMHXqvsls3dZt8yP9Sr8UeI/jYBECy2DQpVnHImNkw4UQi/rrnSeKbo3ABwpVbnt7MIAxZW53t9DyQ2dMry7DVAd+ALjBeSGPOIh9Xfq3yXEPE8N0ZWvf3u79xy5A2HKIRLDVxEQAD/zfm+lMLBjA+E0Di+KU9uanlEK1W7V0DFgDrXU7yJ4lXCBcov15demKDpPSOimby7C0sjnTlu3++0jcl/hgIbgcAnwn3BBuFBeEGwh8Vjk7ve+1wbkBaZxrn1Lq5im1jRnWZJnalH2IbiaZdvxjNFLYNjjuGFPLYXaXebSkr0ZxoxJ0Q5TYn78moVKvgrRuw7Z9FDmzmGDZtcsXT1M8rfKIsqS8oZTyYT6c9itRHs+EAy+Rv59+NScRhJKM+eKuC+vPAT8+K8geLvKTY47JsOvG/iMyFJATC6ijaZbsa6IgU/laM085SuVr48fXBUURyyJFWuHz/9qJHr369BswaMiwEaPGjJswaUpBkxmmzTTLbHPMNc98Cyy0yGJLLLXMciustAqEYARlstgcLo8vEIrEEqlMrlCqyA5ptDq9wWiiOkVz2mojOedguOBye+g6Dn+yRq069Ro0atKsRas27SqVq1KtQolSZUIm8j+eVMpcWg0li2DyBubHB6OHH1/08uOHPn780a+QhKGVCLQRhXZi0EEcOklAF0noJgU9pKGXDPSRhX5yMEAeShRgkCIMUYJhyjBCBYxSCWNUwTjVMEENTFILU9TBNPUwQwPM0ghzNME8zbBACyzSCku0wTLtsKIDVnXCmi5Y1w0bemBTL2zpg239sGMAdg3CniHYNwwHRuDQKBwZg2PjcGICTk3CmSk4Nw0XZuDSLFyZg2vzEGMBbizCrSW4swz3VuDBKjxagyfr8GwDsmzCiy3IsQ2vduDNLrzbgyj78OEAPh1CA0fw5Ri+ncCPU/h1BvWcQy0XUMclZLhKi1S3hrQYdRuAPLdQ4A6K3EOJByjzCBWeoIpnqOYFaniFJG8Q5x1SfECaT0jwBRG+IcoPxPiFIH8Q4h/CBNnZNvqzb/2Hgm+XX6shAPDIDn2nEKAqnKGBUOivZA4KW0gZvafr3BQtvdGQKGOXK+jxMuHo+RqAUxEBRoTkYwZwmLuk6nyIpr4UPapkojiXpKlDRMhw0F0ARQPDTMn9UPjbkHEt+m4NOCLsVWbo7ZitUp6Nl3YnrJ8iAvij7nsIRSkYT2AfwVuji87qVBm1Q5gVmYuFsYgqpu1Vy0P4b7e3HTaoWtKXAeiIq9rtbDfJnFEJ3yZ5C9vMFqQ4rUyz9jyEsVO+bind+meT82iX3uh7WLtf/mNHA48h7jF5ypzTlCQcv5ubeehZSly2XeCJ32vWw0QsABZSz1MRvFzCulXrUUotFpgPLHGctww3N2IaitXjWLBtPW/2mW0J9wozblPnTXu/syRwarVqYG2kKhiLdIG7JvyWsZA0S5cPgxEReXFY0nvhZ941sR0MJUHkFQ7CcX3kV73dn/vD9HnX4zD1iwl79nujL6+lfhIthTEg9FMWn8HG31mJYxBFRLi2SxRsAwoSjCwtLT6/QJHjxcxpyU90trhORYQlNEVoAbGpu2GbosgBG5OkOGMFEfxEaXYgF207EO8w4/rRVbtzcBw43CthsjtfCmL0OBzGXkRcHeMaT59lMFjZVw728rXpog0WMNByJpe9kcvkvWrDIJPwkHN5yI1nKJtnLIbJvJ8CpC0DZRiQThkg5CyOqcHwGnJsLMnghmXYs53/HpcMFoqT/eerkoBVBRRvYxNPHyNNQeQAMCbForbAXiTgZZUEjueAtXnoH7H9zuDi/f636fbH3VdPrdw7eOuDvyN3Drx9st7snrvX+5YNXiGOS91Vux7s+nvhzs3tVjXr8khMzBjJllUMimyapCU9KmwhxrSFdmeVw/5mgCsEvEiy8ZkC1iTTAU42MpStqBEbthqWYkhbLgMBaFuGFwUJmsImfqFKWJCxL1r8hd02vNVOgzRus/VWrCjy4oKdpn6SKxVsiIkZw6rhBYfJ0ioZ2Yyr7KrxWsTdUMmVwKlGtwrS1ultYU0lJS1djQX9BLXJhOoliVrLa2MGmSNLpp8EEYQaEbKMOzWImr1XRLBD/hlFJXG5xhnaCoujC6vDbSYgxnlndOSqiujC2Qxl22EM0UsdJhFI0OZT0U9VILjQS2YtDWPPEV0vq8QfBoKrSKAHyyJalTzpy92Iwf5WDXQ3S/2q3vzeMmwXM+YKRAR/h9PxHVkIvwFsEtzcp+DwLBJ4+XCgqUvB6/4bz4T/Pc73+xR8db87+loFX5KsNIk0O+CSUDQjKiH6L+5+++17E/2rKYc7xznuge8C/0LnW2+dDjxMwe4J6lXQf4PD6zuA0X/0TxRc2riGZNwIx/9/llacjXLVM+x//fV0X5b0Rg803Tl6ZlCLGA4ElEGzGAlFrfbrXd/hJgPp8rNuV+c1+a1er/vwe7Xu7jetCgFvHT04vKLIQFoyXtkoqm5Vf/VgZW/mmwgdUXO134d5bvrXE1+a/NVUpZ53p2sTjcnqVPtlUiRo7hHBzVpuzpDaVDNCmVqWW25HVLJeSgtSp3EcOaIllJZKSBcICf+RFv75kffh00vkrXbCrXV/bTPYWNHBp6fg1kF4dBb9z0c6O8Bb2Qg21xD9vXmtro0S8MjcP2KMGNpoenQ72E1bWkjTZVjZvmRt7mLW37vKQOMyw4vZDtO3GVuded3LdjpJXAzjlahVT9a3OoXav3vXV2/d/cOl/f7YnwY6uvl2oD7xP35241LkqBHnj92H97tjh/3xPw9eGF/Va1d0utVZdao7gzf6EvWmvRYH5rLnK+YqfX2EgUYrd2AoN80Jtw9ZarlGYyE1x52d4/fqIPUEru+NHhlOvi8J6agxKY/J4glz+UkpF7jsMZnv/i7HCrHXkhldR60gA2NqEQBm0U7RAJic1QK4pFWF9GUBqGRNBQJ8CNrihUe0miylfnEoCRxHOMClR93J2HOqhI00VPNASU9MpGFcaFgm58huxFU7jJuGt3PZ3tpDk8P1taRoP1P7aUlYIlwOG6QmCpuboJumMlQsukPbI2cFN+egEZ0/61w+XF2hXLC2Lmej40W+LYdoKBKfSVtT0swQMvpJseQMBxjI1KBqVyywFVhYMyxzwcmtM1CLYbGwWFElDpCgiiqMKEXPBlIPSwaVjUKzllM/IVLiJIlZj+jsgDuXL25S0BWnKLJORTFz2coISy7LOIkSFzhN1z68pJA0g1KqkGlkBBAUREHAtGEin+IneJbKmjRrpB/LAgto2GDJRzPoJg1fEUpAPpsztNSLYWdVoew0be76e8sCijlqVCgZ5PMKhFDDoyYb4+0bLAEVjahP/nmqqrOcsTFjGX++lJObZLTOHDQpSTQZU1S1o1/eiiYbVAELF8jkebSh/cISZioQkoInrF2ENKuGiibeiQ32kSLQjTJWs5YFMgsAFQEzw038skAXWVcEJVHAO7VZVZTUykJGxVtZ0Tl9W/opzIh4uUzZqVExcuaNHOSbxrI2Eg4uthqa52oFfWWW2Q4heSUpiH52C642GsGGhbsRFkecw7h2mgbYSvmpSEY1nXPsZg1+aV7KBf/+4iwlzyex258/q9mj2QIvHBd26NZn7uaVRmqL4OrxYcGbauMtOztwKOj3/cGAez3ZTR+lv9Hc7bQqtBMqbMacn7IsEMBh5YURAn2N5Rk7h07xS7obDn5diqFxQh6rCDk8xkjjTYkF+bAS8poqltS3pJYMhNWhBrUstOcnaBMgHJmVemgECca+aasAoYupWuHBignS9J4SwxIAP0341LMF4jSz5vc/7xPUziYygdfZwjnK5DHnAt/tfrNfpTkSEYau5xDqt9ZFyuB+v52hLC1sqE0AMwt2kkapL5b4qUpGJZ1z7CqGpv3Cz15svDXnOfox3+6FB4Mf/eNT77PwC//z+kusDbwCLURGGwlyqJxNTa0nZfoJ0bRzWMET6jFryDx0AnJCmX64NG/Quj4xeW1qYmh6anhSA7PHAwuXrgvl0bY5Q7MW2r8kWMbi9V8hsBZsCtA4rsnxRwjm4hTqYaWHBFMjXZSAtcQEAQ+eTUuG3QhyeHFzrujQftvWxv6x1eNeDPth7aUUwlIqbDO9d/L2ofCjkoiAwhlKXN9jUGNnpS3QEUNa4WYl1OeEFEDI9eEacreOypDOYV4Ny/oY9qoY6AEI8zOzwIORYbwvlvQ/HQdHIgOmYl9YT1nhKVmRLmMsR5UkjTam5TIel1mMOUGExd5CbDSTcRZ67+rFhgwIn9LsRk4bWNNK1F9nRCGOJXWqiAnRilfl2mAVHTsoWU4vApNEqosFOOBsz9+sTdTt6lRjbmYF/AU3vJ1wz98NtuV1ss5Bc8xY3bnMoJdOqZPm2m653wgTT00+cxhlwl2wpLBzWai+ZKGtZvPfcVmho0CCAM2oXxSolLg+brA5qgE4S7xUbShb1ticnbHa9TiEZdh1Nkil1WvX6sZwVyCjRiK9tOktC+zv1jxr3RrRSqHqD74YMOwk4qnoL7YZdR9qfiVlZyzlML9goAYBzJTtBA3ASvqpTkYFnXPsZoz6y96z83f7jk/sDLpf0hHYdXvXXTiad2e1q7qP9txeI316T4aZVefu9B4LaVfdK5a1BVttbXfU5mC7pjPo8IlLtpjO4DPhHfTZ2z0nx19ME+7uuh17Ex453Xc3+vjUC7ZLZyZYMy132mzohrrrVO+dqGOTApnr7z7kHw3IvrsS6V3fY5G2b6xaTMrdbqg3FJfpAxxKXFJmyU8rfG39hsnv1isdlMFQZ3ioC4xlq4qpp+QXdl/SnW/RK5yMUgnqddd6JWU4wP496D2vOq9FRxd5e72/ohCPAEKocl+TQKz1OUxMkoF0xTZFgVI2mXg1WEtaapSJPOLfwitO+aYRV1xBgyUbvU3ekV2REZ8L7SGiE1pJaNQilbIhalQhbWOerTULv14WN0VJRfLvHvps95YNy25Nu+WNZf+Qf5TvP+afrpge7N/2vff3bf7B0/0LfN+D3DzgO6wa9h2QDQY9llXyq2f9OgiNuVxjKAjlvnq4Fa1R7xGpgMzBrNAKUq5amVMgBIOJIiAAIRqsEUEERA7hJBgiELlskRauDA8YUnYhK4DoZpII7p9r1IgMZNQWDLFasJCbLSCPEzCPBY6ntt3IJ8aCAui+tKQlftx6xOLm3UYj2U9CeVmZHJ7WUtsZwhLkqeW1fm+F7n/AY16g8WoZpMx9j67AigwPadbUh/qZhsmetTqdKqga1/x73VXq+6vXpi8/uNjww5R/n4akT/GcV6Tz8sZuz50601Oa8T2mK2jFd5UUG8FGstI6IHCYFoBTYAwgLQLx6VdJnooVUbrxVVcuK1tb+nye9/VGtZ19yZ+BxyDltEDj6uq6R6/PGhm9ZuCI2+UKHE3/9z27Y/KI3Z68PBDE+KMqoiuZypC71diyfWvWsFTju19kwZ9gE64Jej6JIO0BdjKiih6ESUq/iTW0spnFlJM3+Q7pc4Q64uOcNqrNR7j6gmGwcQJZs4tqq2lH7mHg5BBCbeYXW4brrJsT1TecGRadbwbhKkF08Yvgp4P3P3D1zkfzc5Zdv/7t3ICh6TOGgr/Ly4Nvvz0c/OkLoq4woKfn0SPwYJ+zXKI4lB5vjO5SR8KqKpU4y74+N6v5webqKjYZoh3wSQvo+SGCdAQ4RO1gBuB4vQKN19trchPY8kJ6LAi7WRECd15dUHhrS/T9ApzO+jW5CjC5cjC5CjK5CjO5CtRPLnIQNhY84Mh+wi0vLZW7SdtNjrzjM+xzh7KlgVvBKmmjbCRUjWzCSoeCMRr1StxpjMKhxAtJsgLAm4eV+gajHvRPv9ULgebHfzyuf/ftNc/t0HHbWM9r33533aNKw4LdHnfvStvapNEz4SfVdzwl+9gQs2slZPhfUAiuan97rWTgRyLrECouLX5v27sh0YE+7xU/3umvLdfKcosIXTHsf+nrprCXXy0+Vj5TO/vMZtB54kATsWbc6oOLjz860Lpk51bf4uf/33x1YE7FWOXYnK2503deXWs2xtVf2ST71eof6PP+5PCf6nW+9duyS1IS4uo2H534a3+wuizq96U6cs1F4g5cEREV7Q0fFg/mXnmeNXVDL7xW/Jwgcm9MuVds/2t2eMylrN+rV56fV8IsB8UVwz3HnwqVrdpSEB2WeyOhN/yS+N+qa2/G8PKSbWt1rUllIDtkFpIfkdtKZpU0Fk0un7Xr2mIjM+KAk7Mia73fvMFOiYceOAcFQOEjMC85vtJ76e2psQ2hK6vzLysVv/eZ+z7qjGt8fv1386an13zQ5clxrZVrW71983PekhWVFszxeKuorKzoLY85BaVFsre8tlZLWVbaQ1axpmpJlcRk6q/axALWbnvxwqbYNAOik8YCML9ha2iwxZ+DqiCKexSYUOZ8p9wZv7PvV3x+EYgwRlIMhKI5kdXjFJwceAD1+2MIwV8gDmwtMcdcq12+pQTJ5S82ZVVMPfCf8r//+eA/f/+9/4P9+69fr/cC2b5Iu1Z2Le0Lg7hqStFULQg0QvnpmcEzTwefmRE848yD4QilFHuKm8UcRyjVCpbCYRo5plpiB6qqFYWmgIXNpq640FiMR1s2PmW6+9ZnMESl2MgWah/Oe1CWEGJvDki5womJVbgULRSgWhSjyDVGWiCthIMY81tYPon8/nustCuZOdB6Zb+/nxciHRIbmF1EptQHTakxydJfLace/Dic3Ji4f5lP5ptgQYHyfx9RHt8WztB/EqE14wtXdqQuBKuk809mLvPZv4pYTnxC++9YOLLj5T/vbjGbahK86/veuJHj+aZX/qIcL5dXLgis3k3NNY0jJnDK8uWr/gazqLkluUPEG/XCWjzNQ1ykUqbIVmp/889g83LBGiAKDxWs5GFjsERtIBxExzvGyLnFdhhajG6LEAgTHYVc3ixCFWBAJpaYKECZCIZCRNoJN2EnUXrL9lAEDOJA/lnFSzmH6rFQtlObGZXEvDHBu+KAo2cSI1zUdELR0qf6kIk+dALDatG43ilcPZFToFMEa8sbLgRi8TCGBC3u/YcQAlsDBKFALwiTq2zfMko8ZFAy337xhWVWVrf+n+n9jnDHxImm9bW4PfzseMJBAlLeYxCsdwg1zwACyGapSAfQQKuyVQEVrUorkl+/Ln9EEHODSjxfF/3zZL9mHXmXB7yN2NI+CMtqTAQLiFkQwwcOjyyJhj4BRRSAURrK33xTjqJrOYYltqM1HHRhkFdxTJE48CMAvoAn6QkgsAM1fia7v+U5OTT+Kw4J/rKg0508Y2UghwGGEDAAqoEVQJqHPAj949VEi4XOyJPl09NPq3BHVXcTOah0kDsBGI7L90tDubkvN2pWVXyaX36c/QySkv9QeqV6ZHko65rDawLS1gV47quT589qkt5aEZyjmyHTrp/v7bVLmuYxt6TRHw3PaV6epS+vnrYmIKJTiMhIygpV1m+gmjwy2QDPTI90j7kXPCjQ97m2z8s7ydu7L8czOmDJKqV32OJVERkHd5fVl8UtU0as7TtSOzeGlTD6mE0b7VOFKHbDQASAooCENSuqqrnQEA5HkazOne8zcn/dsuMtGoABvHZ857rakXvcXDm6FnQNyRVsHDl5XpNO5TjoaHA0OA8e9//zSD0AtIKesGAjXeaUSNMPJkQ1dEc3xJ+1SEG5897M8+upO+UtOIiemoCT1iLADEPoAtwN+sbf08lJUdeafnDLCOMzaQG5kQtaAfz1+uAgF7PxCovM2IzMPOLNmw72u1jMngEgipJSQCEFHq3UODopmthhoyuQUrFiDWR/CAsxFceov5CCUWhSMxkYJSE53uOkxgWUikXXA4UQM3NYQqDysQoVjHnTfh6SdkIlMjBSGGUG5EWTA9VgWtpa5kgYCXuPUIqGKjyThGQ/TwE3bx4jrBGLvRkKqyqKqlHyTNY1Cq1ZC7tc0GVRuaFbwCJ+cBvUOEfHgYJAAMDIIb95Fc+z8ezyVIQkc+ob53jMe9ngNSdNI6rcKhUIsruCgCpFPsh1XBBP8CdQj+OD9DVqynuLtGpdA8ybFV1xgeYTrPMggmLA4u+TGJgARqtGqWRpWlrqs/ljKru+pSV7Jchn3zIkw6v3QrMbNtUOPLYJg5c6nL69X8FK+Lm9BidOl8clzK1OmPOZVyRZulSikxRdRYPeO+BtBcV+q1y0LA6KmpkES80lCPst0kYGkR/YxQUGmyKX2w59GzNIX9KNiWa6umosZplQMzt58gyPljnIOeggfMngUgD25nxvSGw0JhrE1XsUYKmjtOQkxh/F8zxML8gfKiycDpxGAQrqveN+sWF2PWLx5IDRvSNsMzJhADkBCSPiQ/hQrRqDY0IgRtiNMx84AQKCM6REUp/+EYexbbKDPMThGDiwBpjy/0yUWVHBKNcJSZMJU7ixUGu4pUZTy+1loQjVcqIIQm3nDQiIAmIYhEYvOu98saDwik5SU9MBc3IrFtLpC9OOKoeqJM5mPHTh6P+V0GTBIegCY2Clqe1XDmUHYadatMrCxFyiAc6rAct8bie0rk7gQQJ7hHSNOm0RrC2kp0wprKit1VWMG6ej65Nki3x1votkJlWNjvZJNTWRPXR9qOwH0WG84t/0UaRVubFbZUQdiAFuF7TyVkBzWkIGeFFY69JUOmnxEc2S+AH1wyVO/OGfZMeArQF/JQ7124ZsPzr6T4PA3cjFA4hcic+GzeaHQNyuO+97SyAKkIFAwkNercYM7n0ZmsaxxvZRq6r4Wu+hvgzXtZddVykhe3b7wfqwEboyOvrolAgozY58zO7QZes02xfP8fQ8vw0x6BObGZmfXiq69JS8iBxJVaG3d5VuUogPbu6OVfmGfVUe7qVnb2T1wtSdGkcE+FDo/N40zvcniVJy4oSF1O9vrpjrWxge7DnJesHDF7T6LAISibVHT/5dV3mR1J+52EpQ4zr9wgnwk27pIJDk7BFLQ2OjIVHck6MAg0vfPFmCcfzHPI8yCgqGdLrpQLyTgbx9obsK+0T7VOHurVvlEP2EmnDJuMzgIIMYAULO5m8rHvIb+pMdKybZ5LAiXDgGNrCc6RO/oOwdZVOBTlr5EAZjC4Fsje3Fc0f8+f7SEhsY1WCIeYzwTSC+W1EQrl08L6gDQhQnLAJd8LmSWmTG7Dkr9JTX1+YBPcekF90Yv3xS7ZF1BolMb7JQ0vpy4AJldfnR+TE04UtuIbAE+9nJWykr+aoYOw2UNJ07Z5PwCdICJ8cghmcgdqIhwNJ2P+Uk5cRb4Py+Mk9cARQrQSMvp5HnOJXiTVRqPpQgUcvvJeC7oM73BUnLrOjJmJiXPEHJATAFnIIAl3OghBGIUSY9bYz3V40SylwSSfqhhGhjl3ri0w5KML/r/qzzzZsfPBj4wQR5IgcgUFfQPCVWLWY6/yIRjYxYX8i/KYTPtz7E1CGC+KZvFityPSimBsHHspyhHY4Ea9JTVlLZD/S3cXFoua08ipA2ZUl/6YTcciN018In//sI6ZPY34t++VZ2EKMXvbh+tWZgtCwUymgLeoEHDiSfcutLTGWGYH177hb9D1eSDoC6g7nt+hB9mal0zcqQ8+dCVq4pZctvNuZQrpd3KjideBrUncm5joMNWWzkTp07HxJu2Lm3p7b+9yXhP6X9FL7k9wW1Vm5nJbNzX0D1xaE/pv0YuviPytqjezuiHvjnJFjioyGWhCnycpOIqFmzPw935F/u7KGiefzHU7PJsJIxm+oLT7vuSxDvhJvm4GU9WsmJXFwT91wVz0WxqN/4InyKPED28Oa45TfEK4vofywig9ELs37TZzIS6AFW0asBfD+Bl0ZluWtLMF5aQJPOiB5dUaw0kSuj06yKkjiPuEpYgkQyAzq9NTpoagqOtUVJmbcmPuwai9Rk+jxaZTzF58ZSHszNJBzv974QWFRdsirDUVzZbJejLnPestqahDO4su66JTY1DQfc0PEtgYeLf+LO0PVAoKypqWLhaVqr/iFb1GUViByfHX3/7fvb2PvoWTo3W/a/V+Xg24gY4h2eoXLtG0v8J6/Q5G7/4/1fXs4MXclf/tr4v9BUxr8SWIOEK6nfoKEGKi/dFKG70Q9dS1sSqyTlHs/eHcr0uDPlhpncVXCXqDLPXarcSnelKRvfvEqTO3gpr8CkJzbupN4H7lDrIzGjmbLA5K7v3SVa/e4uVZ883JUOpKYWq4ymqZdX44QQscublFMr3Kszrq4L/6DVASY3Ry75j1OgGXldVLdzv5FxYtEg/NpzjH3eT3LNvzZbhsMg+TiJxzYWLsbxsyx72g4UrVyfVuOEELHLm2QPS61wf/dx5fvif9DqAFOE7uuw/3EK9OTzuqgSMN8CJ9LlRRt+7TmiSJ/jpSe55l8ogsNlluQjfU0e21i4DOr4WSKrPqlQlE+vsuVRUGm+/hVMTlQgRUyquPCfLBIhKf+ocWTNAUSYUMaFVNpY54MwipM0y4uyqpu264dxmpd124/zup/3+0EIRlDmNyA7zeHy+AKhSCyRyuQKpUr956J3Sac3GE1mi9Vmdzhdbo/Xd4mu7CdgT7jsIBHfNOnxK5LwGpg7Is2O1qchGwKJtOpx7UkHYDNqFLareKlGvW6jB2wxqHTEdjk7Be5A6lUS9ZsmUTRrgTrgs4kUIS66zKjoYP0eJdZv9oBrk6h1Wi+CQ7YPrTeMdFFwNAS8vxHbMDU4oEdA9uGO3CAHE3tOsF34nyjNUQecB6TjXuTg9CRvZ6qinGiE7PdBrJzfbN+OHZRCH9XKaNUE0bvSGKvADWWp1UQW30lsgHXsnAQccMkB0Mm6jIjXmOYSR8tIBa0TtscZhSXwRiR01h0pa+q/xjnzhCOxPb3zvCsK95kGEzJmqYuu75oc34nPZETBkHtIT9WQvc4F5XRKN3pvO5Y/BBGL5ozyoVk98es6kBqNubiJOhLw6hGcIPio7iEyAqVNzXS4aUEBKJlmLQRtCozmvHli7F653tyaWBGHzbaolSJOwZZ4V0tFTKACGXekU6Bqm7QAed+iww8VFkX58zAzHFucbafUNjil+sP34TuWxtYKfmG7SBJFHZlAEMLiog9RNjRveXWXDVCP7ECWFoMjFSqYBqRVLiHLawKexYYOm9Up8DYOiS+8LyU406BGKXjmLXDgnszuGReg5dDtPO8bmeVfeB/4ZIth3LFCerstGoCr/aDNrFJvUtISUq8D4aJz4P79C+bBzKI4cTZp+Ld4QTOPH5WMp3CILztqe8OmOVMfVdw1NR7DqGs8k5RtPlQ2hmWME41Ku0b3VBbyKBqcBcHh7OgJAAAA') format('woff2'), - url('http://github.com/iconfont.woff?t=1605236775724') format('woff'), - url('http://github.com/iconfont.ttf?t=1605236775724') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */ - url('http://github.com/iconfont.svg?t=1605236775724#iconfont') format('svg'); /* iOS 4.1- */ -} - -.iconfont { - font-family: "iconfont" !important; - font-size: 16px; - font-style: normal; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -.luckysheet-iconfont-lianjie:before { - content: "\e7f8"; -} - -.luckysheet-iconfont-dayinquyu:before { - content: "\e7f5"; -} - -.luckysheet-iconfont-dayinyemianpeizhi:before { - content: "\e7f6"; -} - -.luckysheet-iconfont-dayinbiaoti:before { - content: "\e7f7"; -} - -.luckysheet-iconfont-fenyeyulan:before { - content: "\e7f2"; -} - -.luckysheet-iconfont-putong:before { - content: "\e7f3"; -} - -.luckysheet-iconfont-yemianbuju:before { - content: "\e7f4"; -} - -.luckysheet-iconfont-biaogesuoding:before { - content: "\e7ee"; -} - -.luckysheet-iconfont-zhuandao1:before { - content: "\e7f1"; -} - -.luckysheet-iconfont-youjiantou:before { - content: "\e7ed"; -} - -.luckysheet-iconfont-caidan2:before { - content: "\e7ef"; -} - -.luckysheet-iconfont-tihuan:before { - content: "\e7f0"; -} - -.luckysheet-iconfont-dongjie1:before { - content: "\e7e1"; -} - -.luckysheet-iconfont-jian1:before { - content: "\e7e2"; -} - -.luckysheet-iconfont-jia1:before { - content: "\e7e3"; -} - -.luckysheet-iconfont-yichu1:before { - content: "\e7e4"; -} - -.luckysheet-iconfont-shengxu1:before { - content: "\e7e5"; -} - -.luckysheet-iconfont-neikuangxian:before { - content: "\e7e6"; -} - -.luckysheet-iconfont-qingchushaixuan:before { - content: "\e7e7"; -} - -.luckysheet-iconfont-wenbenxiangshang:before { - content: "\e7e8"; -} - -.luckysheet-iconfont-jiangxu1:before { - content: "\e7e9"; -} - -.luckysheet-iconfont-neikuanghengxian:before { - content: "\e7ea"; -} - -.luckysheet-iconfont-neikuangshuxian:before { - content: "\e7eb"; -} - -.luckysheet-iconfont-zidingyipaixu:before { - content: "\e7ec"; -} - -.luckysheet-iconfont-logo2:before { - content: "\e7df"; -} - -.luckysheet-iconfont-logo:before { - content: "\e7e0"; -} - -.luckysheet-iconfont-wenbenqingxie1:before { - content: "\e7de"; -} - -.luckysheet-iconfont-jiacu:before { - content: "\e7d9"; -} - -.luckysheet-iconfont-sousuo:before { - content: "\e78a"; -} - -.luckysheet-iconfont-guanbi:before { - content: "\e78b"; -} - -.luckysheet-iconfont-xiayige:before { - content: "\e78c"; -} - -.luckysheet-iconfont-xiala:before { - content: "\e78d"; -} - -.luckysheet-iconfont-wenbenyanse:before { - content: "\e78e"; -} - -.luckysheet-iconfont-shangyige:before { - content: "\e78f"; -} - -.luckysheet-iconfont-shujutoushi:before { - content: "\e790"; -} - -.luckysheet-iconfont-tianchong:before { - content: "\e791"; -} - -.luckysheet-iconfont-zengjiaxiaoshuwei:before { - content: "\e792"; -} - -.luckysheet-iconfont-bianji2:before { - content: "\e793"; -} - -.luckysheet-iconfont-jieping:before { - content: "\e794"; -} - -.luckysheet-iconfont-jianxiaoxiaoshuwei:before { - content: "\e796"; -} - -.luckysheet-iconfont-caidan:before { - content: "\e797"; -} - -.luckysheet-iconfont-shujuku:before { - content: "\e798"; -} - -.luckysheet-iconfont-wubiankuang:before { - content: "\e799"; -} - -.luckysheet-iconfont-bianji:before { - content: "\e79a"; -} - -.luckysheet-iconfont-qingchuyangshi:before { - content: "\e79b"; -} - -.luckysheet-iconfont-shanchu:before { - content: "\e79c"; -} - -.luckysheet-iconfont-wenbenjuzhongduiqi:before { - content: "\e79d"; -} - -.luckysheet-iconfont-dayin:before { - content: "\e79e"; -} - -.luckysheet-iconfont-wenbenfenge:before { - content: "\e79f"; -} - -.luckysheet-iconfont-hanshu:before { - content: "\e7a0"; -} - -.luckysheet-iconfont-jiangxu:before { - content: "\e7a1"; -} - -.luckysheet-iconfont-dingbuduiqi:before { - content: "\e7a2"; -} - -.luckysheet-iconfont-tupian:before { - content: "\e7a3"; -} - -.luckysheet-iconfont-xiangxia90:before { - content: "\e7a4"; -} - -.luckysheet-iconfont-shupaiwenzi:before { - content: "\e7a5"; -} - -.luckysheet-iconfont-quanjiabiankuang:before { - content: "\e7a6"; -} - -.luckysheet-iconfont-shengxu:before { - content: "\e7a7"; -} - -.luckysheet-iconfont-caijian:before { - content: "\e7a8"; -} - -.luckysheet-iconfont-jine:before { - content: "\e7a9"; -} - -.luckysheet-iconfont-caidan1:before { - content: "\e7aa"; -} - -.luckysheet-iconfont-quxiaohebing:before { - content: "\e7ab"; -} - -.luckysheet-iconfont-wenbenxiahuaxian:before { - content: "\e7ac"; -} - -.luckysheet-iconfont-shangbiankuang:before { - content: "\e7ad"; -} - -.luckysheet-iconfont-dingwei:before { - content: "\e7ae"; -} - -.luckysheet-iconfont-sizhoujiabiankuang:before { - content: "\e7af"; -} - -.luckysheet-iconfont-cebianlanshouqi:before { - content: "\e7b0"; -} - -.luckysheet-iconfont-hebing:before { - content: "\e7b1"; -} - -.luckysheet-iconfont-xiangshangqingxie:before { - content: "\e7b2"; -} - -.luckysheet-iconfont-shuipingduiqi:before { - content: "\e7b3"; -} - -.luckysheet-iconfont-wenbenshanchuxian:before { - content: "\e7b4"; -} - -.luckysheet-iconfont-wenbenyouduiqi:before { - content: "\e7b5"; -} - -.luckysheet-iconfont-qianjin:before { - content: "\e7b6"; -} - -.luckysheet-iconfont-tubiao:before { - content: "\e7b7"; -} - -.luckysheet-iconfont-youbiankuang:before { - content: "\e7b8"; -} - -.luckysheet-iconfont-baifenhao:before { - content: "\e7b9"; -} - -.luckysheet-iconfont-geshishua:before { - content: "\e7ba"; -} - -.luckysheet-iconfont-baocun:before { - content: "\e7bb"; -} - -.luckysheet-iconfont-shujuyanzheng:before { - content: "\e7bc"; -} - -.luckysheet-iconfont-jieduan:before { - content: "\e7bd"; -} - -.luckysheet-iconfont-geshitiaojian:before { - content: "\e7be"; -} - -.luckysheet-iconfont-zidonghuanhang:before { - content: "\e7bf"; -} - -.luckysheet-iconfont-cebianlanzhankai:before { - content: "\e7c0"; -} - -.luckysheet-iconfont-shaixuan2:before { - content: "\e7c1"; -} - -.luckysheet-iconfont-xiangxiaqingxie:before { - content: "\e7c2"; -} - -.luckysheet-iconfont-yichu:before { - content: "\e7c3"; -} - -.luckysheet-iconfont-chuizhihebing:before { - content: "\e7c4"; -} - -.luckysheet-iconfont-wenbenfensanduiqi:before { - content: "\e7c5"; -} - -.luckysheet-iconfont-zuobiankuang:before { - content: "\e7c6"; -} - -.luckysheet-iconfont-fenyechakan:before { - content: "\e7c7"; -} - -.luckysheet-iconfont-yunhang:before { - content: "\e7c8"; -} - -.luckysheet-iconfont-lie:before { - content: "\e7c9"; -} - -.luckysheet-iconfont-quanping:before { - content: "\e7ca"; -} - -.luckysheet-iconfont-shaixuan:before { - content: "\e7cb"; -} - -.luckysheet-iconfont-gengxin:before { - content: "\e7cc"; -} - -.luckysheet-iconfont-qingchu:before { - content: "\e7cd"; -} - -.luckysheet-iconfont-hang:before { - content: "\e7ce"; -} - -.luckysheet-iconfont-zhushi:before { - content: "\e7cf"; -} - -.luckysheet-iconfont-jian:before { - content: "\e7d0"; -} - -.luckysheet-iconfont-jisuan:before { - content: "\e7d1"; -} - -.luckysheet-iconfont-jia:before { - content: "\e7d2"; -} - -.luckysheet-iconfont-dibuduiqi:before { - content: "\e7d3"; -} - -.luckysheet-iconfont-xiangshang90:before { - content: "\e7d4"; -} - -.luckysheet-iconfont-wuxuanzhuang:before { - content: "\e7d5"; -} - -.luckysheet-iconfont-xianshiyincangwangge:before { - content: "\e7d6"; -} - -.luckysheet-iconfont-dongjie:before { - content: "\e7d7"; -} - -.luckysheet-iconfont-wenbenzuoduiqi:before { - content: "\e7d8"; -} - -.luckysheet-iconfont-houtui:before { - content: "\e7da"; -} - -.luckysheet-iconfont-shuipinghebing:before { - content: "\e7db"; -} - -.luckysheet-iconfont-xiabiankuang:before { - content: "\e7dc"; -} - -.luckysheet-iconfont-shezhi:before { - content: "\e7dd"; -} - +@font-face {font-family: "iconfont-luckysheet"; + src: url('http://github.com/iconfont.eot?t=1605236775724'); /* IE9 */ + src: url('http://github.com/iconfont.eot?t=1605236775724#iefix') format('embedded-opentype'), /* IE6-IE8 */ + url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAACJQAAsAAAAAVKgAACH9AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCObgqBghDoEwE2AiQDgygLgVYABCAFhG0HimMbCkZ1hhxsHACQvM8iooIUIPv/vyU3hoisQDP7oxQspFSOEhyEI964SGdpHgbZQdChvkX9Xd97nQ+VaIq7d5noG8yfVj6tSWbtWNLPqLzFBpnESCbt5xn252+nSxLNW5sNpeTh+f39/481976wz7uPRtUHGDrbrw4ZrEQ+o9sQS7AOLVwR9wAYHufsX4sltIw2UGCOWN/DZAYtWnRGXhjMYFsLlBOm6ZgkU7ixOUVm3hSYSZmdcy3Ttndf4ESBU8/fv9PPcyR7254j2T+y/RCTRQgUIXDBiWYbMHXqvsls3dZt8yP9Sr8UeI/jYBECy2DQpVnHImNkw4UQi/rrnSeKbo3ABwpVbnt7MIAxZW53t9DyQ2dMry7DVAd+ALjBeSGPOIh9Xfq3yXEPE8N0ZWvf3u79xy5A2HKIRLDVxEQAD/zfm+lMLBjA+E0Di+KU9uanlEK1W7V0DFgDrXU7yJ4lXCBcov15demKDpPSOimby7C0sjnTlu3++0jcl/hgIbgcAnwn3BBuFBeEGwh8Vjk7ve+1wbkBaZxrn1Lq5im1jRnWZJnalH2IbiaZdvxjNFLYNjjuGFPLYXaXebSkr0ZxoxJ0Q5TYn78moVKvgrRuw7Z9FDmzmGDZtcsXT1M8rfKIsqS8oZTyYT6c9itRHs+EAy+Rv59+NScRhJKM+eKuC+vPAT8+K8geLvKTY47JsOvG/iMyFJATC6ijaZbsa6IgU/laM085SuVr48fXBUURyyJFWuHz/9qJHr369BswaMiwEaPGjJswaUpBkxmmzTTLbHPMNc98Cyy0yGJLLLXMciustAqEYARlstgcLo8vEIrEEqlMrlCqyA5ptDq9wWiiOkVz2mojOedguOBye+g6Dn+yRq069Ro0atKsRas27SqVq1KtQolSZUIm8j+eVMpcWg0li2DyBubHB6OHH1/08uOHPn780a+QhKGVCLQRhXZi0EEcOklAF0noJgU9pKGXDPSRhX5yMEAeShRgkCIMUYJhyjBCBYxSCWNUwTjVMEENTFILU9TBNPUwQwPM0ghzNME8zbBACyzSCku0wTLtsKIDVnXCmi5Y1w0bemBTL2zpg239sGMAdg3CniHYNwwHRuDQKBwZg2PjcGICTk3CmSk4Nw0XZuDSLFyZg2vzEGMBbizCrSW4swz3VuDBKjxagyfr8GwDsmzCiy3IsQ2vduDNLrzbgyj78OEAPh1CA0fw5Ri+ncCPU/h1BvWcQy0XUMclZLhKi1S3hrQYdRuAPLdQ4A6K3EOJByjzCBWeoIpnqOYFaniFJG8Q5x1SfECaT0jwBRG+IcoPxPiFIH8Q4h/CBNnZNvqzb/2Hgm+XX6shAPDIDn2nEKAqnKGBUOivZA4KW0gZvafr3BQtvdGQKGOXK+jxMuHo+RqAUxEBRoTkYwZwmLuk6nyIpr4UPapkojiXpKlDRMhw0F0ARQPDTMn9UPjbkHEt+m4NOCLsVWbo7ZitUp6Nl3YnrJ8iAvij7nsIRSkYT2AfwVuji87qVBm1Q5gVmYuFsYgqpu1Vy0P4b7e3HTaoWtKXAeiIq9rtbDfJnFEJ3yZ5C9vMFqQ4rUyz9jyEsVO+bind+meT82iX3uh7WLtf/mNHA48h7jF5ypzTlCQcv5ubeehZSly2XeCJ32vWw0QsABZSz1MRvFzCulXrUUotFpgPLHGctww3N2IaitXjWLBtPW/2mW0J9wozblPnTXu/syRwarVqYG2kKhiLdIG7JvyWsZA0S5cPgxEReXFY0nvhZ941sR0MJUHkFQ7CcX3kV73dn/vD9HnX4zD1iwl79nujL6+lfhIthTEg9FMWn8HG31mJYxBFRLi2SxRsAwoSjCwtLT6/QJHjxcxpyU90trhORYQlNEVoAbGpu2GbosgBG5OkOGMFEfxEaXYgF207EO8w4/rRVbtzcBw43CthsjtfCmL0OBzGXkRcHeMaT59lMFjZVw728rXpog0WMNByJpe9kcvkvWrDIJPwkHN5yI1nKJtnLIbJvJ8CpC0DZRiQThkg5CyOqcHwGnJsLMnghmXYs53/HpcMFoqT/eerkoBVBRRvYxNPHyNNQeQAMCbForbAXiTgZZUEjueAtXnoH7H9zuDi/f636fbH3VdPrdw7eOuDvyN3Drx9st7snrvX+5YNXiGOS91Vux7s+nvhzs3tVjXr8khMzBjJllUMimyapCU9KmwhxrSFdmeVw/5mgCsEvEiy8ZkC1iTTAU42MpStqBEbthqWYkhbLgMBaFuGFwUJmsImfqFKWJCxL1r8hd02vNVOgzRus/VWrCjy4oKdpn6SKxVsiIkZw6rhBYfJ0ioZ2Yyr7KrxWsTdUMmVwKlGtwrS1ultYU0lJS1djQX9BLXJhOoliVrLa2MGmSNLpp8EEYQaEbKMOzWImr1XRLBD/hlFJXG5xhnaCoujC6vDbSYgxnlndOSqiujC2Qxl22EM0UsdJhFI0OZT0U9VILjQS2YtDWPPEV0vq8QfBoKrSKAHyyJalTzpy92Iwf5WDXQ3S/2q3vzeMmwXM+YKRAR/h9PxHVkIvwFsEtzcp+DwLBJ4+XCgqUvB6/4bz4T/Pc73+xR8db87+loFX5KsNIk0O+CSUDQjKiH6L+5+++17E/2rKYc7xznuge8C/0LnW2+dDjxMwe4J6lXQf4PD6zuA0X/0TxRc2riGZNwIx/9/llacjXLVM+x//fV0X5b0Rg803Tl6ZlCLGA4ElEGzGAlFrfbrXd/hJgPp8rNuV+c1+a1er/vwe7Xu7jetCgFvHT04vKLIQFoyXtkoqm5Vf/VgZW/mmwgdUXO134d5bvrXE1+a/NVUpZ53p2sTjcnqVPtlUiRo7hHBzVpuzpDaVDNCmVqWW25HVLJeSgtSp3EcOaIllJZKSBcICf+RFv75kffh00vkrXbCrXV/bTPYWNHBp6fg1kF4dBb9z0c6O8Bb2Qg21xD9vXmtro0S8MjcP2KMGNpoenQ72E1bWkjTZVjZvmRt7mLW37vKQOMyw4vZDtO3GVuded3LdjpJXAzjlahVT9a3OoXav3vXV2/d/cOl/f7YnwY6uvl2oD7xP35241LkqBHnj92H97tjh/3xPw9eGF/Va1d0utVZdao7gzf6EvWmvRYH5rLnK+YqfX2EgUYrd2AoN80Jtw9ZarlGYyE1x52d4/fqIPUEru+NHhlOvi8J6agxKY/J4glz+UkpF7jsMZnv/i7HCrHXkhldR60gA2NqEQBm0U7RAJic1QK4pFWF9GUBqGRNBQJ8CNrihUe0miylfnEoCRxHOMClR93J2HOqhI00VPNASU9MpGFcaFgm58huxFU7jJuGt3PZ3tpDk8P1taRoP1P7aUlYIlwOG6QmCpuboJumMlQsukPbI2cFN+egEZ0/61w+XF2hXLC2Lmej40W+LYdoKBKfSVtT0swQMvpJseQMBxjI1KBqVyywFVhYMyxzwcmtM1CLYbGwWFElDpCgiiqMKEXPBlIPSwaVjUKzllM/IVLiJIlZj+jsgDuXL25S0BWnKLJORTFz2coISy7LOIkSFzhN1z68pJA0g1KqkGlkBBAUREHAtGEin+IneJbKmjRrpB/LAgto2GDJRzPoJg1fEUpAPpsztNSLYWdVoew0be76e8sCijlqVCgZ5PMKhFDDoyYb4+0bLAEVjahP/nmqqrOcsTFjGX++lJObZLTOHDQpSTQZU1S1o1/eiiYbVAELF8jkebSh/cISZioQkoInrF2ENKuGiibeiQ32kSLQjTJWs5YFMgsAFQEzw038skAXWVcEJVHAO7VZVZTUykJGxVtZ0Tl9W/opzIh4uUzZqVExcuaNHOSbxrI2Eg4uthqa52oFfWWW2Q4heSUpiH52C642GsGGhbsRFkecw7h2mgbYSvmpSEY1nXPsZg1+aV7KBf/+4iwlzyex258/q9mj2QIvHBd26NZn7uaVRmqL4OrxYcGbauMtOztwKOj3/cGAez3ZTR+lv9Hc7bQqtBMqbMacn7IsEMBh5YURAn2N5Rk7h07xS7obDn5diqFxQh6rCDk8xkjjTYkF+bAS8poqltS3pJYMhNWhBrUstOcnaBMgHJmVemgECca+aasAoYupWuHBignS9J4SwxIAP0341LMF4jSz5vc/7xPUziYygdfZwjnK5DHnAt/tfrNfpTkSEYau5xDqt9ZFyuB+v52hLC1sqE0AMwt2kkapL5b4qUpGJZ1z7CqGpv3Cz15svDXnOfox3+6FB4Mf/eNT77PwC//z+kusDbwCLURGGwlyqJxNTa0nZfoJ0bRzWMET6jFryDx0AnJCmX64NG/Quj4xeW1qYmh6anhSA7PHAwuXrgvl0bY5Q7MW2r8kWMbi9V8hsBZsCtA4rsnxRwjm4hTqYaWHBFMjXZSAtcQEAQ+eTUuG3QhyeHFzrujQftvWxv6x1eNeDPth7aUUwlIqbDO9d/L2ofCjkoiAwhlKXN9jUGNnpS3QEUNa4WYl1OeEFEDI9eEacreOypDOYV4Ny/oY9qoY6AEI8zOzwIORYbwvlvQ/HQdHIgOmYl9YT1nhKVmRLmMsR5UkjTam5TIel1mMOUGExd5CbDSTcRZ67+rFhgwIn9LsRk4bWNNK1F9nRCGOJXWqiAnRilfl2mAVHTsoWU4vApNEqosFOOBsz9+sTdTt6lRjbmYF/AU3vJ1wz98NtuV1ss5Bc8xY3bnMoJdOqZPm2m653wgTT00+cxhlwl2wpLBzWai+ZKGtZvPfcVmho0CCAM2oXxSolLg+brA5qgE4S7xUbShb1ticnbHa9TiEZdh1Nkil1WvX6sZwVyCjRiK9tOktC+zv1jxr3RrRSqHqD74YMOwk4qnoL7YZdR9qfiVlZyzlML9goAYBzJTtBA3ASvqpTkYFnXPsZoz6y96z83f7jk/sDLpf0hHYdXvXXTiad2e1q7qP9txeI316T4aZVefu9B4LaVfdK5a1BVttbXfU5mC7pjPo8IlLtpjO4DPhHfTZ2z0nx19ME+7uuh17Ex453Xc3+vjUC7ZLZyZYMy132mzohrrrVO+dqGOTApnr7z7kHw3IvrsS6V3fY5G2b6xaTMrdbqg3FJfpAxxKXFJmyU8rfG39hsnv1isdlMFQZ3ioC4xlq4qpp+QXdl/SnW/RK5yMUgnqddd6JWU4wP496D2vOq9FRxd5e72/ohCPAEKocl+TQKz1OUxMkoF0xTZFgVI2mXg1WEtaapSJPOLfwitO+aYRV1xBgyUbvU3ekV2REZ8L7SGiE1pJaNQilbIhalQhbWOerTULv14WN0VJRfLvHvps95YNy25Nu+WNZf+Qf5TvP+afrpge7N/2vff3bf7B0/0LfN+D3DzgO6wa9h2QDQY9llXyq2f9OgiNuVxjKAjlvnq4Fa1R7xGpgMzBrNAKUq5amVMgBIOJIiAAIRqsEUEERA7hJBgiELlskRauDA8YUnYhK4DoZpII7p9r1IgMZNQWDLFasJCbLSCPEzCPBY6ntt3IJ8aCAui+tKQlftx6xOLm3UYj2U9CeVmZHJ7WUtsZwhLkqeW1fm+F7n/AY16g8WoZpMx9j67AigwPadbUh/qZhsmetTqdKqga1/x73VXq+6vXpi8/uNjww5R/n4akT/GcV6Tz8sZuz50601Oa8T2mK2jFd5UUG8FGstI6IHCYFoBTYAwgLQLx6VdJnooVUbrxVVcuK1tb+nye9/VGtZ19yZ+BxyDltEDj6uq6R6/PGhm9ZuCI2+UKHE3/9z27Y/KI3Z68PBDE+KMqoiuZypC71diyfWvWsFTju19kwZ9gE64Jej6JIO0BdjKiih6ESUq/iTW0spnFlJM3+Q7pc4Q64uOcNqrNR7j6gmGwcQJZs4tqq2lH7mHg5BBCbeYXW4brrJsT1TecGRadbwbhKkF08Yvgp4P3P3D1zkfzc5Zdv/7t3ICh6TOGgr/Ly4Nvvz0c/OkLoq4woKfn0SPwYJ+zXKI4lB5vjO5SR8KqKpU4y74+N6v5webqKjYZoh3wSQvo+SGCdAQ4RO1gBuB4vQKN19trchPY8kJ6LAi7WRECd15dUHhrS/T9ApzO+jW5CjC5cjC5CjK5CjO5CtRPLnIQNhY84Mh+wi0vLZW7SdtNjrzjM+xzh7KlgVvBKmmjbCRUjWzCSoeCMRr1StxpjMKhxAtJsgLAm4eV+gajHvRPv9ULgebHfzyuf/ftNc/t0HHbWM9r33533aNKw4LdHnfvStvapNEz4SfVdzwl+9gQs2slZPhfUAiuan97rWTgRyLrECouLX5v27sh0YE+7xU/3umvLdfKcosIXTHsf+nrprCXXy0+Vj5TO/vMZtB54kATsWbc6oOLjz860Lpk51bf4uf/33x1YE7FWOXYnK2503deXWs2xtVf2ST71eof6PP+5PCf6nW+9duyS1IS4uo2H534a3+wuizq96U6cs1F4g5cEREV7Q0fFg/mXnmeNXVDL7xW/Jwgcm9MuVds/2t2eMylrN+rV56fV8IsB8UVwz3HnwqVrdpSEB2WeyOhN/yS+N+qa2/G8PKSbWt1rUllIDtkFpIfkdtKZpU0Fk0un7Xr2mIjM+KAk7Mia73fvMFOiYceOAcFQOEjMC85vtJ76e2psQ2hK6vzLysVv/eZ+z7qjGt8fv1386an13zQ5clxrZVrW71983PekhWVFszxeKuorKzoLY85BaVFsre8tlZLWVbaQ1axpmpJlcRk6q/axALWbnvxwqbYNAOik8YCML9ha2iwxZ+DqiCKexSYUOZ8p9wZv7PvV3x+EYgwRlIMhKI5kdXjFJwceAD1+2MIwV8gDmwtMcdcq12+pQTJ5S82ZVVMPfCf8r//+eA/f/+9/4P9+69fr/cC2b5Iu1Z2Le0Lg7hqStFULQg0QvnpmcEzTwefmRE848yD4QilFHuKm8UcRyjVCpbCYRo5plpiB6qqFYWmgIXNpq640FiMR1s2PmW6+9ZnMESl2MgWah/Oe1CWEGJvDki5womJVbgULRSgWhSjyDVGWiCthIMY81tYPon8/nustCuZOdB6Zb+/nxciHRIbmF1EptQHTakxydJfLace/Dic3Ji4f5lP5ptgQYHyfx9RHt8WztB/EqE14wtXdqQuBKuk809mLvPZv4pYTnxC++9YOLLj5T/vbjGbahK86/veuJHj+aZX/qIcL5dXLgis3k3NNY0jJnDK8uWr/gazqLkluUPEG/XCWjzNQ1ykUqbIVmp/889g83LBGiAKDxWs5GFjsERtIBxExzvGyLnFdhhajG6LEAgTHYVc3ixCFWBAJpaYKECZCIZCRNoJN2EnUXrL9lAEDOJA/lnFSzmH6rFQtlObGZXEvDHBu+KAo2cSI1zUdELR0qf6kIk+dALDatG43ilcPZFToFMEa8sbLgRi8TCGBC3u/YcQAlsDBKFALwiTq2zfMko8ZFAy337xhWVWVrf+n+n9jnDHxImm9bW4PfzseMJBAlLeYxCsdwg1zwACyGapSAfQQKuyVQEVrUorkl+/Ln9EEHODSjxfF/3zZL9mHXmXB7yN2NI+CMtqTAQLiFkQwwcOjyyJhj4BRRSAURrK33xTjqJrOYYltqM1HHRhkFdxTJE48CMAvoAn6QkgsAM1fia7v+U5OTT+Kw4J/rKg0508Y2UghwGGEDAAqoEVQJqHPAj949VEi4XOyJPl09NPq3BHVXcTOah0kDsBGI7L90tDubkvN2pWVXyaX36c/QySkv9QeqV6ZHko65rDawLS1gV47quT589qkt5aEZyjmyHTrp/v7bVLmuYxt6TRHw3PaV6epS+vnrYmIKJTiMhIygpV1m+gmjwy2QDPTI90j7kXPCjQ97m2z8s7ydu7L8czOmDJKqV32OJVERkHd5fVl8UtU0as7TtSOzeGlTD6mE0b7VOFKHbDQASAooCENSuqqrnQEA5HkazOne8zcn/dsuMtGoABvHZ857rakXvcXDm6FnQNyRVsHDl5XpNO5TjoaHA0OA8e9//zSD0AtIKesGAjXeaUSNMPJkQ1dEc3xJ+1SEG5897M8+upO+UtOIiemoCT1iLADEPoAtwN+sbf08lJUdeafnDLCOMzaQG5kQtaAfz1+uAgF7PxCovM2IzMPOLNmw72u1jMngEgipJSQCEFHq3UODopmthhoyuQUrFiDWR/CAsxFceov5CCUWhSMxkYJSE53uOkxgWUikXXA4UQM3NYQqDysQoVjHnTfh6SdkIlMjBSGGUG5EWTA9VgWtpa5kgYCXuPUIqGKjyThGQ/TwE3bx4jrBGLvRkKqyqKqlHyTNY1Cq1ZC7tc0GVRuaFbwCJ+cBvUOEfHgYJAAMDIIb95Fc+z8ezyVIQkc+ob53jMe9ngNSdNI6rcKhUIsruCgCpFPsh1XBBP8CdQj+OD9DVqynuLtGpdA8ybFV1xgeYTrPMggmLA4u+TGJgARqtGqWRpWlrqs/ljKru+pSV7Jchn3zIkw6v3QrMbNtUOPLYJg5c6nL69X8FK+Lm9BidOl8clzK1OmPOZVyRZulSikxRdRYPeO+BtBcV+q1y0LA6KmpkES80lCPst0kYGkR/YxQUGmyKX2w59GzNIX9KNiWa6umosZplQMzt58gyPljnIOeggfMngUgD25nxvSGw0JhrE1XsUYKmjtOQkxh/F8zxML8gfKiycDpxGAQrqveN+sWF2PWLx5IDRvSNsMzJhADkBCSPiQ/hQrRqDY0IgRtiNMx84AQKCM6REUp/+EYexbbKDPMThGDiwBpjy/0yUWVHBKNcJSZMJU7ixUGu4pUZTy+1loQjVcqIIQm3nDQiIAmIYhEYvOu98saDwik5SU9MBc3IrFtLpC9OOKoeqJM5mPHTh6P+V0GTBIegCY2Clqe1XDmUHYadatMrCxFyiAc6rAct8bie0rk7gQQJ7hHSNOm0RrC2kp0wprKit1VWMG6ej65Nki3x1votkJlWNjvZJNTWRPXR9qOwH0WG84t/0UaRVubFbZUQdiAFuF7TyVkBzWkIGeFFY69JUOmnxEc2S+AH1wyVO/OGfZMeArQF/JQ7124ZsPzr6T4PA3cjFA4hcic+GzeaHQNyuO+97SyAKkIFAwkNercYM7n0ZmsaxxvZRq6r4Wu+hvgzXtZddVykhe3b7wfqwEboyOvrolAgozY58zO7QZes02xfP8fQ8vw0x6BObGZmfXiq69JS8iBxJVaG3d5VuUogPbu6OVfmGfVUe7qVnb2T1wtSdGkcE+FDo/N40zvcniVJy4oSF1O9vrpjrWxge7DnJesHDF7T6LAISibVHT/5dV3mR1J+52EpQ4zr9wgnwk27pIJDk7BFLQ2OjIVHck6MAg0vfPFmCcfzHPI8yCgqGdLrpQLyTgbx9obsK+0T7VOHurVvlEP2EmnDJuMzgIIMYAULO5m8rHvIb+pMdKybZ5LAiXDgGNrCc6RO/oOwdZVOBTlr5EAZjC4Fsje3Fc0f8+f7SEhsY1WCIeYzwTSC+W1EQrl08L6gDQhQnLAJd8LmSWmTG7Dkr9JTX1+YBPcekF90Yv3xS7ZF1BolMb7JQ0vpy4AJldfnR+TE04UtuIbAE+9nJWykr+aoYOw2UNJ07Z5PwCdICJ8cghmcgdqIhwNJ2P+Uk5cRb4Py+Mk9cARQrQSMvp5HnOJXiTVRqPpQgUcvvJeC7oM73BUnLrOjJmJiXPEHJATAFnIIAl3OghBGIUSY9bYz3V40SylwSSfqhhGhjl3ri0w5KML/r/qzzzZsfPBj4wQR5IgcgUFfQPCVWLWY6/yIRjYxYX8i/KYTPtz7E1CGC+KZvFityPSimBsHHspyhHY4Ea9JTVlLZD/S3cXFoua08ipA2ZUl/6YTcciN018In//sI6ZPY34t++VZ2EKMXvbh+tWZgtCwUymgLeoEHDiSfcutLTGWGYH177hb9D1eSDoC6g7nt+hB9mal0zcqQ8+dCVq4pZctvNuZQrpd3KjideBrUncm5joMNWWzkTp07HxJu2Lm3p7b+9yXhP6X9FL7k9wW1Vm5nJbNzX0D1xaE/pv0YuviPytqjezuiHvjnJFjioyGWhCnycpOIqFmzPw935F/u7KGiefzHU7PJsJIxm+oLT7vuSxDvhJvm4GU9WsmJXFwT91wVz0WxqN/4InyKPED28Oa45TfEK4vofywig9ELs37TZzIS6AFW0asBfD+Bl0ZluWtLMF5aQJPOiB5dUaw0kSuj06yKkjiPuEpYgkQyAzq9NTpoagqOtUVJmbcmPuwai9Rk+jxaZTzF58ZSHszNJBzv974QWFRdsirDUVzZbJejLnPestqahDO4su66JTY1DQfc0PEtgYeLf+LO0PVAoKypqWLhaVqr/iFb1GUViByfHX3/7fvb2PvoWTo3W/a/V+Xg24gY4h2eoXLtG0v8J6/Q5G7/4/1fXs4MXclf/tr4v9BUxr8SWIOEK6nfoKEGKi/dFKG70Q9dS1sSqyTlHs/eHcr0uDPlhpncVXCXqDLPXarcSnelKRvfvEqTO3gpr8CkJzbupN4H7lDrIzGjmbLA5K7v3SVa/e4uVZ883JUOpKYWq4ymqZdX44QQscublFMr3Kszrq4L/6DVASY3Ry75j1OgGXldVLdzv5FxYtEg/NpzjH3eT3LNvzZbhsMg+TiJxzYWLsbxsyx72g4UrVyfVuOEELHLm2QPS61wf/dx5fvif9DqAFOE7uuw/3EK9OTzuqgSMN8CJ9LlRRt+7TmiSJ/jpSe55l8ogsNlluQjfU0e21i4DOr4WSKrPqlQlE+vsuVRUGm+/hVMTlQgRUyquPCfLBIhKf+ocWTNAUSYUMaFVNpY54MwipM0y4uyqpu264dxmpd124/zup/3+0EIRlDmNyA7zeHy+AKhSCyRyuQKpUr956J3Sac3GE1mi9Vmdzhdbo/Xd4mu7CdgT7jsIBHfNOnxK5LwGpg7Is2O1qchGwKJtOpx7UkHYDNqFLareKlGvW6jB2wxqHTEdjk7Be5A6lUS9ZsmUTRrgTrgs4kUIS66zKjoYP0eJdZv9oBrk6h1Wi+CQ7YPrTeMdFFwNAS8vxHbMDU4oEdA9uGO3CAHE3tOsF34nyjNUQecB6TjXuTg9CRvZ6qinGiE7PdBrJzfbN+OHZRCH9XKaNUE0bvSGKvADWWp1UQW30lsgHXsnAQccMkB0Mm6jIjXmOYSR8tIBa0TtscZhSXwRiR01h0pa+q/xjnzhCOxPb3zvCsK95kGEzJmqYuu75oc34nPZETBkHtIT9WQvc4F5XRKN3pvO5Y/BBGL5ozyoVk98es6kBqNubiJOhLw6hGcIPio7iEyAqVNzXS4aUEBKJlmLQRtCozmvHli7F653tyaWBGHzbaolSJOwZZ4V0tFTKACGXekU6Bqm7QAed+iww8VFkX58zAzHFucbafUNjil+sP34TuWxtYKfmG7SBJFHZlAEMLiog9RNjRveXWXDVCP7ECWFoMjFSqYBqRVLiHLawKexYYOm9Up8DYOiS+8LyU406BGKXjmLXDgnszuGReg5dDtPO8bmeVfeB/4ZIth3LFCerstGoCr/aDNrFJvUtISUq8D4aJz4P79C+bBzKI4cTZp+Ld4QTOPH5WMp3CILztqe8OmOVMfVdw1NR7DqGs8k5RtPlQ2hmWME41Ku0b3VBbyKBqcBcHh7OgJAAAA') format('woff2'), + url('http://github.com/iconfont.woff?t=1605236775724') format('woff'), + url('http://github.com/iconfont.ttf?t=1605236775724') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */ + url('http://github.com/iconfont.svg?t=1605236775724#iconfont') format('svg'); /* iOS 4.1- */ +} + +.iconfont-luckysheet { + font-family: "iconfont-luckysheet" !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.luckysheet-iconfont-lianjie:before { + content: "\e7f8"; +} + +.luckysheet-iconfont-dayinquyu:before { + content: "\e7f5"; +} + +.luckysheet-iconfont-dayinyemianpeizhi:before { + content: "\e7f6"; +} + +.luckysheet-iconfont-dayinbiaoti:before { + content: "\e7f7"; +} + +.luckysheet-iconfont-fenyeyulan:before { + content: "\e7f2"; +} + +.luckysheet-iconfont-putong:before { + content: "\e7f3"; +} + +.luckysheet-iconfont-yemianbuju:before { + content: "\e7f4"; +} + +.luckysheet-iconfont-biaogesuoding:before { + content: "\e7ee"; +} + +.luckysheet-iconfont-zhuandao1:before { + content: "\e7f1"; +} + +.luckysheet-iconfont-youjiantou:before { + content: "\e7ed"; +} + +.luckysheet-iconfont-caidan2:before { + content: "\e7ef"; +} + +.luckysheet-iconfont-tihuan:before { + content: "\e7f0"; +} + +.luckysheet-iconfont-dongjie1:before { + content: "\e7e1"; +} + +.luckysheet-iconfont-jian1:before { + content: "\e7e2"; +} + +.luckysheet-iconfont-jia1:before { + content: "\e7e3"; +} + +.luckysheet-iconfont-yichu1:before { + content: "\e7e4"; +} + +.luckysheet-iconfont-shengxu1:before { + content: "\e7e5"; +} + +.luckysheet-iconfont-neikuangxian:before { + content: "\e7e6"; +} + +.luckysheet-iconfont-qingchushaixuan:before { + content: "\e7e7"; +} + +.luckysheet-iconfont-wenbenxiangshang:before { + content: "\e7e8"; +} + +.luckysheet-iconfont-jiangxu1:before { + content: "\e7e9"; +} + +.luckysheet-iconfont-neikuanghengxian:before { + content: "\e7ea"; +} + +.luckysheet-iconfont-neikuangshuxian:before { + content: "\e7eb"; +} + +.luckysheet-iconfont-zidingyipaixu:before { + content: "\e7ec"; +} + +.luckysheet-iconfont-logo2:before { + content: "\e7df"; +} + +.luckysheet-iconfont-logo:before { + content: "\e7e0"; +} + +.luckysheet-iconfont-wenbenqingxie1:before { + content: "\e7de"; +} + +.luckysheet-iconfont-jiacu:before { + content: "\e7d9"; +} + +.luckysheet-iconfont-sousuo:before { + content: "\e78a"; +} + +.luckysheet-iconfont-guanbi:before { + content: "\e78b"; +} + +.luckysheet-iconfont-xiayige:before { + content: "\e78c"; +} + +.luckysheet-iconfont-xiala:before { + content: "\e78d"; +} + +.luckysheet-iconfont-wenbenyanse:before { + content: "\e78e"; +} + +.luckysheet-iconfont-shangyige:before { + content: "\e78f"; +} + +.luckysheet-iconfont-shujutoushi:before { + content: "\e790"; +} + +.luckysheet-iconfont-tianchong:before { + content: "\e791"; +} + +.luckysheet-iconfont-zengjiaxiaoshuwei:before { + content: "\e792"; +} + +.luckysheet-iconfont-bianji2:before { + content: "\e793"; +} + +.luckysheet-iconfont-jieping:before { + content: "\e794"; +} + +.luckysheet-iconfont-jianxiaoxiaoshuwei:before { + content: "\e796"; +} + +.luckysheet-iconfont-caidan:before { + content: "\e797"; +} + +.luckysheet-iconfont-shujuku:before { + content: "\e798"; +} + +.luckysheet-iconfont-wubiankuang:before { + content: "\e799"; +} + +.luckysheet-iconfont-bianji:before { + content: "\e79a"; +} + +.luckysheet-iconfont-qingchuyangshi:before { + content: "\e79b"; +} + +.luckysheet-iconfont-shanchu:before { + content: "\e79c"; +} + +.luckysheet-iconfont-wenbenjuzhongduiqi:before { + content: "\e79d"; +} + +.luckysheet-iconfont-dayin:before { + content: "\e79e"; +} + +.luckysheet-iconfont-wenbenfenge:before { + content: "\e79f"; +} + +.luckysheet-iconfont-hanshu:before { + content: "\e7a0"; +} + +.luckysheet-iconfont-jiangxu:before { + content: "\e7a1"; +} + +.luckysheet-iconfont-dingbuduiqi:before { + content: "\e7a2"; +} + +.luckysheet-iconfont-tupian:before { + content: "\e7a3"; +} + +.luckysheet-iconfont-xiangxia90:before { + content: "\e7a4"; +} + +.luckysheet-iconfont-shupaiwenzi:before { + content: "\e7a5"; +} + +.luckysheet-iconfont-quanjiabiankuang:before { + content: "\e7a6"; +} + +.luckysheet-iconfont-shengxu:before { + content: "\e7a7"; +} + +.luckysheet-iconfont-caijian:before { + content: "\e7a8"; +} + +.luckysheet-iconfont-jine:before { + content: "\e7a9"; +} + +.luckysheet-iconfont-caidan1:before { + content: "\e7aa"; +} + +.luckysheet-iconfont-quxiaohebing:before { + content: "\e7ab"; +} + +.luckysheet-iconfont-wenbenxiahuaxian:before { + content: "\e7ac"; +} + +.luckysheet-iconfont-shangbiankuang:before { + content: "\e7ad"; +} + +.luckysheet-iconfont-dingwei:before { + content: "\e7ae"; +} + +.luckysheet-iconfont-sizhoujiabiankuang:before { + content: "\e7af"; +} + +.luckysheet-iconfont-cebianlanshouqi:before { + content: "\e7b0"; +} + +.luckysheet-iconfont-hebing:before { + content: "\e7b1"; +} + +.luckysheet-iconfont-xiangshangqingxie:before { + content: "\e7b2"; +} + +.luckysheet-iconfont-shuipingduiqi:before { + content: "\e7b3"; +} + +.luckysheet-iconfont-wenbenshanchuxian:before { + content: "\e7b4"; +} + +.luckysheet-iconfont-wenbenyouduiqi:before { + content: "\e7b5"; +} + +.luckysheet-iconfont-qianjin:before { + content: "\e7b6"; +} + +.luckysheet-iconfont-tubiao:before { + content: "\e7b7"; +} + +.luckysheet-iconfont-youbiankuang:before { + content: "\e7b8"; +} + +.luckysheet-iconfont-baifenhao:before { + content: "\e7b9"; +} + +.luckysheet-iconfont-geshishua:before { + content: "\e7ba"; +} + +.luckysheet-iconfont-baocun:before { + content: "\e7bb"; +} + +.luckysheet-iconfont-shujuyanzheng:before { + content: "\e7bc"; +} + +.luckysheet-iconfont-jieduan:before { + content: "\e7bd"; +} + +.luckysheet-iconfont-geshitiaojian:before { + content: "\e7be"; +} + +.luckysheet-iconfont-zidonghuanhang:before { + content: "\e7bf"; +} + +.luckysheet-iconfont-cebianlanzhankai:before { + content: "\e7c0"; +} + +.luckysheet-iconfont-shaixuan2:before { + content: "\e7c1"; +} + +.luckysheet-iconfont-xiangxiaqingxie:before { + content: "\e7c2"; +} + +.luckysheet-iconfont-yichu:before { + content: "\e7c3"; +} + +.luckysheet-iconfont-chuizhihebing:before { + content: "\e7c4"; +} + +.luckysheet-iconfont-wenbenfensanduiqi:before { + content: "\e7c5"; +} + +.luckysheet-iconfont-zuobiankuang:before { + content: "\e7c6"; +} + +.luckysheet-iconfont-fenyechakan:before { + content: "\e7c7"; +} + +.luckysheet-iconfont-yunhang:before { + content: "\e7c8"; +} + +.luckysheet-iconfont-lie:before { + content: "\e7c9"; +} + +.luckysheet-iconfont-quanping:before { + content: "\e7ca"; +} + +.luckysheet-iconfont-shaixuan:before { + content: "\e7cb"; +} + +.luckysheet-iconfont-gengxin:before { + content: "\e7cc"; +} + +.luckysheet-iconfont-qingchu:before { + content: "\e7cd"; +} + +.luckysheet-iconfont-hang:before { + content: "\e7ce"; +} + +.luckysheet-iconfont-zhushi:before { + content: "\e7cf"; +} + +.luckysheet-iconfont-jian:before { + content: "\e7d0"; +} + +.luckysheet-iconfont-jisuan:before { + content: "\e7d1"; +} + +.luckysheet-iconfont-jia:before { + content: "\e7d2"; +} + +.luckysheet-iconfont-dibuduiqi:before { + content: "\e7d3"; +} + +.luckysheet-iconfont-xiangshang90:before { + content: "\e7d4"; +} + +.luckysheet-iconfont-wuxuanzhuang:before { + content: "\e7d5"; +} + +.luckysheet-iconfont-xianshiyincangwangge:before { + content: "\e7d6"; +} + +.luckysheet-iconfont-dongjie:before { + content: "\e7d7"; +} + +.luckysheet-iconfont-wenbenzuoduiqi:before { + content: "\e7d8"; +} + +.luckysheet-iconfont-houtui:before { + content: "\e7da"; +} + +.luckysheet-iconfont-shuipinghebing:before { + content: "\e7db"; +} + +.luckysheet-iconfont-xiabiankuang:before { + content: "\e7dc"; +} + +.luckysheet-iconfont-shezhi:before { + content: "\e7dd"; +} + diff --git a/src/assets/iconfont/iconfont.json b/src/assets/iconfont/iconfont.json index 3d547f726..9aacca0a0 100644 --- a/src/assets/iconfont/iconfont.json +++ b/src/assets/iconfont/iconfont.json @@ -1,779 +1,779 @@ -{ - "id": "1990368", - "name": "lucksheet", - "font_family": "iconfont", - "css_prefix_text": "luckysheet-iconfont-", - "description": "", - "glyphs": [ - { - "icon_id": "17878780", - "name": "链接", - "font_class": "lianjie", - "unicode": "e7f8", - "unicode_decimal": 59384 - }, - { - "icon_id": "17612330", - "name": "打印区域", - "font_class": "dayinquyu", - "unicode": "e7f5", - "unicode_decimal": 59381 - }, - { - "icon_id": "17612331", - "name": "打印页面配置", - "font_class": "dayinyemianpeizhi", - "unicode": "e7f6", - "unicode_decimal": 59382 - }, - { - "icon_id": "17612332", - "name": "打印标题", - "font_class": "dayinbiaoti", - "unicode": "e7f7", - "unicode_decimal": 59383 - }, - { - "icon_id": "17600443", - "name": "分页预览", - "font_class": "fenyeyulan", - "unicode": "e7f2", - "unicode_decimal": 59378 - }, - { - "icon_id": "17600444", - "name": "普通", - "font_class": "putong", - "unicode": "e7f3", - "unicode_decimal": 59379 - }, - { - "icon_id": "17600445", - "name": "页面布局", - "font_class": "yemianbuju", - "unicode": "e7f4", - "unicode_decimal": 59380 - }, - { - "icon_id": "17597312", - "name": "表格锁定", - "font_class": "biaogesuoding", - "unicode": "e7ee", - "unicode_decimal": 59374 - }, - { - "icon_id": "17444514", - "name": "转到", - "font_class": "zhuandao1", - "unicode": "e7f1", - "unicode_decimal": 59377 - }, - { - "icon_id": "17444503", - "name": "右箭头", - "font_class": "youjiantou", - "unicode": "e7ed", - "unicode_decimal": 59373 - }, - { - "icon_id": "17444507", - "name": "菜单", - "font_class": "caidan2", - "unicode": "e7ef", - "unicode_decimal": 59375 - }, - { - "icon_id": "17444508", - "name": "替换", - "font_class": "tihuan", - "unicode": "e7f0", - "unicode_decimal": 59376 - }, - { - "icon_id": "17392794", - "name": "冻结", - "font_class": "dongjie1", - "unicode": "e7e1", - "unicode_decimal": 59361 - }, - { - "icon_id": "17392795", - "name": "剪", - "font_class": "jian1", - "unicode": "e7e2", - "unicode_decimal": 59362 - }, - { - "icon_id": "17392796", - "name": "加", - "font_class": "jia1", - "unicode": "e7e3", - "unicode_decimal": 59363 - }, - { - "icon_id": "17392797", - "name": "溢出", - "font_class": "yichu1", - "unicode": "e7e4", - "unicode_decimal": 59364 - }, - { - "icon_id": "17392798", - "name": "升序", - "font_class": "shengxu1", - "unicode": "e7e5", - "unicode_decimal": 59365 - }, - { - "icon_id": "17392799", - "name": "内框线", - "font_class": "neikuangxian", - "unicode": "e7e6", - "unicode_decimal": 59366 - }, - { - "icon_id": "17392800", - "name": "清除筛选", - "font_class": "qingchushaixuan", - "unicode": "e7e7", - "unicode_decimal": 59367 - }, - { - "icon_id": "17392801", - "name": "文本向上", - "font_class": "wenbenxiangshang", - "unicode": "e7e8", - "unicode_decimal": 59368 - }, - { - "icon_id": "17392802", - "name": "降序", - "font_class": "jiangxu1", - "unicode": "e7e9", - "unicode_decimal": 59369 - }, - { - "icon_id": "17392803", - "name": "内框横线", - "font_class": "neikuanghengxian", - "unicode": "e7ea", - "unicode_decimal": 59370 - }, - { - "icon_id": "17392804", - "name": "内框竖线", - "font_class": "neikuangshuxian", - "unicode": "e7eb", - "unicode_decimal": 59371 - }, - { - "icon_id": "17392805", - "name": "自定义排序", - "font_class": "zidingyipaixu", - "unicode": "e7ec", - "unicode_decimal": 59372 - }, - { - "icon_id": "16746498", - "name": "logo2", - "font_class": "logo2", - "unicode": "e7df", - "unicode_decimal": 59359 - }, - { - "icon_id": "16746532", - "name": "logo", - "font_class": "logo", - "unicode": "e7e0", - "unicode_decimal": 59360 - }, - { - "icon_id": "16730159", - "name": "文本倾斜", - "font_class": "wenbenqingxie1", - "unicode": "e7de", - "unicode_decimal": 59358 - }, - { - "icon_id": "16728412", - "name": "加粗", - "font_class": "jiacu", - "unicode": "e7d9", - "unicode_decimal": 59353 - }, - { - "icon_id": "16728080", - "name": "搜索", - "font_class": "sousuo", - "unicode": "e78a", - "unicode_decimal": 59274 - }, - { - "icon_id": "16728081", - "name": "关闭", - "font_class": "guanbi", - "unicode": "e78b", - "unicode_decimal": 59275 - }, - { - "icon_id": "16728082", - "name": "下一个", - "font_class": "xiayige", - "unicode": "e78c", - "unicode_decimal": 59276 - }, - { - "icon_id": "16728083", - "name": "下拉", - "font_class": "xiala", - "unicode": "e78d", - "unicode_decimal": 59277 - }, - { - "icon_id": "16728084", - "name": "文本颜色", - "font_class": "wenbenyanse", - "unicode": "e78e", - "unicode_decimal": 59278 - }, - { - "icon_id": "16728085", - "name": "上一个", - "font_class": "shangyige", - "unicode": "e78f", - "unicode_decimal": 59279 - }, - { - "icon_id": "16728086", - "name": "数据透视", - "font_class": "shujutoushi", - "unicode": "e790", - "unicode_decimal": 59280 - }, - { - "icon_id": "16728087", - "name": "填充", - "font_class": "tianchong", - "unicode": "e791", - "unicode_decimal": 59281 - }, - { - "icon_id": "16728088", - "name": "增加小数位", - "font_class": "zengjiaxiaoshuwei", - "unicode": "e792", - "unicode_decimal": 59282 - }, - { - "icon_id": "16728089", - "name": "编辑2", - "font_class": "bianji2", - "unicode": "e793", - "unicode_decimal": 59283 - }, - { - "icon_id": "16728090", - "name": "截屏", - "font_class": "jieping", - "unicode": "e794", - "unicode_decimal": 59284 - }, - { - "icon_id": "16728092", - "name": "减小小数位", - "font_class": "jianxiaoxiaoshuwei", - "unicode": "e796", - "unicode_decimal": 59286 - }, - { - "icon_id": "16728093", - "name": "菜单", - "font_class": "caidan", - "unicode": "e797", - "unicode_decimal": 59287 - }, - { - "icon_id": "16728094", - "name": "数据库", - "font_class": "shujuku", - "unicode": "e798", - "unicode_decimal": 59288 - }, - { - "icon_id": "16728095", - "name": "无边框", - "font_class": "wubiankuang", - "unicode": "e799", - "unicode_decimal": 59289 - }, - { - "icon_id": "16728096", - "name": "编辑", - "font_class": "bianji", - "unicode": "e79a", - "unicode_decimal": 59290 - }, - { - "icon_id": "16728097", - "name": "清除样式", - "font_class": "qingchuyangshi", - "unicode": "e79b", - "unicode_decimal": 59291 - }, - { - "icon_id": "16728099", - "name": "删除", - "font_class": "shanchu", - "unicode": "e79c", - "unicode_decimal": 59292 - }, - { - "icon_id": "16728100", - "name": "文本居中对齐", - "font_class": "wenbenjuzhongduiqi", - "unicode": "e79d", - "unicode_decimal": 59293 - }, - { - "icon_id": "16728101", - "name": "打印", - "font_class": "dayin", - "unicode": "e79e", - "unicode_decimal": 59294 - }, - { - "icon_id": "16728102", - "name": "文本分割", - "font_class": "wenbenfenge", - "unicode": "e79f", - "unicode_decimal": 59295 - }, - { - "icon_id": "16728103", - "name": "函数‘", - "font_class": "hanshu", - "unicode": "e7a0", - "unicode_decimal": 59296 - }, - { - "icon_id": "16728104", - "name": "降序", - "font_class": "jiangxu", - "unicode": "e7a1", - "unicode_decimal": 59297 - }, - { - "icon_id": "16728105", - "name": "顶部对齐", - "font_class": "dingbuduiqi", - "unicode": "e7a2", - "unicode_decimal": 59298 - }, - { - "icon_id": "16728106", - "name": "图片", - "font_class": "tupian", - "unicode": "e7a3", - "unicode_decimal": 59299 - }, - { - "icon_id": "16728107", - "name": "向下90", - "font_class": "xiangxia90", - "unicode": "e7a4", - "unicode_decimal": 59300 - }, - { - "icon_id": "16728108", - "name": "竖排文字", - "font_class": "shupaiwenzi", - "unicode": "e7a5", - "unicode_decimal": 59301 - }, - { - "icon_id": "16728109", - "name": "全加边框", - "font_class": "quanjiabiankuang", - "unicode": "e7a6", - "unicode_decimal": 59302 - }, - { - "icon_id": "16728110", - "name": "升序", - "font_class": "shengxu", - "unicode": "e7a7", - "unicode_decimal": 59303 - }, - { - "icon_id": "16728111", - "name": "裁剪", - "font_class": "caijian", - "unicode": "e7a8", - "unicode_decimal": 59304 - }, - { - "icon_id": "16728112", - "name": "金额", - "font_class": "jine", - "unicode": "e7a9", - "unicode_decimal": 59305 - }, - { - "icon_id": "16728113", - "name": "菜单1", - "font_class": "caidan1", - "unicode": "e7aa", - "unicode_decimal": 59306 - }, - { - "icon_id": "16728114", - "name": "取消合并", - "font_class": "quxiaohebing", - "unicode": "e7ab", - "unicode_decimal": 59307 - }, - { - "icon_id": "16728115", - "name": "文本下划线", - "font_class": "wenbenxiahuaxian", - "unicode": "e7ac", - "unicode_decimal": 59308 - }, - { - "icon_id": "16728116", - "name": "上边框", - "font_class": "shangbiankuang", - "unicode": "e7ad", - "unicode_decimal": 59309 - }, - { - "icon_id": "16728117", - "name": "定位", - "font_class": "dingwei", - "unicode": "e7ae", - "unicode_decimal": 59310 - }, - { - "icon_id": "16728118", - "name": "四周加边框", - "font_class": "sizhoujiabiankuang", - "unicode": "e7af", - "unicode_decimal": 59311 - }, - { - "icon_id": "16728119", - "name": "侧边栏收起", - "font_class": "cebianlanshouqi", - "unicode": "e7b0", - "unicode_decimal": 59312 - }, - { - "icon_id": "16728120", - "name": "合并", - "font_class": "hebing", - "unicode": "e7b1", - "unicode_decimal": 59313 - }, - { - "icon_id": "16728121", - "name": "向上倾斜", - "font_class": "xiangshangqingxie", - "unicode": "e7b2", - "unicode_decimal": 59314 - }, - { - "icon_id": "16728122", - "name": "水平对齐", - "font_class": "shuipingduiqi", - "unicode": "e7b3", - "unicode_decimal": 59315 - }, - { - "icon_id": "16728123", - "name": "文本删除线", - "font_class": "wenbenshanchuxian", - "unicode": "e7b4", - "unicode_decimal": 59316 - }, - { - "icon_id": "16728124", - "name": "文本右对齐", - "font_class": "wenbenyouduiqi", - "unicode": "e7b5", - "unicode_decimal": 59317 - }, - { - "icon_id": "16728125", - "name": "前进", - "font_class": "qianjin", - "unicode": "e7b6", - "unicode_decimal": 59318 - }, - { - "icon_id": "16728126", - "name": "图表", - "font_class": "tubiao", - "unicode": "e7b7", - "unicode_decimal": 59319 - }, - { - "icon_id": "16728127", - "name": "右边框", - "font_class": "youbiankuang", - "unicode": "e7b8", - "unicode_decimal": 59320 - }, - { - "icon_id": "16728128", - "name": "百分号", - "font_class": "baifenhao", - "unicode": "e7b9", - "unicode_decimal": 59321 - }, - { - "icon_id": "16728129", - "name": "格式刷", - "font_class": "geshishua", - "unicode": "e7ba", - "unicode_decimal": 59322 - }, - { - "icon_id": "16728130", - "name": "保存", - "font_class": "baocun", - "unicode": "e7bb", - "unicode_decimal": 59323 - }, - { - "icon_id": "16728131", - "name": "数据验证", - "font_class": "shujuyanzheng", - "unicode": "e7bc", - "unicode_decimal": 59324 - }, - { - "icon_id": "16728132", - "name": "截断", - "font_class": "jieduan", - "unicode": "e7bd", - "unicode_decimal": 59325 - }, - { - "icon_id": "16728133", - "name": "格式条件", - "font_class": "geshitiaojian", - "unicode": "e7be", - "unicode_decimal": 59326 - }, - { - "icon_id": "16728134", - "name": "自动换行", - "font_class": "zidonghuanhang", - "unicode": "e7bf", - "unicode_decimal": 59327 - }, - { - "icon_id": "16728135", - "name": "侧边栏展开", - "font_class": "cebianlanzhankai", - "unicode": "e7c0", - "unicode_decimal": 59328 - }, - { - "icon_id": "16728136", - "name": "筛选2", - "font_class": "shaixuan2", - "unicode": "e7c1", - "unicode_decimal": 59329 - }, - { - "icon_id": "16728137", - "name": "向下倾斜", - "font_class": "xiangxiaqingxie", - "unicode": "e7c2", - "unicode_decimal": 59330 - }, - { - "icon_id": "16728138", - "name": "溢出", - "font_class": "yichu", - "unicode": "e7c3", - "unicode_decimal": 59331 - }, - { - "icon_id": "16728139", - "name": "垂直合并", - "font_class": "chuizhihebing", - "unicode": "e7c4", - "unicode_decimal": 59332 - }, - { - "icon_id": "16728140", - "name": "文本分散对齐", - "font_class": "wenbenfensanduiqi", - "unicode": "e7c5", - "unicode_decimal": 59333 - }, - { - "icon_id": "16728141", - "name": "左边框", - "font_class": "zuobiankuang", - "unicode": "e7c6", - "unicode_decimal": 59334 - }, - { - "icon_id": "16728142", - "name": "分页查看", - "font_class": "fenyechakan", - "unicode": "e7c7", - "unicode_decimal": 59335 - }, - { - "icon_id": "16728143", - "name": "运行", - "font_class": "yunhang", - "unicode": "e7c8", - "unicode_decimal": 59336 - }, - { - "icon_id": "16728144", - "name": "列", - "font_class": "lie", - "unicode": "e7c9", - "unicode_decimal": 59337 - }, - { - "icon_id": "16728145", - "name": "全屏", - "font_class": "quanping", - "unicode": "e7ca", - "unicode_decimal": 59338 - }, - { - "icon_id": "16728146", - "name": "筛选", - "font_class": "shaixuan", - "unicode": "e7cb", - "unicode_decimal": 59339 - }, - { - "icon_id": "16728147", - "name": "更新", - "font_class": "gengxin", - "unicode": "e7cc", - "unicode_decimal": 59340 - }, - { - "icon_id": "16728148", - "name": "清除", - "font_class": "qingchu", - "unicode": "e7cd", - "unicode_decimal": 59341 - }, - { - "icon_id": "16728149", - "name": "行", - "font_class": "hang", - "unicode": "e7ce", - "unicode_decimal": 59342 - }, - { - "icon_id": "16728150", - "name": "注释", - "font_class": "zhushi", - "unicode": "e7cf", - "unicode_decimal": 59343 - }, - { - "icon_id": "16728151", - "name": "剪", - "font_class": "jian", - "unicode": "e7d0", - "unicode_decimal": 59344 - }, - { - "icon_id": "16728152", - "name": "计算", - "font_class": "jisuan", - "unicode": "e7d1", - "unicode_decimal": 59345 - }, - { - "icon_id": "16728153", - "name": "加", - "font_class": "jia", - "unicode": "e7d2", - "unicode_decimal": 59346 - }, - { - "icon_id": "16728154", - "name": "底部对齐", - "font_class": "dibuduiqi", - "unicode": "e7d3", - "unicode_decimal": 59347 - }, - { - "icon_id": "16728155", - "name": "向上90", - "font_class": "xiangshang90", - "unicode": "e7d4", - "unicode_decimal": 59348 - }, - { - "icon_id": "16728156", - "name": "无选装", - "font_class": "wuxuanzhuang", - "unicode": "e7d5", - "unicode_decimal": 59349 - }, - { - "icon_id": "16728157", - "name": "显示隐藏网格", - "font_class": "xianshiyincangwangge", - "unicode": "e7d6", - "unicode_decimal": 59350 - }, - { - "icon_id": "16728158", - "name": "冻结", - "font_class": "dongjie", - "unicode": "e7d7", - "unicode_decimal": 59351 - }, - { - "icon_id": "16728159", - "name": "文本左对齐", - "font_class": "wenbenzuoduiqi", - "unicode": "e7d8", - "unicode_decimal": 59352 - }, - { - "icon_id": "16728161", - "name": "后退", - "font_class": "houtui", - "unicode": "e7da", - "unicode_decimal": 59354 - }, - { - "icon_id": "16728162", - "name": "水平合并", - "font_class": "shuipinghebing", - "unicode": "e7db", - "unicode_decimal": 59355 - }, - { - "icon_id": "16728163", - "name": "下边框", - "font_class": "xiabiankuang", - "unicode": "e7dc", - "unicode_decimal": 59356 - }, - { - "icon_id": "16728164", - "name": "设置", - "font_class": "shezhi", - "unicode": "e7dd", - "unicode_decimal": 59357 - } - ] -} +{ + "id": "1990368", + "name": "lucksheet", + "font_family": "iconfont", + "css_prefix_text": "luckysheet-iconfont-", + "description": "", + "glyphs": [ + { + "icon_id": "17878780", + "name": "链接", + "font_class": "lianjie", + "unicode": "e7f8", + "unicode_decimal": 59384 + }, + { + "icon_id": "17612330", + "name": "打印区域", + "font_class": "dayinquyu", + "unicode": "e7f5", + "unicode_decimal": 59381 + }, + { + "icon_id": "17612331", + "name": "打印页面配置", + "font_class": "dayinyemianpeizhi", + "unicode": "e7f6", + "unicode_decimal": 59382 + }, + { + "icon_id": "17612332", + "name": "打印标题", + "font_class": "dayinbiaoti", + "unicode": "e7f7", + "unicode_decimal": 59383 + }, + { + "icon_id": "17600443", + "name": "分页预览", + "font_class": "fenyeyulan", + "unicode": "e7f2", + "unicode_decimal": 59378 + }, + { + "icon_id": "17600444", + "name": "普通", + "font_class": "putong", + "unicode": "e7f3", + "unicode_decimal": 59379 + }, + { + "icon_id": "17600445", + "name": "页面布局", + "font_class": "yemianbuju", + "unicode": "e7f4", + "unicode_decimal": 59380 + }, + { + "icon_id": "17597312", + "name": "表格锁定", + "font_class": "biaogesuoding", + "unicode": "e7ee", + "unicode_decimal": 59374 + }, + { + "icon_id": "17444514", + "name": "转到", + "font_class": "zhuandao1", + "unicode": "e7f1", + "unicode_decimal": 59377 + }, + { + "icon_id": "17444503", + "name": "右箭头", + "font_class": "youjiantou", + "unicode": "e7ed", + "unicode_decimal": 59373 + }, + { + "icon_id": "17444507", + "name": "菜单", + "font_class": "caidan2", + "unicode": "e7ef", + "unicode_decimal": 59375 + }, + { + "icon_id": "17444508", + "name": "替换", + "font_class": "tihuan", + "unicode": "e7f0", + "unicode_decimal": 59376 + }, + { + "icon_id": "17392794", + "name": "冻结", + "font_class": "dongjie1", + "unicode": "e7e1", + "unicode_decimal": 59361 + }, + { + "icon_id": "17392795", + "name": "剪", + "font_class": "jian1", + "unicode": "e7e2", + "unicode_decimal": 59362 + }, + { + "icon_id": "17392796", + "name": "加", + "font_class": "jia1", + "unicode": "e7e3", + "unicode_decimal": 59363 + }, + { + "icon_id": "17392797", + "name": "溢出", + "font_class": "yichu1", + "unicode": "e7e4", + "unicode_decimal": 59364 + }, + { + "icon_id": "17392798", + "name": "升序", + "font_class": "shengxu1", + "unicode": "e7e5", + "unicode_decimal": 59365 + }, + { + "icon_id": "17392799", + "name": "内框线", + "font_class": "neikuangxian", + "unicode": "e7e6", + "unicode_decimal": 59366 + }, + { + "icon_id": "17392800", + "name": "清除筛选", + "font_class": "qingchushaixuan", + "unicode": "e7e7", + "unicode_decimal": 59367 + }, + { + "icon_id": "17392801", + "name": "文本向上", + "font_class": "wenbenxiangshang", + "unicode": "e7e8", + "unicode_decimal": 59368 + }, + { + "icon_id": "17392802", + "name": "降序", + "font_class": "jiangxu1", + "unicode": "e7e9", + "unicode_decimal": 59369 + }, + { + "icon_id": "17392803", + "name": "内框横线", + "font_class": "neikuanghengxian", + "unicode": "e7ea", + "unicode_decimal": 59370 + }, + { + "icon_id": "17392804", + "name": "内框竖线", + "font_class": "neikuangshuxian", + "unicode": "e7eb", + "unicode_decimal": 59371 + }, + { + "icon_id": "17392805", + "name": "自定义排序", + "font_class": "zidingyipaixu", + "unicode": "e7ec", + "unicode_decimal": 59372 + }, + { + "icon_id": "16746498", + "name": "logo2", + "font_class": "logo2", + "unicode": "e7df", + "unicode_decimal": 59359 + }, + { + "icon_id": "16746532", + "name": "logo", + "font_class": "logo", + "unicode": "e7e0", + "unicode_decimal": 59360 + }, + { + "icon_id": "16730159", + "name": "文本倾斜", + "font_class": "wenbenqingxie1", + "unicode": "e7de", + "unicode_decimal": 59358 + }, + { + "icon_id": "16728412", + "name": "加粗", + "font_class": "jiacu", + "unicode": "e7d9", + "unicode_decimal": 59353 + }, + { + "icon_id": "16728080", + "name": "搜索", + "font_class": "sousuo", + "unicode": "e78a", + "unicode_decimal": 59274 + }, + { + "icon_id": "16728081", + "name": "关闭", + "font_class": "guanbi", + "unicode": "e78b", + "unicode_decimal": 59275 + }, + { + "icon_id": "16728082", + "name": "下一个", + "font_class": "xiayige", + "unicode": "e78c", + "unicode_decimal": 59276 + }, + { + "icon_id": "16728083", + "name": "下拉", + "font_class": "xiala", + "unicode": "e78d", + "unicode_decimal": 59277 + }, + { + "icon_id": "16728084", + "name": "文本颜色", + "font_class": "wenbenyanse", + "unicode": "e78e", + "unicode_decimal": 59278 + }, + { + "icon_id": "16728085", + "name": "上一个", + "font_class": "shangyige", + "unicode": "e78f", + "unicode_decimal": 59279 + }, + { + "icon_id": "16728086", + "name": "数据透视", + "font_class": "shujutoushi", + "unicode": "e790", + "unicode_decimal": 59280 + }, + { + "icon_id": "16728087", + "name": "填充", + "font_class": "tianchong", + "unicode": "e791", + "unicode_decimal": 59281 + }, + { + "icon_id": "16728088", + "name": "增加小数位", + "font_class": "zengjiaxiaoshuwei", + "unicode": "e792", + "unicode_decimal": 59282 + }, + { + "icon_id": "16728089", + "name": "编辑2", + "font_class": "bianji2", + "unicode": "e793", + "unicode_decimal": 59283 + }, + { + "icon_id": "16728090", + "name": "截屏", + "font_class": "jieping", + "unicode": "e794", + "unicode_decimal": 59284 + }, + { + "icon_id": "16728092", + "name": "减小小数位", + "font_class": "jianxiaoxiaoshuwei", + "unicode": "e796", + "unicode_decimal": 59286 + }, + { + "icon_id": "16728093", + "name": "菜单", + "font_class": "caidan", + "unicode": "e797", + "unicode_decimal": 59287 + }, + { + "icon_id": "16728094", + "name": "数据库", + "font_class": "shujuku", + "unicode": "e798", + "unicode_decimal": 59288 + }, + { + "icon_id": "16728095", + "name": "无边框", + "font_class": "wubiankuang", + "unicode": "e799", + "unicode_decimal": 59289 + }, + { + "icon_id": "16728096", + "name": "编辑", + "font_class": "bianji", + "unicode": "e79a", + "unicode_decimal": 59290 + }, + { + "icon_id": "16728097", + "name": "清除样式", + "font_class": "qingchuyangshi", + "unicode": "e79b", + "unicode_decimal": 59291 + }, + { + "icon_id": "16728099", + "name": "删除", + "font_class": "shanchu", + "unicode": "e79c", + "unicode_decimal": 59292 + }, + { + "icon_id": "16728100", + "name": "文本居中对齐", + "font_class": "wenbenjuzhongduiqi", + "unicode": "e79d", + "unicode_decimal": 59293 + }, + { + "icon_id": "16728101", + "name": "打印", + "font_class": "dayin", + "unicode": "e79e", + "unicode_decimal": 59294 + }, + { + "icon_id": "16728102", + "name": "文本分割", + "font_class": "wenbenfenge", + "unicode": "e79f", + "unicode_decimal": 59295 + }, + { + "icon_id": "16728103", + "name": "函数‘", + "font_class": "hanshu", + "unicode": "e7a0", + "unicode_decimal": 59296 + }, + { + "icon_id": "16728104", + "name": "降序", + "font_class": "jiangxu", + "unicode": "e7a1", + "unicode_decimal": 59297 + }, + { + "icon_id": "16728105", + "name": "顶部对齐", + "font_class": "dingbuduiqi", + "unicode": "e7a2", + "unicode_decimal": 59298 + }, + { + "icon_id": "16728106", + "name": "图片", + "font_class": "tupian", + "unicode": "e7a3", + "unicode_decimal": 59299 + }, + { + "icon_id": "16728107", + "name": "向下90", + "font_class": "xiangxia90", + "unicode": "e7a4", + "unicode_decimal": 59300 + }, + { + "icon_id": "16728108", + "name": "竖排文字", + "font_class": "shupaiwenzi", + "unicode": "e7a5", + "unicode_decimal": 59301 + }, + { + "icon_id": "16728109", + "name": "全加边框", + "font_class": "quanjiabiankuang", + "unicode": "e7a6", + "unicode_decimal": 59302 + }, + { + "icon_id": "16728110", + "name": "升序", + "font_class": "shengxu", + "unicode": "e7a7", + "unicode_decimal": 59303 + }, + { + "icon_id": "16728111", + "name": "裁剪", + "font_class": "caijian", + "unicode": "e7a8", + "unicode_decimal": 59304 + }, + { + "icon_id": "16728112", + "name": "金额", + "font_class": "jine", + "unicode": "e7a9", + "unicode_decimal": 59305 + }, + { + "icon_id": "16728113", + "name": "菜单1", + "font_class": "caidan1", + "unicode": "e7aa", + "unicode_decimal": 59306 + }, + { + "icon_id": "16728114", + "name": "取消合并", + "font_class": "quxiaohebing", + "unicode": "e7ab", + "unicode_decimal": 59307 + }, + { + "icon_id": "16728115", + "name": "文本下划线", + "font_class": "wenbenxiahuaxian", + "unicode": "e7ac", + "unicode_decimal": 59308 + }, + { + "icon_id": "16728116", + "name": "上边框", + "font_class": "shangbiankuang", + "unicode": "e7ad", + "unicode_decimal": 59309 + }, + { + "icon_id": "16728117", + "name": "定位", + "font_class": "dingwei", + "unicode": "e7ae", + "unicode_decimal": 59310 + }, + { + "icon_id": "16728118", + "name": "四周加边框", + "font_class": "sizhoujiabiankuang", + "unicode": "e7af", + "unicode_decimal": 59311 + }, + { + "icon_id": "16728119", + "name": "侧边栏收起", + "font_class": "cebianlanshouqi", + "unicode": "e7b0", + "unicode_decimal": 59312 + }, + { + "icon_id": "16728120", + "name": "合并", + "font_class": "hebing", + "unicode": "e7b1", + "unicode_decimal": 59313 + }, + { + "icon_id": "16728121", + "name": "向上倾斜", + "font_class": "xiangshangqingxie", + "unicode": "e7b2", + "unicode_decimal": 59314 + }, + { + "icon_id": "16728122", + "name": "水平对齐", + "font_class": "shuipingduiqi", + "unicode": "e7b3", + "unicode_decimal": 59315 + }, + { + "icon_id": "16728123", + "name": "文本删除线", + "font_class": "wenbenshanchuxian", + "unicode": "e7b4", + "unicode_decimal": 59316 + }, + { + "icon_id": "16728124", + "name": "文本右对齐", + "font_class": "wenbenyouduiqi", + "unicode": "e7b5", + "unicode_decimal": 59317 + }, + { + "icon_id": "16728125", + "name": "前进", + "font_class": "qianjin", + "unicode": "e7b6", + "unicode_decimal": 59318 + }, + { + "icon_id": "16728126", + "name": "图表", + "font_class": "tubiao", + "unicode": "e7b7", + "unicode_decimal": 59319 + }, + { + "icon_id": "16728127", + "name": "右边框", + "font_class": "youbiankuang", + "unicode": "e7b8", + "unicode_decimal": 59320 + }, + { + "icon_id": "16728128", + "name": "百分号", + "font_class": "baifenhao", + "unicode": "e7b9", + "unicode_decimal": 59321 + }, + { + "icon_id": "16728129", + "name": "格式刷", + "font_class": "geshishua", + "unicode": "e7ba", + "unicode_decimal": 59322 + }, + { + "icon_id": "16728130", + "name": "保存", + "font_class": "baocun", + "unicode": "e7bb", + "unicode_decimal": 59323 + }, + { + "icon_id": "16728131", + "name": "数据验证", + "font_class": "shujuyanzheng", + "unicode": "e7bc", + "unicode_decimal": 59324 + }, + { + "icon_id": "16728132", + "name": "截断", + "font_class": "jieduan", + "unicode": "e7bd", + "unicode_decimal": 59325 + }, + { + "icon_id": "16728133", + "name": "格式条件", + "font_class": "geshitiaojian", + "unicode": "e7be", + "unicode_decimal": 59326 + }, + { + "icon_id": "16728134", + "name": "自动换行", + "font_class": "zidonghuanhang", + "unicode": "e7bf", + "unicode_decimal": 59327 + }, + { + "icon_id": "16728135", + "name": "侧边栏展开", + "font_class": "cebianlanzhankai", + "unicode": "e7c0", + "unicode_decimal": 59328 + }, + { + "icon_id": "16728136", + "name": "筛选2", + "font_class": "shaixuan2", + "unicode": "e7c1", + "unicode_decimal": 59329 + }, + { + "icon_id": "16728137", + "name": "向下倾斜", + "font_class": "xiangxiaqingxie", + "unicode": "e7c2", + "unicode_decimal": 59330 + }, + { + "icon_id": "16728138", + "name": "溢出", + "font_class": "yichu", + "unicode": "e7c3", + "unicode_decimal": 59331 + }, + { + "icon_id": "16728139", + "name": "垂直合并", + "font_class": "chuizhihebing", + "unicode": "e7c4", + "unicode_decimal": 59332 + }, + { + "icon_id": "16728140", + "name": "文本分散对齐", + "font_class": "wenbenfensanduiqi", + "unicode": "e7c5", + "unicode_decimal": 59333 + }, + { + "icon_id": "16728141", + "name": "左边框", + "font_class": "zuobiankuang", + "unicode": "e7c6", + "unicode_decimal": 59334 + }, + { + "icon_id": "16728142", + "name": "分页查看", + "font_class": "fenyechakan", + "unicode": "e7c7", + "unicode_decimal": 59335 + }, + { + "icon_id": "16728143", + "name": "运行", + "font_class": "yunhang", + "unicode": "e7c8", + "unicode_decimal": 59336 + }, + { + "icon_id": "16728144", + "name": "列", + "font_class": "lie", + "unicode": "e7c9", + "unicode_decimal": 59337 + }, + { + "icon_id": "16728145", + "name": "全屏", + "font_class": "quanping", + "unicode": "e7ca", + "unicode_decimal": 59338 + }, + { + "icon_id": "16728146", + "name": "筛选", + "font_class": "shaixuan", + "unicode": "e7cb", + "unicode_decimal": 59339 + }, + { + "icon_id": "16728147", + "name": "更新", + "font_class": "gengxin", + "unicode": "e7cc", + "unicode_decimal": 59340 + }, + { + "icon_id": "16728148", + "name": "清除", + "font_class": "qingchu", + "unicode": "e7cd", + "unicode_decimal": 59341 + }, + { + "icon_id": "16728149", + "name": "行", + "font_class": "hang", + "unicode": "e7ce", + "unicode_decimal": 59342 + }, + { + "icon_id": "16728150", + "name": "注释", + "font_class": "zhushi", + "unicode": "e7cf", + "unicode_decimal": 59343 + }, + { + "icon_id": "16728151", + "name": "剪", + "font_class": "jian", + "unicode": "e7d0", + "unicode_decimal": 59344 + }, + { + "icon_id": "16728152", + "name": "计算", + "font_class": "jisuan", + "unicode": "e7d1", + "unicode_decimal": 59345 + }, + { + "icon_id": "16728153", + "name": "加", + "font_class": "jia", + "unicode": "e7d2", + "unicode_decimal": 59346 + }, + { + "icon_id": "16728154", + "name": "底部对齐", + "font_class": "dibuduiqi", + "unicode": "e7d3", + "unicode_decimal": 59347 + }, + { + "icon_id": "16728155", + "name": "向上90", + "font_class": "xiangshang90", + "unicode": "e7d4", + "unicode_decimal": 59348 + }, + { + "icon_id": "16728156", + "name": "无选装", + "font_class": "wuxuanzhuang", + "unicode": "e7d5", + "unicode_decimal": 59349 + }, + { + "icon_id": "16728157", + "name": "显示隐藏网格", + "font_class": "xianshiyincangwangge", + "unicode": "e7d6", + "unicode_decimal": 59350 + }, + { + "icon_id": "16728158", + "name": "冻结", + "font_class": "dongjie", + "unicode": "e7d7", + "unicode_decimal": 59351 + }, + { + "icon_id": "16728159", + "name": "文本左对齐", + "font_class": "wenbenzuoduiqi", + "unicode": "e7d8", + "unicode_decimal": 59352 + }, + { + "icon_id": "16728161", + "name": "后退", + "font_class": "houtui", + "unicode": "e7da", + "unicode_decimal": 59354 + }, + { + "icon_id": "16728162", + "name": "水平合并", + "font_class": "shuipinghebing", + "unicode": "e7db", + "unicode_decimal": 59355 + }, + { + "icon_id": "16728163", + "name": "下边框", + "font_class": "xiabiankuang", + "unicode": "e7dc", + "unicode_decimal": 59356 + }, + { + "icon_id": "16728164", + "name": "设置", + "font_class": "shezhi", + "unicode": "e7dd", + "unicode_decimal": 59357 + } + ] +} diff --git a/src/assets/iconfont/iconfont.svg b/src/assets/iconfont/iconfont.svg index 3964a24c6..e606562e8 100644 --- a/src/assets/iconfont/iconfont.svg +++ b/src/assets/iconfont/iconfont.svg @@ -1,356 +1,356 @@ - - - - - -Created by iconfont - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + +Created by iconfont + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/config.js b/src/config.js index f4372c8ff..3ecad6c52 100644 --- a/src/config.js +++ b/src/config.js @@ -1,70 +1,70 @@ -/** - * The default luckysheet config object. - */ -export default { - container: "luckysheet", //容器的ID - loading:{}, //自定义loading - column: 60, //空表格默认的列数量 - row: 84, //空表格默认的行数据量 - allowCopy: true, //是否允许拷贝 - showtoolbar: true, //是否第二列显示工具栏 - showinfobar: true, //是否显示顶部名称栏 - showsheetbar: true, //是否显示底部表格名称区域 - showstatisticBar: true, //是否显示底部计数栏 - pointEdit: false, //是否是编辑器插入表格模式 - pointEditUpdate: null, //编辑器表格更新函数 - pointEditZoom: 1, //编辑器表格编辑时缩放比例 - // menu: "undo|redo|freezenrow|freezencolumn|download|share|chart|pivot", - data: [{ "name": "Sheet1", color: "", "status": "1", "order": "0", "data": [], "config": {}, "index":0 }, { "name": "Sheet2", color: "", "status": "0", "order": "1", "data": [], "config": {}, "index":1 }, { "name": "Sheet3", color: "", "status": "0", "order": "2", "data": [], "config": {}, "index":2 }], //客户端sheet数据[shee1, sheet2, sheet3] - title: "Luckysheet Demo", //表格的名称 - userInfo:false,// 右上角的用户信息展示样式,支持 1. boolean类型:false:不展示,ture:展示默认 ' rabbit' ,2. HTML模板字符串或者普通字符串,如:' Lucky'或者'用户名', 3. 对象格式,设置 userImage:用户头像地址 和 userName:用户名 4. 不设置或者设置undefined同设置false - userMenuItem: [{url:"www.baidu.com", "icon":'', "name":"我的表格"}, {url:"www.baidu.com", "icon":'', "name":"退出登陆"}], //点击右上角的用户信息弹出的菜单 - myFolderUrl: "www.baidu.com", //左上角<返回按钮的链接 - config: {}, //表格行高、列宽、合并单元格、公式等设置 - fullscreenmode: true, //是否全屏模式,非全屏模式下,标记框不会强制选中。 - devicePixelRatio: window.devicePixelRatio, //设备比例,比例越大表格分标率越高 - allowEdit: true, //是否允许前台编辑 - loadUrl: "", // 配置loadUrl的地址,luckysheet会通过ajax请求表格数据,默认载入status为1的sheet数据中的所有data,其余的sheet载入除data字段外的所有字段 - loadSheetUrl: "", //配置loadSheetUrl的地址,参数为gridKey(表格主键) 和 index(sheet主键合集,格式为[1,2,3]),返回的数据为sheet的data字段数据集合 - gridKey: "", // 表格唯一标识符 - updateUrl: "", //表格数据的更新地址 - updateImageUrl: "", //缩略图的更新地址 - allowUpdate: false, //是否允许编辑后的后台更新 - functionButton: "", //右上角功能按钮,例如' ' - showConfigWindowResize: true, //图表和数据透视表的配置会在右侧弹出,设置弹出后表格是否会自动缩进 - enableAddRow: true,//允许添加行 - enableAddBackTop: true,//允许回到顶部 - // enablePage: false,//允许加载下一页 - autoFormatw: false, //自动格式化超过4位数的数字为 亿万格式 例:true or "true" or "TRUE" - accuracy: undefined, //设置传输来的数值的精确位数,小数点后n位 传参数为数字或数字字符串,例: "0" 或 0 - pageInfo:{ - 'queryExps':'', - 'reportId':'', - 'fields':'', - 'mobile':'', - 'frezon':'', - 'currentPage':'', - "totalPage":10, - "pageUrl":"", - }, - editMode: false, //是否为编辑模式 - beforeCreateDom: null,//表格创建之前的方法 - fireMousedown: null, //单元格数据下钻 - lang: 'en', //language - plugins: [], //plugins, e.g. ['chart'] - forceCalculation:false,//强制刷新公式,公式较多会有性能问题,慎用 - rowHeaderWidth: 46, - columnHeaderHeight: 20, - defaultColWidth:73, - defaultRowHeight:19, - defaultFontSize:10, - limitSheetNameLength:true, //是否限制工作表名的长度 - defaultSheetNameMaxLength:31, //默认工作表名称的最大长度 - sheetFormulaBar:true, //是否显示公式栏 - showtoolbarConfig:{}, //自定义工具栏 - showsheetbarConfig:{}, //自定义底部sheet页 - showstatisticBarConfig:{}, //自定义计数栏 - cellRightClickConfig:{}, //自定义单元格右键菜单 - sheetRightClickConfig:{}, //自定义底部sheet页右击菜单 - imageUpdateMethodConfig:{}, //自定义图片同步方式 -} \ No newline at end of file +/** + * The default luckysheet config object. + */ +export default { + container: "luckysheet", //容器的ID + loading:{}, //自定义loading + column: 60, //空表格默认的列数量 + row: 84, //空表格默认的行数据量 + allowCopy: true, //是否允许拷贝 + showtoolbar: true, //是否第二列显示工具栏 + showinfobar: true, //是否显示顶部名称栏 + showsheetbar: true, //是否显示底部表格名称区域 + showstatisticBar: true, //是否显示底部计数栏 + pointEdit: false, //是否是编辑器插入表格模式 + pointEditUpdate: null, //编辑器表格更新函数 + pointEditZoom: 1, //编辑器表格编辑时缩放比例 + // menu: "undo|redo|freezenrow|freezencolumn|download|share|chart|pivot", + data: [{ "name": "Sheet1", color: "", "status": "1", "order": "0", "data": [], "config": {}, "index":0 }, { "name": "Sheet2", color: "", "status": "0", "order": "1", "data": [], "config": {}, "index":1 }, { "name": "Sheet3", color: "", "status": "0", "order": "2", "data": [], "config": {}, "index":2 }], //客户端sheet数据[sheet1, sheet2, sheet3] + title: "Luckysheet Demo", //表格的名称 + userInfo:false,// 右上角的用户信息展示样式,支持 1. boolean类型:false:不展示,true:展示默认 ' rabbit' ,2. HTML模板字符串或者普通字符串,如:' Lucky'或者'用户名', 3. 对象格式,设置 userImage:用户头像地址 和 userName:用户名 4. 不设置或者设置undefined同设置false + userMenuItem: [{url:"www.baidu.com", "icon":'', "name":"我的表格"}, {url:"www.baidu.com", "icon":'', "name":"退出登陆"}], //点击右上角的用户信息弹出的菜单 + myFolderUrl: "www.baidu.com", //左上角<返回按钮的链接 + config: {}, //表格行高、列宽、合并单元格、公式等设置 + fullscreenmode: true, //是否全屏模式,非全屏模式下,标记框不会强制选中。 + devicePixelRatio: window.devicePixelRatio, //设备比例,比例越大表格分标率越高 + allowEdit: true, //是否允许前台编辑 + loadUrl: "", // 配置loadUrl的地址,luckysheet会通过ajax请求表格数据,默认载入status为1的sheet数据中的所有data,其余的sheet载入除data字段外的所有字段 + loadSheetUrl: "", //配置loadSheetUrl的地址,参数为gridKey(表格主键) 和 index(sheet主键合集,格式为[1,2,3]),返回的数据为sheet的data字段数据集合 + gridKey: "", // 表格唯一标识符 + updateUrl: "", //表格数据的更新地址 + updateImageUrl: "", //缩略图的更新地址 + allowUpdate: false, //是否允许编辑后的后台更新 + functionButton: "", //右上角功能按钮,例如' ' + showConfigWindowResize: true, //图表和数据透视表的配置会在右侧弹出,设置弹出后表格是否会自动缩进 + enableAddRow: true,//允许添加行 + enableAddBackTop: true,//允许回到顶部 + // enablePage: false,//允许加载下一页 + autoFormatw: false, //自动格式化超过4位数的数字为 亿万格式 例:true or "true" or "TRUE" + accuracy: undefined, //设置传输来的数值的精确位数,小数点后n位 传参数为数字或数字字符串,例: "0" 或 0 + pageInfo:{ + 'queryExps':'', + 'reportId':'', + 'fields':'', + 'mobile':'', + 'frezon':'', + 'currentPage':'', + "totalPage":10, + "pageUrl":"", + }, + editMode: false, //是否为编辑模式 + beforeCreateDom: null,//表格创建之前的方法 + fireMousedown: null, //单元格数据下钻 + lang: 'en', //language + plugins: [], //plugins, e.g. ['chart'] + forceCalculation:false,//强制刷新公式,公式较多会有性能问题,慎用 + rowHeaderWidth: 46, + columnHeaderHeight: 20, + defaultColWidth:73, + defaultRowHeight:19, + defaultFontSize:10, + limitSheetNameLength:true, //是否限制工作表名的长度 + defaultSheetNameMaxLength:31, //默认工作表名称的最大长度 + sheetFormulaBar:true, //是否显示公式栏 + showtoolbarConfig:{}, //自定义工具栏 + showsheetbarConfig:{}, //自定义底部sheet页 + showstatisticBarConfig:{}, //自定义计数栏 + cellRightClickConfig:{}, //自定义单元格右键菜单 + sheetRightClickConfig:{}, //自定义底部sheet页右击菜单 + imageUpdateMethodConfig:{}, //自定义图片同步方式 +} diff --git a/src/controllers/alternateformat.js b/src/controllers/alternateformat.js index 5c0cf8f76..d2d6baeb4 100644 --- a/src/controllers/alternateformat.js +++ b/src/controllers/alternateformat.js @@ -1,1226 +1,1226 @@ - -import { getSheetIndex, getRangetxt } from '../methods/get'; -import { replaceHtml } from '../utils/util'; -import formula from '../global/formula'; -import { isEditMode } from '../global/validate'; -import tooltip from '../global/tooltip'; -import { luckysheetrefreshgrid } from '../global/refresh'; -import { luckysheetAlternateformatHtml, modelHTML } from './constant'; -import luckysheetsizeauto from './resize'; -import server from './server'; -import { selectHightlightShow } from './select'; -import Store from '../store'; -import locale from '../locale/locale'; - -//交替颜色 -const alternateformat = { - rangefocus: false, - modelfocusIndex: null, - FixedModelColor: [ - { - "head": { "fc": "#000", "bc": "#bfbdbe" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#f8f3f7" }, - "foot": { "fc": "#000", "bc": "#dde2de" } - }, - { - "head": { "fc": "#000", "bc": "#4bd4e7" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#eaf7ff" }, - "foot": { "fc": "#000", "bc": "#aae9f8" } - }, - { - "head": { "fc": "#000", "bc": "#5ed593" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#e5fbee" }, - "foot": { "fc": "#000", "bc": "#a5efcc" } - }, - { - "head": { "fc": "#000", "bc": "#f6cb4b" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#fff9e7" }, - "foot": { "fc": "#000", "bc": "#ffebac" } - }, - { - "head": { "fc": "#000", "bc": "#f96420" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#ffe5d9" }, - "foot": { "fc": "#000", "bc": "#ffcfba" } - }, - { - "head": { "fc": "#000", "bc": "#5599fc" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#ecf2fe" }, - "foot": { "fc": "#000", "bc": "#afcbfa" } - }, - { - "head": { "fc": "#000", "bc": "#22a69b" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#dff2f8" }, - "foot": { "fc": "#000", "bc": "#8dd4d0" } - }, - { - "head": { "fc": "#000", "bc": "#7a939a" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#f0eff7" }, - "foot": { "fc": "#000", "bc": "#bdcad0" } - }, - { - "head": { "fc": "#000", "bc": "#d7a270" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#fdf3f1" }, - "foot": { "fc": "#000", "bc": "#ead2b6" } - }, - { - "head": { "fc": "#000", "bc": "#89c54b" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#f1f7e9" }, - "foot": { "fc": "#000", "bc": "#c5e3a7" } - }, - { - "head": { "fc": "#000", "bc": "#8f88f0" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#f0e5ff" }, - "foot": { "fc": "#000", "bc": "#c6c4f6" } - }, - { - "head": { "fc": "#000", "bc": "#fd1664" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#feddee" }, - "foot": { "fc": "#000", "bc": "#f98ab5" } - }, - { - "head": { "fc": "#000", "bc": "#da96d3" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#fce8fb" }, - "foot": { "fc": "#000", "bc": "#f2caee" } - }, - { - "head": { "fc": "#000", "bc": "#b49191" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#f5ebe8" }, - "foot": { "fc": "#000", "bc": "#d8c3c3" } - }, - { - "head": { "fc": "#000", "bc": "#91b493" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#f0fbf0" }, - "foot": { "fc": "#000", "bc": "#b4cfb6" } - }, - { - "head": { "fc": "#000", "bc": "#b4a891" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#f8f6f1" }, - "foot": { "fc": "#000", "bc": "#d3cab8" } - }, - { - "head": { "fc": "#000", "bc": "#91abb4" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#eff7fa" }, - "foot": { "fc": "#000", "bc": "#b7cbd3" } - }, - { - "head": { "fc": "#000", "bc": "#b7ba82" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#fafbeb" }, - "foot": { "fc": "#000", "bc": "#dadcb4" } - }, - { - "head": { "fc": "#000", "bc": "#df3e3e" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#fde9e9" }, - "foot": { "fc": "#000", "bc": "#f89292" } - }, - { - "head": { "fc": "#000", "bc": "#f2711c" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#fef0d7" }, - "foot": { "fc": "#000", "bc": "#fbb335" } - }, - { - "head": { "fc": "#000", "bc": "#b5cc18" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#f9fbd4" }, - "foot": { "fc": "#000", "bc": "#e2ed2a" } - }, - { - "head": { "fc": "#000", "bc": "#00b5ad" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#ccfaf9" }, - "foot": { "fc": "#000", "bc": "#00e4df" } - }, - { - "head": { "fc": "#000", "bc": "#2185d0" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#d8f3fc" }, - "foot": { "fc": "#000", "bc": "#3cc4f0" } - }, - { - "head": { "fc": "#000", "bc": "#a5673f" }, - "one": { "fc": "#000", "bc": "#ffffff" }, - "two": { "fc": "#000", "bc": "#f6ede5" }, - "foot": { "fc": "#000", "bc": "#d3a47c" } - } - ], - getModelBox: function(hasRowHeader, hasRowFooter){ - let _this = this; - - $("#luckysheet-modal-dialog-slider-alternateformat #luckysheet-alternateformat-modelList").empty(); - $("#luckysheet-modal-dialog-slider-alternateformat #luckysheet-alternateformat-modelCustom").empty(); - - //格式样式 模板 - let modelListHtml = ''; - - for(let i = 0; i < _this.FixedModelColor.length; i++){ - let obj = _this.FixedModelColor[i]; - - let color1, color2, color3, color4; - - if(hasRowHeader && hasRowFooter){ - color1 = obj["head"]; - color2 = obj["one"]; - color3 = obj["two"]; - color4 = obj["foot"]; - } - else if(hasRowHeader){ - color1 = obj["head"]; - color2 = obj["one"]; - color3 = obj["two"]; - color4 = obj["one"]; - } - else if(hasRowFooter){ - color1 = obj["one"]; - color2 = obj["two"]; - color3 = obj["one"]; - color4 = obj["foot"]; - } - else{ - color1 = obj["one"]; - color2 = obj["two"]; - color3 = obj["one"]; - color4 = obj["two"]; - } - - modelListHtml += '
'+ - '
'+ - ''+ - ''+ - ''+ - ''+ - '
'+ - '
'; - } - - $("#luckysheet-modal-dialog-slider-alternateformat #luckysheet-alternateformat-modelList").append(modelListHtml); - - //自定义 模板 - let modelCustom = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["luckysheet_alternateformat_save_modelCustom"]; - if(modelCustom != null && modelCustom.length > 0){ - let modelCustomHtml = ''; - - for(let i = 0; i < modelCustom.length; i++){ - let obj = modelCustom[i]; - - let color1, color2, color3, color4; - - if(hasRowHeader && hasRowFooter){ - color1 = obj["head"]; - color2 = obj["one"]; - color3 = obj["two"]; - color4 = obj["foot"]; - } - else if(hasRowHeader){ - color1 = obj["head"]; - color2 = obj["one"]; - color3 = obj["two"]; - color4 = obj["one"]; - } - else if(hasRowFooter){ - color1 = obj["one"]; - color2 = obj["two"]; - color3 = obj["one"]; - color4 = obj["foot"]; - } - else{ - color1 = obj["one"]; - color2 = obj["two"]; - color3 = obj["one"]; - color4 = obj["two"]; - } - - modelCustomHtml += '
'+ - '
'+ - ''+ - ''+ - ''+ - ''+ - '
'+ - '
'; - } - - $("#luckysheet-modal-dialog-slider-alternateformat #luckysheet-alternateformat-modelCustom").append(modelCustomHtml); - } - }, - init: function(){ - let _this = this; - - $("#luckysheet-modal-dialog-slider-alternateformat").remove(); - $("body").append(luckysheetAlternateformatHtml()); - luckysheetsizeauto(); - - //关闭 - $("#luckysheet-modal-dialog-slider-alternateformat .luckysheet-model-close-btn").click(function () { - $("#luckysheet-modal-dialog-slider-alternateformat").hide(); - luckysheetsizeauto(); - }); - - //应用范围 - $(document).off("focus.AFrangeInput").on("focus.AFrangeInput", "#luckysheet-alternateformat-range input", function(){ - _this.rangefocus = true; - }); - $(document).off("blur.AFrangeInput").on("blur.AFrangeInput", "#luckysheet-alternateformat-range input", function(){ - _this.rangefocus = false; - }); - - $(document).off("keydown.AFrangeInput").on("keydown.AFrangeInput", "#luckysheet-alternateformat-range input", function(e){ - let rangeValue = $(this).val().trim(); - if(e.keyCode == 13){ - _this.update(); - } - }); - $(document).off("click.AFrangeIcon").on("click.AFrangeIcon", "#luckysheet-alternateformat-range .fa-table", function(){ - $("#luckysheet-modal-dialog-slider-alternateformat").hide(); - luckysheetsizeauto(); - - let rangeValue = $(this).parents("#luckysheet-alternateformat-range").find("input").val().trim(); - _this.rangeDialog(rangeValue); - }); - $(document).off("click.AFrDCf").on("click.AFrDCf", "#luckysheet-alternateformat-rangeDialog-confirm", function(){ - let rangeValue = $(this).parents("#luckysheet-alternateformat-rangeDialog").find("input").val().trim(); - $("#luckysheet-modal-dialog-slider-alternateformat #luckysheet-alternateformat-range input").val(rangeValue); - - $(this).parents("#luckysheet-alternateformat-rangeDialog").hide(); - $("#luckysheet-modal-dialog-slider-alternateformat").show(); - luckysheetsizeauto(); - - _this.update(); - }); - $(document).off("click.AFrDCl").on("click.AFrDCl", "#luckysheet-alternateformat-rangeDialog-close", function(){ - $(this).parents("#luckysheet-alternateformat-rangeDialog").hide(); - $("#luckysheet-modal-dialog-slider-alternateformat").show(); - luckysheetsizeauto(); - }); - $(document).off("click.AFrDTitle").on("click.AFrDTitle", "#luckysheet-alternateformat-rangeDialog .luckysheet-modal-dialog-title-close", function(){ - $(this).parents("#luckysheet-alternateformat-rangeDialog").hide(); - $("#luckysheet-modal-dialog-slider-alternateformat").show(); - luckysheetsizeauto(); - }); - - //页眉、页脚选中 - $(document).off("change.AFrowHeader").on("change.AFrowHeader", "#luckysheet-alternateformat-rowHeader", function(){ - let hasRowHeader; - if($(this).is(":checked")){ - hasRowHeader = true; - } - else{ - hasRowHeader = false; - } - - let hasRowFooter; - if($("#luckysheet-alternateformat-rowFooter").is(":checked")){ - hasRowFooter = true; - } - else{ - hasRowFooter = false; - } - - _this.checkboxChange(hasRowHeader, hasRowFooter); - _this.modelboxOn(); - _this.update(); - }); - $(document).off("change.AFrowFooter").on("change.AFrowFooter", "#luckysheet-alternateformat-rowFooter", function(){ - let hasRowHeader; - if($("#luckysheet-alternateformat-rowHeader").is(":checked")){ - hasRowHeader = true; - } - else{ - hasRowHeader = false; - } - - let hasRowFooter; - if($(this).is(":checked")){ - hasRowFooter = true; - } - else{ - hasRowFooter = false; - } - - _this.checkboxChange(hasRowHeader, hasRowFooter); - _this.modelboxOn(); - _this.update(); - }); - - //点击样式模板 - $(document).off("click.AFmodelbox").on("click.AFmodelbox", "#luckysheet-modal-dialog-slider-alternateformat .modelbox", function(){ - let index = $(this).index(); - let $id = $(this).parents(".cf").attr("id"); - - if($id == "luckysheet-alternateformat-modelList"){ - _this.modelfocusIndex = index; - } - else if($id == "luckysheet-alternateformat-modelCustom"){ - let len = _this.FixedModelColor.length; - _this.modelfocusIndex = index + len; - } - - _this.modelboxOn(); - _this.update(); - }); - - //点击选择文本/单元格颜色 - $(document).off("click.AFselectColor").on("click.AFselectColor", "#luckysheet-modal-dialog-slider-alternateformat .luckysheet-color-menu-button-indicator", function(){ - let $parent = $(this).closest(".toningbox"); - - let colorType, currenColor; - if($(this).find(".luckysheet-icon-img").hasClass("luckysheet-icon-text-color")){ - colorType = "fc"; - currenColor = $parent.find(".toningShow").data("fc"); - } - else if($(this).find(".luckysheet-icon-img").hasClass("luckysheet-icon-cell-color")){ - colorType = "bc"; - currenColor = $parent.find(".toningShow").data("bc"); - } - - //source - let source; - if($parent.hasClass("header")){ - source = "0"; - } - else if($parent.hasClass("ctOne")){ - source = "1"; - } - else if($parent.hasClass("ctTwo")){ - source = "2"; - } - else if($parent.hasClass("footer")){ - source = "3"; - } - - _this.colorSelectDialog(currenColor, colorType, source); - }); - - //选择颜色 确定 添加自定义模板 - $(document).off("click.AFselectColorConfirm").on("click.AFselectColorConfirm", "#luckysheet-alternateformat-colorSelect-dialog-confirm", function(){ - let $parent = $(this).parents("#luckysheet-alternateformat-colorSelect-dialog"); - const _locale = locale() - const alternatingColors =_locale.alternatingColors; - $("#luckysheet-modal-dialog-mask").hide(); - $parent.hide(); - - //获取currenColor colorType source - let currenColor = $parent.find(".currenColor span").attr("title"); - - let colorType; - if($parent.find(".luckysheet-modal-dialog-title-text").text() == alternatingColors.selectionTextColor){ - colorType = "fc"; - } - else if($parent.find(".luckysheet-modal-dialog-title-text").text() == alternatingColors.selectionCellColor){ - colorType = "bc"; - } - - let source = $parent.find(".currenColor").attr("data-source"); - - //赋给颜色 - if(source == "0"){ - if(colorType == "fc"){ - $("#luckysheet-alternateformat-modelToning .header .toningShow").css("color", currenColor); - $("#luckysheet-alternateformat-modelToning .header .toningShow").data("fc", currenColor); - $("#luckysheet-alternateformat-modelToning .header .luckysheet-icon-text-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", currenColor); - } - if(colorType == "bc"){ - $("#luckysheet-alternateformat-modelToning .header .toningShow").css("background-color", currenColor); - $("#luckysheet-alternateformat-modelToning .header .toningShow").data("bc", currenColor); - $("#luckysheet-alternateformat-modelToning .header .luckysheet-icon-cell-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", currenColor); - } - } - else if(source == "1"){ - if(colorType == "fc"){ - $("#luckysheet-alternateformat-modelToning .ctOne .toningShow").css("color", currenColor); - $("#luckysheet-alternateformat-modelToning .ctOne .toningShow").data("fc", currenColor); - $("#luckysheet-alternateformat-modelToning .ctOne .luckysheet-icon-text-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", currenColor); - } - if(colorType == "bc"){ - $("#luckysheet-alternateformat-modelToning .ctOne .toningShow").css("background-color", currenColor); - $("#luckysheet-alternateformat-modelToning .ctOne .toningShow").data("bc", currenColor); - $("#luckysheet-alternateformat-modelToning .ctOne .luckysheet-icon-cell-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", currenColor); - } - } - else if(source == "2"){ - if(colorType == "fc"){ - $("#luckysheet-alternateformat-modelToning .ctTwo .toningShow").css("color", currenColor); - $("#luckysheet-alternateformat-modelToning .ctTwo .toningShow").data("fc", currenColor); - $("#luckysheet-alternateformat-modelToning .ctTwo .luckysheet-icon-text-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", currenColor); - } - if(colorType == "bc"){ - $("#luckysheet-alternateformat-modelToning .ctTwo .toningShow").css("background-color", currenColor); - $("#luckysheet-alternateformat-modelToning .ctTwo .toningShow").data("bc", currenColor); - $("#luckysheet-alternateformat-modelToning .ctTwo .luckysheet-icon-cell-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", currenColor); - } - } - else if(source == "3"){ - if(colorType == "fc"){ - $("#luckysheet-alternateformat-modelToning .footer .toningShow").css("color", currenColor); - $("#luckysheet-alternateformat-modelToning .footer .toningShow").data("fc", currenColor); - $("#luckysheet-alternateformat-modelToning .footer .luckysheet-icon-text-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", currenColor); - } - if(colorType == "bc"){ - $("#luckysheet-alternateformat-modelToning .footer .toningShow").css("background-color", currenColor); - $("#luckysheet-alternateformat-modelToning .footer .toningShow").data("bc", currenColor); - $("#luckysheet-alternateformat-modelToning .footer .luckysheet-icon-cell-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", currenColor); - } - } - - //若模板聚焦在固有模板,则新加模板;若模板聚焦在自定义模板,则修改该模板 - let hasRowHeader; - if($("#luckysheet-alternateformat-rowHeader").is(":checked")){ - hasRowHeader = true; - } - else{ - hasRowHeader = false; - } - - let hasRowFooter; - if($("#luckysheet-alternateformat-rowFooter").is(":checked")){ - hasRowFooter = true; - } - else{ - hasRowFooter = false; - } - - let index = _this.modelfocusIndex; - let len = _this.FixedModelColor.length; - - let format, file; - if(index < len){ - format = $.extend(true, {}, _this.getFormatByIndex()); - } - else{ - file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]; - let modelCustom = file["luckysheet_alternateformat_save_modelCustom"]; - - format = $.extend(true, {}, modelCustom[index - len]); - } - - if(source == "0"){ - if(colorType == "fc"){ - format["head"]["fc"] = currenColor; - } - else if(colorType == "bc"){ - format["head"]["bc"] = currenColor; - } - } - else if(source == "1"){ - if(colorType == "fc"){ - format["one"]["fc"] = currenColor; - } - else if(colorType == "bc"){ - format["one"]["bc"] = currenColor; - } - } - else if(source == "2"){ - if(colorType == "fc"){ - format["two"]["fc"] = currenColor; - } - else if(colorType == "bc"){ - format["two"]["bc"] = currenColor; - } - } - else if(source == "3"){ - if(colorType == "fc"){ - format["foot"]["fc"] = currenColor; - } - if(colorType == "bc"){ - format["foot"]["bc"] = currenColor; - } - } - - if(_this.modelfocusIndex < len){ - _this.addCustomModel(format); - _this.modelfocusIndex = _this.getIndexByFormat(format); - } - else{ - file["luckysheet_alternateformat_save_modelCustom"][index - len] = format; - - if(server.allowUpdate){ - server.saveParam("all", Store.currentSheetIndex, file["luckysheet_alternateformat_save_modelCustom"], { "k": "luckysheet_alternateformat_save_modelCustom" }); - } - } - - _this.getModelBox(hasRowHeader, hasRowFooter); - _this.modelboxOn(); - _this.update(); - }); - - //点击 移除交替颜色 按钮 - $(document).off("click.AFremove").on("click.AFremove", "#luckysheet-alternateformat-remove", function(){ - let dataIndex = $(this).data("index"); - - let file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]; - - let ruleArr = file["luckysheet_alternateformat_save"]; - - //保存之前的规则 - let historyRules = $.extend(true, [], ruleArr); - - //保存当前的规则 - if(ruleArr.length > 1){ - ruleArr.splice(dataIndex, 1); - } - else{ - ruleArr = []; - } - - let currentRules = $.extend(true, [], ruleArr); - - //刷新一次表格 - _this.ref(historyRules, currentRules); - - if(server.allowUpdate){ - server.saveParam("all", Store.currentSheetIndex, ruleArr, { "k": "luckysheet_alternateformat_save" }); - } - - //隐藏一些dom - $("#luckysheet-modal-dialog-mask").hide(); - $("#luckysheet-modal-dialog-slider-alternateformat").hide(); - - luckysheetsizeauto(); - }); - }, - perfect: function(){ - let _this = this; - - let range = $.extend(true, {}, Store.luckysheet_select_save[0]); - let existsIndex = _this.rangeIsExists(range)[1]; - - let obj = $.extend(true, {}, Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["luckysheet_alternateformat_save"][existsIndex]); - - //应用范围 - let cellrange = obj["cellrange"]; - $("#luckysheet-alternateformat-range input").val(getRangetxt(Store.currentSheetIndex, { "row": cellrange["row"], "column": cellrange["column"] }, Store.currentSheetIndex)); - - Store.luckysheet_select_save = [{ "row": cellrange["row"], "column": cellrange["column"] }]; - selectHightlightShow(); - - //页眉、页脚 - let hasRowHeader = obj["hasRowHeader"]; - let hasRowFooter = obj["hasRowFooter"]; - - //模板聚焦 - let format = obj["format"]; - _this.modelfocusIndex = _this.getIndexByFormat(format); - - if(_this.modelfocusIndex == null){ - _this.addCustomModel(format); - _this.modelfocusIndex = _this.getIndexByFormat(format); - } - - _this.checkboxChange(hasRowHeader, hasRowFooter); - _this.modelboxOn(); - - //标识 交替颜色的index - $("#luckysheet-alternateformat-remove").data("index", existsIndex); - }, - checkboxChange: function(hasRowHeader, hasRowFooter){ - if(hasRowHeader){ - $("#luckysheet-alternateformat-rowHeader").prop("checked", true); - $("#luckysheet-alternateformat-modelToning .header").show(); - } - else{ - $("#luckysheet-alternateformat-rowHeader").removeAttr("checked"); - $("#luckysheet-alternateformat-modelToning .header").hide(); - } - - if(hasRowFooter){ - $("#luckysheet-alternateformat-rowFooter").prop("checked", true); - $("#luckysheet-alternateformat-modelToning .footer").show(); - } - else{ - $("#luckysheet-alternateformat-rowFooter").removeAttr("checked"); - $("#luckysheet-alternateformat-modelToning .footer").hide(); - } - - this.getModelBox(hasRowHeader, hasRowFooter); - }, - modelboxOn: function(){ - let _this = this; - - //模板 foucs - $("#luckysheet-modal-dialog-slider-alternateformat .modelbox").removeClass("on"); - - let index = _this.modelfocusIndex; - let len = _this.FixedModelColor.length; - - if(index < len){ - $("#luckysheet-alternateformat-modelList .modelbox").eq(index).addClass("on"); - } - else{ - $("#luckysheet-alternateformat-modelCustom .modelbox").eq(index - len).addClass("on"); - } - - //编辑 对应颜色改变 - _this.modelToningColor(); - }, - modelToningColor: function(){ - let format = this.getFormatByIndex(); - - //页眉 - $("#luckysheet-alternateformat-modelToning .header .toningShow").css({"color": format["head"].fc, "background-color": format["head"].bc}); - $("#luckysheet-alternateformat-modelToning .header .toningShow").data("fc", format["head"].fc).data("bc", format["head"].bc); - $("#luckysheet-alternateformat-modelToning .header .luckysheet-icon-text-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", format["head"].fc); - $("#luckysheet-alternateformat-modelToning .header .luckysheet-icon-cell-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", format["head"].bc); - - //颜色1 - $("#luckysheet-alternateformat-modelToning .ctOne .toningShow").css({"color": format["one"].fc, "background-color": format["one"].bc}); - $("#luckysheet-alternateformat-modelToning .ctOne .toningShow").data("fc", format["one"].fc).data("bc", format["one"].bc); - $("#luckysheet-alternateformat-modelToning .ctOne .luckysheet-icon-text-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", format["one"].fc); - $("#luckysheet-alternateformat-modelToning .ctOne .luckysheet-icon-cell-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", format["one"].bc); - - //颜色2 - $("#luckysheet-alternateformat-modelToning .ctTwo .toningShow").css({"color": format["two"].fc, "background-color": format["two"].bc}); - $("#luckysheet-alternateformat-modelToning .ctTwo .toningShow").data("fc", format["two"].fc).data("bc", format["two"].bc); - $("#luckysheet-alternateformat-modelToning .ctTwo .luckysheet-icon-text-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", format["two"].fc); - $("#luckysheet-alternateformat-modelToning .ctTwo .luckysheet-icon-cell-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", format["two"].bc); - - //页脚 - $("#luckysheet-alternateformat-modelToning .footer .toningShow").css({"color": format["foot"].fc, "background-color": format["foot"].bc}); - $("#luckysheet-alternateformat-modelToning .footer .toningShow").data("fc", format["foot"].fc).data("bc", format["foot"].bc); - $("#luckysheet-alternateformat-modelToning .footer .luckysheet-icon-text-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", format["foot"].fc); - $("#luckysheet-alternateformat-modelToning .footer .luckysheet-icon-cell-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", format["foot"].bc); - }, - addCustomModel: function(format){ - let file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]; - - if(file["luckysheet_alternateformat_save_modelCustom"] == null){ - file["luckysheet_alternateformat_save_modelCustom"] = []; - } - - file["luckysheet_alternateformat_save_modelCustom"].push(format); - - if(server.allowUpdate){ - server.saveParam("all", Store.currentSheetIndex, file["luckysheet_alternateformat_save_modelCustom"], { "k": "luckysheet_alternateformat_save_modelCustom" }); - } - }, - colorSelectDialog: function(currenColor, colorType, source){ - $("#luckysheet-modal-dialog-mask").show(); - $("#luckysheet-alternateformat-colorSelect-dialog").remove(); - - const _locale = locale() - const alternatingColors =_locale.alternatingColors; - const locale_button = _locale.button; - const locale_toolbar = _locale.toolbar; - - let title; - if(colorType == "fc"){ - title = alternatingColors.selectionTextColor; - } - else if(colorType == "bc"){ - title = alternatingColors.selectionCellColor; - } - - $("body").append(replaceHtml(modelHTML, { - "id": "luckysheet-alternateformat-colorSelect-dialog", - "addclass": "luckysheet-alternateformat-colorSelect-dialog", - "title": title, - "content": "
"+ alternatingColors.currentColor +":
", - "botton": '', - "style": "z-index:100003" - })); - let $t = $("#luckysheet-alternateformat-colorSelect-dialog") - .find(".luckysheet-modal-dialog-content") - .css("min-width", 300) - .end(), - myh = $t.outerHeight(), - myw = $t.outerWidth(); - let winw = $(window).width(), winh = $(window).height(); - let scrollLeft = $(document).scrollLeft(), scrollTop = $(document).scrollTop(); - $("#luckysheet-alternateformat-colorSelect-dialog").css({ - "left": (winw + scrollLeft - myw) / 2, - "top": (winh + scrollTop - myh) / 3 - }).show(); - - //初始化选择颜色插件 - $("#luckysheet-alternateformat-colorSelect-dialog").find(".colorshowbox").spectrum({ - showPalette: true, - showPaletteOnly: true, - preferredFormat: "hex", - clickoutFiresChange: false, - showInitial: true, - showInput: true, - flat: true, - hideAfterPaletteSelect: true, - showSelectionPalette: true, - showButtons: false,//隐藏选择取消按钮 - maxPaletteSize: 8, - maxSelectionSize: 8, - color: currenColor, - cancelText: locale_button.cancel, - chooseText: locale_toolbar.confirmColor, - togglePaletteMoreText: locale_toolbar.customColor, - togglePaletteLessText: locale_toolbar.collapse, - togglePaletteOnly: true, - clearText: locale_toolbar.clearText, - noColorSelectedText: locale_toolbar.noColorSelectedText, - localStorageKey: "spectrum.textcolor" + server.gridKey, - palette: [ - ["#000", "#444", "#666", "#999", "#ccc", "#eee", "#f3f3f3", "#fff"], - ["#f00", "#f90", "#ff0", "#0f0", "#0ff", "#00f", "#90f", "#f0f"], - ["#f4cccc", "#fce5cd", "#fff2cc", "#d9ead3", "#d0e0e3", "#cfe2f3", "#d9d2e9", "#ead1dc"], - ["#ea9999", "#f9cb9c", "#ffe599", "#b6d7a8", "#a2c4c9", "#9fc5e8", "#b4a7d6", "#d5a6bd"], - ["#e06666", "#f6b26b", "#ffd966", "#93c47d", "#76a5af", "#6fa8dc", "#8e7cc3", "#c27ba0"], - ["#c00", "#e69138", "#f1c232", "#6aa84f", "#45818e", "#3d85c6", "#674ea7", "#a64d79"], - ["#900", "#b45f06", "#bf9000", "#38761d", "#134f5c", "#0b5394", "#351c75", "#741b47"], - ["#600", "#783f04", "#7f6000", "#274e13", "#0c343d", "#073763", "#20124d", "#4c1130"] - ], - move: function(color){ - if (color != null) { - color = color.toHexString(); - } - else { - color = "#000"; - } - - $("#luckysheet-alternateformat-colorSelect-dialog .currenColor span").css("background-color", color).attr("title", color); - } - }); - }, - rangeDialog: function(value){ - $("#luckysheet-modal-dialog-mask").hide(); - $("#luckysheet-alternateformat-rangeDialog").remove(); - - const _locale = locale() - const alternatingColors =_locale.alternatingColors; - const locale_button = _locale.button; - - $("body").append(replaceHtml(modelHTML, { - "id": "luckysheet-alternateformat-rangeDialog", - "addclass": "luckysheet-alternateformat-rangeDialog", - "title": alternatingColors.selectRange, - "content": '', - "botton": '', - "style": "z-index:100003" - })); - let $t = $("#luckysheet-alternateformat-rangeDialog") - .find(".luckysheet-modal-dialog-content") - .css("min-width", 300) - .end(), - myh = $t.outerHeight(), - myw = $t.outerWidth(); - let winw = $(window).width(), winh = $(window).height(); - let scrollLeft = $(document).scrollLeft(), scrollTop = $(document).scrollTop(); - $("#luckysheet-alternateformat-rangeDialog").css({ - "left": (winw + scrollLeft - myw) / 2, - "top": (winh + scrollTop - myh) / 3 - }).show(); - }, - rangeIsExists: function(range, index){ - let _this = this; - - let isExists = false; - let existsIndex = null; - - //获取已有交替颜色所有应用范围 - let AFarr = $.extend(true, [], Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["luckysheet_alternateformat_save"]); - - if(index != undefined && index != null){ - if(AFarr.length > 1){ - AFarr.splice(index, 1); - } - else{ - AFarr = []; - } - } - - if(AFarr.length > 0){ - let arr = []; - for(let i = 0; i < AFarr.length; i++){ - let obj = { - "index": i, - "map": _this.getRangeMap(AFarr[i]["cellrange"]["row"], AFarr[i]["cellrange"]["column"]) - } - - arr.push(obj); - } - - //获取当前选区 - let rangeMap = _this.getRangeMap(range["row"], range["column"]); - - //遍历 - for(let x in rangeMap){ - if(isExists){ - break; - } - - for(let j = 0; j < arr.length; j++){ - if(x in arr[j]["map"]){ - isExists = true; - existsIndex = arr[j]["index"]; - break; - } - } - } - } - - return [isExists, existsIndex]; - }, - getRangeMap: function(row, column){ - let map = {}; - let st_r = row[0], ed_r = row[1], st_c = column[0], ed_c = column[1]; - - for(let r = st_r; r <= ed_r; r++){ - for(let c = st_c; c <= ed_c; c++){ - map[r + "_" + c] = 0; - } - } - - return map; - }, - getIndexByFormat: function(format){ - let _this = this; - let index = null; - - //格式样式 模板 - let modelList = _this.FixedModelColor; - for(let i = 0; i < modelList.length; i++){ - let obj = modelList[i]; - - if(format["head"].fc == obj["head"].fc && format["head"].bc == obj["head"].bc){ - if(format["one"].fc == obj["one"].fc && format["one"].bc == obj["one"].bc){ - if(format["two"].fc == obj["two"].fc && format["two"].bc == obj["two"].bc){ - if(format["foot"].fc == obj["foot"].fc && format["foot"].bc == obj["foot"].bc){ - index = i; - break; - } - } - } - } - } - - //自定义 模板 - let modelCustom = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["luckysheet_alternateformat_save_modelCustom"]; - if(modelCustom != null && modelCustom.length > 0){ - for(let j = 0; j < modelCustom.length; j++){ - let obj = modelCustom[j]; - - if(format["head"].fc == obj["head"].fc && format["head"].bc == obj["head"].bc){ - if(format["one"].fc == obj["one"].fc && format["one"].bc == obj["one"].bc){ - if(format["two"].fc == obj["two"].fc && format["two"].bc == obj["two"].bc){ - if(format["foot"].fc == obj["foot"].fc && format["foot"].bc == obj["foot"].bc){ - index = modelList.length + j; - break; - } - } - } - } - } - } - - return index; - }, - getFormatByIndex: function(){ - let _this = this; - - let index = _this.modelfocusIndex; - let len = _this.FixedModelColor.length; - - let format = {}; - - if(index < len){ - format = _this.FixedModelColor[index]; - } - else{ - format = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["luckysheet_alternateformat_save_modelCustom"][index - len]; - } - - return format; - }, - new: function(cellrange){ - let _this = this; - - let format = _this.getFormatByIndex(); - - let file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]; - let ruleArr = file["luckysheet_alternateformat_save"]; - - if(ruleArr == null){ - ruleArr = []; - } - - //保存之前的规则 - let historyRules = $.extend(true, [], ruleArr); - - //保存当前的规则 - let obj = { - "cellrange": { - "row": cellrange["row"], - "column": cellrange["column"] - }, - "format": format, - "hasRowHeader": true, - "hasRowFooter": false - } - - ruleArr.push(obj); - - let currentRules = $.extend(true, [], ruleArr); - - //刷新一次表格 - _this.ref(historyRules, currentRules); - - if(server.allowUpdate){ - server.saveParam("all", Store.currentSheetIndex, ruleArr, { "k": "luckysheet_alternateformat_save" }); - } - }, - update: function(){ - let _this = this; - const _locale = locale() - const alternatingColors =_locale.alternatingColors; - //获取标识 - let dataIndex = $("#luckysheet-alternateformat-remove").data("index"); - - //应用范围 - let rangeValue = $("#luckysheet-modal-dialog-slider-alternateformat #luckysheet-alternateformat-range input").val().trim(); - - if(!formula.iscelldata(rangeValue)){ - if(isEditMode()){ - alert(alternatingColors.errorNoRange); - } - else{ - tooltip.info(alternatingColors.errorNoRange, ""); - } - - return; - } - - let cellrange = formula.getcellrange(rangeValue); - let isExists = _this.rangeIsExists(cellrange, dataIndex)[0]; - - if(isExists){ - if(isEditMode()){ - alert(alternatingColors.errorExistColors); - } - else{ - tooltip.info(alternatingColors.errorExistColors, ""); - } - - return; - } - - //页眉、页脚 - let hasRowHeader; - if($("#luckysheet-modal-dialog-slider-alternateformat #luckysheet-alternateformat-rowHeader").is(":checked")){ - hasRowHeader = true; - } - else{ - hasRowHeader = false; - } - - let hasRowFooter; - if($("#luckysheet-modal-dialog-slider-alternateformat #luckysheet-alternateformat-rowFooter").is(":checked")){ - hasRowFooter = true; - } - else{ - hasRowFooter = false; - } - - //获取选中样式模板的颜色 - let format = _this.getFormatByIndex(); - let file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]; - - let ruleArr = file["luckysheet_alternateformat_save"]; - if(ruleArr == null){ - ruleArr = []; - } - - //保存之前的规则 - let historyRules = $.extend(true, [], ruleArr); - - //保存当前的规则 - let obj = { - "cellrange": { - "row": cellrange["row"], - "column": cellrange["column"] - }, - "format": format, - "hasRowHeader": hasRowHeader, - "hasRowFooter": hasRowFooter - } - - ruleArr[dataIndex] = obj; - - let currentRules = $.extend(true, [], ruleArr); - - //刷新一次表格 - _this.ref(historyRules, currentRules); - - if(server.allowUpdate){ - server.saveParam("all", Store.currentSheetIndex, ruleArr, { "k": "luckysheet_alternateformat_save" }); - } - }, - checksAF: function(r, c, computeMap){ - if((r + "_" + c) in computeMap){ - //返回值(fc bc) - return computeMap[r + "_" + c]; - } - else{ - return null; - } - }, - getComputeMap: function(){ - let file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]; - let ruleArr = file["luckysheet_alternateformat_save"]; - - let computeMap = this.compute(ruleArr); - - return computeMap; - }, - compute: function(obj){ - //计算存储 - let computeMap = {}; - - if(obj != null && obj.length > 0){ - for(let i = 0; i < obj.length; i++){ - let cellrange = obj[i]["cellrange"]; - let format = obj[i]["format"]; - let hasRowHeader = obj[i]["hasRowHeader"]; - let hasRowFooter = obj[i]["hasRowFooter"]; - let st_r = cellrange["row"][0], - ed_r = cellrange["row"][1], - st_c = cellrange["column"][0], - ed_c = cellrange["column"][1]; - - if(hasRowHeader && hasRowFooter){ - //页眉所在行 - for(let c = st_c; c <= ed_c; c++){ - computeMap[st_r + "_" + c] = [format["head"].fc, format["head"].bc]; - } - - //中间行 - if(ed_r - st_r > 1){ - for(let r = st_r + 1; r < ed_r; r++){ - let fc, bc; - if((r - st_r) % 2 != 0){ - fc = format["one"].fc; - bc = format["one"].bc; - } - else{ - fc = format["two"].fc; - bc = format["two"].bc; - } - - for(let c = st_c; c <= ed_c; c++){ - computeMap[r + "_" + c] = [fc, bc]; - } - } - } - - //页脚所在行 - if(ed_r > st_r){ - for(let c = st_c; c <= ed_c; c++){ - computeMap[ed_r + "_" + c] = [format["foot"].fc, format["foot"].bc]; - } - } - } - else if(hasRowHeader){ - //页眉所在行 - for(let c = st_c; c <= ed_c; c++){ - computeMap[st_r + "_" + c] = [format["head"].fc, format["head"].bc]; - } - - //中间行 - if(ed_r > st_r){ - for(let r = st_r + 1; r <= ed_r; r++){ - let fc, bc; - if((r - st_r) % 2 != 0){ - fc = format["one"].fc; - bc = format["one"].bc; - } - else{ - fc = format["two"].fc; - bc = format["two"].bc; - } - - for(let c = st_c; c <= ed_c; c++){ - computeMap[r + "_" + c] = [fc, bc]; - } - } - } - } - else if(hasRowFooter){ - //中间行 - if(ed_r > st_r){ - for(let r = st_r; r < ed_r; r++){ - let fc, bc; - if((r - st_r) % 2 == 0){ - fc = format["one"].fc; - bc = format["one"].bc; - } - else{ - fc = format["two"].fc; - bc = format["two"].bc; - } - - for(let c = st_c; c <= ed_c; c++){ - computeMap[r + "_" + c] = [fc, bc]; - } - } - } - - //页脚所在行 - for(let c = st_c; c <= ed_c; c++){ - computeMap[ed_r + "_" + c] = [format["foot"].fc, format["foot"].bc]; - } - } - else{ - //中间行 - for(let r = st_r; r <= ed_r; r++){ - let fc, bc; - if((r - st_r) % 2 == 0){ - fc = format["one"].fc; - bc = format["one"].bc; - } - else{ - fc = format["two"].fc; - bc = format["two"].bc; - } - - for(let c = st_c; c <= ed_c; c++){ - computeMap[r + "_" + c] = [fc, bc]; - } - } - } - } - } - - return computeMap; - }, - ref: function(historyRules, currentRules){ - if (Store.clearjfundo) { - Store.jfundo.length = 0; - - let redo = {}; - redo["type"] = "updateAF"; - redo["sheetIndex"] = Store.currentSheetIndex; - redo["data"] = {"historyRules": historyRules, "currentRules": currentRules}; - Store.jfredo.push(redo); - } - - let index = getSheetIndex(Store.currentSheetIndex); - Store.luckysheetfile[index]["luckysheet_alternateformat_save"] = currentRules; - - setTimeout(function () { - luckysheetrefreshgrid(); - }, 1); - } -} - + +import { getSheetIndex, getRangetxt } from '../methods/get'; +import { replaceHtml } from '../utils/util'; +import formula from '../global/formula'; +import { isEditMode } from '../global/validate'; +import tooltip from '../global/tooltip'; +import { luckysheetrefreshgrid } from '../global/refresh'; +import { luckysheetAlternateformatHtml, modelHTML } from './constant'; +import luckysheetsizeauto from './resize'; +import server from './server'; +import { selectHightlightShow } from './select'; +import Store from '../store'; +import locale from '../locale/locale'; + +//交替颜色 +const alternateformat = { + rangefocus: false, + modelfocusIndex: null, + FixedModelColor: [ + { + "head": { "fc": "#000", "bc": "#bfbdbe" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#f8f3f7" }, + "foot": { "fc": "#000", "bc": "#dde2de" } + }, + { + "head": { "fc": "#000", "bc": "#4bd4e7" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#eaf7ff" }, + "foot": { "fc": "#000", "bc": "#aae9f8" } + }, + { + "head": { "fc": "#000", "bc": "#5ed593" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#e5fbee" }, + "foot": { "fc": "#000", "bc": "#a5efcc" } + }, + { + "head": { "fc": "#000", "bc": "#f6cb4b" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#fff9e7" }, + "foot": { "fc": "#000", "bc": "#ffebac" } + }, + { + "head": { "fc": "#000", "bc": "#f96420" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#ffe5d9" }, + "foot": { "fc": "#000", "bc": "#ffcfba" } + }, + { + "head": { "fc": "#000", "bc": "#5599fc" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#ecf2fe" }, + "foot": { "fc": "#000", "bc": "#afcbfa" } + }, + { + "head": { "fc": "#000", "bc": "#22a69b" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#dff2f8" }, + "foot": { "fc": "#000", "bc": "#8dd4d0" } + }, + { + "head": { "fc": "#000", "bc": "#7a939a" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#f0eff7" }, + "foot": { "fc": "#000", "bc": "#bdcad0" } + }, + { + "head": { "fc": "#000", "bc": "#d7a270" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#fdf3f1" }, + "foot": { "fc": "#000", "bc": "#ead2b6" } + }, + { + "head": { "fc": "#000", "bc": "#89c54b" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#f1f7e9" }, + "foot": { "fc": "#000", "bc": "#c5e3a7" } + }, + { + "head": { "fc": "#000", "bc": "#8f88f0" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#f0e5ff" }, + "foot": { "fc": "#000", "bc": "#c6c4f6" } + }, + { + "head": { "fc": "#000", "bc": "#fd1664" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#feddee" }, + "foot": { "fc": "#000", "bc": "#f98ab5" } + }, + { + "head": { "fc": "#000", "bc": "#da96d3" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#fce8fb" }, + "foot": { "fc": "#000", "bc": "#f2caee" } + }, + { + "head": { "fc": "#000", "bc": "#b49191" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#f5ebe8" }, + "foot": { "fc": "#000", "bc": "#d8c3c3" } + }, + { + "head": { "fc": "#000", "bc": "#91b493" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#f0fbf0" }, + "foot": { "fc": "#000", "bc": "#b4cfb6" } + }, + { + "head": { "fc": "#000", "bc": "#b4a891" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#f8f6f1" }, + "foot": { "fc": "#000", "bc": "#d3cab8" } + }, + { + "head": { "fc": "#000", "bc": "#91abb4" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#eff7fa" }, + "foot": { "fc": "#000", "bc": "#b7cbd3" } + }, + { + "head": { "fc": "#000", "bc": "#b7ba82" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#fafbeb" }, + "foot": { "fc": "#000", "bc": "#dadcb4" } + }, + { + "head": { "fc": "#000", "bc": "#df3e3e" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#fde9e9" }, + "foot": { "fc": "#000", "bc": "#f89292" } + }, + { + "head": { "fc": "#000", "bc": "#f2711c" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#fef0d7" }, + "foot": { "fc": "#000", "bc": "#fbb335" } + }, + { + "head": { "fc": "#000", "bc": "#b5cc18" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#f9fbd4" }, + "foot": { "fc": "#000", "bc": "#e2ed2a" } + }, + { + "head": { "fc": "#000", "bc": "#00b5ad" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#ccfaf9" }, + "foot": { "fc": "#000", "bc": "#00e4df" } + }, + { + "head": { "fc": "#000", "bc": "#2185d0" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#d8f3fc" }, + "foot": { "fc": "#000", "bc": "#3cc4f0" } + }, + { + "head": { "fc": "#000", "bc": "#a5673f" }, + "one": { "fc": "#000", "bc": "#ffffff" }, + "two": { "fc": "#000", "bc": "#f6ede5" }, + "foot": { "fc": "#000", "bc": "#d3a47c" } + } + ], + getModelBox: function(hasRowHeader, hasRowFooter){ + let _this = this; + + $("#luckysheet-modal-dialog-slider-alternateformat #luckysheet-alternateformat-modelList").empty(); + $("#luckysheet-modal-dialog-slider-alternateformat #luckysheet-alternateformat-modelCustom").empty(); + + //格式样式 模板 + let modelListHtml = ''; + + for(let i = 0; i < _this.FixedModelColor.length; i++){ + let obj = _this.FixedModelColor[i]; + + let color1, color2, color3, color4; + + if(hasRowHeader && hasRowFooter){ + color1 = obj["head"]; + color2 = obj["one"]; + color3 = obj["two"]; + color4 = obj["foot"]; + } + else if(hasRowHeader){ + color1 = obj["head"]; + color2 = obj["one"]; + color3 = obj["two"]; + color4 = obj["one"]; + } + else if(hasRowFooter){ + color1 = obj["one"]; + color2 = obj["two"]; + color3 = obj["one"]; + color4 = obj["foot"]; + } + else{ + color1 = obj["one"]; + color2 = obj["two"]; + color3 = obj["one"]; + color4 = obj["two"]; + } + + modelListHtml += '
'+ + '
'+ + ''+ + ''+ + ''+ + ''+ + '
'+ + '
'; + } + + $("#luckysheet-modal-dialog-slider-alternateformat #luckysheet-alternateformat-modelList").append(modelListHtml); + + //自定义 模板 + let modelCustom = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["luckysheet_alternateformat_save_modelCustom"]; + if(modelCustom != null && modelCustom.length > 0){ + let modelCustomHtml = ''; + + for(let i = 0; i < modelCustom.length; i++){ + let obj = modelCustom[i]; + + let color1, color2, color3, color4; + + if(hasRowHeader && hasRowFooter){ + color1 = obj["head"]; + color2 = obj["one"]; + color3 = obj["two"]; + color4 = obj["foot"]; + } + else if(hasRowHeader){ + color1 = obj["head"]; + color2 = obj["one"]; + color3 = obj["two"]; + color4 = obj["one"]; + } + else if(hasRowFooter){ + color1 = obj["one"]; + color2 = obj["two"]; + color3 = obj["one"]; + color4 = obj["foot"]; + } + else{ + color1 = obj["one"]; + color2 = obj["two"]; + color3 = obj["one"]; + color4 = obj["two"]; + } + + modelCustomHtml += '
'+ + '
'+ + ''+ + ''+ + ''+ + ''+ + '
'+ + '
'; + } + + $("#luckysheet-modal-dialog-slider-alternateformat #luckysheet-alternateformat-modelCustom").append(modelCustomHtml); + } + }, + init: function(){ + let _this = this; + + $("#luckysheet-modal-dialog-slider-alternateformat").remove(); + $("body").append(luckysheetAlternateformatHtml()); + luckysheetsizeauto(); + + //关闭 + $("#luckysheet-modal-dialog-slider-alternateformat .luckysheet-model-close-btn").click(function () { + $("#luckysheet-modal-dialog-slider-alternateformat").hide(); + luckysheetsizeauto(); + }); + + //应用范围 + $(document).off("focus.AFrangeInput").on("focus.AFrangeInput", "#luckysheet-alternateformat-range input", function(){ + _this.rangefocus = true; + }); + $(document).off("blur.AFrangeInput").on("blur.AFrangeInput", "#luckysheet-alternateformat-range input", function(){ + _this.rangefocus = false; + }); + + $(document).off("keydown.AFrangeInput").on("keydown.AFrangeInput", "#luckysheet-alternateformat-range input", function(e){ + let rangeValue = $(this).val().trim(); + if(e.keyCode == 13){ + _this.update(); + } + }); + $(document).off("click.AFrangeIcon").on("click.AFrangeIcon", "#luckysheet-alternateformat-range .fa-table", function(){ + $("#luckysheet-modal-dialog-slider-alternateformat").hide(); + luckysheetsizeauto(); + + let rangeValue = $(this).parents("#luckysheet-alternateformat-range").find("input").val().trim(); + _this.rangeDialog(rangeValue); + }); + $(document).off("click.AFrDCf").on("click.AFrDCf", "#luckysheet-alternateformat-rangeDialog-confirm", function(){ + let rangeValue = $(this).parents("#luckysheet-alternateformat-rangeDialog").find("input").val().trim(); + $("#luckysheet-modal-dialog-slider-alternateformat #luckysheet-alternateformat-range input").val(rangeValue); + + $(this).parents("#luckysheet-alternateformat-rangeDialog").hide(); + $("#luckysheet-modal-dialog-slider-alternateformat").show(); + luckysheetsizeauto(); + + _this.update(); + }); + $(document).off("click.AFrDCl").on("click.AFrDCl", "#luckysheet-alternateformat-rangeDialog-close", function(){ + $(this).parents("#luckysheet-alternateformat-rangeDialog").hide(); + $("#luckysheet-modal-dialog-slider-alternateformat").show(); + luckysheetsizeauto(); + }); + $(document).off("click.AFrDTitle").on("click.AFrDTitle", "#luckysheet-alternateformat-rangeDialog .luckysheet-modal-dialog-title-close", function(){ + $(this).parents("#luckysheet-alternateformat-rangeDialog").hide(); + $("#luckysheet-modal-dialog-slider-alternateformat").show(); + luckysheetsizeauto(); + }); + + //页眉、页脚选中 + $(document).off("change.AFrowHeader").on("change.AFrowHeader", "#luckysheet-alternateformat-rowHeader", function(){ + let hasRowHeader; + if($(this).is(":checked")){ + hasRowHeader = true; + } + else{ + hasRowHeader = false; + } + + let hasRowFooter; + if($("#luckysheet-alternateformat-rowFooter").is(":checked")){ + hasRowFooter = true; + } + else{ + hasRowFooter = false; + } + + _this.checkboxChange(hasRowHeader, hasRowFooter); + _this.modelboxOn(); + _this.update(); + }); + $(document).off("change.AFrowFooter").on("change.AFrowFooter", "#luckysheet-alternateformat-rowFooter", function(){ + let hasRowHeader; + if($("#luckysheet-alternateformat-rowHeader").is(":checked")){ + hasRowHeader = true; + } + else{ + hasRowHeader = false; + } + + let hasRowFooter; + if($(this).is(":checked")){ + hasRowFooter = true; + } + else{ + hasRowFooter = false; + } + + _this.checkboxChange(hasRowHeader, hasRowFooter); + _this.modelboxOn(); + _this.update(); + }); + + //点击样式模板 + $(document).off("click.AFmodelbox").on("click.AFmodelbox", "#luckysheet-modal-dialog-slider-alternateformat .modelbox", function(){ + let index = $(this).index(); + let $id = $(this).parents(".cf").attr("id"); + + if($id == "luckysheet-alternateformat-modelList"){ + _this.modelfocusIndex = index; + } + else if($id == "luckysheet-alternateformat-modelCustom"){ + let len = _this.FixedModelColor.length; + _this.modelfocusIndex = index + len; + } + + _this.modelboxOn(); + _this.update(); + }); + + //点击选择文本/单元格颜色 + $(document).off("click.AFselectColor").on("click.AFselectColor", "#luckysheet-modal-dialog-slider-alternateformat .luckysheet-color-menu-button-indicator", function(){ + let $parent = $(this).closest(".toningbox"); + + let colorType, currenColor; + if($(this).find(".luckysheet-icon-img").hasClass("luckysheet-icon-text-color")){ + colorType = "fc"; + currenColor = $parent.find(".toningShow").data("fc"); + } + else if($(this).find(".luckysheet-icon-img").hasClass("luckysheet-icon-cell-color")){ + colorType = "bc"; + currenColor = $parent.find(".toningShow").data("bc"); + } + + //source + let source; + if($parent.hasClass("header")){ + source = "0"; + } + else if($parent.hasClass("ctOne")){ + source = "1"; + } + else if($parent.hasClass("ctTwo")){ + source = "2"; + } + else if($parent.hasClass("footer")){ + source = "3"; + } + + _this.colorSelectDialog(currenColor, colorType, source); + }); + + //选择颜色 确定 添加自定义模板 + $(document).off("click.AFselectColorConfirm").on("click.AFselectColorConfirm", "#luckysheet-alternateformat-colorSelect-dialog-confirm", function(){ + let $parent = $(this).parents("#luckysheet-alternateformat-colorSelect-dialog"); + const _locale = locale() + const alternatingColors =_locale.alternatingColors; + $("#luckysheet-modal-dialog-mask").hide(); + $parent.hide(); + + //获取currenColor colorType source + let currenColor = $parent.find(".currenColor span").attr("title"); + + let colorType; + if($parent.find(".luckysheet-modal-dialog-title-text").text() == alternatingColors.selectionTextColor){ + colorType = "fc"; + } + else if($parent.find(".luckysheet-modal-dialog-title-text").text() == alternatingColors.selectionCellColor){ + colorType = "bc"; + } + + let source = $parent.find(".currenColor").attr("data-source"); + + //赋给颜色 + if(source == "0"){ + if(colorType == "fc"){ + $("#luckysheet-alternateformat-modelToning .header .toningShow").css("color", currenColor); + $("#luckysheet-alternateformat-modelToning .header .toningShow").data("fc", currenColor); + $("#luckysheet-alternateformat-modelToning .header .luckysheet-icon-text-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", currenColor); + } + if(colorType == "bc"){ + $("#luckysheet-alternateformat-modelToning .header .toningShow").css("background-color", currenColor); + $("#luckysheet-alternateformat-modelToning .header .toningShow").data("bc", currenColor); + $("#luckysheet-alternateformat-modelToning .header .luckysheet-icon-cell-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", currenColor); + } + } + else if(source == "1"){ + if(colorType == "fc"){ + $("#luckysheet-alternateformat-modelToning .ctOne .toningShow").css("color", currenColor); + $("#luckysheet-alternateformat-modelToning .ctOne .toningShow").data("fc", currenColor); + $("#luckysheet-alternateformat-modelToning .ctOne .luckysheet-icon-text-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", currenColor); + } + if(colorType == "bc"){ + $("#luckysheet-alternateformat-modelToning .ctOne .toningShow").css("background-color", currenColor); + $("#luckysheet-alternateformat-modelToning .ctOne .toningShow").data("bc", currenColor); + $("#luckysheet-alternateformat-modelToning .ctOne .luckysheet-icon-cell-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", currenColor); + } + } + else if(source == "2"){ + if(colorType == "fc"){ + $("#luckysheet-alternateformat-modelToning .ctTwo .toningShow").css("color", currenColor); + $("#luckysheet-alternateformat-modelToning .ctTwo .toningShow").data("fc", currenColor); + $("#luckysheet-alternateformat-modelToning .ctTwo .luckysheet-icon-text-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", currenColor); + } + if(colorType == "bc"){ + $("#luckysheet-alternateformat-modelToning .ctTwo .toningShow").css("background-color", currenColor); + $("#luckysheet-alternateformat-modelToning .ctTwo .toningShow").data("bc", currenColor); + $("#luckysheet-alternateformat-modelToning .ctTwo .luckysheet-icon-cell-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", currenColor); + } + } + else if(source == "3"){ + if(colorType == "fc"){ + $("#luckysheet-alternateformat-modelToning .footer .toningShow").css("color", currenColor); + $("#luckysheet-alternateformat-modelToning .footer .toningShow").data("fc", currenColor); + $("#luckysheet-alternateformat-modelToning .footer .luckysheet-icon-text-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", currenColor); + } + if(colorType == "bc"){ + $("#luckysheet-alternateformat-modelToning .footer .toningShow").css("background-color", currenColor); + $("#luckysheet-alternateformat-modelToning .footer .toningShow").data("bc", currenColor); + $("#luckysheet-alternateformat-modelToning .footer .luckysheet-icon-cell-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", currenColor); + } + } + + //若模板聚焦在固有模板,则新加模板;若模板聚焦在自定义模板,则修改该模板 + let hasRowHeader; + if($("#luckysheet-alternateformat-rowHeader").is(":checked")){ + hasRowHeader = true; + } + else{ + hasRowHeader = false; + } + + let hasRowFooter; + if($("#luckysheet-alternateformat-rowFooter").is(":checked")){ + hasRowFooter = true; + } + else{ + hasRowFooter = false; + } + + let index = _this.modelfocusIndex; + let len = _this.FixedModelColor.length; + + let format, file; + if(index < len){ + format = $.extend(true, {}, _this.getFormatByIndex()); + } + else{ + file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]; + let modelCustom = file["luckysheet_alternateformat_save_modelCustom"]; + + format = $.extend(true, {}, modelCustom[index - len]); + } + + if(source == "0"){ + if(colorType == "fc"){ + format["head"]["fc"] = currenColor; + } + else if(colorType == "bc"){ + format["head"]["bc"] = currenColor; + } + } + else if(source == "1"){ + if(colorType == "fc"){ + format["one"]["fc"] = currenColor; + } + else if(colorType == "bc"){ + format["one"]["bc"] = currenColor; + } + } + else if(source == "2"){ + if(colorType == "fc"){ + format["two"]["fc"] = currenColor; + } + else if(colorType == "bc"){ + format["two"]["bc"] = currenColor; + } + } + else if(source == "3"){ + if(colorType == "fc"){ + format["foot"]["fc"] = currenColor; + } + if(colorType == "bc"){ + format["foot"]["bc"] = currenColor; + } + } + + if(_this.modelfocusIndex < len){ + _this.addCustomModel(format); + _this.modelfocusIndex = _this.getIndexByFormat(format); + } + else{ + file["luckysheet_alternateformat_save_modelCustom"][index - len] = format; + + if(server.allowUpdate){ + server.saveParam("all", Store.currentSheetIndex, file["luckysheet_alternateformat_save_modelCustom"], { "k": "luckysheet_alternateformat_save_modelCustom" }); + } + } + + _this.getModelBox(hasRowHeader, hasRowFooter); + _this.modelboxOn(); + _this.update(); + }); + + //点击 移除交替颜色 按钮 + $(document).off("click.AFremove").on("click.AFremove", "#luckysheet-alternateformat-remove", function(){ + let dataIndex = $(this).data("index"); + + let file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]; + + let ruleArr = file["luckysheet_alternateformat_save"]; + + //保存之前的规则 + let historyRules = $.extend(true, [], ruleArr); + + //保存当前的规则 + if(ruleArr.length > 1){ + ruleArr.splice(dataIndex, 1); + } + else{ + ruleArr = []; + } + + let currentRules = $.extend(true, [], ruleArr); + + //刷新一次表格 + _this.ref(historyRules, currentRules); + + if(server.allowUpdate){ + server.saveParam("all", Store.currentSheetIndex, ruleArr, { "k": "luckysheet_alternateformat_save" }); + } + + //隐藏一些dom + $("#luckysheet-modal-dialog-mask").hide(); + $("#luckysheet-modal-dialog-slider-alternateformat").hide(); + + luckysheetsizeauto(); + }); + }, + perfect: function(){ + let _this = this; + + let range = $.extend(true, {}, Store.luckysheet_select_save[0]); + let existsIndex = _this.rangeIsExists(range)[1]; + + let obj = $.extend(true, {}, Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["luckysheet_alternateformat_save"][existsIndex]); + + //应用范围 + let cellrange = obj["cellrange"]; + $("#luckysheet-alternateformat-range input").val(getRangetxt(Store.currentSheetIndex, { "row": cellrange["row"], "column": cellrange["column"] }, Store.currentSheetIndex)); + + Store.luckysheet_select_save = [{ "row": cellrange["row"], "column": cellrange["column"] }]; + selectHightlightShow(); + + //页眉、页脚 + let hasRowHeader = obj["hasRowHeader"]; + let hasRowFooter = obj["hasRowFooter"]; + + //模板聚焦 + let format = obj["format"]; + _this.modelfocusIndex = _this.getIndexByFormat(format); + + if(_this.modelfocusIndex == null){ + _this.addCustomModel(format); + _this.modelfocusIndex = _this.getIndexByFormat(format); + } + + _this.checkboxChange(hasRowHeader, hasRowFooter); + _this.modelboxOn(); + + //标识 交替颜色的index + $("#luckysheet-alternateformat-remove").data("index", existsIndex); + }, + checkboxChange: function(hasRowHeader, hasRowFooter){ + if(hasRowHeader){ + $("#luckysheet-alternateformat-rowHeader").prop("checked", true); + $("#luckysheet-alternateformat-modelToning .header").show(); + } + else{ + $("#luckysheet-alternateformat-rowHeader").removeAttr("checked"); + $("#luckysheet-alternateformat-modelToning .header").hide(); + } + + if(hasRowFooter){ + $("#luckysheet-alternateformat-rowFooter").prop("checked", true); + $("#luckysheet-alternateformat-modelToning .footer").show(); + } + else{ + $("#luckysheet-alternateformat-rowFooter").removeAttr("checked"); + $("#luckysheet-alternateformat-modelToning .footer").hide(); + } + + this.getModelBox(hasRowHeader, hasRowFooter); + }, + modelboxOn: function(){ + let _this = this; + + //模板 foucs + $("#luckysheet-modal-dialog-slider-alternateformat .modelbox").removeClass("on"); + + let index = _this.modelfocusIndex; + let len = _this.FixedModelColor.length; + + if(index < len){ + $("#luckysheet-alternateformat-modelList .modelbox").eq(index).addClass("on"); + } + else{ + $("#luckysheet-alternateformat-modelCustom .modelbox").eq(index - len).addClass("on"); + } + + //编辑 对应颜色改变 + _this.modelToningColor(); + }, + modelToningColor: function(){ + let format = this.getFormatByIndex(); + + //页眉 + $("#luckysheet-alternateformat-modelToning .header .toningShow").css({"color": format["head"].fc, "background-color": format["head"].bc}); + $("#luckysheet-alternateformat-modelToning .header .toningShow").data("fc", format["head"].fc).data("bc", format["head"].bc); + $("#luckysheet-alternateformat-modelToning .header .luckysheet-icon-text-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", format["head"].fc); + $("#luckysheet-alternateformat-modelToning .header .luckysheet-icon-cell-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", format["head"].bc); + + //颜色1 + $("#luckysheet-alternateformat-modelToning .ctOne .toningShow").css({"color": format["one"].fc, "background-color": format["one"].bc}); + $("#luckysheet-alternateformat-modelToning .ctOne .toningShow").data("fc", format["one"].fc).data("bc", format["one"].bc); + $("#luckysheet-alternateformat-modelToning .ctOne .luckysheet-icon-text-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", format["one"].fc); + $("#luckysheet-alternateformat-modelToning .ctOne .luckysheet-icon-cell-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", format["one"].bc); + + //颜色2 + $("#luckysheet-alternateformat-modelToning .ctTwo .toningShow").css({"color": format["two"].fc, "background-color": format["two"].bc}); + $("#luckysheet-alternateformat-modelToning .ctTwo .toningShow").data("fc", format["two"].fc).data("bc", format["two"].bc); + $("#luckysheet-alternateformat-modelToning .ctTwo .luckysheet-icon-text-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", format["two"].fc); + $("#luckysheet-alternateformat-modelToning .ctTwo .luckysheet-icon-cell-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", format["two"].bc); + + //页脚 + $("#luckysheet-alternateformat-modelToning .footer .toningShow").css({"color": format["foot"].fc, "background-color": format["foot"].bc}); + $("#luckysheet-alternateformat-modelToning .footer .toningShow").data("fc", format["foot"].fc).data("bc", format["foot"].bc); + $("#luckysheet-alternateformat-modelToning .footer .luckysheet-icon-text-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", format["foot"].fc); + $("#luckysheet-alternateformat-modelToning .footer .luckysheet-icon-cell-color").parents(".luckysheet-color-menu-button-indicator").css("border-bottom-color", format["foot"].bc); + }, + addCustomModel: function(format){ + let file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]; + + if(file["luckysheet_alternateformat_save_modelCustom"] == null){ + file["luckysheet_alternateformat_save_modelCustom"] = []; + } + + file["luckysheet_alternateformat_save_modelCustom"].push(format); + + if(server.allowUpdate){ + server.saveParam("all", Store.currentSheetIndex, file["luckysheet_alternateformat_save_modelCustom"], { "k": "luckysheet_alternateformat_save_modelCustom" }); + } + }, + colorSelectDialog: function(currenColor, colorType, source){ + $("#luckysheet-modal-dialog-mask").show(); + $("#luckysheet-alternateformat-colorSelect-dialog").remove(); + + const _locale = locale() + const alternatingColors =_locale.alternatingColors; + const locale_button = _locale.button; + const locale_toolbar = _locale.toolbar; + + let title; + if(colorType == "fc"){ + title = alternatingColors.selectionTextColor; + } + else if(colorType == "bc"){ + title = alternatingColors.selectionCellColor; + } + + $("body").append(replaceHtml(modelHTML, { + "id": "luckysheet-alternateformat-colorSelect-dialog", + "addclass": "luckysheet-alternateformat-colorSelect-dialog", + "title": title, + "content": "
"+ alternatingColors.currentColor +":
", + "botton": '', + "style": "z-index:100003" + })); + let $t = $("#luckysheet-alternateformat-colorSelect-dialog") + .find(".luckysheet-modal-dialog-content") + .css("min-width", 300) + .end(), + myh = $t.outerHeight(), + myw = $t.outerWidth(); + let winw = $(window).width(), winh = $(window).height(); + let scrollLeft = $(document).scrollLeft(), scrollTop = $(document).scrollTop(); + $("#luckysheet-alternateformat-colorSelect-dialog").css({ + "left": (winw + scrollLeft - myw) / 2, + "top": (winh + scrollTop - myh) / 3 + }).show(); + + //初始化选择颜色插件 + $("#luckysheet-alternateformat-colorSelect-dialog").find(".colorshowbox").spectrum({ + showPalette: true, + showPaletteOnly: true, + preferredFormat: "hex", + clickoutFiresChange: false, + showInitial: true, + showInput: true, + flat: true, + hideAfterPaletteSelect: true, + showSelectionPalette: true, + showButtons: false,//隐藏选择取消按钮 + maxPaletteSize: 8, + maxSelectionSize: 8, + color: currenColor, + cancelText: locale_button.cancel, + chooseText: locale_toolbar.confirmColor, + togglePaletteMoreText: locale_toolbar.customColor, + togglePaletteLessText: locale_toolbar.collapse, + togglePaletteOnly: true, + clearText: locale_toolbar.clearText, + noColorSelectedText: locale_toolbar.noColorSelectedText, + localStorageKey: "spectrum.textcolor" + server.gridKey, + palette: [ + ["#000", "#444", "#666", "#999", "#ccc", "#eee", "#f3f3f3", "#fff"], + ["#f00", "#f90", "#ff0", "#0f0", "#0ff", "#00f", "#90f", "#f0f"], + ["#f4cccc", "#fce5cd", "#fff2cc", "#d9ead3", "#d0e0e3", "#cfe2f3", "#d9d2e9", "#ead1dc"], + ["#ea9999", "#f9cb9c", "#ffe599", "#b6d7a8", "#a2c4c9", "#9fc5e8", "#b4a7d6", "#d5a6bd"], + ["#e06666", "#f6b26b", "#ffd966", "#93c47d", "#76a5af", "#6fa8dc", "#8e7cc3", "#c27ba0"], + ["#c00", "#e69138", "#f1c232", "#6aa84f", "#45818e", "#3d85c6", "#674ea7", "#a64d79"], + ["#900", "#b45f06", "#bf9000", "#38761d", "#134f5c", "#0b5394", "#351c75", "#741b47"], + ["#600", "#783f04", "#7f6000", "#274e13", "#0c343d", "#073763", "#20124d", "#4c1130"] + ], + move: function(color){ + if (color != null) { + color = color.toHexString(); + } + else { + color = "#000"; + } + + $("#luckysheet-alternateformat-colorSelect-dialog .currenColor span").css("background-color", color).attr("title", color); + } + }); + }, + rangeDialog: function(value){ + $("#luckysheet-modal-dialog-mask").hide(); + $("#luckysheet-alternateformat-rangeDialog").remove(); + + const _locale = locale() + const alternatingColors =_locale.alternatingColors; + const locale_button = _locale.button; + + $("body").append(replaceHtml(modelHTML, { + "id": "luckysheet-alternateformat-rangeDialog", + "addclass": "luckysheet-alternateformat-rangeDialog", + "title": alternatingColors.selectRange, + "content": '', + "botton": '', + "style": "z-index:100003" + })); + let $t = $("#luckysheet-alternateformat-rangeDialog") + .find(".luckysheet-modal-dialog-content") + .css("min-width", 300) + .end(), + myh = $t.outerHeight(), + myw = $t.outerWidth(); + let winw = $(window).width(), winh = $(window).height(); + let scrollLeft = $(document).scrollLeft(), scrollTop = $(document).scrollTop(); + $("#luckysheet-alternateformat-rangeDialog").css({ + "left": (winw + scrollLeft - myw) / 2, + "top": (winh + scrollTop - myh) / 3 + }).show(); + }, + rangeIsExists: function(range, index){ + let _this = this; + + let isExists = false; + let existsIndex = null; + + //获取已有交替颜色所有应用范围 + let AFarr = $.extend(true, [], Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["luckysheet_alternateformat_save"]); + + if(index != undefined && index != null){ + if(AFarr.length > 1){ + AFarr.splice(index, 1); + } + else{ + AFarr = []; + } + } + + if(AFarr.length > 0){ + let arr = []; + for(let i = 0; i < AFarr.length; i++){ + let obj = { + "index": i, + "map": _this.getRangeMap(AFarr[i]["cellrange"]["row"], AFarr[i]["cellrange"]["column"]) + } + + arr.push(obj); + } + + //获取当前选区 + let rangeMap = _this.getRangeMap(range["row"], range["column"]); + + //遍历 + for(let x in rangeMap){ + if(isExists){ + break; + } + + for(let j = 0; j < arr.length; j++){ + if(x in arr[j]["map"]){ + isExists = true; + existsIndex = arr[j]["index"]; + break; + } + } + } + } + + return [isExists, existsIndex]; + }, + getRangeMap: function(row, column){ + let map = {}; + let st_r = row[0], ed_r = row[1], st_c = column[0], ed_c = column[1]; + + for(let r = st_r; r <= ed_r; r++){ + for(let c = st_c; c <= ed_c; c++){ + map[r + "_" + c] = 0; + } + } + + return map; + }, + getIndexByFormat: function(format){ + let _this = this; + let index = null; + + //格式样式 模板 + let modelList = _this.FixedModelColor; + for(let i = 0; i < modelList.length; i++){ + let obj = modelList[i]; + + if(format["head"].fc == obj["head"].fc && format["head"].bc == obj["head"].bc){ + if(format["one"].fc == obj["one"].fc && format["one"].bc == obj["one"].bc){ + if(format["two"].fc == obj["two"].fc && format["two"].bc == obj["two"].bc){ + if(format["foot"].fc == obj["foot"].fc && format["foot"].bc == obj["foot"].bc){ + index = i; + break; + } + } + } + } + } + + //自定义 模板 + let modelCustom = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["luckysheet_alternateformat_save_modelCustom"]; + if(modelCustom != null && modelCustom.length > 0){ + for(let j = 0; j < modelCustom.length; j++){ + let obj = modelCustom[j]; + + if(format["head"].fc == obj["head"].fc && format["head"].bc == obj["head"].bc){ + if(format["one"].fc == obj["one"].fc && format["one"].bc == obj["one"].bc){ + if(format["two"].fc == obj["two"].fc && format["two"].bc == obj["two"].bc){ + if(format["foot"].fc == obj["foot"].fc && format["foot"].bc == obj["foot"].bc){ + index = modelList.length + j; + break; + } + } + } + } + } + } + + return index; + }, + getFormatByIndex: function(){ + let _this = this; + + let index = _this.modelfocusIndex; + let len = _this.FixedModelColor.length; + + let format = {}; + + if(index < len){ + format = _this.FixedModelColor[index]; + } + else{ + format = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["luckysheet_alternateformat_save_modelCustom"][index - len]; + } + + return format; + }, + new: function(cellrange){ + let _this = this; + + let format = _this.getFormatByIndex(); + + let file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]; + let ruleArr = file["luckysheet_alternateformat_save"]; + + if(ruleArr == null){ + ruleArr = []; + } + + //保存之前的规则 + let historyRules = $.extend(true, [], ruleArr); + + //保存当前的规则 + let obj = { + "cellrange": { + "row": cellrange["row"], + "column": cellrange["column"] + }, + "format": format, + "hasRowHeader": true, + "hasRowFooter": false + } + + ruleArr.push(obj); + + let currentRules = $.extend(true, [], ruleArr); + + //刷新一次表格 + _this.ref(historyRules, currentRules); + + if(server.allowUpdate){ + server.saveParam("all", Store.currentSheetIndex, ruleArr, { "k": "luckysheet_alternateformat_save" }); + } + }, + update: function(){ + let _this = this; + const _locale = locale() + const alternatingColors =_locale.alternatingColors; + //获取标识 + let dataIndex = $("#luckysheet-alternateformat-remove").data("index"); + + //应用范围 + let rangeValue = $("#luckysheet-modal-dialog-slider-alternateformat #luckysheet-alternateformat-range input").val().trim(); + + if(!formula.iscelldata(rangeValue)){ + if(isEditMode()){ + alert(alternatingColors.errorNoRange); + } + else{ + tooltip.info(alternatingColors.errorNoRange, ""); + } + + return; + } + + let cellrange = formula.getcellrange(rangeValue); + let isExists = _this.rangeIsExists(cellrange, dataIndex)[0]; + + if(isExists){ + if(isEditMode()){ + alert(alternatingColors.errorExistColors); + } + else{ + tooltip.info(alternatingColors.errorExistColors, ""); + } + + return; + } + + //页眉、页脚 + let hasRowHeader; + if($("#luckysheet-modal-dialog-slider-alternateformat #luckysheet-alternateformat-rowHeader").is(":checked")){ + hasRowHeader = true; + } + else{ + hasRowHeader = false; + } + + let hasRowFooter; + if($("#luckysheet-modal-dialog-slider-alternateformat #luckysheet-alternateformat-rowFooter").is(":checked")){ + hasRowFooter = true; + } + else{ + hasRowFooter = false; + } + + //获取选中样式模板的颜色 + let format = _this.getFormatByIndex(); + let file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]; + + let ruleArr = file["luckysheet_alternateformat_save"]; + if(ruleArr == null){ + ruleArr = []; + } + + //保存之前的规则 + let historyRules = $.extend(true, [], ruleArr); + + //保存当前的规则 + let obj = { + "cellrange": { + "row": cellrange["row"], + "column": cellrange["column"] + }, + "format": format, + "hasRowHeader": hasRowHeader, + "hasRowFooter": hasRowFooter + } + + ruleArr[dataIndex] = obj; + + let currentRules = $.extend(true, [], ruleArr); + + //刷新一次表格 + _this.ref(historyRules, currentRules); + + if(server.allowUpdate){ + server.saveParam("all", Store.currentSheetIndex, ruleArr, { "k": "luckysheet_alternateformat_save" }); + } + }, + checksAF: function(r, c, computeMap){ + if((r + "_" + c) in computeMap){ + //返回值(fc bc) + return computeMap[r + "_" + c]; + } + else{ + return null; + } + }, + getComputeMap: function(){ + let file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]; + let ruleArr = file["luckysheet_alternateformat_save"]; + + let computeMap = this.compute(ruleArr); + + return computeMap; + }, + compute: function(obj){ + //计算存储 + let computeMap = {}; + + if(obj != null && obj.length > 0){ + for(let i = 0; i < obj.length; i++){ + let cellrange = obj[i]["cellrange"]; + let format = obj[i]["format"]; + let hasRowHeader = obj[i]["hasRowHeader"]; + let hasRowFooter = obj[i]["hasRowFooter"]; + let st_r = cellrange["row"][0], + ed_r = cellrange["row"][1], + st_c = cellrange["column"][0], + ed_c = cellrange["column"][1]; + + if(hasRowHeader && hasRowFooter){ + //页眉所在行 + for(let c = st_c; c <= ed_c; c++){ + computeMap[st_r + "_" + c] = [format["head"].fc, format["head"].bc]; + } + + //中间行 + if(ed_r - st_r > 1){ + for(let r = st_r + 1; r < ed_r; r++){ + let fc, bc; + if((r - st_r) % 2 != 0){ + fc = format["one"].fc; + bc = format["one"].bc; + } + else{ + fc = format["two"].fc; + bc = format["two"].bc; + } + + for(let c = st_c; c <= ed_c; c++){ + computeMap[r + "_" + c] = [fc, bc]; + } + } + } + + //页脚所在行 + if(ed_r > st_r){ + for(let c = st_c; c <= ed_c; c++){ + computeMap[ed_r + "_" + c] = [format["foot"].fc, format["foot"].bc]; + } + } + } + else if(hasRowHeader){ + //页眉所在行 + for(let c = st_c; c <= ed_c; c++){ + computeMap[st_r + "_" + c] = [format["head"].fc, format["head"].bc]; + } + + //中间行 + if(ed_r > st_r){ + for(let r = st_r + 1; r <= ed_r; r++){ + let fc, bc; + if((r - st_r) % 2 != 0){ + fc = format["one"].fc; + bc = format["one"].bc; + } + else{ + fc = format["two"].fc; + bc = format["two"].bc; + } + + for(let c = st_c; c <= ed_c; c++){ + computeMap[r + "_" + c] = [fc, bc]; + } + } + } + } + else if(hasRowFooter){ + //中间行 + if(ed_r > st_r){ + for(let r = st_r; r < ed_r; r++){ + let fc, bc; + if((r - st_r) % 2 == 0){ + fc = format["one"].fc; + bc = format["one"].bc; + } + else{ + fc = format["two"].fc; + bc = format["two"].bc; + } + + for(let c = st_c; c <= ed_c; c++){ + computeMap[r + "_" + c] = [fc, bc]; + } + } + } + + //页脚所在行 + for(let c = st_c; c <= ed_c; c++){ + computeMap[ed_r + "_" + c] = [format["foot"].fc, format["foot"].bc]; + } + } + else{ + //中间行 + for(let r = st_r; r <= ed_r; r++){ + let fc, bc; + if((r - st_r) % 2 == 0){ + fc = format["one"].fc; + bc = format["one"].bc; + } + else{ + fc = format["two"].fc; + bc = format["two"].bc; + } + + for(let c = st_c; c <= ed_c; c++){ + computeMap[r + "_" + c] = [fc, bc]; + } + } + } + } + } + + return computeMap; + }, + ref: function(historyRules, currentRules){ + if (Store.clearjfundo) { + Store.jfundo.length = 0; + + let redo = {}; + redo["type"] = "updateAF"; + redo["sheetIndex"] = Store.currentSheetIndex; + redo["data"] = {"historyRules": historyRules, "currentRules": currentRules}; + Store.jfredo.push(redo); + } + + let index = getSheetIndex(Store.currentSheetIndex); + Store.luckysheetfile[index]["luckysheet_alternateformat_save"] = currentRules; + + setTimeout(function () { + luckysheetrefreshgrid(); + }, 1); + } +} + export default alternateformat; \ No newline at end of file diff --git a/src/controllers/cellDatePickerCtrl.js b/src/controllers/cellDatePickerCtrl.js index 53a4eba46..a78d68c76 100644 --- a/src/controllers/cellDatePickerCtrl.js +++ b/src/controllers/cellDatePickerCtrl.js @@ -1,115 +1,115 @@ -import menuButton from './menuButton'; -import formula from '../global/formula'; -import Store from '../store'; -import flatpickr from 'flatpickr' -import dayjs from "dayjs"; -import { update, datenum_local } from '../global/format'; -import { setCellValue, setCellFormat } from '../global/api'; - -const fitFormat = (formatStr) => { - let dateFormat = formatStr.replace(/y/g, 'Y'); - dateFormat = dateFormat.replace(/d/g, 'D'); - dateFormat = dateFormat.replace(/h/g, 'H'); - - dateFormat = dateFormat.replace(/上午\/下午/g, 'A'); - dateFormat = dateFormat.replace(/上午/g, 'A'); - dateFormat = dateFormat.replace(/下午/g, 'A'); - - dateFormat = dateFormat.replace(/AM\/PM/g, 'A'); - dateFormat = dateFormat.replace(/AM/g, 'A'); - dateFormat = dateFormat.replace(/PM/g, 'A'); - dateFormat = dateFormat.replace(/\"/g, ''); - - if (dateFormat.includes('A')) { - dateFormat = dateFormat.replace(/H/g, 'h'); - } - return dateFormat -} - -const cellDatePickerCtrl = { - cellFocus: function (r, c, cell) { - let row = Store.visibledatarow[r], - row_pre = r == 0 ? 0 : Store.visibledatarow[r - 1]; - let col = Store.visibledatacolumn[c], - col_pre = c == 0 ? 0 : Store.visibledatacolumn[c - 1]; - - let margeset = menuButton.mergeborer(Store.flowdata, r, c); - let type = cell.ct.fa || 'YYYY-MM-DD'; - let defaultDate = update('yyyy-MM-dd hh:mm:ss', cell.v); - let dateFormat = fitFormat(type); - let enableTime = false; - let noCalendar = false; - let enableSeconds = false; - let time_24hr = true; - let hasChineseTime = false; - - - if (!!margeset) { - row = margeset.row[1]; - row_pre = margeset.row[0]; - - col = margeset.column[1]; - col_pre = margeset.column[0]; - } - - $(".cell-date-picker").show().css({ - width: col - col_pre + 1, - height: row - row_pre + 1, - left: col_pre, - top: row_pre - }) - - if (/[上午下午]/.test(type)) { - hasChineseTime = true - } - if (/[Hhms]/.test(dateFormat)) { - enableTime = true; - } - if (!/[YMD]/.test(dateFormat)) { - noCalendar = true; - } - if (/s/.test(dateFormat)) { - enableSeconds = true; - } - if (/A/.test(dateFormat)) { - time_24hr = false; - } - - const fp = flatpickr('#luckysheet-input-box', { - allowInput: false, - noCalendar, - enableSeconds, - enableTime, - dateFormat, - time_24hr, - defaultDate, - onClose() { - setTimeout(() => { - fp.destroy() - }, 0); - }, - parseDate: (datestr, format) => { - return dayjs(datestr).toDate(); - }, - formatDate: (date, format, locale) => { - if (hasChineseTime) { - return dayjs(date).format(format).replace('AM', '上午').replace('PM', '下午') - } - return dayjs(date).format(format); - }, - onChange: function (selectedDates, dateStr) { - let currentVal = datenum_local(new Date(selectedDates)) - $("#luckysheet-rich-text-editor").html(dateStr); - setCellValue(r, c, currentVal, { isRefresh: false }) - setCellFormat(r, c, 'ct', cell.ct) - if (!enableTime) { - formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]); - } - } - }); - - $("#luckysheet-input-box").click(); - }, -} - -export default cellDatePickerCtrl; +import menuButton from './menuButton'; +import formula from '../global/formula'; +import Store from '../store'; +import flatpickr from 'flatpickr' +import dayjs from "dayjs"; +import { update, datenum_local } from '../global/format'; +import { setCellValue, setCellFormat } from '../global/api'; + +const fitFormat = (formatStr) => { + let dateFormat = formatStr.replace(/y/g, 'Y'); + dateFormat = dateFormat.replace(/d/g, 'D'); + dateFormat = dateFormat.replace(/h/g, 'H'); + + dateFormat = dateFormat.replace(/上午\/下午/g, 'A'); + dateFormat = dateFormat.replace(/上午/g, 'A'); + dateFormat = dateFormat.replace(/下午/g, 'A'); + + dateFormat = dateFormat.replace(/AM\/PM/g, 'A'); + dateFormat = dateFormat.replace(/AM/g, 'A'); + dateFormat = dateFormat.replace(/PM/g, 'A'); + dateFormat = dateFormat.replace(/\"/g, ''); + + if (dateFormat.includes('A')) { + dateFormat = dateFormat.replace(/H/g, 'h'); + } + return dateFormat +} + +const cellDatePickerCtrl = { + cellFocus: function (r, c, cell) { + let row = Store.visibledatarow[r], + row_pre = r == 0 ? 0 : Store.visibledatarow[r - 1]; + let col = Store.visibledatacolumn[c], + col_pre = c == 0 ? 0 : Store.visibledatacolumn[c - 1]; + + let margeset = menuButton.mergeborer(Store.flowdata, r, c); + let type = cell.ct.fa || 'YYYY-MM-DD'; + let defaultDate = update('yyyy-MM-dd hh:mm:ss', cell.v); + let dateFormat = fitFormat(type); + let enableTime = false; + let noCalendar = false; + let enableSeconds = false; + let time_24hr = true; + let hasChineseTime = false; + + + if (!!margeset) { + row = margeset.row[1]; + row_pre = margeset.row[0]; + + col = margeset.column[1]; + col_pre = margeset.column[0]; + } + + $(".cell-date-picker").show().css({ + width: col - col_pre + 1, + height: row - row_pre + 1, + left: col_pre, + top: row_pre + }) + + if (/[上午下午]/.test(type)) { + hasChineseTime = true + } + if (/[Hhms]/.test(dateFormat)) { + enableTime = true; + } + if (!/[YMD]/.test(dateFormat)) { + noCalendar = true; + } + if (/s/.test(dateFormat)) { + enableSeconds = true; + } + if (/A/.test(dateFormat)) { + time_24hr = false; + } + + const fp = flatpickr('#luckysheet-input-box', { + allowInput: false, + noCalendar, + enableSeconds, + enableTime, + dateFormat, + time_24hr, + defaultDate, + onClose() { + setTimeout(() => { + fp.destroy() + }, 0); + }, + parseDate: (datestr, format) => { + return dayjs(datestr).toDate(); + }, + formatDate: (date, format, locale) => { + if (hasChineseTime) { + return dayjs(date).format(format).replace('AM', '上午').replace('PM', '下午') + } + return dayjs(date).format(format); + }, + onChange: function (selectedDates, dateStr) { + let currentVal = datenum_local(new Date(selectedDates)) + $("#luckysheet-rich-text-editor").html(dateStr); + setCellValue(r, c, currentVal, { isRefresh: false }) + setCellFormat(r, c, 'ct', cell.ct) + if (!enableTime) { + formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]); + } + } + }); + + $("#luckysheet-input-box").click(); + }, +} + +export default cellDatePickerCtrl; diff --git a/src/controllers/cellFormat.js b/src/controllers/cellFormat.js index 415b79457..d0923195c 100644 --- a/src/controllers/cellFormat.js +++ b/src/controllers/cellFormat.js @@ -1,201 +1,201 @@ -import Store from '../store'; -import { replaceHtml,transformRangeToAbsolute,openSelfModel } from '../utils/util'; -import { modelHTML } from './constant'; -import sheetmanage from './sheetmanage'; -import menuButton from './menuButton'; -import {checkProtectionNotEnable} from './protection'; -import { jfrefreshgrid } from '../global/refresh'; -import locale from '../locale/locale'; -import { setcellvalue } from '../global/setdata'; - - -let isInitialCellFormatModel = false; - -function initialCellFormatModelEvent(){ - const _locale = locale(); - const local_cellFormat = _locale.cellFormat; - - $("#luckysheet-cellFormat-confirm").click(function(){ - let locked = $("#luckysheet-protection-check-locked").is(':checked'); - let hidden = $("#luckysheet-protection-check-hidden").is(':checked'); - - locked = locked==true?1:0; - hidden = hidden==true?1:0; - - let d = recycleSeletion( - function(cell, r, c, data){ - if(cell==null){ - setcellvalue(r, c, data, { - lo:locked, - hi:hidden - }); - } - else{ - cell.lo = locked; - cell.hi = hidden; - } - }, - function(){ - alert(local_cellFormat.sheetDataIsNullAlert); - } - ); - - jfrefreshgrid(d, undefined, undefined, false); - - $("#luckysheet-cellFormat-config").hide(); - $("#luckysheet-modal-dialog-mask").hide(); - }); -} - -function recycleSeletion(cycleFunction, dataIsNullFunction){ - if(Store.luckysheet_select_save != null && Store.luckysheet_select_save.length > 0){ - let sheetFile = sheetmanage.getSheetByIndex(), data=sheetFile.data; - if(data!=null){ - - for(let i=0;i