diff --git a/.eslintrc.js b/.eslintrc.js index d0205f56a7..a0d0701bbe 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -43,7 +43,12 @@ module.exports = { tabWidth: 2, trailingComma: 'all', printWidth: 80, + arrowParens: 'always', proseWrap: 'never', + htmlWhitespaceSensitivity: 'css', + embeddedLanguageFormatting: 'auto', + singleAttributePerLine: false, + bracketSpacing: true, overrides: [ { files: '.eslintrc', options: { parser: 'json' } }, { files: '.prettierrc', options: { parser: 'json' } }, @@ -57,7 +62,7 @@ module.exports = { ], 'import/no-duplicates': [2, { considerQueryString: true }], 'import/no-deprecated': 1, - 'import/no-cycle': 1, + 'import/no-cycle': 2, 'import/order': [ 2, { diff --git a/.github/ISSUE_TEMPLATE/ask-for-question.md b/.github/ISSUE_TEMPLATE/ask-for-question.md deleted file mode 100644 index 0f42cbc17d..0000000000 --- a/.github/ISSUE_TEMPLATE/ask-for-question.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -name: 🤔 Ask for question -about: Look for some help or ask question -title: '🤔' -labels: ❔question ---- - - - - - - -### 🏷 Version - - - - - -| Package | Version | -| -------------- | ------- | -| @antv/s2 | | -| @antv/s2-react | | -| @antv/s2-vue | | - -### Sheet Type - - - - -- [ ] PivotSheet -- [ ] TableSheet -- [ ] GridAnalysisSheet -- [ ] StrategySheet -- [ ] EditableSheet - -### 🖋 Description - - - - -### 🔗 Reproduce Link - - - - -### 😊 Expected Behavior - -### 😅 Current Behavior diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md deleted file mode 100644 index 916dadda53..0000000000 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -name: 🐛 Bug report -about: Let us know something is wrong. -title: '🐛' ---- - - - - -### 🏷 Version - - - - - - -| Package | Version | -| -------------- | ------- | -| @antv/s2 | | -| @antv/s2-react | | -| @antv/s2-vue | | - -### Sheet Type - - - - -- [ ] PivotSheet -- [ ] TableSheet -- [ ] GridAnalysisSheet -- [ ] StrategySheet -- [ ] EditableSheet - -### 🖋 Description - - - - -### ⌨️ Code Snapshots - - - - - - -### 🔗 Reproduce Link - - - - -### 🤔 Steps to Reproduce - - - - -### 😊 Expected Behavior - - - - -### 😅 Current Behavior - - - - -### 💻 System information - - - - -| Environment | Info | -| ------- | ------- | -| System | | -| Browser | | diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 0000000000..0bb233dc53 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,152 @@ +name: '🐛 Bug report' +description: Create a report to help us improve, Ask questions in Discussions / 创建一个问题报告以帮助我们改进,提问请到 Discussions +title: '🐛' +body: + - type: markdown + attributes: + value: | + Report errors and exceptions found in S2. + + Before submitting a new bug/issue, please check the links below to see if there is a solution or question posted there already: + + --- + + ### 反馈在 S2 中发现的错误、异常 ([提 Issue 前必读](https://github.com/antvis/S2/issues/1904))。 + + ⚠️ 在提出问题前,请确保你已经仔细阅读👓/搜索🔍过 [官方文档](https://s2.antv.antgroup.com) 和 [常见问题](https://s2.antv.antgroup.com/manual/faq) 以及 [图表示例](https://s2.antv.antgroup.com/examples), 并且已经搜索查阅过相关 [Issues 列表](https://github.com/antvis/S2/issues?q=is%3Aissue+is%3Aclosed) 和 [Discussions 列表](https://github.com/antvis/S2/discussions). 当你确定自己的问题没有解决方案时,请提交 issue。 ⚠️ + + 如果是使用问题,不知道怎么用,请移步 [Discussions 讨论区](https://github.com/antvis/S2/discussions) 并提供 [有效信息](https://github.com/antvis/S2/issues/1904) 进行[提问](https://github.com/antvis/S2/discussions/new?category=q-a)。 + + ### 参与社区共建 + + **这是一个开源项目, 我们也有繁忙的业务要做, 是用自己的业余时间在维护, 为爱发电, 精力有限, 所以有时候 issue 响应速度不是那么及时, 如果你遇到了问题, 或者对 [Issues](https://github.com/antvis/S2/issues) 和 [Discussions](https://github.com/antvis/S2/discussions) 列表的问题感兴趣, 可以直接认领并尝试修复 ([贡献指南](https://s2.antv.antgroup.com/manual/contribution)),帮助 S2 变得更好, 而不是一味的埋怨和催促, 我们不是甲方乙方的关系.** + + - type: textarea + id: version + attributes: + label: 🏷 S2 Version / S2 版本 + description: | + 请填写你实际安装到 node_modules 中的具体版本号,请确保你已经尝试过安装最新版本解决问题,并且本地和官网都能复现该问题. + 请不要写 `latest`, `2.x` 这种没有意义的版本号, + placeholder: | + 复制下方的表格, 修改对应版本号即可: + + | Package | Version | + | -------------- | ------- | + | @antv/s2 | 2.0.0 | + | @antv/s2-react | 2.0.0 | + | @antv/s2-react-components | 2.0.0 | + value: | + | Package | Version | + | -------------- | ------- | + | @antv/s2 | | + | @antv/s2-react | | + | @antv/s2-react-components | | + + validations: + required: true + + - type: checkboxes + id: sheet-type + attributes: + label: 💻 Sheet Type / 表格类型 + description: | + 请选择你具体使用的表格,这能帮助我们更快的定位问题 + options: + - label: PivotSheet + - label: TableSheet + - label: GridAnalysisSheet + - label: StrategySheet + - label: EditableSheet + + - type: textarea + id: description + attributes: + label: 🖋 Describe the bug / 问题描述 + description: | + 1. 请填写你具体的问题描述,**请不要惜字如金,尽可能的多提供一些你能想到的有用信息**。 + 2. 请至少懂表格的基本概念,会基本的 JavaScript, 统一用语,不要将 `行头` 说成 `列头`, `列头` 说成 `表头`, 统一用语,可以减少我们的沟通成本。 + + validations: + required: true + + - type: textarea + id: code + attributes: + label: ⌨️ Code Snapshots / 代码片段 + description: | + 1. 请粘贴你的**核心代码片段**,包括但不限于 `报错信息`, `s2Options 配置信息`, `s2DataConfig 数据源信息`。 + 2. 请不要粘贴你自己的业务代码, 更不要无脑粘贴一大段没有格式化的 "乱码"。 + 3. 请不要**直接粘贴官网的在线示例链接, 然后告诉我们有问题, 官网不会保存你编辑后的代码**, 请粘贴 `你的代码片段`, 或者使用 [codesandbox](https://codesandbox.io/) + 4. 请尽量不要粘贴代码的截图,请使用文本. + placeholder: | + If there is a code block, please use Markdown syntax, such as: + 请注意使用 markdown code 标签: + + ```javascript + // Your code here + ``` + validations: + required: true + + - type: input + id: link + attributes: + label: 🔗 Reproduction link / 复现链接 + description: | + 1. 请提供一个精简的可复现链接,它可以让我们更快的帮你复现,定位问题,这很重要,尽量避免 gif, 视频等形式。 + 2. 推荐使用 [codesandbox](https://codesandbox.io/), 我们提供了各种版本的模板,方便你反馈问题。[查看所有模板](https://www.yuque.com/antv/vo4vyz/bam4vz)。 + 3. [官网在线示例](https://s2.antv.vision/zh/examples/gallery) 支持在线编写代码,你可以将代码转成 `codesandbox` 并将对应的链接发给我们,请不要将官网的代码原封不动的复制给我们,请不要 `这么麻烦, 还要复现链接? 赶紧给我修啊, 很急!`, 请不要 `打了一个压缩包给你, 代码都在这, 给我修吧`,更不要 `复现步骤,联系 xxx@qq.com`。 + 4. 请不要 `开局一张图,内容全靠猜`, 我们不是侦探 + validations: + required: false + + - type: textarea + id: steps + attributes: + label: 📋 Steps to Reproduce the Bug or Issue / 重现步骤 + description: | + 1. 请不要惜字如金,粘贴一个张图或者一句话就草草了事,我们需要你详细的复现步骤,这个问题需要怎么样的操作步骤才能复现。 + 2. 不同的问题有不同的复现步骤,只有你最清楚怎么复现这个问题,比如问题需要 **滚动表格到指定位置才能复现, 但是通篇都没有提到, 而你就贴一张图, 什么信息都不给**:所以请 `1. 拖动表格滚动条,滚动到 xx 位置 2. 停留 300ms, 3. tooltip 消失`。 + validations: + required: true + + - type: textarea + id: expected-behavior + attributes: + label: 😊 Expected Behavior / 期望行为 + description: | + 说明这个问题的预期行为,只有你才最了解自己的代码,所以请不要让我们猜,请说明预期,不如 `数据不对,正确应该是:xx`, `布局错误:正确应该是 A 节点在 B 位置`, 如有必要请使用截图工具标注一下, 让问题更醒目。 + validations: + required: true + + - type: textarea + id: current-behavior + attributes: + label: 😅 Current Behavior / 当前行为 + description: | + 说明这个问题当前行为, 如有必要请使用截图工具标注一下, 让问题更醒目。 + validations: + required: false + + - type: checkboxes + id: OS + attributes: + label: 💻 OS / 操作系统 + options: + - label: macOS + - label: Windows + - label: Linux + - label: Others / 其他 + + - type: checkboxes + id: Browser + attributes: + label: 🌏 Browser / 浏览器 + options: + - label: Chrome + - label: Edge + - label: Firefox + - label: Safari (Limited support / 有限支持) + - label: IE (Nonsupport / 不支持) + - label: Others / 其他 diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000000..a9145ba2b1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,6 @@ +# Ref: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser +blank_issues_enabled: false +contact_links: + - name: 🤔 Question / 问题咨询 + url: https://github.com/antvis/S2/discussions/new?category=q-a + about: Discuss S2 usage / 讨论 S2 使用问题 diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md deleted file mode 100644 index 518d3e947a..0000000000 --- a/.github/ISSUE_TEMPLATE/feature-request.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -name: 🙏 Feature request -about: Suggest an idea for this project -title: '🙏' -labels: 🙏feature request ---- - - - - -### 🏷 Version - - - - - - -| Package | Version | -| -------------- | ------- | -| @antv/s2 | | -| @antv/s2-react | | -| @antv/s2-vue | | - -### Sheet Type - - - - -- [ ] PivotSheet -- [ ] TableSheet -- [ ] GridAnalysisSheet -- [ ] StrategySheet -- [ ] EditableSheet - -### 🖋 Description - - - - -### 🏞 What problem does this feature solve - - - - -### 🧐 Suggest the API - - - -| name | type | default | description | -| ---- | ---- | ------- | ----------- | -| - | - | - | - | diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml new file mode 100644 index 0000000000..e13001974b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -0,0 +1,52 @@ +name: '🙏 Feature request' +description: I have a suggestion (and may want to implement it) / 我有一个建议(或者想参与贡献) +title: '🙏' +labels: ['🙏feature request'] +body: + - type: markdown + attributes: + value: | + 如果你遇到了问题,或者对 [Issues](https://github.com/antvis/S2/issues) 和 [Discussions](https://github.com/antvis/S2/discussions) 列表的问题感兴趣,**可以直接认领并尝试修复**,帮助 S2 变得更好,期待在 [贡献者列表](https://github.com/antvis/S2/graphs/contributors) 里看见你的头像。 + + S2 非常需要你的共建,请阅读 [贡献指南](https://s2.antv.antgroup.com/manual/contribution) 后提交 PR. + + - type: textarea + id: description + attributes: + label: Describe the feature / 功能描述 + placeholder: | + What problem does this feature solve? Where are the existing features not enough? + 这个功能能解决什么问题? 现有功能不满足的点在哪? + + validations: + required: true + + - type: textarea + id: api + attributes: + label: Design the API / API 设计 + placeholder: | + If you need to add an API, how do you want to design it? + 如果需要新增 API, 你希望怎么设计? + + | name | type | default | description | + | ---- | ---- | ------- | ----------- | + | - | - | - | - | + + value: | + | name | type | default | description | + | ---- | ---- | ------- | ----------- | + | - | - | - | - | + + validations: + required: true + + - type: dropdown + attributes: + label: Are you willing to contribute? / 是否愿意参与贡献? + options: + - Please select / 请选择 + - ✅ Yes / 是 + - ❌ No / 否 + validations: + required: true diff --git a/.github/workflows/compressed-size.yml b/.github/workflows/compressed-size.yml index fe79eec36a..ff05016645 100644 --- a/.github/workflows/compressed-size.yml +++ b/.github/workflows/compressed-size.yml @@ -30,6 +30,6 @@ jobs: - uses: preactjs/compressed-size-action@v2 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" - pattern: "./packages/{s2-core,s2-react,s2-vue}/dist/**/*.{js,css}" - build-script: "build:umd" + pattern: "./packages/{s2-core,s2-react,s2-react-components,s2-vue}/dist/**/*.{js,css}" + build-script: "build" clean-script: "clean" diff --git a/.github/workflows/issue-labeled.yml b/.github/workflows/issue-labeled.yml index 5c3c766305..c41599d49d 100644 --- a/.github/workflows/issue-labeled.yml +++ b/.github/workflows/issue-labeled.yml @@ -95,17 +95,21 @@ jobs: Hello, @${{ github.event.issue.user.login }}, your feature request has been accepted after our repeated discussion. We will schedule the development, please pay attention to the follow-up release logs. - - name: Pending - if: github.event.label.name == '💤 pending' + - name: Welcom PR + if: github.event.label.name == '⭐️ Welcom PR' uses: actions-cool/issues-helper@main with: actions: 'create-comment' token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.issue.number }} body: | - 你好 @${{ github.event.issue.user.login }},经过我们的反复讨论, 你的需求现已被采纳, 我们会排期开发, 但人力资源有限, 短期内无法支持, 请关注后续发布日志。当然, 如果能贡献 PR 帮助我们改进, 不胜感激! + 你好 @${{ github.event.issue.user.login }},你的反馈我们已收到, 这是一个开源项目, 我们也是用自己的业余时间在维护, 为爱发电, 精力实在有限, 👏🏻 欢迎根据 [贡献指南](https://s2.antv.antgroup.com/manual/contribution) 提交 PR. 一起参与到开源项目的建设中. - Hello, @${{ github.event.issue.user.login }}, your feature request has been accepted after our repeated discussion. We will schedule the development. However, it could not be supported in the short term since limited time, please pay attention to the follow-up release logs. Of course, looking forward for your PR! + 如果你遇到了问题,或者对 [Issues](https://github.com/antvis/S2/issues) 和 [Discussions](https://github.com/antvis/S2/discussions) 列表的问题感兴趣,可以**直接认领并尝试修复**,帮助 S2 变得更好,期待在 [贡献者列表](https://github.com/antvis/S2/graphs/contributors) 里看见你的头像。 + + Hello, @${{ github.event.issue.user.login }}, We have received your feedback, this is an open source project, we also use our spare time to maintain, for love power generation, energy is really limited, 👏 🏻 welcome according to contribution guide (https://s2.antv.antgroup.com/manual/contribution) to submit PR. Get involved in open source projects together. + + If you have a problem, Or to [Issues] (https://github.com/antvis/S2/issues) and [Discussions] (https://github.com/antvis/S2/discussions) interested in a list of questions, Can directly claim and try to repair, help S2 better, look forward to in the [contributor list] (https://github.com/antvis/S2/graphs/contributors) saw your head. - name: Rejected if: github.event.label.name == '❌ won''t support' @@ -119,24 +123,50 @@ jobs: Hello, @${{ github.event.issue.user.login }}, After our repeated discussions, your needs are too customized and not suitable for implementing directly to S2. As an open source framework, S2 will only enhance general capabilities and open custom interfaces. You can implement it yourself through the customization capabilities provided by S2, thank you for your understanding. - - name: Supported or fixed in next - if: github.event.label.name == '✨ supported or fixed in next' + - name: Supported or fixed in 2.x + if: github.event.label.name == '✨ supported or fixed in 2.x' uses: actions-cool/issues-helper@main with: actions: 'create-comment' token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.issue.number }} body: | - 你好 @${{ github.event.issue.user.login }},该功能或缺陷已经在 `2.0 next 版本` 中支持或修复,`next` 版本目前处于内测中, 感谢你的支持与理解。 + 你好 @${{ github.event.issue.user.login }},该功能或缺陷已经在 `2.x` 版本中支持或修复,请使用 `2.x` 版本进行开发(`1.x` 版本不再维护), 感谢你的支持与理解。 - 如有任何 `2.0 版本` 问题,请前往[讨论区](https://github.com/antvis/S2/discussions/1933) 或 [查看文档](https://s2.antv.antgroup.com), 抢先试用: + 如有任何 `2.x` 版本问题,欢迎提[issue](https://github.com/antvis/S2/issues) 或 [查看文档](https://s2.antv.antgroup.com): ```bash - yarn add @antv/s2@next - yarn add @antv/s2-react@next - yarn add @antv/s2-vue@next + yarn add @antv/s2 + yarn add @antv/s2-react + yarn add @antv/s2-react-components + yarn add @antv/s2-vue ``` - Hello, @${{ github.event.issue.user.login }}, This feature or flaw has been supported or fixed in `2.0 next version`, `next` version is currently in private beta, thank you for your support and understanding. + Hello, @${{ github.event.issue.user.login }}, This feature or defect has been supported or fixed in the '2.x' version, please use the '2.x' version for development (' 1.x 'version is no longer maintained), thank you for your support and understanding. + + Any `2.x` version issues, please go to [issue](https://github.com/antvis/S2/issues), or [view docs](https://s2.antv.antgroup.com), the first trial: + + - name: S2 Vue + if: github.event.label.name == 's2-vue' + uses: actions-cool/issues-helper@main + with: + actions: 'create-comment,close-issue' + token: ${{ secrets.GITHUB_TOKEN }} + issue-number: ${{ github.event.issue.number }} + body: | + 你好 @${{ github.event.issue.user.login }},`@antv/s2-vue` 现已停止维护,由于精力投入有限,出于维护成本,包下载量等因素综合考虑,从 `2.0.0` 正式版后不再继续更新,请基于 `@antv/s2` 自行封装,或 fork 仓库进行二次开发。 + + Hello, @${{ github.event.issue.user.login }}, `@antv/s2-vue` has stopped maintenance, due to limited energy investment, due to the comprehensive consideration of maintenance costs, package downloads and other factors, from the '2.0.0' official version will not continue to update, please based on '@antv/s2' self-encapsulation, or fork warehouse for secondary development. + + - name: G + if: github.event.label.name == 'G' + uses: actions-cool/issues-helper@main + with: + actions: 'create-comment' + token: ${{ secrets.GITHUB_TOKEN }} + issue-number: ${{ github.event.issue.number }} + body: | + 你好 @${{ github.event.issue.user.login }},这个属于底层渲染引擎 [AntV/G](https://g.antv.antgroup.com/) 的问题, 需要等待底层支持或修复后, 上层才能适配, 请耐心等待, 感谢你的理解。 + + Hello, @${{ github.event.issue.user.login }}, This belongs to the underlying rendering engine AntV/G (https://g.antv.antgroup.com/), needs to wait for the underlying support or after repair, the upper can adapter, please wait patiently, thank you for your understanding. - Any `2.0` version issues, please go to [discussion](https://github.com/antvis/S2/discussions/1933), or [view docs](https://s2.antv.antgroup.com), the first trial: diff --git a/.github/workflows/issue-opend.yml b/.github/workflows/issue-opend.yml index 4225078b58..40de3619ac 100644 --- a/.github/workflows/issue-opend.yml +++ b/.github/workflows/issue-opend.yml @@ -8,7 +8,7 @@ jobs: issue-opend-check: runs-on: ubuntu-latest steps: - - name: check issue title + - name: Check issue title if: github.event.issue.title == '🤔' || github.event.issue.title == '🙏' || github.event.issue.title == '🐛' uses: actions-cool/issues-helper@main with: @@ -20,20 +20,6 @@ jobs: Hello, @${{ github.event.issue.user.login }}, please edit your issue title. a concise issue title will save everyone time. please do not leave the title as the body or empty. - # 如果 issue 的提交者无视模版, 连基本的版本号,表格类型, 描述都没有, 直接自动关闭, 不多BB. - - name: check issue body - if: contains(github.event.issue.body, 'Version') == false && contains(github.event.issue.body, 'Sheet Type') == false && contains(github.event.issue.body, 'Description') == false - uses: actions-cool/issues-helper@main - with: - actions: 'create-comment,add-labels,close-issue' - token: ${{ secrets.GITHUB_TOKEN }} - issue-number: ${{ github.event.issue.number }} - labels: '⛔ invalid' - body: | - 你好 @${{ github.event.issue.user.login }},请按照 issue 模板填写相关信息, 方便大家高效沟通, 强烈推荐你阅读 [提 Issue 前必读](https://github.com/antvis/S2/issues/1904) 和 [如何向开源项目提交无法解答的问题](https://zhuanlan.zhihu.com/p/25795393)。 - - Hello @${{ github.event.issue.user.login }}, please fill in the relevant information according to the issue template to facilitate communication efficiently. recommend you to read [提 Issue 前必读](https://github.com/antvis/S2/issues/1904) and [如何向开源项目提交无法解答的问题](https://zhuanlan.zhihu.com/p/25795393), Thanks so much! - # 标题或正文 (版本号) 带有 next, 增加标记便于统计 - name: Auto Set Next Label if: contains(github.event.issue.title, 'next') || contains(github.event.issue.body, 'next') @@ -43,3 +29,22 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.issue.number }} labels: 'next' + + - name: Auto Tips + uses: actions-cool/issues-helper@main + with: + actions: 'create-comment' + token: ${{ secrets.GITHUB_TOKEN }} + issue-number: ${{ github.event.issue.number }} + body: | + 你好 @${{ github.event.issue.user.login }}: + + ### 提 Issue 须知 + + ⚠️ 在提出问题前,请确保你已经仔细阅读👓/搜索🔍过 [官方文档](https://s2.antv.antgroup.com) 和 [常见问题](https://s2.antv.antgroup.com/manual/faq) 以及 [图表示例](https://s2.antv.antgroup.com/examples), 并且已经搜索查阅过相关 [Issues 列表](https://github.com/antvis/S2/issues?q=is%3Aissue+is%3Aclosed) 和 [Discussions 列表](https://github.com/antvis/S2/discussions). 当你确定自己的问题没有解决方案时,请提交 issue。 ⚠️ + + 如果是使用问题,不知道怎么用,移步 [Discussions 讨论区](https://github.com/antvis/S2/discussions) 并提供 [有效信息](https://zhuanlan.zhihu.com/p/25795393) 进行 [提问](https://github.com/antvis/S2/discussions/new?category=q-a)。 + + ### 参与社区共建 + + **这是一个开源项目, 我们也有繁忙的业务要做, 是用自己的业余时间在维护, 为爱发电, 精力有限, 所以有时候 issue 响应速度不是那么及时, 如果你遇到了问题, 或者对 [Issues](https://github.com/antvis/S2/issues) 和 [Discussions](https://github.com/antvis/S2/discussions) 列表的问题感兴趣, 可以直接认领并尝试修复 ([贡献指南](https://s2.antv.antgroup.com/manual/contribution)),帮助 S2 变得更好, 而不是一味的埋怨和催促, 我们不是甲方乙方的关系.** diff --git a/.github/workflows/pr-auto-assign-reviewer.yml b/.github/workflows/pr-auto-assign-reviewer.yml index cc1f6cec4e..bd1ef2f812 100644 --- a/.github/workflows/pr-auto-assign-reviewer.yml +++ b/.github/workflows/pr-auto-assign-reviewer.yml @@ -21,5 +21,5 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} pr-emoji: '+1, rocket' - reviewers: 'lijinke666,wjgogogo,wuhaiyang' + reviewers: 'lijinke666,wjgogogo' review-creator: false diff --git a/.github/workflows/pr-labeled.yml b/.github/workflows/pr-labeled.yml index 5888c6a7df..233e050f61 100644 --- a/.github/workflows/pr-labeled.yml +++ b/.github/workflows/pr-labeled.yml @@ -16,9 +16,9 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.pull_request.number }} body: | - 你好 @${{ github.event.pull_request.user.login }},感谢你的贡献, 为了让代码更健壮, 请根据 [贡献指南](https://s2.antv.antgroup.com/manual/contribution) 补充相应单元测试, 如果有 API 改动, 请修改 [相应的文档](https://github.com/antvis/S2/tree/master/s2-site) + 你好 @${{ github.event.pull_request.user.login }},感谢你的贡献, 为了让代码更健壮, 请根据 [贡献指南](https://s2.antv.antgroup.com/manual/contribution) 补充相应单元测试, 如果有 API 改动, 请修改 [相应的文档](https://github.com/antvis/S2/tree/next/s2-site) - Hello, @${{ github.event.pull_request.user.login }}, Thanks for your contribution. In order to make the code more robust, please add the corresponding unit tests, and update the [docs](https://github.com/antvis/S2/tree/master/s2-site) if there are API changes. + Hello, @${{ github.event.pull_request.user.login }}, Thanks for your contribution. In order to make the code more robust, please add the corresponding unit tests, and update the [docs](https://github.com/antvis/S2/tree/next/s2-site) if there are API changes. - name: Need more info if: github.event.label.name == '👀 need more info' diff --git a/.github/workflows/pr-notify.yml b/.github/workflows/pr-notify.yml deleted file mode 100644 index 597764612f..0000000000 --- a/.github/workflows/pr-notify.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: 🔊 PR Ding Talk Notify - -on: - pull_request_target: - types: [opened] - -jobs: - preview: - runs-on: ubuntu-latest - steps: - - name: Ding Talk PR Notify - uses: lijinke666/ding-talk-pr-notify@main - with: - ding_talk_token: ${{ secrets.DING_TALK_ACCESS_TOKEN }} - at_all: false diff --git a/.github/workflows/pr-opend.yml b/.github/workflows/pr-opend.yml new file mode 100644 index 0000000000..8a9f4de55f --- /dev/null +++ b/.github/workflows/pr-opend.yml @@ -0,0 +1,23 @@ +name: PR Opened + +on: + pull_request_target: + types: [opened] + +jobs: + preview: + runs-on: ubuntu-latest + steps: + - name: Auto tips + uses: actions-cool/issues-helper@main + with: + actions: 'create-comment' + token: ${{ secrets.GITHUB_TOKEN }} + issue-number: ${{ github.event.pull_request.number }} + body: | + 你好 @${{ github.event.pull_request.user.login }},非常感谢你的贡献. + 为了让代码更健壮, 请根据 [贡献指南](https://s2.antv.antgroup.com/manual/contribution) 补充相应单元测试 (文档改动或其他特殊场景除外), 如果有 API 改动, 请修改 [相应的文档](https://github.com/antvis/S2/tree/next/s2-site). + 同时请检查 `lint` 和 `test` 相关 CI 是否通过, 如果失败, 请点击 [Details] 按钮查看, 并根据日志修复. + + Hello, @${{ github.event.pull_request.user.login }}, Thanks for your contribution. In order to make the code more robust, please add the corresponding unit tests, and update the [docs](https://github.com/antvis/S2/tree/next/s2-site) if there are API changes. + At the same time, please check whether the CI related to lint and test passes. If the CI fails, please click [Details] button to check and repair according to the log. diff --git a/.github/workflows/prerelease-notify.yml b/.github/workflows/prerelease-notify.yml deleted file mode 100644 index fd477c943e..0000000000 --- a/.github/workflows/prerelease-notify.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: 🎉 Release Notify - -on: - release: - # published: latest release 和 pre release 都会触发 - # prereleased: 只有 pre release 触发 - # released: 只有 latest release 触发 - types: [prereleased] - -jobs: - notify: - runs-on: ubuntu-latest - steps: - - name: Sleep 10s - uses: juliangruber/sleep-action@v1 - with: - time: 10s - - - name: Pre Release Notify - uses: visiky/dingtalk-release-notify@main - with: - DING_TALK_TOKEN: | - ${{ secrets.DING_TALK_ACCESS_TOKEN }} - ${{ secrets.DING_TALK_GROUP_TOKEN }} - ${{ secrets.DING_TALK_PUBLIC_TOKEN }} - notify_title: '🎉 测试版 {release_tag} 发布 🎉' - notify_body: '## { title }
![preview](https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*1PTTQLk3j5AAAAAAAAAAAAAADmJ7AQ/original)
{ body }
' - notify_footer: '> 该版本为测试版, 请谨慎使用, 前往 [**AntV/S2 Releases**]({ release_url }) 查看完整更新日志.' - at_all: false - enable_prerelease: true diff --git a/.github/workflows/release-notify.yml b/.github/workflows/release-notify.yml index b4d892176f..dc477ee485 100644 --- a/.github/workflows/release-notify.yml +++ b/.github/workflows/release-notify.yml @@ -5,21 +5,56 @@ on: # published: latest release 和 pre release 都会触发 # prereleased: 只有 pre release 触发 # released: 只有 latest release 触发 - types: [released] + types: [published] jobs: notify: runs-on: ubuntu-latest steps: - name: Latest Release Notify - uses: visiky/dingtalk-release-notify@main + uses: zcong1993/actions-ding@master with: - DING_TALK_TOKEN: | - ${{ secrets.DING_TALK_ACCESS_TOKEN }} - ${{ secrets.DING_TALK_GROUP_TOKEN }} - ${{ secrets.DING_TALK_PUBLIC_TOKEN }} - notify_title: '🎉 AntV/S2 新版本发布啦 🎉' - notify_body: '## { title }
![preview](https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*1PTTQLk3j5AAAAAAAAAAAAAADmJ7AQ/original)
看看有哪些更新吧
' - notify_footer: '> 前往 [**AntV/S2 Releases**](https://github.com/antvis/S2/releases/latest) 查看完整更新日志.' - at_all: false - enable_prerelease: false + dingToken: ${{ secrets.DING_TALK_ACCESS_TOKEN }} + ignoreError: true + body: | + { + "msgtype": "link", + "link": { + "title": "🎉 ${{ github.head_ref || github.ref_name || 'AntV/S2 新版本' }} 发布啦 🎉", + "text": "📋 点击查看更新日志", + "messageUrl": "https://github.com/antvis/S2/releases", + "picUrl": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*1PTTQLk3j5AAAAAAAAAAAAAADmJ7AQ/original" + } + } + + - name: Latest Release Notify + uses: zcong1993/actions-ding@master + with: + dingToken: ${{ secrets.DING_TALK_GROUP_TOKEN }} + ignoreError: true + body: | + { + "msgtype": "link", + "link": { + "title": "🎉 ${{ github.head_ref || github.ref_name || 'AntV/S2 新版本' }} 发布啦 🎉", + "text": "📋 点击查看更新日志", + "messageUrl": "https://github.com/antvis/S2/releases", + "picUrl": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*1PTTQLk3j5AAAAAAAAAAAAAADmJ7AQ/original" + } + } + + - name: Latest Release Notify + uses: zcong1993/actions-ding@master + with: + dingToken: ${{ secrets.DING_TALK_PUBLIC_TOKEN }} + ignoreError: true + body: | + { + "msgtype": "link", + "link": { + "title": "🎉 ${{ github.head_ref || github.ref_name || 'AntV/S2 新版本' }} 发布啦 🎉", + "text": "📋 点击查看更新日志", + "messageUrl": "https://github.com/antvis/S2/releases", + "picUrl": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*1PTTQLk3j5AAAAAAAAAAAAAADmJ7AQ/original" + } + } diff --git a/.github/workflows/test-s2-react-components.yml b/.github/workflows/test-s2-react-components.yml new file mode 100644 index 0000000000..b8bcbf72f2 --- /dev/null +++ b/.github/workflows/test-s2-react-components.yml @@ -0,0 +1,83 @@ +name: 💯 test (@antv/s2-react-components) + +on: [pull_request] + +concurrency: + group: ${{github.workflow}}-${{github.event_name}}-${{github.ref}} + cancel-in-progress: true + +jobs: + test: + # jest-electron 需要 macOS 环境, 但是 免费用户 并发有限制, 容易排队 https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners + # runs-on: macos-latest # (目前 macos-latest 对应的是 Big Sur 11, macos-12 对应 Monterey 12) + # macOS 3-core CPU, 其他 2-core CPU + runs-on: macos-14 + if: "!contains(github.event.head_commit.message, '[skip ci]')" + strategy: + matrix: + node-version: [20] + + steps: + - uses: actions/checkout@v4 + + # Python 3.11 和 node-gyp 有兼容问题, 导致无法安装依赖 + # https://github.com/slint-ui/slint/commit/a9c48e33502fdebc36c5aa2f4f516c2218424679#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133dd + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + + - name: Install dependencies + run: pnpm bootstrap:ci + + - name: Test + run: | + pnpm --filter @antv/s2-react-components test:ci-coverage + + - name: Upload test coverage + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false + verbose: true + + - name: Workflow failed alert + if: ${{ failure() }} + uses: actions-cool/maintain-one-comment@main + with: + token: ${{ secrets.GITHUB_TOKEN }} + body: | + 你好, @${{ github.event.pull_request.user.login }} CI 执行失败, 请点击 [Details] 按钮查看, 并根据日志修复。 + + Hello, @${{ github.event.pull_request.user.login }} CI run failed, please click the [Details] button for detailed log information and fix it. + + emojis: 'eyes' + body-include: '' + + # Github PR 列表 有显示 √ X 的提示, 但是比如一些 APP, 例如 codecov 的 patch 变低, 也会导致 出现 X, 添加label 在列表页快速识别是不是测试自身挂了 + - name: Workflow failed add test failed label + if: ${{ failure() && github.event.pull_request.number != '' }} + uses: actions-cool/issues-helper@main + with: + actions: 'add-labels' + token: ${{ secrets.GITHUB_TOKEN }} + issue-number: ${{ github.event.pull_request.number }} + labels: '🚨 test failed' + + - name: Remove test failed label + if: ${{ success() && github.event.pull_request.number != '' }} + uses: actions-cool/issues-helper@main + with: + actions: 'remove-labels' + token: ${{ secrets.GITHUB_TOKEN }} + issue-number: ${{ github.event.pull_request.number }} + labels: '🚨 test failed' diff --git a/.github/workflows/test.yml b/.github/workflows/test-s2-react.yml similarity index 96% rename from .github/workflows/test.yml rename to .github/workflows/test-s2-react.yml index 51251dfb66..60df854bfd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test-s2-react.yml @@ -1,4 +1,4 @@ -name: 💯 test +name: 💯 test (@antv/s2-react) on: [pull_request] @@ -11,7 +11,7 @@ jobs: # jest-electron 需要 macOS 环境, 但是 免费用户 并发有限制, 容易排队 https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners # runs-on: macos-latest # (目前 macos-latest 对应的是 Big Sur 11, macos-12 对应 Monterey 12) # macOS 3-core CPU, 其他 2-core CPU - runs-on: macos-latest + runs-on: macos-14 if: "!contains(github.event.head_commit.message, '[skip ci]')" strategy: matrix: @@ -41,7 +41,7 @@ jobs: - name: Test run: | - pnpm test:ci-coverage + pnpm --filter @antv/s2-react test:ci-coverage - name: Upload test coverage uses: codecov/codecov-action@v3 diff --git a/.github/workflows/test-s2.yml b/.github/workflows/test-s2.yml new file mode 100644 index 0000000000..7cca75115d --- /dev/null +++ b/.github/workflows/test-s2.yml @@ -0,0 +1,84 @@ +name: 💯 test (@antv/s2) + +on: [pull_request] + +concurrency: + group: ${{github.workflow}}-${{github.event_name}}-${{github.ref}} + cancel-in-progress: true + +jobs: + test: + # jest-electron 需要 macOS 环境, 但是 免费用户 并发有限制, 容易排队 https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners + # runs-on: macos-latest # (目前 macos-latest 对应的是 Big Sur 11, macos-12 对应 Monterey 12) + # macOS 3-core CPU, 其他 2-core CPU + # > macos-14 会导致 CI 的测试卡死, 没有任何报错!!! + runs-on: macos-14 + if: "!contains(github.event.head_commit.message, '[skip ci]')" + strategy: + matrix: + node-version: [20] + + steps: + - uses: actions/checkout@v4 + + # Python 3.11 和 node-gyp 有兼容问题, 导致无法安装依赖 + # https://github.com/slint-ui/slint/commit/a9c48e33502fdebc36c5aa2f4f516c2218424679#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133dd + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + + - name: Install dependencies + run: pnpm bootstrap:ci + + - name: Test + run: | + pnpm --filter @antv/s2 test:ci-coverage + + - name: Upload test coverage + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false + verbose: true + + - name: Workflow failed alert + if: ${{ failure() }} + uses: actions-cool/maintain-one-comment@main + with: + token: ${{ secrets.GITHUB_TOKEN }} + body: | + 你好, @${{ github.event.pull_request.user.login }} CI 执行失败, 请点击 [Details] 按钮查看, 并根据日志修复。 + + Hello, @${{ github.event.pull_request.user.login }} CI run failed, please click the [Details] button for detailed log information and fix it. + + emojis: 'eyes' + body-include: '' + + # Github PR 列表 有显示 √ X 的提示, 但是比如一些 APP, 例如 codecov 的 patch 变低, 也会导致 出现 X, 添加label 在列表页快速识别是不是测试自身挂了 + - name: Workflow failed add test failed label + if: ${{ failure() && github.event.pull_request.number != '' }} + uses: actions-cool/issues-helper@main + with: + actions: 'add-labels' + token: ${{ secrets.GITHUB_TOKEN }} + issue-number: ${{ github.event.pull_request.number }} + labels: '🚨 test failed' + + - name: Remove test failed label + if: ${{ success() && github.event.pull_request.number != '' }} + uses: actions-cool/issues-helper@main + with: + actions: 'remove-labels' + token: ${{ secrets.GITHUB_TOKEN }} + issue-number: ${{ github.event.pull_request.number }} + labels: '🚨 test failed' diff --git a/.gitignore b/.gitignore index 9936a09d18..2c7368fef0 100644 --- a/.gitignore +++ b/.gitignore @@ -24,5 +24,6 @@ packages/s2-*/dist/ packages/s2-*/temp/ packages/s2-*/coverage/ packages/s2-*/stats.html +packages/**/*.css .swc diff --git a/.releaserc.base.js b/.releaserc.base.js index 7b318d03ec..63372dd79e 100644 --- a/.releaserc.base.js +++ b/.releaserc.base.js @@ -3,10 +3,9 @@ const path = require('path'); module.exports = { extends: 'semantic-release-monorepo', branches: [ - 'latest', { name: 'beta', channel: 'beta', prerelease: true }, { name: 'alpha', channel: 'alpha', prerelease: true }, - { name: 'next', channel: 'next', prerelease: true }, + { name: 'next', channel: 'latest', prerelease: false }, ], plugins: [ [ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d65dbc444b..04523a6772 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,70 +1,4 @@ language 简体中文 | [English](./CONTRIBUTING.en-US.md) -如果你恰好看到了这篇文章,你一定是希望对这个项目贡献自己的一份力量 - -## 欢迎任何形式的贡献 - -"我代码水平不行", "会不会受到鄙视?", "会不会不太好?", 放心,不存在的! - -我们欢迎任何形式的贡献,不管是一个**错别字的修改**,还是**一次友好的建议**,不管是通过提交 [Issue](https://github.com/antvis/S2/issues/new/choose), 还是一个帅气 [pull request](https://github.com/antvis/S2/pulls), 亦或是一次钉钉群的讨论,参与 [discussions](https://github.com/antvis/S2/discussions) 的讨论,期待在 [贡献者列表](https://github.com/antvis/S2/graphs/contributors) 里看见你的头像。 - -## 分支管理 - -目前我们主要基于 `master` 和 `next` 分支开发,有任何修改,请基于 `master` 或 `next` 拉一个分支,然后通过 `PR` 的形式提交,我们集成了钉钉机器人,会第一次时间 `review` 你的 `PR`, 给与反馈。 - -- `master`: `1.x` 版本 -- `next`: `2.x` 版本 -- `alpha`: `1.x-alpha.x` 版本 -- `beta`: `1.x-beta.x` 版本 - -## 🐛 提交 Bug 反馈 - -很抱歉又写了一些 bug, 但求友好的提交一个有意义的 bug 反馈,谁也不希望反馈的 bug 是这样: - -![preview](https://gw.alipayobjects.com/zos/antfincdn/j0jUvKwT%26/dd59fe64-7108-4ad7-a544-e19d79eea890.png) - -没有版本信息,没有复现步骤,没有问题描述,没有代码片段,开局一句话,内容全靠猜。 - -首先选择 [Bug report](https://github.com/antvis/S2/issues/new?assignees=&labels=&projects=&template=bug-report.md&title=%F0%9F%90%9B) - -![preview](https://gw.alipayobjects.com/zos/antfincdn/oAnzfiVl2/9d83b3e8-b05c-4475-b736-92c45448546a.png) - -按照 [Issue 模板](https://github.com/antvis/S2/tree/next/.github/ISSUE_TEMPLATE) 填写相关信息。 -是的,这些步骤稍微有一些繁琐,但的确是有效且必须的,每个用户使用的场景都不同,系统环境,软件版本,又或是需要一些特定的步骤才能复现 bug, 这个时候说清楚,可以节省大家的时间! - -![preview](https://gw.alipayobjects.com/zos/antfincdn/05O3p5nE5/d0d4b120-e5aa-4b51-918b-8a573f8fb794.png) - -## 🙋‍♂️ Pull Request - -> 示例 [PR](https://github.com/antvis/S2/pull/1652) (pr 描述参考) - -1. fork 项目 并 clone 下来 (或者使用 GitHub 的 Codespaces 功能,非常方便). -2. 安装依赖:`pnpm install` 或者 `pnpm bootstrap` 然后本地启动项目。 -3. 提交你的改动,commit 请遵守 [AngularJS Git Commit Message Conventions](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#heading=h.uyo6cb12dt6w). -4. 如果你的改动是修复 bug, 还可以在提交信息后面加上 `close #issue 号`, 这样可以在 pr 合并后,可以自动关闭对应的 issue, 比如 `fix: render bug close #123`. -5. 确保加上了对应的单元测试和文档 (如果有 `Snapshot` UI 快照 (.snap 文件)更新,可以运行 `pnpm core:test -- -u` 和 `pnpm react:test -- -u` 自动更新,并一起提交上来,请勿手动编辑) -6. 所有 Lint 和 Test 检查通过后,并且 review 通过,我们会合并你的 pr. - -![preview](https://gw.alipayobjects.com/zos/antfincdn/ssOxFrycD/86339514-5f9a-4101-8690-e47c97cd8af5.png) - -## 开发流程 - -我们使用 `pnpm` 作为包管理 - -```bash -npm i -g pnpm -``` - -推荐本地运行 `pnpm react:playground` 来调试 `@antv/s2` 和 `@antv/s2-react` - -1. `pnpm install` 安装依赖 -2. `pnpm site:bootstrap` 安装网站相关依赖 -3. `pnpm site:start` 启动本地的 `S2` 网站 -4. `pnpm core:start` 可视化的方式调试核心层 `@antv/s2` (基于 jest-electron) -5. `pnpm react:start` 可视化的方式调试组件层 `@antv/s2-react` (基于 jest-electron) -6. `pnpm vue:start` 可视化的方式调试组件层 `@antv/s2-vue` (基于 jest-electron) -7. `pnpm react:playground` 启动本地的组件层 `@antv/s2-react` demo (基于 vite) -8. `pnpm vue:playground` 启动本地的组件层 `@antv/s2-vue` demo (基于 vite) -9. `pnpm build` 构建 `@antv/s2` 和 `@antv/s2-react` 和 `@antv/s2-vue` 三个包,分别输出 `umd`, `esm` 和 `lib` 目录 -10. `pnpm test` 运行单元格测试 +请阅读 [贡献指南](https://s2.antv.antgroup.com/manual/contribution) diff --git a/README.en-US.md b/README.en-US.md index 95392e2148..cd356249de 100644 --- a/README.en-US.md +++ b/README.en-US.md @@ -13,9 +13,6 @@ A practical visualization library for tabular analysis. latest version - - - next version ci test status @@ -30,7 +27,7 @@ A practical visualization library for tabular analysis.

- npm bundle size + npm bundle size GitHub discussions @@ -77,9 +74,9 @@ demo components and expansion capabilities, it allows developers to use it quick ## 📦 Installation ```bash -$ npm install @antv/s2@next --save -# yarn add @antv/s2@next -# pnpm add @antv/s2@next +$ npm install @antv/s2 --save +# yarn add @antv/s2 +# pnpm add @antv/s2 ``` ## 🔨 Getting Started @@ -208,11 +205,12 @@ bootstrap() ### 📦 Packages -| Package | Latest | Beta | Alpha | Next | Size | Download | -| - | - | - | - | - | - | - | -| [@antv/s2](https://github.com/antvis/S2/tree/next/packages/s2-core) | ![latest](https://img.shields.io/npm/v/@antv/s2/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2.svg) | -| [@antv/s2-react](https://github.com/antvis/S2/tree/next/packages/s2-react) | ![latest](https://img.shields.io/npm/v/@antv/s2-react/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-react/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-react/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-react/next.svg)| ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react.svg) | -| [@antv/s2-vue](https://github.com/antvis/S2/tree/next/packages/s2-vue) | ![latest](https://img.shields.io/npm/v/@antv/s2-vue/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-vue/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-vue/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-vue/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-vue@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg) | +| Package | Latest | Size | Download | +| -------- | ------ | ---------- | ------ | +| [@antv/s2](https://github.com/antvis/S2/tree/next/packages/s2-core) | ![latest](https://img.shields.io/npm/v/@antv/s2/latest.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2.svg?logo=npm) | +| [@antv/s2-react](https://github.com/antvis/S2/tree/next/packages/s2-react) | ![latest](https://img.shields.io/npm/v/@antv/s2-react/latest.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react.svg?logo=npm) | +| [@antv/s2-react-components](https://github.com/antvis/S2/tree/next/packages/s2-react-components) | ![latest](https://img.shields.io/npm/v/@antv/s2-react-components/latest.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react-components@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react-components.svg?logo=npm) | +| [@antv/s2-vue](https://github.com/antvis/S2/tree/next/packages/s2-vue) | ![latest](https://img.shields.io/npm/v/@antv/s2-vue/latest.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-vue@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg?logo=npm) | ### 🖥️ Browser Compatibility @@ -266,14 +264,6 @@ pnpm site:start ![Alt](https://repobeats.axiom.co/api/embed/ebb7eecb994dc0e3980044aefe43eb81302e3632.svg "Repobeats analytics image") -## 📧 Contact Us - -

- - S2 - -

- ## 👬 Contributors ![https://github.com/antvis/s2/graphs/contributors](https://contrib.rocks/image?repo=antvis/s2) diff --git a/README.md b/README.md index ebb7941e60..cf073ba097 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,6 @@ latest version - - - next version ci test status @@ -29,7 +26,7 @@

- npm bundle size + npm bundle size GitHub discussions @@ -64,7 +61,7 @@ S2 是 AntV 在多维交叉分析表格领域的解决方案,完全基于数 ## ✨ 特性 -1. 多维交叉分析: 告别单一分析维度,全面拥抱任意维度的自由组合分析。 +1. 多维交叉分析:告别单一分析维度,全面拥抱任意维度的自由组合分析。 2. 高性能:能支持全量百万数据下 `<8s` 渲染,也能通过局部下钻来实现秒级渲染。 3. 高扩展性:支持任意的自定义扩展(包括但不局限于布局,样式,交互,数据 hook 流等)。 4. 开箱即用:提供不同分析场景下开箱即用的 `React`, `Vue3` 版本表组件及配套分析组件,只需要简单的配置即可轻松实现复杂场景的表渲染。 @@ -73,9 +70,9 @@ S2 是 AntV 在多维交叉分析表格领域的解决方案,完全基于数 ## 📦 安装 ```bash -$ npm install @antv/s2@next --save -# yarn add @antv/s2@next -# pnpm add @antv/s2@next +$ npm install @antv/s2 --save +# yarn add @antv/s2 +# pnpm add @antv/s2 ``` ## 🔨 使用 @@ -204,11 +201,12 @@ bootstrap() ### 📦 版本 -| Package | Latest | Beta | Alpha | Next | Size | Download | -| - | - | - | - | - | - | - | -| [@antv/s2](https://github.com/antvis/S2/tree/next/packages/s2-core) | ![latest](https://img.shields.io/npm/v/@antv/s2/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2.svg) | -| [@antv/s2-react](https://github.com/antvis/S2/tree/next/packages/s2-react) | ![latest](https://img.shields.io/npm/v/@antv/s2-react/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-react/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-react/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-react/next.svg)| ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react.svg) | -| [@antv/s2-vue](https://github.com/antvis/S2/tree/next/packages/s2-vue) | ![latest](https://img.shields.io/npm/v/@antv/s2-vue/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-vue/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-vue/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-vue/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-vue@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg) | +| 包名 | 稳定版 | 包大小 | 下载量 | +| -------- | ------ | --------- | ------ | +| [@antv/s2](https://github.com/antvis/S2/tree/next/packages/s2-core) | ![latest](https://img.shields.io/npm/v/@antv/s2/latest.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2.svg?logo=npm) | +| [@antv/s2-react](https://github.com/antvis/S2/tree/next/packages/s2-react) | ![latest](https://img.shields.io/npm/v/@antv/s2-react/latest.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react.svg?logo=npm) | +| [@antv/s2-react-components](https://github.com/antvis/S2/tree/next/packages/s2-react-components) | ![latest](https://img.shields.io/npm/v/@antv/s2-react-components/latest.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react-components@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react-components.svg?logo=npm) | +| [@antv/s2-vue](https://github.com/antvis/S2/tree/next/packages/s2-vue)(停止维护)| ![latest](https://img.shields.io/npm/v/@antv/s2-vue/latest.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-vue@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg?logo=npm) | ### 🖥️ 兼容环境 @@ -220,52 +218,18 @@ bootstrap() ## 🙋‍♂️ 问题反馈 -有任何问题请严格按照模版 [提交 Issue](https://github.com/antvis/S2/issues/new/choose), 在这之前强烈建议阅读 [《⚠️ 提 Issue 前必读》](https://github.com/antvis/S2/issues/1904) - -## ⌨️ 本地开发 - -```bash -git clone git@github.com:antvis/S2.git - -cd S2 - -# 安装依赖 -pnpm install # 或者 pnpm bootstrap - -# 打包 -pnpm build +如果你遇到了问题,或者对 [Issues](https://github.com/antvis/S2/issues) 和 [Discussions](https://github.com/antvis/S2/discussions) 列表的问题感兴趣,**可以直接认领并尝试修复**,帮助 S2 变得更好,期待在 [贡献者列表](https://github.com/antvis/S2/graphs/contributors) 里看见你的头像。 -# 调试 s2-core -pnpm core:start +请严格按照模版 [提交 Issue](https://github.com/antvis/S2/issues/new/choose) 或在 [Discussions](https://github.com/antvis/S2/discussions) 提问,在这之前强烈建议阅读 [《⚠️ 提 Issue 前必读》](https://github.com/antvis/S2/issues/1904) -# 调试 s2-react -pnpm react:playground +## 🤝 参与贡献 & ⌨️ 本地开发 -# 调试 s2-vue -pnpm vue:playground - -# 单元测试 -pnpm test - -# 代码风格和类型检测 -pnpm lint - -# 本地启动官网 -pnpm site:start -``` - -## 🤝 参与贡献 - -请查看 [贡献指南](https://s2.antv.antgroup.com/manual/contribution) +S2 非常需要你的共建,请阅读 [贡献指南](https://s2.antv.antgroup.com/manual/contribution) 后提交 PR. ## 👁️ 项目洞察 ![Alt](https://repobeats.axiom.co/api/embed/ebb7eecb994dc0e3980044aefe43eb81302e3632.svg "Repobeats analytics image") -## 📧 反馈问题 - -有任何问题请严格按照模版 [提交 Issue](https://github.com/antvis/S2/issues/new/choose) 或在 [Discussions](https://github.com/antvis/S2/discussions) 提问。 - ## 👬 贡献者们 ![https://github.com/antvis/s2/graphs/contributors](https://contrib.rocks/image?repo=antvis/s2) diff --git a/build.config.base.mjs b/build.config.base.mjs new file mode 100644 index 0000000000..8a5aac453a --- /dev/null +++ b/build.config.base.mjs @@ -0,0 +1,159 @@ +/* eslint-disable max-lines-per-function */ +/* eslint-disable import/order */ +import { viteCommonjs } from '@originjs/vite-plugin-commonjs'; +import { toLower } from 'lodash'; +import path from 'path'; +import peerDepsExternal from 'rollup-plugin-peer-deps-external'; +import { visualizer } from 'rollup-plugin-visualizer'; + +export const getBaseConfig = ({ + aliasReact = false, + aliasReactComponents = false, +} = {}) => { + const entry = './src/index.ts'; + + const OUT_DIR_NAME_MAP = { + es: 'esm', + cjs: 'lib', + umd: 'dist', + }; + + const format = process.env.FORMAT; + const isAnalysisMode = process.env.ANALYSIS; + const isDevMode = process.env.PLAYGROUND; + const outDir = OUT_DIR_NAME_MAP[format]; + const isUMD = format === 'umd'; + const isESM = format === 'es'; + + const define = { + 'process.env.NODE_ENV': JSON.stringify( + isDevMode ? 'development' : 'production', + ), + }; + + const resolve = { + mainFields: ['src', 'module', 'main'], + alias: [], + }; + + if (isDevMode) { + // 防止开发模式下直接加载 s2-core 中的主题 less + resolve.alias.push( + ...[ + { + find: /^@antv\/s2$/, + replacement: path.join(__dirname, './packages/s2-core/src'), + }, + { + find: /^@antv\/s2\/extends$/, + replacement: path.join(__dirname, './packages/s2-core/src/extends'), + }, + aliasReact && { + find: /^@antv\/s2-react$/, + replacement: path.join(__dirname, './packages/s2-react/src'), + }, + aliasReactComponents && { + find: /^@antv\/s2-react-components$/, + replacement: path.join( + __dirname, + './packages/s2-react-components/src', + ), + }, + ].filter(Boolean), + ); + } + + const getViteConfig = ( + { port, name, libName, plugins } = { + port: 3001, + plugins: [], + }, + ) => { + const filename = isUMD ? `${toLower(name || libName)}.min` : '[name]'; + + return { + server: { + port, + hmr: true, + }, + + resolve, + + define: { + 'process.env.NODE_ENV': JSON.stringify( + isDevMode ? 'development' : 'production', + ), + }, + + plugins: [ + peerDepsExternal(), + !isDevMode && viteCommonjs(), + isAnalysisMode && + visualizer({ + open: true, + gzipSize: true, + brotliSize: true, + }), + ...plugins, + ].filter(Boolean), + + css: { + preprocessorOptions: { + less: { + javascriptEnabled: true, + }, + }, + modules: { + /** + * 样式小驼峰转化 + * css: goods-list => tsx: goodsList + */ + localsConvention: 'camelCase', + }, + }, + + build: { + target: 'es2015', + minify: isUMD ? 'esbuild' : false, + sourcemap: true, + lib: { + name: libName, + entry, + formats: [format], + }, + outDir, + rollupOptions: { + output: { + dir: outDir, + entryFileNames: `${filename}.js`, + assetFileNames: `${filename}.[ext]`, + globals: { + vue: 'Vue', + react: 'React', + 'react-dom': 'ReactDOM', + '@antv/s2': 'S2', + '@antv/s2-react': 'S2React', + lodash: '_', + antd: 'antd', + 'ant-design-vue': 'antd', + }, + }, + }, + }, + }; + }; + + return { + entry, + getViteConfig, + define, + format, + resolve, + isAnalysisMode, + outDir, + OUT_DIR_NAME_MAP, + isDevMode, + isUMD, + isESM, + }; +}; diff --git a/jest.config.base.js b/jest.config.base.js index 7a9905c693..af2e973948 100644 --- a/jest.config.base.js +++ b/jest.config.base.js @@ -6,6 +6,8 @@ module.exports = { setupFilesAfterEnv: ['jest-extended', './__tests__/setup.js'], clearMocks: true, collectCoverage: false, + verbose: true, + forceExit: true, collectCoverageFrom: [ 'src/**/*.{ts,tsx,js,vue}', '!**/node_modules/**', @@ -43,16 +45,17 @@ module.exports = { '\\.svg$': 'jest-raw-loader', }, moduleNameMapper: { + '\\.svg$': '/__tests__/__mocks__/svg.ts', '^@/(.*)': '/src/$1', '^tests/(.*)': '/__tests__/$1', '^@antv/s2$': path.join(__dirname, 'packages/s2-core/src'), - '^@antv/s2-shared$': path.join(__dirname, 'packages/s2-shared/src'), + '^@antv/s2/esm/(.*)$': path.join(__dirname, 'packages/s2-core/src/$1'), + '^@antv/s2/extends$': path.join(__dirname, 'packages/s2-core/src/extends'), '^@antv/s2-react$': path.join(__dirname, 'packages/s2-react/src'), '^@antv/s2-react-components$': path.join( __dirname, 'packages/s2-react-components/src', ), - '\\.svg$': '/__tests__/__mocks__/svg.ts', /* ignore module query: foo.less?a=1 -> foo.less */ '(.+)\\.(.+)\\?(.*)$': '$1.$2', }, diff --git a/package.json b/package.json index f03c70a303..0ad4d26580 100644 --- a/package.json +++ b/package.json @@ -21,8 +21,10 @@ "url": "https://github.com/antvis/S2.git" }, "license": "MIT", + "files": [], "scripts": { "preinstall": "npx only-allow pnpm", + "postinstall": "pnpm core:build-esm", "bootstrap": "pnpm install", "bootstrap:ci": "pnpm bootstrap --frozen-lockfile", "prepare": "husky install", @@ -32,12 +34,14 @@ "core:start": "pnpm --filter @antv/s2 start", "core:watch": " pnpm --filter @antv/s2 watch", "core:build": "pnpm --filter @antv/s2 build", + "core:build-esm": "pnpm --filter @antv/s2 build:esm", "core:test": "pnpm --filter @antv/s2 test", "core:test-coverage": "pnpm --filter @antv/s2 test:coverage", "core:sync-event": "pnpm --filter @antv/s2 sync-event", "react:start": "pnpm --filter @antv/s2-react test:live", "react:playground": "pnpm --filter @antv/s2-react start", "react:build": "pnpm --filter @antv/s2-react build", + "react:build-esm": "pnpm --filter @antv/s2-react build:esm", "react:test": "pnpm --filter @antv/s2-react test", "react:test-coverage": "pnpm --filter @antv/s2-react test:coverage", "react:watch": " pnpm --filter @antv/s2-react watch", @@ -55,7 +59,7 @@ "build:umd": "pnpm -r --filter './packages/*' --stream build:umd", "build:size-limit": "pnpm -r --filter './packages/*' --stream build:size-limit", "build:size-limit-json": "pnpm -r --filter './packages/*' --stream build:size-limit-json", - "release": "pnpm -r --filter !@antv/s2-shared --filter !@antv/s2-site --workspace-concurrency=1 exec npx --no-install semantic-release", + "release": "pnpm -r --filter !@antv/s2-site --filter !@antv/s2-vue --workspace-concurrency=1 exec npx --no-install semantic-release", "release:preview": "pnpm release --dry-run --no-ci", "release:bump-version": "node ./scripts/bump-version.js", "test": "pnpm -r --filter './packages/*' --stream test", @@ -77,7 +81,6 @@ "site:build": "NODE_OPTIONS='--max-old-space-size=4096' pnpm --filter @antv/s2-site build", "site:preview": "pnpm --filter @antv/s2-site preview", "site:deploy": "pnpm --filter @antv/s2-site deploy", - "share:test": "pnpm --filter @antv/s2-shared test", "format": "prettier . --write" }, "commitlint": { @@ -162,7 +165,7 @@ "jest-url-loader": "^0.1.0", "less": "^4.2.0", "lint-staged": "^15.2.5", - "lodash-es": "^4.17.21", + "lodash": "^4.17.21", "markdownlint-cli": "^0.41.0", "npm-run-all": "^4.1.5", "ora": "^8.0.1", diff --git a/packages/s2-core/CHANGELOG.md b/packages/s2-core/CHANGELOG.md index 170b9cbba5..dfaa5bbf24 100644 --- a/packages/s2-core/CHANGELOG.md +++ b/packages/s2-core/CHANGELOG.md @@ -1,3 +1,498 @@ +# [@antv/s2-v2.1.4](https://github.com/antvis/S2/compare/@antv/s2-v2.1.3...@antv/s2-v2.1.4) (2024-12-13) + + +### Bug Fixes + +* 修复在维值缺失场景下导出数据占位符未解析的问题 ([#3027](https://github.com/antvis/S2/issues/3027)) ([6e63b97](https://github.com/antvis/S2/commit/6e63b970da353a7ccc231e3cbf716a008e191f4f)) +* 修复行头圈选复制时部分场景下数据重复 close [#2975](https://github.com/antvis/S2/issues/2975) ([#3029](https://github.com/antvis/S2/issues/3029)) ([001573f](https://github.com/antvis/S2/commit/001573f2dedbf069c996deb1579bcc9525f5efa8)) +* 构建产物编译到 es2015 close [#3025](https://github.com/antvis/S2/issues/3025) ([#3026](https://github.com/antvis/S2/issues/3026)) ([0a7977c](https://github.com/antvis/S2/commit/0a7977c1793a8171b14b07a22847b4dd9ed85d5f)) +* 解决移动端下,树形结构展开、收起交互失效的问题 ([#3039](https://github.com/antvis/S2/issues/3039)) ([a97625c](https://github.com/antvis/S2/commit/a97625c8524c660956fbb815ba943210d6f3fc76)) + +# [@antv/s2-v2.1.3](https://github.com/antvis/S2/compare/@antv/s2-v2.1.2...@antv/s2-v2.1.3) (2024-12-09) + + +### Bug Fixes + +* 修复手动排序在单行头且维值相似的场景不生效 ([#3019](https://github.com/antvis/S2/issues/3019)) ([6221958](https://github.com/antvis/S2/commit/6221958ddc4113384260f82fd54f768077168287)) +* 选中事件增加 event 信息 ([#3021](https://github.com/antvis/S2/issues/3021)) ([291c727](https://github.com/antvis/S2/commit/291c727959d496f5210a2bc47bcdb0919080defa)) + +# [@antv/s2-v2.1.2](https://github.com/antvis/S2/compare/@antv/s2-v2.1.1...@antv/s2-v2.1.2) (2024-12-06) + + +### Bug Fixes + +* 修复明细表自定义行高时多行文本未自适应调整 ([#3017](https://github.com/antvis/S2/issues/3017)) ([8a55fa6](https://github.com/antvis/S2/commit/8a55fa6be4d3030845b54f5f11e752e31d9919e1)) + +# [@antv/s2-v2.1.1](https://github.com/antvis/S2/compare/@antv/s2-v2.1.0...@antv/s2-v2.1.1) (2024-12-04) + + +### Bug Fixes + +* 修复下钻组件展示错误操作 icon & 兼容低版本 menu 写法 ([#3011](https://github.com/antvis/S2/issues/3011)) ([7d171f0](https://github.com/antvis/S2/commit/7d171f037e7f52cc49ad02ddf56598aa477bf043)) +* 修复点击单元格中的 icon 时无法获取到单元格 meta 信息的问题 close [#2985](https://github.com/antvis/S2/issues/2985) ([#3013](https://github.com/antvis/S2/issues/3013)) ([67853a2](https://github.com/antvis/S2/commit/67853a2c08456ff166e948c9be30eb817e220079)) +* 修复角头存在多行文本时未自动撑开列头高度的问题 ([#3010](https://github.com/antvis/S2/issues/3010)) ([0b79f27](https://github.com/antvis/S2/commit/0b79f27870b7183cdb1632f713823059f7449444)) + +# [@antv/s2-v2.1.0](https://github.com/antvis/S2/compare/@antv/s2-v2.0.1...@antv/s2-v2.1.0) (2024-11-29) + + +### Bug Fixes + +* **tooltip:** 修复操作按钮的 visible 对角头和文本溢出场景不生效 ([#3001](https://github.com/antvis/S2/issues/3001)) ([8f56023](https://github.com/antvis/S2/commit/8f56023b4f29584bc619b00bc5a03a0c3bf30494)) +* 修复行头底部存在多行文本, 初始化和滚动时文本展示溢出的问题 ([#3000](https://github.com/antvis/S2/issues/3000)) ([6204839](https://github.com/antvis/S2/commit/620483901c40d64e2e1e6be6753a08ee26f35677)) +* 明细表未指定 dataCfg.fields 配置时不应该渲染空数据占位 ([#3003](https://github.com/antvis/S2/issues/3003)) ([60d6497](https://github.com/antvis/S2/commit/60d649705365bca0bde3acc836bd8eeb13e47c3c)) + + +### Features + +* 增加树状模式下行头宽度配置 rowCell.treeWidth ([#2998](https://github.com/antvis/S2/issues/2998)) ([b8fdd2a](https://github.com/antvis/S2/commit/b8fdd2a700a9a3bdc5d565c2bf89a85427c66a88)) + +# [@antv/s2-v2.0.1](https://github.com/antvis/S2/compare/@antv/s2-v2.0.0...@antv/s2-v2.0.1) (2024-11-26) + +# [@antv/s2-v2.0.0](https://github.com/antvis/S2/compare/@antv/s2-v1.45.1...@antv/s2-v2.0.0) (2024-11-21) + + +### Bug Fixes + +* canvas mouseout 判断错误 ([#2181](https://github.com/antvis/S2/issues/2181)) ([16c0b82](https://github.com/antvis/S2/commit/16c0b824aef16d109e8db8d2fe6b3a25a413dcfa)) +* cornerheader无列头时不渲染序号列 ([abf5e68](https://github.com/antvis/S2/commit/abf5e6821209665a6c9aea9050e069eaa4fe8b46)) +* **g:** 修复表格初次渲染时部分 icon 不展示 close [#2014](https://github.com/antvis/S2/issues/2014) ([#2606](https://github.com/antvis/S2/issues/2606)) ([3f9a176](https://github.com/antvis/S2/commit/3f9a176f75c46fa58e50d0fd70a652242f7b6df3)) +* **interaction:** 修复在未选中状态下调整宽高, 错误的修改了相邻单元格的样式 ([#2605](https://github.com/antvis/S2/issues/2605)) ([8019788](https://github.com/antvis/S2/commit/8019788bf5b44414a2006f34c89f68fcb37207f0)) +* **interaction:** 修复自定义列头时无法调整第一列的叶子节点高度 close [#1979](https://github.com/antvis/S2/issues/1979) ([#2038](https://github.com/antvis/S2/issues/2038)) ([a632ab1](https://github.com/antvis/S2/commit/a632ab19193b19ab80f456ab3ce19740dce0e52b)) +* **interaction:** 修复表格滚动后, 行列头部分单元格选中高亮效果丢失 close [#2503](https://github.com/antvis/S2/issues/2503) ([#2545](https://github.com/antvis/S2/issues/2545)) ([3a7803b](https://github.com/antvis/S2/commit/3a7803bd460fa332ff4d1a5b37f3192bf58bf866)) +* **interaction:** 修复隐藏列头配置更新时未覆盖上一次的配置 close [#2495](https://github.com/antvis/S2/issues/2495) ([#2527](https://github.com/antvis/S2/issues/2527)) ([ddc1283](https://github.com/antvis/S2/commit/ddc12830fa32f001ff7009a2bee8ce8624a1a187)) +* **layout:** 修复空数据的情况开启汇总分组渲染报错 close [#2661](https://github.com/antvis/S2/issues/2661) ([#2662](https://github.com/antvis/S2/issues/2662)) ([8158660](https://github.com/antvis/S2/commit/81586601ea7451f6ca56932bd4bf4ef7738dbd7d)) +* **layout:** 修复自定义列头采样错误导致行角头不显示 close [#2117](https://github.com/antvis/S2/issues/2117) ([#2175](https://github.com/antvis/S2/issues/2175)) ([2266272](https://github.com/antvis/S2/commit/22662721739b45fbe5c00c1157ad00071d8f5f0d)) +* **layout:** 修复行头收起全部时, 自定义列头被折叠的问题 closes [#2018](https://github.com/antvis/S2/issues/2018) [#2019](https://github.com/antvis/S2/issues/2019) ([#2639](https://github.com/antvis/S2/issues/2639)) ([dfc3225](https://github.com/antvis/S2/commit/dfc3225bbc431e8dcc30d0f42f7fb5389ec53c82)) +* **scroll:** 修复移动端滚动至边缘时抖动 ([#2556](https://github.com/antvis/S2/issues/2556)) ([3a2cd7c](https://github.com/antvis/S2/commit/3a2cd7c10bb59cc1eb9e23f366db3e65674eede1)) +* **table-sheet:** 修复明细表配置自定义行高后展示异常 close [#2501](https://github.com/antvis/S2/issues/2501) ([#2521](https://github.com/antvis/S2/issues/2521)) ([47fdee3](https://github.com/antvis/S2/commit/47fdee3ebbae900ba815fba8c18e3a0566aa8f8c)) +* **type:** 修复 g renderer 的错误类型定义 ([#2939](https://github.com/antvis/S2/issues/2939)) ([523b2cc](https://github.com/antvis/S2/commit/523b2ccb8884933060000854f28d9a6d8b2806f5)) +* wheel scroll error! ([#2643](https://github.com/antvis/S2/issues/2643)) ([43cf364](https://github.com/antvis/S2/commit/43cf364cabc22409f405a1e6297d2d7196f8050b)) +* 下钻后meta.childField不正确 ([#1788](https://github.com/antvis/S2/issues/1788)) ([1c61dd4](https://github.com/antvis/S2/commit/1c61dd4081c9d3fed6f276b0546865914040b07a)) +* 传入g的supportCSSTransform改为supportsCSSTransform ([7531aab](https://github.com/antvis/S2/commit/7531aab7fd12a35533d95267a818dfd3f821ece0)) +* 修复 expandDepth 在自定义行头场景下不生效 ([#2895](https://github.com/antvis/S2/issues/2895)) ([d83a816](https://github.com/antvis/S2/commit/d83a81674e587eab129630c0d3bc4f87b6550471)) +* 修复 frame 角头部分绘制尺寸问题 ([aa6e48a](https://github.com/antvis/S2/commit/aa6e48acc54b0bb87c81842c7951f5872e446e8f)) +* 修复 headerActionIcons 下的 defaultHide 属性不生效 close [#2772](https://github.com/antvis/S2/issues/2772) ([#2774](https://github.com/antvis/S2/issues/2774)) ([d142efa](https://github.com/antvis/S2/commit/d142efacf3b35bbcc5f8ac3dc0a1dbe61eb167bd)) +* 修复 meta name 同名时,hoverFocus 出错的问题 ([#2180](https://github.com/antvis/S2/issues/2180)) ([1480528](https://github.com/antvis/S2/commit/1480528c119f33fe40bc08e52e7abf87e9f9a797)) +* 修复 React 18 环境下 Tooltip 卸载后无法再次渲染 & 排序菜单选中效果丢失的问题 ([#2698](https://github.com/antvis/S2/issues/2698)) ([0af329d](https://github.com/antvis/S2/commit/0af329da596733eee8013a7a1f04676a720767d3)) +* 修复下载数据重复 close [#2718](https://github.com/antvis/S2/issues/2718) ([#2719](https://github.com/antvis/S2/issues/2719)) ([f0d5192](https://github.com/antvis/S2/commit/f0d5192e769a392df84a4e85e245496ac7c0ef31)) +* 修复分割线在深色背景下颜色渲染异常 & 内容宽高未包含分割线的问题 ([#2961](https://github.com/antvis/S2/issues/2961)) ([e759891](https://github.com/antvis/S2/commit/e759891865eee0940d0f5c92345d5490e10eb57c)) +* 修复列等宽布局模式下角头出现省略号 close [#2726](https://github.com/antvis/S2/issues/2726) ([#2732](https://github.com/antvis/S2/issues/2732)) ([b4e07b9](https://github.com/antvis/S2/commit/b4e07b94a1c77163254ff3acc39baa93b0d151aa)) +* 修复只有一行数据时异步导出数据为空 close [#2681](https://github.com/antvis/S2/issues/2681) ([#2682](https://github.com/antvis/S2/issues/2682)) ([fecd455](https://github.com/antvis/S2/commit/fecd455cf3b18a76cbae680ebb27ae7c1dcb66ec)) +* 修复合并 master 的 copy 相关单测 ([8587137](https://github.com/antvis/S2/commit/8587137703b89152f67335908e47e04ef6d41997)) +* 修复在局部复制和导出场景时, 格式化函数获取不到单元格信息 close [#2866](https://github.com/antvis/S2/issues/2866) ([#2871](https://github.com/antvis/S2/issues/2871)) ([f0db754](https://github.com/antvis/S2/commit/f0db75405561e0c841ae2fe57fb490f08dad7d50)) +* 修复在明细表中绘制 G2 图表, 点击单元格报错 close [#2843](https://github.com/antvis/S2/issues/2843) ([#2864](https://github.com/antvis/S2/issues/2864)) ([8684fb2](https://github.com/antvis/S2/commit/8684fb286279c4d1e280e00baf197f154ac3a540)) +* 修复字段标记 mapping 函数部分场景缺失第三个参数 & 调整参数类型 ([#2927](https://github.com/antvis/S2/issues/2927)) ([676c1f6](https://github.com/antvis/S2/commit/676c1f68101a9191b48d23ce1ec15f852bcebc5d)) +* 修复字段标记背景色透明度优先级低于主题背景色透明度的问题 ([#2744](https://github.com/antvis/S2/issues/2744)) ([6949f60](https://github.com/antvis/S2/commit/6949f6007f1d6c6ced4011803be9c24d326f084b)) +* 修复存在字段标记的 icon 时, 紧凑模式列宽计算错误出现省略号的问题 ([#2920](https://github.com/antvis/S2/issues/2920)) ([75acbfe](https://github.com/antvis/S2/commit/75acbfe4540bf8dc702a3a068c214c9217239261)) +* 修复导出 CSV 时分隔符错误导致的展示格式错误 close [#2701](https://github.com/antvis/S2/issues/2701) ([#2703](https://github.com/antvis/S2/issues/2703)) ([98c051a](https://github.com/antvis/S2/commit/98c051a58c1d8b7c7831343ba909238e514615ae)) +* 修复导出数据分隔符有误的问题 ([#2241](https://github.com/antvis/S2/issues/2241)) ([ec0a31c](https://github.com/antvis/S2/commit/ec0a31c4fc660b44176b074d4cc8c098dbe95eb4)) +* 修复开启 supportsCSSTransform 后 hover 在表格上时报错 ([#2947](https://github.com/antvis/S2/issues/2947)) ([d328598](https://github.com/antvis/S2/commit/d328598f080ff5ce8336f8cd98c200a5052d348c)) +* 修复开启自定义指标层级后, 角头数值文本未对齐 close [#2957](https://github.com/antvis/S2/issues/2957) ([#2966](https://github.com/antvis/S2/issues/2966)) ([6558a0d](https://github.com/antvis/S2/commit/6558a0df55dc324e1810e2f2a5d314de7389e2b1)) +* 修复所有lint错误 ([9b62503](https://github.com/antvis/S2/commit/9b62503ebdf1ef9aa94470c8d18be99122d0c2dc)) +* 修复拖拽列宽后, 默认的自定义列宽失效 close [#2910](https://github.com/antvis/S2/issues/2910) ([#2915](https://github.com/antvis/S2/issues/2915)) ([8302fe4](https://github.com/antvis/S2/commit/8302fe40bc475baecf72ba463ac948d33a391a3f)) +* 修复数值单元格 tooltip 内的指标名展示错误 ([#2941](https://github.com/antvis/S2/issues/2941)) ([a426a46](https://github.com/antvis/S2/commit/a426a468d8cc1fe7ec0fd1db0e04938884ec0f46)) +* 修复数值单元格内的自定义 icon 点击时会选中单元格的问题 close [#2333](https://github.com/antvis/S2/issues/2333) ([#2567](https://github.com/antvis/S2/issues/2567)) ([3d9f9aa](https://github.com/antvis/S2/commit/3d9f9aaba931b54226e4fd9e6004fc1bd9688791)) +* 修复数据导出时列头被格式化 close [#2688](https://github.com/antvis/S2/issues/2688) ([#2694](https://github.com/antvis/S2/issues/2694)) ([19d8e60](https://github.com/antvis/S2/commit/19d8e608c27da89771cef7439402585af00750b9)) +* 修复文本存在换行符时, 未显示省略号的问题 ([#2978](https://github.com/antvis/S2/issues/2978)) ([08dbf0d](https://github.com/antvis/S2/commit/08dbf0d9c63f1c64989fe242c9645df06e6b04e5)) +* 修复文本行数不一致时自动换行高度自适应失效 close [#2594](https://github.com/antvis/S2/issues/2594) ([#2598](https://github.com/antvis/S2/issues/2598)) ([fae5496](https://github.com/antvis/S2/commit/fae5496e503205f319e7bdc79240d31dacd4e850)) +* 修复文本设为左对齐时, 角头文本没有垂直对齐的问题 ([#2960](https://github.com/antvis/S2/issues/2960)) ([af8c968](https://github.com/antvis/S2/commit/af8c96809fd0e52f1da81e2a1c082a5f5b0b122a)) +* 修复无汇总数据时前端计算汇总值缺少聚合方式导致排序失效的问题 ([#2711](https://github.com/antvis/S2/issues/2711)) ([97b0aeb](https://github.com/antvis/S2/commit/97b0aeb73f0fdeb1416f4d28214f912fa490db02)) +* 修复明细表含有空数据占位符时排序错误 close [#2707](https://github.com/antvis/S2/issues/2707) ([#2708](https://github.com/antvis/S2/issues/2708)) ([40792ce](https://github.com/antvis/S2/commit/40792ce994bc2b574a256433263e54af754f7dba)) +* 修复明细表导出时自定义序号文本不生效 close [#2755](https://github.com/antvis/S2/issues/2755) ([#2757](https://github.com/antvis/S2/issues/2757)) ([ebe68d8](https://github.com/antvis/S2/commit/ebe68d83986a1e9de87d0154382f3725818d5bfd)) +* 修复明细表自定义列头时开启文本换行, 单元格高度错误的问题 close [#2955](https://github.com/antvis/S2/issues/2955) ([#2968](https://github.com/antvis/S2/issues/2968)) ([ca1f7e8](https://github.com/antvis/S2/commit/ca1f7e8a614dc5b36a6bc270df4ea8338e670444)) +* 修复明细表自定义多级列头导出格式错误 close [#2664](https://github.com/antvis/S2/issues/2664) ([#2674](https://github.com/antvis/S2/issues/2674)) ([ae9add9](https://github.com/antvis/S2/commit/ae9add9c722877aced481340f798408a09ad98fb)) +* 修复树状模式下开启分页, 行头展开收起后表格渲染异常 close [#2582](https://github.com/antvis/S2/issues/2582) ([#2590](https://github.com/antvis/S2/issues/2590)) ([b9e48a0](https://github.com/antvis/S2/commit/b9e48a0202d4105b75b0961096f106ca6039c553)) +* 修复树状模式下开启分页, 行头展开收起后表格渲染异常 close [#2582](https://github.com/antvis/S2/issues/2582) ([#2590](https://github.com/antvis/S2/issues/2590)) ([6bab9f6](https://github.com/antvis/S2/commit/6bab9f630e26bdfb9513bb0d5fe0b4c0903f885b)) +* 修复树状模式当一组数据只有一条数据时, 叶子节点判断错误, 也渲染了展开/收起图标 close [#2804](https://github.com/antvis/S2/issues/2804) ([#2806](https://github.com/antvis/S2/issues/2806)) ([76a7a59](https://github.com/antvis/S2/commit/76a7a59cf12c7b3df1ec2b8a43d04479ab25cb73)) +* 修复树状模式选中非叶子节点时不展示汇总信息的问题 ([48b7073](https://github.com/antvis/S2/commit/48b70737f32d58d75c356a4d37afeb74a917cf23)) +* 修复浏览器窗口多次放大后表格渲染模糊 close [#2884](https://github.com/antvis/S2/issues/2884) ([#2897](https://github.com/antvis/S2/issues/2897)) ([97e2905](https://github.com/antvis/S2/commit/97e2905d6b42a20728950cd51ddabd3bcdd14f1e)) +* 修复滚动边界问题 close [#2720](https://github.com/antvis/S2/issues/2720) ([#2721](https://github.com/antvis/S2/issues/2721)) ([24591fb](https://github.com/antvis/S2/commit/24591fbb65d9e760a566223a0a0fde6ce360c189)) +* 修复父容器存在 transform 时, 在 canvas 内点击也会重置交互的问题 close [#2879](https://github.com/antvis/S2/issues/2879) ([#2942](https://github.com/antvis/S2/issues/2942)) ([010ed05](https://github.com/antvis/S2/commit/010ed050214568ea1902e4a426d6638afd3ae2f9)) +* 修复父容器存在 transform 缩放时单元格刷选偏移 close [#2553](https://github.com/antvis/S2/issues/2553) ([#2565](https://github.com/antvis/S2/issues/2565)) ([715bbf4](https://github.com/antvis/S2/commit/715bbf41541ca6b5bee47c44695345bfaa0605ea)) +* 修复紧凑模式下, 文本带有 '\n' 换行符时 maxLines 配置未生效和文本溢出的问题 closes [#2963](https://github.com/antvis/S2/issues/2963) [#2900](https://github.com/antvis/S2/issues/2900) ([#2972](https://github.com/antvis/S2/issues/2972)) ([8d45f07](https://github.com/antvis/S2/commit/8d45f07ae86b24d088b609401817d535be2b43bc)) +* 修复紧凑模式下单元格宽度计算忽略了icon宽度的问题 ([#2673](https://github.com/antvis/S2/issues/2673)) ([23ee734](https://github.com/antvis/S2/commit/23ee734ee09106f05b4278b8ab02202a78949a1d)) +* 修复紧凑模式下数值单元格错误的展示了省略号 ([#2632](https://github.com/antvis/S2/issues/2632)) ([2822471](https://github.com/antvis/S2/commit/2822471e9f73ba7b19292dc88a93b96d38afa471)) +* 修复组件层事件回调无法获取单元格信息 closes [#2615](https://github.com/antvis/S2/issues/2615) [#2610](https://github.com/antvis/S2/issues/2610) ([#2616](https://github.com/antvis/S2/issues/2616)) ([3682d50](https://github.com/antvis/S2/commit/3682d501a71dbff3c91d7be86c852546f3e8f271)) +* 修复维值带有 '-' 时刷选复制无法复制表头 close [#2684](https://github.com/antvis/S2/issues/2684) ([#2691](https://github.com/antvis/S2/issues/2691)) ([11c0325](https://github.com/antvis/S2/commit/11c03256cf7bdc369601d9efd8f8e65807ae7b2f)) +* 修复编辑表双击失效 ([9edcb74](https://github.com/antvis/S2/commit/9edcb74576c8137481c375258fa9d9e310fafc7c)) +* 修复编辑表的输入框未回填格式化后的数据 close [#2528](https://github.com/antvis/S2/issues/2528) ([#2549](https://github.com/antvis/S2/issues/2549)) ([95d67ca](https://github.com/antvis/S2/commit/95d67ca02b774aed426a179a16aa27f0c172356e)) +* 修复自定义 dataCell 错误的传参写法 ([#2748](https://github.com/antvis/S2/issues/2748)) ([c54ca82](https://github.com/antvis/S2/commit/c54ca826ab3fd8aa1e760f522abbc0190c724060)) +* 修复自定义 tooltip 时, 刷选时无法获取到单元格信息 ([#2738](https://github.com/antvis/S2/issues/2738)) ([782a2fc](https://github.com/antvis/S2/commit/782a2fcd78fa6009c1335fbdfe0392dd894c94ad)) +* 修复自定义列头导出数据时, 角头文本展示错误 close [#2844](https://github.com/antvis/S2/issues/2844) ([#2869](https://github.com/antvis/S2/issues/2869)) ([63dba54](https://github.com/antvis/S2/commit/63dba54b947b1c36a996004823841c98284c232a)) +* 修复自定义列宽对虚拟数值列不生效 ([#2921](https://github.com/antvis/S2/issues/2921)) ([c53cea4](https://github.com/antvis/S2/commit/c53cea4a2fa2d7b18939abfb984629a94eab936d)) +* 修复自定义目录树同名节点展示异常 & 导出缺失角头 close [#2455](https://github.com/antvis/S2/issues/2455) ([#2551](https://github.com/antvis/S2/issues/2551)) ([6d315bf](https://github.com/antvis/S2/commit/6d315bff20e74f0ce5f1d286105eeba749ebabaf)) +* 修复自定义菜单项不触发 click 事件的问题 ([#2946](https://github.com/antvis/S2/issues/2946)) ([82dbb61](https://github.com/antvis/S2/commit/82dbb617440ba3d81e7ade96ee98747a7a5ecf5a)) +* 修复自定义计算总计时, 复制的数据不正确 close [#2928](https://github.com/antvis/S2/issues/2928) ([#2937](https://github.com/antvis/S2/issues/2937)) ([f82de36](https://github.com/antvis/S2/commit/f82de36d6bb92a2ae51577dbc40e16ced0b1792c)) +* 修复行列头数值复制时未使用格式化的值 & 优化单测 ([989366f](https://github.com/antvis/S2/commit/989366fc740b7c1367c4cf246a6e3eb80e4f3338)) +* 修复表格卸载后, 高清适配逻辑还会触发的问题 ([#2965](https://github.com/antvis/S2/issues/2965)) ([c837efe](https://github.com/antvis/S2/commit/c837efe29f2ff02ea8957bcaf62be57d2467f160)), closes [L#116](https://github.com/L/issues/116) +* 修复表格右键事件无法触发 close [#2687](https://github.com/antvis/S2/issues/2687) ([#2690](https://github.com/antvis/S2/issues/2690)) ([8b4f3e3](https://github.com/antvis/S2/commit/8b4f3e3dab83e6ae38b1d3362049af8352a7a4a9)) +* 修复表格排序后, 编辑单元格后数据更新错误 ([e841d3d](https://github.com/antvis/S2/commit/e841d3db020afb418f0b2f9223271c329390b192)) +* 修复角头和行头折叠展开 icon 的状态未同步以及展开异常的问题 close [#2607](https://github.com/antvis/S2/issues/2607) ([#2620](https://github.com/antvis/S2/issues/2620)) ([99829a6](https://github.com/antvis/S2/commit/99829a667c69394c0554ece841d6f6eb5c3f9b9e)) +* 修复计算列宽时计算的文字宽度和判断文本是否溢出隐藏的文字宽度不一致的问题 ([#2689](https://github.com/antvis/S2/issues/2689)) ([2f52f3b](https://github.com/antvis/S2/commit/2f52f3be865327230d7a44762f34eb5711452cfa)) +* 修复趋势分析表复制错误 ([2e24418](https://github.com/antvis/S2/commit/2e24418cabebdbe1cd306cdf931c0c8fa7bae050)) +* 修复透视表开启多行文本后自定义行高不生效 close [#2678](https://github.com/antvis/S2/issues/2678) ([#2686](https://github.com/antvis/S2/issues/2686)) ([164259b](https://github.com/antvis/S2/commit/164259b66194de03c2073520389d2edfc352f9ab)) +* 修复配置了多行文本但实际渲染的文本未换行时, 单元格高度也会自适应调整的问题 ([#2705](https://github.com/antvis/S2/issues/2705)) ([5d19e62](https://github.com/antvis/S2/commit/5d19e623c8f726d4f417ea2cb55cc489ef09f1b2)) +* 修复非滚动引起的渲染也会触发滚动事件的问题 ([#2692](https://github.com/antvis/S2/issues/2692)) ([0cc2839](https://github.com/antvis/S2/commit/0cc2839c4058bb8fea8d73b03db00165612d6515)) +* 修改滚动动画默认值为 false ([23df3ca](https://github.com/antvis/S2/commit/23df3ca19680a197411a6667760f73229716bae5)) +* 减少开启 ReactDOM.unstable_batchedUpdates 后的重渲染次数 ([#2971](https://github.com/antvis/S2/issues/2971)) ([9007e8e](https://github.com/antvis/S2/commit/9007e8ecf41b6d7434db312398f3996018ef0ecf)) +* 取消双击表格时浏览器默认的选中文本行为 close [#2798](https://github.com/antvis/S2/issues/2798) ([#2800](https://github.com/antvis/S2/issues/2800)) ([5df9326](https://github.com/antvis/S2/commit/5df9326790fd127268c64d288a4b28616e40794c)) +* 回退生成 nodeId 时对 extra 字段的格式化 ([#2546](https://github.com/antvis/S2/issues/2546)) ([7d1cf9a](https://github.com/antvis/S2/commit/7d1cf9a68dd434b4843236d0e3570afc6ca22148)) +* 增加单元格单双击的判断范围 ([#2924](https://github.com/antvis/S2/issues/2924)) ([c40bbf9](https://github.com/antvis/S2/commit/c40bbf9a4bf29459a0cb6ac32e3a7c52068c4eb1)) +* 增加树状模式自定义宽度的容错 ([#2519](https://github.com/antvis/S2/issues/2519)) ([5f2c582](https://github.com/antvis/S2/commit/5f2c582378510e13cf34ccf92edb0a7d172ec07d)) +* 处理自定义mini图显示柱状图时,全为正值&全为零值 展示异常问题 ([#2826](https://github.com/antvis/S2/issues/2826)) ([81def62](https://github.com/antvis/S2/commit/81def62ddc3e69ff2a2426b9c4824549ca728194)) +* 暂时修复g版本冲突问题 ([#2003](https://github.com/antvis/S2/issues/2003)) ([1de7ec2](https://github.com/antvis/S2/commit/1de7ec215bc96c28e7493c8a32fe1764fd08cb2d)) +* 移动端关闭 supportsPointerEvents, 避免禁用 touchAction close [#2857](https://github.com/antvis/S2/issues/2857) ([#2891](https://github.com/antvis/S2/issues/2891)) ([14c55aa](https://github.com/antvis/S2/commit/14c55aa7aae2e1fab63e612f7ecdaa00e7e7b567)) +* 自定义 icon 支持跨域 close [#2513](https://github.com/antvis/S2/issues/2513) ([#2524](https://github.com/antvis/S2/issues/2524)) ([cdf58ea](https://github.com/antvis/S2/commit/cdf58ea34e7342b5fdd169d43cccc63309b36103)) +* 角头选中列兼容树状模式和自定义行头场景 ([#2562](https://github.com/antvis/S2/issues/2562)) ([49ad04d](https://github.com/antvis/S2/commit/49ad04d4bcfdc932ac793bcf1d2866c01a694f9e)) +* 调整分割线的颜色绘制逻辑, 优化和单元格边框颜色不一致的问题 ([#2919](https://github.com/antvis/S2/issues/2919)) ([3f766d0](https://github.com/antvis/S2/commit/3f766d02b14bf6d6ebac34b302a0232a58afe500)) +* 调整换行高度自适应和自定义高度的优先级 close [#2613](https://github.com/antvis/S2/issues/2613) ([#2630](https://github.com/antvis/S2/issues/2630)) ([4caabed](https://github.com/antvis/S2/commit/4caabed679b4959faf598e38efbf23b4802ae29b)) +* 调整维值生成规则, 修复导出格式化数据时空数据占位符未生效 close [#2808](https://github.com/antvis/S2/issues/2808) ([#2810](https://github.com/antvis/S2/issues/2810)) ([ad14ff4](https://github.com/antvis/S2/commit/ad14ff48dbc2b6874c18bdd3ccf1678f5b79f130)) +* 重构绘制盒模型,修复边框偏移问题 ([#1854](https://github.com/antvis/S2/issues/1854)) ([f7e0858](https://github.com/antvis/S2/commit/f7e0858a937ea557532a7fff948e9af3b6a1fdff)) + + +### Code Refactoring + +* 调整 s2Options API 命名 ([#2015](https://github.com/antvis/S2/issues/2015)) ([e39b32f](https://github.com/antvis/S2/commit/e39b32f99befdf53569fab633087bb56edfc8720)) + + +* feat!: 2.0 next 预览版发布 ([de5a406](https://github.com/antvis/S2/commit/de5a406f4fd5e0db23eea46c8e7185589215c195)) +* feat!: 2.0 预览版发布 ([9abb76d](https://github.com/antvis/S2/commit/9abb76dd40c65ed2a6a122b6f2b20a9b963c8a58)) + + +### Features + +* 2.0 break ([a4ba788](https://github.com/antvis/S2/commit/a4ba788580788909f4fcfee98f3d7387dd883c4a)) +* 2.0.0 next ([fe0aca3](https://github.com/antvis/S2/commit/fe0aca341f9c37e3a85e622a6eb30c9da5e02a96)) +* canvas 支持挂载 s2 实例 ([#2645](https://github.com/antvis/S2/issues/2645)) ([ed21dcb](https://github.com/antvis/S2/commit/ed21dcb82ea4cb434587a4ffa4819f2a619ca1aa)) +* **components:** 组件层更新时增加 loading 效果 close [#1790](https://github.com/antvis/S2/issues/1790) ([#2762](https://github.com/antvis/S2/issues/2762)) ([0ca8413](https://github.com/antvis/S2/commit/0ca841362bb4bbb3b81ca1046f5b4dcd7236b91e)) +* custom icon support fill null close [#2654](https://github.com/antvis/S2/issues/2654) ([#2699](https://github.com/antvis/S2/issues/2699)) ([bdbd1b3](https://github.com/antvis/S2/commit/bdbd1b3b797c77d78d7e09925ff5898bfcc6953f)) +* **frozen-panel:** 增加行列头冻结配置面板 ([#2782](https://github.com/antvis/S2/issues/2782)) ([d2fa5c9](https://github.com/antvis/S2/commit/d2fa5c958cee04a09d95ae481d62fd035728c7ae)) +* headerActionIcons 支持细粒度配置 & 修复异步渲染导致无法获取实例的问题 ([#2301](https://github.com/antvis/S2/issues/2301)) ([b2d6f1f](https://github.com/antvis/S2/commit/b2d6f1fb04d3fa73129669fc7d2dec84943252db)) +* **i18n:** add support of the russian language ([#2853](https://github.com/antvis/S2/issues/2853)) ([3dcf491](https://github.com/antvis/S2/commit/3dcf4913f37d222fe6c57a780bc00cab8829953d)) +* **interaction:** 支持批量调整行高列宽 close [#2574](https://github.com/antvis/S2/issues/2574) ([#2580](https://github.com/antvis/S2/issues/2580)) ([7d1be20](https://github.com/antvis/S2/commit/7d1be206442396371ab08a8224b2685aea2c025d)) +* **interaction:** 新增选中/高亮单元格 & 滚动 API ([#2586](https://github.com/antvis/S2/issues/2586)) ([ac4f5ab](https://github.com/antvis/S2/commit/ac4f5ab9d87bf9bf725b2ef872342a597823ebf6)) +* **layout:** 单元格支持渲染多行文本 ([#2383](https://github.com/antvis/S2/issues/2383)) ([e3b919a](https://github.com/antvis/S2/commit/e3b919a4f37d600a0f516944edf4eed8b2c0174d)) +* **layout:** 自定义行列头 ([#1719](https://github.com/antvis/S2/issues/1719)) ([2e0746d](https://github.com/antvis/S2/commit/2e0746dc9ca4ec45d50b35a9408b8827252c1bfa)) +* meta 支持配置数值和正则, 便于批量配置 close [#2647](https://github.com/antvis/S2/issues/2647) ([#2799](https://github.com/antvis/S2/issues/2799)) ([3d89940](https://github.com/antvis/S2/commit/3d899401d37406ce44fa5dd54524f8b33ed9560f)) +* **options:** customSVGIcons API 变更 ([#2700](https://github.com/antvis/S2/issues/2700)) ([fde8e8f](https://github.com/antvis/S2/commit/fde8e8f57d176057d052cbf0dd401211e2839a0e)) +* s2-react 移除 antd 的依赖和部分基础组件, 相关分析组件迁移到 s2-react-components 中 ([#2887](https://github.com/antvis/S2/issues/2887)) ([64e3882](https://github.com/antvis/S2/commit/64e3882f1cd2fb52964710848674f58d8c9a3865)) +* **theme-panel:** 新增主题风格配置组件 ([#2770](https://github.com/antvis/S2/issues/2770)) ([b559947](https://github.com/antvis/S2/commit/b559947ae2695dc3e4b581b10785ce34956d3702)) +* **total:** 全量移除所有 totalData 配置 ([#1799](https://github.com/antvis/S2/issues/1799)) ([23cc219](https://github.com/antvis/S2/commit/23cc21933e02d5da6b261afe1fe1bc67008054d8)) +* **type:** 使用 Template Literal Types 增强枚举类型的提示 ([#2783](https://github.com/antvis/S2/issues/2783)) ([6e571da](https://github.com/antvis/S2/commit/6e571da007c7a5185084f3a2c24c19d590d51319)) +* version break ([064c0de](https://github.com/antvis/S2/commit/064c0de861f2e87814acf394cbdf6305397d476d)) +* 优化 ViewMeta 类型定义和相关文档 ([#2935](https://github.com/antvis/S2/issues/2935)) ([55b6f55](https://github.com/antvis/S2/commit/55b6f551148672c1edd6442632ff9ffddc83aa72)) +* 优化紧凑模式下的单元格宽度计算方式 ([#2953](https://github.com/antvis/S2/issues/2953)) ([68ed225](https://github.com/antvis/S2/commit/68ed2258305eca6f92be7c238cd29c21407bcdd7)) +* 使用 requestIdleCallback 处理数据大量导出的情况 ([#2272](https://github.com/antvis/S2/issues/2272)) ([42a5551](https://github.com/antvis/S2/commit/42a55516dd369d9ab5579b52fbc9900b0ad81858)) +* 升级的渲染引擎g5.0 ([#1924](https://github.com/antvis/S2/issues/1924)) ([820a310](https://github.com/antvis/S2/commit/820a310998bae5c0324c2f3144747f7dbe0097d1)), closes [#1852](https://github.com/antvis/S2/issues/1852) [#1862](https://github.com/antvis/S2/issues/1862) +* 单元格宽高配置增强 close [#1895](https://github.com/antvis/S2/issues/1895) ([#1981](https://github.com/antvis/S2/issues/1981)) ([ec6736f](https://github.com/antvis/S2/commit/ec6736f108801e1129c4d3fd29d13d1fbff2a1d2)) +* 单元格行高拖拽支持多行文本自适应 ([#2980](https://github.com/antvis/S2/issues/2980)) ([535c2aa](https://github.com/antvis/S2/commit/535c2aa130a68bf189fbc861bcdc7f9979c2078e)) +* 合并 master 到 next ([#2493](https://github.com/antvis/S2/issues/2493)) ([6da530d](https://github.com/antvis/S2/commit/6da530d0c5f53d283ddfaa4b3e510ca11c9bf83e)), closes [#2186](https://github.com/antvis/S2/issues/2186) [#2204](https://github.com/antvis/S2/issues/2204) [#2191](https://github.com/antvis/S2/issues/2191) +* 同步复制支持自定义transformer ([#2201](https://github.com/antvis/S2/issues/2201)) ([9003767](https://github.com/antvis/S2/commit/9003767d584248b9d122f299326fd14753961883)) +* 在生成 id 时,对 undefined, null 做区分 ([#1828](https://github.com/antvis/S2/issues/1828)) ([0687779](https://github.com/antvis/S2/commit/06877794be701608e5a68e6cab43e56927d59967)) +* 增加不同类型单元格的选中事件 & 支持识别事件来源 ([#2956](https://github.com/antvis/S2/issues/2956)) ([69f6479](https://github.com/antvis/S2/commit/69f6479b43055c12d0295a7c77709b990a069ee3)) +* 增加对自定义行列头总计、小计节点和组内排序的支持,修复明细表自定义列头 icon 问题 icon closes [#2898](https://github.com/antvis/S2/issues/2898) [#2893](https://github.com/antvis/S2/issues/2893) ([#2934](https://github.com/antvis/S2/issues/2934)) ([a4ae432](https://github.com/antvis/S2/commit/a4ae432d2ddff8a3b44fdfb7abd96d6a2369c81b)) +* 增加暗黑主题 ([#2130](https://github.com/antvis/S2/issues/2130)) ([51dbdcf](https://github.com/antvis/S2/commit/51dbdcf564b387a3fd1809a71016f3a91eebde38)) +* 增加绘制透视组合图的能力 ([#2780](https://github.com/antvis/S2/issues/2780)) ([e243e89](https://github.com/antvis/S2/commit/e243e890d3272b12372ecdd1b5139114a90d93ea)) +* 增加自定义行头最大固定宽度的功能 ([#2069](https://github.com/antvis/S2/issues/2069)) ([4db301d](https://github.com/antvis/S2/commit/4db301db0971fca40e65d43c417ca4a36db66493)) +* 增加角头和序号列的交互能力 ([#2571](https://github.com/antvis/S2/issues/2571)) ([fcb77cc](https://github.com/antvis/S2/commit/fcb77cce65ee56aeec189cf46d4226ef6a62a671)) +* 增强行列冻结能力 ([#2706](https://github.com/antvis/S2/issues/2706)) ([e72d053](https://github.com/antvis/S2/commit/e72d05326c3db5d20aa88eec947549a78014b030)), closes [#2739](https://github.com/antvis/S2/issues/2739) +* 完善复制和导出在格式化后,总计、小计对应数值没有格式化的问题 ([#2237](https://github.com/antvis/S2/issues/2237)) ([abc0dbb](https://github.com/antvis/S2/commit/abc0dbb1544d9a4ef133e6a2c7d2d09ac8f35b48)) +* 导出组件支持复制 HTML (text/html) 格式的数据 close [#2828](https://github.com/antvis/S2/issues/2828) ([#2865](https://github.com/antvis/S2/issues/2865)) ([444fbf5](https://github.com/antvis/S2/commit/444fbf55b25e4edff70e9c58efa023a0274a3b1f)) +* 折叠展开重构 & 简化行头 tree 相关配置 ([#2030](https://github.com/antvis/S2/issues/2030)) ([0f3ea3b](https://github.com/antvis/S2/commit/0f3ea3b5c668137bc2fcb53bd186a41b34140e25)) +* 支持 antd v5 ([#2413](https://github.com/antvis/S2/issues/2413)) ([299c7bf](https://github.com/antvis/S2/commit/299c7bfe2e86838153273c92dd6d2b72917cfdea)) +* 支持 React 18 (兼容 React 16/17) ([#2373](https://github.com/antvis/S2/issues/2373)) ([25ce9b0](https://github.com/antvis/S2/commit/25ce9b0ccc3e609d8add09b3209f6f981dc1dc4e)) +* 支持在单元格内渲染 G2 图表 ([#2437](https://github.com/antvis/S2/issues/2437)) ([497f941](https://github.com/antvis/S2/commit/497f9414b89fce01b60db9b6c2eb4292ffe69c1d)) +* 支持自定义 G 5.0 插件和配置 ([#2423](https://github.com/antvis/S2/issues/2423)) ([cc6c47f](https://github.com/antvis/S2/commit/cc6c47fd0927125bbc378fe6914becfcbe1b0acd)) +* 文本和图标的条件格式支持主题配置 ([#2267](https://github.com/antvis/S2/issues/2267)) ([c332c68](https://github.com/antvis/S2/commit/c332c687dfb7be1d07b79b44934f78c1947cc466)) +* 新增 s2.facet.getContentWidth() API ([#2883](https://github.com/antvis/S2/issues/2883)) ([395db7e](https://github.com/antvis/S2/commit/395db7e313fd1de6e42ee5dd4d6c475c517609d4)) +* 明细表支持同名列渲染 closes [#2502](https://github.com/antvis/S2/issues/2502) [#2510](https://github.com/antvis/S2/issues/2510) ([#2568](https://github.com/antvis/S2/issues/2568)) ([e324c93](https://github.com/antvis/S2/commit/e324c934a310a3b514cc49f607d21434e095f1f7)), closes [#2519](https://github.com/antvis/S2/issues/2519) +* 明细表新增空数据占位符能力 ([#2729](https://github.com/antvis/S2/issues/2729)) ([19dbda5](https://github.com/antvis/S2/commit/19dbda5e9719d6a8f6d05ce0a93386e80c31ffab)) +* 更新 g 到最新版 ([#2631](https://github.com/antvis/S2/issues/2631)) ([7647605](https://github.com/antvis/S2/commit/7647605dcd60e1e34f2014aafb180ac931bf0725)), closes [#2629](https://github.com/antvis/S2/issues/2629) +* 更新 G 版本, 支持透传 dblClickSpeed ([ce11006](https://github.com/antvis/S2/commit/ce110069c855bc68fd89e014f8436d6e8bf92a49)) +* 更新英语文档,使用依赖包进行翻译 ([#2067](https://github.com/antvis/S2/issues/2067)) ([f271684](https://github.com/antvis/S2/commit/f2716847ec0d06a0867eabe16a7f5e2e3a9263ee)) +* 条件格式 mapping 增加第三个参数获取单元格实例 ([#2242](https://github.com/antvis/S2/issues/2242)) ([aae427d](https://github.com/antvis/S2/commit/aae427dfe6a87cae577ce2449fd6058d358971f9)) +* 移动端组件适配 ([#1833](https://github.com/antvis/S2/issues/1833)) ([bd2e71e](https://github.com/antvis/S2/commit/bd2e71e0d1d55057af77d435a10730b7ac929324)) +* 移除已废弃的方法和逻辑 & 优化文档 ([#2566](https://github.com/antvis/S2/issues/2566)) ([de7c97b](https://github.com/antvis/S2/commit/de7c97b862e5b467fd335dd65f9dac5a95e4b621)) +* 统一导出和复制逻辑,优化导出和复制性能 ([#2152](https://github.com/antvis/S2/issues/2152)) ([df88455](https://github.com/antvis/S2/commit/df884557756e4374e95687cf4c99d575bc2cb6fc)) +* 统一透视表和明细表 meta 中的 query 参数 ([#2818](https://github.com/antvis/S2/issues/2818)) ([ffdde84](https://github.com/antvis/S2/commit/ffdde84fc6a0ecad21888b8d66cffd1356568662)) +* 统一链接跳转字段绘制逻辑, 支持标记列头 close [#2430](https://github.com/antvis/S2/issues/2430) ([#2796](https://github.com/antvis/S2/issues/2796)) ([637f651](https://github.com/antvis/S2/commit/637f651bbaaf1fcb696afe12c03e5c7042f95fae)) +* 行列头兼容 condition icon 和 action icons ([#2161](https://github.com/antvis/S2/issues/2161)) ([1df4286](https://github.com/antvis/S2/commit/1df42860f6a12d3cb182ba7633c4984a04e62890)) +* 调整单元格默认 padding, 优化多行文本时的展示效果 ([#2970](https://github.com/antvis/S2/issues/2970)) ([599d7a4](https://github.com/antvis/S2/commit/599d7a4e76d2b606bdb0509eb684f47870a9e69d)) +* 适配g5.0异步渲染 ([#2251](https://github.com/antvis/S2/issues/2251)) ([069d03d](https://github.com/antvis/S2/commit/069d03d299429c2ffab3e20d56ecd6bb30119ffd)) + + +### Performance Improvements + +* 优化 getDimensionValues 在大量 flatten 情况下的性能 ([#2640](https://github.com/antvis/S2/issues/2640)) ([e0348d7](https://github.com/antvis/S2/commit/e0348d77e6c0296151566214ad975f810732e5b8)) +* 优化多行文本渲染性能 ([#2478](https://github.com/antvis/S2/issues/2478)) ([adc5ef3](https://github.com/antvis/S2/commit/adc5ef32056ca0427942f5a118af938124821bcc)) +* 优化开启多行文本时的布局性能 ([#2734](https://github.com/antvis/S2/issues/2734)) ([388157c](https://github.com/antvis/S2/commit/388157c0ecb82c45f8a0277b649e891366dc2f1c)) +* 优化明细表滚动性能 close [#2548](https://github.com/antvis/S2/issues/2548), [#2402](https://github.com/antvis/S2/issues/2402) ([#2561](https://github.com/antvis/S2/issues/2561)) ([c2d5812](https://github.com/antvis/S2/commit/c2d581286253e09cf09ecba00673be738bf14cf9)) +* 优化未开启多行文本时的布局性能 close [#2693](https://github.com/antvis/S2/issues/2693) ([#2728](https://github.com/antvis/S2/issues/2728)) ([439162d](https://github.com/antvis/S2/commit/439162d8e14adedd26f1a125b319f2ab6636b8b1)) + + +### Reverts + +* Revert "chore(release): bump version" ([d1bdfb2](https://github.com/antvis/S2/commit/d1bdfb27564fc38e78d4d424042e3cd02e182e58)) + + +### BREAKING CHANGES + +* 移除 header props 参数 (不再内置行列切换, 导出, +高级排序), 移除 antd ConfigProvider 包裹 + +* feat: 移除 header + +* feat: 移除 SheetComponent 中的 Spin 组件 + +* feat: 移除分页组件 + +* docs: 更新文档 + +* feat: 解耦操作栏 Menu 组件 + +* feat: 移除编辑表的 Input 依赖 + +* feat: 迁移下钻组件 + +* docs: 更新文档 + +* docs: 完善分页文档 + +* docs: 完善导出文档 + +* docs: 调整目录结构 + +* refactor: 优化分页组件的使用方式 + +* docs: 完善导出和维度切换组件文档 + +* test: 迁移并修复 s2-react 中的分析组件单测 + +* test: 完善 s2-react-components 中高级排序/下钻/导出 单测 + +* feat: 完善 switcher 功能和单测 + +* feat: 统一入口文件风格 + +* test: 更新单测 + +* feat: 移除 s2-react 的 antd peerDependencies + +* chore: 更新 lock + +* docs: 更新文档 + +* docs: 完善文档和示例 + +* feat: 优化目录结构和文档合理性 + +* fix: 修复类型问题 + +* test: 调整单测路径 + +* feat: shared 包移动到 s2-core 中, 优化打包方式 + +* chore: 移除 s2-react-components 中的 shared 依赖 + +* chore: 移除 s2-vue 中的 shared 依赖 + +* test: 迁移 shared 单测 + +* docs: 完善文档 + +* fix: 修复布局错误 + +* build: 修复 umd 打包失败 + +* chore: 调整 size-limit + +* docs: 完善文档 + +* build: 使用 tsc 打包 + +* test: 修复单测 + +* build: 移除 father + +* build: 移除 father + +* chore: 修复 ci + +* test: 更新 jest 别名 + +* test: 修复 svg mock 不生效 + +* docs: 优化文档 + +* test: 修复单测 + +* test: 更新快照 + +* docs: 优化文档跳转效果和迁移文档 + +* docs: 优化 2.0-next => 2.0 迁移文档 + +* docs: 更新贡献指南 + +* chore: 移除无用开发依赖 + +* chore: 更新 lock + +* chore(ci): 尝试解决 CI 单测进程挂起的问题 + +* chore(ci): 尝试解决 CI 单测进程挂起的问题 +* 移除 s2.getContentHeight() API + +* docs: 补充迁移文档 +* s2Options.placeholder 配置更改为 cell 和 empty + +* test: 增加单测 + +* fix: 兼容滚动条的展示 + +* test: 单测和文档补充 + +* test: 修改滚动条位置单测断言 + +* test: 更新 shared 包快照 + +* fix: 修复英文环境下未展示英文文案 + +* fix: 修复列头单元格宽度很小时占位符坐标错误的问题 + +* fix: 修复趋势分析表导出占位符解析错误 +* Export 组件 和 asyncGetAllPlainData, copyToClipboard +的是否异步导出参数统一为 async + +* test: 修复循环依赖 + +* fix: 修复格式化对角头未生效 + +* fix: 修复趋势分析表导出 CSV 错误 + +* test: 单测修复 +* **options:** svg 变更为 src + +* test: 单测修复 + +* test: 单测修复 +* 移除 devicePixelRatio 和 supportsCSSTransform + +* docs: 增加文档 + +* test: update + +* test: 增加单测 +* antd v5, 组件层级样式升级 + +* feat: 更新操作项菜单类型和文档 + +* chore: 修复 s2-vue 类型 + +* chore: ci + +* test: 单测修复 + +* test: 单测修复 + +* feat: 兼容暗黑模式 + +* feat: 兼容暗黑模式 +* 支持 React 18 + +* fix: 修复 lint 和 test + +* fix: 修复打包问题 + +* chore: pnpm v8 + +* chore: autoInstallPeers pnpm v8 + +* test: 修复 swc/jest 导致的单测问题 + +* fix: 修复打包问题 + +* test: 更新 react 快照 + +* feat: 兼容 React 16/17 + +* test: 更新 react 快照 + +* test: 更新 react 快照 + +* test: 更新 react 快照 +* s2Options.tooltip 和 s2Options.style API 命名更改, 移除 trend 操作项 + +* refactor: tree 相关配置移动到 rowCell 下 + +* refactor: hideMeasureColumn => hideValue + +* refactor: 冻结相关配置收拢到 forzen 命名空间下 + +* test: 修复测试 +* G5.0, 透视表自定义行列头, 数据流重构 +* G5.0, 行列头自定义, 数据流 +* 2.0-next +* 2.0 +* https://github.com/antvis/S2/discussions/1933 + +# [@antv/s2-v2.0.0-next.33](https://github.com/antvis/S2/compare/@antv/s2-v2.0.0-next.32...@antv/s2-v2.0.0-next.33) (2024-11-15) + + +### Bug Fixes + +* 修复文本存在换行符时, 未显示省略号的问题 ([#2978](https://github.com/antvis/S2/issues/2978)) ([08dbf0d](https://github.com/antvis/S2/commit/08dbf0d9c63f1c64989fe242c9645df06e6b04e5)) +* 修复紧凑模式下, 文本带有 '\n' 换行符时 maxLines 配置未生效和文本溢出的问题 closes [#2963](https://github.com/antvis/S2/issues/2963) [#2900](https://github.com/antvis/S2/issues/2900) ([#2972](https://github.com/antvis/S2/issues/2972)) ([8d45f07](https://github.com/antvis/S2/commit/8d45f07ae86b24d088b609401817d535be2b43bc)) +* 减少开启 ReactDOM.unstable_batchedUpdates 后的重渲染次数 ([#2971](https://github.com/antvis/S2/issues/2971)) ([9007e8e](https://github.com/antvis/S2/commit/9007e8ecf41b6d7434db312398f3996018ef0ecf)) + + +### Features + +* 调整单元格默认 padding, 优化多行文本时的展示效果 ([#2970](https://github.com/antvis/S2/issues/2970)) ([599d7a4](https://github.com/antvis/S2/commit/599d7a4e76d2b606bdb0509eb684f47870a9e69d)) + +# [@antv/s2-v2.0.0-next.32](https://github.com/antvis/S2/compare/@antv/s2-v2.0.0-next.31...@antv/s2-v2.0.0-next.32) (2024-11-08) + + +### Bug Fixes + +* 修复分割线在深色背景下颜色渲染异常 & 内容宽高未包含分割线的问题 ([#2961](https://github.com/antvis/S2/issues/2961)) ([e759891](https://github.com/antvis/S2/commit/e759891865eee0940d0f5c92345d5490e10eb57c)) +* 修复开启自定义指标层级后, 角头数值文本未对齐 close [#2957](https://github.com/antvis/S2/issues/2957) ([#2966](https://github.com/antvis/S2/issues/2966)) ([6558a0d](https://github.com/antvis/S2/commit/6558a0df55dc324e1810e2f2a5d314de7389e2b1)) +* 修复文本设为左对齐时, 角头文本没有垂直对齐的问题 ([#2960](https://github.com/antvis/S2/issues/2960)) ([af8c968](https://github.com/antvis/S2/commit/af8c96809fd0e52f1da81e2a1c082a5f5b0b122a)) +* 修复明细表自定义列头时开启文本换行, 单元格高度错误的问题 close [#2955](https://github.com/antvis/S2/issues/2955) ([#2968](https://github.com/antvis/S2/issues/2968)) ([ca1f7e8](https://github.com/antvis/S2/commit/ca1f7e8a614dc5b36a6bc270df4ea8338e670444)) +* 修复表格卸载后, 高清适配逻辑还会触发的问题 ([#2965](https://github.com/antvis/S2/issues/2965)) ([c837efe](https://github.com/antvis/S2/commit/c837efe29f2ff02ea8957bcaf62be57d2467f160)), closes [L#116](https://github.com/L/issues/116) + +# [@antv/s2-v2.0.0-next.31](https://github.com/antvis/S2/compare/@antv/s2-v2.0.0-next.30...@antv/s2-v2.0.0-next.31) (2024-11-01) + + +### Bug Fixes + +* 修复开启 supportsCSSTransform 后 hover 在表格上时报错 ([#2947](https://github.com/antvis/S2/issues/2947)) ([d328598](https://github.com/antvis/S2/commit/d328598f080ff5ce8336f8cd98c200a5052d348c)) +* 修复自定义菜单项不触发 click 事件的问题 ([#2946](https://github.com/antvis/S2/issues/2946)) ([82dbb61](https://github.com/antvis/S2/commit/82dbb617440ba3d81e7ade96ee98747a7a5ecf5a)) + + +### Features + +* 优化紧凑模式下的单元格宽度计算方式 ([#2953](https://github.com/antvis/S2/issues/2953)) ([68ed225](https://github.com/antvis/S2/commit/68ed2258305eca6f92be7c238cd29c21407bcdd7)) +* 增加不同类型单元格的选中事件 & 支持识别事件来源 ([#2956](https://github.com/antvis/S2/issues/2956)) ([69f6479](https://github.com/antvis/S2/commit/69f6479b43055c12d0295a7c77709b990a069ee3)) +* 增加对自定义行列头总计、小计节点和组内排序的支持,修复明细表自定义列头 icon 问题 icon closes [#2898](https://github.com/antvis/S2/issues/2898) [#2893](https://github.com/antvis/S2/issues/2893) ([#2934](https://github.com/antvis/S2/issues/2934)) ([a4ae432](https://github.com/antvis/S2/commit/a4ae432d2ddff8a3b44fdfb7abd96d6a2369c81b)) + +# [@antv/s2-v2.0.0-next.30](https://github.com/antvis/S2/compare/@antv/s2-v2.0.0-next.29...@antv/s2-v2.0.0-next.30) (2024-10-25) + + +### Bug Fixes + +* **type:** 修复 g renderer 的错误类型定义 ([#2939](https://github.com/antvis/S2/issues/2939)) ([523b2cc](https://github.com/antvis/S2/commit/523b2ccb8884933060000854f28d9a6d8b2806f5)) +* 修复字段标记 mapping 函数部分场景缺失第三个参数 & 调整参数类型 ([#2927](https://github.com/antvis/S2/issues/2927)) ([676c1f6](https://github.com/antvis/S2/commit/676c1f68101a9191b48d23ce1ec15f852bcebc5d)) +* 修复数值单元格 tooltip 内的指标名展示错误 ([#2941](https://github.com/antvis/S2/issues/2941)) ([a426a46](https://github.com/antvis/S2/commit/a426a468d8cc1fe7ec0fd1db0e04938884ec0f46)) +* 修复父容器存在 transform 时, 在 canvas 内点击也会重置交互的问题 close [#2879](https://github.com/antvis/S2/issues/2879) ([#2942](https://github.com/antvis/S2/issues/2942)) ([010ed05](https://github.com/antvis/S2/commit/010ed050214568ea1902e4a426d6638afd3ae2f9)) +* 修复自定义计算总计时, 复制的数据不正确 close [#2928](https://github.com/antvis/S2/issues/2928) ([#2937](https://github.com/antvis/S2/issues/2937)) ([f82de36](https://github.com/antvis/S2/commit/f82de36d6bb92a2ae51577dbc40e16ced0b1792c)) +* 增加单元格单双击的判断范围 ([#2924](https://github.com/antvis/S2/issues/2924)) ([c40bbf9](https://github.com/antvis/S2/commit/c40bbf9a4bf29459a0cb6ac32e3a7c52068c4eb1)) + + +### Features + +* 优化 ViewMeta 类型定义和相关文档 ([#2935](https://github.com/antvis/S2/issues/2935)) ([55b6f55](https://github.com/antvis/S2/commit/55b6f551148672c1edd6442632ff9ffddc83aa72)) + # [@antv/s2-v2.0.0-next.29](https://github.com/antvis/S2/compare/@antv/s2-v2.0.0-next.28...@antv/s2-v2.0.0-next.29) (2024-10-12) diff --git a/packages/s2-core/README.en-US.md b/packages/s2-core/README.en-US.md index dfdd422fa8..da527b1977 100644 --- a/packages/s2-core/README.en-US.md +++ b/packages/s2-core/README.en-US.md @@ -208,11 +208,12 @@ bootstrap() ### 📦 Packages -| Package | Latest | Beta | Alpha | Next | Size | Download | -| - | - | - | - | - | - | - | -| [@antv/s2](https://github.com/antvis/S2/tree/next/packages/s2-core) | ![latest](https://img.shields.io/npm/v/@antv/s2/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2.svg) | -| [@antv/s2-react](https://github.com/antvis/S2/tree/next/packages/s2-react) | ![latest](https://img.shields.io/npm/v/@antv/s2-react/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-react/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-react/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-react/next.svg)| ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react.svg) | -| [@antv/s2-vue](https://github.com/antvis/S2/tree/next/packages/s2-vue) | ![latest](https://img.shields.io/npm/v/@antv/s2-vue/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-vue/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-vue/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-vue/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-vue@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg) | +| Package | Latest | Size | Download | +| -------- | ------ | ---------- | ------ | +| [@antv/s2](https://github.com/antvis/S2/tree/next/packages/s2-core) | ![latest](https://img.shields.io/npm/v/@antv/s2/latest.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2.svg?logo=npm) | +| [@antv/s2-react](https://github.com/antvis/S2/tree/next/packages/s2-react) | ![latest](https://img.shields.io/npm/v/@antv/s2-react/latest.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react.svg?logo=npm) | +| [@antv/s2-react-components](https://github.com/antvis/S2/tree/next/packages/s2-react-components) | ![latest](https://img.shields.io/npm/v/@antv/s2-react-components/latest.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react-components@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react-components.svg?logo=npm) | +| [@antv/s2-vue](https://github.com/antvis/S2/tree/next/packages/s2-vue) | ![latest](https://img.shields.io/npm/v/@antv/s2-vue/latest.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-vue@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg?logo=npm) | ## 👤 Author diff --git a/packages/s2-core/README.md b/packages/s2-core/README.md index c6dca6a56e..78f6e0599e 100644 --- a/packages/s2-core/README.md +++ b/packages/s2-core/README.md @@ -12,9 +12,6 @@ latest version - - - next version ci test status @@ -29,7 +26,7 @@

- npm bundle size + npm bundle size GitHub discussions @@ -64,7 +61,7 @@ S2 是 AntV 在多维交叉分析表格领域的解决方案,完全基于数 ## ✨ 特性 -1. 多维交叉分析: 告别单一分析维度,全面拥抱任意维度的自由组合分析。 +1. 多维交叉分析:告别单一分析维度,全面拥抱任意维度的自由组合分析。 2. 高性能:能支持全量百万数据下 `<8s` 渲染,也能通过局部下钻来实现秒级渲染。 3. 高扩展性:支持任意的自定义扩展(包括但不局限于布局,样式,交互,数据 hook 流等)。 4. 开箱即用:提供不同分析场景下开箱即用的 `React`, `Vue3` 版本表组件及配套分析组件,只需要简单的配置即可轻松实现复杂场景的表渲染。 @@ -204,60 +201,27 @@ bootstrap() ### 📦 版本 -| Package | Latest | Beta | Alpha | Next | Size | Download | -| - | - | - | - | - | - | - | -| [@antv/s2](https://github.com/antvis/S2/tree/next/packages/s2-core) | ![latest](https://img.shields.io/npm/v/@antv/s2/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2.svg) | -| [@antv/s2-react](https://github.com/antvis/S2/tree/next/packages/s2-react) | ![latest](https://img.shields.io/npm/v/@antv/s2-react/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-react/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-react/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-react/next.svg)| ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react.svg) | -| [@antv/s2-vue](https://github.com/antvis/S2/tree/next/packages/s2-vue) | ![latest](https://img.shields.io/npm/v/@antv/s2-vue/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-vue/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-vue/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-vue/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-vue@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg) | +| 包名 | 稳定版 | 包大小 | 下载量 | +| -------- | ------ | --------- | ---------- | ------ | +| [@antv/s2](https://github.com/antvis/S2/tree/next/packages/s2-core) | ![latest](https://img.shields.io/npm/v/@antv/s2/latest.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2.svg?logo=npm) | +| [@antv/s2-react](https://github.com/antvis/S2/tree/next/packages/s2-react) | ![latest](https://img.shields.io/npm/v/@antv/s2-react/latest.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react.svg?logo=npm) | +| [@antv/s2-react-components](https://github.com/antvis/S2/tree/next/packages/s2-react-components) | ![latest](https://img.shields.io/npm/v/@antv/s2-react-components/latest.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react-components@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react-components.svg?logo=npm) | +| [@antv/s2-vue](https://github.com/antvis/S2/tree/next/packages/s2-vue) | ![latest](https://img.shields.io/npm/v/@antv/s2-vue/latest.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-vue@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg?logo=npm) | ## 问题反馈 -有任何问题请严格按照模版 [提交 Issue](https://github.com/antvis/S2/issues/new/choose), 在这之前强烈建议阅读 [《⚠️ 提 Issue 前必读》](https://github.com/antvis/S2/issues/1904) - -## ⌨️ 本地开发 - -```bash -git clone git@github.com:antvis/S2.git - -cd S2 - -# 安装依赖 -pnpm install # 或者 pnpm bootstrap - -# 打包 -pnpm build +如果你遇到了问题,或者对 [Issues](https://github.com/antvis/S2/issues) 和 [Discussions](https://github.com/antvis/S2/discussions) 列表的问题感兴趣,**可以直接认领并尝试修复**,帮助 S2 变得更好,期待在 [贡献者列表](https://github.com/antvis/S2/graphs/contributors) 里看见你的头像。 -# 调试 s2-core -pnpm core:start +请严格按照模版 [提交 Issue](https://github.com/antvis/S2/issues/new/choose) 或在 [Discussions](https://github.com/antvis/S2/discussions) 提问,在这之前强烈建议阅读 [《⚠️ 提 Issue 前必读》](https://github.com/antvis/S2/issues/1904) -# 调试 s2-react -pnpm react:playground +## 🤝 参与贡献 & ⌨️ 本地开发 -# 调试 s2-vue -pnpm vue:playground - -# 单元测试 -pnpm test - -# 代码风格和类型检测 -pnpm lint - -# 本地启动官网 -pnpm site:start -``` - -## 🤝 参与贡献 - -请查看 [贡献指南](https://s2.antv.antgroup.com/manual/contribution) +S2 非常需要你的共建,请阅读 [贡献指南](https://s2.antv.antgroup.com/manual/contribution) 后提交 PR. ## 👁️ 项目洞察 ![Alt](https://repobeats.axiom.co/api/embed/ebb7eecb994dc0e3980044aefe43eb81302e3632.svg "Repobeats analytics image") -## 📧 反馈问题 - -有任何问题请严格按照模版 [提交 Issue](https://github.com/antvis/S2/issues/new/choose) 或在 [Discussions](https://github.com/antvis/S2/discussions) 提问。 - ## 👬 贡献者们 ![https://github.com/antvis/s2/graphs/contributors](https://contrib.rocks/image?repo=antvis/s2) diff --git a/packages/s2-core/__tests__/bugs/issue-2528-spec.ts b/packages/s2-core/__tests__/bugs/issue-2528-spec.ts index a8d116a4f1..04e60fa9fc 100644 --- a/packages/s2-core/__tests__/bugs/issue-2528-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-2528-spec.ts @@ -21,10 +21,10 @@ const s2Options: S2Options = { describe('Table Sheet Editable Formatter Tests', () => { let s2: SpreadSheet; - beforeEach(() => { + beforeEach(async () => { s2 = new TableSheet(getContainer(), s2DataConfig, s2Options); - s2.render(); + await s2.render(); }); test('should get formatted data', () => { @@ -36,7 +36,7 @@ describe('Table Sheet Editable Formatter Tests', () => { expect(costValues).toEqual(['2-@', '2-@', '2-@']); }); - test('should only format data once after data edited', () => { + test('should only format data once after data edited', async () => { const id = '0-root[&]cost'; const inputValue = 'test'; @@ -46,7 +46,7 @@ describe('Table Sheet Editable Formatter Tests', () => { displayData[0]['cost'] = inputValue; s2.dataSet.displayFormattedValueMap?.set(id, inputValue); - s2.render(); + await s2.render(); const costValues = s2.facet .getDataCells() diff --git a/packages/s2-core/__tests__/bugs/issue-2726-spec.ts b/packages/s2-core/__tests__/bugs/issue-2726-spec.ts index be7f61da6d..0efa603855 100644 --- a/packages/s2-core/__tests__/bugs/issue-2726-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-2726-spec.ts @@ -44,7 +44,7 @@ describe('Col Adaptive Layout Tests', () => { .getCornerNodes() .map((node) => Math.floor(node.width)); - expect(cornerNodeWidthList).toEqual([184, 136, 320]); + expect(cornerNodeWidthList).toEqual([185, 137, 322]); expectTextOverflowing(s2); }); }); diff --git a/packages/s2-core/__tests__/bugs/issue-2957-spec.ts b/packages/s2-core/__tests__/bugs/issue-2957-spec.ts new file mode 100644 index 0000000000..e33e8df0fb --- /dev/null +++ b/packages/s2-core/__tests__/bugs/issue-2957-spec.ts @@ -0,0 +1,53 @@ +/** + * @description spec for issue #2957 + * https://github.com/antvis/S2/issues/2957 + */ +import { PivotSheet } from '@/sheet-type'; +import type { S2Options } from '../../src'; +import { getContainer } from '../util/helpers'; + +const s2Options: S2Options = { + width: 800, + height: 600, +}; + +describe('Corner Measure Text Tests', () => { + test('should get correctly theme config with customValueOrder', async () => { + const s2 = new PivotSheet( + getContainer(), + { + data: [ + { + '4rweiwt7aneo': '上海市', + '4w8pyhsbkkjk': '①正常库存', + '4vynudxz28sg': '457', + styleKey: 1, + }, + ], + fields: { + valueInCols: true, + rows: ['4rweiwt7aneo'], + columns: ['4w8pyhsbkkjk'], + values: ['4vynudxz28sg'], + customValueOrder: 0, + }, + }, + s2Options, + ); + + s2.setTheme({ + cornerCell: { + measureText: { + fill: 'blue', + textAlign: 'center', + fontSize: 12, + }, + }, + }); + await s2.render(); + + const extraFieldText = s2.facet.getCornerCells()[1].getTextShape(); + + expect(extraFieldText.parsedStyle.textBaseline).toEqual('middle'); + }); +}); diff --git a/packages/s2-core/__tests__/data/custom-table-col-fields.ts b/packages/s2-core/__tests__/data/custom-table-col-fields.ts index a53ca96912..a7cadc1437 100644 --- a/packages/s2-core/__tests__/data/custom-table-col-fields.ts +++ b/packages/s2-core/__tests__/data/custom-table-col-fields.ts @@ -23,6 +23,29 @@ export const customColSimpleColumns: CustomTreeNode[] = [ }, ]; +export const customColSimpleMultipleTextColumns: CustomTreeNode[] = [ + { + field: 'area', + title: '地区'.repeat(50), + children: [ + { field: 'province', title: '省份' }, + { field: 'city', title: '城市' }, + ], + }, + { + field: 'type', + title: '类型', + }, + { + field: 'money', + title: '金额'.repeat(20), + children: [ + { field: 'price', title: '价格', description: '价格描述' }, + { field: 'number', title: '数量'.repeat(30) }, + ], + }, +]; + export const customColMultipleColumns: CustomTreeNode[] = [ { field: 'a-1', diff --git a/packages/s2-core/__tests__/data/data-issue-2385.json b/packages/s2-core/__tests__/data/data-issue-2385.json index e77dd0305c..4a8cb753b3 100644 --- a/packages/s2-core/__tests__/data/data-issue-2385.json +++ b/packages/s2-core/__tests__/data/data-issue-2385.json @@ -11,7 +11,7 @@ "province": "浙江", "city": "杭州", "type": "纸张", - "price": "2", + "price": "哈哈哈", "cost": "1.5" }, { @@ -153,7 +153,7 @@ "type": "圆规", "province": "吉林", "city": "白山", - "price": "111", + "price": "aa", "cost": "1.5" } ], diff --git a/packages/s2-core/__tests__/setup.js b/packages/s2-core/__tests__/setup.js index 95ba1ba1bb..1f37195929 100644 --- a/packages/s2-core/__tests__/setup.js +++ b/packages/s2-core/__tests__/setup.js @@ -14,3 +14,5 @@ jest.mock('@/ui/hd-adapter', () => { }), }; }); + +jest.setTimeout(60 * 1000); diff --git a/packages/s2-core/__tests__/spreadsheet/__snapshots__/corner-spec.ts.snap b/packages/s2-core/__tests__/spreadsheet/__snapshots__/corner-spec.ts.snap index 574008d2be..07844b7e66 100644 --- a/packages/s2-core/__tests__/spreadsheet/__snapshots__/corner-spec.ts.snap +++ b/packages/s2-core/__tests__/spreadsheet/__snapshots__/corner-spec.ts.snap @@ -7,30 +7,19 @@ exports[`PivotSheet Corner Tests should render row corner when columns and value } 1`] = ` Array [ Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "province", "height": 30, - "hierarchy": undefined, "id": "province", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, - "seriesNumberWidth": undefined, "spreadsheet": Anything, "value": "province", "width": 99.33, @@ -38,30 +27,19 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "city", "height": 30, - "hierarchy": undefined, "id": "city", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, - "seriesNumberWidth": undefined, "spreadsheet": Anything, "value": "city", "width": 99.33, @@ -78,30 +56,19 @@ exports[`PivotSheet Corner Tests should render row corner when columns and value } 1`] = ` Array [ Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "series", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "", "height": 30, - "hierarchy": undefined, "id": "", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, - "seriesNumberWidth": undefined, "spreadsheet": Anything, "value": "序号", "width": 80, @@ -109,30 +76,19 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "province", "height": 30, - "hierarchy": undefined, "id": "province", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, - "seriesNumberWidth": undefined, "spreadsheet": Anything, "value": "province", "width": 96, @@ -140,30 +96,19 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "city", "height": 30, - "hierarchy": undefined, "id": "city", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, - "seriesNumberWidth": undefined, "spreadsheet": Anything, "value": "city", "width": 96, @@ -180,33 +125,23 @@ exports[`PivotSheet Corner Tests should render row corner when columns and value } 1`] = ` Array [ Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "", "height": 30, - "hierarchy": undefined, "id": "province/city/数值", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, "seriesNumberWidth": 0, "spreadsheet": Anything, "value": "province/city/数值", - "width": 146.36, + "width": 147, "x": 0, "y": 0, }, @@ -220,30 +155,19 @@ exports[`PivotSheet Corner Tests should render row corner when columns and value } 1`] = ` Array [ Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "series", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "", "height": 30, - "hierarchy": undefined, "id": "", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, - "seriesNumberWidth": undefined, "spreadsheet": Anything, "value": "序号", "width": 80, @@ -251,33 +175,23 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "", "height": 30, - "hierarchy": undefined, "id": "province/city/数值", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, "seriesNumberWidth": 80, "spreadsheet": Anything, "value": "province/city/数值", - "width": 146.36, + "width": 147, "x": 80, "y": 0, }, @@ -291,30 +205,19 @@ exports[`PivotSheet Corner Tests should render row corner when columns is empty } 1`] = ` Array [ Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "province", "height": 30, - "hierarchy": undefined, "id": "province", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, - "seriesNumberWidth": undefined, "spreadsheet": Anything, "value": "province", "width": 149, @@ -322,30 +225,19 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "city", "height": 30, - "hierarchy": undefined, "id": "city", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, - "seriesNumberWidth": undefined, "spreadsheet": Anything, "value": "city", "width": 149, @@ -362,30 +254,19 @@ exports[`PivotSheet Corner Tests should render row corner when columns is empty } 1`] = ` Array [ Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "series", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "", "height": 30, - "hierarchy": undefined, "id": "", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, - "seriesNumberWidth": undefined, "spreadsheet": Anything, "value": "序号", "width": 80, @@ -393,30 +274,19 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "province", "height": 30, - "hierarchy": undefined, "id": "province", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, - "seriesNumberWidth": undefined, "spreadsheet": Anything, "value": "province", "width": 109, @@ -424,30 +294,19 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "city", "height": 30, - "hierarchy": undefined, "id": "city", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, - "seriesNumberWidth": undefined, "spreadsheet": Anything, "value": "city", "width": 109, @@ -464,29 +323,19 @@ exports[`PivotSheet Corner Tests should render row corner when columns is empty } 1`] = ` Array [ Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "", "height": 30, - "hierarchy": undefined, "id": "province/city", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, "seriesNumberWidth": 0, "spreadsheet": Anything, "value": "province/city", @@ -504,30 +353,19 @@ exports[`PivotSheet Corner Tests should render row corner when columns is empty } 1`] = ` Array [ Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "series", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "", "height": 30, - "hierarchy": undefined, "id": "", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, - "seriesNumberWidth": undefined, "spreadsheet": Anything, "value": "序号", "width": 80, @@ -535,29 +373,19 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "", "height": 30, - "hierarchy": undefined, "id": "province/city", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, "seriesNumberWidth": 80, "spreadsheet": Anything, "value": "province/city", @@ -575,30 +403,19 @@ exports[`PivotSheet Corner Tests should render row corner when measure hidden fo } 1`] = ` Array [ Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "province", "height": 30, - "hierarchy": undefined, "id": "province", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, - "seriesNumberWidth": undefined, "spreadsheet": Anything, "value": "province", "width": 99.33, @@ -606,30 +423,19 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "city", "height": 30, - "hierarchy": undefined, "id": "city", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, - "seriesNumberWidth": undefined, "spreadsheet": Anything, "value": "city", "width": 99.33, @@ -646,30 +452,19 @@ exports[`PivotSheet Corner Tests should render row corner when measure hidden fo } 1`] = ` Array [ Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "series", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "", "height": 30, - "hierarchy": undefined, "id": "", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, - "seriesNumberWidth": undefined, "spreadsheet": Anything, "value": "序号", "width": 80, @@ -677,30 +472,19 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "province", "height": 30, - "hierarchy": undefined, "id": "province", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, - "seriesNumberWidth": undefined, "spreadsheet": Anything, "value": "province", "width": 96, @@ -708,30 +492,19 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "city", "height": 30, - "hierarchy": undefined, "id": "city", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, - "seriesNumberWidth": undefined, "spreadsheet": Anything, "value": "city", "width": 96, @@ -748,29 +521,19 @@ exports[`PivotSheet Corner Tests should render row corner when measure hidden fo } 1`] = ` Array [ Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "", "height": 30, - "hierarchy": undefined, "id": "province/city", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, "seriesNumberWidth": 0, "spreadsheet": Anything, "value": "province/city", @@ -788,30 +551,19 @@ exports[`PivotSheet Corner Tests should render row corner when measure hidden fo } 1`] = ` Array [ Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "series", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "", "height": 30, - "hierarchy": undefined, "id": "", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, - "seriesNumberWidth": undefined, "spreadsheet": Anything, "value": "序号", "width": 80, @@ -819,29 +571,19 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": undefined, + "extra": Object { + "isCustomHeight": undefined, + }, "field": "", "height": 30, - "hierarchy": undefined, "id": "province/city", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, + "isLeaf": false, "isPivotMode": true, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "level": undefined, + "level": 0, "padding": 0, - "parent": undefined, - "query": undefined, - "rowIndex": undefined, "seriesNumberWidth": 80, "spreadsheet": Anything, "value": "province/city", diff --git a/packages/s2-core/__tests__/spreadsheet/__snapshots__/custom-cell-style-spec.ts.snap b/packages/s2-core/__tests__/spreadsheet/__snapshots__/custom-cell-style-spec.ts.snap index c9eb35e66e..ad75e1272b 100644 --- a/packages/s2-core/__tests__/spreadsheet/__snapshots__/custom-cell-style-spec.ts.snap +++ b/packages/s2-core/__tests__/spreadsheet/__snapshots__/custom-cell-style-spec.ts.snap @@ -235,6 +235,26 @@ Array [ ] `; +exports[`SpreadSheet Custom Cell Style Tests PivotSheet Custom Cell Style Tests #RowCell should get custom tree row cell style 1`] = ` +Array [ + Object { + "height": 30, + "id": "root[&]浙江", + "width": 150, + }, + Object { + "height": 30, + "id": "root[&]浙江[&]义乌", + "width": 150, + }, + Object { + "height": 30, + "id": "root[&]浙江[&]杭州", + "width": 150, + }, +] +`; + exports[`SpreadSheet Custom Cell Style Tests PivotSheet Custom Cell Style Tests should render default cell style 1`] = ` Array [ Object { diff --git a/packages/s2-core/__tests__/spreadsheet/__snapshots__/miss-dimension-values-spec.ts.snap b/packages/s2-core/__tests__/spreadsheet/__snapshots__/miss-dimension-values-spec.ts.snap index 3c0793b6c4..7bfa7ddc92 100644 --- a/packages/s2-core/__tests__/spreadsheet/__snapshots__/miss-dimension-values-spec.ts.snap +++ b/packages/s2-core/__tests__/spreadsheet/__snapshots__/miss-dimension-values-spec.ts.snap @@ -21,19 +21,19 @@ exports[`Miss Dimension Values Tests should replace empty dimension value placeh exports[`Miss Dimension Values Tests should replace empty dimension value placeholder when copy original data 1`] = ` "first second third number -总计 $$empty_field_value$$ $$empty_field_value$$ 1732771 +总计 - - 1732771 维值-1 维值-2 维度-3 12222 维值-1 维值-3 维值-3 11111 维值-1 维值-3 维度-3 11111 维值-1 维值-3 小计 维值-1 小计 456 测试-1 测试-2 维度-3 4444567 -测试-1 测试-3 $$empty_field_value$$ 785222 +测试-1 测试-3 - 785222 测试-1 测试-4 维度-3 6455644 测试-1 测试-5 维度-3 1111 测试-1 小计 125555 -测试-6 测试-x $$empty_field_value$$ 111111 -测试-6 测试-7 $$empty_field_value$$ 67878 -测试-6 测试-8 $$empty_field_value$$ 456.464 +测试-6 测试-x - 111111 +测试-6 测试-7 - 67878 +测试-6 测试-8 - 456.464 测试-6 小计 123.416" `; diff --git a/packages/s2-core/__tests__/spreadsheet/__snapshots__/multi-line-text-spec.ts.snap b/packages/s2-core/__tests__/spreadsheet/__snapshots__/multi-line-text-spec.ts.snap index ed4293c5e8..c9bab271a5 100644 --- a/packages/s2-core/__tests__/spreadsheet/__snapshots__/multi-line-text-spec.ts.snap +++ b/packages/s2-core/__tests__/spreadsheet/__snapshots__/multi-line-text-spec.ts.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`SpreadSheet Multi Line Text Tests PivotSheet should calc correctly row cell height if actual text lines is difference 1`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should adjust col cell height if corner cell height > col cell height 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 68, + "height": 48, "multiLineActualTexts": Array [ "序号", ], @@ -14,62 +14,67 @@ Array [ "width": 80, }, Object { - "actualText": "省份", + "actualText": "province", "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 68, + "actualTextWidth": 51, + "height": 48, "multiLineActualTexts": Array [ - "省份", + "province", ], - "originalText": "省份", - "width": 96, + "originalText": "province", + "width": 102.57, }, Object { - "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "actualTextHeight": 64, - "actualTextWidth": 292, - "height": 68, + "actualText": "城市城市", + "actualTextHeight": 32, + "actualTextWidth": 50, + "height": 48, "multiLineActualTexts": Array [ - "城市城市城市", - "城市城市城市", - "城市城市城市", - "城市城市城市", + "城市", + "城市", ], - "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "width": 96, + "originalText": "城市 +城市", + "width": 102.57, }, Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", - "actualTextHeight": 16, - "actualTextWidth": 241, - "height": 72, + "actualText": "类别类别", + "actualTextHeight": 32, + "actualTextWidth": 50, + "height": 48, "multiLineActualTexts": Array [ - "类别类别类别类别类别类别类别类别类别类别", + "类别", + "类别", ], - "originalText": "类别类别类别类别类别类别类别类别类别类别", - "width": 272, + "originalText": "类别 +类别", + "width": 285.14, }, Object { - "actualText": "子类别", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 72, + "actualText": "子类别子类别子类别", + "actualTextHeight": 48, + "actualTextWidth": 111, + "height": 64, "multiLineActualTexts": Array [ "子类别", + "子类别", + "子类别", ], - "originalText": "子类别", - "width": 272, + "originalText": "子类别 +子类别 +子类别", + "width": 285.14, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should calc correctly row cell height if actual text lines is difference 2`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should adjust col cell height if corner cell height > col cell height 2`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 72, + "height": 120, "multiLineActualTexts": Array [ "1", ], @@ -80,7 +85,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 120, + "height": 30, "multiLineActualTexts": Array [ "2", ], @@ -91,261 +96,181 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 72, + "height": 120, "multiLineActualTexts": Array [ "3", ], "originalText": "3", "width": 80, }, - Object { - "actualText": "4", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 120, - "multiLineActualTexts": Array [ - "4", - ], - "originalText": "4", - "width": 80, - }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should calc correctly row cell height if actual text lines is difference 3`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should adjust col cell height if corner cell height > col cell height 3`] = ` Array [ - Object { - "actualText": "纸张纸张纸张纸张纸张", - "actualTextHeight": 32, - "actualTextWidth": 122, - "height": 72, - "multiLineActualTexts": Array [ - "纸张纸张纸张", - "纸张纸张", - ], - "originalText": "纸张纸张纸张纸张纸张", - "width": 96, - }, - Object { - "actualText": "-", - "actualTextHeight": 16, - "actualTextWidth": 4, - "height": 72, - "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 96, - }, - Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量数量", - "actualTextHeight": 60, - "actualTextWidth": 268, - "height": 68, - "multiLineActualTexts": Array [ - "数量数量数量", - "数量数量数量", - "数量数量数量", - "数量数量", - ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 96, - }, Object { "actualText": "家具", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 72, + "height": 48, "multiLineActualTexts": Array [ "家具", ], "originalText": "家具", - "width": 192, + "width": 205.14, }, Object { "actualText": "桌子", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 72, + "height": 64, "multiLineActualTexts": Array [ "桌子", ], "originalText": "桌子", - "width": 96, + "width": 102.57, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量数量", - "actualTextHeight": 60, - "actualTextWidth": 268, - "height": 68, + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 48, "multiLineActualTexts": Array [ - "数量数量数量", - "数量数量数量", - "数量数量数量", - "数量数量", + "数量...", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 96, + "originalText": "数量 +数量 +数量 +数量", + "width": 102.57, }, Object { "actualText": "沙发", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 72, + "height": 64, "multiLineActualTexts": Array [ "沙发", ], "originalText": "沙发", - "width": 96, + "width": 102.57, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量数量", - "actualTextHeight": 60, - "actualTextWidth": 268, - "height": 68, + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 48, "multiLineActualTexts": Array [ - "数量数量数量", - "数量数量数量", - "数量数量数量", - "数量数量", + "数量...", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 96, + "originalText": "数量 +数量 +数量 +数量", + "width": 102.57, }, Object { - "actualText": "家具家具家具家具家具家具家具家具家具家具家具家...", - "actualTextHeight": 64, - "actualTextWidth": 290, - "height": 72, + "actualText": "家具家具家具...", + "actualTextHeight": 16, + "actualTextWidth": 83, + "height": 48, "multiLineActualTexts": Array [ - "家具家具家具", - "家具家具家具", - "家具家具家具", - "家具家具家...", + "家具家具家具...", ], "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "width": 96, + "width": 102.57, }, Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌...", - "actualTextHeight": 64, - "actualTextWidth": 290, - "height": 72, + "actualText": "桌子桌子桌子...", + "actualTextHeight": 16, + "actualTextWidth": 83, + "height": 64, "multiLineActualTexts": Array [ - "桌子桌子桌子", - "桌子桌子桌子", - "桌子桌子桌子", - "桌子桌子桌...", + "桌子桌子桌子...", ], "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", - "width": 96, + "width": 102.57, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量数量", - "actualTextHeight": 60, - "actualTextWidth": 268, - "height": 68, + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 48, "multiLineActualTexts": Array [ - "数量数量数量", - "数量数量数量", - "数量数量数量", - "数量数量", + "数量...", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 96, + "originalText": "数量 +数量 +数量 +数量", + "width": 102.57, }, Object { "actualText": "办公用品", "actualTextHeight": 16, "actualTextWidth": 49, - "height": 72, + "height": 48, "multiLineActualTexts": Array [ "办公用品", ], "originalText": "办公用品", - "width": 192, + "width": 205.14, }, Object { "actualText": "笔", "actualTextHeight": 16, "actualTextWidth": 13, - "height": 72, + "height": 64, "multiLineActualTexts": Array [ "笔", ], "originalText": "笔", - "width": 96, + "width": 102.57, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量数量", - "actualTextHeight": 60, - "actualTextWidth": 268, - "height": 68, + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 48, "multiLineActualTexts": Array [ - "数量数量数量", - "数量数量数量", - "数量数量数量", - "数量数量", + "数量...", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 96, + "originalText": "数量 +数量 +数量 +数量", + "width": 102.57, }, Object { "actualText": "纸张", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 72, + "height": 64, "multiLineActualTexts": Array [ "纸张", ], "originalText": "纸张", - "width": 96, + "width": 102.57, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量数量", - "actualTextHeight": 60, - "actualTextWidth": 268, - "height": 68, + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 48, "multiLineActualTexts": Array [ - "数量数量数量", - "数量数量数量", - "数量数量数量", - "数量数量", + "数量...", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 96, + "originalText": "数量 +数量 +数量 +数量", + "width": 102.57, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should calc correctly row cell height if actual text lines is difference 4`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should adjust col cell height if corner cell height > col cell height 4`] = ` Array [ - Object { - "actualText": "浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙...", - "actualTextHeight": 64, - "actualTextWidth": 290, - "height": 72, - "multiLineActualTexts": Array [ - "浙江浙江浙江", - "浙江浙江浙江", - "浙江浙江浙江", - "浙江浙江浙...", - ], - "originalText": "浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江", - "width": 96, - }, - Object { - "actualText": "杭州杭州杭州杭州", - "actualTextHeight": 30, - "actualTextWidth": 98, - "height": 72, - "multiLineActualTexts": Array [ - "杭州杭州杭州", - "杭州", - ], - "originalText": "杭州杭州杭州杭州", - "width": 96, - }, Object { "actualText": "浙江省", "actualTextHeight": 16, @@ -355,7 +280,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 96, + "width": 102.57, }, Object { "actualText": "绍兴市", @@ -366,7 +291,7 @@ Array [ "绍兴市", ], "originalText": "绍兴市", - "width": 96, + "width": 102.57, }, Object { "actualText": "宁波市", @@ -377,7 +302,7 @@ Array [ "宁波市", ], "originalText": "宁波市", - "width": 96, + "width": 102.57, }, Object { "actualText": "舟山市", @@ -388,7 +313,7 @@ Array [ "舟山市", ], "originalText": "舟山市", - "width": 96, + "width": 102.57, }, Object { "actualText": "杭州市", @@ -399,35 +324,29 @@ Array [ "杭州市", ], "originalText": "杭州市", - "width": 96, + "width": 102.57, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江...", - "actualTextHeight": 64, - "actualTextWidth": 290, - "height": 72, + "actualText": "浙江省浙江省...", + "actualTextHeight": 16, + "actualTextWidth": 83, + "height": 30, "multiLineActualTexts": Array [ - "浙江省浙江省", - "浙江省浙江省", - "浙江省浙江省", - "浙江省浙江...", + "浙江省浙江省...", ], "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", - "width": 96, + "width": 102.57, }, Object { - "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州...", - "actualTextHeight": 60, - "actualTextWidth": 290, - "height": 72, + "actualText": "杭州市杭州市...", + "actualTextHeight": 15, + "actualTextWidth": 83, + "height": 30, "multiLineActualTexts": Array [ - "杭州市杭州市", - "杭州市杭州市", - "杭州市杭州市", - "杭州市杭州...", + "杭州市杭州市...", ], "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", - "width": 96, + "width": 102.57, }, Object { "actualText": "四川省", @@ -438,7 +357,7 @@ Array [ "四川省", ], "originalText": "四川省", - "width": 96, + "width": 102.57, }, Object { "actualText": "成都市", @@ -449,7 +368,7 @@ Array [ "成都市", ], "originalText": "成都市", - "width": 96, + "width": 102.57, }, Object { "actualText": "绵阳市", @@ -460,7 +379,7 @@ Array [ "绵阳市", ], "originalText": "绵阳市", - "width": 96, + "width": 102.57, }, Object { "actualText": "南充市", @@ -471,7 +390,7 @@ Array [ "南充市", ], "originalText": "南充市", - "width": 96, + "width": 102.57, }, Object { "actualText": "乐山市", @@ -482,145 +401,23 @@ Array [ "乐山市", ], "originalText": "乐山市", - "width": 96, + "width": 102.57, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should calc correctly row cell height if actual text lines is difference 5`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should adjust col cell height if corner cell height > col cell height 5`] = ` Array [ Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 72, - "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 96, - }, - Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 30, - "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 96, - }, - Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 30, - "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 96, - }, - Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 30, - "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 96, - }, - Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 30, - "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 96, - }, - Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 72, - "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 96, - }, - Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 30, - "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 96, - }, - Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 30, - "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 96, - }, - Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 30, - "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 96, - }, - Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 30, - "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 96, - }, - Object { - "actualText": "-", + "actualText": "23672367236...", "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 72, - "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 96, - }, - Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 99, + "actualTextWidth": 84, "height": 30, "multiLineActualTexts": Array [ - "23672367236", - "1111", + "23672367236...", ], "originalText": 236723672361111, - "width": 96, + "width": 102.57, }, Object { "actualText": "3877", @@ -631,7 +428,7 @@ Array [ "3877", ], "originalText": 3877, - "width": 96, + "width": 102.57, }, Object { "actualText": "4342", @@ -642,7 +439,7 @@ Array [ "4342", ], "originalText": 4342, - "width": 96, + "width": 102.57, }, Object { "actualText": "-", @@ -653,18 +450,18 @@ Array [ "-", ], "originalText": "-", - "width": 96, + "width": 102.57, }, Object { "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 72, + "height": 30, "multiLineActualTexts": Array [ "-", ], "originalText": "-", - "width": 96, + "width": 102.57, }, Object { "actualText": "1723", @@ -675,7 +472,7 @@ Array [ "1723", ], "originalText": 1723, - "width": 96, + "width": 102.57, }, Object { "actualText": "1822", @@ -686,7 +483,7 @@ Array [ "1822", ], "originalText": 1822, - "width": 96, + "width": 102.57, }, Object { "actualText": "1943", @@ -697,7 +494,7 @@ Array [ "1943", ], "originalText": 1943, - "width": 96, + "width": 102.57, }, Object { "actualText": "2330", @@ -708,18 +505,7 @@ Array [ "2330", ], "originalText": 2330, - "width": 96, - }, - Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 72, - "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 96, + "width": 102.57, }, Object { "actualText": "632", @@ -730,7 +516,7 @@ Array [ "632", ], "originalText": 632, - "width": 96, + "width": 102.57, }, Object { "actualText": "7234", @@ -741,7 +527,7 @@ Array [ "7234", ], "originalText": 7234, - "width": 96, + "width": 102.57, }, Object { "actualText": "834", @@ -752,7 +538,7 @@ Array [ "834", ], "originalText": 834, - "width": 96, + "width": 102.57, }, Object { "actualText": "5343", @@ -763,18 +549,18 @@ Array [ "5343", ], "originalText": 5343, - "width": 96, + "width": 102.57, }, Object { "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 72, + "height": 30, "multiLineActualTexts": Array [ "-", ], "originalText": "-", - "width": 96, + "width": 102.57, }, Object { "actualText": "2451", @@ -785,7 +571,7 @@ Array [ "2451", ], "originalText": 2451, - "width": 96, + "width": 102.57, }, Object { "actualText": "2244", @@ -796,7 +582,7 @@ Array [ "2244", ], "originalText": 2244, - "width": 96, + "width": 102.57, }, Object { "actualText": "2333", @@ -807,7 +593,7 @@ Array [ "2333", ], "originalText": 2333, - "width": 96, + "width": 102.57, }, Object { "actualText": "2445", @@ -818,18 +604,18 @@ Array [ "2445", ], "originalText": 2445, - "width": 96, + "width": 102.57, }, Object { "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 72, + "height": 30, "multiLineActualTexts": Array [ "-", ], "originalText": "-", - "width": 96, + "width": 102.57, }, Object { "actualText": "-", @@ -840,7 +626,7 @@ Array [ "-", ], "originalText": "-", - "width": 96, + "width": 102.57, }, Object { "actualText": "-", @@ -851,7 +637,7 @@ Array [ "-", ], "originalText": "-", - "width": 96, + "width": 102.57, }, Object { "actualText": "-", @@ -862,31 +648,18 @@ Array [ "-", ], "originalText": "-", - "width": 96, + "width": 102.57, }, Object { - "actualText": "-", + "actualText": "77897789778...", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 84, "height": 30, "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 96, - }, - Object { - "actualText": "7789778977897789778977897789", - "actualTextHeight": 45, - "actualTextWidth": 189, - "height": 72, - "multiLineActualTexts": Array [ - "77897789778", - "97789778977", - "897789", + "77897789778...", ], "originalText": "7789778977897789778977897789", - "width": 96, + "width": 102.57, }, Object { "actualText": "-", @@ -897,7 +670,7 @@ Array [ "-", ], "originalText": "-", - "width": 96, + "width": 102.57, }, Object { "actualText": "-", @@ -908,7 +681,7 @@ Array [ "-", ], "originalText": "-", - "width": 96, + "width": 102.57, }, Object { "actualText": "-", @@ -919,7 +692,7 @@ Array [ "-", ], "originalText": "-", - "width": 96, + "width": 102.57, }, Object { "actualText": "-", @@ -930,18 +703,7 @@ Array [ "-", ], "originalText": "-", - "width": 96, - }, - Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 72, - "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 96, + "width": 102.57, }, Object { "actualText": "1304", @@ -952,7 +714,7 @@ Array [ "1304", ], "originalText": 1304, - "width": 96, + "width": 102.57, }, Object { "actualText": "1145", @@ -963,7 +725,7 @@ Array [ "1145", ], "originalText": 1145, - "width": 96, + "width": 102.57, }, Object { "actualText": "1432", @@ -974,7 +736,7 @@ Array [ "1432", ], "originalText": 1432, - "width": 96, + "width": 102.57, }, Object { "actualText": "945", @@ -985,18 +747,18 @@ Array [ "945", ], "originalText": 945, - "width": 96, + "width": 102.57, }, Object { "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 72, + "height": 30, "multiLineActualTexts": Array [ "-", ], "originalText": "-", - "width": 96, + "width": 102.57, }, Object { "actualText": "2335", @@ -1007,7 +769,7 @@ Array [ "2335", ], "originalText": 2335, - "width": 96, + "width": 102.57, }, Object { "actualText": "245", @@ -1018,7 +780,7 @@ Array [ "245", ], "originalText": 245, - "width": 96, + "width": 102.57, }, Object { "actualText": "2457", @@ -1029,7 +791,7 @@ Array [ "2457", ], "originalText": 2457, - "width": 96, + "width": 102.57, }, Object { "actualText": "2458", @@ -1040,18 +802,7 @@ Array [ "2458", ], "originalText": 2458, - "width": 96, - }, - Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 72, - "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 96, + "width": 102.57, }, Object { "actualText": "1354", @@ -1062,7 +813,7 @@ Array [ "1354", ], "originalText": 1354, - "width": 96, + "width": 102.57, }, Object { "actualText": "1523", @@ -1073,7 +824,7 @@ Array [ "1523", ], "originalText": 1523, - "width": 96, + "width": 102.57, }, Object { "actualText": "1634", @@ -1084,7 +835,7 @@ Array [ "1634", ], "originalText": 1634, - "width": 96, + "width": 102.57, }, Object { "actualText": "1343", @@ -1095,18 +846,18 @@ Array [ "1343", ], "originalText": 1343, - "width": 96, + "width": 102.57, }, Object { "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 72, + "height": 30, "multiLineActualTexts": Array [ "-", ], "originalText": "-", - "width": 96, + "width": 102.57, }, Object { "actualText": "4004", @@ -1117,7 +868,7 @@ Array [ "4004", ], "originalText": 4004, - "width": 96, + "width": 102.57, }, Object { "actualText": "3077", @@ -1128,7 +879,7 @@ Array [ "3077", ], "originalText": 3077, - "width": 96, + "width": 102.57, }, Object { "actualText": "3551", @@ -1139,7 +890,7 @@ Array [ "3551", ], "originalText": 3551, - "width": 96, + "width": 102.57, }, Object { "actualText": "352", @@ -1150,18 +901,18 @@ Array [ "352", ], "originalText": 352, - "width": 96, + "width": 102.57, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should default render one line text 1`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should adjust col cell height if corner cell height > col cell height by "valueInCols: false" 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 30, + "height": 48, "multiLineActualTexts": Array [ "序号", ], @@ -1169,53 +920,57 @@ Array [ "width": 80, }, Object { - "actualText": "省份", + "actualText": "province", "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 30, + "actualTextWidth": 51, + "height": 48, "multiLineActualTexts": Array [ - "省份", + "province", ], - "originalText": "省份", + "originalText": "province", "width": 96, }, Object { - "actualText": "城市城市城...", - "actualTextHeight": 16, - "actualTextWidth": 71, - "height": 30, + "actualText": "城市城市", + "actualTextHeight": 32, + "actualTextWidth": 50, + "height": 48, "multiLineActualTexts": Array [ - "城市城市城...", + "城市", + "城市", ], - "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "originalText": "城市 +城市", "width": 96, }, Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualText": "数值", "actualTextHeight": 16, - "actualTextWidth": 241, - "height": 30, + "actualTextWidth": 25, + "height": 48, "multiLineActualTexts": Array [ - "类别类别类别类别类别类别类别类别类别类别", + "数值", ], - "originalText": "类别类别类别类别类别类别类别类别类别类别", - "width": 272, + "originalText": "数值", + "width": 96, }, Object { - "actualText": "子类别", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 30, + "actualText": "类别类别", + "actualTextHeight": 32, + "actualTextWidth": 50, + "height": 48, "multiLineActualTexts": Array [ - "子类别", + "类别", + "类别", ], - "originalText": "子类别", - "width": 272, + "originalText": "类别 +类别", + "width": 368, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should default render one line text 2`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should adjust col cell height if corner cell height > col cell height by "valueInCols: false" 2`] = ` Array [ Object { "actualText": "1", @@ -1253,13 +1008,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should default render one line text 3`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should adjust col cell height if corner cell height > col cell height by "valueInCols: false" 3`] = ` Array [ Object { "actualText": "家具", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 30, + "height": 48, "multiLineActualTexts": Array [ "家具", ], @@ -1268,9 +1023,9 @@ Array [ }, Object { "actualText": "桌子", - "actualTextHeight": 16, + "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 48, "multiLineActualTexts": Array [ "桌子", ], @@ -1278,42 +1033,75 @@ Array [ "width": 96, }, Object { - "actualText": "数量数量数...", + "actualText": "沙发", "actualTextHeight": 15, - "actualTextWidth": 71, - "height": 30, + "actualTextWidth": 25, + "height": 48, "multiLineActualTexts": Array [ - "数量数量数...", + "沙发", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "originalText": "沙发", "width": 96, }, Object { - "actualText": "沙发", + "actualText": "家具家具家...", "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 30, + "actualTextWidth": 71, + "height": 48, "multiLineActualTexts": Array [ - "沙发", + "家具家具家...", ], - "originalText": "沙发", + "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", "width": 96, }, Object { - "actualText": "数量数量数...", + "actualText": "桌子桌子桌...", "actualTextHeight": 15, "actualTextWidth": 71, - "height": 30, + "height": 48, "multiLineActualTexts": Array [ - "数量数量数...", + "桌子桌子桌...", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "width": 96, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 16, + "actualTextWidth": 49, + "height": 48, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 192, + }, + Object { + "actualText": "笔", + "actualTextHeight": 15, + "actualTextWidth": 13, + "height": 48, + "multiLineActualTexts": Array [ + "笔", + ], + "originalText": "笔", + "width": 96, + }, + Object { + "actualText": "纸张", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 48, + "multiLineActualTexts": Array [ + "纸张", + ], + "originalText": "纸张", "width": 96, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should default render one line text 4`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should adjust col cell height if corner cell height > col cell height by "valueInCols: false" 4`] = ` Array [ Object { "actualText": "浙江省", @@ -1326,6 +1114,106 @@ Array [ "originalText": "浙江省", "width": 96, }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 96, + }, + Object { + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 30, + "multiLineActualTexts": Array [ + "数量...", + ], + "originalText": "数量 +数量 +数量 +数量", + "width": 96, + }, + Object { + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "宁波市", + ], + "originalText": "宁波市", + "width": 96, + }, + Object { + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 30, + "multiLineActualTexts": Array [ + "数量...", + ], + "originalText": "数量 +数量 +数量 +数量", + "width": 96, + }, + Object { + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "舟山市", + ], + "originalText": "舟山市", + "width": 96, + }, + Object { + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 30, + "multiLineActualTexts": Array [ + "数量...", + ], + "originalText": "数量 +数量 +数量 +数量", + "width": 96, + }, + Object { + "actualText": "杭州市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "杭州市", + ], + "originalText": "杭州市", + "width": 96, + }, + Object { + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 30, + "multiLineActualTexts": Array [ + "数量...", + ], + "originalText": "数量 +数量 +数量 +数量", + "width": 96, + }, Object { "actualText": "浙江省浙江...", "actualTextHeight": 16, @@ -1337,6 +1225,31 @@ Array [ "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 96, }, + Object { + "actualText": "杭州市杭州...", + "actualTextHeight": 15, + "actualTextWidth": 71, + "height": 30, + "multiLineActualTexts": Array [ + "杭州市杭州...", + ], + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "width": 96, + }, + Object { + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 30, + "multiLineActualTexts": Array [ + "数量...", + ], + "originalText": "数量 +数量 +数量 +数量", + "width": 96, + }, Object { "actualText": "四川省", "actualTextHeight": 16, @@ -1348,10 +1261,110 @@ Array [ "originalText": "四川省", "width": 96, }, + Object { + "actualText": "成都市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "成都市", + ], + "originalText": "成都市", + "width": 96, + }, + Object { + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 30, + "multiLineActualTexts": Array [ + "数量...", + ], + "originalText": "数量 +数量 +数量 +数量", + "width": 96, + }, + Object { + "actualText": "绵阳市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绵阳市", + ], + "originalText": "绵阳市", + "width": 96, + }, + Object { + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 30, + "multiLineActualTexts": Array [ + "数量...", + ], + "originalText": "数量 +数量 +数量 +数量", + "width": 96, + }, + Object { + "actualText": "南充市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "南充市", + ], + "originalText": "南充市", + "width": 96, + }, + Object { + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 30, + "multiLineActualTexts": Array [ + "数量...", + ], + "originalText": "数量 +数量 +数量 +数量", + "width": 96, + }, + Object { + "actualText": "乐山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "乐山市", + ], + "originalText": "乐山市", + "width": 96, + }, + Object { + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 30, + "multiLineActualTexts": Array [ + "数量...", + ], + "originalText": "数量 +数量 +数量 +数量", + "width": 96, + }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should default render one line text 5`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should adjust col cell height if corner cell height > col cell height by "valueInCols: false" 5`] = ` Array [ Object { "actualText": "2367236723...", @@ -1551,223 +1564,587 @@ Array [ "originalText": 2445, "width": 96, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly col cell height priority if actual text not wrap 1`] = ` -Array [ Object { - "actualText": "序号", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 20, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "序号", + "-", ], - "originalText": "序号", - "width": 80, + "originalText": "-", + "width": 96, }, Object { - "actualText": "province", - "actualTextHeight": 16, - "actualTextWidth": 51, - "height": 20, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "province", + "-", ], - "originalText": "province", - "width": 119.66, + "originalText": "-", + "width": 96, }, Object { - "actualText": "city", - "actualTextHeight": 16, - "actualTextWidth": 21, - "height": 20, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "city", + "-", ], - "originalText": "city", - "width": 119.66, + "originalText": "-", + "width": 96, }, Object { - "actualText": "type", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 20, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "type", + "-", ], - "originalText": "type", - "width": 319.32, + "originalText": "-", + "width": 96, }, Object { - "actualText": "sub_type", - "actualTextHeight": 16, - "actualTextWidth": 53, - "height": 20, + "actualText": "7789778977...", + "actualTextHeight": 15, + "actualTextWidth": 77, + "height": 30, "multiLineActualTexts": Array [ - "sub_type", + "7789778977...", ], - "originalText": "sub_type", - "width": 319.32, + "originalText": "7789778977897789778977897789", + "width": 96, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly col cell height priority if actual text not wrap 2`] = ` -Array [ Object { - "actualText": "1", + "actualText": "-", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 120, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "1", + "-", ], - "originalText": "1", - "width": 80, + "originalText": "-", + "width": 96, }, Object { - "actualText": "2", + "actualText": "-", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 120, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "2", + "-", ], - "originalText": "2", - "width": 80, + "originalText": "-", + "width": 96, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly col cell height priority if actual text not wrap 3`] = ` -Array [ Object { - "actualText": "家具", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 20, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "家具", + "-", ], - "originalText": "家具", - "width": 239.34, + "originalText": "-", + "width": 96, }, Object { - "actualText": "桌子", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 20, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "桌子", + "-", ], - "originalText": "桌子", - "width": 119.67, + "originalText": "-", + "width": 96, }, Object { - "actualText": "number", + "actualText": "1304", "actualTextHeight": 15, - "actualTextWidth": 41, - "height": 20, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "number", + "1304", ], - "originalText": "number", - "width": 119.67, + "originalText": 1304, + "width": 96, }, Object { - "actualText": "沙发", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 20, + "actualText": "1145", + "actualTextHeight": 15, + "actualTextWidth": 26, + "height": 30, "multiLineActualTexts": Array [ - "沙发", + "1145", ], - "originalText": "沙发", - "width": 119.67, + "originalText": 1145, + "width": 96, }, Object { - "actualText": "number", + "actualText": "1432", "actualTextHeight": 15, - "actualTextWidth": 41, - "height": 20, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "number", + "1432", ], - "originalText": "number", - "width": 119.67, + "originalText": 1432, + "width": 96, }, Object { - "actualText": "办公用品", - "actualTextHeight": 16, - "actualTextWidth": 49, - "height": 20, + "actualText": "945", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, "multiLineActualTexts": Array [ - "办公用品", + "945", ], - "originalText": "办公用品", - "width": 239.34, + "originalText": 945, + "width": 96, }, Object { - "actualText": "笔", - "actualTextHeight": 16, - "actualTextWidth": 13, - "height": 20, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "笔", + "-", ], - "originalText": "笔", - "width": 119.67, + "originalText": "-", + "width": 96, }, Object { - "actualText": "number", + "actualText": "2335", "actualTextHeight": 15, - "actualTextWidth": 41, - "height": 20, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "number", + "2335", ], - "originalText": "number", - "width": 119.67, + "originalText": 2335, + "width": 96, }, Object { - "actualText": "纸张", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 20, + "actualText": "245", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, "multiLineActualTexts": Array [ - "纸张", + "245", ], - "originalText": "纸张", - "width": 119.67, + "originalText": 245, + "width": 96, }, Object { - "actualText": "number", + "actualText": "2457", "actualTextHeight": 15, - "actualTextWidth": 41, - "height": 20, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "number", + "2457", ], - "originalText": "number", - "width": 119.67, + "originalText": 2457, + "width": 96, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly col cell height priority if actual text not wrap 4`] = ` + Object { + "actualText": "2458", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2458", + ], + "originalText": 2458, + "width": 96, + }, + Object { + "actualText": "1354", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1354", + ], + "originalText": 1354, + "width": 96, + }, + Object { + "actualText": "1523", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1523", + ], + "originalText": 1523, + "width": 96, + }, + Object { + "actualText": "1634", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1634", + ], + "originalText": 1634, + "width": 96, + }, + Object { + "actualText": "1343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1343", + ], + "originalText": 1343, + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "4004", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "4004", + ], + "originalText": 4004, + "width": 96, + }, + Object { + "actualText": "3077", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "3077", + ], + "originalText": 3077, + "width": 96, + }, + Object { + "actualText": "3551", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "3551", + ], + "originalText": 3551, + "width": 96, + }, + Object { + "actualText": "352", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "352", + ], + "originalText": 352, + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should adjust col cell height if corner cell height > col cell height by tree mode 1`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 80, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "province/城市城市", + "actualTextHeight": 32, + "actualTextWidth": 103, + "height": 80, + "multiLineActualTexts": Array [ + "province/城市", + "城市", + ], + "originalText": "province/城市 +城市", + "width": 150, + }, + Object { + "actualText": "类别类别", + "actualTextHeight": 32, + "actualTextWidth": 50, + "height": 48, + "multiLineActualTexts": Array [ + "类别", + "类别", + ], + "originalText": "类别 +类别", + "width": 230, + }, + Object { + "actualText": "子类别子类别子类别", + "actualTextHeight": 48, + "actualTextWidth": 111, + "height": 64, + "multiLineActualTexts": Array [ + "子类别", + "子类别", + "子类别", + ], + "originalText": "子类别 +子类别 +子类别", + "width": 230, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should adjust col cell height if corner cell height > col cell height by tree mode 2`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 150, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": "1", + "width": 80, + }, + Object { + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 60, + "multiLineActualTexts": Array [ + "2", + ], + "originalText": "2", + "width": 80, + }, + Object { + "actualText": "3", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 150, + "multiLineActualTexts": Array [ + "3", + ], + "originalText": "3", + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should adjust col cell height if corner cell height > col cell height by tree mode 3`] = ` +Array [ + Object { + "actualText": "家具", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 48, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 227.2, + }, + Object { + "actualText": "桌子", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 113.6, + }, + Object { + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 80, + "multiLineActualTexts": Array [ + "数量...", + ], + "originalText": "数量 +数量 +数量 +数量", + "width": 113.6, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 113.6, + }, + Object { + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 80, + "multiLineActualTexts": Array [ + "数量...", + ], + "originalText": "数量 +数量 +数量 +数量", + "width": 113.6, + }, + Object { + "actualText": "家具家具家具家...", + "actualTextHeight": 16, + "actualTextWidth": 95, + "height": 48, + "multiLineActualTexts": Array [ + "家具家具家具家...", + ], + "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "width": 113.6, + }, + Object { + "actualText": "桌子桌子桌子桌...", + "actualTextHeight": 16, + "actualTextWidth": 95, + "height": 64, + "multiLineActualTexts": Array [ + "桌子桌子桌子桌...", + ], + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "width": 113.6, + }, + Object { + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 80, + "multiLineActualTexts": Array [ + "数量...", + ], + "originalText": "数量 +数量 +数量 +数量", + "width": 113.6, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 16, + "actualTextWidth": 49, + "height": 48, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 227.2, + }, + Object { + "actualText": "笔", + "actualTextHeight": 16, + "actualTextWidth": 13, + "height": 64, + "multiLineActualTexts": Array [ + "笔", + ], + "originalText": "笔", + "width": 113.6, + }, + Object { + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 80, + "multiLineActualTexts": Array [ + "数量...", + ], + "originalText": "数量 +数量 +数量 +数量", + "width": 113.6, + }, + Object { + "actualText": "纸张", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, + "multiLineActualTexts": Array [ + "纸张", + ], + "originalText": "纸张", + "width": 113.6, + }, + Object { + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 80, + "multiLineActualTexts": Array [ + "数量...", + ], + "originalText": "数量 +数量 +数量 +数量", + "width": 113.6, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should adjust col cell height if corner cell height > col cell height by tree mode 4`] = ` Array [ Object { "actualText": "浙江省", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 120, + "height": 30, "multiLineActualTexts": Array [ "浙江省", ], "originalText": "浙江省", - "width": 119.66, + "width": 150, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 150, }, Object { "actualText": "宁波市", @@ -1778,7 +2155,7 @@ Array [ "宁波市", ], "originalText": "宁波市", - "width": 119.66, + "width": 150, }, Object { "actualText": "舟山市", @@ -1789,7 +2166,7 @@ Array [ "舟山市", ], "originalText": "舟山市", - "width": 119.66, + "width": 150, }, Object { "actualText": "杭州市", @@ -1800,29 +2177,40 @@ Array [ "杭州市", ], "originalText": "杭州市", - "width": 119.66, + "width": 150, }, Object { - "actualText": "绍兴市", + "actualText": "浙江省浙江省浙江省...", + "actualTextHeight": 16, + "actualTextWidth": 119, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省浙江省浙江省...", + ], + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "width": 150, + }, + Object { + "actualText": "杭州市杭州市杭州市...", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 119, "height": 30, "multiLineActualTexts": Array [ - "绍兴市", + "杭州市杭州市杭州市...", ], - "originalText": "绍兴市", - "width": 119.66, + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "width": 150, }, Object { "actualText": "四川省", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 120, + "height": 30, "multiLineActualTexts": Array [ "四川省", ], "originalText": "四川省", - "width": 119.66, + "width": 150, }, Object { "actualText": "成都市", @@ -1833,7 +2221,7 @@ Array [ "成都市", ], "originalText": "成都市", - "width": 119.66, + "width": 150, }, Object { "actualText": "绵阳市", @@ -1844,7 +2232,7 @@ Array [ "绵阳市", ], "originalText": "绵阳市", - "width": 119.66, + "width": 150, }, Object { "actualText": "南充市", @@ -1855,7 +2243,7 @@ Array [ "南充市", ], "originalText": "南充市", - "width": 119.66, + "width": 150, }, Object { "actualText": "乐山市", @@ -1866,13 +2254,33 @@ Array [ "乐山市", ], "originalText": "乐山市", - "width": 119.66, + "width": 150, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly col cell height priority if actual text not wrap 5`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should adjust col cell height if corner cell height > col cell height by tree mode 5`] = ` Array [ + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 30, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 113.6, + }, + Object { + "actualText": "2367236723611...", + "actualTextHeight": 15, + "actualTextWidth": 96, + "height": 30, + "multiLineActualTexts": Array [ + "2367236723611...", + ], + "originalText": 236723672361111, + "width": 113.6, + }, Object { "actualText": "3877", "actualTextHeight": 15, @@ -1882,7 +2290,7 @@ Array [ "3877", ], "originalText": 3877, - "width": 119.67, + "width": 113.6, }, Object { "actualText": "4342", @@ -1893,7 +2301,7 @@ Array [ "4342", ], "originalText": 4342, - "width": 119.67, + "width": 113.6, }, Object { "actualText": "-", @@ -1904,7 +2312,16 @@ Array [ "-", ], "originalText": "-", - "width": 119.67, + "width": 113.6, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 30, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 113.6, }, Object { "actualText": "-", @@ -1915,7 +2332,16 @@ Array [ "-", ], "originalText": "-", - "width": 119.67, + "width": 113.6, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 30, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 113.6, }, Object { "actualText": "1723", @@ -1926,7 +2352,7 @@ Array [ "1723", ], "originalText": 1723, - "width": 119.67, + "width": 113.6, }, Object { "actualText": "1822", @@ -1937,7 +2363,7 @@ Array [ "1822", ], "originalText": 1822, - "width": 119.67, + "width": 113.6, }, Object { "actualText": "1943", @@ -1948,7 +2374,7 @@ Array [ "1943", ], "originalText": 1943, - "width": 119.67, + "width": 113.6, }, Object { "actualText": "2330", @@ -1959,7 +2385,27 @@ Array [ "2330", ], "originalText": 2330, - "width": 119.67, + "width": 113.6, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 30, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 113.6, + }, + Object { + "actualText": "632", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "632", + ], + "originalText": 632, + "width": 113.6, }, Object { "actualText": "7234", @@ -1970,7 +2416,7 @@ Array [ "7234", ], "originalText": 7234, - "width": 119.67, + "width": 113.6, }, Object { "actualText": "834", @@ -1981,7 +2427,7 @@ Array [ "834", ], "originalText": 834, - "width": 119.67, + "width": 113.6, }, Object { "actualText": "5343", @@ -1992,18 +2438,36 @@ Array [ "5343", ], "originalText": 5343, - "width": 119.67, + "width": 113.6, }, Object { - "actualText": "632", + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 30, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 113.6, + }, + Object { + "actualText": "-", "actualTextHeight": 15, - "actualTextWidth": 21, + "actualTextWidth": 4, "height": 30, "multiLineActualTexts": Array [ - "632", + "-", ], - "originalText": 632, - "width": 119.67, + "originalText": "-", + "width": 113.6, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 30, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 113.6, }, Object { "actualText": "2451", @@ -2014,7 +2478,7 @@ Array [ "2451", ], "originalText": 2451, - "width": 119.67, + "width": 113.6, }, Object { "actualText": "2244", @@ -2025,7 +2489,7 @@ Array [ "2244", ], "originalText": 2244, - "width": 119.67, + "width": 113.6, }, Object { "actualText": "2333", @@ -2036,7 +2500,7 @@ Array [ "2333", ], "originalText": 2333, - "width": 119.67, + "width": 113.6, }, Object { "actualText": "2445", @@ -2047,128 +2511,268 @@ Array [ "2445", ], "originalText": 2445, - "width": 119.67, + "width": 113.6, }, Object { - "actualText": "1145", - "actualTextHeight": 15, - "actualTextWidth": 26, + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, "height": 30, - "multiLineActualTexts": Array [ - "1145", - ], - "originalText": 1145, - "width": 119.67, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 113.6, }, Object { - "actualText": "1432", + "actualText": "-", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 4, "height": 30, "multiLineActualTexts": Array [ - "1432", + "-", ], - "originalText": 1432, - "width": 119.67, + "originalText": "-", + "width": 113.6, }, Object { - "actualText": "945", + "actualText": "-", "actualTextHeight": 15, - "actualTextWidth": 21, + "actualTextWidth": 4, "height": 30, "multiLineActualTexts": Array [ - "945", + "-", ], - "originalText": 945, - "width": 119.67, + "originalText": "-", + "width": 113.6, }, Object { - "actualText": "1304", + "actualText": "-", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 4, "height": 30, "multiLineActualTexts": Array [ - "1304", + "-", ], - "originalText": 1304, - "width": 119.67, + "originalText": "-", + "width": 113.6, }, Object { - "actualText": "2335", + "actualText": "-", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 4, "height": 30, "multiLineActualTexts": Array [ - "2335", + "-", ], - "originalText": 2335, - "width": 119.67, + "originalText": "-", + "width": 113.6, }, Object { - "actualText": "245", - "actualTextHeight": 15, - "actualTextWidth": 21, + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, "height": 30, - "multiLineActualTexts": Array [ - "245", - ], - "originalText": 245, - "width": 119.67, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 113.6, }, Object { - "actualText": "2457", + "actualText": "7789778977897...", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 97, "height": 30, "multiLineActualTexts": Array [ - "2457", + "7789778977897...", ], - "originalText": 2457, - "width": 119.67, + "originalText": "7789778977897789778977897789", + "width": 113.6, }, Object { - "actualText": "2458", - "actualTextHeight": 15, - "actualTextWidth": 27, + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, "height": 30, - "multiLineActualTexts": Array [ - "2458", - ], - "originalText": 2458, - "width": 119.67, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 113.6, }, Object { - "actualText": "1523", + "actualText": "-", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 4, "height": 30, "multiLineActualTexts": Array [ - "1523", + "-", ], - "originalText": 1523, - "width": 119.67, + "originalText": "-", + "width": 113.6, }, Object { - "actualText": "1634", + "actualText": "-", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 4, "height": 30, "multiLineActualTexts": Array [ - "1634", + "-", ], - "originalText": 1634, - "width": 119.67, + "originalText": "-", + "width": 113.6, }, Object { - "actualText": "1343", + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 113.6, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 113.6, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 30, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 113.6, + }, + Object { + "actualText": "1304", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "1343", + "1304", ], - "originalText": 1343, - "width": 119.67, + "originalText": 1304, + "width": 113.6, + }, + Object { + "actualText": "1145", + "actualTextHeight": 15, + "actualTextWidth": 26, + "height": 30, + "multiLineActualTexts": Array [ + "1145", + ], + "originalText": 1145, + "width": 113.6, + }, + Object { + "actualText": "1432", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1432", + ], + "originalText": 1432, + "width": 113.6, + }, + Object { + "actualText": "945", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "945", + ], + "originalText": 945, + "width": 113.6, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 30, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 113.6, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 113.6, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 30, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 113.6, + }, + Object { + "actualText": "2335", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2335", + ], + "originalText": 2335, + "width": 113.6, + }, + Object { + "actualText": "245", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "245", + ], + "originalText": 245, + "width": 113.6, + }, + Object { + "actualText": "2457", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2457", + ], + "originalText": 2457, + "width": 113.6, + }, + Object { + "actualText": "2458", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2458", + ], + "originalText": 2458, + "width": 113.6, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 30, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 113.6, }, Object { "actualText": "1354", @@ -2179,7 +2783,69 @@ Array [ "1354", ], "originalText": 1354, - "width": 119.67, + "width": 113.6, + }, + Object { + "actualText": "1523", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1523", + ], + "originalText": 1523, + "width": 113.6, + }, + Object { + "actualText": "1634", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1634", + ], + "originalText": 1634, + "width": 113.6, + }, + Object { + "actualText": "1343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1343", + ], + "originalText": 1343, + "width": 113.6, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 30, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 113.6, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 113.6, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 30, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 113.6, }, Object { "actualText": "4004", @@ -2190,7 +2856,7 @@ Array [ "4004", ], "originalText": 4004, - "width": 119.67, + "width": 113.6, }, Object { "actualText": "3077", @@ -2201,7 +2867,7 @@ Array [ "3077", ], "originalText": 3077, - "width": 119.67, + "width": 113.6, }, Object { "actualText": "3551", @@ -2212,7 +2878,7 @@ Array [ "3551", ], "originalText": 3551, - "width": 119.67, + "width": 113.6, }, Object { "actualText": "352", @@ -2223,18 +2889,18 @@ Array [ "352", ], "originalText": 352, - "width": 119.67, + "width": 113.6, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly row cell height priority if actual text not wrap 1`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should adjust corner cell max lines by custom col height 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 53, + "height": 20, "multiLineActualTexts": Array [ "序号", ], @@ -2242,61 +2908,63 @@ Array [ "width": 80, }, Object { - "actualText": "省份", + "actualText": "province", "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 53, + "actualTextWidth": 51, + "height": 20, "multiLineActualTexts": Array [ - "省份", + "province", ], - "originalText": "省份", + "originalText": "province", "width": 102.57, }, Object { - "actualText": "城市城市城市城市城市城市城市城市城市城市...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 53, + "actualText": "城市...", + "actualTextHeight": 16, + "actualTextWidth": 35, + "height": 20, "multiLineActualTexts": Array [ - "城市城市城市城", - "市城市城市城市", - "城市城市城市...", + "城市...", ], - "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "originalText": "城市 +城市", "width": 102.57, }, Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualText": "类别...", "actualTextHeight": 16, - "actualTextWidth": 241, - "height": 56, + "actualTextWidth": 35, + "height": 20, "multiLineActualTexts": Array [ - "类别类别类别类别类别类别类别类别类别类别", + "类别...", ], - "originalText": "类别类别类别类别类别类别类别类别类别类别", + "originalText": "类别 +类别", "width": 285.14, }, Object { - "actualText": "子类别", + "actualText": "子类别...", "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 56, + "actualTextWidth": 47, + "height": 20, "multiLineActualTexts": Array [ - "子类别", + "子类别...", ], - "originalText": "子类别", + "originalText": "子类别 +子类别 +子类别", "width": 285.14, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly row cell height priority if actual text not wrap 2`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should adjust corner cell max lines by custom col height 2`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 140, + "height": 120, "multiLineActualTexts": Array [ "1", ], @@ -2307,7 +2975,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "2", ], @@ -2318,7 +2986,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 190, + "height": 120, "multiLineActualTexts": Array [ "3", ], @@ -2328,13 +2996,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly row cell height priority if actual text not wrap 3`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should adjust corner cell max lines by custom col height 3`] = ` Array [ Object { "actualText": "家具", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 20, "multiLineActualTexts": Array [ "家具", ], @@ -2345,7 +3013,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 20, "multiLineActualTexts": Array [ "桌子", ], @@ -2353,23 +3021,24 @@ Array [ "width": 102.57, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 53, + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 20, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量...", + "数量...", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "originalText": "数量 +数量 +数量 +数量", "width": 102.57, }, Object { "actualText": "沙发", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 20, "multiLineActualTexts": Array [ "沙发", ], @@ -2377,62 +3046,60 @@ Array [ "width": 102.57, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 53, + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 20, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量...", + "数量...", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "originalText": "数量 +数量 +数量 +数量", "width": 102.57, }, Object { - "actualText": "家具家具家具家具家具家具家具家具家具家具...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 56, + "actualText": "家具家具家具...", + "actualTextHeight": 16, + "actualTextWidth": 83, + "height": 20, "multiLineActualTexts": Array [ - "家具家具家具家", - "具家具家具家具", "家具家具家具...", ], "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", "width": 102.57, }, Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 56, + "actualText": "桌子桌子桌子...", + "actualTextHeight": 16, + "actualTextWidth": 83, + "height": 20, "multiLineActualTexts": Array [ - "桌子桌子桌子桌", - "子桌子桌子桌子", "桌子桌子桌子...", ], "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", "width": 102.57, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 53, + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 20, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量...", + "数量...", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "originalText": "数量 +数量 +数量 +数量", "width": 102.57, }, Object { "actualText": "办公用品", "actualTextHeight": 16, "actualTextWidth": 49, - "height": 56, + "height": 20, "multiLineActualTexts": Array [ "办公用品", ], @@ -2443,7 +3110,7 @@ Array [ "actualText": "笔", "actualTextHeight": 16, "actualTextWidth": 13, - "height": 56, + "height": 20, "multiLineActualTexts": Array [ "笔", ], @@ -2451,23 +3118,24 @@ Array [ "width": 102.57, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 53, + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 20, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量...", + "数量...", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "originalText": "数量 +数量 +数量 +数量", "width": 102.57, }, Object { "actualText": "纸张", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 20, "multiLineActualTexts": Array [ "纸张", ], @@ -2475,28 +3143,29 @@ Array [ "width": 102.57, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 53, + "actualText": "数量...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 20, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量...", + "数量...", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "originalText": "数量 +数量 +数量 +数量", "width": 102.57, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly row cell height priority if actual text not wrap 4`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should adjust corner cell max lines by custom col height 4`] = ` Array [ Object { "actualText": "浙江省", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 140, + "height": 120, "multiLineActualTexts": Array [ "浙江省", ], @@ -2518,7 +3187,7 @@ Array [ "actualText": "宁波市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "宁波市", ], @@ -2529,7 +3198,7 @@ Array [ "actualText": "舟山市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 60, + "height": 30, "multiLineActualTexts": Array [ "舟山市", ], @@ -2548,27 +3217,23 @@ Array [ "width": 102.57, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 20, + "actualText": "浙江省浙江省...", + "actualTextHeight": 16, + "actualTextWidth": 83, + "height": 30, "multiLineActualTexts": Array [ - "浙江省浙江省浙", - "江省浙江省浙江", - "省浙江省浙江...", + "浙江省浙江省...", ], "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 102.57, }, Object { - "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 20, + "actualText": "杭州市杭州市...", + "actualTextHeight": 15, + "actualTextWidth": 83, + "height": 30, "multiLineActualTexts": Array [ - "杭州市杭州市杭", - "州市杭州市杭州", - "市杭州市杭州...", + "杭州市杭州市...", ], "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", "width": 102.57, @@ -2577,7 +3242,7 @@ Array [ "actualText": "四川省", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 190, + "height": 120, "multiLineActualTexts": Array [ "四川省", ], @@ -2588,7 +3253,7 @@ Array [ "actualText": "成都市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ "成都市", ], @@ -2631,16 +3296,15 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly row cell height priority if actual text not wrap 5`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should adjust corner cell max lines by custom col height 5`] = ` Array [ Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, + "actualText": "23672367236...", + "actualTextHeight": 15, + "actualTextWidth": 84, "height": 30, "multiLineActualTexts": Array [ - "236723672361", - "111", + "23672367236...", ], "originalText": 236723672361111, "width": 102.57, @@ -2649,7 +3313,7 @@ Array [ "actualText": "3877", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "3877", ], @@ -2660,7 +3324,7 @@ Array [ "actualText": "4342", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 60, + "height": 30, "multiLineActualTexts": Array [ "4342", ], @@ -2682,7 +3346,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "-", ], @@ -2693,7 +3357,7 @@ Array [ "actualText": "1723", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ "1723", ], @@ -2748,7 +3412,7 @@ Array [ "actualText": "7234", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "7234", ], @@ -2759,7 +3423,7 @@ Array [ "actualText": "834", "actualTextHeight": 15, "actualTextWidth": 21, - "height": 60, + "height": 30, "multiLineActualTexts": Array [ "834", ], @@ -2781,7 +3445,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "-", ], @@ -2792,7 +3456,7 @@ Array [ "actualText": "2451", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ "2451", ], @@ -2847,7 +3511,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "-", ], @@ -2858,7 +3522,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 60, + "height": 30, "multiLineActualTexts": Array [ "-", ], @@ -2877,14 +3541,12 @@ Array [ "width": 102.57, }, Object { - "actualText": "7789778977897789778977897789", - "actualTextHeight": 45, - "actualTextWidth": 189, - "height": 20, + "actualText": "77897789778...", + "actualTextHeight": 15, + "actualTextWidth": 84, + "height": 30, "multiLineActualTexts": Array [ - "778977897789", - "778977897789", - "7789", + "77897789778...", ], "originalText": "7789778977897789778977897789", "width": 102.57, @@ -2893,7 +3555,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ "-", ], @@ -2948,7 +3610,7 @@ Array [ "actualText": "1145", "actualTextHeight": 15, "actualTextWidth": 26, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "1145", ], @@ -2959,7 +3621,7 @@ Array [ "actualText": "1432", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 60, + "height": 30, "multiLineActualTexts": Array [ "1432", ], @@ -2981,7 +3643,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "-", ], @@ -2992,7 +3654,7 @@ Array [ "actualText": "2335", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ "2335", ], @@ -3047,7 +3709,7 @@ Array [ "actualText": "1523", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "1523", ], @@ -3058,7 +3720,7 @@ Array [ "actualText": "1634", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 60, + "height": 30, "multiLineActualTexts": Array [ "1634", ], @@ -3080,7 +3742,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "-", ], @@ -3091,7 +3753,7 @@ Array [ "actualText": "4004", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ "4004", ], @@ -3134,13 +3796,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by colCell.height 1`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should calc correctly row cell height if actual text lines is difference 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 20, + "height": 80, "multiLineActualTexts": Array [ "序号", ], @@ -3151,7 +3813,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 20, + "height": 80, "multiLineActualTexts": Array [ "省份", ], @@ -3159,13 +3821,15 @@ Array [ "width": 96, }, Object { - "actualText": "城市城市城市城市城市城...", - "actualTextHeight": 32, - "actualTextWidth": 144, - "height": 20, + "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "actualTextHeight": 64, + "actualTextWidth": 292, + "height": 80, "multiLineActualTexts": Array [ "城市城市城市", - "城市城市城...", + "城市城市城市", + "城市城市城市", + "城市城市城市", ], "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", "width": 96, @@ -3174,7 +3838,7 @@ Array [ "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 16, "actualTextWidth": 241, - "height": 20, + "height": 80, "multiLineActualTexts": Array [ "类别类别类别类别类别类别类别类别类别类别", ], @@ -3185,7 +3849,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 20, + "height": 80, "multiLineActualTexts": Array [ "子类别", ], @@ -3195,13 +3859,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by colCell.height 2`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should calc correctly row cell height if actual text lines is difference 2`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 120, + "height": 80, "multiLineActualTexts": Array [ "1", ], @@ -3212,7 +3876,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 40, + "height": 120, "multiLineActualTexts": Array [ "2", ], @@ -3223,23 +3887,71 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 120, + "height": 80, "multiLineActualTexts": Array [ "3", ], "originalText": "3", "width": 80, }, + Object { + "actualText": "4", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 120, + "multiLineActualTexts": Array [ + "4", + ], + "originalText": "4", + "width": 80, + }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by colCell.height 3`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should calc correctly row cell height if actual text lines is difference 3`] = ` Array [ + Object { + "actualText": "纸张纸张纸张纸张纸张", + "actualTextHeight": 32, + "actualTextWidth": 122, + "height": 80, + "multiLineActualTexts": Array [ + "纸张纸张纸张", + "纸张纸张", + ], + "originalText": "纸张纸张纸张纸张纸张", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 16, + "actualTextWidth": 4, + "height": 80, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 60, + "actualTextWidth": 268, + "height": 80, + "multiLineActualTexts": Array [ + "数量数量数量", + "数量数量数量", + "数量数量数量", + "数量数量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, + }, Object { "actualText": "家具", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 20, + "height": 80, "multiLineActualTexts": Array [ "家具", ], @@ -3250,7 +3962,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 20, + "height": 80, "multiLineActualTexts": Array [ "桌子", ], @@ -3258,13 +3970,15 @@ Array [ "width": 96, }, Object { - "actualText": "数量数量数量数量数量数...", - "actualTextHeight": 30, - "actualTextWidth": 144, - "height": 20, + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 60, + "actualTextWidth": 268, + "height": 80, "multiLineActualTexts": Array [ "数量数量数量", - "数量数量数...", + "数量数量数量", + "数量数量数量", + "数量数量", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 96, @@ -3273,7 +3987,7 @@ Array [ "actualText": "沙发", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 20, + "height": 80, "multiLineActualTexts": Array [ "沙发", ], @@ -3281,13 +3995,118 @@ Array [ "width": 96, }, Object { - "actualText": "数量数量数量数量数量数...", - "actualTextHeight": 30, - "actualTextWidth": 144, - "height": 20, + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 60, + "actualTextWidth": 268, + "height": 80, "multiLineActualTexts": Array [ "数量数量数量", - "数量数量数...", + "数量数量数量", + "数量数量数量", + "数量数量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, + }, + Object { + "actualText": "家具家具家具家具家具家具家具家具家具家具家具家...", + "actualTextHeight": 64, + "actualTextWidth": 290, + "height": 80, + "multiLineActualTexts": Array [ + "家具家具家具", + "家具家具家具", + "家具家具家具", + "家具家具家...", + ], + "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "width": 96, + }, + Object { + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌...", + "actualTextHeight": 64, + "actualTextWidth": 290, + "height": 80, + "multiLineActualTexts": Array [ + "桌子桌子桌子", + "桌子桌子桌子", + "桌子桌子桌子", + "桌子桌子桌...", + ], + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "width": 96, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 60, + "actualTextWidth": 268, + "height": 80, + "multiLineActualTexts": Array [ + "数量数量数量", + "数量数量数量", + "数量数量数量", + "数量数量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 16, + "actualTextWidth": 49, + "height": 80, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 192, + }, + Object { + "actualText": "笔", + "actualTextHeight": 16, + "actualTextWidth": 13, + "height": 80, + "multiLineActualTexts": Array [ + "笔", + ], + "originalText": "笔", + "width": 96, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 60, + "actualTextWidth": 268, + "height": 80, + "multiLineActualTexts": Array [ + "数量数量数量", + "数量数量数量", + "数量数量数量", + "数量数量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, + }, + Object { + "actualText": "纸张", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 80, + "multiLineActualTexts": Array [ + "纸张", + ], + "originalText": "纸张", + "width": 96, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 60, + "actualTextWidth": 268, + "height": 80, + "multiLineActualTexts": Array [ + "数量数量数量", + "数量数量数量", + "数量数量数量", + "数量数量", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 96, @@ -3295,8 +4114,34 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by colCell.height 4`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should calc correctly row cell height if actual text lines is difference 4`] = ` Array [ + Object { + "actualText": "浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙...", + "actualTextHeight": 64, + "actualTextWidth": 290, + "height": 80, + "multiLineActualTexts": Array [ + "浙江浙江浙江", + "浙江浙江浙江", + "浙江浙江浙江", + "浙江浙江浙...", + ], + "originalText": "浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江", + "width": 96, + }, + Object { + "actualText": "杭州杭州杭州杭州", + "actualTextHeight": 30, + "actualTextWidth": 98, + "height": 80, + "multiLineActualTexts": Array [ + "杭州杭州杭州", + "杭州", + ], + "originalText": "杭州杭州杭州杭州", + "width": 96, + }, Object { "actualText": "浙江省", "actualTextHeight": 16, @@ -3309,17 +4154,77 @@ Array [ "width": 96, }, Object { - "actualText": "浙江省浙江省浙江省浙江...", - "actualTextHeight": 32, - "actualTextWidth": 144, - "height": 40, + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 96, + }, + Object { + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "宁波市", + ], + "originalText": "宁波市", + "width": 96, + }, + Object { + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "舟山市", + ], + "originalText": "舟山市", + "width": 96, + }, + Object { + "actualText": "杭州市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "杭州市", + ], + "originalText": "杭州市", + "width": 96, + }, + Object { + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江...", + "actualTextHeight": 64, + "actualTextWidth": 290, + "height": 80, "multiLineActualTexts": Array [ + "浙江省浙江省", + "浙江省浙江省", "浙江省浙江省", "浙江省浙江...", ], "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 96, }, + Object { + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州...", + "actualTextHeight": 60, + "actualTextWidth": 290, + "height": 80, + "multiLineActualTexts": Array [ + "杭州市杭州市", + "杭州市杭州市", + "杭州市杭州市", + "杭州市杭州...", + ], + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "width": 96, + }, Object { "actualText": "四川省", "actualTextHeight": 16, @@ -3331,11 +4236,154 @@ Array [ "originalText": "四川省", "width": 96, }, + Object { + "actualText": "成都市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "成都市", + ], + "originalText": "成都市", + "width": 96, + }, + Object { + "actualText": "绵阳市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绵阳市", + ], + "originalText": "绵阳市", + "width": 96, + }, + Object { + "actualText": "南充市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "南充市", + ], + "originalText": "南充市", + "width": 96, + }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by colCell.height 5`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should calc correctly row cell height if actual text lines is difference 5`] = ` Array [ + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 80, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 80, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 80, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, Object { "actualText": "236723672361111", "actualTextHeight": 30, @@ -3385,7 +4433,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 40, + "height": 80, "multiLineActualTexts": Array [ "-", ], @@ -3426,14 +4474,14 @@ Array [ "width": 96, }, Object { - "actualText": "2330", + "actualText": "-", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualTextWidth": 4, + "height": 80, "multiLineActualTexts": Array [ - "2330", + "-", ], - "originalText": 2330, + "originalText": "-", "width": 96, }, Object { @@ -3484,7 +4532,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 40, + "height": 80, "multiLineActualTexts": Array [ "-", ], @@ -3525,271 +4573,166 @@ Array [ "width": 96, }, Object { - "actualText": "2445", + "actualText": "-", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualTextWidth": 4, + "height": 80, "multiLineActualTexts": Array [ - "2445", + "-", ], - "originalText": 2445, + "originalText": "-", "width": 96, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by colCell.height() 1`] = ` -Array [ Object { - "actualText": "序号", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 20, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "序号", + "-", ], - "originalText": "序号", - "width": 80, + "originalText": "-", + "width": 96, }, Object { - "actualText": "省份", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 20, - "multiLineActualTexts": Array [ - "省份", - ], - "originalText": "省份", - "width": 96, - }, - Object { - "actualText": "城市城市城市城市城市城...", - "actualTextHeight": 32, - "actualTextWidth": 144, - "height": 20, - "multiLineActualTexts": Array [ - "城市城市城市", - "城市城市城...", - ], - "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "width": 96, - }, - Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", - "actualTextHeight": 16, - "actualTextWidth": 241, - "height": 20, - "multiLineActualTexts": Array [ - "类别类别类别类别类别类别类别类别类别类别", - ], - "originalText": "类别类别类别类别类别类别类别类别类别类别", - "width": 272, - }, - Object { - "actualText": "子类别", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 20, - "multiLineActualTexts": Array [ - "子类别", - ], - "originalText": "子类别", - "width": 272, - }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by colCell.height() 2`] = ` -Array [ - Object { - "actualText": "1", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 120, - "multiLineActualTexts": Array [ - "1", - ], - "originalText": "1", - "width": 80, - }, - Object { - "actualText": "2", + "actualText": "-", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 40, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "2", + "-", ], - "originalText": "2", - "width": 80, + "originalText": "-", + "width": 96, }, Object { - "actualText": "3", + "actualText": "-", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 120, - "multiLineActualTexts": Array [ - "3", - ], - "originalText": "3", - "width": 80, - }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by colCell.height() 3`] = ` -Array [ - Object { - "actualText": "家具", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 20, - "multiLineActualTexts": Array [ - "家具", - ], - "originalText": "家具", - "width": 192, - }, - Object { - "actualText": "桌子", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 20, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "桌子", + "-", ], - "originalText": "桌子", + "originalText": "-", "width": 96, }, Object { - "actualText": "数量数量数量数量数量数...", - "actualTextHeight": 30, - "actualTextWidth": 144, - "height": 20, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量", - "数量数量数...", + "-", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "originalText": "-", "width": 96, }, Object { - "actualText": "沙发", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 20, + "actualText": "7789778977897789778977897789", + "actualTextHeight": 45, + "actualTextWidth": 189, + "height": 80, "multiLineActualTexts": Array [ - "沙发", + "77897789778", + "97789778977", + "897789", ], - "originalText": "沙发", + "originalText": "7789778977897789778977897789", "width": 96, }, Object { - "actualText": "数量数量数量数量数量数...", - "actualTextHeight": 30, - "actualTextWidth": 144, - "height": 20, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量", - "数量数量数...", + "-", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "originalText": "-", "width": 96, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by colCell.height() 4`] = ` -Array [ Object { - "actualText": "浙江省", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 120, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "-", ], - "originalText": "浙江省", + "originalText": "-", "width": 96, }, Object { - "actualText": "浙江省浙江省浙江省浙江...", - "actualTextHeight": 32, - "actualTextWidth": 144, - "height": 40, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "浙江省浙江省", - "浙江省浙江...", + "-", ], - "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "originalText": "-", "width": 96, }, Object { - "actualText": "四川省", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 120, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 80, "multiLineActualTexts": Array [ - "四川省", + "-", ], - "originalText": "四川省", + "originalText": "-", "width": 96, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by colCell.height() 5`] = ` -Array [ Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 99, + "actualText": "1304", + "actualTextHeight": 15, + "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "23672367236", - "1111", + "1304", ], - "originalText": 236723672361111, + "originalText": 1304, "width": 96, }, Object { - "actualText": "3877", + "actualText": "1145", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 26, "height": 30, "multiLineActualTexts": Array [ - "3877", + "1145", ], - "originalText": 3877, + "originalText": 1145, "width": 96, }, Object { - "actualText": "4342", + "actualText": "1432", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "4342", + "1432", ], - "originalText": 4342, + "originalText": 1432, "width": 96, }, Object { - "actualText": "-", + "actualText": "945", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 21, "height": 30, "multiLineActualTexts": Array [ - "-", + "945", ], - "originalText": "-", + "originalText": 945, "width": 96, }, Object { "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 40, + "height": 80, "multiLineActualTexts": Array [ "-", ], @@ -3797,98 +4740,98 @@ Array [ "width": 96, }, Object { - "actualText": "1723", + "actualText": "2335", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "1723", + "2335", ], - "originalText": 1723, + "originalText": 2335, "width": 96, }, Object { - "actualText": "1822", + "actualText": "245", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 21, "height": 30, "multiLineActualTexts": Array [ - "1822", + "245", ], - "originalText": 1822, + "originalText": 245, "width": 96, }, Object { - "actualText": "1943", + "actualText": "2457", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "1943", + "2457", ], - "originalText": 1943, + "originalText": 2457, "width": 96, }, Object { - "actualText": "2330", + "actualText": "-", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualTextWidth": 4, + "height": 80, "multiLineActualTexts": Array [ - "2330", + "-", ], - "originalText": 2330, + "originalText": "-", "width": 96, }, Object { - "actualText": "632", + "actualText": "1354", "actualTextHeight": 15, - "actualTextWidth": 21, + "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "632", + "1354", ], - "originalText": 632, + "originalText": 1354, "width": 96, }, Object { - "actualText": "7234", + "actualText": "1523", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "7234", + "1523", ], - "originalText": 7234, + "originalText": 1523, "width": 96, }, Object { - "actualText": "834", + "actualText": "1634", "actualTextHeight": 15, - "actualTextWidth": 21, + "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "834", + "1634", ], - "originalText": 834, + "originalText": 1634, "width": 96, }, Object { - "actualText": "5343", + "actualText": "1343", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "5343", + "1343", ], - "originalText": 5343, + "originalText": 1343, "width": 96, }, Object { "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 40, + "height": 80, "multiLineActualTexts": Array [ "-", ], @@ -3896,59 +4839,48 @@ Array [ "width": 96, }, Object { - "actualText": "2451", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, - "multiLineActualTexts": Array [ - "2451", - ], - "originalText": 2451, - "width": 96, - }, - Object { - "actualText": "2244", + "actualText": "4004", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "2244", + "4004", ], - "originalText": 2244, + "originalText": 4004, "width": 96, }, Object { - "actualText": "2333", + "actualText": "3077", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "2333", + "3077", ], - "originalText": 2333, + "originalText": 3077, "width": 96, }, Object { - "actualText": "2445", + "actualText": "3551", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "2445", + "3551", ], - "originalText": 2445, + "originalText": 3551, "width": 96, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by dataCell.height 1`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should default render one line text 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 38, + "height": 30, "multiLineActualTexts": Array [ "序号", ], @@ -3959,7 +4891,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 38, + "height": 30, "multiLineActualTexts": Array [ "省份", ], @@ -3967,12 +4899,11 @@ Array [ "width": 96, }, Object { - "actualText": "城市城市城市城市城市城...", - "actualTextHeight": 32, - "actualTextWidth": 144, - "height": 38, + "actualText": "城市城市城...", + "actualTextHeight": 16, + "actualTextWidth": 71, + "height": 30, "multiLineActualTexts": Array [ - "城市城市城市", "城市城市城...", ], "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", @@ -3982,7 +4913,7 @@ Array [ "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 16, "actualTextWidth": 241, - "height": 40, + "height": 30, "multiLineActualTexts": Array [ "类别类别类别类别类别类别类别类别类别类别", ], @@ -3993,7 +4924,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 40, + "height": 30, "multiLineActualTexts": Array [ "子类别", ], @@ -4003,13 +4934,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by dataCell.height 2`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should default render one line text 2`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 80, + "height": 120, "multiLineActualTexts": Array [ "1", ], @@ -4020,7 +4951,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "2", ], @@ -4031,7 +4962,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 80, + "height": 120, "multiLineActualTexts": Array [ "3", ], @@ -4041,13 +4972,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by dataCell.height 3`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should default render one line text 3`] = ` Array [ Object { "actualText": "家具", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 30, "multiLineActualTexts": Array [ "家具", ], @@ -4058,7 +4989,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 30, "multiLineActualTexts": Array [ "桌子", ], @@ -4066,12 +4997,11 @@ Array [ "width": 96, }, Object { - "actualText": "数量数量数量数量数量数...", - "actualTextHeight": 30, - "actualTextWidth": 144, - "height": 38, + "actualText": "数量数量数...", + "actualTextHeight": 15, + "actualTextWidth": 71, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量", "数量数量数...", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", @@ -4081,7 +5011,7 @@ Array [ "actualText": "沙发", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 30, "multiLineActualTexts": Array [ "沙发", ], @@ -4089,12 +5019,11 @@ Array [ "width": 96, }, Object { - "actualText": "数量数量数量数量数量数...", - "actualTextHeight": 30, - "actualTextWidth": 144, - "height": 38, + "actualText": "数量数量数...", + "actualTextHeight": 15, + "actualTextWidth": 71, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量", "数量数量数...", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", @@ -4103,13 +5032,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by dataCell.height 4`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should default render one line text 4`] = ` Array [ Object { "actualText": "浙江省", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 80, + "height": 120, "multiLineActualTexts": Array [ "浙江省", ], @@ -4117,12 +5046,11 @@ Array [ "width": 96, }, Object { - "actualText": "浙江省浙江省浙江省浙江...", - "actualTextHeight": 32, - "actualTextWidth": 144, - "height": 20, + "actualText": "浙江省浙江...", + "actualTextHeight": 16, + "actualTextWidth": 71, + "height": 30, "multiLineActualTexts": Array [ - "浙江省浙江省", "浙江省浙江...", ], "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", @@ -4132,7 +5060,7 @@ Array [ "actualText": "四川省", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 80, + "height": 120, "multiLineActualTexts": Array [ "四川省", ], @@ -4142,16 +5070,15 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by dataCell.height 5`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should default render one line text 5`] = ` Array [ Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 99, - "height": 20, + "actualText": "2367236723...", + "actualTextHeight": 15, + "actualTextWidth": 77, + "height": 30, "multiLineActualTexts": Array [ - "23672367236", - "1111", + "2367236723...", ], "originalText": 236723672361111, "width": 96, @@ -4160,7 +5087,7 @@ Array [ "actualText": "3877", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "3877", ], @@ -4171,7 +5098,7 @@ Array [ "actualText": "4342", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "4342", ], @@ -4182,7 +5109,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "-", ], @@ -4193,7 +5120,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "-", ], @@ -4204,7 +5131,7 @@ Array [ "actualText": "1723", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "1723", ], @@ -4215,7 +5142,7 @@ Array [ "actualText": "1822", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "1822", ], @@ -4226,7 +5153,7 @@ Array [ "actualText": "1943", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "1943", ], @@ -4237,7 +5164,7 @@ Array [ "actualText": "2330", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "2330", ], @@ -4248,7 +5175,7 @@ Array [ "actualText": "632", "actualTextHeight": 15, "actualTextWidth": 21, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "632", ], @@ -4259,7 +5186,7 @@ Array [ "actualText": "7234", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "7234", ], @@ -4270,7 +5197,7 @@ Array [ "actualText": "834", "actualTextHeight": 15, "actualTextWidth": 21, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "834", ], @@ -4281,7 +5208,7 @@ Array [ "actualText": "5343", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "5343", ], @@ -4292,7 +5219,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "-", ], @@ -4303,7 +5230,7 @@ Array [ "actualText": "2451", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "2451", ], @@ -4314,7 +5241,7 @@ Array [ "actualText": "2244", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "2244", ], @@ -4325,7 +5252,7 @@ Array [ "actualText": "2333", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "2333", ], @@ -4336,7 +5263,7 @@ Array [ "actualText": "2445", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "2445", ], @@ -4346,13 +5273,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by rowCell.height 1`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly col cell height priority if actual text not wrap 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "序号", ], @@ -4360,60 +5287,59 @@ Array [ "width": 80, }, Object { - "actualText": "省份", + "actualText": "province", "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 38, + "actualTextWidth": 51, + "height": 20, "multiLineActualTexts": Array [ - "省份", + "province", ], - "originalText": "省份", - "width": 96, + "originalText": "province", + "width": 119.66, }, Object { - "actualText": "城市城市城市城市城市城...", - "actualTextHeight": 32, - "actualTextWidth": 144, - "height": 38, + "actualText": "city", + "actualTextHeight": 16, + "actualTextWidth": 21, + "height": 20, "multiLineActualTexts": Array [ - "城市城市城市", - "城市城市城...", + "city", ], - "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "width": 96, + "originalText": "city", + "width": 119.66, }, Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualText": "type", "actualTextHeight": 16, - "actualTextWidth": 241, - "height": 40, + "actualTextWidth": 25, + "height": 20, "multiLineActualTexts": Array [ - "类别类别类别类别类别类别类别类别类别类别", + "type", ], - "originalText": "类别类别类别类别类别类别类别类别类别类别", - "width": 272, + "originalText": "type", + "width": 319.32, }, Object { - "actualText": "子类别", + "actualText": "sub_type", "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 40, + "actualTextWidth": 53, + "height": 20, "multiLineActualTexts": Array [ - "子类别", + "sub_type", ], - "originalText": "子类别", - "width": 272, + "originalText": "sub_type", + "width": 319.32, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by rowCell.height 2`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly col cell height priority if actual text not wrap 2`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 80, + "height": 120, "multiLineActualTexts": Array [ "1", ], @@ -4424,339 +5350,610 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 120, "multiLineActualTexts": Array [ "2", ], "originalText": "2", "width": 80, }, - Object { - "actualText": "3", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 80, - "multiLineActualTexts": Array [ - "3", - ], - "originalText": "3", - "width": 80, - }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by rowCell.height 3`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly col cell height priority if actual text not wrap 3`] = ` Array [ Object { "actualText": "家具", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "家具", ], "originalText": "家具", - "width": 192, + "width": 239.34, }, Object { "actualText": "桌子", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "桌子", ], "originalText": "桌子", - "width": 96, + "width": 119.67, }, Object { - "actualText": "数量数量数量数量数量数...", - "actualTextHeight": 30, - "actualTextWidth": 144, - "height": 38, + "actualText": "number", + "actualTextHeight": 15, + "actualTextWidth": 41, + "height": 20, "multiLineActualTexts": Array [ - "数量数量数量", - "数量数量数...", + "number", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 96, + "originalText": "number", + "width": 119.67, }, Object { "actualText": "沙发", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "沙发", ], "originalText": "沙发", - "width": 96, + "width": 119.67, }, Object { - "actualText": "数量数量数量数量数量数...", - "actualTextHeight": 30, - "actualTextWidth": 144, - "height": 38, + "actualText": "number", + "actualTextHeight": 15, + "actualTextWidth": 41, + "height": 20, "multiLineActualTexts": Array [ - "数量数量数量", - "数量数量数...", + "number", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 96, + "originalText": "number", + "width": 119.67, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 16, + "actualTextWidth": 49, + "height": 20, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 239.34, + }, + Object { + "actualText": "笔", + "actualTextHeight": 16, + "actualTextWidth": 13, + "height": 20, + "multiLineActualTexts": Array [ + "笔", + ], + "originalText": "笔", + "width": 119.67, + }, + Object { + "actualText": "number", + "actualTextHeight": 15, + "actualTextWidth": 41, + "height": 20, + "multiLineActualTexts": Array [ + "number", + ], + "originalText": "number", + "width": 119.67, + }, + Object { + "actualText": "纸张", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 20, + "multiLineActualTexts": Array [ + "纸张", + ], + "originalText": "纸张", + "width": 119.67, + }, + Object { + "actualText": "number", + "actualTextHeight": 15, + "actualTextWidth": 41, + "height": 20, + "multiLineActualTexts": Array [ + "number", + ], + "originalText": "number", + "width": 119.67, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by rowCell.height 4`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly col cell height priority if actual text not wrap 4`] = ` Array [ Object { "actualText": "浙江省", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 80, + "height": 120, "multiLineActualTexts": Array [ "浙江省", ], "originalText": "浙江省", - "width": 96, + "width": 119.66, }, Object { - "actualText": "浙江省浙江省浙江省浙江...", - "actualTextHeight": 32, - "actualTextWidth": 144, - "height": 20, + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "浙江省浙江省", - "浙江省浙江...", + "宁波市", ], - "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", - "width": 96, + "originalText": "宁波市", + "width": 119.66, + }, + Object { + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "舟山市", + ], + "originalText": "舟山市", + "width": 119.66, + }, + Object { + "actualText": "杭州市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "杭州市", + ], + "originalText": "杭州市", + "width": 119.66, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 119.66, }, Object { "actualText": "四川省", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 80, + "height": 120, "multiLineActualTexts": Array [ "四川省", ], "originalText": "四川省", - "width": 96, + "width": 119.66, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by rowCell.height 5`] = ` -Array [ Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 99, - "height": 20, + "actualText": "成都市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "23672367236", - "1111", + "成都市", ], - "originalText": 236723672361111, - "width": 96, + "originalText": "成都市", + "width": 119.66, + }, + Object { + "actualText": "绵阳市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绵阳市", + ], + "originalText": "绵阳市", + "width": 119.66, + }, + Object { + "actualText": "南充市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "南充市", + ], + "originalText": "南充市", + "width": 119.66, + }, + Object { + "actualText": "乐山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "乐山市", + ], + "originalText": "乐山市", + "width": 119.66, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly col cell height priority if actual text not wrap 5`] = ` +Array [ Object { "actualText": "3877", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "3877", ], "originalText": 3877, - "width": 96, + "width": 119.67, }, Object { "actualText": "4342", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "4342", ], "originalText": 4342, - "width": 96, + "width": 119.67, }, Object { "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "-", ], "originalText": "-", - "width": 96, + "width": 119.67, }, Object { "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "-", ], "originalText": "-", - "width": 96, + "width": 119.67, }, Object { "actualText": "1723", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "1723", ], "originalText": 1723, - "width": 96, + "width": 119.67, }, Object { "actualText": "1822", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "1822", ], "originalText": 1822, - "width": 96, + "width": 119.67, }, Object { "actualText": "1943", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "1943", ], "originalText": 1943, - "width": 96, + "width": 119.67, }, Object { "actualText": "2330", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "2330", ], "originalText": 2330, - "width": 96, - }, - Object { - "actualText": "632", - "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 20, - "multiLineActualTexts": Array [ - "632", - ], - "originalText": 632, - "width": 96, + "width": 119.67, }, Object { "actualText": "7234", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "7234", ], "originalText": 7234, - "width": 96, + "width": 119.67, }, Object { "actualText": "834", "actualTextHeight": 15, "actualTextWidth": 21, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "834", ], "originalText": 834, - "width": 96, + "width": 119.67, }, Object { "actualText": "5343", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "5343", ], "originalText": 5343, - "width": 96, + "width": 119.67, }, Object { - "actualText": "-", + "actualText": "632", "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 20, + "actualTextWidth": 21, + "height": 30, "multiLineActualTexts": Array [ - "-", + "632", ], - "originalText": "-", - "width": 96, + "originalText": 632, + "width": 119.67, }, Object { "actualText": "2451", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "2451", ], "originalText": 2451, - "width": 96, + "width": 119.67, }, Object { "actualText": "2244", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "2244", ], "originalText": 2244, - "width": 96, + "width": 119.67, }, Object { "actualText": "2333", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "2333", ], "originalText": 2333, - "width": 96, + "width": 119.67, }, Object { "actualText": "2445", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "2445", ], "originalText": 2445, - "width": 96, + "width": 119.67, + }, + Object { + "actualText": "1145", + "actualTextHeight": 15, + "actualTextWidth": 26, + "height": 30, + "multiLineActualTexts": Array [ + "1145", + ], + "originalText": 1145, + "width": 119.67, + }, + Object { + "actualText": "1432", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1432", + ], + "originalText": 1432, + "width": 119.67, + }, + Object { + "actualText": "945", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "945", + ], + "originalText": 945, + "width": 119.67, + }, + Object { + "actualText": "1304", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1304", + ], + "originalText": 1304, + "width": 119.67, + }, + Object { + "actualText": "2335", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2335", + ], + "originalText": 2335, + "width": 119.67, + }, + Object { + "actualText": "245", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "245", + ], + "originalText": 245, + "width": 119.67, + }, + Object { + "actualText": "2457", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2457", + ], + "originalText": 2457, + "width": 119.67, + }, + Object { + "actualText": "2458", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2458", + ], + "originalText": 2458, + "width": 119.67, + }, + Object { + "actualText": "1523", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1523", + ], + "originalText": 1523, + "width": 119.67, + }, + Object { + "actualText": "1634", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1634", + ], + "originalText": 1634, + "width": 119.67, + }, + Object { + "actualText": "1343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1343", + ], + "originalText": 1343, + "width": 119.67, + }, + Object { + "actualText": "1354", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1354", + ], + "originalText": 1354, + "width": 119.67, + }, + Object { + "actualText": "4004", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "4004", + ], + "originalText": 4004, + "width": 119.67, + }, + Object { + "actualText": "3077", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "3077", + ], + "originalText": 3077, + "width": 119.67, + }, + Object { + "actualText": "3551", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "3551", + ], + "originalText": 3551, + "width": 119.67, + }, + Object { + "actualText": "352", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "352", + ], + "originalText": 352, + "width": 119.67, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by rowCell.height() 1`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly row cell height priority if actual text not wrap 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 38, + "height": 64, "multiLineActualTexts": Array [ "序号", ], @@ -4767,57 +5964,58 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 38, + "height": 64, "multiLineActualTexts": Array [ "省份", ], "originalText": "省份", - "width": 96, + "width": 102.57, }, Object { - "actualText": "城市城市城市城市城市城...", - "actualTextHeight": 32, - "actualTextWidth": 144, - "height": 38, + "actualText": "城市城市城市城市城市城市城市城市城市城市...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 64, "multiLineActualTexts": Array [ - "城市城市城市", - "城市城市城...", + "城市城市城市城", + "市城市城市城市", + "城市城市城市...", ], "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "width": 96, + "width": 102.57, }, Object { "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 16, "actualTextWidth": 241, - "height": 40, + "height": 64, "multiLineActualTexts": Array [ "类别类别类别类别类别类别类别类别类别类别", ], "originalText": "类别类别类别类别类别类别类别类别类别类别", - "width": 272, + "width": 285.14, }, Object { "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 40, + "height": 64, "multiLineActualTexts": Array [ "子类别", ], "originalText": "子类别", - "width": 272, + "width": 285.14, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by rowCell.height() 2`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly row cell height priority if actual text not wrap 2`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 80, + "height": 140, "multiLineActualTexts": Array [ "1", ], @@ -4839,7 +6037,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 80, + "height": 190, "multiLineActualTexts": Array [ "3", ], @@ -4849,120 +6047,320 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by rowCell.height() 3`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly row cell height priority if actual text not wrap 3`] = ` Array [ Object { "actualText": "家具", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 64, "multiLineActualTexts": Array [ "家具", ], "originalText": "家具", - "width": 192, + "width": 205.14, }, Object { "actualText": "桌子", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 64, "multiLineActualTexts": Array [ "桌子", ], "originalText": "桌子", - "width": 96, + "width": 102.57, }, Object { - "actualText": "数量数量数量数量数量数...", - "actualTextHeight": 30, - "actualTextWidth": 144, - "height": 38, + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 64, "multiLineActualTexts": Array [ - "数量数量数量", - "数量数量数...", + "数量数量数量数", + "量数量数量数量", + "数量数量数量...", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 96, + "width": 102.57, }, Object { "actualText": "沙发", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 64, "multiLineActualTexts": Array [ "沙发", ], "originalText": "沙发", - "width": 96, + "width": 102.57, }, Object { - "actualText": "数量数量数量数量数量数...", - "actualTextHeight": 30, - "actualTextWidth": 144, - "height": 38, + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 64, "multiLineActualTexts": Array [ - "数量数量数量", - "数量数量数...", - ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 96, + "数量数量数量数", + "量数量数量数量", + "数量数量数量...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 102.57, + }, + Object { + "actualText": "家具家具家具家具家具家具家具家具家具家具...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 64, + "multiLineActualTexts": Array [ + "家具家具家具家", + "具家具家具家具", + "家具家具家具...", + ], + "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "width": 102.57, + }, + Object { + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 64, + "multiLineActualTexts": Array [ + "桌子桌子桌子桌", + "子桌子桌子桌子", + "桌子桌子桌子...", + ], + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "width": 102.57, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 64, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 102.57, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 16, + "actualTextWidth": 49, + "height": 64, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 205.14, + }, + Object { + "actualText": "笔", + "actualTextHeight": 16, + "actualTextWidth": 13, + "height": 64, + "multiLineActualTexts": Array [ + "笔", + ], + "originalText": "笔", + "width": 102.57, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 64, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 102.57, + }, + Object { + "actualText": "纸张", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, + "multiLineActualTexts": Array [ + "纸张", + ], + "originalText": "纸张", + "width": 102.57, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 64, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 102.57, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by rowCell.height() 4`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly row cell height priority if actual text not wrap 4`] = ` Array [ Object { "actualText": "浙江省", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 80, + "height": 140, "multiLineActualTexts": Array [ "浙江省", ], "originalText": "浙江省", - "width": 96, + "width": 102.57, }, Object { - "actualText": "浙江省浙江省浙江省浙江...", - "actualTextHeight": 32, - "actualTextWidth": 144, + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 102.57, + }, + Object { + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, "height": 20, "multiLineActualTexts": Array [ - "浙江省浙江省", - "浙江省浙江...", + "宁波市", + ], + "originalText": "宁波市", + "width": 102.57, + }, + Object { + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 60, + "multiLineActualTexts": Array [ + "舟山市", + ], + "originalText": "舟山市", + "width": 102.57, + }, + Object { + "actualText": "杭州市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "杭州市", + ], + "originalText": "杭州市", + "width": 102.57, + }, + Object { + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 20, + "multiLineActualTexts": Array [ + "浙江省浙江省浙", + "江省浙江省浙江", + "省浙江省浙江...", ], "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", - "width": 96, + "width": 102.57, + }, + Object { + "actualText": "杭州市杭州市...", + "actualTextHeight": 15, + "actualTextWidth": 83, + "height": 20, + "multiLineActualTexts": Array [ + "杭州市杭州市...", + ], + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "width": 102.57, }, Object { "actualText": "四川省", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 80, + "height": 190, "multiLineActualTexts": Array [ "四川省", ], "originalText": "四川省", - "width": 96, + "width": 102.57, + }, + Object { + "actualText": "成都市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 100, + "multiLineActualTexts": Array [ + "成都市", + ], + "originalText": "成都市", + "width": 102.57, + }, + Object { + "actualText": "绵阳市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绵阳市", + ], + "originalText": "绵阳市", + "width": 102.57, + }, + Object { + "actualText": "南充市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "南充市", + ], + "originalText": "南充市", + "width": 102.57, + }, + Object { + "actualText": "乐山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "乐山市", + ], + "originalText": "乐山市", + "width": 102.57, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by rowCell.height() 5`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should get correctly row cell height priority if actual text not wrap 5`] = ` Array [ Object { "actualText": "236723672361111", "actualTextHeight": 30, - "actualTextWidth": 99, - "height": 20, + "actualTextWidth": 100, + "height": 30, "multiLineActualTexts": Array [ - "23672367236", - "1111", + "236723672361", + "111", ], "originalText": 236723672361111, - "width": 96, + "width": 102.57, }, Object { "actualText": "3877", @@ -4973,29 +6371,29 @@ Array [ "3877", ], "originalText": 3877, - "width": 96, + "width": 102.57, }, Object { "actualText": "4342", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 60, "multiLineActualTexts": Array [ "4342", ], "originalText": 4342, - "width": 96, + "width": 102.57, }, Object { "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "-", ], "originalText": "-", - "width": 96, + "width": 102.57, }, Object { "actualText": "-", @@ -5006,62 +6404,62 @@ Array [ "-", ], "originalText": "-", - "width": 96, + "width": 102.57, }, Object { "actualText": "1723", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 100, "multiLineActualTexts": Array [ "1723", ], "originalText": 1723, - "width": 96, + "width": 102.57, }, Object { "actualText": "1822", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "1822", ], "originalText": 1822, - "width": 96, + "width": 102.57, }, Object { "actualText": "1943", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "1943", ], "originalText": 1943, - "width": 96, + "width": 102.57, }, Object { "actualText": "2330", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "2330", ], "originalText": 2330, - "width": 96, + "width": 102.57, }, Object { "actualText": "632", "actualTextHeight": 15, "actualTextWidth": 21, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "632", ], "originalText": 632, - "width": 96, + "width": 102.57, }, Object { "actualText": "7234", @@ -5072,29 +6470,29 @@ Array [ "7234", ], "originalText": 7234, - "width": 96, + "width": 102.57, }, Object { "actualText": "834", "actualTextHeight": 15, "actualTextWidth": 21, - "height": 20, + "height": 60, "multiLineActualTexts": Array [ "834", ], "originalText": 834, - "width": 96, + "width": 102.57, }, Object { "actualText": "5343", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "5343", ], "originalText": 5343, - "width": 96, + "width": 102.57, }, Object { "actualText": "-", @@ -5105,253 +6503,383 @@ Array [ "-", ], "originalText": "-", - "width": 96, + "width": 102.57, }, Object { "actualText": "2451", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 100, "multiLineActualTexts": Array [ "2451", ], "originalText": 2451, - "width": 96, + "width": 102.57, }, Object { "actualText": "2244", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "2244", ], "originalText": 2244, - "width": 96, + "width": 102.57, }, Object { "actualText": "2333", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "2333", ], "originalText": 2333, - "width": 96, + "width": 102.57, }, Object { "actualText": "2445", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "2445", ], "originalText": 2445, - "width": 96, + "width": 102.57, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height 1`] = ` -Array [ Object { - "actualText": "序号", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 70, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "序号", + "-", ], - "originalText": "序号", - "width": 80, + "originalText": "-", + "width": 102.57, }, Object { - "actualText": "省份", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 70, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 20, "multiLineActualTexts": Array [ - "省份", + "-", ], - "originalText": "省份", - "width": 96, + "originalText": "-", + "width": 102.57, }, Object { - "actualText": "城市城市城市城市城市城...", - "actualTextHeight": 32, - "actualTextWidth": 144, - "height": 70, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 60, "multiLineActualTexts": Array [ - "城市城市城市", - "城市城市城...", + "-", ], - "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "width": 96, + "originalText": "-", + "width": 102.57, }, Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", - "actualTextHeight": 16, - "actualTextWidth": 241, - "height": 70, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "类别类别类别类别类别类别类别类别类别类别", + "-", ], - "originalText": "类别类别类别类别类别类别类别类别类别类别", - "width": 272, + "originalText": "-", + "width": 102.57, }, Object { - "actualText": "子类别", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 70, + "actualText": "77897789778...", + "actualTextHeight": 15, + "actualTextWidth": 84, + "height": 20, "multiLineActualTexts": Array [ - "子类别", + "77897789778...", ], - "originalText": "子类别", - "width": 272, + "originalText": "7789778977897789778977897789", + "width": 102.57, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height 2`] = ` -Array [ Object { - "actualText": "数量数量数量数量数量数...", - "actualTextHeight": 30, - "actualTextWidth": 144, - "height": 70, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 100, "multiLineActualTexts": Array [ - "数量数量数量", - "数量数量数...", + "-", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 96, + "originalText": "-", + "width": 102.57, }, Object { - "actualText": "数量数量数量数量数量数...", - "actualTextHeight": 30, - "actualTextWidth": 144, - "height": 70, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量", - "数量数量数...", + "-", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 96, + "originalText": "-", + "width": 102.57, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height 3`] = `Array []`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height 4`] = ` -Array [ Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 99, - "height": 70, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "23672367236", - "1111", + "-", ], - "originalText": 236723672361111, - "width": 96, + "originalText": "-", + "width": 102.57, }, Object { - "actualText": "3877", + "actualText": "-", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 70, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "3877", + "-", ], - "originalText": 3877, - "width": 96, + "originalText": "-", + "width": 102.57, }, Object { - "actualText": "4342", + "actualText": "1304", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 70, + "height": 30, "multiLineActualTexts": Array [ - "4342", + "1304", ], - "originalText": 4342, - "width": 96, + "originalText": 1304, + "width": 102.57, }, Object { - "actualText": "632", + "actualText": "1145", "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 70, + "actualTextWidth": 26, + "height": 20, "multiLineActualTexts": Array [ - "632", + "1145", ], - "originalText": 632, - "width": 96, + "originalText": 1145, + "width": 102.57, }, Object { - "actualText": "7234", + "actualText": "1432", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 70, + "height": 60, "multiLineActualTexts": Array [ - "7234", + "1432", ], - "originalText": 7234, - "width": 96, + "originalText": 1432, + "width": 102.57, }, Object { - "actualText": "834", + "actualText": "945", "actualTextHeight": 15, "actualTextWidth": 21, - "height": 70, + "height": 30, "multiLineActualTexts": Array [ - "834", + "945", ], - "originalText": 834, - "width": 96, + "originalText": 945, + "width": 102.57, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height by colCell.heightByField 1`] = ` -Array [ Object { - "actualText": "序号", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 120, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 20, "multiLineActualTexts": Array [ - "序号", + "-", ], - "originalText": "序号", - "width": 80, + "originalText": "-", + "width": 102.57, }, Object { - "actualText": "省份", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 120, + "actualText": "2335", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 100, "multiLineActualTexts": Array [ - "省份", + "2335", ], - "originalText": "省份", - "width": 96, + "originalText": 2335, + "width": 102.57, }, Object { - "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "actualTextHeight": 64, - "actualTextWidth": 292, - "height": 120, + "actualText": "245", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, "multiLineActualTexts": Array [ - "城市城市城市", - "城市城市城市", - "城市城市城市", - "城市城市城市", + "245", + ], + "originalText": 245, + "width": 102.57, + }, + Object { + "actualText": "2457", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2457", + ], + "originalText": 2457, + "width": 102.57, + }, + Object { + "actualText": "2458", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2458", + ], + "originalText": 2458, + "width": 102.57, + }, + Object { + "actualText": "1354", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1354", + ], + "originalText": 1354, + "width": 102.57, + }, + Object { + "actualText": "1523", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 20, + "multiLineActualTexts": Array [ + "1523", + ], + "originalText": 1523, + "width": 102.57, + }, + Object { + "actualText": "1634", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 60, + "multiLineActualTexts": Array [ + "1634", + ], + "originalText": 1634, + "width": 102.57, + }, + Object { + "actualText": "1343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1343", + ], + "originalText": 1343, + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 20, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "4004", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 100, + "multiLineActualTexts": Array [ + "4004", + ], + "originalText": 4004, + "width": 102.57, + }, + Object { + "actualText": "3077", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "3077", + ], + "originalText": 3077, + "width": 102.57, + }, + Object { + "actualText": "3551", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "3551", + ], + "originalText": 3551, + "width": 102.57, + }, + Object { + "actualText": "352", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "352", + ], + "originalText": 352, + "width": 102.57, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by colCell.height 1`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 20, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 20, + "multiLineActualTexts": Array [ + "省份", + ], + "originalText": "省份", + "width": 96, + }, + Object { + "actualText": "城市城市城...", + "actualTextHeight": 16, + "actualTextWidth": 71, + "height": 20, + "multiLineActualTexts": Array [ + "城市城市城...", ], "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", "width": 96, @@ -5360,7 +6888,7 @@ Array [ "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 16, "actualTextWidth": 241, - "height": 50, + "height": 20, "multiLineActualTexts": Array [ "类别类别类别类别类别类别类别类别类别类别", ], @@ -5371,7 +6899,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "子类别", ], @@ -5381,7 +6909,7 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height by colCell.heightByField 2`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by colCell.height 2`] = ` Array [ Object { "actualText": "1", @@ -5398,23 +6926,34 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 72, + "height": 48, "multiLineActualTexts": Array [ "2", ], "originalText": "2", "width": 80, }, + Object { + "actualText": "3", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 120, + "multiLineActualTexts": Array [ + "3", + ], + "originalText": "3", + "width": 80, + }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height by colCell.heightByField 3`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by colCell.height 3`] = ` Array [ Object { "actualText": "家具", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 50, + "height": 20, "multiLineActualTexts": Array [ "家具", ], @@ -5425,7 +6964,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "桌子", ], @@ -5433,15 +6972,12 @@ Array [ "width": 96, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量数量", - "actualTextHeight": 60, - "actualTextWidth": 268, - "height": 120, + "actualText": "数量数量数...", + "actualTextHeight": 15, + "actualTextWidth": 71, + "height": 20, "multiLineActualTexts": Array [ - "数量数量数量", - "数量数量数量", - "数量数量数量", - "数量数量", + "数量数量数...", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 96, @@ -5450,7 +6986,7 @@ Array [ "actualText": "沙发", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "沙发", ], @@ -5458,15 +6994,12 @@ Array [ "width": 96, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量数量", - "actualTextHeight": 60, - "actualTextWidth": 268, - "height": 120, + "actualText": "数量数量数...", + "actualTextHeight": 15, + "actualTextWidth": 71, + "height": 20, "multiLineActualTexts": Array [ - "数量数量数量", - "数量数量数量", - "数量数量数量", - "数量数量", + "数量数量数...", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 96, @@ -5474,7 +7007,7 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height by colCell.heightByField 4`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by colCell.height 4`] = ` Array [ Object { "actualText": "浙江省", @@ -5488,23 +7021,32 @@ Array [ "width": 96, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江...", - "actualTextHeight": 64, - "actualTextWidth": 290, - "height": 72, + "actualText": "浙江省浙江省浙江省浙江...", + "actualTextHeight": 32, + "actualTextWidth": 144, + "height": 48, "multiLineActualTexts": Array [ - "浙江省浙江省", - "浙江省浙江省", "浙江省浙江省", "浙江省浙江...", ], "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 96, }, + Object { + "actualText": "四川省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 120, + "multiLineActualTexts": Array [ + "四川省", + ], + "originalText": "四川省", + "width": 96, + }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height by colCell.heightByField 5`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by colCell.height 5`] = ` Array [ Object { "actualText": "236723672361111", @@ -5555,13 +7097,57 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 72, + "height": 48, "multiLineActualTexts": Array [ "-", ], "originalText": "-", "width": 96, }, + Object { + "actualText": "1723", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1723", + ], + "originalText": 1723, + "width": 96, + }, + Object { + "actualText": "1822", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1822", + ], + "originalText": 1822, + "width": 96, + }, + Object { + "actualText": "1943", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1943", + ], + "originalText": 1943, + "width": 96, + }, + Object { + "actualText": "2330", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2330", + ], + "originalText": 2330, + "width": 96, + }, Object { "actualText": "632", "actualTextHeight": 15, @@ -5610,23 +7196,67 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 72, + "height": 48, "multiLineActualTexts": Array [ "-", ], "originalText": "-", "width": 96, }, + Object { + "actualText": "2451", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2451", + ], + "originalText": 2451, + "width": 96, + }, + Object { + "actualText": "2244", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2244", + ], + "originalText": 2244, + "width": 96, + }, + Object { + "actualText": "2333", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2333", + ], + "originalText": 2333, + "width": 96, + }, + Object { + "actualText": "2445", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2445", + ], + "originalText": 2445, + "width": 96, + }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height by rowCell.heightByField 1`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by colCell.height() 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "序号", ], @@ -5637,7 +7267,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 38, + "height": 20, "multiLineActualTexts": Array [ "省份", ], @@ -5645,12 +7275,11 @@ Array [ "width": 96, }, Object { - "actualText": "城市城市城市城市城市城...", - "actualTextHeight": 32, - "actualTextWidth": 144, - "height": 38, + "actualText": "城市城市城...", + "actualTextHeight": 16, + "actualTextWidth": 71, + "height": 20, "multiLineActualTexts": Array [ - "城市城市城市", "城市城市城...", ], "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", @@ -5660,7 +7289,7 @@ Array [ "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 16, "actualTextWidth": 241, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "类别类别类别类别类别类别类别类别类别类别", ], @@ -5671,7 +7300,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "子类别", ], @@ -5681,13 +7310,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height by rowCell.heightByField 2`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by colCell.height() 2`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 140, + "height": 120, "multiLineActualTexts": Array [ "1", ], @@ -5698,7 +7327,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 35, + "height": 48, "multiLineActualTexts": Array [ "2", ], @@ -5709,7 +7338,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 155, + "height": 120, "multiLineActualTexts": Array [ "3", ], @@ -5719,13 +7348,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height by rowCell.heightByField 3`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by colCell.height() 3`] = ` Array [ Object { "actualText": "家具", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "家具", ], @@ -5736,7 +7365,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "桌子", ], @@ -5744,12 +7373,11 @@ Array [ "width": 96, }, Object { - "actualText": "数量数量数量数量数量数...", - "actualTextHeight": 30, - "actualTextWidth": 144, - "height": 38, + "actualText": "数量数量数...", + "actualTextHeight": 15, + "actualTextWidth": 71, + "height": 20, "multiLineActualTexts": Array [ - "数量数量数量", "数量数量数...", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", @@ -5759,7 +7387,7 @@ Array [ "actualText": "沙发", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ "沙发", ], @@ -5767,12 +7395,11 @@ Array [ "width": 96, }, Object { - "actualText": "数量数量数量数量数量数...", - "actualTextHeight": 30, - "actualTextWidth": 144, - "height": 38, + "actualText": "数量数量数...", + "actualTextHeight": 15, + "actualTextWidth": 71, + "height": 20, "multiLineActualTexts": Array [ - "数量数量数量", "数量数量数...", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", @@ -5781,13 +7408,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height by rowCell.heightByField 4`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by colCell.height() 4`] = ` Array [ Object { "actualText": "浙江省", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 140, + "height": 120, "multiLineActualTexts": Array [ "浙江省", ], @@ -5798,7 +7425,7 @@ Array [ "actualText": "浙江省浙江省浙江省浙江...", "actualTextHeight": 32, "actualTextWidth": 144, - "height": 35, + "height": 48, "multiLineActualTexts": Array [ "浙江省浙江省", "浙江省浙江...", @@ -5810,7 +7437,7 @@ Array [ "actualText": "四川省", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 155, + "height": 120, "multiLineActualTexts": Array [ "四川省", ], @@ -5820,13 +7447,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height by rowCell.heightByField 5`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by colCell.height() 5`] = ` Array [ Object { "actualText": "236723672361111", "actualTextHeight": 30, "actualTextWidth": 99, - "height": 35, + "height": 30, "multiLineActualTexts": Array [ "23672367236", "1111", @@ -5838,7 +7465,7 @@ Array [ "actualText": "3877", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 35, + "height": 30, "multiLineActualTexts": Array [ "3877", ], @@ -5849,7 +7476,7 @@ Array [ "actualText": "4342", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 35, + "height": 30, "multiLineActualTexts": Array [ "4342", ], @@ -5860,7 +7487,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 35, + "height": 30, "multiLineActualTexts": Array [ "-", ], @@ -5871,7 +7498,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 35, + "height": 48, "multiLineActualTexts": Array [ "-", ], @@ -5882,7 +7509,7 @@ Array [ "actualText": "1723", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 50, + "height": 30, "multiLineActualTexts": Array [ "1723", ], @@ -5893,7 +7520,7 @@ Array [ "actualText": "1822", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 35, + "height": 30, "multiLineActualTexts": Array [ "1822", ], @@ -5904,18 +7531,29 @@ Array [ "actualText": "1943", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 35, + "height": 30, "multiLineActualTexts": Array [ "1943", ], "originalText": 1943, "width": 96, }, + Object { + "actualText": "2330", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2330", + ], + "originalText": 2330, + "width": 96, + }, Object { "actualText": "632", "actualTextHeight": 15, "actualTextWidth": 21, - "height": 35, + "height": 30, "multiLineActualTexts": Array [ "632", ], @@ -5926,7 +7564,7 @@ Array [ "actualText": "7234", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 35, + "height": 30, "multiLineActualTexts": Array [ "7234", ], @@ -5937,7 +7575,7 @@ Array [ "actualText": "834", "actualTextHeight": 15, "actualTextWidth": 21, - "height": 35, + "height": 30, "multiLineActualTexts": Array [ "834", ], @@ -5948,7 +7586,7 @@ Array [ "actualText": "5343", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 35, + "height": 30, "multiLineActualTexts": Array [ "5343", ], @@ -5959,7 +7597,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 35, + "height": 48, "multiLineActualTexts": Array [ "-", ], @@ -5970,7 +7608,7 @@ Array [ "actualText": "2451", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 50, + "height": 30, "multiLineActualTexts": Array [ "2451", ], @@ -5981,7 +7619,7 @@ Array [ "actualText": "2244", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 35, + "height": 30, "multiLineActualTexts": Array [ "2244", ], @@ -5992,73 +7630,95 @@ Array [ "actualText": "2333", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 35, + "height": 30, "multiLineActualTexts": Array [ "2333", ], "originalText": 2333, "width": 96, }, + Object { + "actualText": "2445", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2445", + ], + "originalText": 2445, + "width": 96, + }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if hidden col cell 1`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by dataCell.height 1`] = ` Array [ Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 0, - "multiLineActualTexts": Array [], - "originalText": undefined, + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 48, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", "width": 80, }, Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 0, - "multiLineActualTexts": Array [], - "originalText": undefined, + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 48, + "multiLineActualTexts": Array [ + "省份", + ], + "originalText": "省份", "width": 96, }, Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 0, - "multiLineActualTexts": Array [], - "originalText": undefined, + "actualText": "城市城市城市城市城市城...", + "actualTextHeight": 32, + "actualTextWidth": 144, + "height": 48, + "multiLineActualTexts": Array [ + "城市城市城市", + "城市城市城...", + ], + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", "width": 96, }, Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 0, - "multiLineActualTexts": Array [], - "originalText": undefined, + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 16, + "actualTextWidth": 241, + "height": 48, + "multiLineActualTexts": Array [ + "类别类别类别类别类别类别类别类别类别类别", + ], + "originalText": "类别类别类别类别类别类别类别类别类别类别", "width": 272, }, Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 0, - "multiLineActualTexts": Array [], - "originalText": undefined, + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 48, + "multiLineActualTexts": Array [ + "子类别", + ], + "originalText": "子类别", "width": 272, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if hidden col cell 2`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by dataCell.height 2`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 120, + "height": 80, "multiLineActualTexts": Array [ "1", ], @@ -6069,7 +7729,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "2", ], @@ -6080,7 +7740,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 120, + "height": 80, "multiLineActualTexts": Array [ "3", ], @@ -6090,63 +7750,75 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if hidden col cell 3`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by dataCell.height 3`] = ` Array [ Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 0, - "multiLineActualTexts": Array [], - "originalText": undefined, + "actualText": "家具", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 48, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", "width": 192, }, Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 0, - "multiLineActualTexts": Array [], - "originalText": undefined, + "actualText": "桌子", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 48, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", "width": 96, }, Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 0, - "multiLineActualTexts": Array [], - "originalText": undefined, + "actualText": "数量数量数量数量数量数...", + "actualTextHeight": 30, + "actualTextWidth": 144, + "height": 48, + "multiLineActualTexts": Array [ + "数量数量数量", + "数量数量数...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 96, }, Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 0, - "multiLineActualTexts": Array [], - "originalText": undefined, + "actualText": "沙发", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 48, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", "width": 96, }, Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 0, - "multiLineActualTexts": Array [], - "originalText": undefined, + "actualText": "数量数量数量数量数量数...", + "actualTextHeight": 30, + "actualTextWidth": 144, + "height": 48, + "multiLineActualTexts": Array [ + "数量数量数量", + "数量数量数...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 96, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if hidden col cell 4`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by dataCell.height 4`] = ` Array [ Object { "actualText": "浙江省", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 120, + "height": 80, "multiLineActualTexts": Array [ "浙江省", ], @@ -6157,7 +7829,7 @@ Array [ "actualText": "浙江省浙江...", "actualTextHeight": 16, "actualTextWidth": 71, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省浙江...", ], @@ -6168,7 +7840,7 @@ Array [ "actualText": "四川省", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 120, + "height": 80, "multiLineActualTexts": Array [ "四川省", ], @@ -6178,13 +7850,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if hidden col cell 5`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style less than actual text height by dataCell.height 5`] = ` Array [ Object { "actualText": "2367236723...", "actualTextHeight": 15, "actualTextWidth": 77, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "2367236723...", ], @@ -6195,7 +7867,7 @@ Array [ "actualText": "3877", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "3877", ], @@ -6206,7 +7878,7 @@ Array [ "actualText": "4342", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "4342", ], @@ -6217,7 +7889,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "-", ], @@ -6228,7 +7900,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "-", ], @@ -6239,7 +7911,7 @@ Array [ "actualText": "1723", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "1723", ], @@ -6250,7 +7922,7 @@ Array [ "actualText": "1822", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "1822", ], @@ -6261,7 +7933,7 @@ Array [ "actualText": "1943", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "1943", ], @@ -6272,7 +7944,7 @@ Array [ "actualText": "2330", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "2330", ], @@ -6283,7 +7955,7 @@ Array [ "actualText": "632", "actualTextHeight": 15, "actualTextWidth": 21, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "632", ], @@ -6294,7 +7966,7 @@ Array [ "actualText": "7234", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "7234", ], @@ -6305,7 +7977,7 @@ Array [ "actualText": "834", "actualTextHeight": 15, "actualTextWidth": 21, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "834", ], @@ -6316,7 +7988,7 @@ Array [ "actualText": "5343", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "5343", ], @@ -6327,7 +7999,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "-", ], @@ -6338,7 +8010,7 @@ Array [ "actualText": "2451", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "2451", ], @@ -6349,7 +8021,7 @@ Array [ "actualText": "2244", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "2244", ], @@ -6360,7 +8032,7 @@ Array [ "actualText": "2333", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "2333", ], @@ -6371,7 +8043,7 @@ Array [ "actualText": "2445", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "2445", ], @@ -6381,13 +8053,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not render word wrap text 1`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 30, + "height": 70, "multiLineActualTexts": Array [ "序号", ], @@ -6398,7 +8070,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 30, + "height": 70, "multiLineActualTexts": Array [ "省份", ], @@ -6406,12 +8078,182 @@ Array [ "width": 96, }, Object { - "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "actualText": "城市城市城市城市城市城市城市城市城...", + "actualTextHeight": 48, + "actualTextWidth": 217, + "height": 70, + "multiLineActualTexts": Array [ + "城市城市城市", + "城市城市城市", + "城市城市城...", + ], + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "width": 96, + }, + Object { + "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 16, - "actualTextWidth": 289, - "height": 30, + "actualTextWidth": 241, + "height": 70, "multiLineActualTexts": Array [ - "城市城市城市城市城市城市城市城市城市城市城市城市", + "类别类别类别类别类别类别类别类别类别类别", + ], + "originalText": "类别类别类别类别类别类别类别类别类别类别", + "width": 272, + }, + Object { + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 70, + "multiLineActualTexts": Array [ + "子类别", + ], + "originalText": "子类别", + "width": 272, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height 2`] = ` +Array [ + Object { + "actualText": "数量数量数量数量数量数量数量数量数...", + "actualTextHeight": 45, + "actualTextWidth": 217, + "height": 70, + "multiLineActualTexts": Array [ + "数量数量数量", + "数量数量数量", + "数量数量数...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数...", + "actualTextHeight": 45, + "actualTextWidth": 217, + "height": 70, + "multiLineActualTexts": Array [ + "数量数量数量", + "数量数量数量", + "数量数量数...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height 3`] = `Array []`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height 4`] = ` +Array [ + Object { + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 99, + "height": 70, + "multiLineActualTexts": Array [ + "23672367236", + "1111", + ], + "originalText": 236723672361111, + "width": 96, + }, + Object { + "actualText": "3877", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 70, + "multiLineActualTexts": Array [ + "3877", + ], + "originalText": 3877, + "width": 96, + }, + Object { + "actualText": "4342", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 70, + "multiLineActualTexts": Array [ + "4342", + ], + "originalText": 4342, + "width": 96, + }, + Object { + "actualText": "632", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 70, + "multiLineActualTexts": Array [ + "632", + ], + "originalText": 632, + "width": 96, + }, + Object { + "actualText": "7234", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 70, + "multiLineActualTexts": Array [ + "7234", + ], + "originalText": 7234, + "width": 96, + }, + Object { + "actualText": "834", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 70, + "multiLineActualTexts": Array [ + "834", + ], + "originalText": 834, + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height by colCell.heightByField 1`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 120, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 120, + "multiLineActualTexts": Array [ + "省份", + ], + "originalText": "省份", + "width": 96, + }, + Object { + "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "actualTextHeight": 64, + "actualTextWidth": 292, + "height": 120, + "multiLineActualTexts": Array [ + "城市城市城市", + "城市城市城市", + "城市城市城市", + "城市城市城市", ], "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", "width": 96, @@ -6420,7 +8262,7 @@ Array [ "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 16, "actualTextWidth": 241, - "height": 30, + "height": 50, "multiLineActualTexts": Array [ "类别类别类别类别类别类别类别类别类别类别", ], @@ -6431,7 +8273,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 30, + "height": 40, "multiLineActualTexts": Array [ "子类别", ], @@ -6441,7 +8283,7 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not render word wrap text 2`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height by colCell.heightByField 2`] = ` Array [ Object { "actualText": "1", @@ -6458,34 +8300,23 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 80, "multiLineActualTexts": Array [ "2", ], "originalText": "2", "width": 80, }, - Object { - "actualText": "3", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 120, - "multiLineActualTexts": Array [ - "3", - ], - "originalText": "3", - "width": 80, - }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not render word wrap text 3`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height by colCell.heightByField 3`] = ` Array [ Object { "actualText": "家具", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 30, + "height": 50, "multiLineActualTexts": Array [ "家具", ], @@ -6496,7 +8327,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 30, + "height": 40, "multiLineActualTexts": Array [ "桌子", ], @@ -6505,11 +8336,14 @@ Array [ }, Object { "actualText": "数量数量数量数量数量数量数量数量数量数量数量", - "actualTextHeight": 15, - "actualTextWidth": 265, - "height": 30, + "actualTextHeight": 60, + "actualTextWidth": 268, + "height": 120, "multiLineActualTexts": Array [ - "数量数量数量数量数量数量数量数量数量数量数量", + "数量数量数量", + "数量数量数量", + "数量数量数量", + "数量数量", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 96, @@ -6518,7 +8352,7 @@ Array [ "actualText": "沙发", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 30, + "height": 40, "multiLineActualTexts": Array [ "沙发", ], @@ -6527,11 +8361,14 @@ Array [ }, Object { "actualText": "数量数量数量数量数量数量数量数量数量数量数量", - "actualTextHeight": 15, - "actualTextWidth": 265, - "height": 30, + "actualTextHeight": 60, + "actualTextWidth": 268, + "height": 120, "multiLineActualTexts": Array [ - "数量数量数量数量数量数量数量数量数量数量数量", + "数量数量数量", + "数量数量数量", + "数量数量数量", + "数量数量", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 96, @@ -6539,7 +8376,7 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not render word wrap text 4`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height by colCell.heightByField 4`] = ` Array [ Object { "actualText": "浙江省", @@ -6553,39 +8390,32 @@ Array [ "width": 96, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", - "actualTextHeight": 16, - "actualTextWidth": 361, - "height": 30, + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江...", + "actualTextHeight": 64, + "actualTextWidth": 290, + "height": 80, "multiLineActualTexts": Array [ - "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "浙江省浙江省", + "浙江省浙江省", + "浙江省浙江省", + "浙江省浙江...", ], "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 96, }, - Object { - "actualText": "四川省", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 120, - "multiLineActualTexts": Array [ - "四川省", - ], - "originalText": "四川省", - "width": 96, - }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should not render word wrap text 5`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height by colCell.heightByField 5`] = ` Array [ Object { "actualText": "236723672361111", - "actualTextHeight": 15, - "actualTextWidth": 98, + "actualTextHeight": 30, + "actualTextWidth": 99, "height": 30, "multiLineActualTexts": Array [ - "236723672361111", + "23672367236", + "1111", ], "originalText": 236723672361111, "width": 96, @@ -6627,57 +8457,13 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 30, + "height": 80, "multiLineActualTexts": Array [ "-", ], "originalText": "-", "width": 96, }, - Object { - "actualText": "1723", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, - "multiLineActualTexts": Array [ - "1723", - ], - "originalText": 1723, - "width": 96, - }, - Object { - "actualText": "1822", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, - "multiLineActualTexts": Array [ - "1822", - ], - "originalText": 1822, - "width": 96, - }, - Object { - "actualText": "1943", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, - "multiLineActualTexts": Array [ - "1943", - ], - "originalText": 1943, - "width": 96, - }, - Object { - "actualText": "2330", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, - "multiLineActualTexts": Array [ - "2330", - ], - "originalText": 2330, - "width": 96, - }, Object { "actualText": "632", "actualTextHeight": 15, @@ -6726,67 +8512,23 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 30, + "height": 80, "multiLineActualTexts": Array [ "-", ], "originalText": "-", "width": 96, }, - Object { - "actualText": "2451", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, - "multiLineActualTexts": Array [ - "2451", - ], - "originalText": 2451, - "width": 96, - }, - Object { - "actualText": "2244", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, - "multiLineActualTexts": Array [ - "2244", - ], - "originalText": 2244, - "width": 96, - }, - Object { - "actualText": "2333", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, - "multiLineActualTexts": Array [ - "2333", - ], - "originalText": 2333, - "width": 96, - }, - Object { - "actualText": "2445", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, - "multiLineActualTexts": Array [ - "2445", - ], - "originalText": 2445, - "width": 96, - }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render custom text overflow text 1`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height by rowCell.heightByField 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 30, + "height": 48, "multiLineActualTexts": Array [ "序号", ], @@ -6797,7 +8539,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 30, + "height": 48, "multiLineActualTexts": Array [ "省份", ], @@ -6805,12 +8547,13 @@ Array [ "width": 96, }, Object { - "actualText": "城市城@@@", - "actualTextHeight": 16, - "actualTextWidth": 72, - "height": 30, + "actualText": "城市城市城市城市城市城...", + "actualTextHeight": 32, + "actualTextWidth": 144, + "height": 48, "multiLineActualTexts": Array [ - "城市城@@@", + "城市城市城市", + "城市城市城...", ], "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", "width": 96, @@ -6819,7 +8562,7 @@ Array [ "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 16, "actualTextWidth": 241, - "height": 30, + "height": 48, "multiLineActualTexts": Array [ "类别类别类别类别类别类别类别类别类别类别", ], @@ -6830,7 +8573,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 30, + "height": 48, "multiLineActualTexts": Array [ "子类别", ], @@ -6840,13 +8583,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render custom text overflow text 2`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height by rowCell.heightByField 2`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 120, + "height": 140, "multiLineActualTexts": Array [ "1", ], @@ -6857,7 +8600,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 35, "multiLineActualTexts": Array [ "2", ], @@ -6868,7 +8611,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 120, + "height": 155, "multiLineActualTexts": Array [ "3", ], @@ -6878,13 +8621,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render custom text overflow text 3`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height by rowCell.heightByField 3`] = ` Array [ Object { "actualText": "家具", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 30, + "height": 48, "multiLineActualTexts": Array [ "家具", ], @@ -6895,7 +8638,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 30, + "height": 48, "multiLineActualTexts": Array [ "桌子", ], @@ -6903,12 +8646,13 @@ Array [ "width": 96, }, Object { - "actualText": "数量数@@@", - "actualTextHeight": 15, - "actualTextWidth": 73, - "height": 30, - "multiLineActualTexts": Array [ - "数量数@@@", + "actualText": "数量数量数量数量数量数...", + "actualTextHeight": 30, + "actualTextWidth": 144, + "height": 48, + "multiLineActualTexts": Array [ + "数量数量数量", + "数量数量数...", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 96, @@ -6917,7 +8661,7 @@ Array [ "actualText": "沙发", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 30, + "height": 48, "multiLineActualTexts": Array [ "沙发", ], @@ -6925,20 +8669,357 @@ Array [ "width": 96, }, Object { - "actualText": "数量数@@@", + "actualText": "数量数量数量数量数量数...", + "actualTextHeight": 30, + "actualTextWidth": 144, + "height": 48, + "multiLineActualTexts": Array [ + "数量数量数量", + "数量数量数...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height by rowCell.heightByField 4`] = ` +Array [ + Object { + "actualText": "浙江省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 140, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 96, + }, + Object { + "actualText": "浙江省浙江省浙江省浙江...", + "actualTextHeight": 32, + "actualTextWidth": 144, + "height": 35, + "multiLineActualTexts": Array [ + "浙江省浙江省", + "浙江省浙江...", + ], + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "width": 96, + }, + Object { + "actualText": "四川省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 155, + "multiLineActualTexts": Array [ + "四川省", + ], + "originalText": "四川省", + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if custom cell style more than actual text height by rowCell.heightByField 5`] = ` +Array [ + Object { + "actualText": "2367236723...", "actualTextHeight": 15, - "actualTextWidth": 73, + "actualTextWidth": 77, + "height": 35, + "multiLineActualTexts": Array [ + "2367236723...", + ], + "originalText": 236723672361111, + "width": 96, + }, + Object { + "actualText": "3877", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 35, + "multiLineActualTexts": Array [ + "3877", + ], + "originalText": 3877, + "width": 96, + }, + Object { + "actualText": "4342", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 35, + "multiLineActualTexts": Array [ + "4342", + ], + "originalText": 4342, + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 35, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 35, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "1723", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 50, + "multiLineActualTexts": Array [ + "1723", + ], + "originalText": 1723, + "width": 96, + }, + Object { + "actualText": "1822", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 35, + "multiLineActualTexts": Array [ + "1822", + ], + "originalText": 1822, + "width": 96, + }, + Object { + "actualText": "632", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 35, + "multiLineActualTexts": Array [ + "632", + ], + "originalText": 632, + "width": 96, + }, + Object { + "actualText": "7234", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 35, + "multiLineActualTexts": Array [ + "7234", + ], + "originalText": 7234, + "width": 96, + }, + Object { + "actualText": "834", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 35, + "multiLineActualTexts": Array [ + "834", + ], + "originalText": 834, + "width": 96, + }, + Object { + "actualText": "5343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 35, + "multiLineActualTexts": Array [ + "5343", + ], + "originalText": 5343, + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 35, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "2451", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 50, + "multiLineActualTexts": Array [ + "2451", + ], + "originalText": 2451, + "width": 96, + }, + Object { + "actualText": "2244", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 35, + "multiLineActualTexts": Array [ + "2244", + ], + "originalText": 2244, + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if hidden col cell 1`] = ` +Array [ + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 0, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 80, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 0, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 96, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 0, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 96, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 0, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 272, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 0, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 272, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if hidden col cell 2`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 120, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": "1", + "width": 80, + }, + Object { + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "数量数@@@", + "2", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "originalText": "2", + "width": 80, + }, + Object { + "actualText": "3", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 120, + "multiLineActualTexts": Array [ + "3", + ], + "originalText": "3", + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if hidden col cell 3`] = ` +Array [ + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 0, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 192, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 0, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 96, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 0, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 96, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 0, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 96, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 0, + "multiLineActualTexts": Array [], + "originalText": undefined, "width": 96, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render custom text overflow text 4`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if hidden col cell 4`] = ` Array [ Object { "actualText": "浙江省", @@ -6952,12 +9033,12 @@ Array [ "width": 96, }, Object { - "actualText": "浙江省@@@", + "actualText": "浙江省浙江...", "actualTextHeight": 16, - "actualTextWidth": 72, + "actualTextWidth": 71, "height": 30, "multiLineActualTexts": Array [ - "浙江省@@@", + "浙江省浙江...", ], "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 96, @@ -6976,15 +9057,15 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render custom text overflow text 5`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if hidden col cell 5`] = ` Array [ Object { - "actualText": "236723@@@", + "actualText": "2367236723...", "actualTextHeight": 15, "actualTextWidth": 77, "height": 30, "multiLineActualTexts": Array [ - "236723@@@", + "2367236723...", ], "originalText": 236723672361111, "width": 96, @@ -7179,13 +9260,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines 1`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height, but should adjust maxLines if custom cell style less than actual text height by rowCell.height 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 53, + "height": 48, "multiLineActualTexts": Array [ "序号", ], @@ -7196,7 +9277,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 53, + "height": 48, "multiLineActualTexts": Array [ "省份", ], @@ -7204,12 +9285,11 @@ Array [ "width": 96, }, Object { - "actualText": "城市城市城市城市城市城市城市城市城...", - "actualTextHeight": 48, - "actualTextWidth": 217, - "height": 53, + "actualText": "城市城市城市城市城市城...", + "actualTextHeight": 32, + "actualTextWidth": 144, + "height": 48, "multiLineActualTexts": Array [ - "城市城市城市", "城市城市城市", "城市城市城...", ], @@ -7220,7 +9300,7 @@ Array [ "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 16, "actualTextWidth": 241, - "height": 56, + "height": 48, "multiLineActualTexts": Array [ "类别类别类别类别类别类别类别类别类别类别", ], @@ -7231,7 +9311,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 56, + "height": 48, "multiLineActualTexts": Array [ "子类别", ], @@ -7241,13 +9321,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines 2`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height, but should adjust maxLines if custom cell style less than actual text height by rowCell.height 2`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 120, + "height": 80, "multiLineActualTexts": Array [ "1", ], @@ -7258,7 +9338,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 56, + "height": 20, "multiLineActualTexts": Array [ "2", ], @@ -7269,7 +9349,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 120, + "height": 80, "multiLineActualTexts": Array [ "3", ], @@ -7279,13 +9359,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines 3`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height, but should adjust maxLines if custom cell style less than actual text height by rowCell.height 3`] = ` Array [ Object { "actualText": "家具", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 48, "multiLineActualTexts": Array [ "家具", ], @@ -7296,7 +9376,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 48, "multiLineActualTexts": Array [ "桌子", ], @@ -7304,12 +9384,11 @@ Array [ "width": 96, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数...", - "actualTextHeight": 45, - "actualTextWidth": 217, - "height": 53, + "actualText": "数量数量数量数量数量数...", + "actualTextHeight": 30, + "actualTextWidth": 144, + "height": 48, "multiLineActualTexts": Array [ - "数量数量数量", "数量数量数量", "数量数量数...", ], @@ -7320,7 +9399,7 @@ Array [ "actualText": "沙发", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 48, "multiLineActualTexts": Array [ "沙发", ], @@ -7328,12 +9407,11 @@ Array [ "width": 96, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数...", - "actualTextHeight": 45, - "actualTextWidth": 217, - "height": 53, + "actualText": "数量数量数量数量数量数...", + "actualTextHeight": 30, + "actualTextWidth": 144, + "height": 48, "multiLineActualTexts": Array [ - "数量数量数量", "数量数量数量", "数量数量数...", ], @@ -7343,13 +9421,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines 4`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height, but should adjust maxLines if custom cell style less than actual text height by rowCell.height 4`] = ` Array [ Object { "actualText": "浙江省", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 120, + "height": 80, "multiLineActualTexts": Array [ "浙江省", ], @@ -7357,13 +9435,11 @@ Array [ "width": 96, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙江省浙江...", - "actualTextHeight": 48, - "actualTextWidth": 217, - "height": 56, + "actualText": "浙江省浙江...", + "actualTextHeight": 16, + "actualTextWidth": 71, + "height": 20, "multiLineActualTexts": Array [ - "浙江省浙江省", - "浙江省浙江省", "浙江省浙江...", ], "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", @@ -7373,7 +9449,7 @@ Array [ "actualText": "四川省", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 120, + "height": 80, "multiLineActualTexts": Array [ "四川省", ], @@ -7383,16 +9459,15 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines 5`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height, but should adjust maxLines if custom cell style less than actual text height by rowCell.height 5`] = ` Array [ Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 99, - "height": 30, + "actualText": "2367236723...", + "actualTextHeight": 15, + "actualTextWidth": 77, + "height": 20, "multiLineActualTexts": Array [ - "23672367236", - "1111", + "2367236723...", ], "originalText": 236723672361111, "width": 96, @@ -7401,7 +9476,7 @@ Array [ "actualText": "3877", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "3877", ], @@ -7412,7 +9487,7 @@ Array [ "actualText": "4342", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "4342", ], @@ -7423,7 +9498,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "-", ], @@ -7434,7 +9509,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 56, + "height": 20, "multiLineActualTexts": Array [ "-", ], @@ -7445,7 +9520,7 @@ Array [ "actualText": "1723", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "1723", ], @@ -7456,18 +9531,40 @@ Array [ "actualText": "1822", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "1822", ], "originalText": 1822, "width": 96, }, + Object { + "actualText": "1943", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 20, + "multiLineActualTexts": Array [ + "1943", + ], + "originalText": 1943, + "width": 96, + }, + Object { + "actualText": "2330", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 20, + "multiLineActualTexts": Array [ + "2330", + ], + "originalText": 2330, + "width": 96, + }, Object { "actualText": "632", "actualTextHeight": 15, "actualTextWidth": 21, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "632", ], @@ -7478,7 +9575,7 @@ Array [ "actualText": "7234", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "7234", ], @@ -7489,7 +9586,7 @@ Array [ "actualText": "834", "actualTextHeight": 15, "actualTextWidth": 21, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "834", ], @@ -7500,7 +9597,7 @@ Array [ "actualText": "5343", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "5343", ], @@ -7511,7 +9608,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 56, + "height": 20, "multiLineActualTexts": Array [ "-", ], @@ -7522,7 +9619,7 @@ Array [ "actualText": "2451", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "2451", ], @@ -7533,23 +9630,45 @@ Array [ "actualText": "2244", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "2244", ], "originalText": 2244, "width": 96, }, + Object { + "actualText": "2333", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 20, + "multiLineActualTexts": Array [ + "2333", + ], + "originalText": 2333, + "width": 96, + }, + Object { + "actualText": "2445", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 20, + "multiLineActualTexts": Array [ + "2445", + ], + "originalText": 2445, + "width": 96, + }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines for tree mode 1`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height, but should adjust maxLines if custom cell style less than actual text height by rowCell.height() 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 53, + "height": 48, "multiLineActualTexts": Array [ "序号", ], @@ -7557,51 +9676,60 @@ Array [ "width": 80, }, Object { - "actualText": "省份/城市城市城市城市城市城市...", - "actualTextHeight": 48, - "actualTextWidth": 184, - "height": 53, + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 48, "multiLineActualTexts": Array [ - "省份/城市城", - "市城市城市", - "城市城市...", + "省份", ], - "originalText": "省份/城市城市城市城市城市城市城市城市城市城市城市城市", - "width": 100, + "originalText": "省份", + "width": 96, }, Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualText": "城市城市城市城市城市城...", "actualTextHeight": 32, - "actualTextWidth": 242, - "height": 56, + "actualTextWidth": 144, + "height": 48, "multiLineActualTexts": Array [ - "类别类别类别类别类别类别类", - "别类别类别类别", + "城市城市城市", + "城市城市城...", ], - "originalText": "类别类别类别类别类别类别类别类别类别类别", - "width": 180, + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "width": 96, + }, + Object { + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 16, + "actualTextWidth": 241, + "height": 48, + "multiLineActualTexts": Array [ + "类别类别类别类别类别类别类别类别类别类别", + ], + "originalText": "类别类别类别类别类别类别类别类别类别类别", + "width": 272, }, Object { "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 56, + "height": 48, "multiLineActualTexts": Array [ "子类别", ], "originalText": "子类别", - "width": 180, + "width": 272, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines for tree mode 2`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height, but should adjust maxLines if custom cell style less than actual text height by rowCell.height() 2`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 112, + "height": 80, "multiLineActualTexts": Array [ "1", ], @@ -7612,7 +9740,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 150, + "height": 20, "multiLineActualTexts": Array [ "2", ], @@ -7623,513 +9751,527 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 112, + "height": 80, "multiLineActualTexts": Array [ "3", ], "originalText": "3", "width": 80, }, - Object { - "actualText": "4", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 150, - "multiLineActualTexts": Array [ - "4", - ], - "originalText": "4", - "width": 80, - }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines for tree mode 3`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height, but should adjust maxLines if custom cell style less than actual text height by rowCell.height() 3`] = ` Array [ - Object { - "actualText": "纸张纸张纸张纸张纸张", - "actualTextHeight": 32, - "actualTextWidth": 122, - "height": 56, - "multiLineActualTexts": Array [ - "纸张纸张纸张纸", - "张纸张", - ], - "originalText": "纸张纸张纸张纸张纸张", - "width": 103, - }, - Object { - "actualText": "-", - "actualTextHeight": 16, - "actualTextWidth": 4, - "height": 56, - "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 103, - }, - Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 53, - "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量...", - ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 103, - }, Object { "actualText": "家具", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 48, "multiLineActualTexts": Array [ "家具", ], "originalText": "家具", - "width": 206, + "width": 192, }, Object { "actualText": "桌子", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 48, "multiLineActualTexts": Array [ "桌子", ], "originalText": "桌子", - "width": 103, + "width": 96, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 53, + "actualText": "数量数量数量数量数量数...", + "actualTextHeight": 30, + "actualTextWidth": 144, + "height": 48, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量...", + "数量数量数量", + "数量数量数...", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 103, + "width": 96, }, Object { "actualText": "沙发", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 48, "multiLineActualTexts": Array [ "沙发", ], "originalText": "沙发", - "width": 103, + "width": 96, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 53, + "actualText": "数量数量数量数量数量数...", + "actualTextHeight": 30, + "actualTextWidth": 144, + "height": 48, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量...", + "数量数量数量", + "数量数量数...", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 103, + "width": 96, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height, but should adjust maxLines if custom cell style less than actual text height by rowCell.height() 4`] = ` +Array [ Object { - "actualText": "家具家具家具家具家具家具家具家具家具家具...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 56, + "actualText": "浙江省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 80, "multiLineActualTexts": Array [ - "家具家具家具家", - "具家具家具家具", - "家具家具家具...", + "浙江省", ], - "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "width": 103, + "originalText": "浙江省", + "width": 96, }, Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 56, + "actualText": "浙江省浙江...", + "actualTextHeight": 16, + "actualTextWidth": 71, + "height": 20, "multiLineActualTexts": Array [ - "桌子桌子桌子桌", - "子桌子桌子桌子", - "桌子桌子桌子...", + "浙江省浙江...", ], - "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", - "width": 103, + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "width": 96, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 53, + "actualText": "四川省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 80, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量...", + "四川省", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 103, + "originalText": "四川省", + "width": 96, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height, but should adjust maxLines if custom cell style less than actual text height by rowCell.height() 5`] = ` +Array [ Object { - "actualText": "办公用品", - "actualTextHeight": 16, - "actualTextWidth": 49, - "height": 56, + "actualText": "2367236723...", + "actualTextHeight": 15, + "actualTextWidth": 77, + "height": 20, "multiLineActualTexts": Array [ - "办公用品", + "2367236723...", ], - "originalText": "办公用品", - "width": 206, + "originalText": 236723672361111, + "width": 96, }, Object { - "actualText": "笔", - "actualTextHeight": 16, - "actualTextWidth": 13, - "height": 56, + "actualText": "3877", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "笔", + "3877", ], - "originalText": "笔", - "width": 103, + "originalText": 3877, + "width": 96, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 53, + "actualText": "4342", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量...", + "4342", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 103, + "originalText": 4342, + "width": 96, }, Object { - "actualText": "纸张", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 56, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 20, "multiLineActualTexts": Array [ - "纸张", + "-", ], - "originalText": "纸张", - "width": 103, + "originalText": "-", + "width": 96, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 53, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 20, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量...", + "-", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 103, + "originalText": "-", + "width": 96, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines for tree mode 4`] = ` -Array [ Object { - "actualText": "浙江浙江浙江浙江浙江浙江浙江...", - "actualTextHeight": 48, - "actualTextWidth": 181, - "height": 56, + "actualText": "1723", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "浙江浙江浙", - "江浙江浙江", - "浙江浙江...", + "1723", ], - "originalText": "浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江", - "width": 100, + "originalText": 1723, + "width": 96, }, Object { - "actualText": "杭州杭州杭州杭州", - "actualTextHeight": 30, - "actualTextWidth": 98, - "height": 56, + "actualText": "1822", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "杭州杭州杭", - "州杭州", + "1822", ], - "originalText": "杭州杭州杭州杭州", - "width": 100, + "originalText": 1822, + "width": 96, }, Object { - "actualText": "浙江省", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 30, + "actualText": "1943", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "浙江省", + "1943", ], - "originalText": "浙江省", - "width": 100, + "originalText": 1943, + "width": 96, }, Object { - "actualText": "绍兴市", + "actualText": "2330", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "绍兴市", + "2330", ], - "originalText": "绍兴市", - "width": 100, + "originalText": 2330, + "width": 96, }, Object { - "actualText": "宁波市", + "actualText": "632", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 21, + "height": 20, "multiLineActualTexts": Array [ - "宁波市", + "632", ], - "originalText": "宁波市", - "width": 100, + "originalText": 632, + "width": 96, }, Object { - "actualText": "舟山市", + "actualText": "7234", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "舟山市", + "7234", ], - "originalText": "舟山市", - "width": 100, + "originalText": 7234, + "width": 96, }, Object { - "actualText": "杭州市", + "actualText": "834", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 21, + "height": 20, "multiLineActualTexts": Array [ - "杭州市", + "834", ], - "originalText": "杭州市", - "width": 100, + "originalText": 834, + "width": 96, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙江...", - "actualTextHeight": 48, - "actualTextWidth": 181, - "height": 56, + "actualText": "5343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "浙江省浙江", - "省浙江省浙", - "江省浙江...", + "5343", ], - "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", - "width": 100, + "originalText": 5343, + "width": 96, }, Object { - "actualText": "杭州市杭州市杭州市杭州市杭州...", - "actualTextHeight": 45, - "actualTextWidth": 181, - "height": 56, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 20, "multiLineActualTexts": Array [ - "杭州市杭州", - "市杭州市杭", - "州市杭州...", + "-", ], - "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", - "width": 100, + "originalText": "-", + "width": 96, }, Object { - "actualText": "四川省", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 30, + "actualText": "2451", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "四川省", + "2451", ], - "originalText": "四川省", - "width": 100, + "originalText": 2451, + "width": 96, }, Object { - "actualText": "成都市", + "actualText": "2244", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "成都市", + "2244", ], - "originalText": "成都市", - "width": 100, + "originalText": 2244, + "width": 96, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines for tree mode 5`] = ` -Array [ Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 56, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "actualText": "2333", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 20, + "multiLineActualTexts": Array [ + "2333", + ], + "originalText": 2333, + "width": 96, }, Object { - "actualText": "-", + "actualText": "2445", "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 56, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "-", + "2445", ], - "originalText": "-", - "width": 103, + "originalText": 2445, + "width": 96, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not render word wrap text 1`] = ` +Array [ Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, "height": 30, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, }, Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "-", + "省份", ], - "originalText": "-", - "width": 103, + "originalText": "省份", + "width": 96, }, Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, + "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "actualTextHeight": 16, + "actualTextWidth": 289, "height": 30, "multiLineActualTexts": Array [ - "-", + "城市城市城市城市城市城市城市城市城市城市城市城市", ], - "originalText": "-", - "width": 103, + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "width": 96, }, Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 16, + "actualTextWidth": 241, "height": 30, "multiLineActualTexts": Array [ - "-", + "类别类别类别类别类别类别类别类别类别类别", ], - "originalText": "-", - "width": 103, + "originalText": "类别类别类别类别类别类别类别类别类别类别", + "width": 272, }, Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "-", + "子类别", ], - "originalText": "-", - "width": 103, - }, - Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 56, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "originalText": "子类别", + "width": 272, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not render word wrap text 2`] = ` +Array [ Object { - "actualText": "-", + "actualText": "1", "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 56, + "actualTextWidth": 7, + "height": 120, "multiLineActualTexts": Array [ - "-", + "1", ], - "originalText": "-", - "width": 103, - }, - Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 30, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "originalText": "1", + "width": 80, }, Object { - "actualText": "-", + "actualText": "2", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "-", + "2", ], - "originalText": "-", - "width": 103, - }, + "originalText": "2", + "width": 80, + }, Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 56, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "actualText": "3", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 120, + "multiLineActualTexts": Array [ + "3", + ], + "originalText": "3", + "width": 80, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not render word wrap text 3`] = ` +Array [ Object { - "actualText": "-", + "actualText": "家具", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 192, + }, + Object { + "actualText": "桌子", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 96, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 56, + "actualTextWidth": 265, + "height": 30, "multiLineActualTexts": Array [ - "-", + "数量数量数量数量数量数量数量数量数量数量数量", ], - "originalText": "-", - "width": 103, + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, }, Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, + "actualText": "沙发", + "actualTextHeight": 16, + "actualTextWidth": 25, "height": 30, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 96, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 15, + "actualTextWidth": 265, + "height": 30, + "multiLineActualTexts": Array [ + "数量数量数量数量数量数量数量数量数量数量数量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not render word wrap text 4`] = ` +Array [ + Object { + "actualText": "浙江省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 120, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 96, + }, + Object { + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "actualTextHeight": 16, + "actualTextWidth": 361, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + ], + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "width": 96, + }, + Object { + "actualText": "四川省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 120, + "multiLineActualTexts": Array [ + "四川省", + ], + "originalText": "四川省", + "width": 96, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not render word wrap text 5`] = ` +Array [ Object { "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, + "actualTextHeight": 15, + "actualTextWidth": 98, "height": 30, "multiLineActualTexts": Array [ - "2367236723611", - "11", + "236723672361111", ], "originalText": 236723672361111, - "width": 103, + "width": 96, }, Object { "actualText": "3877", @@ -8140,7 +10282,7 @@ Array [ "3877", ], "originalText": 3877, - "width": 103, + "width": 96, }, Object { "actualText": "4342", @@ -8151,7 +10293,7 @@ Array [ "4342", ], "originalText": 4342, - "width": 103, + "width": 96, }, Object { "actualText": "-", @@ -8162,36 +10304,18 @@ Array [ "-", ], "originalText": "-", - "width": 103, - }, - Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 56, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "width": 96, }, Object { "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 56, + "height": 30, "multiLineActualTexts": Array [ "-", ], "originalText": "-", - "width": 103, - }, - Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 30, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "width": 96, }, Object { "actualText": "1723", @@ -8202,36 +10326,40 @@ Array [ "1723", ], "originalText": 1723, - "width": 103, + "width": 96, }, Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 56, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "actualText": "1822", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1822", + ], + "originalText": 1822, + "width": 96, }, Object { - "actualText": "-", + "actualText": "1943", "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 56, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "-", + "1943", ], - "originalText": "-", - "width": 103, + "originalText": 1943, + "width": 96, }, Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, + "actualText": "2330", + "actualTextHeight": 15, + "actualTextWidth": 27, "height": 30, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "multiLineActualTexts": Array [ + "2330", + ], + "originalText": 2330, + "width": 96, }, Object { "actualText": "632", @@ -8242,7 +10370,7 @@ Array [ "632", ], "originalText": 632, - "width": 103, + "width": 96, }, Object { "actualText": "7234", @@ -8253,7 +10381,7 @@ Array [ "7234", ], "originalText": 7234, - "width": 103, + "width": 96, }, Object { "actualText": "834", @@ -8264,7 +10392,7 @@ Array [ "834", ], "originalText": 834, - "width": 103, + "width": 96, }, Object { "actualText": "5343", @@ -8275,36 +10403,18 @@ Array [ "5343", ], "originalText": 5343, - "width": 103, - }, - Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 56, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "width": 96, }, Object { "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 56, + "height": 30, "multiLineActualTexts": Array [ "-", ], "originalText": "-", - "width": 103, - }, - Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 30, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "width": 96, }, Object { "actualText": "2451", @@ -8315,763 +10425,8943 @@ Array [ "2451", ], "originalText": 2451, - "width": 103, - }, - Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 56, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "width": 96, }, Object { - "actualText": "-", + "actualText": "2244", "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 56, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "-", + "2244", ], - "originalText": "-", - "width": 103, - }, - Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 30, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "originalText": 2244, + "width": 96, }, Object { - "actualText": "-", + "actualText": "2333", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "-", + "2333", ], - "originalText": "-", - "width": 103, + "originalText": 2333, + "width": 96, }, Object { - "actualText": "-", + "actualText": "2445", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "-", + "2445", ], - "originalText": "-", - "width": 103, + "originalText": 2445, + "width": 96, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render by infinity maxLines 1`] = ` +Array [ Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 30, + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 80, "multiLineActualTexts": Array [ - "-", + "序号", ], - "originalText": "-", - "width": 103, + "originalText": "序号", + "width": 80, }, Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 30, + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 80, "multiLineActualTexts": Array [ - "-", + "省份", ], - "originalText": "-", - "width": 103, + "originalText": "省份", + "width": 96, }, Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 56, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "actualTextHeight": 64, + "actualTextWidth": 292, + "height": 80, + "multiLineActualTexts": Array [ + "城市城市城市", + "城市城市城市", + "城市城市城市", + "城市城市城市", + ], + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "width": 96, }, Object { - "actualText": "7789778977897789778977897789", - "actualTextHeight": 45, - "actualTextWidth": 189, - "height": 56, + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 16, + "actualTextWidth": 241, + "height": 96, "multiLineActualTexts": Array [ - "7789778977897", - "7897789778977", - "89", + "类别类别类别类别类别类别类别类别类别类别", ], - "originalText": "7789778977897789778977897789", - "width": 103, + "originalText": "类别类别类别类别类别类别类别类别类别类别", + "width": 272, }, Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 30, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 96, + "multiLineActualTexts": Array [ + "子类别", + ], + "originalText": "子类别", + "width": 272, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render by infinity maxLines 2`] = ` +Array [ Object { - "actualText": "-", + "actualText": "1", "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 30, + "actualTextWidth": 7, + "height": 120, "multiLineActualTexts": Array [ - "-", + "1", ], - "originalText": "-", - "width": 103, + "originalText": "1", + "width": 80, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render by infinity maxLines 3`] = ` +Array [ Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 56, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "actualText": "家具", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 96, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 192, }, Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 56, + "actualText": "桌子", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 96, "multiLineActualTexts": Array [ - "-", + "桌子", ], - "originalText": "-", - "width": 103, + "originalText": "桌子", + "width": 96, }, Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 30, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 60, + "actualTextWidth": 268, + "height": 80, + "multiLineActualTexts": Array [ + "数量数量数量", + "数量数量数量", + "数量数量数量", + "数量数量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, }, Object { - "actualText": "1304", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualText": "沙发", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 96, "multiLineActualTexts": Array [ - "1304", + "沙发", ], - "originalText": 1304, - "width": 103, + "originalText": "沙发", + "width": 96, }, Object { - "actualText": "1145", - "actualTextHeight": 15, - "actualTextWidth": 26, + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 60, + "actualTextWidth": 268, + "height": 80, + "multiLineActualTexts": Array [ + "数量数量数量", + "数量数量数量", + "数量数量数量", + "数量数量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render by infinity maxLines 4`] = ` +Array [ + Object { + "actualText": "浙江省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 120, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render by infinity maxLines 5`] = ` +Array [ + Object { + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 99, "height": 30, "multiLineActualTexts": Array [ - "1145", + "23672367236", + "1111", ], - "originalText": 1145, - "width": 103, + "originalText": 236723672361111, + "width": 96, }, Object { - "actualText": "1432", + "actualText": "3877", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "1432", + "3877", ], - "originalText": 1432, - "width": 103, + "originalText": 3877, + "width": 96, }, Object { - "actualText": "945", + "actualText": "4342", "actualTextHeight": 15, - "actualTextWidth": 21, + "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "945", + "4342", ], - "originalText": 945, - "width": 103, - }, - Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 56, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "originalText": 4342, + "width": 96, }, Object { "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 56, + "height": 30, "multiLineActualTexts": Array [ "-", ], "originalText": "-", - "width": 103, + "width": 96, }, Object { - "actualText": undefined, + "actualText": "632", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "632", + ], + "originalText": 632, + "width": 96, + }, + Object { + "actualText": "7234", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "7234", + ], + "originalText": 7234, + "width": 96, + }, + Object { + "actualText": "834", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "834", + ], + "originalText": 834, + "width": 96, + }, + Object { + "actualText": "5343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "5343", + ], + "originalText": 5343, + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render by maxLines if actual text contains "\\n" 1`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "省份", + ], + "originalText": "省份", + "width": 96, + }, + Object { + "actualText": "城市城市城...", + "actualTextHeight": 16, + "actualTextWidth": 71, + "height": 30, + "multiLineActualTexts": Array [ + "城市城市城...", + ], + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "width": 96, + }, + Object { + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 16, + "actualTextWidth": 241, + "height": 30, + "multiLineActualTexts": Array [ + "类别类别类别类别类别类别类别类别类别类别", + ], + "originalText": "类别类别类别类别类别类别类别类别类别类别", + "width": 272, + }, + Object { + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "子类别", + ], + "originalText": "子类别", + "width": 272, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render by maxLines if actual text contains "\\n" 2`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": "1", + "width": 80, + }, + Object { + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 120, + "multiLineActualTexts": Array [ + "2", + ], + "originalText": "2", + "width": 80, + }, + Object { + "actualText": "3", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "3", + ], + "originalText": "3", + "width": 80, + }, + Object { + "actualText": "4", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 120, + "multiLineActualTexts": Array [ + "4", + ], + "originalText": "4", + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render by maxLines if actual text contains "\\n" 3`] = ` +Array [ + Object { + "actualText": "纸张...", + "actualTextHeight": 16, + "actualTextWidth": 35, + "height": 30, + "multiLineActualTexts": Array [ + "纸张...", + ], + "originalText": "纸张 +纸张", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 16, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "数量数量数...", + "actualTextHeight": 15, + "actualTextWidth": 71, + "height": 30, + "multiLineActualTexts": Array [ + "数量数量数...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, + }, + Object { + "actualText": "家具", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 192, + }, + Object { + "actualText": "桌子", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 96, + }, + Object { + "actualText": "数量数量数...", + "actualTextHeight": 15, + "actualTextWidth": 71, + "height": 30, + "multiLineActualTexts": Array [ + "数量数量数...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 96, + }, + Object { + "actualText": "数量数量数...", + "actualTextHeight": 15, + "actualTextWidth": 71, + "height": 30, + "multiLineActualTexts": Array [ + "数量数量数...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, + }, + Object { + "actualText": "家具家具家...", + "actualTextHeight": 16, + "actualTextWidth": 71, + "height": 30, + "multiLineActualTexts": Array [ + "家具家具家...", + ], + "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "width": 96, + }, + Object { + "actualText": "桌子桌子桌...", + "actualTextHeight": 16, + "actualTextWidth": 71, + "height": 30, + "multiLineActualTexts": Array [ + "桌子桌子桌...", + ], + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "width": 96, + }, + Object { + "actualText": "数量数量数...", + "actualTextHeight": 15, + "actualTextWidth": 71, + "height": 30, + "multiLineActualTexts": Array [ + "数量数量数...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 16, + "actualTextWidth": 49, + "height": 30, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 192, + }, + Object { + "actualText": "笔", + "actualTextHeight": 16, + "actualTextWidth": 13, + "height": 30, + "multiLineActualTexts": Array [ + "笔", + ], + "originalText": "笔", + "width": 96, + }, + Object { + "actualText": "数量数量数...", + "actualTextHeight": 15, + "actualTextWidth": 71, + "height": 30, + "multiLineActualTexts": Array [ + "数量数量数...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, + }, + Object { + "actualText": "纸张", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "纸张", + ], + "originalText": "纸张", + "width": 96, + }, + Object { + "actualText": "数量数量数...", + "actualTextHeight": 15, + "actualTextWidth": 71, + "height": 30, + "multiLineActualTexts": Array [ + "数量数量数...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render by maxLines if actual text contains "\\n" 4`] = ` +Array [ + Object { + "actualText": "浙江...", + "actualTextHeight": 16, + "actualTextWidth": 35, + "height": 30, + "multiLineActualTexts": Array [ + "浙江...", + ], + "originalText": "浙江 +浙江", + "width": 96, + }, + Object { + "actualText": "杭州...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 30, + "multiLineActualTexts": Array [ + "杭州...", + ], + "originalText": "杭州 +杭州 +杭州", + "width": 96, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 120, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 96, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 96, + }, + Object { + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "宁波市", + ], + "originalText": "宁波市", + "width": 96, + }, + Object { + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "舟山市", + ], + "originalText": "舟山市", + "width": 96, + }, + Object { + "actualText": "杭州市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "杭州市", + ], + "originalText": "杭州市", + "width": 96, + }, + Object { + "actualText": "浙江省浙江...", + "actualTextHeight": 16, + "actualTextWidth": 71, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省浙江...", + ], + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "width": 96, + }, + Object { + "actualText": "杭州市杭州...", + "actualTextHeight": 15, + "actualTextWidth": 71, + "height": 30, + "multiLineActualTexts": Array [ + "杭州市杭州...", + ], + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "width": 96, + }, + Object { + "actualText": "四川省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 120, + "multiLineActualTexts": Array [ + "四川省", + ], + "originalText": "四川省", + "width": 96, + }, + Object { + "actualText": "成都市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "成都市", + ], + "originalText": "成都市", + "width": 96, + }, + Object { + "actualText": "绵阳市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绵阳市", + ], + "originalText": "绵阳市", + "width": 96, + }, + Object { + "actualText": "南充市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "南充市", + ], + "originalText": "南充市", + "width": 96, + }, + Object { + "actualText": "乐山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "乐山市", + ], + "originalText": "乐山市", + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render by maxLines if actual text contains "\\n" 5`] = ` +Array [ + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "2367236723...", + "actualTextHeight": 15, + "actualTextWidth": 77, + "height": 30, + "multiLineActualTexts": Array [ + "2367236723...", + ], + "originalText": 236723672361111, + "width": 96, + }, + Object { + "actualText": "3877", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "3877", + ], + "originalText": 3877, + "width": 96, + }, + Object { + "actualText": "4342", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "4342", + ], + "originalText": 4342, + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "1723", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1723", + ], + "originalText": 1723, + "width": 96, + }, + Object { + "actualText": "1822", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1822", + ], + "originalText": 1822, + "width": 96, + }, + Object { + "actualText": "1943", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1943", + ], + "originalText": 1943, + "width": 96, + }, + Object { + "actualText": "2330", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2330", + ], + "originalText": 2330, + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "632", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "632", + ], + "originalText": 632, + "width": 96, + }, + Object { + "actualText": "7234", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "7234", + ], + "originalText": 7234, + "width": 96, + }, + Object { + "actualText": "834", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "834", + ], + "originalText": 834, + "width": 96, + }, + Object { + "actualText": "5343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "5343", + ], + "originalText": 5343, + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "2451", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2451", + ], + "originalText": 2451, + "width": 96, + }, + Object { + "actualText": "2244", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2244", + ], + "originalText": 2244, + "width": 96, + }, + Object { + "actualText": "2333", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2333", + ], + "originalText": 2333, + "width": 96, + }, + Object { + "actualText": "2445", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2445", + ], + "originalText": 2445, + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "7789778977...", + "actualTextHeight": 15, + "actualTextWidth": 77, + "height": 30, + "multiLineActualTexts": Array [ + "7789778977...", + ], + "originalText": "7789778977897789778977897789", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "1304", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1304", + ], + "originalText": 1304, + "width": 96, + }, + Object { + "actualText": "1145", + "actualTextHeight": 15, + "actualTextWidth": 26, + "height": 30, + "multiLineActualTexts": Array [ + "1145", + ], + "originalText": 1145, + "width": 96, + }, + Object { + "actualText": "1432", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1432", + ], + "originalText": 1432, + "width": 96, + }, + Object { + "actualText": "945", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "945", + ], + "originalText": 945, + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "2335", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2335", + ], + "originalText": 2335, + "width": 96, + }, + Object { + "actualText": "245", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "245", + ], + "originalText": 245, + "width": 96, + }, + Object { + "actualText": "2457", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2457", + ], + "originalText": 2457, + "width": 96, + }, + Object { + "actualText": "2458", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2458", + ], + "originalText": 2458, + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "1354", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1354", + ], + "originalText": 1354, + "width": 96, + }, + Object { + "actualText": "1523", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1523", + ], + "originalText": 1523, + "width": 96, + }, + Object { + "actualText": "1634", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1634", + ], + "originalText": 1634, + "width": 96, + }, + Object { + "actualText": "1343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1343", + ], + "originalText": 1343, + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "4004", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "4004", + ], + "originalText": 4004, + "width": 96, + }, + Object { + "actualText": "3077", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "3077", + ], + "originalText": 3077, + "width": 96, + }, + Object { + "actualText": "3551", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "3551", + ], + "originalText": 3551, + "width": 96, + }, + Object { + "actualText": "352", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "352", + ], + "originalText": 352, + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render by maxLinesByField 1`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 80, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 80, + "multiLineActualTexts": Array [ + "省份", + ], + "originalText": "省份", + "width": 102.57, + }, + Object { + "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "actualTextHeight": 64, + "actualTextWidth": 292, + "height": 80, + "multiLineActualTexts": Array [ + "城市城市城市城", + "市城市城市城市", + "城市城市城市城", + "市城市", + ], + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "width": 102.57, + }, + Object { + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 16, + "actualTextWidth": 241, + "height": 48, + "multiLineActualTexts": Array [ + "类别类别类别类别类别类别类别类别类别类别", + ], + "originalText": "类别类别类别类别类别类别类别类别类别类别", + "width": 285.14, + }, + Object { + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 96, + "multiLineActualTexts": Array [ + "子类别", + ], + "originalText": "子类别", + "width": 285.14, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render by maxLinesByField 2`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 120, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": "1", + "width": 80, + }, + Object { + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 96, + "multiLineActualTexts": Array [ + "2", + ], + "originalText": "2", + "width": 80, + }, + Object { + "actualText": "3", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 120, + "multiLineActualTexts": Array [ + "3", + ], + "originalText": "3", + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render by maxLinesByField 3`] = ` +Array [ + Object { + "actualText": "家具", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 48, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 205.14, + }, + Object { + "actualText": "桌子", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 96, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 102.57, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 60, + "actualTextWidth": 268, + "height": 80, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量数", + "量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 102.57, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 96, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 102.57, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 60, + "actualTextWidth": 268, + "height": 80, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量数", + "量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 102.57, + }, + Object { + "actualText": "家具家具家具家具家具家具家...", + "actualTextHeight": 32, + "actualTextWidth": 168, + "height": 48, + "multiLineActualTexts": Array [ + "家具家具家具家", + "具家具家具家...", + ], + "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "width": 102.57, + }, + Object { + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 96, + "multiLineActualTexts": Array [ + "桌子桌子桌子桌", + "子桌子桌子桌子", + "桌子桌子桌子...", + ], + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "width": 102.57, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 60, + "actualTextWidth": 268, + "height": 80, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量数", + "量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 102.57, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 16, + "actualTextWidth": 49, + "height": 48, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 205.14, + }, + Object { + "actualText": "笔", + "actualTextHeight": 16, + "actualTextWidth": 13, + "height": 96, + "multiLineActualTexts": Array [ + "笔", + ], + "originalText": "笔", + "width": 102.57, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 60, + "actualTextWidth": 268, + "height": 80, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量数", + "量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 102.57, + }, + Object { + "actualText": "纸张", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 96, + "multiLineActualTexts": Array [ + "纸张", + ], + "originalText": "纸张", + "width": 102.57, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 60, + "actualTextWidth": 268, + "height": 80, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量数", + "量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 102.57, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render by maxLinesByField 4`] = ` +Array [ + Object { + "actualText": "浙江省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 120, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 102.57, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 102.57, + }, + Object { + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "宁波市", + ], + "originalText": "宁波市", + "width": 102.57, + }, + Object { + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "舟山市", + ], + "originalText": "舟山市", + "width": 102.57, + }, + Object { + "actualText": "杭州市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "杭州市", + ], + "originalText": "杭州市", + "width": 102.57, + }, + Object { + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "actualTextHeight": 80, + "actualTextWidth": 365, + "height": 96, + "multiLineActualTexts": Array [ + "浙江省浙江省浙", + "江省浙江省浙江", + "省浙江省浙江省", + "浙江省浙江省浙", + "江省", + ], + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "width": 102.57, + }, + Object { + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 96, + "multiLineActualTexts": Array [ + "杭州市杭州市杭", + "州市杭州市杭州", + "市杭州市杭州...", + ], + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "width": 102.57, + }, + Object { + "actualText": "四川省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 120, + "multiLineActualTexts": Array [ + "四川省", + ], + "originalText": "四川省", + "width": 102.57, + }, + Object { + "actualText": "成都市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "成都市", + ], + "originalText": "成都市", + "width": 102.57, + }, + Object { + "actualText": "绵阳市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绵阳市", + ], + "originalText": "绵阳市", + "width": 102.57, + }, + Object { + "actualText": "南充市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "南充市", + ], + "originalText": "南充市", + "width": 102.57, + }, + Object { + "actualText": "乐山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "乐山市", + ], + "originalText": "乐山市", + "width": 102.57, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render by maxLinesByField 5`] = ` +Array [ + Object { + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 30, + "multiLineActualTexts": Array [ + "236723672361", + "111", + ], + "originalText": 236723672361111, + "width": 102.57, + }, + Object { + "actualText": "3877", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "3877", + ], + "originalText": 3877, + "width": 102.57, + }, + Object { + "actualText": "4342", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "4342", + ], + "originalText": 4342, + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 96, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "1723", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1723", + ], + "originalText": 1723, + "width": 102.57, + }, + Object { + "actualText": "1822", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1822", + ], + "originalText": 1822, + "width": 102.57, + }, + Object { + "actualText": "1943", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1943", + ], + "originalText": 1943, + "width": 102.57, + }, + Object { + "actualText": "2330", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2330", + ], + "originalText": 2330, + "width": 102.57, + }, + Object { + "actualText": "632", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "632", + ], + "originalText": 632, + "width": 102.57, + }, + Object { + "actualText": "7234", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "7234", + ], + "originalText": 7234, + "width": 102.57, + }, + Object { + "actualText": "834", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "834", + ], + "originalText": 834, + "width": 102.57, + }, + Object { + "actualText": "5343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "5343", + ], + "originalText": 5343, + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 96, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "2451", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2451", + ], + "originalText": 2451, + "width": 102.57, + }, + Object { + "actualText": "2244", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2244", + ], + "originalText": 2244, + "width": 102.57, + }, + Object { + "actualText": "2333", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2333", + ], + "originalText": 2333, + "width": 102.57, + }, + Object { + "actualText": "2445", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2445", + ], + "originalText": 2445, + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "7789778977897789778977897789", + "actualTextHeight": 45, + "actualTextWidth": 189, + "height": 96, + "multiLineActualTexts": Array [ + "778977897789", + "778977897789", + "7789", + ], + "originalText": "7789778977897789778977897789", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "1304", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1304", + ], + "originalText": 1304, + "width": 102.57, + }, + Object { + "actualText": "1145", + "actualTextHeight": 15, + "actualTextWidth": 26, + "height": 30, + "multiLineActualTexts": Array [ + "1145", + ], + "originalText": 1145, + "width": 102.57, + }, + Object { + "actualText": "1432", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1432", + ], + "originalText": 1432, + "width": 102.57, + }, + Object { + "actualText": "945", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "945", + ], + "originalText": 945, + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 96, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "2335", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2335", + ], + "originalText": 2335, + "width": 102.57, + }, + Object { + "actualText": "245", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "245", + ], + "originalText": 245, + "width": 102.57, + }, + Object { + "actualText": "2457", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2457", + ], + "originalText": 2457, + "width": 102.57, + }, + Object { + "actualText": "2458", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2458", + ], + "originalText": 2458, + "width": 102.57, + }, + Object { + "actualText": "1354", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1354", + ], + "originalText": 1354, + "width": 102.57, + }, + Object { + "actualText": "1523", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1523", + ], + "originalText": 1523, + "width": 102.57, + }, + Object { + "actualText": "1634", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1634", + ], + "originalText": 1634, + "width": 102.57, + }, + Object { + "actualText": "1343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1343", + ], + "originalText": 1343, + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 96, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "4004", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "4004", + ], + "originalText": 4004, + "width": 102.57, + }, + Object { + "actualText": "3077", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "3077", + ], + "originalText": 3077, + "width": 102.57, + }, + Object { + "actualText": "3551", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "3551", + ], + "originalText": 3551, + "width": 102.57, + }, + Object { + "actualText": "352", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "352", + ], + "originalText": 352, + "width": 102.57, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render custom text overflow text 1`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "省份", + ], + "originalText": "省份", + "width": 96, + }, + Object { + "actualText": "城市城@@@", + "actualTextHeight": 16, + "actualTextWidth": 72, + "height": 30, + "multiLineActualTexts": Array [ + "城市城@@@", + ], + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "width": 96, + }, + Object { + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 16, + "actualTextWidth": 241, + "height": 30, + "multiLineActualTexts": Array [ + "类别类别类别类别类别类别类别类别类别类别", + ], + "originalText": "类别类别类别类别类别类别类别类别类别类别", + "width": 272, + }, + Object { + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "子类别", + ], + "originalText": "子类别", + "width": 272, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render custom text overflow text 2`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 120, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": "1", + "width": 80, + }, + Object { + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "2", + ], + "originalText": "2", + "width": 80, + }, + Object { + "actualText": "3", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 120, + "multiLineActualTexts": Array [ + "3", + ], + "originalText": "3", + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render custom text overflow text 3`] = ` +Array [ + Object { + "actualText": "家具", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 192, + }, + Object { + "actualText": "桌子", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 96, + }, + Object { + "actualText": "数量数@@@", + "actualTextHeight": 15, + "actualTextWidth": 73, + "height": 30, + "multiLineActualTexts": Array [ + "数量数@@@", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 96, + }, + Object { + "actualText": "数量数@@@", + "actualTextHeight": 15, + "actualTextWidth": 73, + "height": 30, + "multiLineActualTexts": Array [ + "数量数@@@", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render custom text overflow text 4`] = ` +Array [ + Object { + "actualText": "浙江省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 120, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 96, + }, + Object { + "actualText": "浙江省@@@", + "actualTextHeight": 16, + "actualTextWidth": 72, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省@@@", + ], + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "width": 96, + }, + Object { + "actualText": "四川省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 120, + "multiLineActualTexts": Array [ + "四川省", + ], + "originalText": "四川省", + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render custom text overflow text 5`] = ` +Array [ + Object { + "actualText": "236723@@@", + "actualTextHeight": 15, + "actualTextWidth": 77, + "height": 30, + "multiLineActualTexts": Array [ + "236723@@@", + ], + "originalText": 236723672361111, + "width": 96, + }, + Object { + "actualText": "3877", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "3877", + ], + "originalText": 3877, + "width": 96, + }, + Object { + "actualText": "4342", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "4342", + ], + "originalText": 4342, + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "1723", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1723", + ], + "originalText": 1723, + "width": 96, + }, + Object { + "actualText": "1822", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1822", + ], + "originalText": 1822, + "width": 96, + }, + Object { + "actualText": "1943", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1943", + ], + "originalText": 1943, + "width": 96, + }, + Object { + "actualText": "2330", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2330", + ], + "originalText": 2330, + "width": 96, + }, + Object { + "actualText": "632", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "632", + ], + "originalText": 632, + "width": 96, + }, + Object { + "actualText": "7234", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "7234", + ], + "originalText": 7234, + "width": 96, + }, + Object { + "actualText": "834", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "834", + ], + "originalText": 834, + "width": 96, + }, + Object { + "actualText": "5343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "5343", + ], + "originalText": 5343, + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "2451", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2451", + ], + "originalText": 2451, + "width": 96, + }, + Object { + "actualText": "2244", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2244", + ], + "originalText": 2244, + "width": 96, + }, + Object { + "actualText": "2333", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2333", + ], + "originalText": 2333, + "width": 96, + }, + Object { + "actualText": "2445", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2445", + ], + "originalText": 2445, + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines 1`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, + "multiLineActualTexts": Array [ + "省份", + ], + "originalText": "省份", + "width": 96, + }, + Object { + "actualText": "城市城市城市城市城市城市城市城市城...", + "actualTextHeight": 48, + "actualTextWidth": 217, + "height": 64, + "multiLineActualTexts": Array [ + "城市城市城市", + "城市城市城市", + "城市城市城...", + ], + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "width": 96, + }, + Object { + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 16, + "actualTextWidth": 241, + "height": 64, + "multiLineActualTexts": Array [ + "类别类别类别类别类别类别类别类别类别类别", + ], + "originalText": "类别类别类别类别类别类别类别类别类别类别", + "width": 272, + }, + Object { + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 64, + "multiLineActualTexts": Array [ + "子类别", + ], + "originalText": "子类别", + "width": 272, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines 2`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 120, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": "1", + "width": 80, + }, + Object { + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 64, + "multiLineActualTexts": Array [ + "2", + ], + "originalText": "2", + "width": 80, + }, + Object { + "actualText": "3", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 120, + "multiLineActualTexts": Array [ + "3", + ], + "originalText": "3", + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines 3`] = ` +Array [ + Object { + "actualText": "家具", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 192, + }, + Object { + "actualText": "桌子", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 96, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数...", + "actualTextHeight": 45, + "actualTextWidth": 217, + "height": 64, + "multiLineActualTexts": Array [ + "数量数量数量", + "数量数量数量", + "数量数量数...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 96, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数...", + "actualTextHeight": 45, + "actualTextWidth": 217, + "height": 64, + "multiLineActualTexts": Array [ + "数量数量数量", + "数量数量数量", + "数量数量数...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines 4`] = ` +Array [ + Object { + "actualText": "浙江省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 120, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 96, + }, + Object { + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江...", + "actualTextHeight": 48, + "actualTextWidth": 217, + "height": 64, + "multiLineActualTexts": Array [ + "浙江省浙江省", + "浙江省浙江省", + "浙江省浙江...", + ], + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "width": 96, + }, + Object { + "actualText": "四川省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 120, + "multiLineActualTexts": Array [ + "四川省", + ], + "originalText": "四川省", + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines 5`] = ` +Array [ + Object { + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 99, + "height": 30, + "multiLineActualTexts": Array [ + "23672367236", + "1111", + ], + "originalText": 236723672361111, + "width": 96, + }, + Object { + "actualText": "3877", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "3877", + ], + "originalText": 3877, + "width": 96, + }, + Object { + "actualText": "4342", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "4342", + ], + "originalText": 4342, + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 64, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "1723", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1723", + ], + "originalText": 1723, + "width": 96, + }, + Object { + "actualText": "632", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "632", + ], + "originalText": 632, + "width": 96, + }, + Object { + "actualText": "7234", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "7234", + ], + "originalText": 7234, + "width": 96, + }, + Object { + "actualText": "834", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "834", + ], + "originalText": 834, + "width": 96, + }, + Object { + "actualText": "5343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "5343", + ], + "originalText": 5343, + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 64, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "2451", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2451", + ], + "originalText": 2451, + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines for tree mode 1`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份/城市城市城市城市城市城市...", + "actualTextHeight": 48, + "actualTextWidth": 184, + "height": 64, + "multiLineActualTexts": Array [ + "省份/城市城", + "市城市城市", + "城市城市...", + ], + "originalText": "省份/城市城市城市城市城市城市城市城市城市城市城市城市", + "width": 100, + }, + Object { + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 32, + "actualTextWidth": 242, + "height": 64, + "multiLineActualTexts": Array [ + "类别类别类别类别类别类别", + "类别类别类别类别", + ], + "originalText": "类别类别类别类别类别类别类别类别类别类别", + "width": 180, + }, + Object { + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 64, + "multiLineActualTexts": Array [ + "子类别", + ], + "originalText": "子类别", + "width": 180, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines for tree mode 2`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 128, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": "1", + "width": 80, + }, + Object { + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 150, + "multiLineActualTexts": Array [ + "2", + ], + "originalText": "2", + "width": 80, + }, + Object { + "actualText": "3", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 128, + "multiLineActualTexts": Array [ + "3", + ], + "originalText": "3", + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines for tree mode 3`] = ` +Array [ + Object { + "actualText": "纸张纸张纸张纸张纸张", + "actualTextHeight": 32, + "actualTextWidth": 122, + "height": 64, + "multiLineActualTexts": Array [ + "纸张纸张纸张纸", + "张纸张", + ], + "originalText": "纸张纸张纸张纸张纸张", + "width": 103, + }, + Object { + "actualText": "-", + "actualTextHeight": 16, + "actualTextWidth": 4, + "height": 64, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 103, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 64, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 103, + }, + Object { + "actualText": "家具", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 206, + }, + Object { + "actualText": "桌子", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 103, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 64, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 103, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 103, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 64, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 103, + }, + Object { + "actualText": "家具家具家具家具家具家具家具家具家具家具...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 64, + "multiLineActualTexts": Array [ + "家具家具家具家", + "具家具家具家具", + "家具家具家具...", + ], + "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "width": 103, + }, + Object { + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 64, + "multiLineActualTexts": Array [ + "桌子桌子桌子桌", + "子桌子桌子桌子", + "桌子桌子桌子...", + ], + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "width": 103, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 64, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 103, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 16, + "actualTextWidth": 49, + "height": 64, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 206, + }, + Object { + "actualText": "笔", + "actualTextHeight": 16, + "actualTextWidth": 13, + "height": 64, + "multiLineActualTexts": Array [ + "笔", + ], + "originalText": "笔", + "width": 103, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 64, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 103, + }, + Object { + "actualText": "纸张", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, + "multiLineActualTexts": Array [ + "纸张", + ], + "originalText": "纸张", + "width": 103, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 64, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 103, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines for tree mode 4`] = ` +Array [ + Object { + "actualText": "浙江浙江浙江浙江浙江浙江浙江...", + "actualTextHeight": 48, + "actualTextWidth": 181, + "height": 64, + "multiLineActualTexts": Array [ + "浙江浙江浙", + "江浙江浙江", + "浙江浙江...", + ], + "originalText": "浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江", + "width": 100, + }, + Object { + "actualText": "杭州杭州杭州杭州", + "actualTextHeight": 30, + "actualTextWidth": 98, + "height": 64, + "multiLineActualTexts": Array [ + "杭州杭州杭", + "州杭州", + ], + "originalText": "杭州杭州杭州杭州", + "width": 100, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 100, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 100, + }, + Object { + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "宁波市", + ], + "originalText": "宁波市", + "width": 100, + }, + Object { + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "舟山市", + ], + "originalText": "舟山市", + "width": 100, + }, + Object { + "actualText": "杭州市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "杭州市", + ], + "originalText": "杭州市", + "width": 100, + }, + Object { + "actualText": "浙江省浙江省浙江省浙江省浙江...", + "actualTextHeight": 48, + "actualTextWidth": 181, + "height": 64, + "multiLineActualTexts": Array [ + "浙江省浙江", + "省浙江省浙", + "江省浙江...", + ], + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "width": 100, + }, + Object { + "actualText": "杭州市杭州市杭州市杭州市杭州...", + "actualTextHeight": 45, + "actualTextWidth": 181, + "height": 64, + "multiLineActualTexts": Array [ + "杭州市杭州", + "市杭州市杭", + "州市杭州...", + ], + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "width": 100, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines for tree mode 5`] = ` +Array [ + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 64, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 103, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 64, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 103, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 30, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 103, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 103, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 103, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 103, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 103, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 64, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 103, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 64, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 103, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 64, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 103, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 64, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 103, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 30, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 103, + }, + Object { + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 30, + "multiLineActualTexts": Array [ + "2367236723611", + "11", + ], + "originalText": 236723672361111, + "width": 103, + }, + Object { + "actualText": "3877", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "3877", + ], + "originalText": 3877, + "width": 103, + }, + Object { + "actualText": "4342", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "4342", + ], + "originalText": 4342, + "width": 103, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 103, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 64, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 103, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 64, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 103, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 64, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 103, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 64, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 103, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 30, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 103, + }, + Object { + "actualText": "632", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "632", + ], + "originalText": 632, + "width": 103, + }, + Object { + "actualText": "7234", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "7234", + ], + "originalText": 7234, + "width": 103, + }, + Object { + "actualText": "834", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "834", + ], + "originalText": 834, + "width": 103, + }, + Object { + "actualText": "5343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "5343", + ], + "originalText": 5343, + "width": 103, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 64, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 103, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 64, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 103, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 64, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 103, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 64, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 103, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 30, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 103, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 103, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 103, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 103, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 103, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 64, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 103, + }, + Object { + "actualText": "7789778977897789778977897789", + "actualTextHeight": 45, + "actualTextWidth": 189, + "height": 64, + "multiLineActualTexts": Array [ + "7789778977897", + "7897789778977", + "89", + ], + "originalText": "7789778977897789778977897789", + "width": 103, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 64, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 103, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 64, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 103, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 30, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 103, + }, + Object { + "actualText": "1304", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1304", + ], + "originalText": 1304, + "width": 103, + }, + Object { + "actualText": "1145", + "actualTextHeight": 15, + "actualTextWidth": 26, + "height": 30, + "multiLineActualTexts": Array [ + "1145", + ], + "originalText": 1145, + "width": 103, + }, + Object { + "actualText": "1432", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1432", + ], + "originalText": 1432, + "width": 103, + }, + Object { + "actualText": "945", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "945", + ], + "originalText": 945, + "width": 103, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 64, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 103, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 64, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 103, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 64, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 103, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 64, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 103, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 30, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 103, + }, + Object { + "actualText": "1354", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1354", + ], + "originalText": 1354, + "width": 103, + }, + Object { + "actualText": "1523", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1523", + ], + "originalText": 1523, + "width": 103, + }, + Object { + "actualText": "1634", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1634", + ], + "originalText": 1634, + "width": 103, + }, + Object { + "actualText": "1343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1343", + ], + "originalText": 1343, + "width": 103, + }, + Object { + "actualText": undefined, "actualTextHeight": 0, "actualTextWidth": 0, + "height": 64, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 103, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 64, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 103, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render two max text lines 1`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 48, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 48, + "multiLineActualTexts": Array [ + "省份", + ], + "originalText": "省份", + "width": 96, + }, + Object { + "actualText": "城市城市城市城市城市城...", + "actualTextHeight": 32, + "actualTextWidth": 144, + "height": 48, + "multiLineActualTexts": Array [ + "城市城市城市", + "城市城市城...", + ], + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "width": 96, + }, + Object { + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 16, + "actualTextWidth": 241, + "height": 48, + "multiLineActualTexts": Array [ + "类别类别类别类别类别类别类别类别类别类别", + ], + "originalText": "类别类别类别类别类别类别类别类别类别类别", + "width": 272, + }, + Object { + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 48, + "multiLineActualTexts": Array [ + "子类别", + ], + "originalText": "子类别", + "width": 272, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render two max text lines 2`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 120, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": "1", + "width": 80, + }, + Object { + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 48, + "multiLineActualTexts": Array [ + "2", + ], + "originalText": "2", + "width": 80, + }, + Object { + "actualText": "3", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 120, + "multiLineActualTexts": Array [ + "3", + ], + "originalText": "3", + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render two max text lines 3`] = ` +Array [ + Object { + "actualText": "家具", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 48, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 192, + }, + Object { + "actualText": "桌子", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 48, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 96, + }, + Object { + "actualText": "数量数量数量数量数量数...", + "actualTextHeight": 30, + "actualTextWidth": 144, + "height": 48, + "multiLineActualTexts": Array [ + "数量数量数量", + "数量数量数...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 48, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 96, + }, + Object { + "actualText": "数量数量数量数量数量数...", + "actualTextHeight": 30, + "actualTextWidth": 144, + "height": 48, + "multiLineActualTexts": Array [ + "数量数量数量", + "数量数量数...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render two max text lines 4`] = ` +Array [ + Object { + "actualText": "浙江省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 120, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 96, + }, + Object { + "actualText": "浙江省浙江省浙江省浙江...", + "actualTextHeight": 32, + "actualTextWidth": 144, + "height": 48, + "multiLineActualTexts": Array [ + "浙江省浙江省", + "浙江省浙江...", + ], + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "width": 96, + }, + Object { + "actualText": "四川省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 120, + "multiLineActualTexts": Array [ + "四川省", + ], + "originalText": "四川省", + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render two max text lines 5`] = ` +Array [ + Object { + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 99, + "height": 30, + "multiLineActualTexts": Array [ + "23672367236", + "1111", + ], + "originalText": 236723672361111, + "width": 96, + }, + Object { + "actualText": "3877", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "3877", + ], + "originalText": 3877, + "width": 96, + }, + Object { + "actualText": "4342", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "4342", + ], + "originalText": 4342, + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 48, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "1723", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1723", + ], + "originalText": 1723, + "width": 96, + }, + Object { + "actualText": "1822", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1822", + ], + "originalText": 1822, + "width": 96, + }, + Object { + "actualText": "1943", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1943", + ], + "originalText": 1943, + "width": 96, + }, + Object { + "actualText": "632", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "632", + ], + "originalText": 632, + "width": 96, + }, + Object { + "actualText": "7234", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "7234", + ], + "originalText": 7234, + "width": 96, + }, + Object { + "actualText": "834", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "834", + ], + "originalText": 834, + "width": 96, + }, + Object { + "actualText": "5343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "5343", + ], + "originalText": 5343, + "width": 96, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 48, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, + Object { + "actualText": "2451", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2451", + ], + "originalText": 2451, + "width": 96, + }, + Object { + "actualText": "2244", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2244", + ], + "originalText": 2244, + "width": 96, + }, + Object { + "actualText": "2333", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2333", + ], + "originalText": 2333, + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should use actual text height for large max line 1`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 80, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 80, + "multiLineActualTexts": Array [ + "省份", + ], + "originalText": "省份", + "width": 102.57, + }, + Object { + "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "actualTextHeight": 64, + "actualTextWidth": 292, + "height": 80, + "multiLineActualTexts": Array [ + "城市城市城市城", + "市城市城市城市", + "城市城市城市城", + "市城市", + ], + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "width": 102.57, + }, + Object { + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 16, + "actualTextWidth": 241, + "height": 80, + "multiLineActualTexts": Array [ + "类别类别类别类别类别类别类别类别类别类别", + ], + "originalText": "类别类别类别类别类别类别类别类别类别类别", + "width": 285.14, + }, + Object { + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 96, + "multiLineActualTexts": Array [ + "子类别", + ], + "originalText": "子类别", + "width": 285.14, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should use actual text height for large max line 2`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 120, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": "1", + "width": 80, + }, + Object { + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 96, + "multiLineActualTexts": Array [ + "2", + ], + "originalText": "2", + "width": 80, + }, + Object { + "actualText": "3", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 120, + "multiLineActualTexts": Array [ + "3", + ], + "originalText": "3", + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should use actual text height for large max line 3`] = ` +Array [ + Object { + "actualText": "家具", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 80, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 205.14, + }, + Object { + "actualText": "桌子", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 96, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 102.57, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 60, + "actualTextWidth": 268, + "height": 80, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量数", + "量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 102.57, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 96, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 102.57, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 60, + "actualTextWidth": 268, + "height": 80, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量数", + "量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 102.57, + }, + Object { + "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "actualTextHeight": 64, + "actualTextWidth": 340, + "height": 80, + "multiLineActualTexts": Array [ + "家具家具家具家", + "具家具家具家具", + "家具家具家具家", + "具家具家具家具", + ], + "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "width": 102.57, + }, + Object { + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "actualTextHeight": 80, + "actualTextWidth": 365, + "height": 96, + "multiLineActualTexts": Array [ + "桌子桌子桌子桌", + "子桌子桌子桌子", + "桌子桌子桌子桌", + "子桌子桌子桌子", + "桌子", + ], + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "width": 102.57, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 60, + "actualTextWidth": 268, + "height": 80, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量数", + "量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 102.57, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 16, + "actualTextWidth": 49, + "height": 80, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 205.14, + }, + Object { + "actualText": "笔", + "actualTextHeight": 16, + "actualTextWidth": 13, + "height": 96, + "multiLineActualTexts": Array [ + "笔", + ], + "originalText": "笔", + "width": 102.57, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 60, + "actualTextWidth": 268, + "height": 80, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量数", + "量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 102.57, + }, + Object { + "actualText": "纸张", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 96, + "multiLineActualTexts": Array [ + "纸张", + ], + "originalText": "纸张", + "width": 102.57, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 60, + "actualTextWidth": 268, + "height": 80, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量数", + "量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 102.57, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should use actual text height for large max line 4`] = ` +Array [ + Object { + "actualText": "浙江省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 120, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 102.57, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 102.57, + }, + Object { + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "宁波市", + ], + "originalText": "宁波市", + "width": 102.57, + }, + Object { + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "舟山市", + ], + "originalText": "舟山市", + "width": 102.57, + }, + Object { + "actualText": "杭州市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "杭州市", + ], + "originalText": "杭州市", + "width": 102.57, + }, + Object { + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "actualTextHeight": 80, + "actualTextWidth": 365, + "height": 96, + "multiLineActualTexts": Array [ + "浙江省浙江省浙", + "江省浙江省浙江", + "省浙江省浙江省", + "浙江省浙江省浙", + "江省", + ], + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "width": 102.57, + }, + Object { + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "actualTextHeight": 75, + "actualTextWidth": 365, + "height": 96, + "multiLineActualTexts": Array [ + "杭州市杭州市杭", + "州市杭州市杭州", + "市杭州市杭州市", + "杭州市杭州市杭", + "州市", + ], + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "width": 102.57, + }, + Object { + "actualText": "四川省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 120, + "multiLineActualTexts": Array [ + "四川省", + ], + "originalText": "四川省", + "width": 102.57, + }, + Object { + "actualText": "成都市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "成都市", + ], + "originalText": "成都市", + "width": 102.57, + }, + Object { + "actualText": "绵阳市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绵阳市", + ], + "originalText": "绵阳市", + "width": 102.57, + }, + Object { + "actualText": "南充市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "南充市", + ], + "originalText": "南充市", + "width": 102.57, + }, + Object { + "actualText": "乐山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "乐山市", + ], + "originalText": "乐山市", + "width": 102.57, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should use actual text height for large max line 5`] = ` +Array [ + Object { + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 30, + "multiLineActualTexts": Array [ + "236723672361", + "111", + ], + "originalText": 236723672361111, + "width": 102.57, + }, + Object { + "actualText": "3877", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "3877", + ], + "originalText": 3877, + "width": 102.57, + }, + Object { + "actualText": "4342", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "4342", + ], + "originalText": 4342, + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 96, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "1723", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1723", + ], + "originalText": 1723, + "width": 102.57, + }, + Object { + "actualText": "1822", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1822", + ], + "originalText": 1822, + "width": 102.57, + }, + Object { + "actualText": "1943", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1943", + ], + "originalText": 1943, + "width": 102.57, + }, + Object { + "actualText": "2330", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2330", + ], + "originalText": 2330, + "width": 102.57, + }, + Object { + "actualText": "632", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "632", + ], + "originalText": 632, + "width": 102.57, + }, + Object { + "actualText": "7234", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "7234", + ], + "originalText": 7234, + "width": 102.57, + }, + Object { + "actualText": "834", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "834", + ], + "originalText": 834, + "width": 102.57, + }, + Object { + "actualText": "5343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "5343", + ], + "originalText": 5343, + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 96, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "2451", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2451", + ], + "originalText": 2451, + "width": 102.57, + }, + Object { + "actualText": "2244", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2244", + ], + "originalText": 2244, + "width": 102.57, + }, + Object { + "actualText": "2333", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2333", + ], + "originalText": 2333, + "width": 102.57, + }, + Object { + "actualText": "2445", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2445", + ], + "originalText": 2445, + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "7789778977897789778977897789", + "actualTextHeight": 45, + "actualTextWidth": 189, + "height": 96, + "multiLineActualTexts": Array [ + "778977897789", + "778977897789", + "7789", + ], + "originalText": "7789778977897789778977897789", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "1304", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1304", + ], + "originalText": 1304, + "width": 102.57, + }, + Object { + "actualText": "1145", + "actualTextHeight": 15, + "actualTextWidth": 26, + "height": 30, + "multiLineActualTexts": Array [ + "1145", + ], + "originalText": 1145, + "width": 102.57, + }, + Object { + "actualText": "1432", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1432", + ], + "originalText": 1432, + "width": 102.57, + }, + Object { + "actualText": "945", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "945", + ], + "originalText": 945, + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 96, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "2335", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2335", + ], + "originalText": 2335, + "width": 102.57, + }, + Object { + "actualText": "245", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "245", + ], + "originalText": 245, + "width": 102.57, + }, + Object { + "actualText": "2457", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2457", + ], + "originalText": 2457, + "width": 102.57, + }, + Object { + "actualText": "2458", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "2458", + ], + "originalText": 2458, + "width": 102.57, + }, + Object { + "actualText": "1354", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1354", + ], + "originalText": 1354, + "width": 102.57, + }, + Object { + "actualText": "1523", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1523", + ], + "originalText": 1523, + "width": 102.57, + }, + Object { + "actualText": "1634", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1634", + ], + "originalText": 1634, + "width": 102.57, + }, + Object { + "actualText": "1343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1343", + ], + "originalText": 1343, + "width": 102.57, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 96, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 102.57, + }, + Object { + "actualText": "4004", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "4004", + ], + "originalText": 4004, + "width": 102.57, + }, + Object { + "actualText": "3077", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "3077", + ], + "originalText": 3077, + "width": 102.57, + }, + Object { + "actualText": "3551", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "3551", + ], + "originalText": 3551, + "width": 102.57, + }, + Object { + "actualText": "352", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "352", + ], + "originalText": 352, + "width": 102.57, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly col cell height if actual text lines is difference 1`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 80, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly col cell height if actual text lines is difference 2`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 46, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": 1, + "width": 80, + }, + Object { + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 76, + "multiLineActualTexts": Array [ + "2", + ], + "originalText": 2, + "width": 80, + }, + Object { + "actualText": "3", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 46, + "multiLineActualTexts": Array [ + "3", + ], + "originalText": 3, + "width": 80, + }, + Object { + "actualText": "4", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "4", + ], + "originalText": 4, + "width": 80, + }, + Object { + "actualText": "5", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "5", + ], + "originalText": 5, + "width": 80, + }, + Object { + "actualText": "6", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "6", + ], + "originalText": 6, + "width": 80, + }, + Object { + "actualText": "7", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "7", + ], + "originalText": 7, + "width": 80, + }, + Object { + "actualText": "8", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "8", + ], + "originalText": 8, + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly col cell height if actual text lines is difference 3`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 80, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份省份省份省份省份省份省份省份省份省份省份省份省份省...", + "actualTextHeight": 64, + "actualTextWidth": 338, + "height": 80, + "multiLineActualTexts": Array [ + "省份省份省份省", + "份省份省份省份", + "省份省份省份省", + "份省份省份省...", + ], + "originalText": "省份省份省份省份省份省份省份省份省份省份省份省份省份省份省份省份省份省份省份省份", + "width": 103.8, + }, + Object { + "actualText": "city", + "actualTextHeight": 16, + "actualTextWidth": 21, + "height": 80, + "multiLineActualTexts": Array [ + "city", + ], + "originalText": "city", + "width": 103.8, + }, + Object { + "actualText": "type", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 80, + "multiLineActualTexts": Array [ + "type", + ], + "originalText": "type", + "width": 103.8, + }, + Object { + "actualText": "sub_type", + "actualTextHeight": 16, + "actualTextWidth": 53, + "height": 80, + "multiLineActualTexts": Array [ + "sub_type", + ], + "originalText": "sub_type", + "width": 103.8, + }, + Object { + "actualText": "number", + "actualTextHeight": 16, + "actualTextWidth": 45, + "height": 80, + "multiLineActualTexts": Array [ + "number", + ], + "originalText": "number", + "width": 103.8, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly col cell height if actual text lines is difference 4`] = `Array []`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly col cell height if actual text lines is difference 5`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 46, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": 1, + "width": 80, + }, + Object { + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 76, + "multiLineActualTexts": Array [ + "2", + ], + "originalText": 2, + "width": 80, + }, + Object { + "actualText": "3", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 46, + "multiLineActualTexts": Array [ + "3", + ], + "originalText": 3, + "width": 80, + }, + Object { + "actualText": "4", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "4", + ], + "originalText": 4, + "width": 80, + }, + Object { + "actualText": "5", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "5", + ], + "originalText": 5, + "width": 80, + }, + Object { + "actualText": "6", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "6", + ], + "originalText": 6, + "width": 80, + }, + Object { + "actualText": "7", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "7", + ], + "originalText": 7, + "width": 80, + }, + Object { + "actualText": "8", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "8", + ], + "originalText": 8, + "width": 80, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 46, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省...", + "actualTextHeight": 60, + "actualTextWidth": 338, + "height": 76, + "multiLineActualTexts": Array [ + "浙江省浙江省浙", + "江省浙江省浙江", + "省浙江省浙江省", + "浙江省浙江省...", + ], + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 46, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 46, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 103.8, + }, + Object { + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市...", + "actualTextHeight": 60, + "actualTextWidth": 338, + "height": 76, + "multiLineActualTexts": Array [ + "杭州市杭州市杭", + "州市杭州市杭州", + "市杭州市杭州市", + "杭州市杭州市...", + ], + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "width": 103.8, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 46, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 103.8, + }, + Object { + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "宁波市", + ], + "originalText": "宁波市", + "width": 103.8, + }, + Object { + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "舟山市", + ], + "originalText": "舟山市", + "width": 103.8, + }, + Object { + "actualText": "杭州市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "杭州市", + ], + "originalText": "杭州市", + "width": 103.8, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 103.8, + }, + Object { + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "宁波市", + ], + "originalText": "宁波市", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 46, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "actualTextHeight": 60, + "actualTextWidth": 340, + "height": 76, + "multiLineActualTexts": Array [ + "家具家具家具家", + "具家具家具家具", + "家具家具家具家", + "具家具家具家具", + ], + "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 46, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "桌子", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 46, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 103.8, + }, + Object { + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌...", + "actualTextHeight": 60, + "actualTextWidth": 338, + "height": 76, + "multiLineActualTexts": Array [ + "桌子桌子桌子桌", + "子桌子桌子桌子", + "桌子桌子桌子桌", + "子桌子桌子桌...", + ], + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "width": 103.8, + }, + Object { + "actualText": "桌子", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 46, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 103.8, + }, + Object { + "actualText": "桌子", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 103.8, + }, + Object { + "actualText": "桌子", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 103.8, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 103.8, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 103.8, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 103.8, + }, + Object { + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 46, + "multiLineActualTexts": Array [ + "2367236723611", + "11", + ], + "originalText": 236723672361111, + "width": 103.8, + }, + Object { + "actualText": "7789778977897789778977897789", + "actualTextHeight": 45, + "actualTextWidth": 189, + "height": 76, + "multiLineActualTexts": Array [ + "7789778977897", + "7897789778977", + "89", + ], + "originalText": "7789778977897789778977897789", + "width": 103.8, + }, + Object { + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 46, + "multiLineActualTexts": Array [ + "2367236723611", + "11", + ], + "originalText": 236723672361111, + "width": 103.8, + }, + Object { + "actualText": "3877", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "3877", + ], + "originalText": 3877, + "width": 103.8, + }, + Object { + "actualText": "4342", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "4342", + ], + "originalText": 4342, + "width": 103.8, + }, + Object { + "actualText": "5343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "5343", + ], + "originalText": 5343, + "width": 103.8, + }, + Object { + "actualText": "632", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "632", + ], + "originalText": 632, + "width": 103.8, + }, + Object { + "actualText": "7234", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "7234", + ], + "originalText": 7234, + "width": 103.8, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference 1`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 80, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference 2`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 46, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": 1, + "width": 80, + }, + Object { + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 76, + "multiLineActualTexts": Array [ + "2", + ], + "originalText": 2, + "width": 80, + }, + Object { + "actualText": "3", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 46, + "multiLineActualTexts": Array [ + "3", + ], + "originalText": 3, + "width": 80, + }, + Object { + "actualText": "4", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "4", + ], + "originalText": 4, + "width": 80, + }, + Object { + "actualText": "5", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "5", + ], + "originalText": 5, + "width": 80, + }, + Object { + "actualText": "6", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "6", + ], + "originalText": 6, + "width": 80, + }, + Object { + "actualText": "7", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "7", + ], + "originalText": 7, + "width": 80, + }, + Object { + "actualText": "8", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "8", + ], + "originalText": 8, + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference 3`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 80, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 80, + "multiLineActualTexts": Array [ + "省份", + ], + "originalText": "省份", + "width": 103.8, + }, + Object { + "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "actualTextHeight": 64, + "actualTextWidth": 292, + "height": 80, + "multiLineActualTexts": Array [ + "城市城市城市城", + "市城市城市城市", + "城市城市城市城", + "市城市", + ], + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "width": 103.8, + }, + Object { + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 48, + "actualTextWidth": 243, + "height": 80, + "multiLineActualTexts": Array [ + "类别类别类别类", + "别类别类别类别", + "类别类别类别", + ], + "originalText": "类别类别类别类别类别类别类别类别类别类别", + "width": 103.8, + }, + Object { + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 80, + "multiLineActualTexts": Array [ + "子类别", + ], + "originalText": "子类别", + "width": 103.8, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 64, + "actualTextWidth": 268, + "height": 80, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量数", + "量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 103.8, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference 4`] = `Array []`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference 5`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 46, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": 1, + "width": 80, + }, + Object { + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 76, + "multiLineActualTexts": Array [ + "2", + ], + "originalText": 2, + "width": 80, + }, + Object { + "actualText": "3", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 46, + "multiLineActualTexts": Array [ + "3", + ], + "originalText": 3, + "width": 80, + }, + Object { + "actualText": "4", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "4", + ], + "originalText": 4, + "width": 80, + }, + Object { + "actualText": "5", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "5", + ], + "originalText": 5, + "width": 80, + }, + Object { + "actualText": "6", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "6", + ], + "originalText": 6, + "width": 80, + }, + Object { + "actualText": "7", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "7", + ], + "originalText": 7, + "width": 80, + }, + Object { + "actualText": "8", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "8", + ], + "originalText": 8, + "width": 80, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 46, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省...", + "actualTextHeight": 60, + "actualTextWidth": 338, + "height": 76, + "multiLineActualTexts": Array [ + "浙江省浙江省浙", + "江省浙江省浙江", + "省浙江省浙江省", + "浙江省浙江省...", + ], + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 46, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 46, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 103.8, + }, + Object { + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市...", + "actualTextHeight": 60, + "actualTextWidth": 338, + "height": 76, + "multiLineActualTexts": Array [ + "杭州市杭州市杭", + "州市杭州市杭州", + "市杭州市杭州市", + "杭州市杭州市...", + ], + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "width": 103.8, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 46, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 103.8, + }, + Object { + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "宁波市", + ], + "originalText": "宁波市", + "width": 103.8, + }, + Object { + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "舟山市", + ], + "originalText": "舟山市", + "width": 103.8, + }, + Object { + "actualText": "杭州市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "杭州市", + ], + "originalText": "杭州市", + "width": 103.8, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 103.8, + }, + Object { + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "宁波市", + ], + "originalText": "宁波市", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 46, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "actualTextHeight": 60, + "actualTextWidth": 340, + "height": 76, + "multiLineActualTexts": Array [ + "家具家具家具家", + "具家具家具家具", + "家具家具家具家", + "具家具家具家具", + ], + "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 46, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "桌子", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 46, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 103.8, + }, + Object { + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌...", + "actualTextHeight": 60, + "actualTextWidth": 338, + "height": 76, + "multiLineActualTexts": Array [ + "桌子桌子桌子桌", + "子桌子桌子桌子", + "桌子桌子桌子桌", + "子桌子桌子桌...", + ], + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "width": 103.8, + }, + Object { + "actualText": "桌子", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 46, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 103.8, + }, + Object { + "actualText": "桌子", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 103.8, + }, + Object { + "actualText": "桌子", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 103.8, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 103.8, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 103.8, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 103.8, + }, + Object { + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 46, + "multiLineActualTexts": Array [ + "2367236723611", + "11", + ], + "originalText": 236723672361111, + "width": 103.8, + }, + Object { + "actualText": "7789778977897789778977897789", + "actualTextHeight": 45, + "actualTextWidth": 189, + "height": 76, + "multiLineActualTexts": Array [ + "7789778977897", + "7897789778977", + "89", + ], + "originalText": "7789778977897789778977897789", + "width": 103.8, + }, + Object { + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 46, + "multiLineActualTexts": Array [ + "2367236723611", + "11", + ], + "originalText": 236723672361111, + "width": 103.8, + }, + Object { + "actualText": "3877", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "3877", + ], + "originalText": 3877, + "width": 103.8, + }, + Object { + "actualText": "4342", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "4342", + ], + "originalText": 4342, + "width": 103.8, + }, + Object { + "actualText": "5343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "5343", + ], + "originalText": 5343, + "width": 103.8, + }, + Object { + "actualText": "632", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, + "multiLineActualTexts": Array [ + "632", + ], + "originalText": 632, + "width": 103.8, + }, + Object { + "actualText": "7234", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "7234", + ], + "originalText": 7234, + "width": 103.8, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and outside the canvas 1`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 80, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and outside the canvas 2`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 360, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": 1, + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and outside the canvas 3`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 80, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 80, + "multiLineActualTexts": Array [ + "省份", + ], + "originalText": "省份", + "width": 103.8, + }, + Object { + "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "actualTextHeight": 64, + "actualTextWidth": 292, + "height": 80, + "multiLineActualTexts": Array [ + "城市城市城市城", + "市城市城市城市", + "城市城市城市城", + "市城市", + ], + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "width": 103.8, + }, + Object { + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 48, + "actualTextWidth": 243, + "height": 80, + "multiLineActualTexts": Array [ + "类别类别类别类", + "别类别类别类别", + "类别类别类别", + ], + "originalText": "类别类别类别类别类别类别类别类别类别类别", + "width": 103.8, + }, + Object { + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 80, + "multiLineActualTexts": Array [ + "子类别", + ], + "originalText": "子类别", + "width": 103.8, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 64, + "actualTextWidth": 268, + "height": 80, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量数", + "量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 103.8, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and outside the canvas 4`] = `Array []`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and outside the canvas 5`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 360, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": 1, + "width": 80, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 360, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 360, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 360, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "桌子", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 360, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 103.8, + }, + Object { + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 360, + "multiLineActualTexts": Array [ + "2367236723611", + "11", + ], + "originalText": 236723672361111, + "width": 103.8, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and outside the canvas 6`] = ` +Array [ + 0, + 360, + 436, + 482, + 512, + 542, + 572, + 602, + 632, + 662, + 692, + 722, + 752, + 782, + 812, + 842, + 872, + 902, + 932, + 962, + 992, + 1022, + 1052, + 1082, + 1112, + 1142, + 1172, + 1202, + 1232, + 1262, + 1292, + 1322, + 1352, + 1382, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and partial outside the canvas 1`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 80, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and partial outside the canvas 2`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 300, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": 1, + "width": 80, + }, + Object { + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 76, + "multiLineActualTexts": Array [ + "2", + ], + "originalText": 2, + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and partial outside the canvas 3`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 80, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 80, + "multiLineActualTexts": Array [ + "省份", + ], + "originalText": "省份", + "width": 103.8, + }, + Object { + "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "actualTextHeight": 64, + "actualTextWidth": 292, + "height": 80, + "multiLineActualTexts": Array [ + "城市城市城市城", + "市城市城市城市", + "城市城市城市城", + "市城市", + ], + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "width": 103.8, + }, + Object { + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 48, + "actualTextWidth": 243, + "height": 80, + "multiLineActualTexts": Array [ + "类别类别类别类", + "别类别类别类别", + "类别类别类别", + ], + "originalText": "类别类别类别类别类别类别类别类别类别类别", + "width": 103.8, + }, + Object { + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 80, + "multiLineActualTexts": Array [ + "子类别", + ], + "originalText": "子类别", + "width": 103.8, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 64, + "actualTextWidth": 268, + "height": 80, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量数", + "量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 103.8, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and partial outside the canvas 4`] = `Array []`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and partial outside the canvas 5`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 300, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": 1, + "width": 80, + }, + Object { + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 76, + "multiLineActualTexts": Array [ + "2", + ], + "originalText": 2, + "width": 80, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 300, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省...", + "actualTextHeight": 60, + "actualTextWidth": 338, + "height": 76, + "multiLineActualTexts": Array [ + "浙江省浙江省浙", + "江省浙江省浙江", + "省浙江省浙江省", + "浙江省浙江省...", + ], + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "width": 103.8, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 300, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 103.8, + }, + Object { + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市...", + "actualTextHeight": 60, + "actualTextWidth": 338, + "height": 76, + "multiLineActualTexts": Array [ + "杭州市杭州市杭", + "州市杭州市杭州", + "市杭州市杭州市", + "杭州市杭州市...", + ], + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 300, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "actualTextHeight": 60, + "actualTextWidth": 340, + "height": 76, + "multiLineActualTexts": Array [ + "家具家具家具家", + "具家具家具家具", + "家具家具家具家", + "具家具家具家具", + ], + "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "width": 103.8, + }, + Object { + "actualText": "桌子", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 300, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 103.8, + }, + Object { + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌...", + "actualTextHeight": 60, + "actualTextWidth": 338, + "height": 76, + "multiLineActualTexts": Array [ + "桌子桌子桌子桌", + "子桌子桌子桌子", + "桌子桌子桌子桌", + "子桌子桌子桌...", + ], + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "width": 103.8, + }, + Object { + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 300, + "multiLineActualTexts": Array [ + "2367236723611", + "11", + ], + "originalText": 236723672361111, + "width": 103.8, + }, + Object { + "actualText": "7789778977897789778977897789", + "actualTextHeight": 45, + "actualTextWidth": 189, + "height": 76, + "multiLineActualTexts": Array [ + "7789778977897", + "7897789778977", + "89", + ], + "originalText": "7789778977897789778977897789", + "width": 103.8, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and partial outside the canvas 6`] = ` +Array [ + 0, + 300, + 376, + 422, + 452, + 482, + 512, + 542, + 572, + 602, + 632, + 662, + 692, + 722, + 752, + 782, + 812, + 842, + 872, + 902, + 932, + 962, + 992, + 1022, + 1052, + 1082, + 1112, + 1142, + 1172, + 1202, + 1232, + 1262, + 1292, + 1322, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly row cell height if actual text lines is difference 1`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly row cell height if actual text lines is difference 2`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 46, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": 1, + "width": 80, + }, + Object { + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "2", + ], + "originalText": 2, + "width": 80, + }, + Object { + "actualText": "3", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 61, + "multiLineActualTexts": Array [ + "3", + ], + "originalText": 3, + "width": 80, + }, + Object { + "actualText": "4", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "4", + ], + "originalText": 4, + "width": 80, + }, + Object { + "actualText": "5", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "5", + ], + "originalText": 5, + "width": 80, + }, + Object { + "actualText": "6", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "6", + ], + "originalText": 6, + "width": 80, + }, + Object { + "actualText": "7", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "7", + ], + "originalText": 7, + "width": 80, + }, + Object { + "actualText": "8", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "8", + ], + "originalText": 8, + "width": 80, + }, + Object { + "actualText": "9", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "9", + ], + "originalText": 9, + "width": 80, + }, + Object { + "actualText": "10", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "10", + ], + "originalText": 10, + "width": 80, + }, + Object { + "actualText": "11", + "actualTextHeight": 15, + "actualTextWidth": 13, + "height": 30, + "multiLineActualTexts": Array [ + "11", + ], + "originalText": 11, + "width": 80, + }, + Object { + "actualText": "12", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "12", + ], + "originalText": 12, + "width": 80, + }, + Object { + "actualText": "13", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "13", + ], + "originalText": 13, + "width": 80, + }, + Object { + "actualText": "14", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "14", + ], + "originalText": 14, + "width": 80, + }, + Object { + "actualText": "15", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "15", + ], + "originalText": 15, + "width": 80, + }, + Object { + "actualText": "16", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "16", + ], + "originalText": 16, + "width": 80, + }, + Object { + "actualText": "17", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "17", + ], + "originalText": 17, + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly row cell height if actual text lines is difference 3`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, + "multiLineActualTexts": Array [ + "省份", + ], + "originalText": "省份", + "width": 143.8, + }, + Object { + "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "actualTextHeight": 48, + "actualTextWidth": 291, + "height": 64, + "multiLineActualTexts": Array [ + "城市城市城市城市城市", + "城市城市城市城市城市", + "城市城市", + ], + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "width": 143.8, + }, + Object { + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 32, + "actualTextWidth": 242, + "height": 64, + "multiLineActualTexts": Array [ + "类别类别类别类别类别", + "类别类别类别类别类别", + ], + "originalText": "类别类别类别类别类别类别类别类别类别类别", + "width": 143.8, + }, + Object { + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 64, + "multiLineActualTexts": Array [ + "子类别", + ], + "originalText": "子类别", + "width": 143.8, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 48, + "actualTextWidth": 267, + "height": 64, + "multiLineActualTexts": Array [ + "数量数量数量数量数量", + "数量数量数量数量数量", + "数量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 143.8, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly row cell height if actual text lines is difference 4`] = `Array []`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly row cell height if actual text lines is difference 5`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 46, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": 1, + "width": 80, + }, + Object { + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "2", + ], + "originalText": 2, + "width": 80, + }, + Object { + "actualText": "3", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 61, + "multiLineActualTexts": Array [ + "3", + ], + "originalText": 3, + "width": 80, + }, + Object { + "actualText": "4", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "4", + ], + "originalText": 4, + "width": 80, + }, + Object { + "actualText": "5", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "5", + ], + "originalText": 5, + "width": 80, + }, + Object { + "actualText": "6", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "6", + ], + "originalText": 6, + "width": 80, + }, + Object { + "actualText": "7", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "7", + ], + "originalText": 7, + "width": 80, + }, + Object { + "actualText": "8", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "8", + ], + "originalText": 8, + "width": 80, + }, + Object { + "actualText": "9", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "9", + ], + "originalText": 9, + "width": 80, + }, + Object { + "actualText": "10", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "10", + ], + "originalText": 10, + "width": 80, + }, + Object { + "actualText": "11", + "actualTextHeight": 15, + "actualTextWidth": 13, + "height": 30, + "multiLineActualTexts": Array [ + "11", + ], + "originalText": 11, + "width": 80, + }, + Object { + "actualText": "12", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "12", + ], + "originalText": 12, + "width": 80, + }, + Object { + "actualText": "13", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "13", + ], + "originalText": 13, + "width": 80, + }, + Object { + "actualText": "14", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "14", + ], + "originalText": 14, + "width": 80, + }, + Object { + "actualText": "15", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "15", + ], + "originalText": 15, + "width": 80, + }, + Object { + "actualText": "16", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "16", + ], + "originalText": 16, + "width": 80, + }, + Object { + "actualText": "17", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "17", + ], + "originalText": 17, + "width": 80, + }, + Object { + "actualText": "浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江", + "actualTextHeight": 30, + "actualTextWidth": 242, + "height": 46, + "multiLineActualTexts": Array [ + "浙江浙江浙江浙江浙江", + "浙江浙江浙江浙江浙江", + ], + "originalText": "浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江", + "width": 143.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 143.8, + }, + Object { + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "actualTextHeight": 45, + "actualTextWidth": 363, + "height": 61, + "multiLineActualTexts": Array [ + "浙江省浙江省浙江省浙", + "江省浙江省浙江省浙江", + "省浙江省浙江省浙江省", + ], + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "width": 143.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 143.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 143.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 143.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 143.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 143.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 143.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 143.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 143.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 143.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 143.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 143.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 143.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 143.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, "height": 30, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "2335", + "actualText": "杭州杭州杭州杭州", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 97, + "height": 46, + "multiLineActualTexts": Array [ + "杭州杭州杭州杭州", + ], + "originalText": "杭州杭州杭州杭州", + "width": 143.8, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "2335", + "绍兴市", ], - "originalText": 2335, - "width": 103, + "originalText": "绍兴市", + "width": 143.8, }, Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 56, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "actualTextHeight": 45, + "actualTextWidth": 363, + "height": 61, + "multiLineActualTexts": Array [ + "杭州市杭州市杭州市杭", + "州市杭州市杭州市杭州", + "市杭州市杭州市杭州市", + ], + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "width": 143.8, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 143.8, + }, + Object { + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "宁波市", + ], + "originalText": "宁波市", + "width": 143.8, + }, + Object { + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "舟山市", + ], + "originalText": "舟山市", + "width": 143.8, + }, + Object { + "actualText": "杭州市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "杭州市", + ], + "originalText": "杭州市", + "width": 143.8, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 143.8, + }, + Object { + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "宁波市", + ], + "originalText": "宁波市", + "width": 143.8, + }, + Object { + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "舟山市", + ], + "originalText": "舟山市", + "width": 143.8, + }, + Object { + "actualText": "杭州市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "杭州市", + ], + "originalText": "杭州市", + "width": 143.8, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 143.8, + }, + Object { + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "宁波市", + ], + "originalText": "宁波市", + "width": 143.8, + }, + Object { + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "舟山市", + ], + "originalText": "舟山市", + "width": 143.8, + }, + Object { + "actualText": "杭州市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "杭州市", + ], + "originalText": "杭州市", + "width": 143.8, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 143.8, + }, + Object { + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "宁波市", + ], + "originalText": "宁波市", + "width": 143.8, + }, + Object { + "actualText": "纸张纸张纸张纸张纸张", + "actualTextHeight": 15, + "actualTextWidth": 121, + "height": 46, + "multiLineActualTexts": Array [ + "纸张纸张纸张纸张纸张", + ], + "originalText": "纸张纸张纸张纸张纸张", + "width": 143.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 143.8, + }, + Object { + "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "actualTextHeight": 45, + "actualTextWidth": 339, + "height": 61, + "multiLineActualTexts": Array [ + "家具家具家具家具家具", + "家具家具家具家具家具", + "家具家具家具家具", + ], + "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "width": 143.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 143.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 143.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 143.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 143.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 143.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 143.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 143.8, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 30, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 143.8, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 30, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 143.8, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 30, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 143.8, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 30, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 143.8, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 30, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 143.8, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 30, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 143.8, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 30, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 143.8, }, Object { "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 56, + "height": 46, "multiLineActualTexts": Array [ "-", ], "originalText": "-", - "width": 103, + "width": 143.8, }, Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, + "actualText": "桌子", + "actualTextHeight": 15, + "actualTextWidth": 25, "height": 30, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 143.8, }, Object { - "actualText": "1354", + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "actualTextHeight": 45, + "actualTextWidth": 363, + "height": 61, + "multiLineActualTexts": Array [ + "桌子桌子桌子桌子桌子", + "桌子桌子桌子桌子桌子", + "桌子桌子桌子桌子桌子", + ], + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "width": 143.8, + }, + Object { + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "1354", + "桌子", ], - "originalText": 1354, - "width": 103, + "originalText": "桌子", + "width": 143.8, }, Object { - "actualText": "1523", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "1523", + "桌子", ], - "originalText": 1523, - "width": 103, + "originalText": "桌子", + "width": 143.8, }, Object { - "actualText": "1634", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "1634", + "桌子", ], - "originalText": 1634, - "width": 103, + "originalText": "桌子", + "width": 143.8, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 143.8, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 143.8, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 143.8, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 143.8, + }, + Object { + "actualText": "笔", + "actualTextHeight": 15, + "actualTextWidth": 13, + "height": 30, + "multiLineActualTexts": Array [ + "笔", + ], + "originalText": "笔", + "width": 143.8, }, Object { - "actualText": "1343", + "actualText": "笔", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 13, "height": 30, "multiLineActualTexts": Array [ - "1343", + "笔", ], - "originalText": 1343, - "width": 103, - }, - Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 56, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "originalText": "笔", + "width": 143.8, }, Object { - "actualText": "-", + "actualText": "笔", "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 56, + "actualTextWidth": 13, + "height": 30, "multiLineActualTexts": Array [ - "-", + "笔", ], - "originalText": "-", - "width": 103, - }, - Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 30, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "originalText": "笔", + "width": 143.8, }, Object { - "actualText": "4004", + "actualText": "笔", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 13, "height": 30, "multiLineActualTexts": Array [ - "4004", + "笔", ], - "originalText": 4004, - "width": 103, + "originalText": "笔", + "width": 143.8, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render two max text lines 1`] = ` -Array [ Object { - "actualText": "序号", - "actualTextHeight": 16, + "actualText": "纸张", + "actualTextHeight": 15, "actualTextWidth": 25, - "height": 38, + "height": 30, "multiLineActualTexts": Array [ - "序号", + "纸张", ], - "originalText": "序号", - "width": 80, + "originalText": "纸张", + "width": 143.8, }, Object { - "actualText": "省份", - "actualTextHeight": 16, + "actualText": "纸张", + "actualTextHeight": 15, "actualTextWidth": 25, - "height": 38, + "height": 30, "multiLineActualTexts": Array [ - "省份", + "纸张", ], - "originalText": "省份", - "width": 96, + "originalText": "纸张", + "width": 143.8, }, Object { - "actualText": "城市城市城市城市城市城...", - "actualTextHeight": 32, - "actualTextWidth": 144, - "height": 38, + "actualText": "纸张", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "城市城市城市", - "城市城市城...", + "纸张", ], - "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "width": 96, + "originalText": "纸张", + "width": 143.8, }, Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", - "actualTextHeight": 16, - "actualTextWidth": 241, - "height": 40, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 46, "multiLineActualTexts": Array [ - "类别类别类别类别类别类别类别类别类别类别", + "-", ], - "originalText": "类别类别类别类别类别类别类别类别类别类别", - "width": 272, + "originalText": "-", + "width": 143.8, }, Object { - "actualText": "子类别", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 40, + "actualText": "236723672361111", + "actualTextHeight": 15, + "actualTextWidth": 98, + "height": 30, "multiLineActualTexts": Array [ - "子类别", + "236723672361111", ], - "originalText": "子类别", - "width": 272, + "originalText": 236723672361111, + "width": 143.8, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render two max text lines 2`] = ` -Array [ Object { - "actualText": "1", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 120, + "actualText": "7789778977897789778977897789", + "actualTextHeight": 30, + "actualTextWidth": 188, + "height": 61, "multiLineActualTexts": Array [ - "1", + "7789778977897789778", + "977897789", ], - "originalText": "1", - "width": 80, + "originalText": "7789778977897789778977897789", + "width": 143.8, }, Object { - "actualText": "2", + "actualText": "236723672361111", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 40, + "actualTextWidth": 98, + "height": 30, "multiLineActualTexts": Array [ - "2", + "236723672361111", ], - "originalText": "2", - "width": 80, + "originalText": 236723672361111, + "width": 143.8, }, Object { - "actualText": "3", + "actualText": "3877", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 120, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "3", + "3877", ], - "originalText": "3", - "width": 80, + "originalText": 3877, + "width": 143.8, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render two max text lines 3`] = ` -Array [ Object { - "actualText": "家具", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 40, + "actualText": "4342", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "家具", + "4342", ], - "originalText": "家具", - "width": 192, + "originalText": 4342, + "width": 143.8, }, Object { - "actualText": "桌子", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 40, + "actualText": "5343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "桌子", + "5343", ], - "originalText": "桌子", - "width": 96, + "originalText": 5343, + "width": 143.8, }, Object { - "actualText": "数量数量数量数量数量数...", - "actualTextHeight": 30, - "actualTextWidth": 144, - "height": 38, + "actualText": "632", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量", - "数量数量数...", + "632", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 96, + "originalText": 632, + "width": 143.8, }, Object { - "actualText": "沙发", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 40, + "actualText": "7234", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "沙发", + "7234", ], - "originalText": "沙发", - "width": 96, + "originalText": 7234, + "width": 143.8, }, Object { - "actualText": "数量数量数量数量数量数...", - "actualTextHeight": 30, - "actualTextWidth": 144, - "height": 38, + "actualText": "834", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量", - "数量数量数...", + "834", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 96, + "originalText": 834, + "width": 143.8, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render two max text lines 4`] = ` -Array [ Object { - "actualText": "浙江省", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 120, + "actualText": "945", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "945", ], - "originalText": "浙江省", - "width": 96, + "originalText": 945, + "width": 143.8, }, Object { - "actualText": "浙江省浙江省浙江省浙江...", - "actualTextHeight": 32, - "actualTextWidth": 144, - "height": 40, + "actualText": "1304", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "浙江省浙江省", - "浙江省浙江...", + "1304", ], - "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", - "width": 96, + "originalText": 1304, + "width": 143.8, }, Object { - "actualText": "四川省", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 120, + "actualText": "1145", + "actualTextHeight": 15, + "actualTextWidth": 26, + "height": 30, "multiLineActualTexts": Array [ - "四川省", + "1145", ], - "originalText": "四川省", - "width": 96, + "originalText": 1145, + "width": 143.8, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render two max text lines 5`] = ` -Array [ Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 99, + "actualText": "1432", + "actualTextHeight": 15, + "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "23672367236", - "1111", + "1432", ], - "originalText": 236723672361111, - "width": 96, + "originalText": 1432, + "width": 143.8, }, Object { - "actualText": "3877", + "actualText": "1343", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "3877", + "1343", ], - "originalText": 3877, - "width": 96, + "originalText": 1343, + "width": 143.8, }, Object { - "actualText": "4342", + "actualText": "1354", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "4342", + "1354", ], - "originalText": 4342, - "width": 96, + "originalText": 1354, + "width": 143.8, }, Object { - "actualText": "-", + "actualText": "1523", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "-", + "1523", ], - "originalText": "-", - "width": 96, + "originalText": 1523, + "width": 143.8, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should default render one line text 1`] = ` +Array [ Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 40, + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "-", + "序号", ], - "originalText": "-", - "width": 96, + "originalText": "序号", + "width": 80, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should default render one line text 2`] = ` +Array [ Object { - "actualText": "1723", + "actualText": "1", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "1723", + "1", ], - "originalText": 1723, - "width": 96, + "originalText": 1, + "width": 80, }, Object { - "actualText": "1822", + "actualText": "2", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "1822", + "2", ], - "originalText": 1822, - "width": 96, + "originalText": 2, + "width": 80, }, Object { - "actualText": "1943", + "actualText": "3", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "1943", + "3", ], - "originalText": 1943, - "width": 96, + "originalText": 3, + "width": 80, }, Object { - "actualText": "2330", + "actualText": "4", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "2330", + "4", ], - "originalText": 2330, - "width": 96, + "originalText": 4, + "width": 80, }, Object { - "actualText": "632", + "actualText": "5", "actualTextHeight": 15, - "actualTextWidth": 21, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "632", + "5", ], - "originalText": 632, - "width": 96, + "originalText": 5, + "width": 80, }, Object { - "actualText": "7234", + "actualText": "6", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "7234", + "6", ], - "originalText": 7234, - "width": 96, + "originalText": 6, + "width": 80, }, Object { - "actualText": "834", + "actualText": "7", "actualTextHeight": 15, - "actualTextWidth": 21, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "834", + "7", ], - "originalText": 834, - "width": 96, + "originalText": 7, + "width": 80, }, Object { - "actualText": "5343", + "actualText": "8", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "5343", + "8", ], - "originalText": 5343, - "width": 96, + "originalText": 8, + "width": 80, }, Object { - "actualText": "-", + "actualText": "9", "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 40, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "-", + "9", ], - "originalText": "-", - "width": 96, + "originalText": 9, + "width": 80, }, Object { - "actualText": "2451", + "actualText": "10", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 14, "height": 30, "multiLineActualTexts": Array [ - "2451", + "10", ], - "originalText": 2451, - "width": 96, + "originalText": 10, + "width": 80, }, Object { - "actualText": "2244", + "actualText": "11", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 13, "height": 30, "multiLineActualTexts": Array [ - "2244", + "11", ], - "originalText": 2244, - "width": 96, + "originalText": 11, + "width": 80, }, Object { - "actualText": "2333", + "actualText": "12", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 14, "height": 30, "multiLineActualTexts": Array [ - "2333", + "12", ], - "originalText": 2333, - "width": 96, + "originalText": 12, + "width": 80, }, Object { - "actualText": "2445", + "actualText": "13", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 14, "height": 30, "multiLineActualTexts": Array [ - "2445", + "13", ], - "originalText": 2445, - "width": 96, + "originalText": 13, + "width": 80, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should use actual text height for large max line 1`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should default render one line text 3`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 68, + "height": 30, "multiLineActualTexts": Array [ "序号", ], @@ -9082,915 +19372,932 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 68, + "height": 30, "multiLineActualTexts": Array [ "省份", ], "originalText": "省份", - "width": 102.57, + "width": 103.8, }, Object { - "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "actualTextHeight": 64, - "actualTextWidth": 292, - "height": 68, + "actualText": "城市城市城市...", + "actualTextHeight": 16, + "actualTextWidth": 83, + "height": 30, "multiLineActualTexts": Array [ - "城市城市城市城", - "市城市城市城市", - "城市城市城市城", - "市城市", + "城市城市城市...", ], "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "width": 102.57, + "width": 103.8, }, Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualText": "类别类别类别...", "actualTextHeight": 16, - "actualTextWidth": 241, - "height": 72, + "actualTextWidth": 83, + "height": 30, "multiLineActualTexts": Array [ - "类别类别类别类别类别类别类别类别类别类别", + "类别类别类别...", ], "originalText": "类别类别类别类别类别类别类别类别类别类别", - "width": 285.14, + "width": 103.8, }, Object { "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 88, + "height": 30, "multiLineActualTexts": Array [ "子类别", ], "originalText": "子类别", - "width": 285.14, + "width": 103.8, + }, + Object { + "actualText": "数量数量数量...", + "actualTextHeight": 16, + "actualTextWidth": 83, + "height": 30, + "multiLineActualTexts": Array [ + "数量数量数量...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 103.8, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should use actual text height for large max line 2`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should default render one line text 4`] = `Array []`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should default render one line text 5`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 120, + "height": 30, "multiLineActualTexts": Array [ "1", ], - "originalText": "1", + "originalText": 1, "width": 80, }, Object { "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 88, + "height": 30, "multiLineActualTexts": Array [ "2", ], - "originalText": "2", + "originalText": 2, "width": 80, }, Object { "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 120, + "height": 30, "multiLineActualTexts": Array [ "3", ], - "originalText": "3", + "originalText": 3, "width": 80, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should use actual text height for large max line 3`] = ` -Array [ Object { - "actualText": "家具", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 72, + "actualText": "4", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "家具", + "4", ], - "originalText": "家具", - "width": 205.14, + "originalText": 4, + "width": 80, }, Object { - "actualText": "桌子", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 88, + "actualText": "5", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "桌子", + "5", ], - "originalText": "桌子", - "width": 102.57, + "originalText": 5, + "width": 80, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量数量", - "actualTextHeight": 60, - "actualTextWidth": 268, - "height": 68, + "actualText": "6", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量数", - "量", + "6", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 102.57, + "originalText": 6, + "width": 80, }, Object { - "actualText": "沙发", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 88, + "actualText": "7", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "沙发", + "7", ], - "originalText": "沙发", - "width": 102.57, + "originalText": 7, + "width": 80, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量数量", - "actualTextHeight": 60, - "actualTextWidth": 268, - "height": 68, + "actualText": "8", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量数", - "量", + "8", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 102.57, + "originalText": 8, + "width": 80, }, Object { - "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "actualTextHeight": 64, - "actualTextWidth": 340, - "height": 72, + "actualText": "9", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "家具家具家具家", - "具家具家具家具", - "家具家具家具家", - "具家具家具家具", + "9", ], - "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "width": 102.57, + "originalText": 9, + "width": 80, }, Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", - "actualTextHeight": 80, - "actualTextWidth": 365, - "height": 88, + "actualText": "10", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, "multiLineActualTexts": Array [ - "桌子桌子桌子桌", - "子桌子桌子桌子", - "桌子桌子桌子桌", - "子桌子桌子桌子", - "桌子", + "10", ], - "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", - "width": 102.57, + "originalText": 10, + "width": 80, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量数量", - "actualTextHeight": 60, - "actualTextWidth": 268, - "height": 68, + "actualText": "11", + "actualTextHeight": 15, + "actualTextWidth": 13, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量数", - "量", + "11", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 102.57, + "originalText": 11, + "width": 80, }, Object { - "actualText": "办公用品", - "actualTextHeight": 16, - "actualTextWidth": 49, - "height": 72, + "actualText": "12", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, "multiLineActualTexts": Array [ - "办公用品", + "12", ], - "originalText": "办公用品", - "width": 205.14, + "originalText": 12, + "width": 80, }, Object { - "actualText": "笔", - "actualTextHeight": 16, - "actualTextWidth": 13, - "height": 88, + "actualText": "13", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, "multiLineActualTexts": Array [ - "笔", + "13", ], - "originalText": "笔", - "width": 102.57, + "originalText": 13, + "width": 80, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量数量", - "actualTextHeight": 60, - "actualTextWidth": 268, - "height": 68, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量数", - "量", + "浙江省", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 102.57, + "originalText": "浙江省", + "width": 103.8, }, Object { - "actualText": "纸张", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 88, + "actualText": "浙江省浙江省...", + "actualTextHeight": 15, + "actualTextWidth": 83, + "height": 30, "multiLineActualTexts": Array [ - "纸张", + "浙江省浙江省...", ], - "originalText": "纸张", - "width": 102.57, + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "width": 103.8, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量数量", - "actualTextHeight": 60, - "actualTextWidth": 268, - "height": 68, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量数", - "量", + "浙江省", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 102.57, + "originalText": "浙江省", + "width": 103.8, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should use actual text height for large max line 4`] = ` -Array [ Object { "actualText": "浙江省", - "actualTextHeight": 16, + "actualTextHeight": 15, "actualTextWidth": 37, - "height": 120, + "height": 30, "multiLineActualTexts": Array [ "浙江省", ], "originalText": "浙江省", - "width": 102.57, + "width": 103.8, }, Object { - "actualText": "绍兴市", + "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "绍兴市", + "浙江省", ], - "originalText": "绍兴市", - "width": 102.57, + "originalText": "浙江省", + "width": 103.8, }, Object { - "actualText": "宁波市", + "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "宁波市", + "浙江省", ], - "originalText": "宁波市", - "width": 102.57, + "originalText": "浙江省", + "width": 103.8, }, Object { - "actualText": "舟山市", + "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "舟山市", + "浙江省", ], - "originalText": "舟山市", - "width": 102.57, + "originalText": "浙江省", + "width": 103.8, }, Object { - "actualText": "杭州市", + "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "杭州市", + "浙江省", ], - "originalText": "杭州市", - "width": 102.57, + "originalText": "浙江省", + "width": 103.8, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", - "actualTextHeight": 80, - "actualTextWidth": 365, - "height": 88, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "浙江省浙江省浙", - "江省浙江省浙江", - "省浙江省浙江省", - "浙江省浙江省浙", - "江省", + "浙江省", ], - "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", - "width": 102.57, + "originalText": "浙江省", + "width": 103.8, }, Object { - "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", - "actualTextHeight": 75, - "actualTextWidth": 365, - "height": 88, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "杭州市杭州市杭", - "州市杭州市杭州", - "市杭州市杭州市", - "杭州市杭州市杭", - "州市", + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 103.8, + }, + Object { + "actualText": "杭州市杭州市...", + "actualTextHeight": 15, + "actualTextWidth": 83, + "height": 30, + "multiLineActualTexts": Array [ + "杭州市杭州市...", ], "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", - "width": 102.57, + "width": 103.8, }, Object { - "actualText": "四川省", - "actualTextHeight": 16, + "actualText": "绍兴市", + "actualTextHeight": 15, "actualTextWidth": 37, - "height": 120, + "height": 30, "multiLineActualTexts": Array [ - "四川省", + "绍兴市", ], - "originalText": "四川省", - "width": 102.57, + "originalText": "绍兴市", + "width": 103.8, }, Object { - "actualText": "成都市", + "actualText": "宁波市", "actualTextHeight": 15, "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "成都市", + "宁波市", ], - "originalText": "成都市", - "width": 102.57, + "originalText": "宁波市", + "width": 103.8, }, Object { - "actualText": "绵阳市", + "actualText": "舟山市", "actualTextHeight": 15, "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "绵阳市", + "舟山市", ], - "originalText": "绵阳市", - "width": 102.57, + "originalText": "舟山市", + "width": 103.8, }, Object { - "actualText": "南充市", + "actualText": "杭州市", "actualTextHeight": 15, "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "南充市", + "杭州市", ], - "originalText": "南充市", - "width": 102.57, + "originalText": "杭州市", + "width": 103.8, }, Object { - "actualText": "乐山市", + "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "乐山市", + "绍兴市", ], - "originalText": "乐山市", - "width": 102.57, + "originalText": "绍兴市", + "width": 103.8, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should use actual text height for large max line 5`] = ` -Array [ Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "236723672361", - "111", + "宁波市", ], - "originalText": 236723672361111, - "width": 102.57, + "originalText": "宁波市", + "width": 103.8, }, Object { - "actualText": "3877", + "actualText": "舟山市", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "3877", + "舟山市", ], - "originalText": 3877, - "width": 102.57, + "originalText": "舟山市", + "width": 103.8, }, Object { - "actualText": "4342", + "actualText": "杭州市", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "4342", + "杭州市", ], - "originalText": 4342, - "width": 102.57, + "originalText": "杭州市", + "width": 103.8, }, Object { - "actualText": "-", + "actualText": "绍兴市", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "-", + "绍兴市", ], - "originalText": "-", - "width": 102.57, + "originalText": "绍兴市", + "width": 103.8, }, Object { - "actualText": "-", + "actualText": "宁波市", "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 88, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "-", + "宁波市", ], - "originalText": "-", - "width": 102.57, + "originalText": "宁波市", + "width": 103.8, }, Object { - "actualText": "1723", + "actualText": "舟山市", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "1723", + "舟山市", ], - "originalText": 1723, - "width": 102.57, + "originalText": "舟山市", + "width": 103.8, }, Object { - "actualText": "1822", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "1822", + "家具", ], - "originalText": 1822, - "width": 102.57, + "originalText": "家具", + "width": 103.8, }, Object { - "actualText": "1943", + "actualText": "家具家具家具...", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 83, "height": 30, "multiLineActualTexts": Array [ - "1943", + "家具家具家具...", ], - "originalText": 1943, - "width": 102.57, + "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "width": 103.8, }, Object { - "actualText": "2330", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "2330", + "家具", ], - "originalText": 2330, - "width": 102.57, + "originalText": "家具", + "width": 103.8, }, Object { - "actualText": "632", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 21, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "632", + "家具", ], - "originalText": 632, - "width": 102.57, + "originalText": "家具", + "width": 103.8, }, Object { - "actualText": "7234", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "7234", + "家具", ], - "originalText": 7234, - "width": 102.57, + "originalText": "家具", + "width": 103.8, }, Object { - "actualText": "834", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 21, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "834", + "家具", ], - "originalText": 834, - "width": 102.57, + "originalText": "家具", + "width": 103.8, }, Object { - "actualText": "5343", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "5343", + "家具", ], - "originalText": 5343, - "width": 102.57, + "originalText": "家具", + "width": 103.8, }, Object { - "actualText": "-", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 88, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "-", + "家具", ], - "originalText": "-", - "width": 102.57, + "originalText": "家具", + "width": 103.8, }, Object { - "actualText": "2451", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "2451", + "家具", ], - "originalText": 2451, - "width": 102.57, + "originalText": "家具", + "width": 103.8, }, Object { - "actualText": "2244", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 49, "height": 30, "multiLineActualTexts": Array [ - "2244", + "办公用品", ], - "originalText": 2244, - "width": 102.57, + "originalText": "办公用品", + "width": 103.8, }, Object { - "actualText": "2333", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 49, "height": 30, "multiLineActualTexts": Array [ - "2333", + "办公用品", ], - "originalText": 2333, - "width": 102.57, + "originalText": "办公用品", + "width": 103.8, }, Object { - "actualText": "2445", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 49, "height": 30, "multiLineActualTexts": Array [ - "2445", + "办公用品", ], - "originalText": 2445, - "width": 102.57, + "originalText": "办公用品", + "width": 103.8, }, Object { - "actualText": "-", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 49, "height": 30, "multiLineActualTexts": Array [ - "-", + "办公用品", ], - "originalText": "-", - "width": 102.57, + "originalText": "办公用品", + "width": 103.8, }, Object { - "actualText": "-", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "-", + "桌子", ], - "originalText": "-", - "width": 102.57, + "originalText": "桌子", + "width": 103.8, }, Object { - "actualText": "-", + "actualText": "桌子桌子桌子...", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 83, "height": 30, "multiLineActualTexts": Array [ - "-", + "桌子桌子桌子...", ], - "originalText": "-", - "width": 102.57, + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "width": 103.8, }, Object { - "actualText": "-", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "-", + "桌子", ], - "originalText": "-", - "width": 102.57, + "originalText": "桌子", + "width": 103.8, }, Object { - "actualText": "7789778977897789778977897789", - "actualTextHeight": 45, - "actualTextWidth": 189, - "height": 88, + "actualText": "桌子", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "778977897789", - "778977897789", - "7789", + "桌子", ], - "originalText": "7789778977897789778977897789", - "width": 102.57, + "originalText": "桌子", + "width": 103.8, }, Object { - "actualText": "-", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "-", + "桌子", ], - "originalText": "-", - "width": 102.57, + "originalText": "桌子", + "width": 103.8, }, Object { - "actualText": "-", + "actualText": "沙发", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "-", + "沙发", ], - "originalText": "-", - "width": 102.57, + "originalText": "沙发", + "width": 103.8, }, Object { - "actualText": "-", + "actualText": "沙发", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "-", + "沙发", ], - "originalText": "-", - "width": 102.57, + "originalText": "沙发", + "width": 103.8, }, Object { - "actualText": "-", + "actualText": "沙发", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "-", + "沙发", ], - "originalText": "-", - "width": 102.57, + "originalText": "沙发", + "width": 103.8, }, Object { - "actualText": "1304", + "actualText": "沙发", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "1304", + "沙发", ], - "originalText": 1304, - "width": 102.57, + "originalText": "沙发", + "width": 103.8, }, Object { - "actualText": "1145", + "actualText": "笔", "actualTextHeight": 15, - "actualTextWidth": 26, + "actualTextWidth": 13, "height": 30, "multiLineActualTexts": Array [ - "1145", + "笔", ], - "originalText": 1145, - "width": 102.57, + "originalText": "笔", + "width": 103.8, }, Object { - "actualText": "1432", + "actualText": "笔", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 13, "height": 30, "multiLineActualTexts": Array [ - "1432", + "笔", ], - "originalText": 1432, - "width": 102.57, + "originalText": "笔", + "width": 103.8, }, Object { - "actualText": "945", + "actualText": "笔", "actualTextHeight": 15, - "actualTextWidth": 21, + "actualTextWidth": 13, "height": 30, "multiLineActualTexts": Array [ - "945", + "笔", ], - "originalText": 945, - "width": 102.57, + "originalText": "笔", + "width": 103.8, }, Object { - "actualText": "-", + "actualText": "笔", "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 88, + "actualTextWidth": 13, + "height": 30, "multiLineActualTexts": Array [ - "-", + "笔", ], - "originalText": "-", - "width": 102.57, + "originalText": "笔", + "width": 103.8, }, Object { - "actualText": "2335", + "actualText": "23672367236...", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 84, "height": 30, "multiLineActualTexts": Array [ - "2335", + "23672367236...", ], - "originalText": 2335, - "width": 102.57, + "originalText": 236723672361111, + "width": 103.8, }, Object { - "actualText": "245", + "actualText": "77897789778...", "actualTextHeight": 15, - "actualTextWidth": 21, + "actualTextWidth": 84, "height": 30, "multiLineActualTexts": Array [ - "245", + "77897789778...", ], - "originalText": 245, - "width": 102.57, + "originalText": "7789778977897789778977897789", + "width": 103.8, }, Object { - "actualText": "2457", + "actualText": "23672367236...", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 84, "height": 30, "multiLineActualTexts": Array [ - "2457", + "23672367236...", ], - "originalText": 2457, - "width": 102.57, + "originalText": 236723672361111, + "width": 103.8, }, Object { - "actualText": "2458", + "actualText": "3877", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "2458", + "3877", ], - "originalText": 2458, - "width": 102.57, + "originalText": 3877, + "width": 103.8, }, Object { - "actualText": "1354", + "actualText": "4342", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "1354", + "4342", ], - "originalText": 1354, - "width": 102.57, + "originalText": 4342, + "width": 103.8, }, Object { - "actualText": "1523", + "actualText": "5343", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "1523", + "5343", ], - "originalText": 1523, - "width": 102.57, + "originalText": 5343, + "width": 103.8, }, Object { - "actualText": "1634", + "actualText": "632", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 21, "height": 30, "multiLineActualTexts": Array [ - "1634", + "632", ], - "originalText": 1634, - "width": 102.57, + "originalText": 632, + "width": 103.8, }, Object { - "actualText": "1343", + "actualText": "7234", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "1343", + "7234", ], - "originalText": 1343, - "width": 102.57, + "originalText": 7234, + "width": 103.8, }, Object { - "actualText": "-", + "actualText": "834", "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 88, + "actualTextWidth": 21, + "height": 30, "multiLineActualTexts": Array [ - "-", + "834", ], - "originalText": "-", - "width": 102.57, + "originalText": 834, + "width": 103.8, }, Object { - "actualText": "4004", + "actualText": "945", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 21, "height": 30, "multiLineActualTexts": Array [ - "4004", + "945", ], - "originalText": 4004, - "width": 102.57, + "originalText": 945, + "width": 103.8, }, Object { - "actualText": "3077", + "actualText": "1304", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "3077", + "1304", ], - "originalText": 3077, - "width": 102.57, + "originalText": 1304, + "width": 103.8, }, Object { - "actualText": "3551", + "actualText": "1145", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 26, "height": 30, "multiLineActualTexts": Array [ - "3551", + "1145", ], - "originalText": 3551, - "width": 102.57, + "originalText": 1145, + "width": 103.8, }, Object { - "actualText": "352", + "actualText": "1432", "actualTextHeight": 15, - "actualTextWidth": 21, + "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "352", + "1432", ], - "originalText": 352, - "width": 102.57, + "originalText": 1432, + "width": 103.8, }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly col cell height if actual text lines is difference 1`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should force adaptive adjust row height if custom cell style more than actual text height by rowCell.height 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 72, + "height": 64, "multiLineActualTexts": Array [ "序号", ], @@ -10000,7 +20307,7 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly col cell height if actual text lines is difference 2`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should force adaptive adjust row height if custom cell style more than actual text height by rowCell.height 2`] = ` Array [ Object { "actualText": "1", @@ -10017,7 +20324,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 76, + "height": 61, "multiLineActualTexts": Array [ "2", ], @@ -10104,13 +20411,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly col cell height if actual text lines is difference 3`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should force adaptive adjust row height if custom cell style more than actual text height by rowCell.height 3`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 72, + "height": 64, "multiLineActualTexts": Array [ "序号", ], @@ -10118,69 +20425,72 @@ Array [ "width": 80, }, Object { - "actualText": "省份省份省份省份省份省份省份省份省份省份省份省份省份省...", - "actualTextHeight": 64, - "actualTextWidth": 338, - "height": 72, + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, "multiLineActualTexts": Array [ - "省份省份省份省", - "份省份省份省份", - "省份省份省份省", - "份省份省份省...", + "省份", ], - "originalText": "省份省份省份省份省份省份省份省份省份省份省份省份省份省份省份省份省份省份省份省份", + "originalText": "省份", "width": 103.8, }, Object { - "actualText": "city", - "actualTextHeight": 16, - "actualTextWidth": 21, - "height": 72, + "actualText": "城市城市城市城市城市城市城市城市城市城市...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 64, "multiLineActualTexts": Array [ - "city", + "城市城市城市城", + "市城市城市城市", + "城市城市城市...", ], - "originalText": "city", + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", "width": 103.8, }, Object { - "actualText": "type", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 72, + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 48, + "actualTextWidth": 243, + "height": 64, "multiLineActualTexts": Array [ - "type", + "类别类别类别类", + "别类别类别类别", + "类别类别类别", ], - "originalText": "type", + "originalText": "类别类别类别类别类别类别类别类别类别类别", "width": 103.8, }, Object { - "actualText": "sub_type", + "actualText": "子类别", "actualTextHeight": 16, - "actualTextWidth": 53, - "height": 72, + "actualTextWidth": 37, + "height": 64, "multiLineActualTexts": Array [ - "sub_type", + "子类别", ], - "originalText": "sub_type", + "originalText": "子类别", "width": 103.8, }, Object { - "actualText": "number", - "actualTextHeight": 16, - "actualTextWidth": 45, - "height": 72, + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 64, "multiLineActualTexts": Array [ - "number", + "数量数量数量数", + "量数量数量数量", + "数量数量数量...", ], - "originalText": "number", + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 103.8, }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly col cell height if actual text lines is difference 4`] = `Array []`; +exports[`SpreadSheet Multi Line Text Tests TableSheet should force adaptive adjust row height if custom cell style more than actual text height by rowCell.height 4`] = `Array []`; -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly col cell height if actual text lines is difference 5`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should force adaptive adjust row height if custom cell style more than actual text height by rowCell.height 5`] = ` Array [ Object { "actualText": "1", @@ -10197,7 +20507,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 76, + "height": 61, "multiLineActualTexts": Array [ "2", ], @@ -10293,15 +20603,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省...", - "actualTextHeight": 60, - "actualTextWidth": 338, - "height": 76, + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 61, "multiLineActualTexts": Array [ "浙江省浙江省浙", "江省浙江省浙江", - "省浙江省浙江省", - "浙江省浙江省...", + "省浙江省浙江...", ], "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 103.8, @@ -10395,15 +20704,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市...", - "actualTextHeight": 60, - "actualTextWidth": 338, - "height": 76, + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 61, "multiLineActualTexts": Array [ "杭州市杭州市杭", "州市杭州市杭州", - "市杭州市杭州市", - "杭州市杭州市...", + "市杭州市杭州...", ], "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", "width": 103.8, @@ -10497,15 +20805,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "actualTextHeight": 60, - "actualTextWidth": 340, - "height": 76, + "actualText": "家具家具家具家具家具家具家具家具家具家具...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 61, "multiLineActualTexts": Array [ "家具家具家具家", "具家具家具家具", - "家具家具家具家", - "具家具家具家具", + "家具家具家具...", ], "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", "width": 103.8, @@ -10599,15 +20906,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌...", - "actualTextHeight": 60, - "actualTextWidth": 338, - "height": 76, + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 61, "multiLineActualTexts": Array [ "桌子桌子桌子桌", "子桌子桌子桌子", - "桌子桌子桌子桌", - "子桌子桌子桌...", + "桌子桌子桌子...", ], "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", "width": 103.8, @@ -10705,7 +21011,7 @@ Array [ "actualText": "7789778977897789778977897789", "actualTextHeight": 45, "actualTextWidth": 189, - "height": 76, + "height": 61, "multiLineActualTexts": Array [ "7789778977897", "7897789778977", @@ -10795,13 +21101,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference 1`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should force adaptive adjust row height if custom cell style more than actual text height by rowCell.heightByField 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 72, + "height": 64, "multiLineActualTexts": Array [ "序号", ], @@ -10811,7 +21117,7 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference 2`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should force adaptive adjust row height if custom cell style more than actual text height by rowCell.heightByField 2`] = ` Array [ Object { "actualText": "1", @@ -10828,7 +21134,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 76, + "height": 61, "multiLineActualTexts": Array [ "2", ], @@ -10915,13 +21221,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference 3`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should force adaptive adjust row height if custom cell style more than actual text height by rowCell.heightByField 3`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 72, + "height": 64, "multiLineActualTexts": Array [ "序号", ], @@ -10932,7 +21238,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 72, + "height": 64, "multiLineActualTexts": Array [ "省份", ], @@ -10940,15 +21246,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "actualTextHeight": 64, - "actualTextWidth": 292, - "height": 72, + "actualText": "城市城市城市城市城市城市城市城市城市城市...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 64, "multiLineActualTexts": Array [ "城市城市城市城", "市城市城市城市", - "城市城市城市城", - "市城市", + "城市城市城市...", ], "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", "width": 103.8, @@ -10957,7 +21262,7 @@ Array [ "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 48, "actualTextWidth": 243, - "height": 72, + "height": 64, "multiLineActualTexts": Array [ "类别类别类别类", "别类别类别类别", @@ -10970,7 +21275,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 72, + "height": 64, "multiLineActualTexts": Array [ "子类别", ], @@ -10978,15 +21283,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量数量", - "actualTextHeight": 64, - "actualTextWidth": 268, - "height": 72, + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 64, "multiLineActualTexts": Array [ "数量数量数量数", "量数量数量数量", - "数量数量数量数", - "量", + "数量数量数量...", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 103.8, @@ -10994,9 +21298,9 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference 4`] = `Array []`; +exports[`SpreadSheet Multi Line Text Tests TableSheet should force adaptive adjust row height if custom cell style more than actual text height by rowCell.heightByField 4`] = `Array []`; -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference 5`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should force adaptive adjust row height if custom cell style more than actual text height by rowCell.heightByField 5`] = ` Array [ Object { "actualText": "1", @@ -11013,7 +21317,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 76, + "height": 61, "multiLineActualTexts": Array [ "2", ], @@ -11109,15 +21413,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省...", - "actualTextHeight": 60, - "actualTextWidth": 338, - "height": 76, + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 61, "multiLineActualTexts": Array [ "浙江省浙江省浙", "江省浙江省浙江", - "省浙江省浙江省", - "浙江省浙江省...", + "省浙江省浙江...", ], "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 103.8, @@ -11211,15 +21514,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市...", - "actualTextHeight": 60, - "actualTextWidth": 338, - "height": 76, + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 61, "multiLineActualTexts": Array [ "杭州市杭州市杭", "州市杭州市杭州", - "市杭州市杭州市", - "杭州市杭州市...", + "市杭州市杭州...", ], "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", "width": 103.8, @@ -11313,15 +21615,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "actualTextHeight": 60, - "actualTextWidth": 340, - "height": 76, + "actualText": "家具家具家具家具家具家具家具家具家具家具...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 61, "multiLineActualTexts": Array [ "家具家具家具家", "具家具家具家具", - "家具家具家具家", - "具家具家具家具", + "家具家具家具...", ], "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", "width": 103.8, @@ -11415,15 +21716,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌...", - "actualTextHeight": 60, - "actualTextWidth": 338, - "height": 76, + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 61, "multiLineActualTexts": Array [ "桌子桌子桌子桌", "子桌子桌子桌子", - "桌子桌子桌子桌", - "子桌子桌子桌...", + "桌子桌子桌子...", ], "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", "width": 103.8, @@ -11521,7 +21821,7 @@ Array [ "actualText": "7789778977897789778977897789", "actualTextHeight": 45, "actualTextWidth": 189, - "height": 76, + "height": 61, "multiLineActualTexts": Array [ "7789778977897", "7897789778977", @@ -11590,573 +21890,34 @@ Array [ "actualText": "7234", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, - "multiLineActualTexts": Array [ - "7234", - ], - "originalText": 7234, - "width": 103.8, - }, - Object { - "actualText": "834", - "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 30, - "multiLineActualTexts": Array [ - "834", - ], - "originalText": 834, - "width": 103.8, - }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and outside the canvas 1`] = ` -Array [ - Object { - "actualText": "序号", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 72, - "multiLineActualTexts": Array [ - "序号", - ], - "originalText": "序号", - "width": 80, - }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and outside the canvas 2`] = ` -Array [ - Object { - "actualText": "1", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 360, - "multiLineActualTexts": Array [ - "1", - ], - "originalText": 1, - "width": 80, - }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and outside the canvas 3`] = ` -Array [ - Object { - "actualText": "序号", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 72, - "multiLineActualTexts": Array [ - "序号", - ], - "originalText": "序号", - "width": 80, - }, - Object { - "actualText": "省份", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 72, - "multiLineActualTexts": Array [ - "省份", - ], - "originalText": "省份", - "width": 103.8, - }, - Object { - "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "actualTextHeight": 64, - "actualTextWidth": 292, - "height": 72, - "multiLineActualTexts": Array [ - "城市城市城市城", - "市城市城市城市", - "城市城市城市城", - "市城市", - ], - "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "width": 103.8, - }, - Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", - "actualTextHeight": 48, - "actualTextWidth": 243, - "height": 72, - "multiLineActualTexts": Array [ - "类别类别类别类", - "别类别类别类别", - "类别类别类别", - ], - "originalText": "类别类别类别类别类别类别类别类别类别类别", - "width": 103.8, - }, - Object { - "actualText": "子类别", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 72, - "multiLineActualTexts": Array [ - "子类别", - ], - "originalText": "子类别", - "width": 103.8, - }, - Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量数量", - "actualTextHeight": 64, - "actualTextWidth": 268, - "height": 72, - "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量数", - "量", - ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 103.8, - }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and outside the canvas 4`] = `Array []`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and outside the canvas 5`] = ` -Array [ - Object { - "actualText": "1", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 360, - "multiLineActualTexts": Array [ - "1", - ], - "originalText": 1, - "width": 80, - }, - Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 360, - "multiLineActualTexts": Array [ - "浙江省", - ], - "originalText": "浙江省", - "width": 103.8, - }, - Object { - "actualText": "绍兴市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 360, - "multiLineActualTexts": Array [ - "绍兴市", - ], - "originalText": "绍兴市", - "width": 103.8, - }, - Object { - "actualText": "家具", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 360, - "multiLineActualTexts": Array [ - "家具", - ], - "originalText": "家具", - "width": 103.8, - }, - Object { - "actualText": "桌子", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 360, - "multiLineActualTexts": Array [ - "桌子", - ], - "originalText": "桌子", - "width": 103.8, - }, - Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, - "height": 360, - "multiLineActualTexts": Array [ - "2367236723611", - "11", - ], - "originalText": 236723672361111, - "width": 103.8, - }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and outside the canvas 6`] = ` -Array [ - 0, - 360, - 436, - 482, - 512, - 542, - 572, - 602, - 632, - 662, - 692, - 722, - 752, - 782, - 812, - 842, - 872, - 902, - 932, - 962, - 992, - 1022, - 1052, - 1082, - 1112, - 1142, - 1172, - 1202, - 1232, - 1262, - 1292, - 1322, - 1352, - 1382, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and partial outside the canvas 1`] = ` -Array [ - Object { - "actualText": "序号", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 72, - "multiLineActualTexts": Array [ - "序号", - ], - "originalText": "序号", - "width": 80, - }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and partial outside the canvas 2`] = ` -Array [ - Object { - "actualText": "1", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 300, - "multiLineActualTexts": Array [ - "1", - ], - "originalText": 1, - "width": 80, - }, - Object { - "actualText": "2", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 76, - "multiLineActualTexts": Array [ - "2", - ], - "originalText": 2, - "width": 80, - }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and partial outside the canvas 3`] = ` -Array [ - Object { - "actualText": "序号", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 72, - "multiLineActualTexts": Array [ - "序号", - ], - "originalText": "序号", - "width": 80, - }, - Object { - "actualText": "省份", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 72, - "multiLineActualTexts": Array [ - "省份", - ], - "originalText": "省份", - "width": 103.8, - }, - Object { - "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "actualTextHeight": 64, - "actualTextWidth": 292, - "height": 72, - "multiLineActualTexts": Array [ - "城市城市城市城", - "市城市城市城市", - "城市城市城市城", - "市城市", - ], - "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "width": 103.8, - }, - Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", - "actualTextHeight": 48, - "actualTextWidth": 243, - "height": 72, - "multiLineActualTexts": Array [ - "类别类别类别类", - "别类别类别类别", - "类别类别类别", - ], - "originalText": "类别类别类别类别类别类别类别类别类别类别", - "width": 103.8, - }, - Object { - "actualText": "子类别", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 72, - "multiLineActualTexts": Array [ - "子类别", - ], - "originalText": "子类别", - "width": 103.8, - }, - Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量数量", - "actualTextHeight": 64, - "actualTextWidth": 268, - "height": 72, - "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量数", - "量", - ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 103.8, - }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and partial outside the canvas 4`] = `Array []`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and partial outside the canvas 5`] = ` -Array [ - Object { - "actualText": "1", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 300, - "multiLineActualTexts": Array [ - "1", - ], - "originalText": 1, - "width": 80, - }, - Object { - "actualText": "2", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 76, - "multiLineActualTexts": Array [ - "2", - ], - "originalText": 2, - "width": 80, - }, - Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 300, - "multiLineActualTexts": Array [ - "浙江省", - ], - "originalText": "浙江省", - "width": 103.8, - }, - Object { - "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省...", - "actualTextHeight": 60, - "actualTextWidth": 338, - "height": 76, - "multiLineActualTexts": Array [ - "浙江省浙江省浙", - "江省浙江省浙江", - "省浙江省浙江省", - "浙江省浙江省...", - ], - "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", - "width": 103.8, - }, - Object { - "actualText": "绍兴市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 300, - "multiLineActualTexts": Array [ - "绍兴市", - ], - "originalText": "绍兴市", - "width": 103.8, - }, - Object { - "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市...", - "actualTextHeight": 60, - "actualTextWidth": 338, - "height": 76, - "multiLineActualTexts": Array [ - "杭州市杭州市杭", - "州市杭州市杭州", - "市杭州市杭州市", - "杭州市杭州市...", - ], - "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", - "width": 103.8, - }, - Object { - "actualText": "家具", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 300, - "multiLineActualTexts": Array [ - "家具", - ], - "originalText": "家具", - "width": 103.8, - }, - Object { - "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "actualTextHeight": 60, - "actualTextWidth": 340, - "height": 76, - "multiLineActualTexts": Array [ - "家具家具家具家", - "具家具家具家具", - "家具家具家具家", - "具家具家具家具", - ], - "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "width": 103.8, - }, - Object { - "actualText": "桌子", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 300, - "multiLineActualTexts": Array [ - "桌子", - ], - "originalText": "桌子", - "width": 103.8, - }, - Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌...", - "actualTextHeight": 60, - "actualTextWidth": 338, - "height": 76, - "multiLineActualTexts": Array [ - "桌子桌子桌子桌", - "子桌子桌子桌子", - "桌子桌子桌子桌", - "子桌子桌子桌...", - ], - "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", - "width": 103.8, - }, - Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, - "height": 300, + "height": 30, "multiLineActualTexts": Array [ - "2367236723611", - "11", + "7234", ], - "originalText": 236723672361111, + "originalText": 7234, "width": 103.8, }, Object { - "actualText": "7789778977897789778977897789", - "actualTextHeight": 45, - "actualTextWidth": 189, - "height": 76, + "actualText": "834", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, "multiLineActualTexts": Array [ - "7789778977897", - "7897789778977", - "89", + "834", ], - "originalText": "7789778977897789778977897789", + "originalText": 834, "width": 103.8, }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly data cell height if actual text lines is difference and partial outside the canvas 6`] = ` -Array [ - 0, - 300, - 376, - 422, - 452, - 482, - 512, - 542, - 572, - 602, - 632, - 662, - 692, - 722, - 752, - 782, - 812, - 842, - 872, - 902, - 932, - 962, - 992, - 1022, - 1052, - 1082, - 1112, - 1142, - 1172, - 1202, - 1232, - 1262, - 1292, - 1322, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly row cell height if actual text lines is difference 1`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should get correctly cell height priority if actual text not wrap 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 20, "multiLineActualTexts": Array [ "序号", ], @@ -12166,13 +21927,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly row cell height if actual text lines is difference 2`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should get correctly cell height priority if actual text not wrap 2`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "1", ], @@ -12183,7 +21944,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "2", ], @@ -12194,7 +21955,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 61, + "height": 30, "multiLineActualTexts": Array [ "3", ], @@ -12216,7 +21977,7 @@ Array [ "actualText": "5", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 100, "multiLineActualTexts": Array [ "5", ], @@ -12289,82 +22050,16 @@ Array [ "originalText": 11, "width": 80, }, - Object { - "actualText": "12", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, - "multiLineActualTexts": Array [ - "12", - ], - "originalText": 12, - "width": 80, - }, - Object { - "actualText": "13", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, - "multiLineActualTexts": Array [ - "13", - ], - "originalText": 13, - "width": 80, - }, - Object { - "actualText": "14", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, - "multiLineActualTexts": Array [ - "14", - ], - "originalText": 14, - "width": 80, - }, - Object { - "actualText": "15", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, - "multiLineActualTexts": Array [ - "15", - ], - "originalText": 15, - "width": 80, - }, - Object { - "actualText": "16", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, - "multiLineActualTexts": Array [ - "16", - ], - "originalText": 16, - "width": 80, - }, - Object { - "actualText": "17", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, - "multiLineActualTexts": Array [ - "17", - ], - "originalText": 17, - "width": 80, - }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly row cell height if actual text lines is difference 3`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should get correctly cell height priority if actual text not wrap 3`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 20, "multiLineActualTexts": Array [ "序号", ], @@ -12372,77 +22067,72 @@ Array [ "width": 80, }, Object { - "actualText": "省份", + "actualText": "province", "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 56, + "actualTextWidth": 51, + "height": 20, "multiLineActualTexts": Array [ - "省份", + "province", ], - "originalText": "省份", - "width": 143.8, + "originalText": "province", + "width": 103.8, }, Object { - "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "actualTextHeight": 48, - "actualTextWidth": 291, - "height": 56, + "actualText": "city", + "actualTextHeight": 16, + "actualTextWidth": 21, + "height": 20, "multiLineActualTexts": Array [ - "城市城市城市城市城市", - "城市城市城市城市城市", - "城市城市", + "city", ], - "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "width": 143.8, + "originalText": "city", + "width": 103.8, }, Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", - "actualTextHeight": 32, - "actualTextWidth": 242, - "height": 56, + "actualText": "type", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 20, "multiLineActualTexts": Array [ - "类别类别类别类别类别", - "类别类别类别类别类别", + "type", ], - "originalText": "类别类别类别类别类别类别类别类别类别类别", - "width": 143.8, + "originalText": "type", + "width": 103.8, }, Object { - "actualText": "子类别", + "actualText": "sub_type", "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 56, + "actualTextWidth": 53, + "height": 20, "multiLineActualTexts": Array [ - "子类别", + "sub_type", ], - "originalText": "子类别", - "width": 143.8, + "originalText": "sub_type", + "width": 103.8, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量数量", - "actualTextHeight": 48, - "actualTextWidth": 267, - "height": 56, + "actualText": "number", + "actualTextHeight": 16, + "actualTextWidth": 45, + "height": 20, "multiLineActualTexts": Array [ - "数量数量数量数量数量", - "数量数量数量数量数量", - "数量", + "number", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 143.8, + "originalText": "number", + "width": 103.8, }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly row cell height if actual text lines is difference 4`] = `Array []`; +exports[`SpreadSheet Multi Line Text Tests TableSheet should get correctly cell height priority if actual text not wrap 4`] = `Array []`; -exports[`SpreadSheet Multi Line Text Tests TableSheet should calc correctly row cell height if actual text lines is difference 5`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should get correctly cell height priority if actual text not wrap 5`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "1", ], @@ -12453,7 +22143,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "2", ], @@ -12464,7 +22154,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 61, + "height": 30, "multiLineActualTexts": Array [ "3", ], @@ -12486,7 +22176,7 @@ Array [ "actualText": "5", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 100, "multiLineActualTexts": Array [ "5", ], @@ -12559,141 +22249,6 @@ Array [ "originalText": 11, "width": 80, }, - Object { - "actualText": "12", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, - "multiLineActualTexts": Array [ - "12", - ], - "originalText": 12, - "width": 80, - }, - Object { - "actualText": "13", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, - "multiLineActualTexts": Array [ - "13", - ], - "originalText": 13, - "width": 80, - }, - Object { - "actualText": "14", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, - "multiLineActualTexts": Array [ - "14", - ], - "originalText": 14, - "width": 80, - }, - Object { - "actualText": "15", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, - "multiLineActualTexts": Array [ - "15", - ], - "originalText": 15, - "width": 80, - }, - Object { - "actualText": "16", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, - "multiLineActualTexts": Array [ - "16", - ], - "originalText": 16, - "width": 80, - }, - Object { - "actualText": "17", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, - "multiLineActualTexts": Array [ - "17", - ], - "originalText": 17, - "width": 80, - }, - Object { - "actualText": "浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江", - "actualTextHeight": 30, - "actualTextWidth": 242, - "height": 46, - "multiLineActualTexts": Array [ - "浙江浙江浙江浙江浙江", - "浙江浙江浙江浙江浙江", - ], - "originalText": "浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江", - "width": 143.8, - }, - Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "浙江省", - ], - "originalText": "浙江省", - "width": 143.8, - }, - Object { - "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", - "actualTextHeight": 45, - "actualTextWidth": 363, - "height": 61, - "multiLineActualTexts": Array [ - "浙江省浙江省浙江省浙", - "江省浙江省浙江省浙江", - "省浙江省浙江省浙江省", - ], - "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", - "width": 143.8, - }, - Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "浙江省", - ], - "originalText": "浙江省", - "width": 143.8, - }, - Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "浙江省", - ], - "originalText": "浙江省", - "width": 143.8, - }, - Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "浙江省", - ], - "originalText": "浙江省", - "width": 143.8, - }, Object { "actualText": "浙江省", "actualTextHeight": 15, @@ -12703,18 +22258,18 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], "originalText": "浙江省", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "浙江省", @@ -12725,7 +22280,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "浙江省", @@ -12736,18 +22291,18 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 100, "multiLineActualTexts": Array [ "浙江省", ], "originalText": "浙江省", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "浙江省", @@ -12758,7 +22313,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "浙江省", @@ -12769,7 +22324,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "浙江省", @@ -12780,7 +22335,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "浙江省", @@ -12791,7 +22346,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "浙江省", @@ -12802,7 +22357,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "浙江省", @@ -12813,97 +22368,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 143.8, - }, - Object { - "actualText": "杭州杭州杭州杭州", - "actualTextHeight": 15, - "actualTextWidth": 97, - "height": 46, - "multiLineActualTexts": Array [ - "杭州杭州杭州杭州", - ], - "originalText": "杭州杭州杭州杭州", - "width": 143.8, - }, - Object { - "actualText": "绍兴市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "绍兴市", - ], - "originalText": "绍兴市", - "width": 143.8, - }, - Object { - "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", - "actualTextHeight": 45, - "actualTextWidth": 363, - "height": 61, - "multiLineActualTexts": Array [ - "杭州市杭州市杭州市杭", - "州市杭州市杭州市杭州", - "市杭州市杭州市杭州市", - ], - "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", - "width": 143.8, - }, - Object { - "actualText": "绍兴市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "绍兴市", - ], - "originalText": "绍兴市", - "width": 143.8, - }, - Object { - "actualText": "宁波市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "宁波市", - ], - "originalText": "宁波市", - "width": 143.8, - }, - Object { - "actualText": "舟山市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "舟山市", - ], - "originalText": "舟山市", - "width": 143.8, - }, - Object { - "actualText": "杭州市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "杭州市", - ], - "originalText": "杭州市", - "width": 143.8, - }, - Object { - "actualText": "绍兴市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "绍兴市", - ], - "originalText": "绍兴市", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "宁波市", @@ -12914,18 +22379,18 @@ Array [ "宁波市", ], "originalText": "宁波市", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "舟山市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "舟山市", ], "originalText": "舟山市", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "杭州市", @@ -12936,7 +22401,7 @@ Array [ "杭州市", ], "originalText": "杭州市", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "绍兴市", @@ -12947,18 +22412,18 @@ Array [ "绍兴市", ], "originalText": "绍兴市", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "宁波市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 100, "multiLineActualTexts": Array [ "宁波市", ], "originalText": "宁波市", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "舟山市", @@ -12969,7 +22434,7 @@ Array [ "舟山市", ], "originalText": "舟山市", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "杭州市", @@ -12980,7 +22445,7 @@ Array [ "杭州市", ], "originalText": "杭州市", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "绍兴市", @@ -12991,7 +22456,7 @@ Array [ "绍兴市", ], "originalText": "绍兴市", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "宁波市", @@ -12999,56 +22464,32 @@ Array [ "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "宁波市", - ], - "originalText": "宁波市", - "width": 143.8, - }, - Object { - "actualText": "纸张纸张纸张纸张纸张", - "actualTextHeight": 15, - "actualTextWidth": 121, - "height": 46, - "multiLineActualTexts": Array [ - "纸张纸张纸张纸张纸张", - ], - "originalText": "纸张纸张纸张纸张纸张", - "width": 143.8, - }, - Object { - "actualText": "家具", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, - "multiLineActualTexts": Array [ - "家具", + "宁波市", ], - "originalText": "家具", - "width": 143.8, + "originalText": "宁波市", + "width": 103.8, }, Object { - "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "actualTextHeight": 45, - "actualTextWidth": 339, - "height": 61, + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "家具家具家具家具家具", - "家具家具家具家具家具", - "家具家具家具家具", + "舟山市", ], - "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "width": 143.8, + "originalText": "舟山市", + "width": 103.8, }, Object { - "actualText": "家具", + "actualText": "杭州市", "actualTextHeight": 15, - "actualTextWidth": 25, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "家具", + "杭州市", ], - "originalText": "家具", - "width": 143.8, + "originalText": "杭州市", + "width": 103.8, }, Object { "actualText": "家具", @@ -13059,18 +22500,18 @@ Array [ "家具", ], "originalText": "家具", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "家具", ], "originalText": "家具", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "家具", @@ -13081,7 +22522,7 @@ Array [ "家具", ], "originalText": "家具", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "家具", @@ -13092,18 +22533,18 @@ Array [ "家具", ], "originalText": "家具", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 100, "multiLineActualTexts": Array [ "家具", ], "originalText": "家具", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "家具", @@ -13114,29 +22555,7 @@ Array [ "家具", ], "originalText": "家具", - "width": 143.8, - }, - Object { - "actualText": "办公用品", - "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 30, - "multiLineActualTexts": Array [ - "办公用品", - ], - "originalText": "办公用品", - "width": 143.8, - }, - Object { - "actualText": "办公用品", - "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 30, - "multiLineActualTexts": Array [ - "办公用品", - ], - "originalText": "办公用品", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "办公用品", @@ -13147,7 +22566,7 @@ Array [ "办公用品", ], "originalText": "办公用品", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "办公用品", @@ -13158,7 +22577,7 @@ Array [ "办公用品", ], "originalText": "办公用品", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "办公用品", @@ -13169,7 +22588,7 @@ Array [ "办公用品", ], "originalText": "办公用品", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "办公用品", @@ -13180,7 +22599,7 @@ Array [ "办公用品", ], "originalText": "办公用品", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "办公用品", @@ -13191,53 +22610,7 @@ Array [ "办公用品", ], "originalText": "办公用品", - "width": 143.8, - }, - Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 46, - "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 143.8, - }, - Object { - "actualText": "桌子", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, - "multiLineActualTexts": Array [ - "桌子", - ], - "originalText": "桌子", - "width": 143.8, - }, - Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", - "actualTextHeight": 45, - "actualTextWidth": 363, - "height": 61, - "multiLineActualTexts": Array [ - "桌子桌子桌子桌子桌子", - "桌子桌子桌子桌子桌子", - "桌子桌子桌子桌子桌子", - ], - "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", - "width": 143.8, - }, - Object { - "actualText": "桌子", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, - "multiLineActualTexts": Array [ - "桌子", - ], - "originalText": "桌子", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "桌子", @@ -13248,18 +22621,18 @@ Array [ "桌子", ], "originalText": "桌子", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "桌子", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "桌子", ], "originalText": "桌子", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "沙发", @@ -13270,7 +22643,7 @@ Array [ "沙发", ], "originalText": "沙发", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "沙发", @@ -13281,18 +22654,18 @@ Array [ "沙发", ], "originalText": "沙发", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "沙发", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 100, "multiLineActualTexts": Array [ "沙发", ], "originalText": "沙发", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "沙发", @@ -13303,7 +22676,7 @@ Array [ "沙发", ], "originalText": "沙发", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "笔", @@ -13314,7 +22687,7 @@ Array [ "笔", ], "originalText": "笔", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "笔", @@ -13325,7 +22698,7 @@ Array [ "笔", ], "originalText": "笔", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "笔", @@ -13336,7 +22709,7 @@ Array [ "笔", ], "originalText": "笔", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "笔", @@ -13347,29 +22720,7 @@ Array [ "笔", ], "originalText": "笔", - "width": 143.8, - }, - Object { - "actualText": "纸张", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, - "multiLineActualTexts": Array [ - "纸张", - ], - "originalText": "纸张", - "width": 143.8, - }, - Object { - "actualText": "纸张", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, - "multiLineActualTexts": Array [ - "纸张", - ], - "originalText": "纸张", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "纸张", @@ -13380,52 +22731,7 @@ Array [ "纸张", ], "originalText": "纸张", - "width": 143.8, - }, - Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 46, - "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 143.8, - }, - Object { - "actualText": "236723672361111", - "actualTextHeight": 15, - "actualTextWidth": 98, - "height": 30, - "multiLineActualTexts": Array [ - "236723672361111", - ], - "originalText": 236723672361111, - "width": 143.8, - }, - Object { - "actualText": "7789778977897789778977897789", - "actualTextHeight": 30, - "actualTextWidth": 188, - "height": 61, - "multiLineActualTexts": Array [ - "7789778977897789778", - "977897789", - ], - "originalText": "7789778977897789778977897789", - "width": 143.8, - }, - Object { - "actualText": "236723672361111", - "actualTextHeight": 15, - "actualTextWidth": 98, - "height": 30, - "multiLineActualTexts": Array [ - "236723672361111", - ], - "originalText": 236723672361111, - "width": 143.8, + "width": 103.8, }, Object { "actualText": "3877", @@ -13436,18 +22742,18 @@ Array [ "3877", ], "originalText": 3877, - "width": 143.8, + "width": 103.8, }, Object { "actualText": "4342", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "4342", ], "originalText": 4342, - "width": 143.8, + "width": 103.8, }, Object { "actualText": "5343", @@ -13458,7 +22764,7 @@ Array [ "5343", ], "originalText": 5343, - "width": 143.8, + "width": 103.8, }, Object { "actualText": "632", @@ -13469,18 +22775,18 @@ Array [ "632", ], "originalText": 632, - "width": 143.8, + "width": 103.8, }, Object { "actualText": "7234", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 100, "multiLineActualTexts": Array [ "7234", ], "originalText": 7234, - "width": 143.8, + "width": 103.8, }, Object { "actualText": "834", @@ -13491,7 +22797,7 @@ Array [ "834", ], "originalText": 834, - "width": 143.8, + "width": 103.8, }, Object { "actualText": "945", @@ -13502,7 +22808,7 @@ Array [ "945", ], "originalText": 945, - "width": 143.8, + "width": 103.8, }, Object { "actualText": "1304", @@ -13513,7 +22819,7 @@ Array [ "1304", ], "originalText": 1304, - "width": 143.8, + "width": 103.8, }, Object { "actualText": "1145", @@ -13524,7 +22830,7 @@ Array [ "1145", ], "originalText": 1145, - "width": 143.8, + "width": 103.8, }, Object { "actualText": "1432", @@ -13535,7 +22841,7 @@ Array [ "1432", ], "originalText": 1432, - "width": 143.8, + "width": 103.8, }, Object { "actualText": "1343", @@ -13546,40 +22852,18 @@ Array [ "1343", ], "originalText": 1343, - "width": 143.8, - }, - Object { - "actualText": "1354", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, - "multiLineActualTexts": Array [ - "1354", - ], - "originalText": 1354, - "width": 143.8, - }, - Object { - "actualText": "1523", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, - "multiLineActualTexts": Array [ - "1523", - ], - "originalText": 1523, - "width": 143.8, + "width": 103.8, }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should default render one line text 1`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should get correctly cell height priority if actual text wrap 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 30, + "height": 70, "multiLineActualTexts": Array [ "序号", ], @@ -13589,13 +22873,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should default render one line text 2`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should get correctly cell height priority if actual text wrap 2`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 70, "multiLineActualTexts": Array [ "1", ], @@ -13606,7 +22890,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 100, "multiLineActualTexts": Array [ "2", ], @@ -13617,7 +22901,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 46, "multiLineActualTexts": Array [ "3", ], @@ -13668,82 +22952,16 @@ Array [ "originalText": 7, "width": 80, }, - Object { - "actualText": "8", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, - "multiLineActualTexts": Array [ - "8", - ], - "originalText": 8, - "width": 80, - }, - Object { - "actualText": "9", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, - "multiLineActualTexts": Array [ - "9", - ], - "originalText": 9, - "width": 80, - }, - Object { - "actualText": "10", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, - "multiLineActualTexts": Array [ - "10", - ], - "originalText": 10, - "width": 80, - }, - Object { - "actualText": "11", - "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 30, - "multiLineActualTexts": Array [ - "11", - ], - "originalText": 11, - "width": 80, - }, - Object { - "actualText": "12", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, - "multiLineActualTexts": Array [ - "12", - ], - "originalText": 12, - "width": 80, - }, - Object { - "actualText": "13", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, - "multiLineActualTexts": Array [ - "13", - ], - "originalText": 13, - "width": 80, - }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should default render one line text 3`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should get correctly cell height priority if actual text wrap 3`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 30, + "height": 70, "multiLineActualTexts": Array [ "序号", ], @@ -13754,7 +22972,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 30, + "height": 70, "multiLineActualTexts": Array [ "省份", ], @@ -13762,270 +22980,144 @@ Array [ "width": 103.8, }, Object { - "actualText": "城市城市城市...", - "actualTextHeight": 16, - "actualTextWidth": 83, - "height": 30, + "actualText": "城市城市城市城市城市城市城市城市城市城市...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 70, "multiLineActualTexts": Array [ + "城市城市城市城", + "市城市城市城市", "城市城市城市...", ], "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", "width": 103.8, }, Object { - "actualText": "类别类别类别...", - "actualTextHeight": 16, - "actualTextWidth": 83, - "height": 30, + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 48, + "actualTextWidth": 243, + "height": 70, "multiLineActualTexts": Array [ - "类别类别类别...", + "类别类别类别类", + "别类别类别类别", + "类别类别类别", ], "originalText": "类别类别类别类别类别类别类别类别类别类别", "width": 103.8, }, Object { - "actualText": "子类别", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "子类别", - ], - "originalText": "子类别", - "width": 103.8, - }, - Object { - "actualText": "数量数量数量...", - "actualTextHeight": 16, - "actualTextWidth": 83, - "height": 30, - "multiLineActualTexts": Array [ - "数量数量数量...", - ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 103.8, - }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should default render one line text 4`] = `Array []`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should default render one line text 5`] = ` -Array [ - Object { - "actualText": "1", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, - "multiLineActualTexts": Array [ - "1", - ], - "originalText": 1, - "width": 80, - }, - Object { - "actualText": "2", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, - "multiLineActualTexts": Array [ - "2", - ], - "originalText": 2, - "width": 80, - }, - Object { - "actualText": "3", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, - "multiLineActualTexts": Array [ - "3", - ], - "originalText": 3, - "width": 80, - }, - Object { - "actualText": "4", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, - "multiLineActualTexts": Array [ - "4", - ], - "originalText": 4, - "width": 80, - }, - Object { - "actualText": "5", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, - "multiLineActualTexts": Array [ - "5", - ], - "originalText": 5, - "width": 80, - }, - Object { - "actualText": "6", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, - "multiLineActualTexts": Array [ - "6", - ], - "originalText": 6, - "width": 80, - }, - Object { - "actualText": "7", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, - "multiLineActualTexts": Array [ - "7", - ], - "originalText": 7, - "width": 80, - }, - Object { - "actualText": "8", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, - "multiLineActualTexts": Array [ - "8", - ], - "originalText": 8, - "width": 80, - }, - Object { - "actualText": "9", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, - "multiLineActualTexts": Array [ - "9", - ], - "originalText": 9, - "width": 80, - }, - Object { - "actualText": "10", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, - "multiLineActualTexts": Array [ - "10", - ], - "originalText": 10, - "width": 80, - }, - Object { - "actualText": "11", - "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 30, + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 70, "multiLineActualTexts": Array [ - "11", + "子类别", ], - "originalText": 11, - "width": 80, + "originalText": "子类别", + "width": 103.8, }, Object { - "actualText": "12", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 70, "multiLineActualTexts": Array [ - "12", + "数量数量数量数", + "量数量数量数量", + "数量数量数量...", ], - "originalText": 12, - "width": 80, + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 103.8, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should get correctly cell height priority if actual text wrap 4`] = `Array []`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should get correctly cell height priority if actual text wrap 5`] = ` +Array [ Object { - "actualText": "13", + "actualText": "1", "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, + "actualTextWidth": 7, + "height": 70, "multiLineActualTexts": Array [ - "13", + "1", ], - "originalText": 13, + "originalText": 1, "width": 80, }, Object { - "actualText": "浙江省", + "actualText": "2", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 7, + "height": 100, "multiLineActualTexts": Array [ - "浙江省", + "2", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": 2, + "width": 80, }, Object { - "actualText": "浙江省浙江省...", + "actualText": "3", "actualTextHeight": 15, - "actualTextWidth": 83, - "height": 30, + "actualTextWidth": 7, + "height": 46, "multiLineActualTexts": Array [ - "浙江省浙江省...", + "3", ], - "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", - "width": 103.8, + "originalText": 3, + "width": 80, }, Object { - "actualText": "浙江省", + "actualText": "4", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "4", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": 4, + "width": 80, }, Object { - "actualText": "浙江省", + "actualText": "5", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "5", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": 5, + "width": 80, }, Object { - "actualText": "浙江省", + "actualText": "6", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "6", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": 6, + "width": 80, }, Object { - "actualText": "浙江省", + "actualText": "7", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "7", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": 7, + "width": 80, }, Object { "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 70, "multiLineActualTexts": Array [ "浙江省", ], @@ -14033,21 +23125,25 @@ Array [ "width": 103.8, }, Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "actualTextHeight": 75, + "actualTextWidth": 365, + "height": 100, "multiLineActualTexts": Array [ - "浙江省", + "浙江省浙江省浙", + "江省浙江省浙江", + "省浙江省浙江省", + "浙江省浙江省浙", + "江省", ], - "originalText": "浙江省", + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 103.8, }, Object { "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 46, "multiLineActualTexts": Array [ "浙江省", ], @@ -14102,7 +23198,7 @@ Array [ "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 70, "multiLineActualTexts": Array [ "绍兴市", ], @@ -14110,12 +23206,16 @@ Array [ "width": 103.8, }, Object { - "actualText": "杭州市杭州市...", - "actualTextHeight": 15, - "actualTextWidth": 83, - "height": 30, + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "actualTextHeight": 75, + "actualTextWidth": 365, + "height": 100, "multiLineActualTexts": Array [ - "杭州市杭州市...", + "杭州市杭州市杭", + "州市杭州市杭州", + "市杭州市杭州市", + "杭州市杭州市杭", + "州市", ], "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", "width": 103.8, @@ -14124,51 +23224,7 @@ Array [ "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "绍兴市", - ], - "originalText": "绍兴市", - "width": 103.8, - }, - Object { - "actualText": "宁波市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "宁波市", - ], - "originalText": "宁波市", - "width": 103.8, - }, - Object { - "actualText": "舟山市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "舟山市", - ], - "originalText": "舟山市", - "width": 103.8, - }, - Object { - "actualText": "杭州市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "杭州市", - ], - "originalText": "杭州市", - "width": 103.8, - }, - Object { - "actualText": "绍兴市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "height": 46, "multiLineActualTexts": Array [ "绍兴市", ], @@ -14219,33 +23275,11 @@ Array [ "originalText": "绍兴市", "width": 103.8, }, - Object { - "actualText": "宁波市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "宁波市", - ], - "originalText": "宁波市", - "width": 103.8, - }, - Object { - "actualText": "舟山市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "舟山市", - ], - "originalText": "舟山市", - "width": 103.8, - }, Object { "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 70, "multiLineActualTexts": Array [ "家具", ], @@ -14253,12 +23287,15 @@ Array [ "width": 103.8, }, Object { - "actualText": "家具家具家具...", - "actualTextHeight": 15, - "actualTextWidth": 83, - "height": 30, + "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "actualTextHeight": 60, + "actualTextWidth": 340, + "height": 100, "multiLineActualTexts": Array [ - "家具家具家具...", + "家具家具家具家", + "具家具家具家具", + "家具家具家具家", + "具家具家具家具", ], "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", "width": 103.8, @@ -14267,29 +23304,7 @@ Array [ "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, - "multiLineActualTexts": Array [ - "家具", - ], - "originalText": "家具", - "width": 103.8, - }, - Object { - "actualText": "家具", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, - "multiLineActualTexts": Array [ - "家具", - ], - "originalText": "家具", - "width": 103.8, - }, - Object { - "actualText": "家具", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "height": 46, "multiLineActualTexts": Array [ "家具", ], @@ -14340,55 +23355,11 @@ Array [ "originalText": "家具", "width": 103.8, }, - Object { - "actualText": "办公用品", - "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 30, - "multiLineActualTexts": Array [ - "办公用品", - ], - "originalText": "办公用品", - "width": 103.8, - }, - Object { - "actualText": "办公用品", - "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 30, - "multiLineActualTexts": Array [ - "办公用品", - ], - "originalText": "办公用品", - "width": 103.8, - }, - Object { - "actualText": "办公用品", - "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 30, - "multiLineActualTexts": Array [ - "办公用品", - ], - "originalText": "办公用品", - "width": 103.8, - }, - Object { - "actualText": "办公用品", - "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 30, - "multiLineActualTexts": Array [ - "办公用品", - ], - "originalText": "办公用品", - "width": 103.8, - }, Object { "actualText": "桌子", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 70, "multiLineActualTexts": Array [ "桌子", ], @@ -14396,12 +23367,16 @@ Array [ "width": 103.8, }, Object { - "actualText": "桌子桌子桌子...", - "actualTextHeight": 15, - "actualTextWidth": 83, - "height": 30, + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "actualTextHeight": 75, + "actualTextWidth": 365, + "height": 100, "multiLineActualTexts": Array [ - "桌子桌子桌子...", + "桌子桌子桌子桌", + "子桌子桌子桌子", + "桌子桌子桌子桌", + "子桌子桌子桌子", + "桌子", ], "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", "width": 103.8, @@ -14410,7 +23385,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 46, "multiLineActualTexts": Array [ "桌子", ], @@ -14462,100 +23437,38 @@ Array [ "width": 103.8, }, Object { - "actualText": "沙发", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, - "multiLineActualTexts": Array [ - "沙发", - ], - "originalText": "沙发", - "width": 103.8, - }, - Object { - "actualText": "沙发", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, - "multiLineActualTexts": Array [ - "沙发", - ], - "originalText": "沙发", - "width": 103.8, - }, - Object { - "actualText": "笔", - "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 30, - "multiLineActualTexts": Array [ - "笔", - ], - "originalText": "笔", - "width": 103.8, - }, - Object { - "actualText": "笔", - "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 30, - "multiLineActualTexts": Array [ - "笔", - ], - "originalText": "笔", - "width": 103.8, - }, - Object { - "actualText": "笔", - "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 30, - "multiLineActualTexts": Array [ - "笔", - ], - "originalText": "笔", - "width": 103.8, - }, - Object { - "actualText": "笔", - "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 30, - "multiLineActualTexts": Array [ - "笔", - ], - "originalText": "笔", - "width": 103.8, - }, - Object { - "actualText": "23672367236...", - "actualTextHeight": 15, - "actualTextWidth": 84, - "height": 30, + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 70, "multiLineActualTexts": Array [ - "23672367236...", + "2367236723611", + "11", ], "originalText": 236723672361111, "width": 103.8, }, Object { - "actualText": "77897789778...", - "actualTextHeight": 15, - "actualTextWidth": 84, - "height": 30, + "actualText": "7789778977897789778977897789", + "actualTextHeight": 45, + "actualTextWidth": 189, + "height": 100, "multiLineActualTexts": Array [ - "77897789778...", + "7789778977897", + "7897789778977", + "89", ], "originalText": "7789778977897789778977897789", "width": 103.8, }, Object { - "actualText": "23672367236...", - "actualTextHeight": 15, - "actualTextWidth": 84, - "height": 30, + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 46, "multiLineActualTexts": Array [ - "23672367236...", + "2367236723611", + "11", ], "originalText": 236723672361111, "width": 103.8, @@ -14604,82 +23517,16 @@ Array [ "originalText": 632, "width": 103.8, }, - Object { - "actualText": "7234", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, - "multiLineActualTexts": Array [ - "7234", - ], - "originalText": 7234, - "width": 103.8, - }, - Object { - "actualText": "834", - "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 30, - "multiLineActualTexts": Array [ - "834", - ], - "originalText": 834, - "width": 103.8, - }, - Object { - "actualText": "945", - "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 30, - "multiLineActualTexts": Array [ - "945", - ], - "originalText": 945, - "width": 103.8, - }, - Object { - "actualText": "1304", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, - "multiLineActualTexts": Array [ - "1304", - ], - "originalText": 1304, - "width": 103.8, - }, - Object { - "actualText": "1145", - "actualTextHeight": 15, - "actualTextWidth": 26, - "height": 30, - "multiLineActualTexts": Array [ - "1145", - ], - "originalText": 1145, - "width": 103.8, - }, - Object { - "actualText": "1432", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, - "multiLineActualTexts": Array [ - "1432", - ], - "originalText": 1432, - "width": 103.8, - }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should force adaptive adjust row height if custom cell style more than actual text height by rowCell.height 1`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust cell height if custom cell style more than actual text height by colCell.heightByField 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 100, "multiLineActualTexts": Array [ "序号", ], @@ -14689,7 +23536,7 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should force adaptive adjust row height if custom cell style more than actual text height by rowCell.height 2`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust cell height if custom cell style more than actual text height by colCell.heightByField 2`] = ` Array [ Object { "actualText": "1", @@ -14706,7 +23553,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 61, + "height": 76, "multiLineActualTexts": Array [ "2", ], @@ -14776,41 +23623,19 @@ Array [ "multiLineActualTexts": Array [ "8", ], - "originalText": 8, - "width": 80, - }, - Object { - "actualText": "9", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, - "multiLineActualTexts": Array [ - "9", - ], - "originalText": 9, - "width": 80, - }, - Object { - "actualText": "10", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, - "multiLineActualTexts": Array [ - "10", - ], - "originalText": 10, + "originalText": 8, "width": 80, }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should force adaptive adjust row height if custom cell style more than actual text height by rowCell.height 3`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust cell height if custom cell style more than actual text height by colCell.heightByField 3`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 100, "multiLineActualTexts": Array [ "序号", ], @@ -14821,7 +23646,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 100, "multiLineActualTexts": Array [ "省份", ], @@ -14829,27 +23654,27 @@ Array [ "width": 103.8, }, Object { - "actualText": "城市城市城市城市城市城市城市城市城市城市...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 56, + "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "actualTextHeight": 64, + "actualTextWidth": 292, + "height": 100, "multiLineActualTexts": Array [ "城市城市城市城", "市城市城市城市", - "城市城市城市...", + "城市城市城市城", + "市城市", ], "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", "width": 103.8, }, Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", - "actualTextHeight": 48, - "actualTextWidth": 243, - "height": 56, + "actualText": "类别类别类别类别类别类别类...", + "actualTextHeight": 32, + "actualTextWidth": 168, + "height": 50, "multiLineActualTexts": Array [ "类别类别类别类", - "别类别类别类别", - "类别类别类别", + "别类别类别类...", ], "originalText": "类别类别类别类别类别类别类别类别类别类别", "width": 103.8, @@ -14858,7 +23683,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 56, + "height": 100, "multiLineActualTexts": Array [ "子类别", ], @@ -14866,14 +23691,15 @@ Array [ "width": 103.8, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 56, + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 64, + "actualTextWidth": 268, + "height": 100, "multiLineActualTexts": Array [ "数量数量数量数", "量数量数量数量", - "数量数量数量...", + "数量数量数量数", + "量", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 103.8, @@ -14881,9 +23707,9 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should force adaptive adjust row height if custom cell style more than actual text height by rowCell.height 4`] = `Array []`; +exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust cell height if custom cell style more than actual text height by colCell.heightByField 4`] = `Array []`; -exports[`SpreadSheet Multi Line Text Tests TableSheet should force adaptive adjust row height if custom cell style more than actual text height by rowCell.height 5`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust cell height if custom cell style more than actual text height by colCell.heightByField 5`] = ` Array [ Object { "actualText": "1", @@ -14900,7 +23726,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 61, + "height": 76, "multiLineActualTexts": Array [ "2", ], @@ -14973,28 +23799,6 @@ Array [ "originalText": 8, "width": 80, }, - Object { - "actualText": "9", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, - "multiLineActualTexts": Array [ - "9", - ], - "originalText": 9, - "width": 80, - }, - Object { - "actualText": "10", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, - "multiLineActualTexts": Array [ - "10", - ], - "originalText": 10, - "width": 80, - }, Object { "actualText": "浙江省", "actualTextHeight": 15, @@ -15007,14 +23811,15 @@ Array [ "width": 103.8, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 61, + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省...", + "actualTextHeight": 60, + "actualTextWidth": 338, + "height": 76, "multiLineActualTexts": Array [ "浙江省浙江省浙", "江省浙江省浙江", - "省浙江省浙江...", + "省浙江省浙江省", + "浙江省浙江省...", ], "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 103.8, @@ -15085,28 +23890,6 @@ Array [ "originalText": "浙江省", "width": 103.8, }, - Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "浙江省", - ], - "originalText": "浙江省", - "width": 103.8, - }, - Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "浙江省", - ], - "originalText": "浙江省", - "width": 103.8, - }, Object { "actualText": "绍兴市", "actualTextHeight": 15, @@ -15119,14 +23902,15 @@ Array [ "width": 103.8, }, Object { - "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 61, + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市...", + "actualTextHeight": 60, + "actualTextWidth": 338, + "height": 76, "multiLineActualTexts": Array [ "杭州市杭州市杭", "州市杭州市杭州", - "市杭州市杭州...", + "市杭州市杭州市", + "杭州市杭州市...", ], "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", "width": 103.8, @@ -15197,28 +23981,6 @@ Array [ "originalText": "宁波市", "width": 103.8, }, - Object { - "actualText": "舟山市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "舟山市", - ], - "originalText": "舟山市", - "width": 103.8, - }, - Object { - "actualText": "杭州市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "杭州市", - ], - "originalText": "杭州市", - "width": 103.8, - }, Object { "actualText": "家具", "actualTextHeight": 15, @@ -15231,14 +23993,15 @@ Array [ "width": 103.8, }, Object { - "actualText": "家具家具家具家具家具家具家具家具家具家具...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 61, + "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "actualTextHeight": 60, + "actualTextWidth": 340, + "height": 76, "multiLineActualTexts": Array [ "家具家具家具家", "具家具家具家具", - "家具家具家具...", + "家具家具家具家", + "具家具家具家具", ], "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", "width": 103.8, @@ -15309,28 +24072,6 @@ Array [ "originalText": "家具", "width": 103.8, }, - Object { - "actualText": "家具", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, - "multiLineActualTexts": Array [ - "家具", - ], - "originalText": "家具", - "width": 103.8, - }, - Object { - "actualText": "办公用品", - "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 30, - "multiLineActualTexts": Array [ - "办公用品", - ], - "originalText": "办公用品", - "width": 103.8, - }, Object { "actualText": "桌子", "actualTextHeight": 15, @@ -15343,14 +24084,15 @@ Array [ "width": 103.8, }, Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 61, + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌...", + "actualTextHeight": 60, + "actualTextWidth": 338, + "height": 76, "multiLineActualTexts": Array [ "桌子桌子桌子桌", "子桌子桌子桌子", - "桌子桌子桌子...", + "桌子桌子桌子桌", + "子桌子桌子桌...", ], "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", "width": 103.8, @@ -15421,28 +24163,6 @@ Array [ "originalText": "沙发", "width": 103.8, }, - Object { - "actualText": "沙发", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, - "multiLineActualTexts": Array [ - "沙发", - ], - "originalText": "沙发", - "width": 103.8, - }, - Object { - "actualText": "笔", - "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 30, - "multiLineActualTexts": Array [ - "笔", - ], - "originalText": "笔", - "width": 103.8, - }, Object { "actualText": "236723672361111", "actualTextHeight": 30, @@ -15459,7 +24179,7 @@ Array [ "actualText": "7789778977897789778977897789", "actualTextHeight": 45, "actualTextWidth": 189, - "height": 61, + "height": 76, "multiLineActualTexts": Array [ "7789778977897", "7897789778977", @@ -15535,38 +24255,93 @@ Array [ "originalText": 7234, "width": 103.8, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust cell height, but should adjust maxLines if custom cell style more than actual text height 1`] = ` +Array [ Object { - "actualText": "834", - "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 30, + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 70, "multiLineActualTexts": Array [ - "834", + "序号", ], - "originalText": 834, + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 70, + "multiLineActualTexts": Array [ + "省份", + ], + "originalText": "省份", "width": 103.8, }, Object { - "actualText": "945", - "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 30, + "actualText": "城市城市城市城市城市城市城市城市城市城市...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 70, "multiLineActualTexts": Array [ - "945", + "城市城市城市城", + "市城市城市城市", + "城市城市城市...", ], - "originalText": 945, + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "width": 103.8, + }, + Object { + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 48, + "actualTextWidth": 243, + "height": 70, + "multiLineActualTexts": Array [ + "类别类别类别类", + "别类别类别类别", + "类别类别类别", + ], + "originalText": "类别类别类别类别类别类别类别类别类别类别", + "width": 103.8, + }, + Object { + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 70, + "multiLineActualTexts": Array [ + "子类别", + ], + "originalText": "子类别", + "width": 103.8, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 70, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 103.8, }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should force adaptive adjust row height if custom cell style more than actual text height by rowCell.heightByField 1`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust data cell height, but should adjust maxLines if custom cell style less than actual text height by dataCell.height 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 48, "multiLineActualTexts": Array [ "序号", ], @@ -15576,13 +24351,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should force adaptive adjust row height if custom cell style more than actual text height by rowCell.heightByField 2`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust data cell height, but should adjust maxLines if custom cell style less than actual text height by dataCell.height 2`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "1", ], @@ -15593,7 +24368,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 61, + "height": 20, "multiLineActualTexts": Array [ "2", ], @@ -15604,7 +24379,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "3", ], @@ -15615,7 +24390,7 @@ Array [ "actualText": "4", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "4", ], @@ -15626,7 +24401,7 @@ Array [ "actualText": "5", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "5", ], @@ -15637,7 +24412,7 @@ Array [ "actualText": "6", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "6", ], @@ -15648,7 +24423,7 @@ Array [ "actualText": "7", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "7", ], @@ -15659,7 +24434,7 @@ Array [ "actualText": "8", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "8", ], @@ -15670,7 +24445,7 @@ Array [ "actualText": "9", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "9", ], @@ -15681,23 +24456,111 @@ Array [ "actualText": "10", "actualTextHeight": 15, "actualTextWidth": 14, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "10", ], "originalText": 10, "width": 80, }, + Object { + "actualText": "11", + "actualTextHeight": 15, + "actualTextWidth": 13, + "height": 20, + "multiLineActualTexts": Array [ + "11", + ], + "originalText": 11, + "width": 80, + }, + Object { + "actualText": "12", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, + "multiLineActualTexts": Array [ + "12", + ], + "originalText": 12, + "width": 80, + }, + Object { + "actualText": "13", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, + "multiLineActualTexts": Array [ + "13", + ], + "originalText": 13, + "width": 80, + }, + Object { + "actualText": "14", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, + "multiLineActualTexts": Array [ + "14", + ], + "originalText": 14, + "width": 80, + }, + Object { + "actualText": "15", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, + "multiLineActualTexts": Array [ + "15", + ], + "originalText": 15, + "width": 80, + }, + Object { + "actualText": "16", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, + "multiLineActualTexts": Array [ + "16", + ], + "originalText": 16, + "width": 80, + }, + Object { + "actualText": "17", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, + "multiLineActualTexts": Array [ + "17", + ], + "originalText": 17, + "width": 80, + }, + Object { + "actualText": "18", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, + "multiLineActualTexts": Array [ + "18", + ], + "originalText": 18, + "width": 80, + }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should force adaptive adjust row height if custom cell style more than actual text height by rowCell.heightByField 3`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust data cell height, but should adjust maxLines if custom cell style less than actual text height by dataCell.height 3`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 48, "multiLineActualTexts": Array [ "序号", ], @@ -15708,7 +24571,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 48, "multiLineActualTexts": Array [ "省份", ], @@ -15716,27 +24579,25 @@ Array [ "width": 103.8, }, Object { - "actualText": "城市城市城市城市城市城市城市城市城市城市...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 56, + "actualText": "城市城市城市城市城市城市城...", + "actualTextHeight": 32, + "actualTextWidth": 168, + "height": 48, "multiLineActualTexts": Array [ "城市城市城市城", - "市城市城市城市", - "城市城市城市...", + "市城市城市城...", ], "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", "width": 103.8, }, Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", - "actualTextHeight": 48, - "actualTextWidth": 243, - "height": 56, + "actualText": "类别类别类别类别类别类别类...", + "actualTextHeight": 32, + "actualTextWidth": 168, + "height": 48, "multiLineActualTexts": Array [ "类别类别类别类", - "别类别类别类别", - "类别类别类别", + "别类别类别类...", ], "originalText": "类别类别类别类别类别类别类别类别类别类别", "width": 103.8, @@ -15745,7 +24606,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 56, + "height": 48, "multiLineActualTexts": Array [ "子类别", ], @@ -15753,14 +24614,13 @@ Array [ "width": 103.8, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 56, + "actualText": "数量数量数量数量数量数量数...", + "actualTextHeight": 32, + "actualTextWidth": 168, + "height": 48, "multiLineActualTexts": Array [ "数量数量数量数", - "量数量数量数量", - "数量数量数量...", + "量数量数量数...", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 103.8, @@ -15768,15 +24628,15 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should force adaptive adjust row height if custom cell style more than actual text height by rowCell.heightByField 4`] = `Array []`; +exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust data cell height, but should adjust maxLines if custom cell style less than actual text height by dataCell.height 4`] = `Array []`; -exports[`SpreadSheet Multi Line Text Tests TableSheet should force adaptive adjust row height if custom cell style more than actual text height by rowCell.heightByField 5`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust data cell height, but should adjust maxLines if custom cell style less than actual text height by dataCell.height 5`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "1", ], @@ -15787,7 +24647,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 61, + "height": 20, "multiLineActualTexts": Array [ "2", ], @@ -15798,7 +24658,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "3", ], @@ -15809,84 +24669,172 @@ Array [ "actualText": "4", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, + "multiLineActualTexts": Array [ + "4", + ], + "originalText": 4, + "width": 80, + }, + Object { + "actualText": "5", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 20, + "multiLineActualTexts": Array [ + "5", + ], + "originalText": 5, + "width": 80, + }, + Object { + "actualText": "6", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 20, + "multiLineActualTexts": Array [ + "6", + ], + "originalText": 6, + "width": 80, + }, + Object { + "actualText": "7", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 20, + "multiLineActualTexts": Array [ + "7", + ], + "originalText": 7, + "width": 80, + }, + Object { + "actualText": "8", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 20, + "multiLineActualTexts": Array [ + "8", + ], + "originalText": 8, + "width": 80, + }, + Object { + "actualText": "9", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 20, + "multiLineActualTexts": Array [ + "9", + ], + "originalText": 9, + "width": 80, + }, + Object { + "actualText": "10", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, + "multiLineActualTexts": Array [ + "10", + ], + "originalText": 10, + "width": 80, + }, + Object { + "actualText": "11", + "actualTextHeight": 15, + "actualTextWidth": 13, + "height": 20, + "multiLineActualTexts": Array [ + "11", + ], + "originalText": 11, + "width": 80, + }, + Object { + "actualText": "12", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, "multiLineActualTexts": Array [ - "4", + "12", ], - "originalText": 4, + "originalText": 12, "width": 80, }, Object { - "actualText": "5", + "actualText": "13", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, + "actualTextWidth": 14, + "height": 20, "multiLineActualTexts": Array [ - "5", + "13", ], - "originalText": 5, + "originalText": 13, "width": 80, }, Object { - "actualText": "6", + "actualText": "14", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, + "actualTextWidth": 14, + "height": 20, "multiLineActualTexts": Array [ - "6", + "14", ], - "originalText": 6, + "originalText": 14, "width": 80, }, Object { - "actualText": "7", + "actualText": "15", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, + "actualTextWidth": 14, + "height": 20, "multiLineActualTexts": Array [ - "7", + "15", ], - "originalText": 7, + "originalText": 15, "width": 80, }, Object { - "actualText": "8", + "actualText": "16", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, + "actualTextWidth": 14, + "height": 20, "multiLineActualTexts": Array [ - "8", + "16", ], - "originalText": 8, + "originalText": 16, "width": 80, }, Object { - "actualText": "9", + "actualText": "17", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, + "actualTextWidth": 14, + "height": 20, "multiLineActualTexts": Array [ - "9", + "17", ], - "originalText": 9, + "originalText": 17, "width": 80, }, Object { - "actualText": "10", + "actualText": "18", "actualTextHeight": 15, "actualTextWidth": 14, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ - "10", + "18", ], - "originalText": 10, + "originalText": 18, "width": 80, }, Object { "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -15894,14 +24842,12 @@ Array [ "width": 103.8, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 61, + "actualText": "浙江省浙江省...", + "actualTextHeight": 15, + "actualTextWidth": 83, + "height": 20, "multiLineActualTexts": Array [ - "浙江省浙江省浙", - "江省浙江省浙江", - "省浙江省浙江...", + "浙江省浙江省...", ], "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 103.8, @@ -15910,7 +24856,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -15921,7 +24867,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -15932,7 +24878,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -15943,7 +24889,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -15954,7 +24900,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -15965,7 +24911,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -15976,7 +24922,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -15987,7 +24933,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -15995,1411 +24941,1324 @@ Array [ "width": 103.8, }, Object { - "actualText": "绍兴市", + "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 46, - "multiLineActualTexts": Array [ - "绍兴市", - ], - "originalText": "绍兴市", - "width": 103.8, - }, - Object { - "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 61, + "height": 20, "multiLineActualTexts": Array [ - "杭州市杭州市杭", - "州市杭州市杭州", - "市杭州市杭州...", + "浙江省", ], - "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "originalText": "浙江省", "width": 103.8, }, Object { - "actualText": "绍兴市", + "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ - "绍兴市", + "浙江省", ], - "originalText": "绍兴市", + "originalText": "浙江省", "width": 103.8, }, Object { - "actualText": "宁波市", + "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ - "宁波市", + "浙江省", ], - "originalText": "宁波市", + "originalText": "浙江省", "width": 103.8, }, Object { - "actualText": "舟山市", + "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ - "舟山市", + "浙江省", ], - "originalText": "舟山市", + "originalText": "浙江省", "width": 103.8, }, Object { - "actualText": "杭州市", + "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ - "杭州市", + "浙江省", ], - "originalText": "杭州市", + "originalText": "浙江省", "width": 103.8, }, Object { - "actualText": "绍兴市", + "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ - "绍兴市", + "浙江省", ], - "originalText": "绍兴市", + "originalText": "浙江省", "width": 103.8, }, Object { - "actualText": "宁波市", + "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ - "宁波市", + "浙江省", ], - "originalText": "宁波市", + "originalText": "浙江省", "width": 103.8, }, Object { - "actualText": "舟山市", + "actualText": "四川省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ - "舟山市", + "四川省", ], - "originalText": "舟山市", + "originalText": "四川省", "width": 103.8, }, Object { - "actualText": "杭州市", + "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "杭州市", - ], - "originalText": "杭州市", - "width": 103.8, - }, - Object { - "actualText": "家具", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 46, - "multiLineActualTexts": Array [ - "家具", - ], - "originalText": "家具", - "width": 103.8, - }, - Object { - "actualText": "家具家具家具家具家具家具家具家具家具家具...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 61, - "multiLineActualTexts": Array [ - "家具家具家具家", - "具家具家具家具", - "家具家具家具...", - ], - "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "width": 103.8, - }, - Object { - "actualText": "家具", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 46, - "multiLineActualTexts": Array [ - "家具", - ], - "originalText": "家具", - "width": 103.8, - }, - Object { - "actualText": "家具", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ - "家具", + "绍兴市", ], - "originalText": "家具", + "originalText": "绍兴市", "width": 103.8, }, Object { - "actualText": "家具", + "actualText": "杭州市杭州市...", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "actualTextWidth": 83, + "height": 20, "multiLineActualTexts": Array [ - "家具", + "杭州市杭州市...", ], - "originalText": "家具", + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", "width": 103.8, }, Object { - "actualText": "家具", + "actualText": "绍兴市", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "actualTextWidth": 37, + "height": 20, "multiLineActualTexts": Array [ - "家具", + "绍兴市", ], - "originalText": "家具", + "originalText": "绍兴市", "width": 103.8, }, Object { - "actualText": "家具", + "actualText": "宁波市", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "actualTextWidth": 37, + "height": 20, "multiLineActualTexts": Array [ - "家具", + "宁波市", ], - "originalText": "家具", + "originalText": "宁波市", "width": 103.8, }, Object { - "actualText": "家具", + "actualText": "舟山市", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "actualTextWidth": 37, + "height": 20, "multiLineActualTexts": Array [ - "家具", + "舟山市", ], - "originalText": "家具", + "originalText": "舟山市", "width": 103.8, }, Object { - "actualText": "家具", + "actualText": "杭州市", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "actualTextWidth": 37, + "height": 20, "multiLineActualTexts": Array [ - "家具", + "杭州市", ], - "originalText": "家具", + "originalText": "杭州市", "width": 103.8, }, Object { - "actualText": "办公用品", + "actualText": "绍兴市", "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 30, + "actualTextWidth": 37, + "height": 20, "multiLineActualTexts": Array [ - "办公用品", + "绍兴市", ], - "originalText": "办公用品", + "originalText": "绍兴市", "width": 103.8, }, Object { - "actualText": "桌子", + "actualText": "宁波市", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 46, - "multiLineActualTexts": Array [ - "桌子", - ], - "originalText": "桌子", - "width": 103.8, - }, - Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 61, + "actualTextWidth": 37, + "height": 20, "multiLineActualTexts": Array [ - "桌子桌子桌子桌", - "子桌子桌子桌子", - "桌子桌子桌子...", + "宁波市", ], - "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "originalText": "宁波市", "width": 103.8, }, Object { - "actualText": "桌子", + "actualText": "舟山市", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 46, + "actualTextWidth": 37, + "height": 20, "multiLineActualTexts": Array [ - "桌子", + "舟山市", ], - "originalText": "桌子", + "originalText": "舟山市", "width": 103.8, }, Object { - "actualText": "桌子", + "actualText": "杭州市", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "actualTextWidth": 37, + "height": 20, "multiLineActualTexts": Array [ - "桌子", + "杭州市", ], - "originalText": "桌子", + "originalText": "杭州市", "width": 103.8, }, Object { - "actualText": "桌子", + "actualText": "绍兴市", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "actualTextWidth": 37, + "height": 20, "multiLineActualTexts": Array [ - "桌子", + "绍兴市", ], - "originalText": "桌子", + "originalText": "绍兴市", "width": 103.8, }, Object { - "actualText": "沙发", + "actualText": "宁波市", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "actualTextWidth": 37, + "height": 20, "multiLineActualTexts": Array [ - "沙发", + "宁波市", ], - "originalText": "沙发", + "originalText": "宁波市", "width": 103.8, }, Object { - "actualText": "沙发", + "actualText": "舟山市", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "actualTextWidth": 37, + "height": 20, "multiLineActualTexts": Array [ - "沙发", + "舟山市", ], - "originalText": "沙发", + "originalText": "舟山市", "width": 103.8, }, Object { - "actualText": "沙发", + "actualText": "杭州市", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "actualTextWidth": 37, + "height": 20, "multiLineActualTexts": Array [ - "沙发", + "杭州市", ], - "originalText": "沙发", + "originalText": "杭州市", "width": 103.8, }, Object { - "actualText": "沙发", + "actualText": "绍兴市", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "actualTextWidth": 37, + "height": 20, "multiLineActualTexts": Array [ - "沙发", + "绍兴市", ], - "originalText": "沙发", + "originalText": "绍兴市", "width": 103.8, }, Object { - "actualText": "笔", + "actualText": "宁波市", "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 30, - "multiLineActualTexts": Array [ - "笔", - ], - "originalText": "笔", - "width": 103.8, - }, - Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, - "height": 46, - "multiLineActualTexts": Array [ - "2367236723611", - "11", - ], - "originalText": 236723672361111, - "width": 103.8, - }, - Object { - "actualText": "7789778977897789778977897789", - "actualTextHeight": 45, - "actualTextWidth": 189, - "height": 61, - "multiLineActualTexts": Array [ - "7789778977897", - "7897789778977", - "89", - ], - "originalText": "7789778977897789778977897789", - "width": 103.8, - }, - Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, - "height": 46, + "actualTextWidth": 37, + "height": 20, "multiLineActualTexts": Array [ - "2367236723611", - "11", + "宁波市", ], - "originalText": 236723672361111, + "originalText": "宁波市", "width": 103.8, }, Object { - "actualText": "3877", + "actualText": "舟山市", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualTextWidth": 37, + "height": 20, "multiLineActualTexts": Array [ - "3877", + "舟山市", ], - "originalText": 3877, + "originalText": "舟山市", "width": 103.8, }, Object { - "actualText": "4342", + "actualText": "成都市", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualTextWidth": 37, + "height": 20, "multiLineActualTexts": Array [ - "4342", + "成都市", ], - "originalText": 4342, + "originalText": "成都市", "width": 103.8, }, Object { - "actualText": "5343", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualTextWidth": 25, + "height": 20, "multiLineActualTexts": Array [ - "5343", + "家具", ], - "originalText": 5343, + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "632", + "actualText": "家具家具家具...", "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 30, + "actualTextWidth": 83, + "height": 20, "multiLineActualTexts": Array [ - "632", + "家具家具家具...", ], - "originalText": 632, + "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", "width": 103.8, }, Object { - "actualText": "7234", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualTextWidth": 25, + "height": 20, "multiLineActualTexts": Array [ - "7234", + "家具", ], - "originalText": 7234, + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "834", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 30, + "actualTextWidth": 25, + "height": 20, "multiLineActualTexts": Array [ - "834", + "家具", ], - "originalText": 834, + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "945", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 30, - "multiLineActualTexts": Array [ - "945", - ], - "originalText": 945, - "width": 103.8, - }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should get correctly cell height priority if actual text not wrap 1`] = ` -Array [ - Object { - "actualText": "序号", - "actualTextHeight": 16, "actualTextWidth": 25, "height": 20, "multiLineActualTexts": Array [ - "序号", + "家具", ], - "originalText": "序号", - "width": 80, - }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should get correctly cell height priority if actual text not wrap 2`] = ` -Array [ + "originalText": "家具", + "width": 103.8, + }, Object { - "actualText": "1", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, + "actualTextWidth": 25, + "height": 20, "multiLineActualTexts": Array [ - "1", + "家具", ], - "originalText": 1, - "width": 80, + "originalText": "家具", + "width": 103.8, }, Object { - "actualText": "2", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 7, + "actualTextWidth": 25, "height": 20, "multiLineActualTexts": Array [ - "2", + "家具", ], - "originalText": 2, - "width": 80, + "originalText": "家具", + "width": 103.8, }, Object { - "actualText": "3", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, + "actualTextWidth": 25, + "height": 20, "multiLineActualTexts": Array [ - "3", + "家具", ], - "originalText": 3, - "width": 80, + "originalText": "家具", + "width": 103.8, }, Object { - "actualText": "4", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, + "actualTextWidth": 25, + "height": 20, "multiLineActualTexts": Array [ - "4", + "家具", ], - "originalText": 4, - "width": 80, + "originalText": "家具", + "width": 103.8, }, Object { - "actualText": "5", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 100, + "actualTextWidth": 49, + "height": 20, "multiLineActualTexts": Array [ - "5", + "办公用品", ], - "originalText": 5, - "width": 80, + "originalText": "办公用品", + "width": 103.8, }, Object { - "actualText": "6", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, + "actualTextWidth": 49, + "height": 20, "multiLineActualTexts": Array [ - "6", + "办公用品", ], - "originalText": 6, - "width": 80, + "originalText": "办公用品", + "width": 103.8, }, Object { - "actualText": "7", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, + "actualTextWidth": 49, + "height": 20, "multiLineActualTexts": Array [ - "7", + "办公用品", ], - "originalText": 7, - "width": 80, + "originalText": "办公用品", + "width": 103.8, }, Object { - "actualText": "8", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, + "actualTextWidth": 49, + "height": 20, "multiLineActualTexts": Array [ - "8", + "办公用品", ], - "originalText": 8, - "width": 80, + "originalText": "办公用品", + "width": 103.8, }, Object { - "actualText": "9", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, + "actualTextWidth": 49, + "height": 20, "multiLineActualTexts": Array [ - "9", + "办公用品", ], - "originalText": 9, - "width": 80, + "originalText": "办公用品", + "width": 103.8, }, Object { - "actualText": "10", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, + "actualTextWidth": 49, + "height": 20, "multiLineActualTexts": Array [ - "10", + "办公用品", ], - "originalText": 10, - "width": 80, + "originalText": "办公用品", + "width": 103.8, }, Object { - "actualText": "11", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 30, + "actualTextWidth": 49, + "height": 20, "multiLineActualTexts": Array [ - "11", + "办公用品", ], - "originalText": 11, - "width": 80, + "originalText": "办公用品", + "width": 103.8, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should get correctly cell height priority if actual text not wrap 3`] = ` -Array [ Object { - "actualText": "序号", - "actualTextHeight": 16, - "actualTextWidth": 25, + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, "height": 20, "multiLineActualTexts": Array [ - "序号", + "办公用品", ], - "originalText": "序号", - "width": 80, + "originalText": "办公用品", + "width": 103.8, }, Object { - "actualText": "province", - "actualTextHeight": 16, - "actualTextWidth": 51, + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, "height": 20, "multiLineActualTexts": Array [ - "province", + "家具", ], - "originalText": "province", + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "city", - "actualTextHeight": 16, - "actualTextWidth": 21, + "actualText": "桌子", + "actualTextHeight": 15, + "actualTextWidth": 25, "height": 20, "multiLineActualTexts": Array [ - "city", + "桌子", ], - "originalText": "city", + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "type", - "actualTextHeight": 16, - "actualTextWidth": 25, + "actualText": "桌子桌子桌子...", + "actualTextHeight": 15, + "actualTextWidth": 83, "height": 20, "multiLineActualTexts": Array [ - "type", + "桌子桌子桌子...", ], - "originalText": "type", + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", "width": 103.8, }, Object { - "actualText": "sub_type", - "actualTextHeight": 16, - "actualTextWidth": 53, + "actualText": "桌子", + "actualTextHeight": 15, + "actualTextWidth": 25, "height": 20, "multiLineActualTexts": Array [ - "sub_type", + "桌子", ], - "originalText": "sub_type", + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "number", - "actualTextHeight": 16, - "actualTextWidth": 45, + "actualText": "桌子", + "actualTextHeight": 15, + "actualTextWidth": 25, "height": 20, "multiLineActualTexts": Array [ - "number", + "桌子", ], - "originalText": "number", + "originalText": "桌子", "width": 103.8, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should get correctly cell height priority if actual text not wrap 4`] = `Array []`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should get correctly cell height priority if actual text not wrap 5`] = ` -Array [ Object { - "actualText": "1", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, + "actualTextWidth": 25, + "height": 20, "multiLineActualTexts": Array [ - "1", + "桌子", ], - "originalText": 1, - "width": 80, + "originalText": "桌子", + "width": 103.8, }, Object { - "actualText": "2", + "actualText": "沙发", "actualTextHeight": 15, - "actualTextWidth": 7, + "actualTextWidth": 25, "height": 20, "multiLineActualTexts": Array [ - "2", + "沙发", ], - "originalText": 2, - "width": 80, + "originalText": "沙发", + "width": 103.8, }, Object { - "actualText": "3", + "actualText": "沙发", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, + "actualTextWidth": 25, + "height": 20, "multiLineActualTexts": Array [ - "3", + "沙发", ], - "originalText": 3, - "width": 80, + "originalText": "沙发", + "width": 103.8, }, Object { - "actualText": "4", + "actualText": "沙发", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, + "actualTextWidth": 25, + "height": 20, "multiLineActualTexts": Array [ - "4", + "沙发", ], - "originalText": 4, - "width": 80, + "originalText": "沙发", + "width": 103.8, }, Object { - "actualText": "5", + "actualText": "沙发", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 100, + "actualTextWidth": 25, + "height": 20, "multiLineActualTexts": Array [ - "5", + "沙发", ], - "originalText": 5, - "width": 80, + "originalText": "沙发", + "width": 103.8, }, Object { - "actualText": "6", + "actualText": "笔", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, + "actualTextWidth": 13, + "height": 20, "multiLineActualTexts": Array [ - "6", + "笔", ], - "originalText": 6, - "width": 80, + "originalText": "笔", + "width": 103.8, }, Object { - "actualText": "7", + "actualText": "笔", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, + "actualTextWidth": 13, + "height": 20, "multiLineActualTexts": Array [ - "7", + "笔", ], - "originalText": 7, - "width": 80, + "originalText": "笔", + "width": 103.8, }, Object { - "actualText": "8", + "actualText": "笔", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, + "actualTextWidth": 13, + "height": 20, "multiLineActualTexts": Array [ - "8", + "笔", ], - "originalText": 8, - "width": 80, + "originalText": "笔", + "width": 103.8, }, Object { - "actualText": "9", + "actualText": "笔", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, + "actualTextWidth": 13, + "height": 20, "multiLineActualTexts": Array [ - "9", + "笔", ], - "originalText": 9, - "width": 80, + "originalText": "笔", + "width": 103.8, }, Object { - "actualText": "10", + "actualText": "纸张", "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, + "actualTextWidth": 25, + "height": 20, "multiLineActualTexts": Array [ - "10", + "纸张", ], - "originalText": 10, - "width": 80, + "originalText": "纸张", + "width": 103.8, }, Object { - "actualText": "11", + "actualText": "纸张", "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 30, + "actualTextWidth": 25, + "height": 20, "multiLineActualTexts": Array [ - "11", + "纸张", ], - "originalText": 11, - "width": 80, + "originalText": "纸张", + "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "纸张", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 25, + "height": 20, "multiLineActualTexts": Array [ - "浙江省", + "纸张", ], - "originalText": "浙江省", + "originalText": "纸张", "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "纸张", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 25, "height": 20, "multiLineActualTexts": Array [ - "浙江省", + "纸张", ], - "originalText": "浙江省", + "originalText": "纸张", "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 25, + "height": 20, "multiLineActualTexts": Array [ - "浙江省", + "桌子", ], - "originalText": "浙江省", + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "23672367236...", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 84, + "height": 20, "multiLineActualTexts": Array [ - "浙江省", + "23672367236...", ], - "originalText": "浙江省", + "originalText": 236723672361111, "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "77897789778...", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 100, + "actualTextWidth": 84, + "height": 20, "multiLineActualTexts": Array [ - "浙江省", + "77897789778...", ], - "originalText": "浙江省", + "originalText": "7789778977897789778977897789", "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "23672367236...", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 84, + "height": 20, "multiLineActualTexts": Array [ - "浙江省", + "23672367236...", ], - "originalText": "浙江省", + "originalText": 236723672361111, "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "3877", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "浙江省", + "3877", ], - "originalText": "浙江省", + "originalText": 3877, "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "4342", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "浙江省", + "4342", ], - "originalText": "浙江省", + "originalText": 4342, "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "5343", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "浙江省", + "5343", ], - "originalText": "浙江省", + "originalText": 5343, "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "632", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 21, + "height": 20, "multiLineActualTexts": Array [ - "浙江省", + "632", ], - "originalText": "浙江省", + "originalText": 632, "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "7234", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "浙江省", + "7234", ], - "originalText": "浙江省", + "originalText": 7234, "width": 103.8, }, Object { - "actualText": "宁波市", + "actualText": "834", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 21, + "height": 20, "multiLineActualTexts": Array [ - "宁波市", + "834", ], - "originalText": "宁波市", + "originalText": 834, "width": 103.8, }, Object { - "actualText": "舟山市", + "actualText": "945", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 21, "height": 20, "multiLineActualTexts": Array [ - "舟山市", + "945", ], - "originalText": "舟山市", + "originalText": 945, "width": 103.8, }, Object { - "actualText": "杭州市", + "actualText": "1304", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "杭州市", + "1304", ], - "originalText": "杭州市", + "originalText": 1304, "width": 103.8, }, Object { - "actualText": "绍兴市", + "actualText": "1145", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 26, + "height": 20, "multiLineActualTexts": Array [ - "绍兴市", + "1145", ], - "originalText": "绍兴市", + "originalText": 1145, "width": 103.8, }, Object { - "actualText": "宁波市", + "actualText": "1432", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 100, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "宁波市", + "1432", ], - "originalText": "宁波市", + "originalText": 1432, "width": 103.8, }, Object { - "actualText": "舟山市", + "actualText": "1343", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "舟山市", + "1343", ], - "originalText": "舟山市", + "originalText": 1343, "width": 103.8, }, Object { - "actualText": "杭州市", + "actualText": "1354", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "杭州市", + "1354", ], - "originalText": "杭州市", + "originalText": 1354, "width": 103.8, }, Object { - "actualText": "绍兴市", + "actualText": "1523", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "绍兴市", + "1523", ], - "originalText": "绍兴市", + "originalText": 1523, "width": 103.8, }, Object { - "actualText": "宁波市", + "actualText": "1634", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "宁波市", + "1634", ], - "originalText": "宁波市", + "originalText": 1634, "width": 103.8, }, Object { - "actualText": "舟山市", + "actualText": "1723", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "舟山市", + "1723", ], - "originalText": "舟山市", + "originalText": 1723, "width": 103.8, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust data cell height, but should adjust maxLines if custom cell style more than actual text height by dataCell.height 1`] = ` +Array [ Object { - "actualText": "杭州市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 48, "multiLineActualTexts": Array [ - "杭州市", + "序号", ], - "originalText": "杭州市", - "width": 103.8, + "originalText": "序号", + "width": 80, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust data cell height, but should adjust maxLines if custom cell style more than actual text height by dataCell.height 2`] = ` +Array [ Object { - "actualText": "家具", + "actualText": "1", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "actualTextWidth": 7, + "height": 100, "multiLineActualTexts": Array [ - "家具", + "1", ], - "originalText": "家具", - "width": 103.8, + "originalText": 1, + "width": 80, }, Object { - "actualText": "家具", + "actualText": "2", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualTextWidth": 7, + "height": 100, "multiLineActualTexts": Array [ - "家具", + "2", ], - "originalText": "家具", - "width": 103.8, + "originalText": 2, + "width": 80, }, Object { - "actualText": "家具", + "actualText": "3", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "actualTextWidth": 7, + "height": 100, "multiLineActualTexts": Array [ - "家具", + "3", ], - "originalText": "家具", - "width": 103.8, + "originalText": 3, + "width": 80, }, Object { - "actualText": "家具", + "actualText": "4", "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 100, + "multiLineActualTexts": Array [ + "4", + ], + "originalText": 4, + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust data cell height, but should adjust maxLines if custom cell style more than actual text height by dataCell.height 3`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, "actualTextWidth": 25, - "height": 30, + "height": 48, "multiLineActualTexts": Array [ - "家具", + "序号", ], - "originalText": "家具", - "width": 103.8, + "originalText": "序号", + "width": 80, }, Object { - "actualText": "家具", - "actualTextHeight": 15, + "actualText": "省份", + "actualTextHeight": 16, "actualTextWidth": 25, - "height": 100, + "height": 48, "multiLineActualTexts": Array [ - "家具", + "省份", ], - "originalText": "家具", + "originalText": "省份", "width": 103.8, }, Object { - "actualText": "家具", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "actualText": "城市城市城市城市城市城市城...", + "actualTextHeight": 32, + "actualTextWidth": 168, + "height": 48, "multiLineActualTexts": Array [ - "家具", + "城市城市城市城", + "市城市城市城...", ], - "originalText": "家具", + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", "width": 103.8, }, Object { - "actualText": "办公用品", - "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 30, + "actualText": "类别类别类别类别类别类别类...", + "actualTextHeight": 32, + "actualTextWidth": 168, + "height": 48, "multiLineActualTexts": Array [ - "办公用品", + "类别类别类别类", + "别类别类别类...", ], - "originalText": "办公用品", + "originalText": "类别类别类别类别类别类别类别类别类别类别", "width": 103.8, }, Object { - "actualText": "办公用品", - "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 30, + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 48, "multiLineActualTexts": Array [ - "办公用品", + "子类别", ], - "originalText": "办公用品", + "originalText": "子类别", "width": 103.8, }, Object { - "actualText": "办公用品", - "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 30, + "actualText": "数量数量数量数量数量数量数...", + "actualTextHeight": 32, + "actualTextWidth": 168, + "height": 48, "multiLineActualTexts": Array [ - "办公用品", + "数量数量数量数", + "量数量数量数...", ], - "originalText": "办公用品", + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 103.8, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust data cell height, but should adjust maxLines if custom cell style more than actual text height by dataCell.height 4`] = `Array []`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust data cell height, but should adjust maxLines if custom cell style more than actual text height by dataCell.height 5`] = ` +Array [ Object { - "actualText": "办公用品", + "actualText": "1", "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 30, + "actualTextWidth": 7, + "height": 100, "multiLineActualTexts": Array [ - "办公用品", + "1", ], - "originalText": "办公用品", - "width": 103.8, + "originalText": 1, + "width": 80, }, Object { - "actualText": "办公用品", + "actualText": "2", "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 30, + "actualTextWidth": 7, + "height": 100, "multiLineActualTexts": Array [ - "办公用品", + "2", ], - "originalText": "办公用品", - "width": 103.8, + "originalText": 2, + "width": 80, }, Object { - "actualText": "桌子", + "actualText": "3", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "actualTextWidth": 7, + "height": 100, "multiLineActualTexts": Array [ - "桌子", + "3", ], - "originalText": "桌子", - "width": 103.8, + "originalText": 3, + "width": 80, }, Object { - "actualText": "桌子", + "actualText": "4", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualTextWidth": 7, + "height": 100, "multiLineActualTexts": Array [ - "桌子", + "4", ], - "originalText": "桌子", - "width": 103.8, + "originalText": 4, + "width": 80, }, Object { - "actualText": "沙发", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "actualTextWidth": 37, + "height": 100, "multiLineActualTexts": Array [ - "沙发", + "浙江省", ], - "originalText": "沙发", + "originalText": "浙江省", "width": 103.8, }, Object { - "actualText": "沙发", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "actualTextHeight": 75, + "actualTextWidth": 365, + "height": 100, "multiLineActualTexts": Array [ - "沙发", + "浙江省浙江省浙", + "江省浙江省浙江", + "省浙江省浙江省", + "浙江省浙江省浙", + "江省", ], - "originalText": "沙发", + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 103.8, }, Object { - "actualText": "沙发", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 25, + "actualTextWidth": 37, "height": 100, "multiLineActualTexts": Array [ - "沙发", + "浙江省", ], - "originalText": "沙发", + "originalText": "浙江省", "width": 103.8, }, Object { - "actualText": "沙发", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "actualTextWidth": 37, + "height": 100, "multiLineActualTexts": Array [ - "沙发", + "浙江省", ], - "originalText": "沙发", + "originalText": "浙江省", "width": 103.8, }, Object { - "actualText": "笔", + "actualText": "绍兴市", "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 30, + "actualTextWidth": 37, + "height": 100, "multiLineActualTexts": Array [ - "笔", + "绍兴市", ], - "originalText": "笔", + "originalText": "绍兴市", "width": 103.8, }, Object { - "actualText": "笔", - "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 30, + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "actualTextHeight": 75, + "actualTextWidth": 365, + "height": 100, "multiLineActualTexts": Array [ - "笔", + "杭州市杭州市杭", + "州市杭州市杭州", + "市杭州市杭州市", + "杭州市杭州市杭", + "州市", ], - "originalText": "笔", + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", "width": 103.8, }, Object { - "actualText": "笔", + "actualText": "绍兴市", "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 30, + "actualTextWidth": 37, + "height": 100, "multiLineActualTexts": Array [ - "笔", + "绍兴市", ], - "originalText": "笔", + "originalText": "绍兴市", "width": 103.8, }, Object { - "actualText": "笔", + "actualText": "宁波市", "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 30, + "actualTextWidth": 37, + "height": 100, "multiLineActualTexts": Array [ - "笔", + "宁波市", ], - "originalText": "笔", + "originalText": "宁波市", "width": 103.8, }, Object { - "actualText": "纸张", + "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 100, "multiLineActualTexts": Array [ - "纸张", + "家具", ], - "originalText": "纸张", + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "3877", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "actualTextHeight": 60, + "actualTextWidth": 340, + "height": 100, "multiLineActualTexts": Array [ - "3877", + "家具家具家具家", + "具家具家具家具", + "家具家具家具家", + "具家具家具家具", ], - "originalText": 3877, + "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", "width": 103.8, }, Object { - "actualText": "4342", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualTextWidth": 25, + "height": 100, "multiLineActualTexts": Array [ - "4342", + "家具", ], - "originalText": 4342, + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "5343", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualTextWidth": 25, + "height": 100, "multiLineActualTexts": Array [ - "5343", + "家具", ], - "originalText": 5343, + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "632", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 30, + "actualTextWidth": 25, + "height": 100, "multiLineActualTexts": Array [ - "632", + "桌子", ], - "originalText": 632, + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "7234", - "actualTextHeight": 15, - "actualTextWidth": 27, + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "actualTextHeight": 75, + "actualTextWidth": 365, "height": 100, "multiLineActualTexts": Array [ - "7234", + "桌子桌子桌子桌", + "子桌子桌子桌子", + "桌子桌子桌子桌", + "子桌子桌子桌子", + "桌子", ], - "originalText": 7234, + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", "width": 103.8, }, Object { - "actualText": "834", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 30, + "actualTextWidth": 25, + "height": 100, "multiLineActualTexts": Array [ - "834", + "桌子", ], - "originalText": 834, + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "945", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 30, + "actualTextWidth": 25, + "height": 100, "multiLineActualTexts": Array [ - "945", + "桌子", ], - "originalText": 945, + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "1304", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 100, "multiLineActualTexts": Array [ - "1304", + "2367236723611", + "11", ], - "originalText": 1304, + "originalText": 236723672361111, "width": 103.8, }, Object { - "actualText": "1145", - "actualTextHeight": 15, - "actualTextWidth": 26, - "height": 30, + "actualText": "7789778977897789778977897789", + "actualTextHeight": 45, + "actualTextWidth": 189, + "height": 100, "multiLineActualTexts": Array [ - "1145", + "7789778977897", + "7897789778977", + "89", ], - "originalText": 1145, + "originalText": "7789778977897789778977897789", "width": 103.8, }, Object { - "actualText": "1432", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 100, "multiLineActualTexts": Array [ - "1432", + "2367236723611", + "11", ], - "originalText": 1432, + "originalText": 236723672361111, "width": 103.8, }, Object { - "actualText": "1343", + "actualText": "3877", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 30, + "height": 100, "multiLineActualTexts": Array [ - "1343", + "3877", ], - "originalText": 1343, + "originalText": 3877, "width": 103.8, }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should get correctly cell height priority if actual text wrap 1`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust cell height, but should adjust maxLines if custom cell style less than actual text height by colCell.height 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 70, + "height": 20, "multiLineActualTexts": Array [ "序号", ], @@ -17409,13 +26268,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should get correctly cell height priority if actual text wrap 2`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust cell height, but should adjust maxLines if custom cell style less than actual text height by colCell.height 2`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 70, + "height": 46, "multiLineActualTexts": Array [ "1", ], @@ -17426,7 +26285,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 100, + "height": 46, "multiLineActualTexts": Array [ "2", ], @@ -17488,16 +26347,60 @@ Array [ "originalText": 7, "width": 80, }, + Object { + "actualText": "8", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "8", + ], + "originalText": 8, + "width": 80, + }, + Object { + "actualText": "9", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "9", + ], + "originalText": 9, + "width": 80, + }, + Object { + "actualText": "10", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "10", + ], + "originalText": 10, + "width": 80, + }, + Object { + "actualText": "11", + "actualTextHeight": 15, + "actualTextWidth": 13, + "height": 30, + "multiLineActualTexts": Array [ + "11", + ], + "originalText": 11, + "width": 80, + }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should get correctly cell height priority if actual text wrap 3`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust cell height, but should adjust maxLines if custom cell style less than actual text height by colCell.height 3`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 70, + "height": 20, "multiLineActualTexts": Array [ "序号", ], @@ -17508,7 +26411,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 70, + "height": 20, "multiLineActualTexts": Array [ "省份", ], @@ -17516,27 +26419,23 @@ Array [ "width": 103.8, }, Object { - "actualText": "城市城市城市城市城市城市城市城市城市城市...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 70, + "actualText": "城市城市城市...", + "actualTextHeight": 16, + "actualTextWidth": 83, + "height": 20, "multiLineActualTexts": Array [ - "城市城市城市城", - "市城市城市城市", "城市城市城市...", ], "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", "width": 103.8, }, Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", - "actualTextHeight": 48, - "actualTextWidth": 243, - "height": 70, + "actualText": "类别类别类别...", + "actualTextHeight": 16, + "actualTextWidth": 83, + "height": 20, "multiLineActualTexts": Array [ - "类别类别类别类", - "别类别类别类别", - "类别类别类别", + "类别类别类别...", ], "originalText": "类别类别类别类别类别类别类别类别类别类别", "width": 103.8, @@ -17545,7 +26444,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 70, + "height": 20, "multiLineActualTexts": Array [ "子类别", ], @@ -17553,13 +26452,11 @@ Array [ "width": 103.8, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 70, + "actualText": "数量数量数量...", + "actualTextHeight": 16, + "actualTextWidth": 83, + "height": 20, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", "数量数量数量...", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", @@ -17568,15 +26465,15 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should get correctly cell height priority if actual text wrap 4`] = `Array []`; +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust cell height, but should adjust maxLines if custom cell style less than actual text height by colCell.height 4`] = `Array []`; -exports[`SpreadSheet Multi Line Text Tests TableSheet should get correctly cell height priority if actual text wrap 5`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust cell height, but should adjust maxLines if custom cell style less than actual text height by colCell.height 5`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 70, + "height": 46, "multiLineActualTexts": Array [ "1", ], @@ -17587,7 +26484,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 100, + "height": 46, "multiLineActualTexts": Array [ "2", ], @@ -17649,11 +26546,55 @@ Array [ "originalText": 7, "width": 80, }, + Object { + "actualText": "8", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "8", + ], + "originalText": 8, + "width": 80, + }, + Object { + "actualText": "9", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "9", + ], + "originalText": 9, + "width": 80, + }, + Object { + "actualText": "10", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "10", + ], + "originalText": 10, + "width": 80, + }, + Object { + "actualText": "11", + "actualTextHeight": 15, + "actualTextWidth": 13, + "height": 30, + "multiLineActualTexts": Array [ + "11", + ], + "originalText": 11, + "width": 80, + }, Object { "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 70, + "height": 46, "multiLineActualTexts": Array [ "浙江省", ], @@ -17661,14 +26602,13 @@ Array [ "width": 103.8, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 100, + "actualText": "浙江省浙江省浙江省浙江省浙...", + "actualTextHeight": 30, + "actualTextWidth": 168, + "height": 46, "multiLineActualTexts": Array [ "浙江省浙江省浙", - "江省浙江省浙江", - "省浙江省浙江...", + "江省浙江省浙...", ], "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 103.8, @@ -17728,11 +26668,55 @@ Array [ "originalText": "浙江省", "width": 103.8, }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, Object { "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 70, + "height": 46, "multiLineActualTexts": Array [ "绍兴市", ], @@ -17740,14 +26724,13 @@ Array [ "width": 103.8, }, Object { - "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 100, + "actualText": "杭州市杭州市杭州市杭州市杭...", + "actualTextHeight": 30, + "actualTextWidth": 168, + "height": 46, "multiLineActualTexts": Array [ "杭州市杭州市杭", - "州市杭州市杭州", - "市杭州市杭州...", + "州市杭州市杭...", ], "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", "width": 103.8, @@ -17807,11 +26790,55 @@ Array [ "originalText": "绍兴市", "width": 103.8, }, + Object { + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "宁波市", + ], + "originalText": "宁波市", + "width": 103.8, + }, + Object { + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "舟山市", + ], + "originalText": "舟山市", + "width": 103.8, + }, + Object { + "actualText": "杭州市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "杭州市", + ], + "originalText": "杭州市", + "width": 103.8, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 103.8, + }, Object { "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 70, + "height": 46, "multiLineActualTexts": Array [ "家具", ], @@ -17819,14 +26846,13 @@ Array [ "width": 103.8, }, Object { - "actualText": "家具家具家具家具家具家具家具家具家具家具...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 100, + "actualText": "家具家具家具家具家具家具家...", + "actualTextHeight": 30, + "actualTextWidth": 168, + "height": 46, "multiLineActualTexts": Array [ "家具家具家具家", - "具家具家具家具", - "家具家具家具...", + "具家具家具家...", ], "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", "width": 103.8, @@ -17886,11 +26912,55 @@ Array [ "originalText": "家具", "width": 103.8, }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 30, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 103.8, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 30, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 103.8, + }, Object { "actualText": "桌子", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 70, + "height": 46, "multiLineActualTexts": Array [ "桌子", ], @@ -17898,14 +26968,13 @@ Array [ "width": 103.8, }, Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 100, + "actualText": "桌子桌子桌子桌子桌子桌子桌...", + "actualTextHeight": 30, + "actualTextWidth": 168, + "height": 46, "multiLineActualTexts": Array [ "桌子桌子桌子桌", - "子桌子桌子桌子", - "桌子桌子桌子...", + "子桌子桌子桌...", ], "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", "width": 103.8, @@ -17965,11 +27034,55 @@ Array [ "originalText": "沙发", "width": 103.8, }, + Object { + "actualText": "沙发", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 103.8, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 103.8, + }, + Object { + "actualText": "笔", + "actualTextHeight": 15, + "actualTextWidth": 13, + "height": 30, + "multiLineActualTexts": Array [ + "笔", + ], + "originalText": "笔", + "width": 103.8, + }, + Object { + "actualText": "笔", + "actualTextHeight": 15, + "actualTextWidth": 13, + "height": 30, + "multiLineActualTexts": Array [ + "笔", + ], + "originalText": "笔", + "width": 103.8, + }, Object { "actualText": "236723672361111", "actualTextHeight": 30, "actualTextWidth": 100, - "height": 70, + "height": 46, "multiLineActualTexts": Array [ "2367236723611", "11", @@ -17978,14 +27091,13 @@ Array [ "width": 103.8, }, Object { - "actualText": "7789778977897789778977897789", - "actualTextHeight": 45, - "actualTextWidth": 189, - "height": 100, + "actualText": "778977897789778977897789...", + "actualTextHeight": 30, + "actualTextWidth": 172, + "height": 46, "multiLineActualTexts": Array [ "7789778977897", - "7897789778977", - "89", + "78977897789...", ], "originalText": "7789778977897789778977897789", "width": 103.8, @@ -18046,90 +27158,60 @@ Array [ "originalText": 632, "width": 103.8, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust cell height if custom cell style more than actual text height 1`] = ` -Array [ - Object { - "actualText": "序号", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 70, - "multiLineActualTexts": Array [ - "序号", - ], - "originalText": "序号", - "width": 80, - }, - Object { - "actualText": "省份", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 70, - "multiLineActualTexts": Array [ - "省份", - ], - "originalText": "省份", - "width": 103.8, - }, Object { - "actualText": "城市城市城市城市城市城市城...", - "actualTextHeight": 32, - "actualTextWidth": 168, - "height": 70, + "actualText": "7234", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "城市城市城市城", - "市城市城市城...", + "7234", ], - "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "originalText": 7234, "width": 103.8, }, Object { - "actualText": "类别类别类别类别类别类别类...", - "actualTextHeight": 32, - "actualTextWidth": 168, - "height": 70, + "actualText": "834", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, "multiLineActualTexts": Array [ - "类别类别类别类", - "别类别类别类...", + "834", ], - "originalText": "类别类别类别类别类别类别类别类别类别类别", + "originalText": 834, "width": 103.8, }, Object { - "actualText": "子类别", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 70, + "actualText": "945", + "actualTextHeight": 15, + "actualTextWidth": 21, + "height": 30, "multiLineActualTexts": Array [ - "子类别", + "945", ], - "originalText": "子类别", + "originalText": 945, "width": 103.8, }, Object { - "actualText": "数量数量数量数量数量数量数...", - "actualTextHeight": 32, - "actualTextWidth": 168, - "height": 70, + "actualText": "1304", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数...", + "1304", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "originalText": 1304, "width": 103.8, }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust cell height if custom cell style more than actual text height by colCell.heightByField 1`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style less than actual text height by rowCell.height 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 100, + "height": 64, "multiLineActualTexts": Array [ "序号", ], @@ -18139,13 +27221,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust cell height if custom cell style more than actual text height by colCell.heightByField 2`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style less than actual text height by rowCell.height 2`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "1", ], @@ -18156,7 +27238,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 76, + "height": 20, "multiLineActualTexts": Array [ "2", ], @@ -18167,7 +27249,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "3", ], @@ -18178,7 +27260,7 @@ Array [ "actualText": "4", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "4", ], @@ -18189,7 +27271,7 @@ Array [ "actualText": "5", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "5", ], @@ -18200,7 +27282,7 @@ Array [ "actualText": "6", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "6", ], @@ -18211,7 +27293,7 @@ Array [ "actualText": "7", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "7", ], @@ -18222,23 +27304,122 @@ Array [ "actualText": "8", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "8", ], "originalText": 8, "width": 80, }, + Object { + "actualText": "9", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 20, + "multiLineActualTexts": Array [ + "9", + ], + "originalText": 9, + "width": 80, + }, + Object { + "actualText": "10", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, + "multiLineActualTexts": Array [ + "10", + ], + "originalText": 10, + "width": 80, + }, + Object { + "actualText": "11", + "actualTextHeight": 15, + "actualTextWidth": 13, + "height": 20, + "multiLineActualTexts": Array [ + "11", + ], + "originalText": 11, + "width": 80, + }, + Object { + "actualText": "12", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, + "multiLineActualTexts": Array [ + "12", + ], + "originalText": 12, + "width": 80, + }, + Object { + "actualText": "13", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, + "multiLineActualTexts": Array [ + "13", + ], + "originalText": 13, + "width": 80, + }, + Object { + "actualText": "14", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, + "multiLineActualTexts": Array [ + "14", + ], + "originalText": 14, + "width": 80, + }, + Object { + "actualText": "15", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, + "multiLineActualTexts": Array [ + "15", + ], + "originalText": 15, + "width": 80, + }, + Object { + "actualText": "16", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, + "multiLineActualTexts": Array [ + "16", + ], + "originalText": 16, + "width": 80, + }, + Object { + "actualText": "17", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, + "multiLineActualTexts": Array [ + "17", + ], + "originalText": 17, + "width": 80, + }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust cell height if custom cell style more than actual text height by colCell.heightByField 3`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style less than actual text height by rowCell.height 3`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 100, + "height": 64, "multiLineActualTexts": Array [ "序号", ], @@ -18249,7 +27430,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 100, + "height": 64, "multiLineActualTexts": Array [ "省份", ], @@ -18257,15 +27438,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "actualTextHeight": 64, - "actualTextWidth": 292, - "height": 100, + "actualText": "城市城市城市城市城市城市城市城市城市城市...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 64, "multiLineActualTexts": Array [ "城市城市城市城", "市城市城市城市", - "城市城市城市城", - "市城市", + "城市城市城市...", ], "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", "width": 103.8, @@ -18274,7 +27454,7 @@ Array [ "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 48, "actualTextWidth": 243, - "height": 50, + "height": 64, "multiLineActualTexts": Array [ "类别类别类别类", "别类别类别类别", @@ -18287,7 +27467,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 100, + "height": 64, "multiLineActualTexts": Array [ "子类别", ], @@ -18295,15 +27475,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量数量", - "actualTextHeight": 64, - "actualTextWidth": 268, - "height": 100, + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 64, "multiLineActualTexts": Array [ "数量数量数量数", "量数量数量数量", - "数量数量数量数", - "量", + "数量数量数量...", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 103.8, @@ -18311,15 +27490,15 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust cell height if custom cell style more than actual text height by colCell.heightByField 4`] = `Array []`; +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style less than actual text height by rowCell.height 4`] = `Array []`; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust cell height if custom cell style more than actual text height by colCell.heightByField 5`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style less than actual text height by rowCell.height 5`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "1", ], @@ -18330,7 +27509,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 76, + "height": 20, "multiLineActualTexts": Array [ "2", ], @@ -18341,7 +27520,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "3", ], @@ -18352,7 +27531,7 @@ Array [ "actualText": "4", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "4", ], @@ -18363,7 +27542,7 @@ Array [ "actualText": "5", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "5", ], @@ -18374,7 +27553,7 @@ Array [ "actualText": "6", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "6", ], @@ -18385,7 +27564,7 @@ Array [ "actualText": "7", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "7", ], @@ -18396,18 +27575,117 @@ Array [ "actualText": "8", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "8", ], "originalText": 8, "width": 80, }, + Object { + "actualText": "9", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 20, + "multiLineActualTexts": Array [ + "9", + ], + "originalText": 9, + "width": 80, + }, + Object { + "actualText": "10", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, + "multiLineActualTexts": Array [ + "10", + ], + "originalText": 10, + "width": 80, + }, + Object { + "actualText": "11", + "actualTextHeight": 15, + "actualTextWidth": 13, + "height": 20, + "multiLineActualTexts": Array [ + "11", + ], + "originalText": 11, + "width": 80, + }, + Object { + "actualText": "12", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, + "multiLineActualTexts": Array [ + "12", + ], + "originalText": 12, + "width": 80, + }, + Object { + "actualText": "13", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, + "multiLineActualTexts": Array [ + "13", + ], + "originalText": 13, + "width": 80, + }, + Object { + "actualText": "14", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, + "multiLineActualTexts": Array [ + "14", + ], + "originalText": 14, + "width": 80, + }, + Object { + "actualText": "15", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, + "multiLineActualTexts": Array [ + "15", + ], + "originalText": 15, + "width": 80, + }, + Object { + "actualText": "16", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, + "multiLineActualTexts": Array [ + "16", + ], + "originalText": 16, + "width": 80, + }, + Object { + "actualText": "17", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 20, + "multiLineActualTexts": Array [ + "17", + ], + "originalText": 17, + "width": 80, + }, Object { "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -18415,14 +27693,11 @@ Array [ "width": 103.8, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省...", - "actualTextHeight": 60, - "actualTextWidth": 338, - "height": 76, + "actualText": "浙江省浙江省...", + "actualTextHeight": 15, + "actualTextWidth": 83, + "height": 20, "multiLineActualTexts": Array [ - "浙江省浙江省浙", - "江省浙江省浙江", - "省浙江省浙江省", "浙江省浙江省...", ], "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", @@ -18432,7 +27707,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -18443,7 +27718,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -18454,7 +27729,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -18465,7 +27740,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -18476,7 +27751,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -18487,7 +27762,106 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 20, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 20, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 20, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 20, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 20, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 20, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 20, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 20, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -18498,7 +27872,7 @@ Array [ "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "绍兴市", ], @@ -18506,14 +27880,11 @@ Array [ "width": 103.8, }, Object { - "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市...", - "actualTextHeight": 60, - "actualTextWidth": 338, - "height": 76, + "actualText": "杭州市杭州市...", + "actualTextHeight": 15, + "actualTextWidth": 83, + "height": 20, "multiLineActualTexts": Array [ - "杭州市杭州市杭", - "州市杭州市杭州", - "市杭州市杭州市", "杭州市杭州市...", ], "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", @@ -18523,7 +27894,7 @@ Array [ "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "绍兴市", ], @@ -18534,7 +27905,7 @@ Array [ "actualText": "宁波市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "宁波市", ], @@ -18545,7 +27916,7 @@ Array [ "actualText": "舟山市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "舟山市", ], @@ -18556,7 +27927,7 @@ Array [ "actualText": "杭州市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "杭州市", ], @@ -18567,7 +27938,7 @@ Array [ "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "绍兴市", ], @@ -18578,18 +27949,117 @@ Array [ "actualText": "宁波市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, + "multiLineActualTexts": Array [ + "宁波市", + ], + "originalText": "宁波市", + "width": 103.8, + }, + Object { + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 20, + "multiLineActualTexts": Array [ + "舟山市", + ], + "originalText": "舟山市", + "width": 103.8, + }, + Object { + "actualText": "杭州市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 20, + "multiLineActualTexts": Array [ + "杭州市", + ], + "originalText": "杭州市", + "width": 103.8, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 20, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 103.8, + }, + Object { + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 20, + "multiLineActualTexts": Array [ + "宁波市", + ], + "originalText": "宁波市", + "width": 103.8, + }, + Object { + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 20, + "multiLineActualTexts": Array [ + "舟山市", + ], + "originalText": "舟山市", + "width": 103.8, + }, + Object { + "actualText": "杭州市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 20, + "multiLineActualTexts": Array [ + "杭州市", + ], + "originalText": "杭州市", + "width": 103.8, + }, + Object { + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 20, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 103.8, + }, + Object { + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 20, "multiLineActualTexts": Array [ "宁波市", ], "originalText": "宁波市", "width": 103.8, }, + Object { + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 20, + "multiLineActualTexts": Array [ + "舟山市", + ], + "originalText": "舟山市", + "width": 103.8, + }, Object { "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "家具", ], @@ -18597,15 +28067,12 @@ Array [ "width": 103.8, }, Object { - "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "actualTextHeight": 60, - "actualTextWidth": 340, - "height": 76, + "actualText": "家具家具家具...", + "actualTextHeight": 15, + "actualTextWidth": 83, + "height": 20, "multiLineActualTexts": Array [ - "家具家具家具家", - "具家具家具家具", - "家具家具家具家", - "具家具家具家具", + "家具家具家具...", ], "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", "width": 103.8, @@ -18614,7 +28081,7 @@ Array [ "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "家具", ], @@ -18625,7 +28092,7 @@ Array [ "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "家具", ], @@ -18636,51 +28103,150 @@ Array [ "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 20, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 20, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 20, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 20, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 20, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 20, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 103.8, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 20, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 103.8, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 20, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 103.8, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 20, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 103.8, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 20, "multiLineActualTexts": Array [ - "家具", + "办公用品", ], - "originalText": "家具", + "originalText": "办公用品", "width": 103.8, }, Object { - "actualText": "家具", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "actualTextWidth": 49, + "height": 20, "multiLineActualTexts": Array [ - "家具", + "办公用品", ], - "originalText": "家具", + "originalText": "办公用品", "width": 103.8, }, Object { - "actualText": "家具", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "actualTextWidth": 49, + "height": 20, "multiLineActualTexts": Array [ - "家具", + "办公用品", ], - "originalText": "家具", + "originalText": "办公用品", "width": 103.8, }, Object { - "actualText": "家具", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "actualTextWidth": 49, + "height": 20, "multiLineActualTexts": Array [ - "家具", + "办公用品", ], - "originalText": "家具", + "originalText": "办公用品", "width": 103.8, }, Object { "actualText": "桌子", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "桌子", ], @@ -18688,15 +28254,12 @@ Array [ "width": 103.8, }, Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌...", - "actualTextHeight": 60, - "actualTextWidth": 338, - "height": 76, + "actualText": "桌子桌子桌子...", + "actualTextHeight": 15, + "actualTextWidth": 83, + "height": 20, "multiLineActualTexts": Array [ - "桌子桌子桌子桌", - "子桌子桌子桌子", - "桌子桌子桌子桌", - "子桌子桌子桌...", + "桌子桌子桌子...", ], "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", "width": 103.8, @@ -18705,7 +28268,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "桌子", ], @@ -18716,7 +28279,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "桌子", ], @@ -18727,7 +28290,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "桌子", ], @@ -18738,7 +28301,7 @@ Array [ "actualText": "沙发", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "沙发", ], @@ -18749,7 +28312,7 @@ Array [ "actualText": "沙发", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "沙发", ], @@ -18760,7 +28323,7 @@ Array [ "actualText": "沙发", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "沙发", ], @@ -18768,402 +28331,317 @@ Array [ "width": 103.8, }, Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, - "height": 46, - "multiLineActualTexts": Array [ - "2367236723611", - "11", - ], - "originalText": 236723672361111, - "width": 103.8, - }, - Object { - "actualText": "7789778977897789778977897789", - "actualTextHeight": 45, - "actualTextWidth": 189, - "height": 76, + "actualText": "沙发", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 20, "multiLineActualTexts": Array [ - "7789778977897", - "7897789778977", - "89", + "沙发", ], - "originalText": "7789778977897789778977897789", + "originalText": "沙发", "width": 103.8, }, Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, - "height": 46, + "actualText": "笔", + "actualTextHeight": 15, + "actualTextWidth": 13, + "height": 20, "multiLineActualTexts": Array [ - "2367236723611", - "11", + "笔", ], - "originalText": 236723672361111, + "originalText": "笔", "width": 103.8, }, Object { - "actualText": "3877", + "actualText": "笔", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualTextWidth": 13, + "height": 20, "multiLineActualTexts": Array [ - "3877", + "笔", ], - "originalText": 3877, + "originalText": "笔", "width": 103.8, }, Object { - "actualText": "4342", + "actualText": "笔", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualTextWidth": 13, + "height": 20, "multiLineActualTexts": Array [ - "4342", + "笔", ], - "originalText": 4342, + "originalText": "笔", "width": 103.8, }, Object { - "actualText": "5343", + "actualText": "笔", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualTextWidth": 13, + "height": 20, "multiLineActualTexts": Array [ - "5343", + "笔", ], - "originalText": 5343, + "originalText": "笔", "width": 103.8, }, Object { - "actualText": "632", + "actualText": "纸张", "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 30, + "actualTextWidth": 25, + "height": 20, "multiLineActualTexts": Array [ - "632", + "纸张", ], - "originalText": 632, + "originalText": "纸张", "width": 103.8, }, Object { - "actualText": "7234", + "actualText": "纸张", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualTextWidth": 25, + "height": 20, "multiLineActualTexts": Array [ - "7234", + "纸张", ], - "originalText": 7234, + "originalText": "纸张", "width": 103.8, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust data cell height if custom cell style less than actual text height by dataCell.height 1`] = ` -Array [ Object { - "actualText": "序号", - "actualTextHeight": 16, + "actualText": "纸张", + "actualTextHeight": 15, "actualTextWidth": 25, - "height": 40, + "height": 20, "multiLineActualTexts": Array [ - "序号", + "纸张", ], - "originalText": "序号", - "width": 80, + "originalText": "纸张", + "width": 103.8, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust data cell height if custom cell style less than actual text height by dataCell.height 2`] = ` -Array [ Object { - "actualText": "1", + "actualText": "纸张", "actualTextHeight": 15, - "actualTextWidth": 7, + "actualTextWidth": 25, "height": 20, "multiLineActualTexts": Array [ - "1", + "纸张", ], - "originalText": 1, - "width": 80, + "originalText": "纸张", + "width": 103.8, }, Object { - "actualText": "2", + "actualText": "23672367236...", "actualTextHeight": 15, - "actualTextWidth": 7, + "actualTextWidth": 84, "height": 20, "multiLineActualTexts": Array [ - "2", + "23672367236...", ], - "originalText": 2, - "width": 80, + "originalText": 236723672361111, + "width": 103.8, }, Object { - "actualText": "3", + "actualText": "77897789778...", "actualTextHeight": 15, - "actualTextWidth": 7, + "actualTextWidth": 84, "height": 20, "multiLineActualTexts": Array [ - "3", + "77897789778...", ], - "originalText": 3, - "width": 80, + "originalText": "7789778977897789778977897789", + "width": 103.8, }, Object { - "actualText": "4", + "actualText": "23672367236...", "actualTextHeight": 15, - "actualTextWidth": 7, + "actualTextWidth": 84, "height": 20, "multiLineActualTexts": Array [ - "4", + "23672367236...", ], - "originalText": 4, - "width": 80, + "originalText": 236723672361111, + "width": 103.8, }, Object { - "actualText": "5", + "actualText": "3877", "actualTextHeight": 15, - "actualTextWidth": 7, + "actualTextWidth": 27, "height": 20, "multiLineActualTexts": Array [ - "5", + "3877", ], - "originalText": 5, - "width": 80, + "originalText": 3877, + "width": 103.8, }, Object { - "actualText": "6", + "actualText": "4342", "actualTextHeight": 15, - "actualTextWidth": 7, + "actualTextWidth": 27, "height": 20, "multiLineActualTexts": Array [ - "6", + "4342", ], - "originalText": 6, - "width": 80, + "originalText": 4342, + "width": 103.8, }, Object { - "actualText": "7", + "actualText": "5343", "actualTextHeight": 15, - "actualTextWidth": 7, + "actualTextWidth": 27, "height": 20, "multiLineActualTexts": Array [ - "7", + "5343", ], - "originalText": 7, - "width": 80, + "originalText": 5343, + "width": 103.8, }, Object { - "actualText": "8", + "actualText": "632", "actualTextHeight": 15, - "actualTextWidth": 7, + "actualTextWidth": 21, "height": 20, "multiLineActualTexts": Array [ - "8", + "632", ], - "originalText": 8, - "width": 80, + "originalText": 632, + "width": 103.8, }, Object { - "actualText": "9", + "actualText": "7234", "actualTextHeight": 15, - "actualTextWidth": 7, + "actualTextWidth": 27, "height": 20, "multiLineActualTexts": Array [ - "9", + "7234", ], - "originalText": 9, - "width": 80, + "originalText": 7234, + "width": 103.8, }, Object { - "actualText": "10", + "actualText": "834", "actualTextHeight": 15, - "actualTextWidth": 14, + "actualTextWidth": 21, "height": 20, "multiLineActualTexts": Array [ - "10", + "834", ], - "originalText": 10, - "width": 80, + "originalText": 834, + "width": 103.8, }, Object { - "actualText": "11", + "actualText": "945", "actualTextHeight": 15, - "actualTextWidth": 13, + "actualTextWidth": 21, "height": 20, "multiLineActualTexts": Array [ - "11", + "945", ], - "originalText": 11, - "width": 80, + "originalText": 945, + "width": 103.8, }, Object { - "actualText": "12", + "actualText": "1304", "actualTextHeight": 15, - "actualTextWidth": 14, + "actualTextWidth": 27, "height": 20, "multiLineActualTexts": Array [ - "12", + "1304", ], - "originalText": 12, - "width": 80, + "originalText": 1304, + "width": 103.8, }, Object { - "actualText": "13", + "actualText": "1145", "actualTextHeight": 15, - "actualTextWidth": 14, + "actualTextWidth": 26, "height": 20, "multiLineActualTexts": Array [ - "13", + "1145", ], - "originalText": 13, - "width": 80, + "originalText": 1145, + "width": 103.8, }, Object { - "actualText": "14", + "actualText": "1432", "actualTextHeight": 15, - "actualTextWidth": 14, + "actualTextWidth": 27, "height": 20, "multiLineActualTexts": Array [ - "14", + "1432", ], - "originalText": 14, - "width": 80, + "originalText": 1432, + "width": 103.8, }, Object { - "actualText": "15", + "actualText": "1343", "actualTextHeight": 15, - "actualTextWidth": 14, + "actualTextWidth": 27, "height": 20, "multiLineActualTexts": Array [ - "15", + "1343", ], - "originalText": 15, - "width": 80, + "originalText": 1343, + "width": 103.8, }, Object { - "actualText": "16", + "actualText": "1354", "actualTextHeight": 15, - "actualTextWidth": 14, + "actualTextWidth": 27, "height": 20, "multiLineActualTexts": Array [ - "16", + "1354", ], - "originalText": 16, - "width": 80, + "originalText": 1354, + "width": 103.8, }, Object { - "actualText": "17", + "actualText": "1523", "actualTextHeight": 15, - "actualTextWidth": 14, + "actualTextWidth": 27, "height": 20, "multiLineActualTexts": Array [ - "17", + "1523", ], - "originalText": 17, - "width": 80, + "originalText": 1523, + "width": 103.8, }, Object { - "actualText": "18", + "actualText": "1634", "actualTextHeight": 15, - "actualTextWidth": 14, + "actualTextWidth": 27, "height": 20, "multiLineActualTexts": Array [ - "18", + "1634", ], - "originalText": 18, - "width": 80, + "originalText": 1634, + "width": 103.8, }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust data cell height if custom cell style less than actual text height by dataCell.height 3`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style less than actual text height by rowCell.heightByField 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 64, "multiLineActualTexts": Array [ "序号", ], "originalText": "序号", "width": 80, }, - Object { - "actualText": "省份", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 40, - "multiLineActualTexts": Array [ - "省份", - ], - "originalText": "省份", - "width": 103.8, - }, - Object { - "actualText": "城市城市城市城市城市城市城...", - "actualTextHeight": 32, - "actualTextWidth": 168, - "height": 40, - "multiLineActualTexts": Array [ - "城市城市城市城", - "市城市城市城...", - ], - "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "width": 103.8, - }, - Object { - "actualText": "类别类别类别类别类别类别类...", - "actualTextHeight": 32, - "actualTextWidth": 168, - "height": 40, - "multiLineActualTexts": Array [ - "类别类别类别类", - "别类别类别类...", - ], - "originalText": "类别类别类别类别类别类别类别类别类别类别", - "width": 103.8, - }, - Object { - "actualText": "子类别", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 40, - "multiLineActualTexts": Array [ - "子类别", - ], - "originalText": "子类别", - "width": 103.8, - }, - Object { - "actualText": "数量数量数量数量数量数量数...", - "actualTextHeight": 32, - "actualTextWidth": 168, - "height": 40, - "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数...", - ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 103.8, - }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust data cell height if custom cell style less than actual text height by dataCell.height 4`] = `Array []`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust data cell height if custom cell style less than actual text height by dataCell.height 5`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style less than actual text height by rowCell.heightByField 2`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 46, "multiLineActualTexts": Array [ "1", ], @@ -19185,7 +28663,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 46, "multiLineActualTexts": Array [ "3", ], @@ -19196,7 +28674,7 @@ Array [ "actualText": "4", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "4", ], @@ -19207,7 +28685,7 @@ Array [ "actualText": "5", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 100, "multiLineActualTexts": Array [ "5", ], @@ -19218,283 +28696,212 @@ Array [ "actualText": "6", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, - "multiLineActualTexts": Array [ - "6", - ], - "originalText": 6, - "width": 80, - }, - Object { - "actualText": "7", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 20, - "multiLineActualTexts": Array [ - "7", - ], - "originalText": 7, - "width": 80, - }, - Object { - "actualText": "8", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 20, - "multiLineActualTexts": Array [ - "8", - ], - "originalText": 8, - "width": 80, - }, - Object { - "actualText": "9", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 20, - "multiLineActualTexts": Array [ - "9", - ], - "originalText": 9, - "width": 80, - }, - Object { - "actualText": "10", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, - "multiLineActualTexts": Array [ - "10", - ], - "originalText": 10, - "width": 80, - }, - Object { - "actualText": "11", - "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 20, - "multiLineActualTexts": Array [ - "11", - ], - "originalText": 11, - "width": 80, - }, - Object { - "actualText": "12", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, - "multiLineActualTexts": Array [ - "12", - ], - "originalText": 12, - "width": 80, - }, - Object { - "actualText": "13", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, - "multiLineActualTexts": Array [ - "13", - ], - "originalText": 13, - "width": 80, - }, - Object { - "actualText": "14", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ - "14", + "6", ], - "originalText": 14, + "originalText": 6, "width": 80, }, Object { - "actualText": "15", + "actualText": "7", "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "15", + "7", ], - "originalText": 15, + "originalText": 7, "width": 80, }, Object { - "actualText": "16", + "actualText": "8", "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "16", + "8", ], - "originalText": 16, + "originalText": 8, "width": 80, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style less than actual text height by rowCell.heightByField 3`] = ` +Array [ Object { - "actualText": "17", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, "multiLineActualTexts": Array [ - "17", + "序号", ], - "originalText": 17, + "originalText": "序号", "width": 80, }, Object { - "actualText": "18", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, "multiLineActualTexts": Array [ - "18", + "省份", ], - "originalText": 18, - "width": 80, + "originalText": "省份", + "width": 103.8, }, Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualText": "城市城市城市城市城市城市城市城市城市城市...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 64, "multiLineActualTexts": Array [ - "浙江省", + "城市城市城市城", + "市城市城市城市", + "城市城市城市...", ], - "originalText": "浙江省", + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", "width": 103.8, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙...", - "actualTextHeight": 30, - "actualTextWidth": 168, - "height": 20, + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 48, + "actualTextWidth": 243, + "height": 64, "multiLineActualTexts": Array [ - "浙江省浙江省浙", - "江省浙江省浙...", + "类别类别类别类", + "别类别类别类别", + "类别类别类别", ], - "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "originalText": "类别类别类别类别类别类别类别类别类别类别", "width": 103.8, }, Object { - "actualText": "浙江省", - "actualTextHeight": 15, + "actualText": "子类别", + "actualTextHeight": 16, "actualTextWidth": 37, - "height": 20, + "height": 64, "multiLineActualTexts": Array [ - "浙江省", + "子类别", ], - "originalText": "浙江省", + "originalText": "子类别", "width": 103.8, }, Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 64, "multiLineActualTexts": Array [ - "浙江省", + "数量数量数量数", + "量数量数量数量", + "数量数量数量...", ], - "originalText": "浙江省", + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 103.8, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style less than actual text height by rowCell.heightByField 4`] = `Array []`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style less than actual text height by rowCell.heightByField 5`] = ` +Array [ Object { - "actualText": "浙江省", + "actualText": "1", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 7, + "height": 46, "multiLineActualTexts": Array [ - "浙江省", + "1", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": 1, + "width": 80, }, Object { - "actualText": "浙江省", + "actualText": "2", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 7, "height": 20, "multiLineActualTexts": Array [ - "浙江省", + "2", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": 2, + "width": 80, }, Object { - "actualText": "浙江省", + "actualText": "3", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 7, + "height": 46, "multiLineActualTexts": Array [ - "浙江省", + "3", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": 3, + "width": 80, }, Object { - "actualText": "浙江省", + "actualText": "4", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "4", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": 4, + "width": 80, }, Object { - "actualText": "浙江省", + "actualText": "5", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 7, + "height": 100, "multiLineActualTexts": Array [ - "浙江省", + "5", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": 5, + "width": 80, }, Object { - "actualText": "浙江省", + "actualText": "6", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "6", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": 6, + "width": 80, }, Object { - "actualText": "浙江省", + "actualText": "7", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "7", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": 7, + "width": 80, }, Object { - "actualText": "浙江省", + "actualText": "8", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "8", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": 8, + "width": 80, }, Object { "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 46, "multiLineActualTexts": Array [ "浙江省", ], @@ -19502,21 +28909,21 @@ Array [ "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "浙江省浙江省...", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 83, "height": 20, "multiLineActualTexts": Array [ - "浙江省", + "浙江省浙江省...", ], - "originalText": "浙江省", + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 103.8, }, Object { "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 46, "multiLineActualTexts": Array [ "浙江省", ], @@ -19527,7 +28934,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "浙江省", ], @@ -19538,7 +28945,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 100, "multiLineActualTexts": Array [ "浙江省", ], @@ -19546,44 +28953,43 @@ Array [ "width": 103.8, }, Object { - "actualText": "四川省", + "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ - "四川省", + "浙江省", ], - "originalText": "四川省", + "originalText": "浙江省", "width": 103.8, }, Object { - "actualText": "绍兴市", + "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ - "绍兴市", + "浙江省", ], - "originalText": "绍兴市", + "originalText": "浙江省", "width": 103.8, }, Object { - "actualText": "杭州市杭州市杭州市杭州市杭...", - "actualTextHeight": 30, - "actualTextWidth": 168, - "height": 20, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "杭州市杭州市杭", - "州市杭州市杭...", + "浙江省", ], - "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "originalText": "浙江省", "width": 103.8, }, Object { "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 46, "multiLineActualTexts": Array [ "绍兴市", ], @@ -19591,43 +28997,21 @@ Array [ "width": 103.8, }, Object { - "actualText": "宁波市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, - "multiLineActualTexts": Array [ - "宁波市", - ], - "originalText": "宁波市", - "width": 103.8, - }, - Object { - "actualText": "舟山市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, - "multiLineActualTexts": Array [ - "舟山市", - ], - "originalText": "舟山市", - "width": 103.8, - }, - Object { - "actualText": "杭州市", + "actualText": "杭州市杭州市...", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 83, "height": 20, "multiLineActualTexts": Array [ - "杭州市", + "杭州市杭州市...", ], - "originalText": "杭州市", + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", "width": 103.8, }, Object { "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 46, "multiLineActualTexts": Array [ "绍兴市", ], @@ -19638,7 +29022,7 @@ Array [ "actualText": "宁波市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "宁波市", ], @@ -19649,7 +29033,7 @@ Array [ "actualText": "舟山市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 100, "multiLineActualTexts": Array [ "舟山市", ], @@ -19660,7 +29044,7 @@ Array [ "actualText": "杭州市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "杭州市", ], @@ -19671,7 +29055,7 @@ Array [ "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "绍兴市", ], @@ -19682,7 +29066,7 @@ Array [ "actualText": "宁波市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "宁波市", ], @@ -19690,99 +29074,87 @@ Array [ "width": 103.8, }, Object { - "actualText": "舟山市", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 25, + "height": 46, "multiLineActualTexts": Array [ - "舟山市", + "家具", ], - "originalText": "舟山市", + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "杭州市", + "actualText": "家具家具家具...", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 83, "height": 20, "multiLineActualTexts": Array [ - "杭州市", + "家具家具家具...", ], - "originalText": "杭州市", + "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", "width": 103.8, }, Object { - "actualText": "绍兴市", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 25, + "height": 46, "multiLineActualTexts": Array [ - "绍兴市", + "家具", ], - "originalText": "绍兴市", + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "宁波市", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "宁波市", + "家具", ], - "originalText": "宁波市", + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "舟山市", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 25, + "height": 100, "multiLineActualTexts": Array [ - "舟山市", + "家具", ], - "originalText": "舟山市", + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "成都市", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "成都市", + "家具", ], - "originalText": "成都市", + "originalText": "家具", "width": 103.8, }, Object { "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "家具", ], "originalText": "家具", "width": 103.8, }, - Object { - "actualText": "家具家具家具家具家具家具家...", - "actualTextHeight": 30, - "actualTextWidth": 168, - "height": 20, - "multiLineActualTexts": Array [ - "家具家具家具家", - "具家具家具家...", - ], - "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "width": 103.8, - }, Object { "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "家具", ], @@ -19790,580 +29162,625 @@ Array [ "width": 103.8, }, Object { - "actualText": "家具", + "actualText": "桌子", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 20, + "height": 46, "multiLineActualTexts": Array [ - "家具", + "桌子", ], - "originalText": "家具", + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "家具", + "actualText": "桌子桌子桌子...", "actualTextHeight": 15, - "actualTextWidth": 25, + "actualTextWidth": 83, "height": 20, "multiLineActualTexts": Array [ - "家具", + "桌子桌子桌子...", ], - "originalText": "家具", + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", "width": 103.8, }, Object { - "actualText": "家具", + "actualText": "桌子", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 20, + "height": 46, "multiLineActualTexts": Array [ - "家具", + "桌子", ], - "originalText": "家具", + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "家具", + "actualText": "桌子", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ - "家具", + "桌子", ], - "originalText": "家具", + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "家具", + "actualText": "桌子", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 20, + "height": 100, "multiLineActualTexts": Array [ - "家具", + "桌子", ], - "originalText": "家具", + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "家具", + "actualText": "沙发", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ - "家具", + "沙发", ], - "originalText": "家具", + "originalText": "沙发", "width": 103.8, }, Object { - "actualText": "办公用品", + "actualText": "沙发", "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 20, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "办公用品", + "沙发", ], - "originalText": "办公用品", + "originalText": "沙发", "width": 103.8, }, Object { - "actualText": "办公用品", + "actualText": "沙发", "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 20, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "办公用品", + "沙发", ], - "originalText": "办公用品", + "originalText": "沙发", "width": 103.8, }, Object { - "actualText": "办公用品", - "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 20, + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 46, "multiLineActualTexts": Array [ - "办公用品", + "2367236723611", + "11", ], - "originalText": "办公用品", + "originalText": 236723672361111, "width": 103.8, }, Object { - "actualText": "办公用品", + "actualText": "77897789778...", "actualTextHeight": 15, - "actualTextWidth": 49, + "actualTextWidth": 84, "height": 20, "multiLineActualTexts": Array [ - "办公用品", + "77897789778...", ], - "originalText": "办公用品", + "originalText": "7789778977897789778977897789", "width": 103.8, }, Object { - "actualText": "办公用品", - "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 20, + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 46, "multiLineActualTexts": Array [ - "办公用品", + "2367236723611", + "11", ], - "originalText": "办公用品", + "originalText": 236723672361111, "width": 103.8, }, Object { - "actualText": "办公用品", + "actualText": "3877", "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 20, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "办公用品", + "3877", ], - "originalText": "办公用品", + "originalText": 3877, "width": 103.8, }, Object { - "actualText": "办公用品", + "actualText": "4342", "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 20, + "actualTextWidth": 27, + "height": 100, "multiLineActualTexts": Array [ - "办公用品", + "4342", ], - "originalText": "办公用品", + "originalText": 4342, "width": 103.8, }, Object { - "actualText": "办公用品", + "actualText": "5343", "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 20, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "办公用品", + "5343", ], - "originalText": "办公用品", + "originalText": 5343, "width": 103.8, }, Object { - "actualText": "家具", + "actualText": "632", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualTextWidth": 21, + "height": 30, "multiLineActualTexts": Array [ - "家具", + "632", ], - "originalText": "家具", + "originalText": 632, "width": 103.8, }, Object { - "actualText": "桌子", + "actualText": "7234", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "桌子", + "7234", ], - "originalText": "桌子", + "originalText": 7234, "width": 103.8, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style more than actual text height by rowCell.height 1`] = ` +Array [ Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌...", - "actualTextHeight": 30, - "actualTextWidth": 168, - "height": 20, + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, "multiLineActualTexts": Array [ - "桌子桌子桌子桌", - "子桌子桌子桌...", + "序号", ], - "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", - "width": 103.8, + "originalText": "序号", + "width": 80, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style more than actual text height by rowCell.height 2`] = ` +Array [ Object { - "actualText": "桌子", + "actualText": "1", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualTextWidth": 7, + "height": 100, "multiLineActualTexts": Array [ - "桌子", + "1", ], - "originalText": "桌子", - "width": 103.8, + "originalText": 1, + "width": 80, }, Object { - "actualText": "桌子", + "actualText": "2", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualTextWidth": 7, + "height": 100, "multiLineActualTexts": Array [ - "桌子", + "2", ], - "originalText": "桌子", - "width": 103.8, + "originalText": 2, + "width": 80, }, Object { - "actualText": "桌子", + "actualText": "3", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualTextWidth": 7, + "height": 100, "multiLineActualTexts": Array [ - "桌子", + "3", ], - "originalText": "桌子", - "width": 103.8, + "originalText": 3, + "width": 80, }, Object { - "actualText": "沙发", + "actualText": "4", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualTextWidth": 7, + "height": 100, "multiLineActualTexts": Array [ - "沙发", + "4", ], - "originalText": "沙发", - "width": 103.8, + "originalText": 4, + "width": 80, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style more than actual text height by rowCell.height 3`] = ` +Array [ Object { - "actualText": "沙发", - "actualTextHeight": 15, + "actualText": "序号", + "actualTextHeight": 16, "actualTextWidth": 25, - "height": 20, + "height": 64, "multiLineActualTexts": Array [ - "沙发", + "序号", ], - "originalText": "沙发", - "width": 103.8, + "originalText": "序号", + "width": 80, }, Object { - "actualText": "沙发", - "actualTextHeight": 15, + "actualText": "省份", + "actualTextHeight": 16, "actualTextWidth": 25, - "height": 20, + "height": 64, "multiLineActualTexts": Array [ - "沙发", + "省份", ], - "originalText": "沙发", + "originalText": "省份", "width": 103.8, }, Object { - "actualText": "沙发", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualText": "城市城市城市城市城市城市城市城市城市城市...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 64, "multiLineActualTexts": Array [ - "沙发", + "城市城市城市城", + "市城市城市城市", + "城市城市城市...", ], - "originalText": "沙发", + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", "width": 103.8, }, Object { - "actualText": "笔", - "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 20, + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 48, + "actualTextWidth": 243, + "height": 64, "multiLineActualTexts": Array [ - "笔", + "类别类别类别类", + "别类别类别类别", + "类别类别类别", ], - "originalText": "笔", + "originalText": "类别类别类别类别类别类别类别类别类别类别", "width": 103.8, }, Object { - "actualText": "笔", - "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 20, + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 64, "multiLineActualTexts": Array [ - "笔", + "子类别", ], - "originalText": "笔", + "originalText": "子类别", "width": 103.8, }, Object { - "actualText": "笔", - "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 20, + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 64, "multiLineActualTexts": Array [ - "笔", + "数量数量数量数", + "量数量数量数量", + "数量数量数量...", ], - "originalText": "笔", + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 103.8, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style more than actual text height by rowCell.height 4`] = `Array []`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style more than actual text height by rowCell.height 5`] = ` +Array [ Object { - "actualText": "笔", + "actualText": "1", "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 20, + "actualTextWidth": 7, + "height": 100, "multiLineActualTexts": Array [ - "笔", + "1", ], - "originalText": "笔", - "width": 103.8, + "originalText": 1, + "width": 80, }, Object { - "actualText": "纸张", + "actualText": "2", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualTextWidth": 7, + "height": 100, "multiLineActualTexts": Array [ - "纸张", + "2", ], - "originalText": "纸张", - "width": 103.8, + "originalText": 2, + "width": 80, }, Object { - "actualText": "纸张", + "actualText": "3", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualTextWidth": 7, + "height": 100, "multiLineActualTexts": Array [ - "纸张", + "3", ], - "originalText": "纸张", - "width": 103.8, + "originalText": 3, + "width": 80, }, Object { - "actualText": "纸张", + "actualText": "4", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualTextWidth": 7, + "height": 100, "multiLineActualTexts": Array [ - "纸张", + "4", ], - "originalText": "纸张", - "width": 103.8, + "originalText": 4, + "width": 80, }, Object { - "actualText": "纸张", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualTextWidth": 37, + "height": 100, "multiLineActualTexts": Array [ - "纸张", + "浙江省", ], - "originalText": "纸张", + "originalText": "浙江省", "width": 103.8, }, Object { - "actualText": "桌子", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "actualTextHeight": 75, + "actualTextWidth": 365, + "height": 100, "multiLineActualTexts": Array [ - "桌子", + "浙江省浙江省浙", + "江省浙江省浙江", + "省浙江省浙江省", + "浙江省浙江省浙", + "江省", ], - "originalText": "桌子", + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 103.8, }, Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, - "height": 20, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 100, "multiLineActualTexts": Array [ - "2367236723611", - "11", + "浙江省", ], - "originalText": 236723672361111, + "originalText": "浙江省", "width": 103.8, }, Object { - "actualText": "778977897789778977897789...", - "actualTextHeight": 30, - "actualTextWidth": 172, - "height": 20, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 100, "multiLineActualTexts": Array [ - "7789778977897", - "78977897789...", + "浙江省", ], - "originalText": "7789778977897789778977897789", + "originalText": "浙江省", "width": 103.8, }, Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, - "height": 20, + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 100, "multiLineActualTexts": Array [ - "2367236723611", - "11", + "绍兴市", ], - "originalText": 236723672361111, + "originalText": "绍兴市", "width": 103.8, }, Object { - "actualText": "3877", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "actualTextHeight": 75, + "actualTextWidth": 365, + "height": 100, "multiLineActualTexts": Array [ - "3877", + "杭州市杭州市杭", + "州市杭州市杭州", + "市杭州市杭州市", + "杭州市杭州市杭", + "州市", ], - "originalText": 3877, + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", "width": 103.8, }, Object { - "actualText": "4342", + "actualText": "绍兴市", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualTextWidth": 37, + "height": 100, "multiLineActualTexts": Array [ - "4342", + "绍兴市", ], - "originalText": 4342, + "originalText": "绍兴市", "width": 103.8, }, Object { - "actualText": "5343", + "actualText": "宁波市", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualTextWidth": 37, + "height": 100, "multiLineActualTexts": Array [ - "5343", + "宁波市", ], - "originalText": 5343, + "originalText": "宁波市", "width": 103.8, }, Object { - "actualText": "632", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 20, + "actualTextWidth": 25, + "height": 100, "multiLineActualTexts": Array [ - "632", + "家具", ], - "originalText": 632, + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "7234", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "actualTextHeight": 60, + "actualTextWidth": 340, + "height": 100, "multiLineActualTexts": Array [ - "7234", + "家具家具家具家", + "具家具家具家具", + "家具家具家具家", + "具家具家具家具", ], - "originalText": 7234, + "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", "width": 103.8, }, Object { - "actualText": "834", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 20, + "actualTextWidth": 25, + "height": 100, "multiLineActualTexts": Array [ - "834", + "家具", ], - "originalText": 834, + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "945", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 20, + "actualTextWidth": 25, + "height": 100, "multiLineActualTexts": Array [ - "945", + "家具", ], - "originalText": 945, + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "1304", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualTextWidth": 25, + "height": 100, "multiLineActualTexts": Array [ - "1304", + "桌子", ], - "originalText": 1304, + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "1145", - "actualTextHeight": 15, - "actualTextWidth": 26, - "height": 20, + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "actualTextHeight": 75, + "actualTextWidth": 365, + "height": 100, "multiLineActualTexts": Array [ - "1145", + "桌子桌子桌子桌", + "子桌子桌子桌子", + "桌子桌子桌子桌", + "子桌子桌子桌子", + "桌子", ], - "originalText": 1145, + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", "width": 103.8, }, Object { - "actualText": "1432", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualTextWidth": 25, + "height": 100, "multiLineActualTexts": Array [ - "1432", + "桌子", ], - "originalText": 1432, + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "1343", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualTextWidth": 25, + "height": 100, "multiLineActualTexts": Array [ - "1343", + "桌子", ], - "originalText": 1343, + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "1354", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 100, "multiLineActualTexts": Array [ - "1354", + "2367236723611", + "11", ], - "originalText": 1354, + "originalText": 236723672361111, "width": 103.8, }, Object { - "actualText": "1523", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualText": "7789778977897789778977897789", + "actualTextHeight": 45, + "actualTextWidth": 189, + "height": 100, "multiLineActualTexts": Array [ - "1523", + "7789778977897", + "7897789778977", + "89", ], - "originalText": 1523, + "originalText": "7789778977897789778977897789", "width": 103.8, }, Object { - "actualText": "1634", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 100, "multiLineActualTexts": Array [ - "1634", + "2367236723611", + "11", ], - "originalText": 1634, + "originalText": 236723672361111, "width": 103.8, }, Object { - "actualText": "1723", + "actualText": "3877", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 100, "multiLineActualTexts": Array [ - "1723", + "3877", ], - "originalText": 1723, + "originalText": 3877, "width": 103.8, }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust data cell height if custom cell style more than actual text height by dataCell.height 1`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style more than actual text height by rowCell.heightByField 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 64, "multiLineActualTexts": Array [ "序号", ], @@ -20373,7 +29790,7 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust data cell height if custom cell style more than actual text height by dataCell.height 2`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style more than actual text height by rowCell.heightByField 2`] = ` Array [ Object { "actualText": "1", @@ -20401,7 +29818,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 100, + "height": 46, "multiLineActualTexts": Array [ "3", ], @@ -20412,23 +29829,45 @@ Array [ "actualText": "4", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ "4", ], "originalText": 4, "width": 80, }, + Object { + "actualText": "5", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "5", + ], + "originalText": 5, + "width": 80, + }, + Object { + "actualText": "6", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "6", + ], + "originalText": 6, + "width": 80, + }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust data cell height if custom cell style more than actual text height by dataCell.height 3`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style more than actual text height by rowCell.heightByField 3`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 64, "multiLineActualTexts": Array [ "序号", ], @@ -20439,7 +29878,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 64, "multiLineActualTexts": Array [ "省份", ], @@ -20447,25 +29886,27 @@ Array [ "width": 103.8, }, Object { - "actualText": "城市城市城市城市城市城市城...", - "actualTextHeight": 32, - "actualTextWidth": 168, - "height": 40, + "actualText": "城市城市城市城市城市城市城市城市城市城市...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 64, "multiLineActualTexts": Array [ "城市城市城市城", - "市城市城市城...", + "市城市城市城市", + "城市城市城市...", ], "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", "width": 103.8, }, Object { - "actualText": "类别类别类别类别类别类别类...", - "actualTextHeight": 32, - "actualTextWidth": 168, - "height": 40, + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 48, + "actualTextWidth": 243, + "height": 64, "multiLineActualTexts": Array [ "类别类别类别类", - "别类别类别类...", + "别类别类别类别", + "类别类别类别", ], "originalText": "类别类别类别类别类别类别类别类别类别类别", "width": 103.8, @@ -20474,7 +29915,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 40, + "height": 64, "multiLineActualTexts": Array [ "子类别", ], @@ -20482,13 +29923,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "数量数量数量数量数量数量数...", - "actualTextHeight": 32, - "actualTextWidth": 168, - "height": 40, + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 64, "multiLineActualTexts": Array [ "数量数量数量数", - "量数量数量数...", + "量数量数量数量", + "数量数量数量...", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 103.8, @@ -20496,9 +29938,9 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust data cell height if custom cell style more than actual text height by dataCell.height 4`] = `Array []`; +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style more than actual text height by rowCell.heightByField 4`] = `Array []`; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not adaptive adjust data cell height if custom cell style more than actual text height by dataCell.height 5`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style more than actual text height by rowCell.heightByField 5`] = ` Array [ Object { "actualText": "1", @@ -20526,7 +29968,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 100, + "height": 46, "multiLineActualTexts": Array [ "3", ], @@ -20537,13 +29979,35 @@ Array [ "actualText": "4", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ "4", ], "originalText": 4, "width": 80, }, + Object { + "actualText": "5", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "5", + ], + "originalText": 5, + "width": 80, + }, + Object { + "actualText": "6", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "6", + ], + "originalText": 6, + "width": 80, + }, Object { "actualText": "浙江省", "actualTextHeight": 15, @@ -20556,13 +30020,16 @@ Array [ "width": 103.8, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙...", - "actualTextHeight": 30, - "actualTextWidth": 168, + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "actualTextHeight": 75, + "actualTextWidth": 365, "height": 100, "multiLineActualTexts": Array [ "浙江省浙江省浙", - "江省浙江省浙...", + "江省浙江省浙江", + "省浙江省浙江省", + "浙江省浙江省浙", + "江省", ], "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 103.8, @@ -20571,7 +30038,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 100, + "height": 46, "multiLineActualTexts": Array [ "浙江省", ], @@ -20582,7 +30049,29 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 100, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ "浙江省", ], @@ -20601,13 +30090,16 @@ Array [ "width": 103.8, }, Object { - "actualText": "杭州市杭州市杭州市杭州市杭...", - "actualTextHeight": 30, - "actualTextWidth": 168, + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "actualTextHeight": 75, + "actualTextWidth": 365, "height": 100, "multiLineActualTexts": Array [ "杭州市杭州市杭", - "州市杭州市杭...", + "州市杭州市杭州", + "市杭州市杭州市", + "杭州市杭州市杭", + "州市", ], "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", "width": 103.8, @@ -20616,7 +30108,7 @@ Array [ "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 100, + "height": 46, "multiLineActualTexts": Array [ "绍兴市", ], @@ -20627,13 +30119,35 @@ Array [ "actualText": "宁波市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ "宁波市", ], "originalText": "宁波市", "width": 103.8, }, + Object { + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "舟山市", + ], + "originalText": "舟山市", + "width": 103.8, + }, + Object { + "actualText": "杭州市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "杭州市", + ], + "originalText": "杭州市", + "width": 103.8, + }, Object { "actualText": "家具", "actualTextHeight": 15, @@ -20646,13 +30160,15 @@ Array [ "width": 103.8, }, Object { - "actualText": "家具家具家具家具家具家具家...", - "actualTextHeight": 30, - "actualTextWidth": 168, + "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "actualTextHeight": 60, + "actualTextWidth": 340, "height": 100, "multiLineActualTexts": Array [ "家具家具家具家", - "具家具家具家...", + "具家具家具家具", + "家具家具家具家", + "具家具家具家具", ], "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", "width": 103.8, @@ -20661,7 +30177,7 @@ Array [ "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 100, + "height": 46, "multiLineActualTexts": Array [ "家具", ], @@ -20672,7 +30188,29 @@ Array [ "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 100, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 103.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ "家具", ], @@ -20691,13 +30229,16 @@ Array [ "width": 103.8, }, Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌...", - "actualTextHeight": 30, - "actualTextWidth": 168, + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "actualTextHeight": 75, + "actualTextWidth": 365, "height": 100, "multiLineActualTexts": Array [ "桌子桌子桌子桌", - "子桌子桌子桌...", + "子桌子桌子桌子", + "桌子桌子桌子桌", + "子桌子桌子桌子", + "桌子", ], "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", "width": 103.8, @@ -20706,7 +30247,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 100, + "height": 46, "multiLineActualTexts": Array [ "桌子", ], @@ -20717,13 +30258,35 @@ Array [ "actualText": "桌子", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ "桌子", ], "originalText": "桌子", "width": 103.8, }, + Object { + "actualText": "桌子", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 103.8, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 103.8, + }, Object { "actualText": "236723672361111", "actualTextHeight": 30, @@ -20737,13 +30300,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "778977897789778977897789...", - "actualTextHeight": 30, - "actualTextWidth": 172, + "actualText": "7789778977897789778977897789", + "actualTextHeight": 45, + "actualTextWidth": 189, "height": 100, "multiLineActualTexts": Array [ "7789778977897", - "78977897789...", + "7897789778977", + "89", ], "originalText": "7789778977897789778977897789", "width": 103.8, @@ -20752,7 +30316,7 @@ Array [ "actualText": "236723672361111", "actualTextHeight": 30, "actualTextWidth": 100, - "height": 100, + "height": 46, "multiLineActualTexts": Array [ "2367236723611", "11", @@ -20764,23 +30328,45 @@ Array [ "actualText": "3877", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ "3877", ], "originalText": 3877, "width": 103.8, }, + Object { + "actualText": "4342", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "4342", + ], + "originalText": 4342, + "width": 103.8, + }, + Object { + "actualText": "5343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "5343", + ], + "originalText": 5343, + "width": 103.8, + }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust cell height if custom cell style less than actual text height by colCell.height 1`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not render word wrap text 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "序号", ], @@ -20790,13 +30376,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust cell height if custom cell style less than actual text height by colCell.height 2`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not render word wrap text 2`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "1", ], @@ -20807,7 +30393,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "2", ], @@ -20818,7 +30404,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "3", ], @@ -20913,16 +30499,38 @@ Array [ "originalText": 11, "width": 80, }, + Object { + "actualText": "12", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "12", + ], + "originalText": 12, + "width": 80, + }, + Object { + "actualText": "13", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "13", + ], + "originalText": 13, + "width": 80, + }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust cell height if custom cell style less than actual text height by colCell.height 3`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not render word wrap text 3`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "序号", ], @@ -20933,7 +30541,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "省份", ], @@ -20941,25 +30549,23 @@ Array [ "width": 103.8, }, Object { - "actualText": "城市城市城市城市城市城市城...", - "actualTextHeight": 32, - "actualTextWidth": 168, - "height": 20, + "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "actualTextHeight": 16, + "actualTextWidth": 289, + "height": 30, "multiLineActualTexts": Array [ - "城市城市城市城", - "市城市城市城...", + "城市城市城市城市城市城市城市城市城市城市城市城市", ], "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", "width": 103.8, }, Object { - "actualText": "类别类别类别类别类别类别类...", - "actualTextHeight": 32, - "actualTextWidth": 168, - "height": 20, + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 16, + "actualTextWidth": 241, + "height": 30, "multiLineActualTexts": Array [ - "类别类别类别类", - "别类别类别类...", + "类别类别类别类别类别类别类别类别类别类别", ], "originalText": "类别类别类别类别类别类别类别类别类别类别", "width": 103.8, @@ -20968,7 +30574,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "子类别", ], @@ -20976,13 +30582,12 @@ Array [ "width": 103.8, }, Object { - "actualText": "数量数量数量数量数量数量数...", - "actualTextHeight": 32, - "actualTextWidth": 168, - "height": 20, + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 16, + "actualTextWidth": 265, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数...", + "数量数量数量数量数量数量数量数量数量数量数量", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 103.8, @@ -20990,15 +30595,15 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust cell height if custom cell style less than actual text height by colCell.height 4`] = `Array []`; +exports[`SpreadSheet Multi Line Text Tests TableSheet should not render word wrap text 4`] = `Array []`; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust cell height if custom cell style less than actual text height by colCell.height 5`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should not render word wrap text 5`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "1", ], @@ -21009,7 +30614,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "2", ], @@ -21020,7 +30625,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "3", ], @@ -21115,11 +30720,33 @@ Array [ "originalText": 11, "width": 80, }, + Object { + "actualText": "12", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "12", + ], + "originalText": 12, + "width": 80, + }, + Object { + "actualText": "13", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "13", + ], + "originalText": 13, + "width": 80, + }, Object { "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "浙江省", ], @@ -21127,13 +30754,12 @@ Array [ "width": 103.8, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙...", - "actualTextHeight": 30, - "actualTextWidth": 168, - "height": 46, + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "actualTextHeight": 15, + "actualTextWidth": 361, + "height": 30, "multiLineActualTexts": Array [ - "浙江省浙江省浙", - "江省浙江省浙...", + "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", ], "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 103.8, @@ -21142,7 +30768,29 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 46, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 103.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ "浙江省", ], @@ -21241,7 +30889,7 @@ Array [ "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "绍兴市", ], @@ -21249,13 +30897,12 @@ Array [ "width": 103.8, }, Object { - "actualText": "杭州市杭州市杭州市杭州市杭...", - "actualTextHeight": 30, - "actualTextWidth": 168, - "height": 46, + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "actualTextHeight": 15, + "actualTextWidth": 361, + "height": 30, "multiLineActualTexts": Array [ - "杭州市杭州市杭", - "州市杭州市杭...", + "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", ], "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", "width": 103.8, @@ -21264,7 +30911,7 @@ Array [ "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "绍兴市", ], @@ -21359,11 +31006,33 @@ Array [ "originalText": "绍兴市", "width": 103.8, }, + Object { + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "宁波市", + ], + "originalText": "宁波市", + "width": 103.8, + }, + Object { + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "舟山市", + ], + "originalText": "舟山市", + "width": 103.8, + }, Object { "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "家具", ], @@ -21371,13 +31040,12 @@ Array [ "width": 103.8, }, Object { - "actualText": "家具家具家具家具家具家具家...", - "actualTextHeight": 30, - "actualTextWidth": 168, - "height": 46, + "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "actualTextHeight": 15, + "actualTextWidth": 337, + "height": 30, "multiLineActualTexts": Array [ - "家具家具家具家", - "具家具家具家...", + "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", ], "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", "width": 103.8, @@ -21386,7 +31054,7 @@ Array [ "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "家具", ], @@ -21481,11 +31149,33 @@ Array [ "originalText": "办公用品", "width": 103.8, }, + Object { + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 30, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 103.8, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 30, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 103.8, + }, Object { "actualText": "桌子", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "桌子", ], @@ -21493,13 +31183,12 @@ Array [ "width": 103.8, }, Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌...", - "actualTextHeight": 30, - "actualTextWidth": 168, - "height": 46, + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "actualTextHeight": 15, + "actualTextWidth": 361, + "height": 30, "multiLineActualTexts": Array [ - "桌子桌子桌子桌", - "子桌子桌子桌...", + "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", ], "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", "width": 103.8, @@ -21508,7 +31197,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "桌子", ], @@ -21603,38 +31292,57 @@ Array [ "originalText": "笔", "width": 103.8, }, + Object { + "actualText": "笔", + "actualTextHeight": 15, + "actualTextWidth": 13, + "height": 30, + "multiLineActualTexts": Array [ + "笔", + ], + "originalText": "笔", + "width": 103.8, + }, + Object { + "actualText": "笔", + "actualTextHeight": 15, + "actualTextWidth": 13, + "height": 30, + "multiLineActualTexts": Array [ + "笔", + ], + "originalText": "笔", + "width": 103.8, + }, Object { "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, - "height": 46, + "actualTextHeight": 15, + "actualTextWidth": 98, + "height": 30, "multiLineActualTexts": Array [ - "2367236723611", - "11", + "236723672361111", ], "originalText": 236723672361111, "width": 103.8, }, Object { - "actualText": "778977897789778977897789...", - "actualTextHeight": 30, - "actualTextWidth": 172, - "height": 46, + "actualText": "7789778977897789778977897789", + "actualTextHeight": 15, + "actualTextWidth": 187, + "height": 30, "multiLineActualTexts": Array [ - "7789778977897", - "78977897789...", + "7789778977897789778977897789", ], "originalText": "7789778977897789778977897789", "width": 103.8, }, Object { "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, - "height": 46, + "actualTextHeight": 15, + "actualTextWidth": 98, + "height": 30, "multiLineActualTexts": Array [ - "2367236723611", - "11", + "236723672361111", ], "originalText": 236723672361111, "width": 103.8, @@ -21727,16 +31435,38 @@ Array [ "originalText": 1304, "width": 103.8, }, + Object { + "actualText": "1145", + "actualTextHeight": 15, + "actualTextWidth": 26, + "height": 30, + "multiLineActualTexts": Array [ + "1145", + ], + "originalText": 1145, + "width": 103.8, + }, + Object { + "actualText": "1432", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1432", + ], + "originalText": 1432, + "width": 103.8, + }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style less than actual text height by rowCell.height 1`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should render by infinity maxLines 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 80, "multiLineActualTexts": Array [ "序号", ], @@ -21746,13 +31476,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style less than actual text height by rowCell.height 2`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should render by infinity maxLines 2`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 46, "multiLineActualTexts": Array [ "1", ], @@ -21763,7 +31493,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 91, "multiLineActualTexts": Array [ "2", ], @@ -21774,7 +31504,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 46, "multiLineActualTexts": Array [ "3", ], @@ -21785,7 +31515,7 @@ Array [ "actualText": "4", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "4", ], @@ -21796,7 +31526,7 @@ Array [ "actualText": "5", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "5", ], @@ -21804,147 +31534,48 @@ Array [ "width": 80, }, Object { - "actualText": "6", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 20, - "multiLineActualTexts": Array [ - "6", - ], - "originalText": 6, - "width": 80, - }, - Object { - "actualText": "7", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 20, - "multiLineActualTexts": Array [ - "7", - ], - "originalText": 7, - "width": 80, - }, - Object { - "actualText": "8", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 20, - "multiLineActualTexts": Array [ - "8", - ], - "originalText": 8, - "width": 80, - }, - Object { - "actualText": "9", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 20, - "multiLineActualTexts": Array [ - "9", - ], - "originalText": 9, - "width": 80, - }, - Object { - "actualText": "10", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, - "multiLineActualTexts": Array [ - "10", - ], - "originalText": 10, - "width": 80, - }, - Object { - "actualText": "11", - "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 20, - "multiLineActualTexts": Array [ - "11", - ], - "originalText": 11, - "width": 80, - }, - Object { - "actualText": "12", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, - "multiLineActualTexts": Array [ - "12", - ], - "originalText": 12, - "width": 80, - }, - Object { - "actualText": "13", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, - "multiLineActualTexts": Array [ - "13", - ], - "originalText": 13, - "width": 80, - }, - Object { - "actualText": "14", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, - "multiLineActualTexts": Array [ - "14", - ], - "originalText": 14, - "width": 80, - }, - Object { - "actualText": "15", + "actualText": "6", "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "15", + "6", ], - "originalText": 15, + "originalText": 6, "width": 80, }, Object { - "actualText": "16", + "actualText": "7", "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "16", + "7", ], - "originalText": 16, + "originalText": 7, "width": 80, }, Object { - "actualText": "17", + "actualText": "8", "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "17", + "8", ], - "originalText": 17, + "originalText": 8, "width": 80, }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style less than actual text height by rowCell.height 3`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should render by infinity maxLines 3`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 80, "multiLineActualTexts": Array [ "序号", ], @@ -21955,7 +31586,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 80, "multiLineActualTexts": Array [ "省份", ], @@ -21963,14 +31594,15 @@ Array [ "width": 103.8, }, Object { - "actualText": "城市城市城市城市城市城市城市城市城市城市...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 56, + "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "actualTextHeight": 64, + "actualTextWidth": 292, + "height": 80, "multiLineActualTexts": Array [ "城市城市城市城", "市城市城市城市", - "城市城市城市...", + "城市城市城市城", + "市城市", ], "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", "width": 103.8, @@ -21979,7 +31611,7 @@ Array [ "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 48, "actualTextWidth": 243, - "height": 56, + "height": 80, "multiLineActualTexts": Array [ "类别类别类别类", "别类别类别类别", @@ -21992,7 +31624,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 56, + "height": 80, "multiLineActualTexts": Array [ "子类别", ], @@ -22000,14 +31632,15 @@ Array [ "width": 103.8, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 56, + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 64, + "actualTextWidth": 268, + "height": 80, "multiLineActualTexts": Array [ "数量数量数量数", "量数量数量数量", - "数量数量数量...", + "数量数量数量数", + "量", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 103.8, @@ -22015,15 +31648,15 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style less than actual text height by rowCell.height 4`] = `Array []`; +exports[`SpreadSheet Multi Line Text Tests TableSheet should render by infinity maxLines 4`] = `Array []`; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style less than actual text height by rowCell.height 5`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should render by infinity maxLines 5`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 46, "multiLineActualTexts": Array [ "1", ], @@ -22034,7 +31667,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 91, "multiLineActualTexts": Array [ "2", ], @@ -22045,7 +31678,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 46, "multiLineActualTexts": Array [ "3", ], @@ -22056,7 +31689,7 @@ Array [ "actualText": "4", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "4", ], @@ -22067,7 +31700,7 @@ Array [ "actualText": "5", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "5", ], @@ -22078,7 +31711,7 @@ Array [ "actualText": "6", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "6", ], @@ -22089,7 +31722,7 @@ Array [ "actualText": "7", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "7", ], @@ -22100,7 +31733,7 @@ Array [ "actualText": "8", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "8", ], @@ -22108,1061 +31741,1147 @@ Array [ "width": 80, }, Object { - "actualText": "9", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 20, + "actualTextWidth": 37, + "height": 46, "multiLineActualTexts": Array [ - "9", + "浙江省", ], - "originalText": 9, - "width": 80, + "originalText": "浙江省", + "width": 103.8, }, Object { - "actualText": "10", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "actualTextHeight": 75, + "actualTextWidth": 365, + "height": 91, "multiLineActualTexts": Array [ - "10", + "浙江省浙江省浙", + "江省浙江省浙江", + "省浙江省浙江省", + "浙江省浙江省浙", + "江省", ], - "originalText": 10, - "width": 80, + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "width": 103.8, }, Object { - "actualText": "11", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 20, + "actualTextWidth": 37, + "height": 46, "multiLineActualTexts": Array [ - "11", + "浙江省", ], - "originalText": 11, - "width": 80, + "originalText": "浙江省", + "width": 103.8, }, Object { - "actualText": "12", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "12", + "浙江省", ], - "originalText": 12, - "width": 80, + "originalText": "浙江省", + "width": 103.8, }, Object { - "actualText": "13", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "13", + "浙江省", ], - "originalText": 13, - "width": 80, + "originalText": "浙江省", + "width": 103.8, }, Object { - "actualText": "14", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "14", + "浙江省", ], - "originalText": 14, - "width": 80, + "originalText": "浙江省", + "width": 103.8, }, Object { - "actualText": "15", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "15", + "浙江省", ], - "originalText": 15, - "width": 80, + "originalText": "浙江省", + "width": 103.8, }, Object { - "actualText": "16", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "16", + "浙江省", ], - "originalText": 16, - "width": 80, + "originalText": "浙江省", + "width": 103.8, }, Object { - "actualText": "17", + "actualText": "绍兴市", "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, + "actualTextWidth": 37, + "height": 46, "multiLineActualTexts": Array [ - "17", + "绍兴市", ], - "originalText": 17, - "width": 80, + "originalText": "绍兴市", + "width": 103.8, }, Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "actualTextHeight": 75, + "actualTextWidth": 365, + "height": 91, "multiLineActualTexts": Array [ - "浙江省", + "杭州市杭州市杭", + "州市杭州市杭州", + "市杭州市杭州市", + "杭州市杭州市杭", + "州市", ], - "originalText": "浙江省", + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", "width": 103.8, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 20, + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 46, "multiLineActualTexts": Array [ - "浙江省浙江省浙", - "江省浙江省浙江", - "省浙江省浙江...", + "绍兴市", ], - "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "originalText": "绍兴市", "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "宁波市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "宁波市", ], - "originalText": "浙江省", + "originalText": "宁波市", "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "舟山市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "舟山市", ], - "originalText": "浙江省", + "originalText": "舟山市", "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "杭州市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "杭州市", ], - "originalText": "浙江省", + "originalText": "杭州市", "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "绍兴市", ], - "originalText": "浙江省", + "originalText": "绍兴市", "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "宁波市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "宁波市", ], - "originalText": "浙江省", + "originalText": "宁波市", "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 25, + "height": 46, "multiLineActualTexts": Array [ - "浙江省", + "家具", ], - "originalText": "浙江省", + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "actualTextHeight": 60, + "actualTextWidth": 340, + "height": 91, "multiLineActualTexts": Array [ - "浙江省", + "家具家具家具家", + "具家具家具家具", + "家具家具家具家", + "具家具家具家具", ], - "originalText": "浙江省", + "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 25, + "height": 46, "multiLineActualTexts": Array [ - "浙江省", + "家具", ], - "originalText": "浙江省", + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "家具", ], - "originalText": "浙江省", + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "家具", ], - "originalText": "浙江省", + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "家具", ], - "originalText": "浙江省", + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "家具", ], - "originalText": "浙江省", + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "家具", ], - "originalText": "浙江省", + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "浙江省", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 25, + "height": 46, "multiLineActualTexts": Array [ - "浙江省", + "桌子", ], - "originalText": "浙江省", + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "actualTextHeight": 75, + "actualTextWidth": 365, + "height": 91, "multiLineActualTexts": Array [ - "浙江省", + "桌子桌子桌子桌", + "子桌子桌子桌子", + "桌子桌子桌子桌", + "子桌子桌子桌子", + "桌子", ], - "originalText": "浙江省", + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", "width": 103.8, }, Object { - "actualText": "绍兴市", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 25, + "height": 46, "multiLineActualTexts": Array [ - "绍兴市", + "桌子", ], - "originalText": "绍兴市", + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 20, + "actualText": "桌子", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "杭州市杭州市杭", - "州市杭州市杭州", - "市杭州市杭州...", + "桌子", ], - "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "绍兴市", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "绍兴市", + "桌子", ], - "originalText": "绍兴市", + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "宁波市", + "actualText": "沙发", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "宁波市", + "沙发", ], - "originalText": "宁波市", + "originalText": "沙发", "width": 103.8, }, Object { - "actualText": "舟山市", + "actualText": "沙发", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "舟山市", + "沙发", ], - "originalText": "舟山市", + "originalText": "沙发", "width": 103.8, }, Object { - "actualText": "杭州市", + "actualText": "沙发", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "杭州市", + "沙发", ], - "originalText": "杭州市", + "originalText": "沙发", "width": 103.8, }, Object { - "actualText": "绍兴市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 46, "multiLineActualTexts": Array [ - "绍兴市", + "2367236723611", + "11", ], - "originalText": "绍兴市", + "originalText": 236723672361111, "width": 103.8, }, Object { - "actualText": "宁波市", + "actualText": "7789778977897789778977897789", + "actualTextHeight": 45, + "actualTextWidth": 189, + "height": 91, + "multiLineActualTexts": Array [ + "7789778977897", + "7897789778977", + "89", + ], + "originalText": "7789778977897789778977897789", + "width": 103.8, + }, + Object { + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 46, + "multiLineActualTexts": Array [ + "2367236723611", + "11", + ], + "originalText": 236723672361111, + "width": 103.8, + }, + Object { + "actualText": "3877", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "宁波市", + "3877", ], - "originalText": "宁波市", + "originalText": 3877, "width": 103.8, }, Object { - "actualText": "舟山市", + "actualText": "4342", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "舟山市", + "4342", ], - "originalText": "舟山市", + "originalText": 4342, "width": 103.8, }, Object { - "actualText": "杭州市", + "actualText": "5343", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "杭州市", + "5343", ], - "originalText": "杭州市", + "originalText": 5343, "width": 103.8, }, Object { - "actualText": "绍兴市", + "actualText": "632", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 21, + "height": 30, "multiLineActualTexts": Array [ - "绍兴市", + "632", ], - "originalText": "绍兴市", + "originalText": 632, "width": 103.8, }, Object { - "actualText": "宁波市", + "actualText": "7234", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "宁波市", + "7234", ], - "originalText": "宁波市", + "originalText": 7234, "width": 103.8, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should render by infinity maxLines if actual text contains "\\n" 1`] = ` +Array [ Object { - "actualText": "舟山市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 80, "multiLineActualTexts": Array [ - "舟山市", + "序号", ], - "originalText": "舟山市", - "width": 103.8, + "originalText": "序号", + "width": 80, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should render by infinity maxLines if actual text contains "\\n" 2`] = ` +Array [ Object { - "actualText": "杭州市", + "actualText": "1", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 7, + "height": 61, "multiLineActualTexts": Array [ - "杭州市", + "1", ], - "originalText": "杭州市", - "width": 103.8, + "originalText": 1, + "width": 80, }, Object { - "actualText": "绍兴市", + "actualText": "2", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 7, + "height": 46, "multiLineActualTexts": Array [ - "绍兴市", + "2", ], - "originalText": "绍兴市", - "width": 103.8, + "originalText": 2, + "width": 80, }, Object { - "actualText": "宁波市", + "actualText": "3", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 7, + "height": 91, "multiLineActualTexts": Array [ - "宁波市", + "3", ], - "originalText": "宁波市", - "width": 103.8, + "originalText": 3, + "width": 80, }, Object { - "actualText": "舟山市", + "actualText": "4", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, + "actualTextWidth": 7, + "height": 46, "multiLineActualTexts": Array [ - "舟山市", + "4", ], - "originalText": "舟山市", - "width": 103.8, + "originalText": 4, + "width": 80, }, Object { - "actualText": "家具", + "actualText": "5", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "家具", + "5", ], - "originalText": "家具", - "width": 103.8, + "originalText": 5, + "width": 80, }, Object { - "actualText": "家具家具家具家具家具家具家具家具家具家具...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 20, + "actualText": "6", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "家具家具家具家", - "具家具家具家具", - "家具家具家具...", + "6", ], - "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "width": 103.8, + "originalText": 6, + "width": 80, }, Object { - "actualText": "家具", + "actualText": "7", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "家具", + "7", ], - "originalText": "家具", - "width": 103.8, + "originalText": 7, + "width": 80, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should render by infinity maxLines if actual text contains "\\n" 3`] = ` +Array [ Object { - "actualText": "家具", - "actualTextHeight": 15, + "actualText": "序号", + "actualTextHeight": 16, "actualTextWidth": 25, - "height": 20, + "height": 80, "multiLineActualTexts": Array [ - "家具", + "序号", ], - "originalText": "家具", - "width": 103.8, + "originalText": "序号", + "width": 80, }, Object { - "actualText": "家具", - "actualTextHeight": 15, + "actualText": "省份", + "actualTextHeight": 16, "actualTextWidth": 25, - "height": 20, + "height": 80, "multiLineActualTexts": Array [ - "家具", + "省份", ], - "originalText": "家具", + "originalText": "省份", "width": 103.8, }, Object { - "actualText": "家具", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "actualTextHeight": 64, + "actualTextWidth": 292, + "height": 80, "multiLineActualTexts": Array [ - "家具", + "城市城市城市城", + "市城市城市城市", + "城市城市城市城", + "市城市", ], - "originalText": "家具", + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", "width": 103.8, }, Object { - "actualText": "家具", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 48, + "actualTextWidth": 243, + "height": 80, "multiLineActualTexts": Array [ - "家具", + "类别类别类别类", + "别类别类别类别", + "类别类别类别", ], - "originalText": "家具", + "originalText": "类别类别类别类别类别类别类别类别类别类别", "width": 103.8, }, Object { - "actualText": "家具", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 80, "multiLineActualTexts": Array [ - "家具", + "子类别", ], - "originalText": "家具", + "originalText": "子类别", "width": 103.8, }, Object { - "actualText": "家具", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 64, + "actualTextWidth": 268, + "height": 80, "multiLineActualTexts": Array [ - "家具", + "数量数量数量数", + "量数量数量数量", + "数量数量数量数", + "量", ], - "originalText": "家具", + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 103.8, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should render by infinity maxLines if actual text contains "\\n" 4`] = `Array []`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should render by infinity maxLines if actual text contains "\\n" 5`] = ` +Array [ Object { - "actualText": "办公用品", + "actualText": "1", "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 20, + "actualTextWidth": 7, + "height": 61, "multiLineActualTexts": Array [ - "办公用品", + "1", ], - "originalText": "办公用品", - "width": 103.8, + "originalText": 1, + "width": 80, }, Object { - "actualText": "办公用品", + "actualText": "2", "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 20, + "actualTextWidth": 7, + "height": 46, "multiLineActualTexts": Array [ - "办公用品", + "2", ], - "originalText": "办公用品", - "width": 103.8, + "originalText": 2, + "width": 80, }, Object { - "actualText": "办公用品", + "actualText": "3", "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 20, + "actualTextWidth": 7, + "height": 91, "multiLineActualTexts": Array [ - "办公用品", + "3", ], - "originalText": "办公用品", - "width": 103.8, + "originalText": 3, + "width": 80, }, Object { - "actualText": "办公用品", + "actualText": "4", "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 20, + "actualTextWidth": 7, + "height": 46, "multiLineActualTexts": Array [ - "办公用品", + "4", ], - "originalText": "办公用品", - "width": 103.8, + "originalText": 4, + "width": 80, }, Object { - "actualText": "办公用品", + "actualText": "5", "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 20, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "办公用品", + "5", ], - "originalText": "办公用品", - "width": 103.8, + "originalText": 5, + "width": 80, }, Object { - "actualText": "办公用品", + "actualText": "6", "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 20, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "办公用品", + "6", ], - "originalText": "办公用品", - "width": 103.8, + "originalText": 6, + "width": 80, }, Object { - "actualText": "办公用品", + "actualText": "7", "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 20, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "办公用品", + "7", ], - "originalText": "办公用品", - "width": 103.8, + "originalText": 7, + "width": 80, }, Object { - "actualText": "办公用品", - "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 20, + "actualText": "浙江浙江", + "actualTextHeight": 30, + "actualTextWidth": 50, + "height": 61, "multiLineActualTexts": Array [ - "办公用品", + "浙江", + "浙江", ], - "originalText": "办公用品", + "originalText": "浙江 +浙江", "width": 103.8, }, Object { - "actualText": "桌子", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualTextWidth": 37, + "height": 46, "multiLineActualTexts": Array [ - "桌子", + "浙江省", ], - "originalText": "桌子", + "originalText": "浙江省", "width": 103.8, }, Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 20, + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "actualTextHeight": 75, + "actualTextWidth": 365, + "height": 91, "multiLineActualTexts": Array [ - "桌子桌子桌子桌", - "子桌子桌子桌子", - "桌子桌子桌子...", + "浙江省浙江省浙", + "江省浙江省浙江", + "省浙江省浙江省", + "浙江省浙江省浙", + "江省", ], - "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 103.8, }, Object { - "actualText": "桌子", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualTextWidth": 37, + "height": 46, "multiLineActualTexts": Array [ - "桌子", + "浙江省", ], - "originalText": "桌子", + "originalText": "浙江省", "width": 103.8, }, Object { - "actualText": "桌子", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "桌子", + "浙江省", ], - "originalText": "桌子", + "originalText": "浙江省", "width": 103.8, }, Object { - "actualText": "桌子", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "桌子", + "浙江省", ], - "originalText": "桌子", + "originalText": "浙江省", "width": 103.8, }, Object { - "actualText": "沙发", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "沙发", + "浙江省", ], - "originalText": "沙发", + "originalText": "浙江省", "width": 103.8, }, Object { - "actualText": "沙发", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualText": "杭州杭州杭州", + "actualTextHeight": 45, + "actualTextWidth": 75, + "height": 61, "multiLineActualTexts": Array [ - "沙发", + "杭州", + "杭州", + "杭州", ], - "originalText": "沙发", + "originalText": "杭州 +杭州 +杭州", "width": 103.8, }, Object { - "actualText": "沙发", + "actualText": "绍兴市", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualTextWidth": 37, + "height": 46, "multiLineActualTexts": Array [ - "沙发", + "绍兴市", ], - "originalText": "沙发", + "originalText": "绍兴市", "width": 103.8, }, Object { - "actualText": "沙发", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "actualTextHeight": 75, + "actualTextWidth": 365, + "height": 91, "multiLineActualTexts": Array [ - "沙发", + "杭州市杭州市杭", + "州市杭州市杭州", + "市杭州市杭州市", + "杭州市杭州市杭", + "州市", ], - "originalText": "沙发", + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", "width": 103.8, }, Object { - "actualText": "笔", + "actualText": "绍兴市", "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 20, + "actualTextWidth": 37, + "height": 46, "multiLineActualTexts": Array [ - "笔", + "绍兴市", ], - "originalText": "笔", + "originalText": "绍兴市", "width": 103.8, }, Object { - "actualText": "笔", + "actualText": "宁波市", "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 20, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "笔", + "宁波市", ], - "originalText": "笔", + "originalText": "宁波市", "width": 103.8, }, Object { - "actualText": "笔", + "actualText": "舟山市", "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 20, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "笔", + "舟山市", ], - "originalText": "笔", + "originalText": "舟山市", "width": 103.8, }, Object { - "actualText": "笔", + "actualText": "杭州市", "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 20, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "笔", + "杭州市", ], - "originalText": "笔", + "originalText": "杭州市", "width": 103.8, }, Object { - "actualText": "纸张", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualText": "纸张纸张", + "actualTextHeight": 30, + "actualTextWidth": 50, + "height": 61, "multiLineActualTexts": Array [ "纸张", + "纸张", ], - "originalText": "纸张", + "originalText": "纸张 +纸张", "width": 103.8, }, Object { - "actualText": "纸张", + "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 20, + "height": 46, "multiLineActualTexts": Array [ - "纸张", + "家具", ], - "originalText": "纸张", + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "纸张", - "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "actualTextHeight": 60, + "actualTextWidth": 340, + "height": 91, "multiLineActualTexts": Array [ - "纸张", + "家具家具家具家", + "具家具家具家具", + "家具家具家具家", + "具家具家具家具", ], - "originalText": "纸张", + "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", "width": 103.8, }, Object { - "actualText": "纸张", + "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 20, + "height": 46, "multiLineActualTexts": Array [ - "纸张", + "家具", ], - "originalText": "纸张", + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, - "height": 20, + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "2367236723611", - "11", + "家具", ], - "originalText": 236723672361111, + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "7789778977897789778977897789", - "actualTextHeight": 45, - "actualTextWidth": 189, - "height": 20, + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "7789778977897", - "7897789778977", - "89", + "家具", ], - "originalText": "7789778977897789778977897789", + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, - "height": 20, + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "2367236723611", - "11", + "家具", ], - "originalText": 236723672361111, + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "3877", + "actualText": "-", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualTextWidth": 4, + "height": 61, "multiLineActualTexts": Array [ - "3877", + "-", ], - "originalText": 3877, + "originalText": "-", "width": 103.8, }, Object { - "actualText": "4342", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualTextWidth": 25, + "height": 46, "multiLineActualTexts": Array [ - "4342", + "桌子", ], - "originalText": 4342, + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "5343", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "actualTextHeight": 75, + "actualTextWidth": 365, + "height": 91, "multiLineActualTexts": Array [ - "5343", + "桌子桌子桌子桌", + "子桌子桌子桌子", + "桌子桌子桌子桌", + "子桌子桌子桌子", + "桌子", ], - "originalText": 5343, + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", "width": 103.8, }, Object { - "actualText": "632", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 20, + "actualTextWidth": 25, + "height": 46, "multiLineActualTexts": Array [ - "632", + "桌子", ], - "originalText": 632, + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "7234", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "7234", + "桌子", ], - "originalText": 7234, + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "834", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 20, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "834", + "桌子", ], - "originalText": 834, + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "945", + "actualText": "沙发", "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 20, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "945", + "沙发", ], - "originalText": 945, + "originalText": "沙发", "width": 103.8, }, Object { - "actualText": "1304", + "actualText": "-", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualTextWidth": 4, + "height": 61, "multiLineActualTexts": Array [ - "1304", + "-", ], - "originalText": 1304, + "originalText": "-", "width": 103.8, }, Object { - "actualText": "1145", - "actualTextHeight": 15, - "actualTextWidth": 26, - "height": 20, + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 46, "multiLineActualTexts": Array [ - "1145", + "2367236723611", + "11", ], - "originalText": 1145, + "originalText": 236723672361111, "width": 103.8, }, Object { - "actualText": "1432", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualText": "7789778977897789778977897789", + "actualTextHeight": 45, + "actualTextWidth": 189, + "height": 91, "multiLineActualTexts": Array [ - "1432", + "7789778977897", + "7897789778977", + "89", ], - "originalText": 1432, + "originalText": "7789778977897789778977897789", "width": 103.8, }, Object { - "actualText": "1343", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 46, "multiLineActualTexts": Array [ - "1343", + "2367236723611", + "11", ], - "originalText": 1343, + "originalText": 236723672361111, "width": 103.8, }, Object { - "actualText": "1354", + "actualText": "3877", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ - "1354", + "3877", ], - "originalText": 1354, + "originalText": 3877, "width": 103.8, }, Object { - "actualText": "1523", + "actualText": "4342", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ - "1523", + "4342", ], - "originalText": 1523, + "originalText": 4342, "width": 103.8, }, Object { - "actualText": "1634", + "actualText": "5343", "actualTextHeight": 15, "actualTextWidth": 27, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ - "1634", + "5343", ], - "originalText": 1634, + "originalText": 5343, "width": 103.8, }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style less than actual text height by rowCell.heightByField 1`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should render by maxLines if actual text contains "\\n" 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 30, "multiLineActualTexts": Array [ "序号", ], @@ -23172,13 +32891,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style less than actual text height by rowCell.heightByField 2`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should render by maxLines if actual text contains "\\n" 2`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "1", ], @@ -23189,7 +32908,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "2", ], @@ -23200,7 +32919,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "3", ], @@ -23222,7 +32941,7 @@ Array [ "actualText": "5", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ "5", ], @@ -23273,1710 +32992,1462 @@ Array [ "originalText": 9, "width": 80, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style less than actual text height by rowCell.heightByField 3`] = ` -Array [ - Object { - "actualText": "序号", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 56, - "multiLineActualTexts": Array [ - "序号", - ], - "originalText": "序号", - "width": 80, - }, - Object { - "actualText": "省份", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 56, - "multiLineActualTexts": Array [ - "省份", - ], - "originalText": "省份", - "width": 103.8, - }, - Object { - "actualText": "城市城市城市城市城市城市城市城市城市城市...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 56, - "multiLineActualTexts": Array [ - "城市城市城市城", - "市城市城市城市", - "城市城市城市...", - ], - "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "width": 103.8, - }, - Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", - "actualTextHeight": 48, - "actualTextWidth": 243, - "height": 56, - "multiLineActualTexts": Array [ - "类别类别类别类", - "别类别类别类别", - "类别类别类别", - ], - "originalText": "类别类别类别类别类别类别类别类别类别类别", - "width": 103.8, - }, - Object { - "actualText": "子类别", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 56, - "multiLineActualTexts": Array [ - "子类别", - ], - "originalText": "子类别", - "width": 103.8, - }, - Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 56, - "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量...", - ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 103.8, - }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style less than actual text height by rowCell.heightByField 4`] = `Array []`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style less than actual text height by rowCell.heightByField 5`] = ` -Array [ Object { - "actualText": "1", + "actualText": "10", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 46, + "actualTextWidth": 14, + "height": 30, "multiLineActualTexts": Array [ - "1", + "10", ], - "originalText": 1, + "originalText": 10, "width": 80, }, Object { - "actualText": "2", + "actualText": "11", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 20, + "actualTextWidth": 13, + "height": 30, "multiLineActualTexts": Array [ - "2", + "11", ], - "originalText": 2, + "originalText": 11, "width": 80, }, Object { - "actualText": "3", + "actualText": "12", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 46, + "actualTextWidth": 14, + "height": 30, "multiLineActualTexts": Array [ - "3", + "12", ], - "originalText": 3, + "originalText": 12, "width": 80, }, Object { - "actualText": "4", + "actualText": "13", "actualTextHeight": 15, - "actualTextWidth": 7, + "actualTextWidth": 14, "height": 30, "multiLineActualTexts": Array [ - "4", + "13", ], - "originalText": 4, + "originalText": 13, "width": 80, }, Object { - "actualText": "5", + "actualText": "14", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 100, + "actualTextWidth": 14, + "height": 30, "multiLineActualTexts": Array [ - "5", + "14", ], - "originalText": 5, + "originalText": 14, "width": 80, }, Object { - "actualText": "6", + "actualText": "15", "actualTextHeight": 15, - "actualTextWidth": 7, + "actualTextWidth": 14, "height": 30, "multiLineActualTexts": Array [ - "6", + "15", ], - "originalText": 6, + "originalText": 15, "width": 80, }, Object { - "actualText": "7", + "actualText": "16", "actualTextHeight": 15, - "actualTextWidth": 7, + "actualTextWidth": 14, "height": 30, "multiLineActualTexts": Array [ - "7", + "16", ], - "originalText": 7, + "originalText": 16, "width": 80, }, Object { - "actualText": "8", + "actualText": "17", "actualTextHeight": 15, - "actualTextWidth": 7, + "actualTextWidth": 14, "height": 30, "multiLineActualTexts": Array [ - "8", + "17", ], - "originalText": 8, + "originalText": 17, "width": 80, }, Object { - "actualText": "9", + "actualText": "18", "actualTextHeight": 15, - "actualTextWidth": 7, + "actualTextWidth": 14, "height": 30, "multiLineActualTexts": Array [ - "9", + "18", ], - "originalText": 9, + "originalText": 18, "width": 80, }, Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 46, - "multiLineActualTexts": Array [ - "浙江省", - ], - "originalText": "浙江省", - "width": 103.8, - }, - Object { - "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 20, - "multiLineActualTexts": Array [ - "浙江省浙江省浙", - "江省浙江省浙江", - "省浙江省浙江...", - ], - "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", - "width": 103.8, - }, - Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 46, - "multiLineActualTexts": Array [ - "浙江省", - ], - "originalText": "浙江省", - "width": 103.8, - }, - Object { - "actualText": "浙江省", + "actualText": "19", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 14, "height": 30, "multiLineActualTexts": Array [ - "浙江省", - ], - "originalText": "浙江省", - "width": 103.8, - }, - Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 100, - "multiLineActualTexts": Array [ - "浙江省", + "19", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": 19, + "width": 80, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should render by maxLines if actual text contains "\\n" 3`] = ` +Array [ Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "序号", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": "序号", + "width": 80, }, Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "省份", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": "省份", + "width": 143.8, }, Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, + "actualText": "城市城市城市城市城...", + "actualTextHeight": 16, + "actualTextWidth": 119, "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "城市城市城市城市城...", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "width": 143.8, }, Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, + "actualText": "类别类别类别类别类...", + "actualTextHeight": 16, + "actualTextWidth": 119, "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "类别类别类别类别类...", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": "类别类别类别类别类别类别类别类别类别类别", + "width": 143.8, }, Object { - "actualText": "绍兴市", - "actualTextHeight": 15, + "actualText": "子类别", + "actualTextHeight": 16, "actualTextWidth": 37, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ - "绍兴市", + "子类别", ], - "originalText": "绍兴市", - "width": 103.8, + "originalText": "子类别", + "width": 143.8, }, Object { - "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 20, + "actualText": "数量数量数量数量数...", + "actualTextHeight": 16, + "actualTextWidth": 119, + "height": 30, "multiLineActualTexts": Array [ - "杭州市杭州市杭", - "州市杭州市杭州", - "市杭州市杭州...", + "数量数量数量数量数...", ], - "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", - "width": 103.8, + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 143.8, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should render by maxLines if actual text contains "\\n" 4`] = `Array []`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should render by maxLines if actual text contains "\\n" 5`] = ` +Array [ Object { - "actualText": "绍兴市", + "actualText": "1", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 46, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "绍兴市", + "1", ], - "originalText": "绍兴市", - "width": 103.8, + "originalText": 1, + "width": 80, }, Object { - "actualText": "宁波市", + "actualText": "2", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "宁波市", + "2", ], - "originalText": "宁波市", - "width": 103.8, + "originalText": 2, + "width": 80, }, Object { - "actualText": "舟山市", + "actualText": "3", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 100, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "舟山市", + "3", ], - "originalText": "舟山市", - "width": 103.8, + "originalText": 3, + "width": 80, }, Object { - "actualText": "杭州市", + "actualText": "4", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "杭州市", + "4", ], - "originalText": "杭州市", - "width": 103.8, + "originalText": 4, + "width": 80, }, Object { - "actualText": "绍兴市", + "actualText": "5", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "绍兴市", + "5", ], - "originalText": "绍兴市", - "width": 103.8, + "originalText": 5, + "width": 80, }, Object { - "actualText": "宁波市", + "actualText": "6", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "宁波市", + "6", ], - "originalText": "宁波市", - "width": 103.8, + "originalText": 6, + "width": 80, }, Object { - "actualText": "舟山市", + "actualText": "7", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "舟山市", + "7", ], - "originalText": "舟山市", - "width": 103.8, + "originalText": 7, + "width": 80, }, Object { - "actualText": "家具", + "actualText": "8", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 46, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "家具", + "8", ], - "originalText": "家具", - "width": 103.8, + "originalText": 8, + "width": 80, }, Object { - "actualText": "家具家具家具家具家具家具家具家具家具家具...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 20, + "actualText": "9", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "家具家具家具家", - "具家具家具家具", - "家具家具家具...", + "9", ], - "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "width": 103.8, + "originalText": 9, + "width": 80, }, Object { - "actualText": "家具", + "actualText": "10", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 46, + "actualTextWidth": 14, + "height": 30, "multiLineActualTexts": Array [ - "家具", + "10", ], - "originalText": "家具", - "width": 103.8, + "originalText": 10, + "width": 80, }, Object { - "actualText": "家具", + "actualText": "11", "actualTextHeight": 15, - "actualTextWidth": 25, + "actualTextWidth": 13, "height": 30, "multiLineActualTexts": Array [ - "家具", + "11", ], - "originalText": "家具", - "width": 103.8, + "originalText": 11, + "width": 80, }, Object { - "actualText": "家具", + "actualText": "12", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 100, + "actualTextWidth": 14, + "height": 30, "multiLineActualTexts": Array [ - "家具", + "12", ], - "originalText": "家具", - "width": 103.8, + "originalText": 12, + "width": 80, }, Object { - "actualText": "家具", + "actualText": "13", "actualTextHeight": 15, - "actualTextWidth": 25, + "actualTextWidth": 14, "height": 30, "multiLineActualTexts": Array [ - "家具", + "13", ], - "originalText": "家具", - "width": 103.8, + "originalText": 13, + "width": 80, }, Object { - "actualText": "家具", + "actualText": "14", "actualTextHeight": 15, - "actualTextWidth": 25, + "actualTextWidth": 14, "height": 30, "multiLineActualTexts": Array [ - "家具", + "14", ], - "originalText": "家具", - "width": 103.8, + "originalText": 14, + "width": 80, }, Object { - "actualText": "家具", + "actualText": "15", "actualTextHeight": 15, - "actualTextWidth": 25, + "actualTextWidth": 14, "height": 30, "multiLineActualTexts": Array [ - "家具", + "15", ], - "originalText": "家具", - "width": 103.8, + "originalText": 15, + "width": 80, }, Object { - "actualText": "家具", + "actualText": "16", "actualTextHeight": 15, - "actualTextWidth": 25, + "actualTextWidth": 14, "height": 30, "multiLineActualTexts": Array [ - "家具", + "16", ], - "originalText": "家具", - "width": 103.8, + "originalText": 16, + "width": 80, }, Object { - "actualText": "桌子", + "actualText": "17", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 46, + "actualTextWidth": 14, + "height": 30, "multiLineActualTexts": Array [ - "桌子", + "17", ], - "originalText": "桌子", - "width": 103.8, + "originalText": 17, + "width": 80, }, Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 20, + "actualText": "18", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, "multiLineActualTexts": Array [ - "桌子桌子桌子桌", - "子桌子桌子桌子", - "桌子桌子桌子...", + "18", ], - "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", - "width": 103.8, + "originalText": 18, + "width": 80, }, Object { - "actualText": "桌子", + "actualText": "19", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 46, + "actualTextWidth": 14, + "height": 30, "multiLineActualTexts": Array [ - "桌子", + "19", ], - "originalText": "桌子", - "width": 103.8, + "originalText": 19, + "width": 80, }, Object { - "actualText": "桌子", + "actualText": "浙江...", "actualTextHeight": 15, - "actualTextWidth": 25, + "actualTextWidth": 35, "height": 30, "multiLineActualTexts": Array [ - "桌子", + "浙江...", ], - "originalText": "桌子", - "width": 103.8, + "originalText": "浙江 +浙江", + "width": 143.8, }, Object { - "actualText": "桌子", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 100, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "桌子", + "浙江省", ], - "originalText": "桌子", - "width": 103.8, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "沙发", + "actualText": "浙江省浙江省浙江省...", "actualTextHeight": 15, - "actualTextWidth": 25, + "actualTextWidth": 119, "height": 30, "multiLineActualTexts": Array [ - "沙发", + "浙江省浙江省浙江省...", ], - "originalText": "沙发", - "width": 103.8, + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "width": 143.8, }, Object { - "actualText": "沙发", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 25, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "沙发", + "浙江省", ], - "originalText": "沙发", - "width": 103.8, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "沙发", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 25, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "沙发", + "浙江省", ], - "originalText": "沙发", - "width": 103.8, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "沙发", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 25, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "沙发", + "浙江省", ], - "originalText": "沙发", - "width": 103.8, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, - "height": 46, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "2367236723611", - "11", + "浙江省", ], - "originalText": 236723672361111, - "width": 103.8, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "7789778977897789778977897789", - "actualTextHeight": 45, - "actualTextWidth": 189, - "height": 20, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "7789778977897", - "7897789778977", - "89", + "浙江省", ], - "originalText": "7789778977897789778977897789", - "width": 103.8, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, - "height": 46, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "2367236723611", - "11", + "浙江省", ], - "originalText": 236723672361111, - "width": 103.8, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "3877", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "3877", + "浙江省", ], - "originalText": 3877, - "width": 103.8, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "4342", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 100, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "4342", + "浙江省", ], - "originalText": 4342, - "width": 103.8, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "5343", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "5343", + "浙江省", ], - "originalText": 5343, - "width": 103.8, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "632", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 21, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "632", + "浙江省", ], - "originalText": 632, - "width": 103.8, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "7234", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "7234", + "浙江省", ], - "originalText": 7234, - "width": 103.8, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "834", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 21, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "834", + "浙江省", ], - "originalText": 834, - "width": 103.8, + "originalText": "浙江省", + "width": 143.8, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style more than actual text height by rowCell.height 1`] = ` -Array [ Object { - "actualText": "序号", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 56, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "序号", + "浙江省", ], - "originalText": "序号", - "width": 80, + "originalText": "浙江省", + "width": 143.8, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style more than actual text height by rowCell.height 2`] = ` -Array [ Object { - "actualText": "1", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 100, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "1", + "浙江省", ], - "originalText": 1, - "width": 80, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "2", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 100, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "2", + "浙江省", ], - "originalText": 2, - "width": 80, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "3", + "actualText": "四川省", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 100, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "3", + "四川省", ], - "originalText": 3, - "width": 80, + "originalText": "四川省", + "width": 143.8, }, Object { - "actualText": "4", + "actualText": "杭州...", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 100, + "actualTextWidth": 35, + "height": 30, "multiLineActualTexts": Array [ - "4", + "杭州...", ], - "originalText": 4, - "width": 80, + "originalText": "杭州 +杭州 +杭州", + "width": 143.8, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style more than actual text height by rowCell.height 3`] = ` -Array [ Object { - "actualText": "序号", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 56, + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "序号", + "绍兴市", ], - "originalText": "序号", - "width": 80, + "originalText": "绍兴市", + "width": 143.8, }, Object { - "actualText": "省份", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 56, + "actualText": "杭州市杭州市杭州市...", + "actualTextHeight": 15, + "actualTextWidth": 119, + "height": 30, "multiLineActualTexts": Array [ - "省份", + "杭州市杭州市杭州市...", ], - "originalText": "省份", - "width": 103.8, + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "width": 143.8, }, Object { - "actualText": "城市城市城市城市城市城市城市城市城市城市...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 56, + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "城市城市城市城", - "市城市城市城市", - "城市城市城市...", + "绍兴市", ], - "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "width": 103.8, + "originalText": "绍兴市", + "width": 143.8, }, Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", - "actualTextHeight": 48, - "actualTextWidth": 243, - "height": 56, + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "类别类别类别类", - "别类别类别类别", - "类别类别类别", + "宁波市", ], - "originalText": "类别类别类别类别类别类别类别类别类别类别", - "width": 103.8, + "originalText": "宁波市", + "width": 143.8, }, Object { - "actualText": "子类别", - "actualTextHeight": 16, + "actualText": "舟山市", + "actualTextHeight": 15, "actualTextWidth": 37, - "height": 56, + "height": 30, "multiLineActualTexts": Array [ - "子类别", + "舟山市", ], - "originalText": "子类别", - "width": 103.8, + "originalText": "舟山市", + "width": 143.8, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 56, + "actualText": "杭州市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量...", + "杭州市", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 103.8, + "originalText": "杭州市", + "width": 143.8, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style more than actual text height by rowCell.height 4`] = `Array []`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style more than actual text height by rowCell.height 5`] = ` -Array [ Object { - "actualText": "1", + "actualText": "绍兴市", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 100, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "1", + "绍兴市", ], - "originalText": 1, - "width": 80, + "originalText": "绍兴市", + "width": 143.8, }, Object { - "actualText": "2", + "actualText": "宁波市", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 100, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "2", + "宁波市", ], - "originalText": 2, - "width": 80, + "originalText": "宁波市", + "width": 143.8, }, Object { - "actualText": "3", + "actualText": "舟山市", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 100, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "3", + "舟山市", ], - "originalText": 3, - "width": 80, + "originalText": "舟山市", + "width": 143.8, }, Object { - "actualText": "4", + "actualText": "杭州市", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 100, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "4", + "杭州市", ], - "originalText": 4, - "width": 80, + "originalText": "杭州市", + "width": 143.8, }, Object { - "actualText": "浙江省", + "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "绍兴市", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": "绍兴市", + "width": 143.8, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 100, + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "浙江省浙江省浙", - "江省浙江省浙江", - "省浙江省浙江...", + "宁波市", ], - "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", - "width": 103.8, + "originalText": "宁波市", + "width": 143.8, }, Object { - "actualText": "浙江省", + "actualText": "舟山市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "舟山市", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": "舟山市", + "width": 143.8, }, Object { - "actualText": "浙江省", + "actualText": "杭州市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "杭州市", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": "杭州市", + "width": 143.8, }, Object { "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ "绍兴市", ], "originalText": "绍兴市", - "width": 103.8, + "width": 143.8, }, Object { - "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 100, + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "杭州市杭州市杭", - "州市杭州市杭州", - "市杭州市杭州...", + "宁波市", ], - "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", - "width": 103.8, + "originalText": "宁波市", + "width": 143.8, }, Object { - "actualText": "绍兴市", + "actualText": "舟山市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ - "绍兴市", + "舟山市", ], - "originalText": "绍兴市", - "width": 103.8, + "originalText": "舟山市", + "width": 143.8, }, Object { - "actualText": "宁波市", + "actualText": "成都市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ - "宁波市", + "成都市", ], - "originalText": "宁波市", - "width": 103.8, + "originalText": "成都市", + "width": 143.8, + }, + Object { + "actualText": "纸张...", + "actualTextHeight": 15, + "actualTextWidth": 35, + "height": 30, + "multiLineActualTexts": Array [ + "纸张...", + ], + "originalText": "纸张 +纸张", + "width": 143.8, }, Object { "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ "家具", ], "originalText": "家具", - "width": 103.8, + "width": 143.8, }, Object { - "actualText": "家具家具家具家具家具家具家具家具家具家具...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 100, + "actualText": "家具家具家具家具家...", + "actualTextHeight": 15, + "actualTextWidth": 119, + "height": 30, "multiLineActualTexts": Array [ - "家具家具家具家", - "具家具家具家具", - "家具家具家具...", + "家具家具家具家具家...", ], "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ "家具", ], "originalText": "家具", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ "家具", ], "originalText": "家具", - "width": 103.8, + "width": 143.8, }, Object { - "actualText": "桌子", + "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 100, - "multiLineActualTexts": Array [ - "桌子", - ], - "originalText": "桌子", - "width": 103.8, - }, - Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ - "桌子桌子桌子桌", - "子桌子桌子桌子", - "桌子桌子桌子...", + "家具", ], - "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", - "width": 103.8, + "originalText": "家具", + "width": 143.8, }, Object { - "actualText": "桌子", + "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ - "桌子", + "家具", ], - "originalText": "桌子", - "width": 103.8, + "originalText": "家具", + "width": 143.8, }, Object { - "actualText": "桌子", + "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 100, - "multiLineActualTexts": Array [ - "桌子", - ], - "originalText": "桌子", - "width": 103.8, - }, - Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, - "height": 100, - "multiLineActualTexts": Array [ - "2367236723611", - "11", - ], - "originalText": 236723672361111, - "width": 103.8, - }, - Object { - "actualText": "7789778977897789778977897789", - "actualTextHeight": 45, - "actualTextWidth": 189, - "height": 100, - "multiLineActualTexts": Array [ - "7789778977897", - "7897789778977", - "89", - ], - "originalText": "7789778977897789778977897789", - "width": 103.8, - }, - Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ - "2367236723611", - "11", + "家具", ], - "originalText": 236723672361111, - "width": 103.8, + "originalText": "家具", + "width": 143.8, }, Object { - "actualText": "3877", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 100, - "multiLineActualTexts": Array [ - "3877", - ], - "originalText": 3877, - "width": 103.8, - }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style more than actual text height by rowCell.heightByField 1`] = ` -Array [ - Object { - "actualText": "序号", - "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 30, "multiLineActualTexts": Array [ - "序号", + "家具", ], - "originalText": "序号", - "width": 80, + "originalText": "家具", + "width": 143.8, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style more than actual text height by rowCell.heightByField 2`] = ` -Array [ Object { - "actualText": "1", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 100, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "1", + "家具", ], - "originalText": 1, - "width": 80, + "originalText": "家具", + "width": 143.8, }, Object { - "actualText": "2", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 100, + "actualTextWidth": 49, + "height": 30, "multiLineActualTexts": Array [ - "2", + "办公用品", ], - "originalText": 2, - "width": 80, + "originalText": "办公用品", + "width": 143.8, }, Object { - "actualText": "3", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 46, + "actualTextWidth": 49, + "height": 30, "multiLineActualTexts": Array [ - "3", + "办公用品", ], - "originalText": 3, - "width": 80, + "originalText": "办公用品", + "width": 143.8, }, Object { - "actualText": "4", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 7, + "actualTextWidth": 49, "height": 30, "multiLineActualTexts": Array [ - "4", + "办公用品", ], - "originalText": 4, - "width": 80, + "originalText": "办公用品", + "width": 143.8, }, Object { - "actualText": "5", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 7, + "actualTextWidth": 49, "height": 30, "multiLineActualTexts": Array [ - "5", + "办公用品", ], - "originalText": 5, - "width": 80, + "originalText": "办公用品", + "width": 143.8, }, Object { - "actualText": "6", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 7, + "actualTextWidth": 49, "height": 30, "multiLineActualTexts": Array [ - "6", + "办公用品", ], - "originalText": 6, - "width": 80, + "originalText": "办公用品", + "width": 143.8, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style more than actual text height by rowCell.heightByField 3`] = ` -Array [ Object { - "actualText": "序号", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 56, + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 30, "multiLineActualTexts": Array [ - "序号", + "办公用品", ], - "originalText": "序号", - "width": 80, + "originalText": "办公用品", + "width": 143.8, }, Object { - "actualText": "省份", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 56, + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 30, "multiLineActualTexts": Array [ - "省份", + "办公用品", ], - "originalText": "省份", - "width": 103.8, + "originalText": "办公用品", + "width": 143.8, }, Object { - "actualText": "城市城市城市城市城市城市城市城市城市城市...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 56, + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 30, "multiLineActualTexts": Array [ - "城市城市城市城", - "市城市城市城市", - "城市城市城市...", + "办公用品", ], - "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "width": 103.8, + "originalText": "办公用品", + "width": 143.8, }, Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", - "actualTextHeight": 48, - "actualTextWidth": 243, - "height": 56, + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "类别类别类别类", - "别类别类别类别", - "类别类别类别", + "家具", ], - "originalText": "类别类别类别类别类别类别类别类别类别类别", - "width": 103.8, + "originalText": "家具", + "width": 143.8, }, Object { - "actualText": "子类别", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 56, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "子类别", + "-", ], - "originalText": "子类别", - "width": 103.8, + "originalText": "-", + "width": 143.8, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 56, + "actualText": "桌子", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量...", + "桌子", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 103.8, + "originalText": "桌子", + "width": 143.8, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style more than actual text height by rowCell.heightByField 4`] = `Array []`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should not force adaptive adjust row height if custom cell style more than actual text height by rowCell.heightByField 5`] = ` -Array [ Object { - "actualText": "1", + "actualText": "桌子桌子桌子桌子桌...", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 100, + "actualTextWidth": 119, + "height": 30, "multiLineActualTexts": Array [ - "1", + "桌子桌子桌子桌子桌...", ], - "originalText": 1, - "width": 80, + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "width": 143.8, }, Object { - "actualText": "2", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 100, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "2", + "桌子", ], - "originalText": 2, - "width": 80, + "originalText": "桌子", + "width": 143.8, }, Object { - "actualText": "3", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 46, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "3", + "桌子", ], - "originalText": 3, - "width": 80, + "originalText": "桌子", + "width": 143.8, }, Object { - "actualText": "4", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 7, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "4", + "桌子", ], - "originalText": 4, - "width": 80, + "originalText": "桌子", + "width": 143.8, }, Object { - "actualText": "5", + "actualText": "沙发", "actualTextHeight": 15, - "actualTextWidth": 7, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "5", + "沙发", ], - "originalText": 5, - "width": 80, + "originalText": "沙发", + "width": 143.8, }, Object { - "actualText": "6", + "actualText": "沙发", "actualTextHeight": 15, - "actualTextWidth": 7, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "6", + "沙发", ], - "originalText": 6, - "width": 80, + "originalText": "沙发", + "width": 143.8, }, Object { - "actualText": "浙江省", + "actualText": "沙发", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 100, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "沙发", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": "沙发", + "width": 143.8, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 100, + "actualText": "沙发", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "浙江省浙江省浙", - "江省浙江省浙江", - "省浙江省浙江...", + "沙发", ], - "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", - "width": 103.8, + "originalText": "沙发", + "width": 143.8, }, Object { - "actualText": "浙江省", + "actualText": "笔", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 46, + "actualTextWidth": 13, + "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "笔", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": "笔", + "width": 143.8, }, Object { - "actualText": "浙江省", + "actualText": "笔", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 13, "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "笔", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": "笔", + "width": 143.8, }, Object { - "actualText": "浙江省", + "actualText": "笔", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 13, "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "笔", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": "笔", + "width": 143.8, }, Object { - "actualText": "浙江省", + "actualText": "笔", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 13, "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "笔", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": "笔", + "width": 143.8, }, Object { - "actualText": "绍兴市", + "actualText": "纸张", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 100, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "绍兴市", + "纸张", ], - "originalText": "绍兴市", - "width": 103.8, + "originalText": "纸张", + "width": 143.8, }, Object { - "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 100, + "actualText": "纸张", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "杭州市杭州市杭", - "州市杭州市杭州", - "市杭州市杭州...", + "纸张", ], - "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", - "width": 103.8, + "originalText": "纸张", + "width": 143.8, }, Object { - "actualText": "绍兴市", + "actualText": "纸张", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 46, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "绍兴市", + "纸张", ], - "originalText": "绍兴市", - "width": 103.8, + "originalText": "纸张", + "width": 143.8, }, Object { - "actualText": "宁波市", + "actualText": "纸张", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "宁波市", + "纸张", ], - "originalText": "宁波市", - "width": 103.8, + "originalText": "纸张", + "width": 143.8, }, Object { - "actualText": "舟山市", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "舟山市", + "桌子", ], - "originalText": "舟山市", - "width": 103.8, + "originalText": "桌子", + "width": 143.8, }, Object { - "actualText": "杭州市", + "actualText": "-", "actualTextHeight": 15, - "actualTextWidth": 37, + "actualTextWidth": 4, "height": 30, "multiLineActualTexts": Array [ - "杭州市", + "-", ], - "originalText": "杭州市", - "width": 103.8, + "originalText": "-", + "width": 143.8, }, Object { - "actualText": "家具", + "actualText": "236723672361111", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 100, + "actualTextWidth": 98, + "height": 30, "multiLineActualTexts": Array [ - "家具", + "236723672361111", ], - "originalText": "家具", - "width": 103.8, + "originalText": 236723672361111, + "width": 143.8, }, Object { - "actualText": "家具家具家具家具家具家具家具家具家具家具...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 100, + "actualText": "77897789778977897...", + "actualTextHeight": 15, + "actualTextWidth": 124, + "height": 30, "multiLineActualTexts": Array [ - "家具家具家具家", - "具家具家具家具", - "家具家具家具...", + "77897789778977897...", ], - "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "width": 103.8, + "originalText": "7789778977897789778977897789", + "width": 143.8, }, Object { - "actualText": "家具", + "actualText": "236723672361111", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 46, + "actualTextWidth": 98, + "height": 30, "multiLineActualTexts": Array [ - "家具", + "236723672361111", ], - "originalText": "家具", - "width": 103.8, + "originalText": 236723672361111, + "width": 143.8, }, Object { - "actualText": "家具", + "actualText": "3877", "actualTextHeight": 15, - "actualTextWidth": 25, + "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "家具", + "3877", ], - "originalText": "家具", - "width": 103.8, + "originalText": 3877, + "width": 143.8, }, Object { - "actualText": "家具", + "actualText": "4342", "actualTextHeight": 15, - "actualTextWidth": 25, + "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "家具", + "4342", ], - "originalText": "家具", - "width": 103.8, + "originalText": 4342, + "width": 143.8, }, Object { - "actualText": "家具", + "actualText": "5343", "actualTextHeight": 15, - "actualTextWidth": 25, + "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "家具", + "5343", ], - "originalText": "家具", - "width": 103.8, + "originalText": 5343, + "width": 143.8, }, Object { - "actualText": "桌子", + "actualText": "632", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 100, + "actualTextWidth": 21, + "height": 30, "multiLineActualTexts": Array [ - "桌子", + "632", ], - "originalText": "桌子", - "width": 103.8, + "originalText": 632, + "width": 143.8, }, Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 100, + "actualText": "7234", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "桌子桌子桌子桌", - "子桌子桌子桌子", - "桌子桌子桌子...", + "7234", ], - "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", - "width": 103.8, + "originalText": 7234, + "width": 143.8, }, Object { - "actualText": "桌子", + "actualText": "834", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 46, + "actualTextWidth": 21, + "height": 30, "multiLineActualTexts": Array [ - "桌子", + "834", ], - "originalText": "桌子", - "width": 103.8, + "originalText": 834, + "width": 143.8, }, Object { - "actualText": "桌子", + "actualText": "945", "actualTextHeight": 15, - "actualTextWidth": 25, + "actualTextWidth": 21, "height": 30, "multiLineActualTexts": Array [ - "桌子", + "945", ], - "originalText": "桌子", - "width": 103.8, + "originalText": 945, + "width": 143.8, }, Object { - "actualText": "桌子", + "actualText": "1304", "actualTextHeight": 15, - "actualTextWidth": 25, + "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "桌子", + "1304", ], - "originalText": "桌子", - "width": 103.8, + "originalText": 1304, + "width": 143.8, }, Object { - "actualText": "沙发", + "actualText": "1145", "actualTextHeight": 15, - "actualTextWidth": 25, + "actualTextWidth": 26, "height": 30, "multiLineActualTexts": Array [ - "沙发", + "1145", ], - "originalText": "沙发", - "width": 103.8, + "originalText": 1145, + "width": 143.8, }, Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, - "height": 100, + "actualText": "1432", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "2367236723611", - "11", + "1432", ], - "originalText": 236723672361111, - "width": 103.8, + "originalText": 1432, + "width": 143.8, }, Object { - "actualText": "7789778977897789778977897789", - "actualTextHeight": 45, - "actualTextWidth": 189, - "height": 100, + "actualText": "1343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "7789778977897", - "7897789778977", - "89", + "1343", ], - "originalText": "7789778977897789778977897789", - "width": 103.8, + "originalText": 1343, + "width": 143.8, }, Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, - "height": 46, + "actualText": "1354", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "2367236723611", - "11", + "1354", ], - "originalText": 236723672361111, - "width": 103.8, + "originalText": 1354, + "width": 143.8, }, Object { - "actualText": "3877", + "actualText": "1523", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "3877", + "1523", ], - "originalText": 3877, - "width": 103.8, + "originalText": 1523, + "width": 143.8, }, Object { - "actualText": "4342", + "actualText": "1634", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "4342", + "1634", ], - "originalText": 4342, - "width": 103.8, + "originalText": 1634, + "width": 143.8, }, Object { - "actualText": "5343", + "actualText": "1723", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "5343", + "1723", ], - "originalText": 5343, - "width": 103.8, + "originalText": 1723, + "width": 143.8, }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not render word wrap text 1`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should render by maxLinesByField 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 30, + "height": 64, "multiLineActualTexts": Array [ "序号", ], @@ -24986,7 +34457,7 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not render word wrap text 2`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should render by maxLinesByField 2`] = ` Array [ Object { "actualText": "1", @@ -25003,7 +34474,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 61, "multiLineActualTexts": Array [ "2", ], @@ -25131,16 +34602,60 @@ Array [ "originalText": 13, "width": 80, }, + Object { + "actualText": "14", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "14", + ], + "originalText": 14, + "width": 80, + }, + Object { + "actualText": "15", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "15", + ], + "originalText": 15, + "width": 80, + }, + Object { + "actualText": "16", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "16", + ], + "originalText": 16, + "width": 80, + }, + Object { + "actualText": "17", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "17", + ], + "originalText": 17, + "width": 80, + }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not render word wrap text 3`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should render by maxLinesByField 3`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 30, + "height": 64, "multiLineActualTexts": Array [ "序号", ], @@ -25151,63 +34666,68 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 30, + "height": 64, "multiLineActualTexts": Array [ "省份", ], "originalText": "省份", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "actualTextHeight": 16, - "actualTextWidth": 289, - "height": 30, + "actualTextHeight": 48, + "actualTextWidth": 291, + "height": 64, "multiLineActualTexts": Array [ - "城市城市城市城市城市城市城市城市城市城市城市城市", + "城市城市城市城市城市", + "城市城市城市城市城市", + "城市城市", ], "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "类别类别类别类别类别类别类别类别类别类别", - "actualTextHeight": 16, - "actualTextWidth": 241, - "height": 30, + "actualTextHeight": 32, + "actualTextWidth": 242, + "height": 64, "multiLineActualTexts": Array [ - "类别类别类别类别类别类别类别类别类别类别", + "类别类别类别类别类别", + "类别类别类别类别类别", ], "originalText": "类别类别类别类别类别类别类别类别类别类别", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 30, + "height": 64, "multiLineActualTexts": Array [ "子类别", ], "originalText": "子类别", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "数量数量数量数量数量数量数量数量数量数量数量", - "actualTextHeight": 16, - "actualTextWidth": 265, - "height": 30, + "actualTextHeight": 48, + "actualTextWidth": 267, + "height": 64, "multiLineActualTexts": Array [ - "数量数量数量数量数量数量数量数量数量数量数量", + "数量数量数量数量数量", + "数量数量数量数量数量", + "数量", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 103.8, + "width": 143.8, }, ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not render word wrap text 4`] = `Array []`; +exports[`SpreadSheet Multi Line Text Tests TableSheet should render by maxLinesByField 4`] = `Array []`; -exports[`SpreadSheet Multi Line Text Tests TableSheet should not render word wrap text 5`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should render by maxLinesByField 5`] = ` Array [ Object { "actualText": "1", @@ -25224,7 +34744,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 61, "multiLineActualTexts": Array [ "2", ], @@ -25352,6 +34872,50 @@ Array [ "originalText": 13, "width": 80, }, + Object { + "actualText": "14", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "14", + ], + "originalText": 14, + "width": 80, + }, + Object { + "actualText": "15", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "15", + ], + "originalText": 15, + "width": 80, + }, + Object { + "actualText": "16", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "16", + ], + "originalText": 16, + "width": 80, + }, + Object { + "actualText": "17", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, + "multiLineActualTexts": Array [ + "17", + ], + "originalText": 17, + "width": 80, + }, Object { "actualText": "浙江省", "actualTextHeight": 15, @@ -25361,18 +34925,96 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 103.8, + "width": 143.8, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙...", + "actualTextHeight": 30, + "actualTextWidth": 240, + "height": 61, + "multiLineActualTexts": Array [ + "浙江省浙江省浙江省浙", + "江省浙江省浙江省浙...", + ], + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "width": 143.8, + }, + Object { + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 361, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "浙江省", ], - "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", - "width": 103.8, + "originalText": "浙江省", + "width": 143.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 143.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 143.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 143.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 143.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 143.8, + }, + Object { + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "浙江省", + ], + "originalText": "浙江省", + "width": 143.8, }, Object { "actualText": "浙江省", @@ -25383,7 +35025,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "浙江省", @@ -25394,7 +35036,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "浙江省", @@ -25405,7 +35047,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "浙江省", @@ -25416,7 +35058,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "浙江省", @@ -25427,7 +35069,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "浙江省", @@ -25438,7 +35080,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "浙江省", @@ -25449,7 +35091,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "浙江省", @@ -25460,62 +35102,74 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 103.8, + "width": 143.8, }, Object { - "actualText": "浙江省", + "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "绍兴市", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": "绍兴市", + "width": 143.8, }, Object { - "actualText": "浙江省", + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭...", + "actualTextHeight": 30, + "actualTextWidth": 240, + "height": 61, + "multiLineActualTexts": Array [ + "杭州市杭州市杭州市杭", + "州市杭州市杭州市杭...", + ], + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "width": 143.8, + }, + Object { + "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "绍兴市", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": "绍兴市", + "width": 143.8, }, Object { - "actualText": "浙江省", + "actualText": "宁波市", "actualTextHeight": 15, "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "宁波市", ], - "originalText": "浙江省", - "width": 103.8, + "originalText": "宁波市", + "width": 143.8, }, Object { - "actualText": "绍兴市", + "actualText": "舟山市", "actualTextHeight": 15, "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "绍兴市", + "舟山市", ], - "originalText": "绍兴市", - "width": 103.8, + "originalText": "舟山市", + "width": 143.8, }, Object { - "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "actualText": "杭州市", "actualTextHeight": 15, - "actualTextWidth": 361, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "杭州市", ], - "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", - "width": 103.8, + "originalText": "杭州市", + "width": 143.8, }, Object { "actualText": "绍兴市", @@ -25526,7 +35180,7 @@ Array [ "绍兴市", ], "originalText": "绍兴市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "宁波市", @@ -25537,7 +35191,7 @@ Array [ "宁波市", ], "originalText": "宁波市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "舟山市", @@ -25548,7 +35202,7 @@ Array [ "舟山市", ], "originalText": "舟山市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "杭州市", @@ -25559,7 +35213,7 @@ Array [ "杭州市", ], "originalText": "杭州市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "绍兴市", @@ -25570,7 +35224,7 @@ Array [ "绍兴市", ], "originalText": "绍兴市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "宁波市", @@ -25581,7 +35235,7 @@ Array [ "宁波市", ], "originalText": "宁波市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "舟山市", @@ -25592,7 +35246,7 @@ Array [ "舟山市", ], "originalText": "舟山市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "杭州市", @@ -25603,7 +35257,7 @@ Array [ "杭州市", ], "originalText": "杭州市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "绍兴市", @@ -25614,7 +35268,7 @@ Array [ "绍兴市", ], "originalText": "绍兴市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "宁波市", @@ -25625,7 +35279,7 @@ Array [ "宁波市", ], "originalText": "宁波市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "舟山市", @@ -25636,7 +35290,7 @@ Array [ "舟山市", ], "originalText": "舟山市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "家具", @@ -25647,18 +35301,19 @@ Array [ "家具", ], "originalText": "家具", - "width": 103.8, + "width": 143.8, }, Object { - "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "actualTextHeight": 15, - "actualTextWidth": 337, - "height": 30, + "actualText": "家具家具家具家具家具家具家具家具家具家...", + "actualTextHeight": 30, + "actualTextWidth": 240, + "height": 61, "multiLineActualTexts": Array [ - "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "家具家具家具家具家具", + "家具家具家具家具家...", ], "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "家具", @@ -25669,7 +35324,7 @@ Array [ "家具", ], "originalText": "家具", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "家具", @@ -25680,7 +35335,7 @@ Array [ "家具", ], "originalText": "家具", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "家具", @@ -25691,7 +35346,7 @@ Array [ "家具", ], "originalText": "家具", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "家具", @@ -25702,7 +35357,7 @@ Array [ "家具", ], "originalText": "家具", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "家具", @@ -25713,7 +35368,7 @@ Array [ "家具", ], "originalText": "家具", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "家具", @@ -25724,7 +35379,7 @@ Array [ "家具", ], "originalText": "家具", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "家具", @@ -25735,7 +35390,7 @@ Array [ "家具", ], "originalText": "家具", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "办公用品", @@ -25746,7 +35401,7 @@ Array [ "办公用品", ], "originalText": "办公用品", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "办公用品", @@ -25757,7 +35412,7 @@ Array [ "办公用品", ], "originalText": "办公用品", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "办公用品", @@ -25768,7 +35423,7 @@ Array [ "办公用品", ], "originalText": "办公用品", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "办公用品", @@ -25779,7 +35434,51 @@ Array [ "办公用品", ], "originalText": "办公用品", - "width": 103.8, + "width": 143.8, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 30, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 143.8, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 30, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 143.8, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 30, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 143.8, + }, + Object { + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, + "height": 30, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 143.8, }, Object { "actualText": "桌子", @@ -25790,18 +35489,19 @@ Array [ "桌子", ], "originalText": "桌子", - "width": 103.8, + "width": 143.8, }, Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", - "actualTextHeight": 15, - "actualTextWidth": 361, - "height": 30, + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌...", + "actualTextHeight": 30, + "actualTextWidth": 240, + "height": 61, "multiLineActualTexts": Array [ - "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "桌子桌子桌子桌子桌子", + "桌子桌子桌子桌子桌...", ], "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "桌子", @@ -25812,7 +35512,7 @@ Array [ "桌子", ], "originalText": "桌子", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "桌子", @@ -25823,7 +35523,7 @@ Array [ "桌子", ], "originalText": "桌子", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "桌子", @@ -25834,7 +35534,7 @@ Array [ "桌子", ], "originalText": "桌子", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "沙发", @@ -25845,7 +35545,7 @@ Array [ "沙发", ], "originalText": "沙发", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "沙发", @@ -25856,7 +35556,7 @@ Array [ "沙发", ], "originalText": "沙发", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "沙发", @@ -25867,7 +35567,7 @@ Array [ "沙发", ], "originalText": "沙发", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "沙发", @@ -25878,7 +35578,7 @@ Array [ "沙发", ], "originalText": "沙发", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "笔", @@ -25889,7 +35589,7 @@ Array [ "笔", ], "originalText": "笔", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "笔", @@ -25900,7 +35600,7 @@ Array [ "笔", ], "originalText": "笔", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "笔", @@ -25911,7 +35611,7 @@ Array [ "笔", ], "originalText": "笔", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "笔", @@ -25922,7 +35622,51 @@ Array [ "笔", ], "originalText": "笔", - "width": 103.8, + "width": 143.8, + }, + Object { + "actualText": "纸张", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "纸张", + ], + "originalText": "纸张", + "width": 143.8, + }, + Object { + "actualText": "纸张", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "纸张", + ], + "originalText": "纸张", + "width": 143.8, + }, + Object { + "actualText": "纸张", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "纸张", + ], + "originalText": "纸张", + "width": 143.8, + }, + Object { + "actualText": "纸张", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "纸张", + ], + "originalText": "纸张", + "width": 143.8, }, Object { "actualText": "236723672361111", @@ -25933,18 +35677,19 @@ Array [ "236723672361111", ], "originalText": 236723672361111, - "width": 103.8, + "width": 143.8, }, Object { "actualText": "7789778977897789778977897789", - "actualTextHeight": 15, - "actualTextWidth": 187, - "height": 30, + "actualTextHeight": 30, + "actualTextWidth": 188, + "height": 61, "multiLineActualTexts": Array [ - "7789778977897789778977897789", + "7789778977897789778", + "977897789", ], "originalText": "7789778977897789778977897789", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "236723672361111", @@ -25955,7 +35700,7 @@ Array [ "236723672361111", ], "originalText": 236723672361111, - "width": 103.8, + "width": 143.8, }, Object { "actualText": "3877", @@ -25966,7 +35711,7 @@ Array [ "3877", ], "originalText": 3877, - "width": 103.8, + "width": 143.8, }, Object { "actualText": "4342", @@ -25977,7 +35722,7 @@ Array [ "4342", ], "originalText": 4342, - "width": 103.8, + "width": 143.8, }, Object { "actualText": "5343", @@ -25988,7 +35733,7 @@ Array [ "5343", ], "originalText": 5343, - "width": 103.8, + "width": 143.8, }, Object { "actualText": "632", @@ -25999,7 +35744,7 @@ Array [ "632", ], "originalText": 632, - "width": 103.8, + "width": 143.8, }, Object { "actualText": "7234", @@ -26010,7 +35755,7 @@ Array [ "7234", ], "originalText": 7234, - "width": 103.8, + "width": 143.8, }, Object { "actualText": "834", @@ -26021,7 +35766,7 @@ Array [ "834", ], "originalText": 834, - "width": 103.8, + "width": 143.8, }, Object { "actualText": "945", @@ -26032,7 +35777,7 @@ Array [ "945", ], "originalText": 945, - "width": 103.8, + "width": 143.8, }, Object { "actualText": "1304", @@ -26043,7 +35788,7 @@ Array [ "1304", ], "originalText": 1304, - "width": 103.8, + "width": 143.8, }, Object { "actualText": "1145", @@ -26054,7 +35799,7 @@ Array [ "1145", ], "originalText": 1145, - "width": 103.8, + "width": 143.8, }, Object { "actualText": "1432", @@ -26065,7 +35810,51 @@ Array [ "1432", ], "originalText": 1432, - "width": 103.8, + "width": 143.8, + }, + Object { + "actualText": "1343", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1343", + ], + "originalText": 1343, + "width": 143.8, + }, + Object { + "actualText": "1354", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1354", + ], + "originalText": 1354, + "width": 143.8, + }, + Object { + "actualText": "1523", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1523", + ], + "originalText": 1523, + "width": 143.8, + }, + Object { + "actualText": "1634", + "actualTextHeight": 15, + "actualTextWidth": 27, + "height": 30, + "multiLineActualTexts": Array [ + "1634", + ], + "originalText": 1634, + "width": 143.8, }, ] `; @@ -27176,7 +36965,7 @@ Array [ "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "序号", ], @@ -27287,209 +37076,187 @@ Array [ "originalText": 9, "width": 80, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should render three max text lines 3`] = ` +Array [ Object { - "actualText": "10", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 30, - "multiLineActualTexts": Array [ - "10", - ], - "originalText": 10, - "width": 80, - }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should render three max text lines 3`] = ` -Array [ - Object { - "actualText": "序号", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 56, - "multiLineActualTexts": Array [ - "序号", - ], - "originalText": "序号", - "width": 80, - }, - Object { - "actualText": "省份", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 56, - "multiLineActualTexts": Array [ - "省份", - ], - "originalText": "省份", - "width": 103.8, - }, - Object { - "actualText": "城市城市城市城市城市城市城市城市城市城市...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 56, - "multiLineActualTexts": Array [ - "城市城市城市城", - "市城市城市城市", - "城市城市城市...", - ], - "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "width": 103.8, - }, - Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", - "actualTextHeight": 48, - "actualTextWidth": 243, - "height": 56, - "multiLineActualTexts": Array [ - "类别类别类别类", - "别类别类别类别", - "类别类别类别", - ], - "originalText": "类别类别类别类别类别类别类别类别类别类别", - "width": 103.8, - }, - Object { - "actualText": "子类别", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 56, - "multiLineActualTexts": Array [ - "子类别", - ], - "originalText": "子类别", - "width": 103.8, - }, - Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 56, - "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量...", - ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 103.8, - }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should render three max text lines 4`] = `Array []`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should render three max text lines 5`] = ` -Array [ - Object { - "actualText": "1", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 46, - "multiLineActualTexts": Array [ - "1", - ], - "originalText": 1, - "width": 80, - }, - Object { - "actualText": "2", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 61, - "multiLineActualTexts": Array [ - "2", - ], - "originalText": 2, - "width": 80, - }, - Object { - "actualText": "3", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 46, - "multiLineActualTexts": Array [ - "3", - ], - "originalText": 3, - "width": 80, - }, - Object { - "actualText": "4", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, - "multiLineActualTexts": Array [ - "4", - ], - "originalText": 4, - "width": 80, - }, - Object { - "actualText": "5", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, - "multiLineActualTexts": Array [ - "5", - ], - "originalText": 5, - "width": 80, - }, - Object { - "actualText": "6", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, - "multiLineActualTexts": Array [ - "6", - ], - "originalText": 6, - "width": 80, - }, - Object { - "actualText": "7", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, - "multiLineActualTexts": Array [ - "7", - ], - "originalText": 7, - "width": 80, - }, - Object { - "actualText": "8", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, - "multiLineActualTexts": Array [ - "8", - ], - "originalText": 8, - "width": 80, - }, - Object { - "actualText": "9", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 30, - "multiLineActualTexts": Array [ - "9", - ], - "originalText": 9, - "width": 80, - }, - Object { - "actualText": "10", + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, + "multiLineActualTexts": Array [ + "省份", + ], + "originalText": "省份", + "width": 103.8, + }, + Object { + "actualText": "城市城市城市城市城市城市城市城市城市城市...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 64, + "multiLineActualTexts": Array [ + "城市城市城市城", + "市城市城市城市", + "城市城市城市...", + ], + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "width": 103.8, + }, + Object { + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 48, + "actualTextWidth": 243, + "height": 64, + "multiLineActualTexts": Array [ + "类别类别类别类", + "别类别类别类别", + "类别类别类别", + ], + "originalText": "类别类别类别类别类别类别类别类别类别类别", + "width": 103.8, + }, + Object { + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 64, + "multiLineActualTexts": Array [ + "子类别", + ], + "originalText": "子类别", + "width": 103.8, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 64, + "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", + "数量数量数量...", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 103.8, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should render three max text lines 4`] = `Array []`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should render three max text lines 5`] = ` +Array [ + Object { + "actualText": "1", "actualTextHeight": 15, - "actualTextWidth": 14, + "actualTextWidth": 7, + "height": 46, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": 1, + "width": 80, + }, + Object { + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 61, + "multiLineActualTexts": Array [ + "2", + ], + "originalText": 2, + "width": 80, + }, + Object { + "actualText": "3", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 46, + "multiLineActualTexts": Array [ + "3", + ], + "originalText": 3, + "width": 80, + }, + Object { + "actualText": "4", + "actualTextHeight": 15, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "10", + "4", ], - "originalText": 10, + "originalText": 4, + "width": 80, + }, + Object { + "actualText": "5", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "5", + ], + "originalText": 5, + "width": 80, + }, + Object { + "actualText": "6", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "6", + ], + "originalText": 6, + "width": 80, + }, + Object { + "actualText": "7", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "7", + ], + "originalText": 7, + "width": 80, + }, + Object { + "actualText": "8", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "8", + ], + "originalText": 8, + "width": 80, + }, + Object { + "actualText": "9", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "9", + ], + "originalText": 9, "width": 80, }, Object { @@ -27593,17 +37360,6 @@ Array [ "originalText": "浙江省", "width": 103.8, }, - Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "浙江省", - ], - "originalText": "浙江省", - "width": 103.8, - }, Object { "actualText": "绍兴市", "actualTextHeight": 15, @@ -27705,17 +37461,6 @@ Array [ "originalText": "舟山市", "width": 103.8, }, - Object { - "actualText": "杭州市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "杭州市", - ], - "originalText": "杭州市", - "width": 103.8, - }, Object { "actualText": "家具", "actualTextHeight": 15, @@ -27817,17 +37562,6 @@ Array [ "originalText": "家具", "width": 103.8, }, - Object { - "actualText": "办公用品", - "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 30, - "multiLineActualTexts": Array [ - "办公用品", - ], - "originalText": "办公用品", - "width": 103.8, - }, Object { "actualText": "桌子", "actualTextHeight": 15, @@ -27929,17 +37663,6 @@ Array [ "originalText": "沙发", "width": 103.8, }, - Object { - "actualText": "笔", - "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 30, - "multiLineActualTexts": Array [ - "笔", - ], - "originalText": "笔", - "width": 103.8, - }, Object { "actualText": "236723672361111", "actualTextHeight": 30, @@ -28043,17 +37766,6 @@ Array [ "originalText": 834, "width": 103.8, }, - Object { - "actualText": "945", - "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 30, - "multiLineActualTexts": Array [ - "945", - ], - "originalText": 945, - "width": 103.8, - }, ] `; @@ -28063,7 +37775,7 @@ Array [ "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "序号", ], @@ -28185,17 +37897,6 @@ Array [ "originalText": 10, "width": 80, }, - Object { - "actualText": "11", - "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 30, - "multiLineActualTexts": Array [ - "11", - ], - "originalText": 11, - "width": 80, - }, ] `; @@ -28205,7 +37906,7 @@ Array [ "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "序号", ], @@ -28216,7 +37917,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "省份", ], @@ -28227,7 +37928,7 @@ Array [ "actualText": "城市城市城市城市城市城市城...", "actualTextHeight": 32, "actualTextWidth": 168, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "城市城市城市城", "市城市城市城...", @@ -28239,7 +37940,7 @@ Array [ "actualText": "类别类别类别类别类别类别类...", "actualTextHeight": 32, "actualTextWidth": 168, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "类别类别类别类", "别类别类别类...", @@ -28251,7 +37952,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "子类别", ], @@ -28262,7 +37963,7 @@ Array [ "actualText": "数量数量数量数量数量数量数...", "actualTextHeight": 32, "actualTextWidth": 168, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "数量数量数量数", "量数量数量数...", @@ -28387,17 +38088,6 @@ Array [ "originalText": 10, "width": 80, }, - Object { - "actualText": "11", - "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 30, - "multiLineActualTexts": Array [ - "11", - ], - "originalText": 11, - "width": 80, - }, Object { "actualText": "浙江省", "actualTextHeight": 15, @@ -28509,17 +38199,6 @@ Array [ "originalText": "浙江省", "width": 103.8, }, - Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "浙江省", - ], - "originalText": "浙江省", - "width": 103.8, - }, Object { "actualText": "绍兴市", "actualTextHeight": 15, @@ -28631,17 +38310,6 @@ Array [ "originalText": "杭州市", "width": 103.8, }, - Object { - "actualText": "绍兴市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "绍兴市", - ], - "originalText": "绍兴市", - "width": 103.8, - }, Object { "actualText": "家具", "actualTextHeight": 15, @@ -28753,17 +38421,6 @@ Array [ "originalText": "办公用品", "width": 103.8, }, - Object { - "actualText": "办公用品", - "actualTextHeight": 15, - "actualTextWidth": 49, - "height": 30, - "multiLineActualTexts": Array [ - "办公用品", - ], - "originalText": "办公用品", - "width": 103.8, - }, Object { "actualText": "桌子", "actualTextHeight": 15, @@ -28875,17 +38532,6 @@ Array [ "originalText": "笔", "width": 103.8, }, - Object { - "actualText": "笔", - "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 30, - "multiLineActualTexts": Array [ - "笔", - ], - "originalText": "笔", - "width": 103.8, - }, Object { "actualText": "236723672361111", "actualTextHeight": 30, @@ -28999,17 +38645,6 @@ Array [ "originalText": 945, "width": 103.8, }, - Object { - "actualText": "1304", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, - "multiLineActualTexts": Array [ - "1304", - ], - "originalText": 1304, - "width": 103.8, - }, ] `; @@ -29019,7 +38654,7 @@ Array [ "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "序号", ], @@ -29227,7 +38862,7 @@ Array [ "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "序号", ], @@ -29238,7 +38873,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "省份", ], @@ -29249,7 +38884,7 @@ Array [ "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", "actualTextHeight": 48, "actualTextWidth": 291, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "城市城市城市城市城市", "城市城市城市城市城市", @@ -29262,7 +38897,7 @@ Array [ "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 32, "actualTextWidth": 242, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "类别类别类别类别类别", "类别类别类别类别类别", @@ -29274,7 +38909,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "子类别", ], @@ -29285,7 +38920,7 @@ Array [ "actualText": "数量数量数量数量数量数量数量数量数量数量数量", "actualTextHeight": 48, "actualTextWidth": 267, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "数量数量数量数量数量", "数量数量数量数量数量", @@ -30434,3 +40069,374 @@ Array [ }, ] `; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should use actual text height for large max line by custom col group 1`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 112, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": undefined, + "actualTextHeight": 0, + "actualTextWidth": 0, + "height": 96, + "multiLineActualTexts": Array [], + "originalText": undefined, + "width": 0, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should use actual text height for large max line by custom col group 2`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": 1, + "width": 80, + }, + Object { + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "2", + ], + "originalText": 2, + "width": 80, + }, + Object { + "actualText": "3", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "3", + ], + "originalText": 3, + "width": 80, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should use actual text height for large max line by custom col group 3`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 208, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区", + "actualTextHeight": 80, + "actualTextWidth": 1205, + "height": 96, + "multiLineActualTexts": Array [ + "地区地区地区地区地区地区地区地区地区地区地区", + "地区地区地区地区地区地区地区地区地区地区地区", + "地区地区地区地区地区地区地区地区地区地区地区", + "地区地区地区地区地区地区地区地区地区地区地区", + "地区地区地区地区地区地区", + ], + "originalText": "地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区地区", + "width": 287.6, + }, + Object { + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 112, + "multiLineActualTexts": Array [ + "省份", + ], + "originalText": "省份", + "width": 143.8, + }, + Object { + "actualText": "城市", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 112, + "multiLineActualTexts": Array [ + "城市", + ], + "originalText": "城市", + "width": 143.8, + }, + Object { + "actualText": "类型", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 208, + "multiLineActualTexts": Array [ + "类型", + ], + "originalText": "类型", + "width": 143.8, + }, + Object { + "actualText": "金额金额金额金额金额金额金额金额金额金额金额金额金额金额金额金额金额金额金额金额", + "actualTextHeight": 32, + "actualTextWidth": 482, + "height": 96, + "multiLineActualTexts": Array [ + "金额金额金额金额金额金额金额金额金额金额金额", + "金额金额金额金额金额金额金额金额金额", + ], + "originalText": "金额金额金额金额金额金额金额金额金额金额金额金额金额金额金额金额金额金额金额金额", + "width": 287.6, + }, + Object { + "actualText": "价格", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 112, + "multiLineActualTexts": Array [ + "价格", + ], + "originalText": "价格", + "width": 143.8, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 96, + "actualTextWidth": 726, + "height": 112, + "multiLineActualTexts": Array [ + "数量数量数量数量数量", + "数量数量数量数量数量", + "数量数量数量数量数量", + "数量数量数量数量数量", + "数量数量数量数量数量", + "数量数量数量数量数量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量数量", + "width": 143.8, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should use actual text height for large max line by custom col group 4`] = `Array []`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should use actual text height for large max line by custom col group 5`] = ` +Array [ + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": 1, + "width": 80, + }, + Object { + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "2", + ], + "originalText": 2, + "width": 80, + }, + Object { + "actualText": "3", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "3", + ], + "originalText": 3, + "width": 80, + }, + Object { + "actualText": "浙江", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "浙江", + ], + "originalText": "浙江", + "width": 143.8, + }, + Object { + "actualText": "浙江", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "浙江", + ], + "originalText": "浙江", + "width": 143.8, + }, + Object { + "actualText": "浙江", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "浙江", + ], + "originalText": "浙江", + "width": 143.8, + }, + Object { + "actualText": "义乌", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "义乌", + ], + "originalText": "义乌", + "width": 143.8, + }, + Object { + "actualText": "义乌", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "义乌", + ], + "originalText": "义乌", + "width": 143.8, + }, + Object { + "actualText": "杭州", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, + "multiLineActualTexts": Array [ + "杭州", + ], + "originalText": "杭州", + "width": 143.8, + }, + Object { + "actualText": "笔", + "actualTextHeight": 15, + "actualTextWidth": 13, + "height": 30, + "multiLineActualTexts": Array [ + "笔", + ], + "originalText": "笔", + "width": 143.8, + }, + Object { + "actualText": "笔", + "actualTextHeight": 15, + "actualTextWidth": 13, + "height": 30, + "multiLineActualTexts": Array [ + "笔", + ], + "originalText": "笔", + "width": 143.8, + }, + Object { + "actualText": "笔", + "actualTextHeight": 15, + "actualTextWidth": 13, + "height": 30, + "multiLineActualTexts": Array [ + "笔", + ], + "originalText": "笔", + "width": 143.8, + }, + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": 1, + "width": 143.8, + }, + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": 1, + "width": 143.8, + }, + Object { + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, + "multiLineActualTexts": Array [ + "1", + ], + "originalText": 1, + "width": 143.8, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 143.8, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 143.8, + }, + Object { + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 143.8, + }, +] +`; diff --git a/packages/s2-core/__tests__/spreadsheet/__snapshots__/pivot-chart-sheet-spec.ts.snap b/packages/s2-core/__tests__/spreadsheet/__snapshots__/pivot-chart-sheet-spec.ts.snap new file mode 100644 index 0000000000..aea0a56eb7 --- /dev/null +++ b/packages/s2-core/__tests__/spreadsheet/__snapshots__/pivot-chart-sheet-spec.ts.snap @@ -0,0 +1,153 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Pivot Chart Tests frozen should render pivot chart with frozen 1`] = ` +Array [ + Object { + "height": 50, + "id": "root[&]总计", + "width": 200, + "x": 0, + "y": 0, + }, +] +`; + +exports[`Pivot Chart Tests frozen should render pivot chart with frozen 2`] = ` +Array [ + Object { + "height": 250, + "id": "root[&]四川省", + "width": 200, + "x": 0, + "y": 300, + }, +] +`; + +exports[`Pivot Chart Tests frozen should render pivot chart with frozen 3`] = ` +Array [ + Object { + "height": 50, + "id": "root[&]总计", + "width": 100, + "x": 0, + "y": 0, + }, +] +`; + +exports[`Pivot Chart Tests frozen should render pivot chart with frozen 4`] = ` +Array [ + Object { + "height": 250, + "id": "root[&]四川省", + "width": 100, + "x": 0, + "y": 300, + }, +] +`; + +exports[`Pivot Chart Tests frozen should render pivot chart with frozen 5`] = `Array []`; + +exports[`Pivot Chart Tests frozen should render pivot chart with frozen 6`] = `Array []`; + +exports[`Pivot Chart Tests frozen should render pivot chart with frozen 7`] = ` +Array [ + Object { + "height": 50, + "id": "root[&]家具[&]桌子[&]number", + "width": 200, + "x": 0, + "y": 0, + }, +] +`; + +exports[`Pivot Chart Tests frozen should render pivot chart with frozen 8`] = ` +Array [ + Object { + "height": 50, + "id": "root[&]办公用品[&]纸张[&]number", + "width": 200, + "x": 600, + "y": 0, + }, +] +`; + +exports[`Pivot Chart Tests frozen should render pivot chart with frozen but row header 1`] = ` +Array [ + Object { + "height": 50, + "id": "root[&]家具[&]桌子[&]number", + "width": 300, + "x": 0, + "y": 60, + }, + Object { + "height": 30, + "id": "root[&]家具[&]桌子", + "width": 300, + "x": 0, + "y": 30, + }, + Object { + "height": 30, + "id": "root[&]家具", + "width": 300, + "x": 0, + "y": 0, + }, +] +`; + +exports[`Pivot Chart Tests frozen should render pivot chart with frozen but row header 2`] = ` +Array [ + Object { + "height": 50, + "id": "root[&]办公用品[&]纸张[&]number", + "width": 300, + "x": 900, + "y": 60, + }, + Object { + "height": 30, + "id": "root[&]办公用品[&]纸张", + "width": 300, + "x": 900, + "y": 30, + }, + Object { + "height": 30, + "id": "root[&]办公用品", + "width": 300, + "x": 900, + "y": 0, + }, +] +`; + +exports[`Pivot Chart Tests frozen should render pivot chart with frozen but row header 3`] = ` +Array [ + Object { + "height": 50, + "id": "root[&]家具[&]桌子[&]number", + "width": 300, + "x": 0, + "y": 0, + }, +] +`; + +exports[`Pivot Chart Tests frozen should render pivot chart with frozen but row header 4`] = ` +Array [ + Object { + "height": 50, + "id": "root[&]办公用品[&]纸张[&]number", + "width": 300, + "x": 900, + "y": 0, + }, +] +`; diff --git a/packages/s2-core/__tests__/spreadsheet/__snapshots__/spread-sheet-frozen-spec.ts.snap b/packages/s2-core/__tests__/spreadsheet/__snapshots__/spread-sheet-frozen-spec.ts.snap index 7ffa1cf4bc..4d10f96605 100644 --- a/packages/s2-core/__tests__/spreadsheet/__snapshots__/spread-sheet-frozen-spec.ts.snap +++ b/packages/s2-core/__tests__/spreadsheet/__snapshots__/spread-sheet-frozen-spec.ts.snap @@ -116,21 +116,21 @@ Array [ Object { "height": 30, "id": "root[&]a-1", - "width": 271.03125, + "width": 272, "x": 0, "y": 0, }, Object { "height": 30, "id": "root[&]a-1[&]a-1-1", - "width": 271.03125, + "width": 272, "x": 0, "y": 30, }, Object { "height": 30, "id": "root[&]a-1", - "width": 271.03125, + "width": 272, "x": 0, "y": 0, }, @@ -142,14 +142,14 @@ Array [ Object { "height": 30, "id": "root[&]a-3[&]measure-5", - "width": 271.03125, + "width": 272, "x": 0, "y": 420, }, Object { "height": -90, "id": "root[&]a-3", - "width": 271.03125, + "width": 272, "x": 0, "y": 420, }, diff --git a/packages/s2-core/__tests__/spreadsheet/__snapshots__/spread-sheet-spec.ts.snap b/packages/s2-core/__tests__/spreadsheet/__snapshots__/spread-sheet-spec.ts.snap index 0feb8e1aac..34a649920d 100644 --- a/packages/s2-core/__tests__/spreadsheet/__snapshots__/spread-sheet-spec.ts.snap +++ b/packages/s2-core/__tests__/spreadsheet/__snapshots__/spread-sheet-spec.ts.snap @@ -47,7 +47,7 @@ Object { "colResizeType": "current", "cornerCellHorizontal": true, "minCellHeight": 20, - "minCellWidth": 20, + "minCellWidth": 40, "rowCellVertical": true, "rowResizeType": "current", }, @@ -72,10 +72,8 @@ Object { "style": Object { "colCell": Object { "height": 30, - "heightByField": null, "maxLines": 1, "textOverflow": "ellipsis", - "widthByField": null, "wordWrap": true, }, "cornerCell": Object { @@ -92,11 +90,9 @@ Object { }, "layoutWidthType": "adaptive", "rowCell": Object { - "heightByField": null, "maxLines": 1, "showTreeLeafNodeAlignDot": false, "textOverflow": "ellipsis", - "widthByField": null, "wordWrap": true, }, "seriesNumberCell": Object { diff --git a/packages/s2-core/__tests__/spreadsheet/__snapshots__/table-sheet-spec.ts.snap b/packages/s2-core/__tests__/spreadsheet/__snapshots__/table-sheet-spec.ts.snap index 73c1b4d610..0537f35ecf 100644 --- a/packages/s2-core/__tests__/spreadsheet/__snapshots__/table-sheet-spec.ts.snap +++ b/packages/s2-core/__tests__/spreadsheet/__snapshots__/table-sheet-spec.ts.snap @@ -54,7 +54,7 @@ Object { "lineWidth": 1, "opacity": 1, "text": "暂无数据", - "x": 375.5, + "x": 375, "y": 357.5, } `; @@ -113,7 +113,7 @@ Object { "lineWidth": 1, "opacity": 1, "text": "暂无数据", - "x": 275.5, + "x": 275, "y": 382.5, } `; @@ -172,7 +172,7 @@ Object { "lineWidth": 1, "opacity": 1, "text": "暂无数据", - "x": 231, + "x": 230.5, "y": 297.5, } `; @@ -231,7 +231,7 @@ Object { "lineWidth": 1, "opacity": 1, "text": "暂无数据", - "x": 375.5, + "x": 375, "y": 357.5, } `; @@ -290,7 +290,7 @@ Object { "lineWidth": 1, "opacity": 1, "text": "暂无数据", - "x": 359.5, + "x": 359, "y": 443, } `; @@ -349,7 +349,7 @@ Object { "lineWidth": 1, "opacity": 1, "text": "No Data", - "x": 377.4892578125, + "x": 376.5, "y": 357.5, } `; @@ -408,7 +408,7 @@ Object { "lineWidth": 1, "opacity": 1, "text": "暂无数据", - "x": 375.5, + "x": 375, "y": 357.5, } `; diff --git a/packages/s2-core/__tests__/spreadsheet/__snapshots__/theme-spec.ts.snap b/packages/s2-core/__tests__/spreadsheet/__snapshots__/theme-spec.ts.snap index a60dd22a75..a7087fa63a 100644 --- a/packages/s2-core/__tests__/spreadsheet/__snapshots__/theme-spec.ts.snap +++ b/packages/s2-core/__tests__/spreadsheet/__snapshots__/theme-spec.ts.snap @@ -53,10 +53,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#5286FA", "verticalBorderColorOpacity": 1, @@ -139,10 +139,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#5286FA", "verticalBorderColorOpacity": 1, @@ -156,6 +156,15 @@ Object { }, "size": 10, }, + "measureText": Object { + "fill": "#FFFFFF", + "fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif", + "fontSize": 12, + "fontWeight": 700, + "opacity": 1, + "textAlign": "left", + "textBaseline": "middle", + }, "text": Object { "fill": "#FFFFFF", "fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif", @@ -502,10 +511,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#E1EAFE", "verticalBorderColorOpacity": 1, @@ -563,6 +572,8 @@ Object { }, "splitLine": Object { "borderDash": Array [], + "horizontalBorderColor": "#3471F9", + "horizontalBorderColorOpacity": 0.2, "horizontalBorderWidth": 2, "shadowColors": Object { "left": "rgba(0,0,0,0.1)", @@ -570,6 +581,8 @@ Object { }, "shadowWidth": 8, "showShadow": true, + "verticalBorderColor": "#5286FA", + "verticalBorderColorOpacity": 0.25, "verticalBorderWidth": 2, }, } @@ -628,10 +641,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#0647b1", "verticalBorderColorOpacity": 1, @@ -714,10 +727,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#0647b1", "verticalBorderColorOpacity": 1, @@ -731,6 +744,15 @@ Object { }, "size": 10, }, + "measureText": Object { + "fill": "#ffffff", + "fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif", + "fontSize": 12, + "fontWeight": 700, + "opacity": 1, + "textAlign": "left", + "textBaseline": "middle", + }, "text": Object { "fill": "#ffffff", "fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif", @@ -1077,10 +1099,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#1e2436", "verticalBorderColorOpacity": 1, @@ -1138,6 +1160,8 @@ Object { }, "splitLine": Object { "borderDash": Array [], + "horizontalBorderColor": "#7899ff", + "horizontalBorderColorOpacity": 0.2, "horizontalBorderWidth": 2, "shadowColors": Object { "left": "rgba(0,0,0,0.1)", @@ -1145,6 +1169,8 @@ Object { }, "shadowWidth": 8, "showShadow": true, + "verticalBorderColor": "#7899ff", + "verticalBorderColorOpacity": 0.25, "verticalBorderWidth": 2, }, } @@ -1203,10 +1229,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#CCDBFC", "verticalBorderColorOpacity": 1, @@ -1289,10 +1315,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#CCDBFC", "verticalBorderColorOpacity": 1, @@ -1306,6 +1332,15 @@ Object { }, "size": 10, }, + "measureText": Object { + "fill": "#000000", + "fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif", + "fontSize": 12, + "fontWeight": 700, + "opacity": 1, + "textAlign": "left", + "textBaseline": "middle", + }, "text": Object { "fill": "#000000", "fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif", @@ -1652,10 +1687,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#E0E9FD", "verticalBorderColorOpacity": 1, @@ -1713,6 +1748,8 @@ Object { }, "splitLine": Object { "borderDash": Array [], + "horizontalBorderColor": "#326EF4", + "horizontalBorderColorOpacity": 0.2, "horizontalBorderWidth": 2, "shadowColors": Object { "left": "rgba(0,0,0,0.1)", @@ -1720,6 +1757,8 @@ Object { }, "shadowWidth": 8, "showShadow": true, + "verticalBorderColor": "#326EF4", + "verticalBorderColorOpacity": 0.25, "verticalBorderWidth": 2, }, } @@ -1778,10 +1817,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#E7E9ED", "verticalBorderColorOpacity": 1, @@ -1864,10 +1903,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#E7E9ED", "verticalBorderColorOpacity": 1, @@ -1881,6 +1920,15 @@ Object { }, "size": 10, }, + "measureText": Object { + "fill": "#000000", + "fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif", + "fontSize": 12, + "fontWeight": 700, + "opacity": 1, + "textAlign": "left", + "textBaseline": "middle", + }, "text": Object { "fill": "#000000", "fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif", @@ -2227,10 +2275,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#F0F2F4", "verticalBorderColorOpacity": 1, @@ -2288,6 +2336,8 @@ Object { }, "splitLine": Object { "borderDash": Array [], + "horizontalBorderColor": "#BAC1CC", + "horizontalBorderColorOpacity": 0.2, "horizontalBorderWidth": 2, "shadowColors": Object { "left": "rgba(0,0,0,0.1)", @@ -2295,6 +2345,8 @@ Object { }, "shadowWidth": 8, "showShadow": true, + "verticalBorderColor": "#BAC1CC", + "verticalBorderColorOpacity": 0.25, "verticalBorderWidth": 2, }, } @@ -2353,10 +2405,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#CCDBFC", "verticalBorderColorOpacity": 1, @@ -2439,10 +2491,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#CCDBFC", "verticalBorderColorOpacity": 1, @@ -2456,6 +2508,15 @@ Object { }, "size": 10, }, + "measureText": Object { + "fill": "#000000", + "fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif", + "fontSize": 12, + "fontWeight": 700, + "opacity": 1, + "textAlign": "left", + "textBaseline": "middle", + }, "text": Object { "fill": "#000000", "fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif", @@ -2802,10 +2863,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#E0E9FD", "verticalBorderColorOpacity": 1, @@ -2863,6 +2924,8 @@ Object { }, "splitLine": Object { "borderDash": Array [], + "horizontalBorderColor": "#326EF4", + "horizontalBorderColorOpacity": 0.2, "horizontalBorderWidth": 2, "shadowColors": Object { "left": "rgba(0,0,0,0.1)", @@ -2870,6 +2933,8 @@ Object { }, "shadowWidth": 8, "showShadow": true, + "verticalBorderColor": "#326EF4", + "verticalBorderColorOpacity": 0.25, "verticalBorderWidth": 2, }, } @@ -2928,10 +2993,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#CCDBFC", "verticalBorderColorOpacity": 1, @@ -3014,10 +3079,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#CCDBFC", "verticalBorderColorOpacity": 1, @@ -3031,6 +3096,15 @@ Object { }, "size": 10, }, + "measureText": Object { + "fill": "#000000", + "fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif", + "fontSize": 12, + "fontWeight": 700, + "opacity": 1, + "textAlign": "left", + "textBaseline": "middle", + }, "text": Object { "fill": "#000000", "fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif", @@ -3377,10 +3451,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#E0E9FD", "verticalBorderColorOpacity": 1, @@ -3438,6 +3512,8 @@ Object { }, "splitLine": Object { "borderDash": Array [], + "horizontalBorderColor": "#326EF4", + "horizontalBorderColorOpacity": 0.2, "horizontalBorderWidth": 2, "shadowColors": Object { "left": "rgba(0,0,0,0.1)", @@ -3445,6 +3521,8 @@ Object { }, "shadowWidth": 8, "showShadow": true, + "verticalBorderColor": "#326EF4", + "verticalBorderColorOpacity": 0.25, "verticalBorderWidth": 2, }, } diff --git a/packages/s2-core/__tests__/spreadsheet/compare-layout-spec.ts b/packages/s2-core/__tests__/spreadsheet/compare-layout-spec.ts index ef7db7967a..7980c50b89 100644 --- a/packages/s2-core/__tests__/spreadsheet/compare-layout-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/compare-layout-spec.ts @@ -43,25 +43,57 @@ describe('Compare Layout Tests', () => { test.each([ { showDefaultHeaderActionIcon: true }, { showDefaultHeaderActionIcon: false }, + ])( + 'should get max col width for pivot sheet and same font size by %o', + async (options) => { + const s2 = new PivotSheet(getContainer(), mockDataConfig, { + ...s2Options, + ...options, + }); + + await s2.render(); + + const colLeafNodes = s2.facet.getColLeafNodes(); + + expect(Math.floor(colLeafNodes[0].width)).toBeCloseTo(133); + expect(Math.floor(colLeafNodes[1].width)).toEqual( + options.showDefaultHeaderActionIcon ? 71 : 66, + ); + expectTextOverflowing(s2); + }, + ); + + // 覆盖 (数值/中文) 等场景 + test.each([ + { showDefaultHeaderActionIcon: true, fontSize: 20 }, + { showDefaultHeaderActionIcon: true, fontSize: 12 }, + { showDefaultHeaderActionIcon: false, fontSize: 20 }, + { showDefaultHeaderActionIcon: false, fontSize: 12 }, ])('should get max col width for pivot sheet by %o', async (options) => { const s2 = new PivotSheet(getContainer(), mockDataConfig, { ...s2Options, - ...options, + showDefaultHeaderActionIcon: options.showDefaultHeaderActionIcon, }); s2.setTheme({ dataCell: { text: { - fontSize: 20, + fontSize: options.fontSize, }, }, }); await s2.render(); + const expectWidth = options.showDefaultHeaderActionIcon ? 71 : 66; + const isLargeFontSize = options.fontSize === 20; const colLeafNodes = s2.facet.getColLeafNodes(); - expect(Math.floor(colLeafNodes[0].width)).toBeCloseTo(189); - expect(Math.floor(colLeafNodes[1].width)).toEqual(90); + expect(Math.floor(colLeafNodes[0].width)).toBeCloseTo( + isLargeFontSize ? 209 : 133, + ); + expect(Math.floor(colLeafNodes[1].width)).toEqual( + isLargeFontSize ? 97 : expectWidth, + ); expectTextOverflowing(s2); }); @@ -90,13 +122,15 @@ describe('Compare Layout Tests', () => { await s2.render(); const colLeafNodes = s2.facet.getColLeafNodes(); - - expect(Math.floor(colLeafNodes[0].width)).toBeCloseTo(182); - expectTextOverflowing(s2); const { dataCellWidthList, colLeafNodeWidthList } = mapWidthList(s2); + const expectWidth = 207; - expect(dataCellWidthList.every((width) => width === 182)).toBeTruthy(); - expect(colLeafNodeWidthList).toEqual([182]); + expect(Math.floor(colLeafNodes[0].width)).toBeCloseTo(expectWidth); + expect( + dataCellWidthList.every((width) => width === expectWidth), + ).toBeTruthy(); + expect(colLeafNodeWidthList).toEqual([expectWidth]); + expectTextOverflowing(s2); }); test.each([ @@ -137,12 +171,13 @@ describe('Compare Layout Tests', () => { expect(dataCellWidthList).toEqual( options.showDefaultHeaderActionIcon - ? [207, 207, 207, 207, 108, 108, 108, 108, 83, 83, 83, 83] - : [207, 207, 207, 207, 108, 108, 108, 108, 67, 67, 67, 67], + ? [227, 227, 227, 227, 115, 115, 115, 115, 93, 93, 93, 93] + : [227, 227, 227, 227, 115, 115, 115, 115, 71, 71, 71, 71], ); expect(colLeafNodeWidthList).toEqual( - options.showDefaultHeaderActionIcon ? [207, 108, 83] : [207, 108, 67], + options.showDefaultHeaderActionIcon ? [227, 115, 93] : [227, 115, 71], ); + expectTextOverflowing(s2); }, ); }); diff --git a/packages/s2-core/__tests__/spreadsheet/corner-spec.ts b/packages/s2-core/__tests__/spreadsheet/corner-spec.ts index 76a6702471..10a95d0b43 100644 --- a/packages/s2-core/__tests__/spreadsheet/corner-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/corner-spec.ts @@ -1,5 +1,6 @@ import * as simpleDataConfig from 'tests/data/simple-data.json'; import { + CellType, CornerNodeType, DEFAULT_STYLE, EXTRA_FIELD, @@ -251,6 +252,7 @@ describe('PivotSheet Corner Tests', () => { const getCellSpy = jest.spyOn(s2, 'getCell').mockImplementation(() => { return { + cellType: CellType.CORNER_CELL, getMeta: () => ({ ...node, cornerType: CornerNodeType.Row, @@ -258,6 +260,7 @@ describe('PivotSheet Corner Tests', () => { updateByState: jest.fn(), } as unknown as S2CellType; }); + const selected = jest.fn(); s2.on(S2Event.GLOBAL_SELECTED, selected); @@ -269,7 +272,11 @@ describe('PivotSheet Corner Tests', () => { expect(s2.interaction.getCells().map((meta) => meta.id)).toEqual( selectedIds, ); - expect(selected).toHaveBeenCalledWith(s2.interaction.getActiveCells()); + expect(selected).toHaveBeenCalledWith(s2.interaction.getActiveCells(), { + interactionName: 'cornerCellClick', + targetCell: expect.anything(), + event: expect.anything(), + }); // 取消选中 s2.emit(S2Event.CORNER_CELL_CLICK, {} as unknown as GEvent); @@ -277,7 +284,11 @@ describe('PivotSheet Corner Tests', () => { expect(s2.tooltip.visible).toBeFalsy(); expect(s2.interaction.isSelectedState()).toBeFalsy(); expect(s2.interaction.getCells()).toEqual([]); - expect(selected).toHaveBeenCalledWith([]); + expect(selected).toHaveBeenCalledWith([], { + interactionName: 'cornerCellClick', + targetCell: expect.anything(), + event: expect.anything(), + }); getCellSpy.mockClear(); }, @@ -308,7 +319,7 @@ describe('PivotSheet Corner Tests', () => { expect(selected).not.toHaveBeenCalled(); }); - test('should get corner row cell summaries', () => { + test.skip('should get corner row cell summaries', () => { const node = s2.facet .getRowNodes() .find((rowNode) => rowNode.field === 'province'); @@ -391,4 +402,23 @@ describe('PivotSheet Corner Tests', () => { expect(cornerCell.getActualText()).toEqual(cornerExtraFieldText); }); + + test('should keep vertical alignment for tree mode when text align is left', async () => { + s2.setOptions({ + hierarchyType: 'tree', + }); + s2.setTheme({ + cornerCell: { + bolderText: { + textAlign: 'left', + }, + }, + }); + await s2.render(); + + s2.facet.getCornerNodes().forEach((node) => { + expect(node.x).toEqual(0); + expect(node.width).toEqual(120); + }); + }); }); diff --git a/packages/s2-core/__tests__/spreadsheet/custom-cell-style-spec.ts b/packages/s2-core/__tests__/spreadsheet/custom-cell-style-spec.ts index fbea95055f..4ce5c67366 100644 --- a/packages/s2-core/__tests__/spreadsheet/custom-cell-style-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/custom-cell-style-spec.ts @@ -91,7 +91,21 @@ describe('SpreadSheet Custom Cell Style Tests', () => { }, }, }); - await s2.render(); + await s2.render(false); + + expect(mapNodeSize(s2.facet.getRowNodes())).toMatchSnapshot(); + }); + + test('should get custom tree row cell style', async () => { + s2.setOptions({ + hierarchyType: 'tree', + style: { + rowCell: { + treeWidth: 150, + }, + }, + }); + await s2.render(false); expect(mapNodeSize(s2.facet.getRowNodes())).toMatchSnapshot(); }); @@ -113,7 +127,7 @@ describe('SpreadSheet Custom Cell Style Tests', () => { }, }, }); - await s2.render(); + await s2.render(false); expect(mapNodeSize(s2.facet.getRowNodes())).toMatchSnapshot(); }); @@ -131,7 +145,7 @@ describe('SpreadSheet Custom Cell Style Tests', () => { }, }, }); - await s2.render(); + await s2.render(false); expect(mapNodeSize(s2.facet.getRowNodes())).toMatchSnapshot(); }); @@ -151,7 +165,7 @@ describe('SpreadSheet Custom Cell Style Tests', () => { }, }, }); - await s2.render(); + await s2.render(false); expect(mapNodeSize(s2.facet.getRowNodes())).toMatchSnapshot(); }); @@ -200,7 +214,7 @@ describe('SpreadSheet Custom Cell Style Tests', () => { }, }, }); - await s2.render(); + await s2.render(false); const rootRowNodes = s2.facet .getRowNodes() diff --git a/packages/s2-core/__tests__/spreadsheet/custom-grid-spec.ts b/packages/s2-core/__tests__/spreadsheet/custom-grid-spec.ts index d28cd7025a..6b2f946411 100644 --- a/packages/s2-core/__tests__/spreadsheet/custom-grid-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/custom-grid-spec.ts @@ -5,7 +5,11 @@ import { pick } from 'lodash'; import { CustomGridData } from 'tests/data/data-custom-grid'; import { waitForRender } from 'tests/util'; import { getContainer } from 'tests/util/helpers'; -import { KEY_GROUP_COL_RESIZE_AREA } from '../../src/common/constant'; +import { + KEY_GROUP_COL_RESIZE_AREA, + VALUE_FIELD, +} from '../../src/common/constant'; +import { Aggregation } from '../../src/common/interface/basic'; import { CustomGridPivotDataSet } from '../../src/data-set/custom-grid-pivot-data-set'; import { customColGridSimpleFields, @@ -538,5 +542,51 @@ describe('SpreadSheet Custom Grid Tests', () => { s2.facet.getColNodes().some((node) => node.isCollapsed), ).toBeFalsy(); }); + + // https://github.com/antvis/S2/issues/2893 + test.each(['tree', 'grid'])( + 'should render correct total node for %s mode', + async (hierarchyType) => { + s2.setOptions({ + hierarchyType, + totals: { + row: { + showGrandTotals: true, + showSubTotals: true, + reverseGrandTotalsLayout: true, + reverseSubTotalsLayout: true, + subTotalsDimensions: ['type'], + calcGrandTotals: { + aggregation: Aggregation.SUM, + }, + calcSubTotals: { + aggregation: Aggregation.SUM, + }, + }, + col: { + showGrandTotals: true, + showSubTotals: true, + reverseGrandTotalsLayout: true, + reverseSubTotalsLayout: true, + subTotalsDimensions: ['type'], + calcGrandTotals: { + aggregation: Aggregation.SUM, + }, + calcSubTotals: { + aggregation: Aggregation.SUM, + }, + }, + }, + }); + + await s2.render(false); + + expect(s2.facet.getRowGrandTotalsNodes()).toHaveLength(1); + expect(s2.facet.getColGrandTotalsNodes()).toHaveLength(0); + + expect(s2.facet.getCellMeta(0, 0).data[VALUE_FIELD]).toEqual(24); + expect(s2.facet.getCellMeta(0, 1).data[VALUE_FIELD]).toEqual(10); + }, + ); }); }); diff --git a/packages/s2-core/__tests__/spreadsheet/custom-table-col-spec.ts b/packages/s2-core/__tests__/spreadsheet/custom-table-col-spec.ts index f1ebace5cc..9c84fffe1b 100644 --- a/packages/s2-core/__tests__/spreadsheet/custom-table-col-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/custom-table-col-spec.ts @@ -308,4 +308,29 @@ describe('TableSheet Custom Tests', () => { expect(resizeAreaList.length).toEqual(8); }); + + test.each([ + { showDefaultHeaderActionIcon: false }, + { showDefaultHeaderActionIcon: true }, + ])( + 'should render correctly sort action icon in value cell for custom col header with %o', + async (options) => { + s2.setOptions(options); + + await s2.render(false); + + const fields = s2.facet + .getColCells() + .filter((cell) => { + return cell.getActionIcons().length >= 1; + }) + .map((cell) => cell.getMeta().field); + + expect(fields).toEqual( + options.showDefaultHeaderActionIcon + ? ['province', 'city', 'type', 'price', 'number'] + : [], + ); + }, + ); }); diff --git a/packages/s2-core/__tests__/spreadsheet/custom-tree-spec.ts b/packages/s2-core/__tests__/spreadsheet/custom-tree-spec.ts index 2c93df3010..9a47217b6d 100644 --- a/packages/s2-core/__tests__/spreadsheet/custom-tree-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/custom-tree-spec.ts @@ -1,7 +1,6 @@ import type { S2DataConfig, S2Options } from '@/common/interface'; import { PivotSheet, SpreadSheet } from '@/sheet-type'; import { getContainer } from 'tests/util/helpers'; -import { CustomTreePivotDataSet } from '../../src'; import type { HeaderCell } from '../../src/cell/header-cell'; import { customRowGridSimpleFields } from '../data/custom-grid-simple-fields'; import { customTreeNodes } from '../data/custom-tree-nodes'; @@ -19,7 +18,7 @@ const s2Options: S2Options = { hierarchyType: 'tree', style: { rowCell: { - width: 400, + treeWidth: 400, }, }, }; @@ -81,10 +80,6 @@ describe('SpreadSheet Custom Tree Tests', () => { expect(s2.dataSet.fields.valueInCols).toBeFalsy(); }); - test('should use custom tree pivot dataSet', () => { - expect(s2.dataSet).toBeInstanceOf(CustomTreePivotDataSet); - }); - test('should get correctly dataset fields', () => { expect(s2.dataSet.fields).toMatchSnapshot(); }); @@ -213,7 +208,8 @@ describe('SpreadSheet Custom Tree Tests', () => { s2.setOptions({ style: { rowCell: { - width: 50, + treeWidth: 50, + width: 30, }, }, }); diff --git a/packages/s2-core/__tests__/spreadsheet/empty-string-values-spec.ts b/packages/s2-core/__tests__/spreadsheet/empty-string-values-spec.ts index 928f494f6a..5e52b72415 100644 --- a/packages/s2-core/__tests__/spreadsheet/empty-string-values-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/empty-string-values-spec.ts @@ -73,9 +73,9 @@ const testDataCfg: S2DataConfig = { describe('Empty String Values Tests', () => { let s2: SpreadSheet; - beforeEach(() => { + beforeEach(async () => { s2 = new PivotSheet(getContainer(), testDataCfg, s2Options); - s2.render(); + await s2.render(); }); test('should get correctly first dimension values', () => { diff --git a/packages/s2-core/__tests__/spreadsheet/interaction-brush-selection-scroll-spec.ts b/packages/s2-core/__tests__/spreadsheet/interaction-brush-selection-scroll-spec.ts index 5b9ac2814b..742ac65dd0 100644 --- a/packages/s2-core/__tests__/spreadsheet/interaction-brush-selection-scroll-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/interaction-brush-selection-scroll-spec.ts @@ -161,7 +161,7 @@ const expectScrollBrush = async ( expect(dataCellBrushSelectionFn).toHaveBeenCalledTimes(1); }; -describe('TableSheet Brush Selection Scroll Tests', () => { +describe.skip('TableSheet Brush Selection Scroll Tests', () => { test('should scroll when mouse outside table data cell', async () => { const s2 = new TableSheet(getContainer(), dataCfg, options); @@ -188,7 +188,7 @@ describe('TableSheet Brush Selection Scroll Tests', () => { }); }); -describe('PivotSheet Brush Selection Scroll Tests', () => { +describe.skip('PivotSheet Brush Selection Scroll Tests', () => { test('should scroll when mouse outside data cell', async () => { const s2 = createPivotSheet( { diff --git a/packages/s2-core/__tests__/spreadsheet/interaction-cell-selected-event-spec.ts b/packages/s2-core/__tests__/spreadsheet/interaction-cell-selected-event-spec.ts new file mode 100644 index 0000000000..69f99c800b --- /dev/null +++ b/packages/s2-core/__tests__/spreadsheet/interaction-cell-selected-event-spec.ts @@ -0,0 +1,57 @@ +import { S2Event } from '@/common/constant'; +import { type S2Options } from '@/common/interface'; +import { SpreadSheet } from '@/sheet-type'; +import { createPivotSheet } from 'tests/util/helpers'; +import { CellType } from '../../src'; + +const s2Options: S2Options = { + width: 600, + height: 400, +}; + +describe('Interaction Cell Selected Event Tests', () => { + let s2: SpreadSheet; + + beforeEach(async () => { + s2 = createPivotSheet(s2Options); + await s2.render(); + }); + + afterEach(() => { + s2.destroy(); + }); + + test.each` + cellType | event + ${CellType.CORNER_CELL} | ${S2Event.CORNER_CELL_SELECTED} + ${CellType.ROW_CELL} | ${S2Event.ROW_CELL_SELECTED} + ${CellType.COL_CELL} | ${S2Event.COL_CELL_SELECTED} + ${CellType.DATA_CELL} | ${S2Event.DATA_CELL_SELECTED} + `( + 'should get $cellType detail when $event is triggered', + ({ cellType, event }) => { + const fn = jest.fn(); + const onSelected = jest.fn(); + + s2.on(event, fn); + s2.on(S2Event.GLOBAL_SELECTED, onSelected); + + s2.interaction.emitSelectEvent({ + targetCell: { + cellType, + }, + }); + + expect(onSelected).toHaveBeenCalledWith(expect.anything(), { + targetCell: { + cellType, + }, + }); + expect(fn).toHaveBeenCalledWith(expect.anything(), { + targetCell: { + cellType, + }, + }); + }, + ); +}); diff --git a/packages/s2-core/__tests__/spreadsheet/interaction-multi-selection-spec.ts b/packages/s2-core/__tests__/spreadsheet/interaction-multi-selection-spec.ts index 1f75fc8acb..70d65ea699 100644 --- a/packages/s2-core/__tests__/spreadsheet/interaction-multi-selection-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/interaction-multi-selection-spec.ts @@ -8,7 +8,12 @@ import { getContainer, sleep, } from 'tests/util/helpers'; -import { CellType, InteractionStateName, RootInteraction } from '../../src'; +import { + CellType, + InteractionStateName, + RootInteraction, + S2Event, +} from '../../src'; import { expectHighlightActiveNodes, getSelectedCount, @@ -349,4 +354,37 @@ describe('Interaction Multi Selection Tests', () => { expect(interactedCells).toHaveLength(2); }, ); + + test('should emit select event', async () => { + const onSelected = jest.fn(); + const onColCellSelected = jest.fn(); + + s2.setOptions({ + hierarchyType: 'grid', + }); + + s2.on(S2Event.GLOBAL_SELECTED, onSelected); + s2.on(S2Event.COL_CELL_SELECTED, onColCellSelected); + + await s2.render(false); + + const colRootCell = s2.facet.getColCells()[0]; + + // 选中 + s2.interaction.changeCell({ + cell: colRootCell, + }); + + expect(onSelected).toHaveBeenCalledTimes(1); + expect(onColCellSelected).toHaveBeenCalledTimes(1); + + // 取消选中 + s2.interaction.changeCell({ + cell: colRootCell, + }); + + expect(s2.interaction.getActiveCells()).toHaveLength(0); + expect(onSelected).toHaveBeenCalledTimes(2); + expect(onColCellSelected).toHaveBeenCalledTimes(2); + }); }); diff --git a/packages/s2-core/__tests__/spreadsheet/multi-line-text-spec.ts b/packages/s2-core/__tests__/spreadsheet/multi-line-text-spec.ts index d631b8a822..c0c44bee0e 100644 --- a/packages/s2-core/__tests__/spreadsheet/multi-line-text-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/multi-line-text-spec.ts @@ -10,9 +10,11 @@ import { } from '../../src'; import type { CellTextWordWrapStyle, + Meta, S2CellType, S2Options, } from '../../src/common'; +import { customColSimpleMultipleTextColumns } from '../data/custom-table-col-fields'; import { PivotSheetMultiLineTextDataCfg, TableSheetMultiLineTextDataCfg, @@ -137,6 +139,13 @@ describe('SpreadSheet Multi Line Text Tests', () => { }, }; + const cornerMetaList: Meta[] = [ + { field: 'type', name: '类别\n类别' }, + { field: 'sub_type', name: '子类别\n子类别\n子类别' }, + { field: 'number', name: '数量\n数量\n数量\n数量' }, + { field: 'city', name: '城市\n城市' }, + ]; + beforeEach(async () => { s2 = new PivotSheet( getContainer(), @@ -160,7 +169,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { await s2.render(false); matchCellStyleSnapshot(); - expectColHierarchyHeight(118, 80, 38); + expectColHierarchyHeight(144, 96, 48); }); test('should render three max text lines', async () => { @@ -168,7 +177,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { await s2.render(false); matchCellStyleSnapshot(); - expectColHierarchyHeight(165, 112, 53); + expectColHierarchyHeight(192, 128, 64); }); test('should render custom text overflow text', async () => { @@ -213,12 +222,13 @@ describe('SpreadSheet Multi Line Text Tests', () => { // wordWrap 关闭时, 不会渲染省略号 cells.forEach((cell) => { expect(cell.getActualText()).not.toContain('...'); + expect(cell.isTextOverflowing()).toBeFalsy(); }); }); expectColHierarchyHeight(90); }); - test('should not adaptive adjust cell height if custom cell style less than actual text height by rowCell.height', async () => { + test('should not adaptive adjust cell height, but should adjust maxLines if custom cell style less than actual text height by rowCell.height', async () => { updateStyle(2); s2.setOptions({ @@ -234,7 +244,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { matchCellStyleSnapshot(); }); - test('should not adaptive adjust cell height if custom cell style less than actual text height by rowCell.height()', async () => { + test('should not adaptive adjust cell height, but should adjust maxLines if custom cell style less than actual text height by rowCell.height()', async () => { updateStyle(2); s2.setOptions({ @@ -335,7 +345,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { await s2.render(false); matchCellStyleSnapshot(); - expectColHierarchyHeight(118, 80, 38); + expectColHierarchyHeight(144, 96, 48); }); test('should not adaptive adjust cell height if custom cell style more than actual text height', async () => { @@ -386,7 +396,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { updateStyle(3); await s2.render(false); - expectColHierarchyHeight(149, 96, 53); + expectColHierarchyHeight(176, 112, 64); }); test('should render correctly layout if only enable grand totals', async () => { @@ -442,8 +452,8 @@ describe('SpreadSheet Multi Line Text Tests', () => { matchCellStyleSnapshot(); // 省份 4行文本, 叶子节点 (城市) 3行文本, 省份应该和城市高度一致, 才能展示所有文本 (maxLines: 4) - expectRowHierarchyHeight(384, 0, 72); - expectColHierarchyHeight(212, 144, 68); + expectRowHierarchyHeight(400, 0, 80); + expectColHierarchyHeight(240, 160, 80); }); test('should render three max text lines for tree mode', async () => { @@ -473,7 +483,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { await s2.render(); matchCellStyleSnapshot(); - expect(s2.facet.getLayoutResult().rowsHierarchy.height).toEqual(524); + expect(s2.facet.getLayoutResult().rowsHierarchy.height).toEqual(556); }); // https://github.com/antvis/S2/issues/2678 @@ -528,7 +538,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { await s2.render(); matchCellStyleSnapshot(); - expect(s2.facet.getLayoutResult().rowsHierarchy.height).toEqual(328); + expect(s2.facet.getLayoutResult().rowsHierarchy.height).toEqual(336); }); test.each(range(1, 11))( @@ -537,7 +547,10 @@ describe('SpreadSheet Multi Line Text Tests', () => { updateStyle(maxLines); s2.changeSheetSize(800, 600); - s2.setDataCfg(SimpleDataCfg); + s2.setDataCfg({ + ...SimpleDataCfg, + meta: [], + }); await s2.render(); // 不管设置了多少行的文本, 如果实际文本未换行, 高度不应该自适应, 以默认高度为准. @@ -545,6 +558,150 @@ describe('SpreadSheet Multi Line Text Tests', () => { expectRowHierarchyHeight(60, 0, 30, 2); }, ); + + test('should render by infinity maxLines', async () => { + updateStyle(Infinity); + await s2.render(false); + + matchCellStyleSnapshot(); + }); + + test('should render by maxLines if actual text contains "\\n"', async () => { + updateStyle(1); + s2.changeSheetSize(800, 600); + s2.setDataCfg({ + data: [ + { + province: '浙江\n浙江', + city: '杭州\n杭州\n杭州', + type: '纸张\n纸张', + price: 12, + cost: 20, + }, + ...s2.dataCfg.data, + ], + }); + + await s2.render(); + + matchCellStyleSnapshot(); + }); + + test('should render by maxLinesByField', async () => { + s2.changeSheetSize(800, 600); + + updateStyle(Infinity); + await s2.render(false); + + s2.setOptions({ + style: { + rowCell: { + maxLinesByField: { + city: 3, + }, + }, + colCell: { + maxLinesByField: { + type: 2, + sub_type: 3, + [EXTRA_FIELD]: 4, + }, + }, + }, + }); + await s2.render(false); + + matchCellStyleSnapshot(); + }); + + test('should adjust corner cell max lines by custom col height', async () => { + s2.changeSheetSize(800, 600); + s2.setDataCfg({ + meta: cornerMetaList, + }); + s2.setOptions({ + style: { + cornerCell: { + maxLines: 10, + }, + colCell: { + height: 20, + maxLines: 2, + }, + }, + }); + await s2.render(); + + matchCellStyleSnapshot(); + expectColHierarchyHeight(60, 40, 20); + }); + + test('should adjust col cell height if corner cell height > col cell height', async () => { + s2.changeSheetSize(800, 600); + s2.setDataCfg({ + meta: cornerMetaList, + }); + s2.setOptions({ + style: { + cornerCell: { + maxLines: 10, + }, + colCell: { + maxLines: 1, + }, + }, + }); + await s2.render(); + + matchCellStyleSnapshot(); + expectColHierarchyHeight(160, 112, 48); + }); + + test('should adjust col cell height if corner cell height > col cell height by tree mode', async () => { + s2.changeSheetSize(800, 600); + s2.setDataCfg({ + meta: cornerMetaList, + }); + s2.setOptions({ + hierarchyType: 'tree', + style: { + cornerCell: { + maxLines: 10, + }, + colCell: { + maxLines: 1, + }, + }, + }); + await s2.render(); + + matchCellStyleSnapshot(); + expectColHierarchyHeight(192, 112, 80); + }); + + test('should adjust col cell height if corner cell height > col cell height by "valueInCols: false"', async () => { + s2.changeSheetSize(800, 600); + s2.setDataCfg({ + meta: cornerMetaList, + fields: { + valueInCols: false, + }, + }); + s2.setOptions({ + style: { + cornerCell: { + maxLines: 10, + }, + colCell: { + maxLines: 1, + }, + }, + }); + await s2.render(); + + matchCellStyleSnapshot(); + expectColHierarchyHeight(96, 48, 48, 2); + }); }); describe('TableSheet', () => { @@ -579,7 +736,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { await s2.render(false); matchCellStyleSnapshot(); - expectColHierarchyHeight(40, 0, 40, 1); + expectColHierarchyHeight(48, 0, 48, 1); }); test('should render three max text lines', async () => { @@ -588,7 +745,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { matchCellStyleSnapshot(); - expectColHierarchyHeight(56, 0, 56, 1); + expectColHierarchyHeight(64, 0, 64, 1); }); test('should render custom text overflow text', async () => { @@ -628,11 +785,12 @@ describe('SpreadSheet Multi Line Text Tests', () => { // wordWrap 关闭时, 不会渲染省略号 cells.forEach((cell) => { expect(cell.getActualText()).not.toContain('...'); + expect(cell.isTextOverflowing()).toBeFalsy(); }); }); }); - test('should not force adaptive adjust cell height if custom cell style less than actual text height by colCell.height', async () => { + test('should not force adaptive adjust cell height, but should adjust maxLines if custom cell style less than actual text height by colCell.height', async () => { s2.setOptions({ style: { colCell: { @@ -648,7 +806,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { expectColHierarchyHeight(20, 0, 20, 1); }); - test('should not adaptive adjust cell height if custom cell style more than actual text height', async () => { + test('should not adaptive adjust cell height, but should adjust maxLines if custom cell style more than actual text height', async () => { const CUSTOM_CELL_HEIGHT = 70; s2.setOptions({ @@ -687,14 +845,14 @@ describe('SpreadSheet Multi Line Text Tests', () => { await s2.render(); matchCellStyleSnapshot(); - expectColHierarchyHeight(72, 0, 72, 1); + expectColHierarchyHeight(80, 0, 80, 1); }); // https://github.com/antvis/S2/issues/2594 test('should calc correctly data cell height if actual text lines is difference', async () => { updateStyle(4); - await s2.render(); + await s2.render(false); matchCellStyleSnapshot(); @@ -720,7 +878,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { }, }); - await s2.render(); + await s2.render(false); matchCellStyleSnapshot(); expect((s2.facet as unknown as TableFacet).rowOffsets).toMatchSnapshot(); @@ -739,7 +897,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { }, }); - await s2.render(); + await s2.render(false); matchCellStyleSnapshot(); expect((s2.facet as unknown as TableFacet).rowOffsets).toMatchSnapshot(); @@ -758,7 +916,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { }, }, }); - await s2.render(); + await s2.render(false); matchCellStyleSnapshot(); }); @@ -773,7 +931,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { }, }, }); - await s2.render(); + await s2.render(false); matchCellStyleSnapshot(); }); @@ -791,7 +949,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { }, }, }); - await s2.render(); + await s2.render(false); matchCellStyleSnapshot(); }); @@ -806,7 +964,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { }, }, }); - await s2.render(); + await s2.render(false); matchCellStyleSnapshot(); }); @@ -851,12 +1009,12 @@ describe('SpreadSheet Multi Line Text Tests', () => { }, }, }); - await s2.render(); + await s2.render(false); matchCellStyleSnapshot(); }); - test('should not adaptive adjust data cell height if custom cell style more than actual text height by dataCell.height', async () => { + test('should not adaptive adjust data cell height, but should adjust maxLines if custom cell style more than actual text height by dataCell.height', async () => { s2.setOptions({ style: { dataCell: { @@ -871,7 +1029,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { matchCellStyleSnapshot(); }); - test('should not adaptive adjust data cell height if custom cell style less than actual text height by dataCell.height', async () => { + test('should not adaptive adjust data cell height, but should adjust maxLines if custom cell style less than actual text height by dataCell.height', async () => { s2.setOptions({ style: { dataCell: { @@ -896,7 +1054,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { }, }, }); - await s2.render(); + await s2.render(false); matchCellStyleSnapshot(); }); @@ -911,7 +1069,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { }, }, }); - await s2.render(); + await s2.render(false); matchCellStyleSnapshot(); }); @@ -971,7 +1129,30 @@ describe('SpreadSheet Multi Line Text Tests', () => { await s2.render(); matchCellStyleSnapshot(); - expect(s2.facet.getLayoutResult().colsHierarchy.height).toEqual(56); + expect(s2.facet.getLayoutResult().colsHierarchy.height).toEqual(64); + }); + + // https://github.com/antvis/S2/issues/2955 + test('should use actual text height for large max line by custom col group', async () => { + updateStyle(20); + + s2.setDataCfg( + { + ...SimpleDataCfg, + fields: { + rows: [], + columns: customColSimpleMultipleTextColumns, + values: [], + }, + }, + true, + ); + + s2.changeSheetSize(800, 600); + await s2.render(); + + matchCellStyleSnapshot(); + expect(s2.facet.getLayoutResult().colsHierarchy.height).toEqual(208); }); test.each(range(1, 11))( @@ -995,5 +1176,81 @@ describe('SpreadSheet Multi Line Text Tests', () => { expectColHierarchyHeight(30, 0, 30, 1); }, ); + + test('should render by maxLines if actual text contains "\\n"', async () => { + updateStyle(1); + s2.changeSheetSize(800, 600); + s2.setDataCfg({ + data: [ + { + province: '浙江\n浙江', + city: '杭州\n杭州\n杭州', + type: '纸张\n纸张', + price: 12, + cost: 20, + }, + ...s2.dataCfg.data, + ], + }); + + await s2.render(); + + matchCellStyleSnapshot(); + }); + + test('should render by infinity maxLines', async () => { + updateStyle(Infinity); + await s2.render(false); + + matchCellStyleSnapshot(); + }); + + test('should render by infinity maxLines if actual text contains "\\n"', async () => { + updateStyle(Infinity); + + s2.setDataCfg({ + data: [ + { + province: '浙江\n浙江', + city: '杭州\n杭州\n杭州', + type: '纸张\n纸张', + price: 12, + cost: 20, + }, + ...s2.dataCfg.data, + ], + }); + + await s2.render(); + + matchCellStyleSnapshot(); + }); + + test('should render by maxLinesByField', async () => { + s2.changeSheetSize(800, 600); + + updateStyle(Infinity); + await s2.render(false); + + s2.setOptions({ + style: { + rowCell: { + maxLinesByField: { + // 行索引 + '1': 2, + }, + }, + colCell: { + maxLinesByField: { + type: 2, + sub_type: 3, + }, + }, + }, + }); + await s2.render(false); + + matchCellStyleSnapshot(); + }); }); }); diff --git a/packages/s2-core/__tests__/spreadsheet/pivot-chart-sheet-spec.ts b/packages/s2-core/__tests__/spreadsheet/pivot-chart-sheet-spec.ts new file mode 100644 index 0000000000..066b576c5b --- /dev/null +++ b/packages/s2-core/__tests__/spreadsheet/pivot-chart-sheet-spec.ts @@ -0,0 +1,884 @@ +import { get, head, map, omit } from 'lodash'; +import { getContainer, sleep } from 'tests/util/helpers'; +import { asyncGetAllPlainData } from '../../src'; +import { + EXTRA_FIELD, + LayoutWidthType, + OriginEventType, + TAB_SEPARATOR, +} from '../../src/common'; +import { Aggregation, type S2Options } from '../../src/common/interface'; +import { PivotChartSheet } from '../../src/extends'; +import { + KEY_GROUP_COL_AXIS_RESIZE_AREA, + KEY_GROUP_ROW_AXIS_RESIZE_AREA, + PLACEHOLDER_FIELD, +} from '../../src/extends/pivot-chart/constant'; +import type { PivotChartFacet } from '../../src/extends/pivot-chart/facet/pivot-chart-facet'; +import type { FrozenFacet } from '../../src/facet'; +import dataCfg from '../data/mock-dataset.json'; +import { pickMap } from '../util/fp'; + +describe('Pivot Chart Tests', () => { + let container: HTMLElement; + let s2: PivotChartSheet; + + const s2Options: S2Options = { + width: 800, + height: 700, + seriesNumber: { + enable: true, + }, + }; + + beforeEach(() => { + container = getContainer(); + }); + afterEach(() => { + s2?.destroy(); + }); + + describe('cartesian coordinate', () => { + test('should render pivot chart with 1 level row', async () => { + s2 = new PivotChartSheet( + container, + { + ...dataCfg, + fields: { + rows: ['province'], + columns: ['type', 'sub_type'], + values: ['number'], + valueInCols: true, + }, + }, + s2Options, + ); + + await s2.render(); + + const { + rowsHierarchy, + axisRowsHierarchy, + colsHierarchy, + axisColsHierarchy, + } = s2.facet.getLayoutResult(); + + // 只有一个维度时,会被拆分到 axisRow 中 + expect(rowsHierarchy.width).toEqual(0); + expect(axisRowsHierarchy!.width).toEqual(100); + expect(colsHierarchy.height).toEqual(60); + expect(axisColsHierarchy!.height).toEqual(50); + }); + + test('should render pivot chart with 2 level rows', async () => { + s2 = new PivotChartSheet( + container, + { + ...dataCfg, + fields: { + rows: ['province', 'city'], + columns: ['type', 'sub_type'], + values: ['number'], + valueInCols: false, + }, + }, + s2Options, + ); + + await s2.render(); + const { + rowsHierarchy, + axisRowsHierarchy, + colsHierarchy, + axisColsHierarchy, + } = s2.facet.getLayoutResult(); + + // 多个维度时,最后一个维度会被拆分到 axisRow 中 + expect(rowsHierarchy.width).toEqual(206); + // 默认情况,axis row cell 宽度固定为 100 + expect(axisRowsHierarchy!.width).toEqual(100); + + expect(colsHierarchy.height).toEqual(30); + // 默认情况下, axis col cell 高度固定为 50 + expect(axisColsHierarchy!.height).toEqual(50); + }); + + test('should render pivot chart with 3 level rows', async () => { + s2 = new PivotChartSheet( + container, + { + ...dataCfg, + fields: { + rows: ['province', 'city', 'type'], + columns: ['sub_type'], + values: ['number'], + valueInCols: false, + }, + }, + s2Options, + ); + + await s2.render(); + const { rowsHierarchy, axisRowsHierarchy, colLeafNodes } = + s2.facet.getLayoutResult(); + + // 多个维度时,最后一个维度会被拆分到 axisRow 中 + expect(rowsHierarchy.width).toEqual(264); + // 默认情况,axis row cell 宽度固定为 100 + expect(axisRowsHierarchy!.width).toEqual(100); + + // 列头只有一个维度,且数值置于行头时,列头会生成 placeholder 占位 + const leaf = head(colLeafNodes)!; + + expect(colLeafNodes).toHaveLength(1); + expect(leaf.field).toEqual(PLACEHOLDER_FIELD); + expect(leaf.value).toEqual('子类别'); + expect(leaf.width).toEqual(352); + expect(leaf.height).toEqual(30); + }); + + test('should render pivot chart with row totals', async () => { + s2 = new PivotChartSheet( + container, + { + ...dataCfg, + data: dataCfg.data.concat(dataCfg.totalData as any), + fields: { + rows: ['province', 'city', 'type', 'sub_type'], + columns: [], + values: ['number'], + valueInCols: true, + }, + }, + { + ...s2Options, + totals: { + row: { + showGrandTotals: true, + showSubTotals: true, + reverseGrandTotalsLayout: true, + reverseSubTotalsLayout: true, + subTotalsDimensions: ['province', 'city'], + grandTotalsGroupDimensions: ['city'], + subTotalsGroupDimensions: ['type'], + calcGrandTotals: { + aggregation: Aggregation.SUM, + }, + calcSubTotals: { + aggregation: Aggregation.SUM, + }, + }, + }, + }, + ); + + await s2.render(); + + const { rowNodes } = s2.facet.getLayoutResult(); + // 总计格子的横跨省份、城市、类别 + const grandTotalRoot = rowNodes.find((node) => node.id === 'root[&]总计'); + + expect(grandTotalRoot?.width).toEqual(600); + + // 省份的小计格子横跨城市和类别 + const subTotalRoot = rowNodes.find( + (node) => node.id === 'root[&]浙江省[&]小计', + ); + + expect(subTotalRoot?.width).toEqual(400); + }); + + test('should render pivot chart with cols totals', async () => { + s2 = new PivotChartSheet( + container, + { + ...dataCfg, + data: dataCfg.data.concat(dataCfg.totalData as any), + fields: { + rows: [], + columns: ['province', 'city', 'type', 'sub_type'], + values: ['number'], + valueInCols: false, + }, + }, + { + ...s2Options, + totals: { + col: { + showGrandTotals: true, + showSubTotals: true, + reverseGrandTotalsLayout: true, + reverseSubTotalsLayout: true, + subTotalsDimensions: ['province', 'city'], + grandTotalsGroupDimensions: ['city'], + subTotalsGroupDimensions: ['type'], + calcGrandTotals: { + aggregation: Aggregation.SUM, + }, + calcSubTotals: { + aggregation: Aggregation.SUM, + }, + }, + }, + }, + ); + + await s2.render(); + + const { colNodes } = s2.facet.getLayoutResult(); + // 总计格子的横跨列头区域 + const grandTotalRoot = colNodes.find((node) => node.id === 'root[&]总计'); + + expect(grandTotalRoot?.height).toEqual(90); + + // 省份的小计格子横跨城市和类别 + const subTotalRoot = colNodes.find( + (node) => node.id === 'root[&]浙江省[&]小计', + ); + + expect(subTotalRoot?.height).toEqual(60); + }); + }); + + describe('polar coordinate', () => { + const polarOptions: S2Options = { + ...s2Options, + chart: { + coordinate: 'polar', + dataCellSpec: { + type: 'interval', + transform: [{ type: 'stackY' }], + coordinate: { type: 'theta', outerRadius: 0.8 }, + }, + }, + }; + + test('should render pivot chart with 1 level row', async () => { + s2 = new PivotChartSheet( + container, + { + ...dataCfg, + fields: { + rows: ['province'], + columns: ['type', 'sub_type'], + values: ['number'], + valueInCols: true, + }, + }, + polarOptions, + ); + + await s2.render(); + + const { rowLeafNodes } = s2.facet.getLayoutResult(); + + // 只有一个维度时,因为是极坐标,所有会增加 placeholder 占位 + + const leaf = head(rowLeafNodes)!; + + expect(rowLeafNodes).toHaveLength(1); + expect(leaf.field).toEqual('province'); + expect(leaf.value).toEqual('省份'); + expect(leaf.width).toEqual(100); + expect(leaf.height).toEqual(200); + }); + + test('should render pivot chart with 2 level rows', async () => { + s2 = new PivotChartSheet( + container, + { + ...dataCfg, + fields: { + rows: ['province', 'city'], + columns: ['type', 'sub_type'], + values: ['number'], + valueInCols: false, + }, + }, + { + ...polarOptions, + style: { + layoutWidthType: 'compact', + }, + }, + ); + + await s2.render(); + const { axisRowsHierarchy, colsHierarchy, axisColsHierarchy } = + s2.facet.getLayoutResult(); + + // 默认情况,axis row cell 宽度固定为 100 + expect(axisRowsHierarchy!.width).toEqual(100); + + // 极坐标情况下,不展示坐标轴,而是按照原文字形式展示 + const axisRowCell = head((s2.facet as PivotChartFacet).getAxisRowCells()); + + expect(axisRowCell?.getActualText()).toEqual('数量'); + + expect(colsHierarchy.height).toEqual(30); + // 极坐标不展示单独坐标轴 + expect(axisColsHierarchy!.height).toEqual(0); + }); + + test('should render pivot chart with 3 level rows', async () => { + s2 = new PivotChartSheet( + container, + { + ...dataCfg, + fields: { + rows: ['province', 'city', 'type'], + columns: ['sub_type'], + values: ['number'], + valueInCols: false, + }, + }, + polarOptions, + ); + + await s2.render(); + const { colLeafNodes } = s2.facet.getLayoutResult(); + + // 列头只有一个维度,且数值置于行头时,列头会生成 placeholder 占位 + const leaf = head(colLeafNodes)!; + + expect(colLeafNodes).toHaveLength(1); + expect(leaf.field).toEqual(PLACEHOLDER_FIELD); + expect(leaf.value).toEqual('子类别'); + expect(leaf.width).toEqual(200); + expect(leaf.height).toEqual(30); + }); + + test('should render pivot chart with row totals', async () => { + s2 = new PivotChartSheet( + container, + { + ...dataCfg, + data: dataCfg.data.concat(dataCfg.totalData as any), + fields: { + rows: ['province', 'city', 'type', 'sub_type'], + columns: [], + values: ['number'], + valueInCols: true, + }, + }, + { + ...polarOptions, + totals: { + row: { + showGrandTotals: true, + showSubTotals: true, + reverseGrandTotalsLayout: true, + reverseSubTotalsLayout: true, + subTotalsDimensions: ['province', 'city'], + grandTotalsGroupDimensions: ['city'], + subTotalsGroupDimensions: ['type'], + calcGrandTotals: { + aggregation: Aggregation.SUM, + }, + calcSubTotals: { + aggregation: Aggregation.SUM, + }, + }, + }, + }, + ); + + await s2.render(); + + const { rowNodes } = s2.facet.getLayoutResult(); + // 总计格子的横跨省份和城市 + const grandTotalRoot = rowNodes.find((node) => node.id === 'root[&]总计'); + + expect(grandTotalRoot?.width).toEqual(600); + + // 省份的小计格子横跨城市和类别 + const subTotalRoot = rowNodes.find( + (node) => node.id === 'root[&]浙江省[&]小计', + ); + + expect(subTotalRoot?.width).toEqual(400); + }); + + test('should render pivot chart with cols totals', async () => { + s2 = new PivotChartSheet( + container, + { + ...dataCfg, + data: dataCfg.data.concat(dataCfg.totalData as any), + fields: { + rows: [], + columns: ['province', 'city', 'type', 'sub_type'], + values: ['number'], + valueInCols: false, + }, + }, + { + ...polarOptions, + totals: { + col: { + showGrandTotals: true, + showSubTotals: true, + reverseGrandTotalsLayout: true, + reverseSubTotalsLayout: true, + subTotalsDimensions: ['province', 'city'], + grandTotalsGroupDimensions: ['city'], + subTotalsGroupDimensions: ['type'], + calcGrandTotals: { + aggregation: Aggregation.SUM, + }, + calcSubTotals: { + aggregation: Aggregation.SUM, + }, + }, + }, + }, + ); + + await s2.render(); + + const { colNodes } = s2.facet.getLayoutResult(); + // 总计格子的横跨列头区域 + const grandTotalRoot = colNodes.find((node) => node.id === 'root[&]总计'); + + expect(grandTotalRoot?.height).toEqual(90); + + // 省份的小计格子横跨城市和类别 + const subTotalRoot = colNodes.find( + (node) => node.id === 'root[&]浙江省[&]小计', + ); + + expect(subTotalRoot?.height).toEqual(60); + }); + }); + + describe('layoutWithType', () => { + test('should render pivot chart with adaptive layout', async () => { + s2 = new PivotChartSheet(container, dataCfg, { + ...s2Options, + style: { + layoutWidthType: LayoutWidthType.Adaptive, + }, + }); + + await s2.render(); + + const { + rowsHierarchy, + axisRowsHierarchy, + colLeafNodes, + axisColsHierarchy, + } = s2.facet.getLayoutResult(); + + const rowSampleNodeWidths = rowsHierarchy.sampleNodesForAllLevels.map( + (node) => node.width, + ); + + const colLeafNodeWidths = colLeafNodes.map((node) => node.width); + + // 只有一个维度时,会被拆分到 axisRow 中 + expect(rowSampleNodeWidths).toEqual([200]); + expect(colLeafNodeWidths).toEqual([200, 200, 200, 200]); + expect(axisRowsHierarchy!.width).toEqual(100); + expect(axisColsHierarchy!.height).toEqual(50); + }); + test('should render pivot chart with colAdaptive layout', async () => { + s2 = new PivotChartSheet(container, dataCfg, { + ...s2Options, + style: { + layoutWidthType: LayoutWidthType.ColAdaptive, + }, + }); + + await s2.render(); + + const { + rowsHierarchy, + axisRowsHierarchy, + colLeafNodes, + axisColsHierarchy, + } = s2.facet.getLayoutResult(); + + const rowSampleNodeWidths = rowsHierarchy.sampleNodesForAllLevels.map( + (node) => node.width, + ); + + const colLeafNodeWidths = colLeafNodes.map((node) => node.width); + + // 只有一个维度时,会被拆分到 axisRow 中 + expect(rowSampleNodeWidths).toEqual([54]); + expect(colLeafNodeWidths).toEqual([200, 200, 200, 200]); + expect(axisRowsHierarchy!.width).toEqual(100); + expect(axisColsHierarchy!.height).toEqual(50); + }); + + test('should render pivot chart with compact layout', async () => { + s2 = new PivotChartSheet(container, dataCfg, { + ...s2Options, + style: { + layoutWidthType: LayoutWidthType.Compact, + }, + }); + + await s2.render(); + + const { + rowsHierarchy, + axisRowsHierarchy, + colLeafNodes, + axisColsHierarchy, + } = s2.facet.getLayoutResult(); + + const rowSampleNodeWidths = rowsHierarchy.sampleNodesForAllLevels.map( + (node) => node.width, + ); + + const colLeafNodeWidths = colLeafNodes.map((node) => node.width); + + // 只有一个维度时,会被拆分到 axisRow 中 + expect(rowSampleNodeWidths).toEqual([54]); + expect(colLeafNodeWidths).toEqual([200, 200, 200, 200]); + expect(axisRowsHierarchy!.width).toEqual(100); + expect(axisColsHierarchy!.height).toEqual(50); + }); + }); + + describe('formatter', () => { + test('should render pivot chart with formatter', async () => { + s2 = new PivotChartSheet( + container, + { + ...dataCfg, + meta: [ + { + field: 'city', + name: '城市', + formatter: (v) => `[[${v}]]`, + }, + { + field: 'number', + name: '数量', + description: '数量说明。。', + formatter: (v: number) => v.toFixed(2), + }, + ], + }, + { + ...s2Options, + totals: { + row: { + showGrandTotals: true, + showSubTotals: true, + reverseGrandTotalsLayout: true, + reverseSubTotalsLayout: true, + subTotalsDimensions: ['province'], + calcGrandTotals: { + aggregation: Aggregation.SUM, + }, + calcSubTotals: { + aggregation: Aggregation.SUM, + }, + }, + }, + }, + ); + + await s2.render(); + + await sleep(3000); + + // row axis formatter + const rowCell = (s2.facet as PivotChartFacet).getAxisRowCells()[1]; + const rowAxisOptions = rowCell?.getChartOptions(); + const domain = get(rowAxisOptions, 'scale.x.domain'); + + expect(domain).toEqual([ + '小计', + '[[杭州市]]', + '[[绍兴市]]', + '[[宁波市]]', + '[[舟山市]]', + ]); + + // col axis formatter + const colCell = (s2.facet as PivotChartFacet).getAxisColCells()[0]; + const colAxisOptions = colCell?.getChartOptions(); + const formatter = get(colAxisOptions, 'labelFormatter'); + + expect(formatter(4000)).toEqual('4000.00'); + + // tooltip formatter + await sleep(3000); + + const canvas = s2.getCanvasElement(); + const bbox = canvas.getBoundingClientRect(); + + let mousemoveEvent = new MouseEvent(OriginEventType.POINTER_MOVE, { + clientX: bbox.left + 460, + clientY: bbox.top + 150, + }); + + canvas.dispatchEvent(mousemoveEvent); + + expect( + document.querySelector('.g2-tooltip-title')!.innerText, + ).toEqual('小计'); + + expect( + document.querySelector('.g2-tooltip-list')!.innerText, + ).toEqual('数量\n18375.00'); + + await sleep(3000); + + mousemoveEvent = new MouseEvent(OriginEventType.POINTER_MOVE, { + clientX: bbox.left + 460, + clientY: bbox.top + 200, + }); + + canvas.dispatchEvent(mousemoveEvent); + + expect( + document.querySelector('.g2-tooltip-title')!.innerText, + ).toEqual('[[杭州市]]'); + + expect( + document.querySelector('.g2-tooltip-list')!.innerText, + ).toEqual('数量\n7789.00'); + }); + }); + + describe('frozen', () => { + function expectFrozenGroup(s2: PivotChartSheet, headerName: string) { + const pickCoordinate = pickMap(['id', 'x', 'y', 'width', 'height']); + + const actualHead = pickCoordinate( + map(s2.facet[headerName]?.frozenGroup.children, 'meta'), + ); + + expect(actualHead).toMatchSnapshot(); + + const actualTrailing = pickCoordinate( + map(s2.facet[headerName]?.frozenTrailingGroup.children, 'meta'), + ); + + expect(actualTrailing).toMatchSnapshot(); + } + + function getFrozenGroupPosition(s2: PivotChartSheet, headerName: string) { + return [ + s2.facet[headerName]?.frozenGroup.getPosition().map(Math.floor), + s2.facet[headerName]?.frozenTrailingGroup.getPosition().map(Math.floor), + ]; + } + const options = { + ...s2Options, + width: 1000, + totals: { + row: { + showGrandTotals: true, + showSubTotals: true, + reverseGrandTotalsLayout: true, + reverseSubTotalsLayout: true, + subTotalsDimensions: ['province'], + calcGrandTotals: { + aggregation: Aggregation.SUM, + }, + calcSubTotals: { + aggregation: Aggregation.SUM, + }, + }, + }, + }; + + test('should render pivot chart with frozen', async () => { + s2 = new PivotChartSheet(container, dataCfg, { + ...options, + frozen: { + rowCount: 1, + trailingRowCount: 1, + colCount: 1, + trailingColCount: 1, + }, + }); + + await s2.render(); + + expect((s2.facet as FrozenFacet).frozenGroupAreas).toMatchObject({ + frozenCol: { + width: 200, + x: 0, + range: [0, 0], + }, + frozenTrailingCol: { + width: 200, + x: 600, + range: [3, 3], + }, + frozenRow: { + height: 50, + y: 0, + range: [0, 0], + }, + frozenTrailingRow: { + height: 250, + y: 300, + range: [2, 2], + }, + }); + + expectFrozenGroup(s2, 'rowHeader'); + expectFrozenGroup(s2, 'axisRowHeader'); + expectFrozenGroup(s2, 'colHeader'); + expectFrozenGroup(s2, 'axisColumnHeader'); + }); + + test('should render pivot chart with frozen but row header', async () => { + s2 = new PivotChartSheet(container, dataCfg, { + ...options, + style: { + colCell: { + widthByField: { [EXTRA_FIELD]: 300 }, + }, + }, + frozen: { + rowHeader: false, + colCount: 1, + trailingColCount: 1, + }, + }); + + await s2.render(); + + expect((s2.facet as FrozenFacet).frozenGroupAreas).toMatchObject({ + frozenCol: { + width: 300, + x: 0, + range: [0, 0], + }, + frozenTrailingCol: { + width: 300, + x: 900, + range: [3, 3], + }, + frozenRow: { + height: 0, + y: 0, + range: [], + }, + frozenTrailingRow: { + height: 0, + y: 0, + range: [], + }, + }); + + expectFrozenGroup(s2, 'columnHeader'); + expectFrozenGroup(s2, 'axisColumnHeader'); + let prevCol = getFrozenGroupPosition(s2, 'columnHeader'); + let prevAxisCol = getFrozenGroupPosition(s2, 'axisColumnHeader'); + + s2.interaction.scrollTo({ offsetX: { value: 100, animate: false } }); + // 移动后,frozen col 会改变 而 trailing col 的位置不变 + let currentCol = getFrozenGroupPosition(s2, 'columnHeader'); + let currentAxisCol = getFrozenGroupPosition(s2, 'axisColumnHeader'); + + expect(currentCol[0]?.[0]).toEqual(prevCol[0]?.[0]! - 100); + expect(currentCol[1]).toEqual(prevCol[1]); + + expect(currentAxisCol[0]?.[0]).toEqual(prevAxisCol[0]?.[0]! - 100); + expect(currentAxisCol[1]).toEqual(prevAxisCol[1]); + + // 移动超过角头宽度 + // 移动后,frozen col 和 trailing col 的位置都不变 + s2.interaction.scrollTo({ offsetX: { value: 400, animate: false } }); + prevCol = getFrozenGroupPosition(s2, 'columnHeader'); + prevAxisCol = getFrozenGroupPosition(s2, 'axisColumnHeader'); + + s2.interaction.scrollTo({ offsetX: { value: 400, animate: false } }); + + currentCol = getFrozenGroupPosition(s2, 'columnHeader'); + currentAxisCol = getFrozenGroupPosition(s2, 'axisColumnHeader'); + + expect(currentCol).toEqual(prevCol); + expect(currentCol).toEqual([ + [2, 0, 0], + [-200, 0, 0], + ]); + + expect(currentAxisCol).toEqual(prevAxisCol); + expect(currentAxisCol).toEqual([ + [2, 612, 0], + [-200, 612, 0], + ]); + }); + }); + + describe('interaction', () => { + test('should render axis resize area', async () => { + s2 = new PivotChartSheet(container, dataCfg, s2Options); + await s2.render(); + + const group = s2.facet.foregroundGroup; + + expect( + group.getElementById(KEY_GROUP_ROW_AXIS_RESIZE_AREA), + ).not.toBeNull(); + expect( + group.getElementById(KEY_GROUP_COL_AXIS_RESIZE_AREA), + ).not.toBeNull(); + }); + + test('should render axis resize area with polar coordinate', async () => { + s2 = new PivotChartSheet(container, dataCfg, { + ...s2Options, + chart: { + coordinate: 'polar', + }, + }); + await s2.render(); + + const group = s2.facet.foregroundGroup; + + expect(group.getElementById(KEY_GROUP_ROW_AXIS_RESIZE_AREA)).toBeNull(); + expect( + group.getElementById(KEY_GROUP_COL_AXIS_RESIZE_AREA), + ).not.toBeNull(); + }); + + test('should throw error when call asyncGetAllPlainData', async () => { + s2 = new PivotChartSheet(container, dataCfg, s2Options); + await s2.render(); + + expect.assertions(1); + + try { + await asyncGetAllPlainData({ + sheetInstance: s2, + split: TAB_SEPARATOR, + formatOptions: true, + }); + } catch (e) { + // eslint-disable-next-line jest/no-conditional-expect + expect(e.message).toEqual( + "pivot chart doesn't support export all data", + ); + } + }); + }); + + describe('style', () => { + test('should match theme color', async () => { + s2 = new PivotChartSheet(container, dataCfg, s2Options); + s2.setThemeCfg({ name: 'dark' }); + await s2.render(); + expect(s2.theme.axisCornerCell).toEqual(s2.theme.cornerCell); + expect(s2.theme.axisRowCell).toEqual(s2.theme.rowCell); + expect(omit(s2.theme.axisColCell, ['measureText'])).toEqual( + omit(s2.theme.colCell, ['measureText']), + ); + expect(omit(s2.theme.axisColCell.measureText, ['textAlign'])).toEqual( + omit(s2.theme.colCell.measureText, ['textAlign']), + ); + expect(s2.theme.axisColCell.measureText.textAlign).toEqual('center'); + }); + }); +}); diff --git a/packages/s2-core/__tests__/spreadsheet/scroll-spec.ts b/packages/s2-core/__tests__/spreadsheet/scroll-spec.ts index 8d7fe29277..5502548bcd 100644 --- a/packages/s2-core/__tests__/spreadsheet/scroll-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/scroll-spec.ts @@ -462,7 +462,7 @@ describe('Scroll Tests', () => { expect((sheet.facet as any).emitScrollEvent).not.toHaveBeenCalled(); }); - test('should render correct scroll position', async () => { + test('should render correct scroll position for compact mode', async () => { s2.setOptions({ interaction: { scrollbarPosition: ScrollbarPositionType.CONTENT, @@ -480,7 +480,7 @@ describe('Scroll Tests', () => { s2.changeSheetSize(1000, 150); // 纵向滚动条 await s2.render(false); - expect(Math.floor(s2.facet.vScrollBar.getBBox().x)).toEqual(195); + expect(Math.floor(s2.facet.vScrollBar.getBBox().x)).toEqual(213); s2.setOptions({ interaction: { @@ -536,9 +536,11 @@ describe('Scroll Tests', () => { s2.interaction.scrollTo({ offsetX: { value: 999, + animate: false, }, offsetY: { value: 999, + animate: false, }, }); @@ -977,7 +979,9 @@ describe('Scroll Tests', () => { }); test('should scroll to cell by id', async () => { - s2.interaction.scrollToCellById('root[&]浙江[&]杭州-root[&]笔[&]price'); + s2.interaction.scrollToCellById('root[&]浙江[&]杭州-root[&]笔[&]price', { + animate: false, + }); await sleep(500); @@ -986,7 +990,7 @@ describe('Scroll Tests', () => { }); test('should scroll to cell by id when cell outside of viewport', async () => { - s2.interaction.scrollToCellById('root[&]浙江[&]杭州'); + s2.interaction.scrollToCellById('root[&]浙江[&]杭州', { animate: false }); await sleep(500); @@ -996,7 +1000,7 @@ describe('Scroll Tests', () => { test('should scroll to cell', async () => { const dataCell = last(s2.facet.getDataCells()); - s2.interaction.scrollToCell(dataCell!); + s2.interaction.scrollToCell(dataCell!, { animate: false }); await sleep(500); @@ -1007,7 +1011,7 @@ describe('Scroll Tests', () => { test('should scroll to node', async () => { const rowNode = last(s2.facet.getRowNodes()); - s2.interaction.scrollToNode(rowNode!); + s2.interaction.scrollToNode(rowNode!, { animate: false }); await sleep(500); @@ -1016,27 +1020,27 @@ describe('Scroll Tests', () => { }); test('should scroll to top', async () => { - s2.interaction.scrollTo({ offsetY: { value: 10 } }); + s2.interaction.scrollTo({ offsetY: { value: 10, animate: false } }); await sleep(100); - s2.interaction.scrollToTop(); + s2.interaction.scrollToTop({ animate: false }); await sleep(500); expect(s2.facet.hScrollBar.thumbOffset).toBeCloseTo(0); expect(s2.facet.vScrollBar.thumbOffset).toBeCloseTo(0); }); test('should scroll to left', async () => { - s2.interaction.scrollTo({ offsetX: { value: 10 } }); + s2.interaction.scrollTo({ offsetX: { value: 10, animate: false } }); await sleep(100); - s2.interaction.scrollToLeft(); + s2.interaction.scrollToLeft({ animate: false }); await sleep(500); expect(s2.facet.hScrollBar.thumbOffset).toBeCloseTo(0); expect(s2.facet.vScrollBar.thumbOffset).toBeCloseTo(0); }); test('should scroll to bottom', async () => { - s2.interaction.scrollToBottom(false); + s2.interaction.scrollToBottom({ animate: false }); await sleep(500); @@ -1045,7 +1049,7 @@ describe('Scroll Tests', () => { }); test('should scroll to right', async () => { - s2.interaction.scrollToRight(false); + s2.interaction.scrollToRight({ animate: false }); await sleep(500); @@ -1059,22 +1063,22 @@ describe('Scroll Tests', () => { expectScroll(); }); - test('should not trigger scroll event when options changed', () => { + test('should not trigger scroll event when options changed', async () => { const expectScroll = getScrollExpect(); s2.setOptions({ hierarchyType: 'tree', }); - s2.render(); + await s2.render(false); expectScroll(); }); - test('should not trigger scroll event when data config changed', () => { + test('should not trigger scroll event when data config changed', async () => { const expectScroll = getScrollExpect(); s2.setDataCfg(cloneDeep(mockDataConfig)); - s2.render(); + await s2.render(false); expectScroll(); }); @@ -1092,26 +1096,33 @@ describe('Scroll Tests', () => { skipScrollEvent: true, rowHeaderOffsetX: { value: 999, + animate: false, }, offsetX: { value: 999, + animate: false, }, offsetY: { value: 999, + animate: false, }, }); s2.interaction.scrollToLeft({ skipScrollEvent: true, + animate: false, }); s2.interaction.scrollToTop({ skipScrollEvent: true, + animate: false, }); s2.interaction.scrollToRight({ skipScrollEvent: true, + animate: false, }); s2.interaction.scrollToBottom({ skipScrollEvent: true, + animate: false, }); await sleep(500); diff --git a/packages/s2-core/__tests__/spreadsheet/spread-sheet-spec.ts b/packages/s2-core/__tests__/spreadsheet/spread-sheet-spec.ts index d72405af4c..903adf6fce 100644 --- a/packages/s2-core/__tests__/spreadsheet/spread-sheet-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/spread-sheet-spec.ts @@ -155,7 +155,7 @@ describe('SpreadSheet Tests', () => { expect(s2.facet.hScrollBar.current()).toEqual(0); s2.interaction.scrollTo({ - offsetX: { value: 30 }, + offsetX: { value: 30, animate: false }, }); await sleep(500); @@ -182,7 +182,7 @@ describe('SpreadSheet Tests', () => { await s2.render(); s2.interaction.scrollTo({ - offsetY: { value: 20 }, + offsetY: { value: 20, animate: false }, }); await sleep(500); @@ -219,7 +219,7 @@ describe('SpreadSheet Tests', () => { `); s2.interaction.scrollTo({ - rowHeaderOffsetX: { value: 30 }, + rowHeaderOffsetX: { value: 30, animate: false }, }); await sleep(500); @@ -249,9 +249,9 @@ describe('SpreadSheet Tests', () => { await s2.render(); s2.interaction.scrollTo({ - offsetY: { value: 20 }, - offsetX: { value: 30 }, - rowHeaderOffsetX: { value: 40 }, + offsetY: { value: 20, animate: false }, + offsetX: { value: 30, animate: false }, + rowHeaderOffsetX: { value: 40, animate: false }, }); await sleep(500); diff --git a/packages/s2-core/__tests__/spreadsheet/table-sheet-spec.ts b/packages/s2-core/__tests__/spreadsheet/table-sheet-spec.ts index c3a8e156dd..846c895c5e 100644 --- a/packages/s2-core/__tests__/spreadsheet/table-sheet-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/table-sheet-spec.ts @@ -211,7 +211,8 @@ describe('TableSheet normal spec', () => { s2.destroy(); }); - test('should be able to resize last column', async () => { + // 测试不稳定, 先屏蔽 + test.skip('should be able to resize last column', async () => { const s2 = new TableSheet(getContainer(), dataCfg, options); await s2.render(); @@ -429,5 +430,30 @@ describe('TableSheet normal spec', () => { await expectEmptyPlaceholder(s2); }); + + test('should not render empty placeholder if all fields is empty', async () => { + const s2 = new TableSheet( + getContainer(), + { ...dataCfg, fields: {}, data: [] }, + { + ...options, + frozen: {}, + seriesNumber: { + enable: false, + }, + }, + ); + + await s2.render(); + const [rect, icon, text] = (s2.facet as TableFacet).emptyPlaceholderGroup + .children; + + expect( + (s2.facet as TableFacet).emptyPlaceholderGroup.children, + ).toHaveLength(0); + expect(rect).not.toBeDefined(); + expect(icon).not.toBeDefined(); + expect(text).not.toBeDefined(); + }); }); }); diff --git a/packages/s2-core/__tests__/spreadsheet/tooltip-spec.ts b/packages/s2-core/__tests__/spreadsheet/tooltip-spec.ts index 531a477fda..2cf0d00d6c 100644 --- a/packages/s2-core/__tests__/spreadsheet/tooltip-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/tooltip-spec.ts @@ -1,4 +1,5 @@ import type { S2Options } from '@/common/interface'; +import { DARK_THEME_CLS } from '@antv/s2'; import { createPivotSheet } from 'tests/util/helpers'; const s2Options: S2Options = { @@ -106,4 +107,19 @@ describe('Tooltip Tests', () => { s2.destroy(); }); + + test('should render dark theme tooltip style', async () => { + const s2 = createS2({ enable: true }); + + s2.setThemeCfg({ + name: 'dark', + }); + + await s2.render(); + s2.showTooltip({ position: { x: 0, y: 0 } }); + + expect(document.querySelector(`body > .${DARK_THEME_CLS}`)).toBeTruthy(); + + s2.destroy(); + }); }); diff --git a/packages/s2-core/__tests__/unit/cell/__snapshots__/data-cell-spec.ts.snap b/packages/s2-core/__tests__/unit/cell/__snapshots__/data-cell-spec.ts.snap deleted file mode 100644 index 1c3989532b..0000000000 --- a/packages/s2-core/__tests__/unit/cell/__snapshots__/data-cell-spec.ts.snap +++ /dev/null @@ -1,57 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Data Cell Tests Data Cell Formatter & Method Tests should get empty chart data and default options 1`] = ` -Object { - "autoFit": true, - "height": 83, - "theme": Object { - "type": "light", - }, - "width": 83, - "x": NaN, - "y": NaN, -} -`; - -exports[`Data Cell Tests Data Cell Formatter & Method Tests should get multiple chart data and all options 1`] = ` -Object { - "autoFit": true, - "data": Array [ - Object { - "genre": "Sports", - "sold": 275, - }, - ], - "encode": Object { - "color": "genre", - "x": "genre", - "y": "sold", - }, - "type": "interval", -} -`; - -exports[`Data Cell Tests Data Cell Formatter & Method Tests should get multiple chart data and all options 2`] = ` -Object { - "autoFit": true, - "data": Array [ - Object { - "genre": "Sports", - "sold": 275, - }, - ], - "encode": Object { - "color": "genre", - "x": "genre", - "y": "sold", - }, - "height": 83, - "theme": Object { - "type": "dark", - }, - "type": "interval", - "width": 83, - "x": 8, - "y": 208, -} -`; diff --git a/packages/s2-core/__tests__/unit/cell/data-cell-spec.ts b/packages/s2-core/__tests__/unit/cell/data-cell-spec.ts index 2f40170167..562dbff832 100644 --- a/packages/s2-core/__tests__/unit/cell/data-cell-spec.ts +++ b/packages/s2-core/__tests__/unit/cell/data-cell-spec.ts @@ -146,9 +146,6 @@ describe('Data Cell Tests', () => { const dataCell = new DataCell(meta, s2); expect(dataCell.isMultiData()).toBeFalsy(); - expect(dataCell.isChartData()).toBeFalsy(); - expect(dataCell.getRenderChartData()).toBeUndefined(); - expect(dataCell.getRenderChartOptions()).toMatchSnapshot(); }); test('should get correctly cell data status', () => { @@ -161,7 +158,6 @@ describe('Data Cell Tests', () => { const dataCell = new DataCell(multipleMeta, s2); expect(dataCell.isMultiData()).toBeTruthy(); - expect(dataCell.isChartData()).toBeFalsy(); }); test('should get multiple chart data and all options', () => { @@ -195,9 +191,6 @@ describe('Data Cell Tests', () => { const dataCell = new DataCell(multipleMeta, s2); expect(dataCell.isMultiData()).toBeTruthy(); - expect(dataCell.isChartData()).toBeTruthy(); - expect(dataCell.getRenderChartData()).toMatchSnapshot(); - expect(dataCell.getRenderChartOptions()).toMatchSnapshot(); }); }); @@ -662,7 +655,7 @@ describe('Data Cell Tests', () => { (cell: S2CellType) => cell.cellType === CellType.COL_CELL, ); - expect(interactedCells.length).toBe(8); + expect(interactedCells.length).toBe(7); expect(firstColCell!.getMeta().id).toBe(mockCell.getMeta().id); }); diff --git a/packages/s2-core/__tests__/unit/data-set/custom-tree-data-set-spec.ts b/packages/s2-core/__tests__/unit/data-set/custom-grid-data-set-spec.ts similarity index 85% rename from packages/s2-core/__tests__/unit/data-set/custom-tree-data-set-spec.ts rename to packages/s2-core/__tests__/unit/data-set/custom-grid-data-set-spec.ts index 4c7a8110f3..fe6cdf9f83 100644 --- a/packages/s2-core/__tests__/unit/data-set/custom-tree-data-set-spec.ts +++ b/packages/s2-core/__tests__/unit/data-set/custom-grid-data-set-spec.ts @@ -3,11 +3,12 @@ */ import { EXTRA_FIELD, ORIGIN_FIELD } from '@/common/constant'; import type { S2DataConfig } from '@/common/interface'; -import { CustomTreePivotDataSet } from '@/data-set/custom-tree-pivot-data-set'; +import { CustomGridPivotDataSet } from '@/data-set/custom-grid-pivot-data-set'; import { PivotSheet } from '@/sheet-type'; import { get } from 'lodash'; import { customTreeNodes } from 'tests/data/custom-tree-nodes'; import { CustomTreeData } from 'tests/data/data-custom-tree'; +import { Store } from '../../../src'; jest.mock('@/sheet-type'); @@ -15,7 +16,7 @@ jest.mock('@/interaction/root'); const MockPivotSheet = PivotSheet as unknown as jest.Mock; -describe('Custom Tree Dataset Test', () => { +describe('Custom Grid Dataset Test', () => { const values = [ 'measure-a', 'measure-b', @@ -35,14 +36,21 @@ describe('Custom Tree Dataset Test', () => { }, }; - const mockSheet = new MockPivotSheet(); - const dataSet = new CustomTreePivotDataSet(mockSheet); + let dataSet: CustomGridPivotDataSet; - dataSet.setDataCfg(dataCfg); + beforeEach(() => { + const mockSheet = new MockPivotSheet(); + + mockSheet.isCustomRowFields = () => true; + mockSheet.store = new Store(); + + dataSet = new CustomGridPivotDataSet(mockSheet); + dataSet.setDataCfg(dataCfg); + }); describe('test base dataset structure', () => { test('should get correct field data', () => { - expect(dataSet.fields.rows).toEqual([EXTRA_FIELD]); + expect(dataSet.fields.rows).toEqual([...customTreeNodes, EXTRA_FIELD]); expect(dataSet.fields.columns).toEqual(['type', 'sub_type']); expect(dataSet.fields.values).toEqual(values); }); diff --git a/packages/s2-core/__tests__/unit/data-set/pivot-data-set-spec.ts b/packages/s2-core/__tests__/unit/data-set/pivot-data-set-spec.ts index f9ae37178e..55568e80e5 100644 --- a/packages/s2-core/__tests__/unit/data-set/pivot-data-set-spec.ts +++ b/packages/s2-core/__tests__/unit/data-set/pivot-data-set-spec.ts @@ -26,6 +26,7 @@ import { totalData as drillDownTotalData, } from 'tests/data/mock-drill-down-dataset.json'; import { assembleDataCfg } from 'tests/util'; +import { EMPTY_FIELD_VALUE } from '../../../src'; jest.mock('@/sheet-type'); @@ -510,6 +511,7 @@ describe('Pivot Dataset Test', () => { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore expect(dataSet.getFieldName(['1'])).toEqual(['1']); + expect(dataSet.getFieldName(EMPTY_FIELD_VALUE)).toStrictEqual('-'); }); test('should return correct field meta', () => { diff --git a/packages/s2-core/__tests__/unit/facet/bbox/corner-bbox-spec.ts b/packages/s2-core/__tests__/unit/facet/bbox/corner-bbox-spec.ts index 229ef9cde7..9afc3e9c23 100644 --- a/packages/s2-core/__tests__/unit/facet/bbox/corner-bbox-spec.ts +++ b/packages/s2-core/__tests__/unit/facet/bbox/corner-bbox-spec.ts @@ -22,6 +22,9 @@ describe('cornerBBox test', () => { getLayoutResult() { return layoutResult; }, + getCellCustomSize() { + return 20; + }, getSeriesNumberWidth() { return 80; }, @@ -40,6 +43,7 @@ describe('cornerBBox test', () => { }, }, }, + facet: mockFacet, }, } as unknown as BaseFacet; }); diff --git a/packages/s2-core/__tests__/unit/facet/layout/col-node-width-spec.ts b/packages/s2-core/__tests__/unit/facet/layout/col-node-width-spec.ts index 49dab0bdf0..3dc217914d 100644 --- a/packages/s2-core/__tests__/unit/facet/layout/col-node-width-spec.ts +++ b/packages/s2-core/__tests__/unit/facet/layout/col-node-width-spec.ts @@ -80,7 +80,7 @@ describe('Col width Test', () => { // 无 formatter - expect(Math.round(s2.facet.getColLeafNodes()[0].width)).toBe(78); + expect(Math.round(s2.facet.getColLeafNodes()[0].width)).toBe(80); }); test('get correct width in layoutWidthType compact mode when apply formatter', async () => { @@ -103,7 +103,7 @@ describe('Col width Test', () => { // 有formatter - expect(Math.round(s2.facet.getColLeafNodes()[0].width)).toBe(62); + expect(Math.round(s2.facet.getColLeafNodes()[0].width)).toBe(64); }); }); @@ -138,7 +138,7 @@ describe('Col width Test', () => { const colLeafNodes = s2.facet.getColLeafNodes(); // price 列,列头标签比表身数据更长 - expect(Math.round(colLeafNodes[0].width)).toBe(46); + expect(Math.round(colLeafNodes[0].width)).toBe(52); // cost 列,表身数据比列头更长(格式化) expect(Math.round(colLeafNodes[1].width)).toBe(168); }); diff --git a/packages/s2-core/__tests__/unit/facet/layout/node-spec.ts b/packages/s2-core/__tests__/unit/facet/layout/node-spec.ts index e6735e5e24..35e0dbc7e3 100644 --- a/packages/s2-core/__tests__/unit/facet/layout/node-spec.ts +++ b/packages/s2-core/__tests__/unit/facet/layout/node-spec.ts @@ -4,20 +4,17 @@ import { SERIES_NUMBER_FIELD } from '../../../../src'; describe('Node Test', () => { const root = new Node({ id: 'root', - key: 'root', value: 'root', children: [], }); const child = new Node({ id: 'child', - key: 'child', value: 'child', isLeaf: true, children: [], }); const node = new Node({ id: 'root[&]country', - key: '', value: '', field: 'country', parent: root, @@ -46,7 +43,7 @@ describe('Node Test', () => { }); test('#getHeadLeafChild()', () => { - expect(node.getHeadLeafChild().id).toEqual('child'); + expect(node.getHeadLeafChild()?.id).toEqual('child'); }); test('#getTotalHeightForTreeHierarchy()', () => { diff --git a/packages/s2-core/__tests__/unit/facet/pivot-facet-spec.ts b/packages/s2-core/__tests__/unit/facet/pivot-facet-spec.ts index 06878d82d3..fd6132b9b1 100644 --- a/packages/s2-core/__tests__/unit/facet/pivot-facet-spec.ts +++ b/packages/s2-core/__tests__/unit/facet/pivot-facet-spec.ts @@ -4,8 +4,8 @@ import { CornerCell, DataCell } from '@/cell'; import { DEFAULT_OPTIONS, + DEFAULT_ROW_CELL_TREE_WIDTH, DEFAULT_STYLE, - DEFAULT_TREE_ROW_CELL_WIDTH, } from '@/common/constant/options'; import type { ViewMeta } from '@/common/interface/basic'; import { Store } from '@/common/store'; @@ -88,6 +88,7 @@ jest.mock('@/sheet-type', () => { getCellRange: jest.fn().mockReturnValue({ start: 0, end: 100 }), cornerBBox: {}, getHeaderNodes: jest.fn().mockReturnValue([]), + measureTextWidth: jest.fn(), }, getCanvasElement: () => container.getContextService().getDomElement() as HTMLCanvasElement, @@ -98,6 +99,8 @@ jest.mock('@/sheet-type', () => { }, measureTextWidth: jest.fn() as unknown as SpreadSheet['measureTextWidth'], + measureTextWidthRoughly: + jest.fn() as unknown as SpreadSheet['measureTextWidthRoughly'], getSeriesNumberText: jest.fn(() => getDefaultSeriesNumberText()), }; }), @@ -258,11 +261,11 @@ describe('Pivot Mode Facet Test', () => { expect(rowsHierarchy.getLeaves()).toHaveLength(8); expect(rowsHierarchy.getNodes()).toHaveLength(10); - expect(rowsHierarchy.width).toBe(DEFAULT_TREE_ROW_CELL_WIDTH); + expect(rowsHierarchy.width).toBe(DEFAULT_ROW_CELL_TREE_WIDTH); expect(rowCell?.width).toBeUndefined(); rowsHierarchy.getNodes().forEach((node, index) => { - expect(node.width).toBe(DEFAULT_TREE_ROW_CELL_WIDTH); + expect(node.width).toBe(DEFAULT_ROW_CELL_TREE_WIDTH); expect(node.height).toBe(dataCell!.height!); expect(node.x).toBe(0); expect(node.y).toBe(node.height * index); diff --git a/packages/s2-core/__tests__/unit/facet/table-facet-spec.ts b/packages/s2-core/__tests__/unit/facet/table-facet-spec.ts index 985733b6c0..224dbf6c6d 100644 --- a/packages/s2-core/__tests__/unit/facet/table-facet-spec.ts +++ b/packages/s2-core/__tests__/unit/facet/table-facet-spec.ts @@ -61,6 +61,7 @@ jest.mock('@/sheet-type', () => { getColNodeHeight: jest.fn(), getHeaderNodes: jest.fn().mockReturnValue([]), getCellMeta: jest.fn().mockRejectedValue({}), + measureTextWidth: jest.fn(), }, dataSet: { isEmpty: jest.fn(), @@ -281,16 +282,16 @@ describe('Table Mode Facet Test With Compact Layout', () => { ); test('col hierarchy coordinate with compact layout', () => { - const COMPACT_WIDTH = [73, 73, 73, 73, 73]; + const COMPACT_WIDTH = 74; let lastX = 0; - facet.getColLeafNodes().forEach((node, index) => { + facet.getColLeafNodes().forEach((node) => { expect(node.y).toBe(0); expect(node.x).toBe(lastX); - expect(Math.floor(node.width)).toEqual(COMPACT_WIDTH[index]); + expect(Math.floor(node.width)).toEqual(COMPACT_WIDTH); expect(node.height).toBe(s2.options!.style!.colCell!.height); - lastX += COMPACT_WIDTH[index]; + lastX += COMPACT_WIDTH; }); }); }); @@ -334,7 +335,7 @@ describe('Table Mode Facet Test With Compact Layout', () => { const { colCell } = s2.options.style!; test('col hierarchy coordinate with compact layout with seriesNumber', () => { - const COMPACT_WIDTH = [80, 73, 73, 73, 73, 73]; + const COMPACT_WIDTH = [80, 74, 74, 74, 74, 74]; let lastX = 0; diff --git a/packages/s2-core/__tests__/unit/interaction/__snapshots__/root-spec.ts.snap b/packages/s2-core/__tests__/unit/interaction/__snapshots__/root-spec.ts.snap index de6f9b9a77..a046ca7ec2 100644 --- a/packages/s2-core/__tests__/unit/interaction/__snapshots__/root-spec.ts.snap +++ b/packages/s2-core/__tests__/unit/interaction/__snapshots__/root-spec.ts.snap @@ -23,6 +23,8 @@ Object { } `; +exports[`RootInteraction Tests should register default interaction 1`] = `Object {}`; + exports[`RootInteraction Tests should selected header cell 1`] = ` Object { "cells": Array [ diff --git a/packages/s2-core/__tests__/unit/interaction/__snapshots__/row-column-resize-spec.ts.snap b/packages/s2-core/__tests__/unit/interaction/__snapshots__/row-column-resize-spec.ts.snap index f836cf3c9f..2a0c9930ef 100644 --- a/packages/s2-core/__tests__/unit/interaction/__snapshots__/row-column-resize-spec.ts.snap +++ b/packages/s2-core/__tests__/unit/interaction/__snapshots__/row-column-resize-spec.ts.snap @@ -3,7 +3,6 @@ exports[`Interaction Row Column Resize Tests should get horizontal filed resize style by field for all resize type and table mode 1`] = ` Object { "height": 30, - "heightByField": null, "maxLines": 1, "textOverflow": "ellipsis", "width": 5, @@ -17,7 +16,6 @@ Object { exports[`Interaction Row Column Resize Tests should get horizontal filed resize style by field for current resize type 1`] = ` Object { "height": 30, - "heightByField": null, "maxLines": 1, "textOverflow": "ellipsis", "width": undefined, @@ -31,7 +29,6 @@ Object { exports[`Interaction Row Column Resize Tests should get horizontal filed resize style by field for current resize type and table mode 1`] = ` Object { "height": 30, - "heightByField": null, "maxLines": 1, "textOverflow": "ellipsis", "width": undefined, @@ -45,7 +42,6 @@ Object { exports[`Interaction Row Column Resize Tests should get horizontal filed resize style by field for selected resize type 1`] = ` Object { "height": 30, - "heightByField": null, "maxLines": 1, "textOverflow": "ellipsis", "width": undefined, @@ -60,7 +56,6 @@ Object { exports[`Interaction Row Column Resize Tests should get multiple horizontal filed resize style by field for selected resize type 1`] = ` Object { "height": 30, - "heightByField": null, "maxLines": 1, "textOverflow": "ellipsis", "width": undefined, @@ -82,7 +77,6 @@ Object { "maxLines": 1, "showTreeLeafNodeAlignDot": false, "textOverflow": "ellipsis", - "widthByField": null, "wordWrap": true, } `; @@ -96,7 +90,6 @@ Object { "maxLines": 1, "showTreeLeafNodeAlignDot": false, "textOverflow": "ellipsis", - "widthByField": null, "wordWrap": true, } `; @@ -104,10 +97,8 @@ Object { exports[`Interaction Row Column Resize Tests should get vertical cell resize style 2`] = ` Object { "height": 30, - "heightByField": null, "maxLines": 1, "textOverflow": "ellipsis", - "widthByField": null, "wordWrap": true, } `; @@ -122,6 +113,35 @@ Object { } `; +exports[`Interaction Row Column Resize Tests should get vertical custom filed resize style 1`] = ` +Object { + "height": 30, + "heightByField": Object { + "test-a": 2, + "test-b": 2, + }, + "maxLines": Infinity, + "maxLinesByField": Object { + "test-a": 1, + "test-b": 1, + }, + "textOverflow": "ellipsis", + "wordWrap": true, +} +`; + +exports[`Interaction Row Column Resize Tests should get vertical filed resize style 1`] = ` +Object { + "height": 30, + "heightByField": Object { + "testField": 2, + }, + "maxLines": 1, + "textOverflow": "ellipsis", + "wordWrap": true, +} +`; + exports[`Interaction Row Column Resize Tests should get vertical filed resize style by field for current resize type 1`] = ` Object { "height": undefined, @@ -131,7 +151,6 @@ Object { "maxLines": 1, "showTreeLeafNodeAlignDot": false, "textOverflow": "ellipsis", - "widthByField": null, "wordWrap": true, } `; @@ -146,7 +165,6 @@ Object { "maxLines": 1, "showTreeLeafNodeAlignDot": false, "textOverflow": "ellipsis", - "widthByField": null, "wordWrap": true, } `; @@ -160,7 +178,21 @@ Object { "maxLines": 1, "showTreeLeafNodeAlignDot": false, "textOverflow": "ellipsis", - "widthByField": null, + "wordWrap": true, +} +`; + +exports[`Interaction Row Column Resize Tests should get vertical filed resize style for height adaptive 1`] = ` +Object { + "height": 30, + "heightByField": Object { + "testField": 2, + }, + "maxLines": 3, + "maxLinesByField": Object { + "testField": 1, + }, + "textOverflow": "ellipsis", "wordWrap": true, } `; @@ -168,7 +200,6 @@ Object { exports[`Interaction Row Column Resize Tests should not effect default resize style by field for selected resize type 1`] = ` Object { "height": 30, - "heightByField": null, "maxLines": 1, "textOverflow": "ellipsis", "width": 50, @@ -182,7 +213,6 @@ Object { exports[`Interaction Row Column Resize Tests should rerender by resize col cell 1`] = ` Object { "height": 30, - "heightByField": null, "maxLines": 1, "textOverflow": "ellipsis", "width": 40, @@ -199,10 +229,12 @@ Object { "heightByField": Object { "testField": 2, }, - "maxLines": 1, + "maxLines": 3, + "maxLinesByField": Object { + "testField": 1, + }, "showTreeLeafNodeAlignDot": false, "textOverflow": "ellipsis", - "widthByField": null, "wordWrap": true, } `; @@ -210,7 +242,7 @@ Object { exports[`Interaction Row Column Resize Tests should rerender by resize row cell 2`] = ` Object { "height": 30, - "maxLines": 1, + "maxLines": Infinity, "textOverflow": "ellipsis", "width": 96, "wordWrap": true, diff --git a/packages/s2-core/__tests__/unit/interaction/base-interaction/click/corner-cell-click-spec.ts b/packages/s2-core/__tests__/unit/interaction/base-interaction/click/corner-cell-click-spec.ts index b6b9701ab0..3546b41d88 100644 --- a/packages/s2-core/__tests__/unit/interaction/base-interaction/click/corner-cell-click-spec.ts +++ b/packages/s2-core/__tests__/unit/interaction/base-interaction/click/corner-cell-click-spec.ts @@ -9,6 +9,7 @@ import { sleep, } from 'tests/util/helpers'; import { + CellType, CornerNodeType, InteractionStateName, type Node, @@ -20,6 +21,7 @@ describe('Interaction Corner Cell Click Tests', () => { let s2: SpreadSheet; const mockCellInfo = createMockCellInfo('testId', { cornerType: CornerNodeType.Row, + cellType: CellType.CORNER_CELL, }); let cornerCellClick: CornerCellClick; @@ -67,6 +69,11 @@ describe('Interaction Corner Cell Click Tests', () => { [], { data: { summaries: [{ name: '', selectedData: [], value: null }] }, + operator: { + menu: { + items: [], + }, + }, }, ); expect(s2.interaction.getState()).toEqual({ diff --git a/packages/s2-core/__tests__/unit/interaction/base-interaction/click/data-cell-click-spec.ts b/packages/s2-core/__tests__/unit/interaction/base-interaction/click/data-cell-click-spec.ts index c3628c148c..e9a62ae853 100644 --- a/packages/s2-core/__tests__/unit/interaction/base-interaction/click/data-cell-click-spec.ts +++ b/packages/s2-core/__tests__/unit/interaction/base-interaction/click/data-cell-click-spec.ts @@ -14,12 +14,15 @@ import { createMockCellInfo, sleep, } from 'tests/util/helpers'; +import { CellType } from '../../../../../src'; jest.mock('@/interaction/event-controller'); describe('Interaction Data Cell Click Tests', () => { let s2: SpreadSheet; - const mockCellInfo = createMockCellInfo('testId'); + const mockCellInfo = createMockCellInfo('testId', { + cellType: CellType.DATA_CELL, + }); beforeEach(() => { s2 = createFakeSpreadSheet(); @@ -86,7 +89,11 @@ describe('Interaction Data Cell Click Tests', () => { stopPropagation() {}, } as unknown as GEvent); - expect(selected).toHaveBeenCalledWith([mockCellInfo.mockCell]); + expect(selected).toHaveBeenCalledWith([mockCellInfo.mockCell], { + interactionName: 'dataCellClick', + targetCell: s2.getCell(), + event: expect.anything(), + }); }); // https://github.com/antvis/S2/issues/2447 @@ -106,7 +113,11 @@ describe('Interaction Data Cell Click Tests', () => { }, } as unknown as GEvent); - expect(selected).toHaveBeenCalledWith([]); + expect(selected).toHaveBeenCalledWith([], { + interactionName: 'dataCellClick', + targetCell: s2.getCell(), + event: expect.anything(), + }); }); test('should emit link field jump event when link field text click and not show tooltip', () => { diff --git a/packages/s2-core/__tests__/unit/interaction/base-interaction/click/row-column-click-spec.ts b/packages/s2-core/__tests__/unit/interaction/base-interaction/click/row-column-click-spec.ts index 51a3cf4ade..1f9516e6e7 100644 --- a/packages/s2-core/__tests__/unit/interaction/base-interaction/click/row-column-click-spec.ts +++ b/packages/s2-core/__tests__/unit/interaction/base-interaction/click/row-column-click-spec.ts @@ -17,6 +17,7 @@ import { RowColumnClick } from '@/interaction/base-interaction/click'; import type { SpreadSheet } from '@/sheet-type'; import { omit } from 'lodash'; import { createFakeSpreadSheet, createMockCellInfo } from 'tests/util/helpers'; +import { CellType } from '../../../../../src'; jest.mock('@/interaction/event-controller'); @@ -30,14 +31,15 @@ describe('Interaction Row & Column Cell Click Tests', () => { id: '1', colIndex: 0, rowIndex: 0, - type: undefined, x: 1, + type: CellType.ROW_CELL, field: mockField, update() {}, }; const mockCellMeta = omit(mockCellViewMeta, ['update', 'x', 'field']); const mockCell = { ...mockCellViewMeta, + cellType: CellType.ROW_CELL, getMeta: () => mockCellViewMeta, }; @@ -158,7 +160,9 @@ describe('Interaction Row & Column Cell Click Tests', () => { test.each([S2Event.ROW_CELL_CLICK, S2Event.COL_CELL_CLICK])( 'should unselected current cell when toggle %s clicked', (event) => { - const mockCellA = createMockCellInfo('cellA'); + const mockCellA = createMockCellInfo('cellA', { + cellType: CellType.ROW_CELL, + }); const getInteractedCellsSpy = jest .spyOn(s2.interaction, 'getInteractedCells') .mockImplementation(() => [mockCellA.mockCell]); @@ -171,7 +175,12 @@ describe('Interaction Row & Column Cell Click Tests', () => { s2.emit(event, { stopPropagation() {}, } as unknown as GEvent); - expect(selected).toHaveBeenCalledWith([mockCell]); + + expect(selected).toHaveBeenCalledWith([mockCell], { + interactionName: 'rowCellClick', + targetCell: s2.getCell(), + event: expect.anything(), + }); // 取消选中 s2.emit(event, { @@ -181,7 +190,7 @@ describe('Interaction Row & Column Cell Click Tests', () => { expect(s2.interaction.getState().cells).toEqual([]); expect(s2.showTooltipWithInfo).toHaveBeenCalled(); expect(selected).toHaveBeenCalled(); - expect(s2.interaction.hasIntercepts([InterceptType.HOVER])).toBeFalse(); + expect(s2.interaction.hasIntercepts([InterceptType.HOVER])).toBeFalsy(); getInteractedCellsSpy.mockRestore(); }, @@ -231,7 +240,12 @@ describe('Interaction Row & Column Cell Click Tests', () => { s2.emit(event, { stopPropagation() {}, } as unknown as GEvent); - expect(selected).toHaveBeenCalledWith([mockCell]); + + expect(selected).toHaveBeenCalledWith([mockCell], { + interactionName: 'rowCellClick', + targetCell: s2.getCell(), + event: expect.anything(), + }); }, ); @@ -258,7 +272,7 @@ describe('Interaction Row & Column Cell Click Tests', () => { }, ])( 'should emit cell selected event when %s clicked with multi selection', - ({ event, enableMultiSelection, result }) => { + ({ event, enableMultiSelection }) => { s2.options.interaction!.multiSelection = enableMultiSelection; const changeCellSpy = jest @@ -274,11 +288,7 @@ describe('Interaction Row & Column Cell Click Tests', () => { stopPropagation() {}, } as unknown as GEvent); - expect(changeCellSpy).toHaveBeenCalledWith({ - cell: expect.anything(), - isMultiSelection: result, - scrollIntoView: false, - }); + expect(changeCellSpy).toHaveBeenCalled(); }, ); diff --git a/packages/s2-core/__tests__/unit/interaction/brush-selection/data-brush-selection-spec.ts b/packages/s2-core/__tests__/unit/interaction/brush-selection/data-brush-selection-spec.ts index d0c6f25e57..bb66b06cc8 100644 --- a/packages/s2-core/__tests__/unit/interaction/brush-selection/data-brush-selection-spec.ts +++ b/packages/s2-core/__tests__/unit/interaction/brush-selection/data-brush-selection-spec.ts @@ -361,7 +361,7 @@ describe('Interaction Data Cell Brush Selection Tests', () => { expect(result).toStrictEqual({ x: { - needScroll: true, + needScroll: false, value: maxX - VSCROLLBAR_WIDTH - EXTRA_PIXEL, }, y: { @@ -409,7 +409,7 @@ describe('Interaction Data Cell Brush Selection Tests', () => { expect(result).toStrictEqual({ x: { - needScroll: true, + needScroll: false, value: minX + EXTRA_PIXEL, }, y: { diff --git a/packages/s2-core/__tests__/unit/interaction/data-cell-multi-selection-spec.ts b/packages/s2-core/__tests__/unit/interaction/data-cell-multi-selection-spec.ts index e5e44df723..b05b9b70e7 100644 --- a/packages/s2-core/__tests__/unit/interaction/data-cell-multi-selection-spec.ts +++ b/packages/s2-core/__tests__/unit/interaction/data-cell-multi-selection-spec.ts @@ -9,6 +9,7 @@ import type { GEvent } from '@/index'; import { DataCellMultiSelection } from '@/interaction/data-cell-multi-selection'; import type { SpreadSheet } from '@/sheet-type'; import { createFakeSpreadSheet, createMockCellInfo } from 'tests/util/helpers'; +import { CellType } from '../../../src'; jest.mock('@/interaction/event-controller'); jest.mock('@/ui/hd-adapter'); @@ -18,7 +19,9 @@ describe('Interaction Data Cell Multi Selection Tests', () => { let s2: SpreadSheet; beforeEach(() => { - const mockCell = createMockCellInfo('testId1').mockCell as any; + const mockCell = createMockCellInfo('testId1', { + cellType: CellType.DATA_CELL, + }).mockCell as any; s2 = createFakeSpreadSheet(); s2.getCell = () => mockCell; @@ -89,6 +92,7 @@ describe('Interaction Data Cell Multi Selection Tests', () => { const mockCellA = createMockCellInfo('testId2', { rowIndex: 0, colIndex: 0, + cellType: CellType.DATA_CELL, }); s2.interaction.getCells = () => [mockCellA.mockCellMeta as CellMeta]; @@ -96,6 +100,7 @@ describe('Interaction Data Cell Multi Selection Tests', () => { const mockCellB = createMockCellInfo('testId3', { rowIndex: 1, colIndex: 1, + cellType: CellType.DATA_CELL, }); s2.getCell = () => mockCellB.mockCell as any; @@ -111,10 +116,14 @@ describe('Interaction Data Cell Multi Selection Tests', () => { stopPropagation() {}, } as unknown as GEvent); - expect(selected).toHaveBeenCalledWith([ - mockCellA.mockCell, - mockCellB.mockCell, - ]); + expect(selected).toHaveBeenCalledWith( + [mockCellA.mockCell, mockCellB.mockCell], + { + interactionName: 'dataCellMultiSelection', + targetCell: s2.getCell(), + event: expect.anything(), + }, + ); expect(s2.interaction.getState()).toEqual({ cells: [mockCellA.mockCellMeta, mockCellB.mockCellMeta], diff --git a/packages/s2-core/__tests__/unit/interaction/event-controller-spec.ts b/packages/s2-core/__tests__/unit/interaction/event-controller-spec.ts index b21d5bc354..7166055f6c 100644 --- a/packages/s2-core/__tests__/unit/interaction/event-controller-spec.ts +++ b/packages/s2-core/__tests__/unit/interaction/event-controller-spec.ts @@ -570,7 +570,11 @@ describe('Interaction Event Controller Tests', () => { } as MouseEventInit), ); - expect(selected).toHaveBeenCalledWith([]); + expect(selected).toHaveBeenCalledWith([], { + interactionName: 'globalReset', + targetCell: null, + event: expect.anything(), + }); expect(reset).toHaveBeenCalled(); expect(spreadsheet.interaction.reset).toHaveBeenCalled(); }); @@ -594,7 +598,11 @@ describe('Interaction Event Controller Tests', () => { new KeyboardEvent('keydown', { key: InteractionKeyboardKey.ESC }), ); - expect(selected).toHaveBeenCalledWith([]); + expect(selected).toHaveBeenCalledWith([], { + interactionName: 'globalReset', + targetCell: null, + event: expect.anything(), + }); expect(reset).toHaveBeenCalled(); expect(spreadsheet.interaction.reset).toHaveBeenCalled(); }); diff --git a/packages/s2-core/__tests__/unit/interaction/range-selection-spec.ts b/packages/s2-core/__tests__/unit/interaction/range-selection-spec.ts index 36f11c236f..0a179ac2b6 100644 --- a/packages/s2-core/__tests__/unit/interaction/range-selection-spec.ts +++ b/packages/s2-core/__tests__/unit/interaction/range-selection-spec.ts @@ -10,6 +10,7 @@ import { RangeSelection } from '@/interaction/range-selection'; import type { SpreadSheet } from '@/sheet-type'; import { getCellMeta } from '@/utils'; import { createFakeSpreadSheet, createMockCellInfo } from 'tests/util/helpers'; +import { CellType } from '../../../src'; import type { PivotFacet } from '../../../src/facet'; jest.mock('@/utils/tooltip'); @@ -24,6 +25,8 @@ describe('Interaction Range Selection Tests', () => { beforeEach(() => { const mockCell = createMockCellInfo('testId1').mockCell as any; + mockCell.cellType = CellType.DATA_CELL; + s2 = createFakeSpreadSheet(); s2.getCell = () => mockCell; rangeSelection = new RangeSelection(s2); @@ -141,10 +144,26 @@ describe('Interaction Range Selection Tests', () => { getSeriesNumberWidth: () => 200, } as unknown as PivotFacet; - const mockCell00 = createMockCellInfo('0-0', { rowIndex: 0, colIndex: 0 }); - const mockCell01 = createMockCellInfo('0-1', { rowIndex: 0, colIndex: 1 }); - const mockCell10 = createMockCellInfo('1-0', { rowIndex: 1, colIndex: 0 }); - const mockCell11 = createMockCellInfo('1-1', { rowIndex: 1, colIndex: 1 }); + const mockCell00 = createMockCellInfo('0-0', { + rowIndex: 0, + colIndex: 0, + cellType: CellType.DATA_CELL, + }); + const mockCell01 = createMockCellInfo('0-1', { + rowIndex: 0, + colIndex: 1, + cellType: CellType.DATA_CELL, + }); + const mockCell10 = createMockCellInfo('1-0', { + rowIndex: 1, + colIndex: 0, + cellType: CellType.DATA_CELL, + }); + const mockCell11 = createMockCellInfo('1-1', { + rowIndex: 1, + colIndex: 1, + cellType: CellType.DATA_CELL, + }); const activeCells: S2CellType[] = [ mockCell00.mockCell, @@ -183,7 +202,11 @@ describe('Interaction Range Selection Tests', () => { ], stateName: InteractionStateName.SELECTED, }); - expect(selected).toHaveBeenCalledWith(activeCells); + expect(selected).toHaveBeenCalledWith(activeCells, { + interactionName: 'rangeSelection', + targetCell: s2.getCell(), + event: expect.anything(), + }); expect( s2.interaction.hasIntercepts([InterceptType.CLICK, InterceptType.HOVER]), ).toBeTruthy(); @@ -207,10 +230,26 @@ describe('Interaction Range Selection Tests', () => { getSeriesNumberWidth: () => 0, } as unknown as PivotFacet; - const mockCell00 = createMockCellInfo('0-0', { rowIndex: 0, colIndex: 0 }); - const mockCell01 = createMockCellInfo('0-1', { rowIndex: 0, colIndex: 1 }); - const mockCell10 = createMockCellInfo('1-0', { rowIndex: 1, colIndex: 0 }); - const mockCell11 = createMockCellInfo('1-1', { rowIndex: 1, colIndex: 1 }); + const mockCell00 = createMockCellInfo('0-0', { + rowIndex: 0, + colIndex: 0, + cellType: CellType.DATA_CELL, + }); + const mockCell01 = createMockCellInfo('0-1', { + rowIndex: 0, + colIndex: 1, + cellType: CellType.DATA_CELL, + }); + const mockCell10 = createMockCellInfo('1-0', { + rowIndex: 1, + colIndex: 0, + cellType: CellType.DATA_CELL, + }); + const mockCell11 = createMockCellInfo('1-1', { + rowIndex: 1, + colIndex: 1, + cellType: CellType.DATA_CELL, + }); const activeCells: S2CellType[] = [ mockCell00.mockCell, @@ -249,7 +288,11 @@ describe('Interaction Range Selection Tests', () => { ], stateName: InteractionStateName.SELECTED, }); - expect(selected).toHaveBeenCalledWith(activeCells); + expect(selected).toHaveBeenCalledWith(activeCells, { + interactionName: 'rangeSelection', + targetCell: s2.getCell(), + event: expect.anything(), + }); expect( s2.interaction.hasIntercepts([InterceptType.CLICK, InterceptType.HOVER]), ).toBeTruthy(); diff --git a/packages/s2-core/__tests__/unit/interaction/root-spec.ts b/packages/s2-core/__tests__/unit/interaction/root-spec.ts index 9f56b7e4cf..05ab71b623 100644 --- a/packages/s2-core/__tests__/unit/interaction/root-spec.ts +++ b/packages/s2-core/__tests__/unit/interaction/root-spec.ts @@ -29,7 +29,6 @@ import { RootInteraction } from '@/interaction/root'; import { mergeCell, unmergeCell } from '@/utils/interaction/merge-cell'; import { getCellMeta } from '@/utils/interaction/select-event'; import type { Canvas } from '@antv/g'; -import { get } from 'lodash'; import { createMockCellInfo, sleep } from 'tests/util/helpers'; import type { PivotFacet } from '../../../src/facet'; @@ -587,17 +586,14 @@ describe('RootInteraction Tests', () => { }); test('should get correctly default interaction size', () => { - expect(defaultInteractionSize).toEqual(13); + expect(defaultInteractionSize).toEqual(18); }); test('should register default interaction', () => { rootInteraction = new RootInteraction(mockSpreadSheetInstance); - expect(rootInteraction.interactions.size).toEqual(defaultInteractionSize); - Object.keys(InteractionName).forEach((key) => { - expect( - rootInteraction.interactions.has(get(InteractionName, key)), - ).toBeTruthy(); - }); + + expect(rootInteraction.interactions.size).toEqual(13); + expect(rootInteraction.interactions.keys()).toMatchSnapshot(); }); test.each` @@ -638,9 +634,7 @@ describe('RootInteraction Tests', () => { ]; rootInteraction = new RootInteraction(mockSpreadSheetInstance); - expect(rootInteraction.interactions.size).toEqual( - defaultInteractionSize + 1, - ); + expect(rootInteraction.interactions.size).toEqual(14); expect( rootInteraction.interactions.has(customInteraction.key), ).toBeTruthy(); @@ -667,9 +661,7 @@ describe('RootInteraction Tests', () => { rootInteraction = new RootInteraction(mockSpreadSheetInstance); - expect(rootInteraction.interactions.size).toEqual( - defaultInteractionSize - 1, - ); + expect(rootInteraction.interactions.size).toEqual(12); expect(rootInteraction.interactions.has(name)).toBeFalsy(); [...rootInteraction.interactions.values()].forEach((interaction) => { expect(interaction).not.toBeInstanceOf(expected); @@ -687,9 +679,7 @@ describe('RootInteraction Tests', () => { rootInteraction = new RootInteraction(mockSpreadSheetInstance); - expect(rootInteraction.interactions.size).toEqual( - defaultInteractionSize - 3, - ); + expect(rootInteraction.interactions.size).toEqual(10); expect( rootInteraction.interactions.has( InteractionName.DATA_CELL_BRUSH_SELECTION, diff --git a/packages/s2-core/__tests__/unit/interaction/row-column-resize-spec.ts b/packages/s2-core/__tests__/unit/interaction/row-column-resize-spec.ts index a1e069dd0e..4233da2abd 100644 --- a/packages/s2-core/__tests__/unit/interaction/row-column-resize-spec.ts +++ b/packages/s2-core/__tests__/unit/interaction/row-column-resize-spec.ts @@ -41,6 +41,8 @@ const MockRootInteraction = RootInteraction as unknown as jest.Mock; describe('Interaction Row Column Resize Tests', () => { + const mockCell = createMockCellInfo('test').mockCell; + let rowColumnResizeInstance: RowColumnResize; let s2: SpreadSheet; let mockRootInteraction: RootInteraction; @@ -92,8 +94,16 @@ describe('Interaction Row Column Resize Tests', () => { const emitResize = ( directionType: ResizeDirectionType, effect: ResizeAreaEffect, - meta?: Partial, + defaultMeta?: Partial, ) => { + const meta = { + ...defaultMeta, + rowId: '0', + rowIndex: 0, + field: 'testField', + id: 'testFieldId', + } as ResizeInfo['meta']; + const resizeInfo: ResizeInfo = { theme: {}, type: directionType, @@ -104,13 +114,8 @@ describe('Interaction Row Column Resize Tests', () => { isResizeArea: true, effect, size: 3, - meta: { - ...meta, - rowId: '0', - rowIndex: 0, - field: 'testField', - id: 'testFieldId', - } as ResizeInfo['meta'], + meta, + cell: mockCell, }; emitResizeEvent( @@ -134,6 +139,22 @@ describe('Interaction Row Column Resize Tests', () => { return resizeInfo; }; + const createCells = () => { + const children = [ + createMockCellInfo('test-cell-a', { isLeaf: true }).getNode(), + createMockCellInfo('test-cell-b', { isLeaf: true }).getNode(), + ]; + + return [ + createMockCellInfo('test-row-cell-1', { + children, + }).mockCell, + createMockCellInfo('test-row-cell-2', { + children, + }).mockCell, + ]; + }; + beforeEach(() => { MockRootInteraction.mockClear(); @@ -167,14 +188,6 @@ describe('Interaction Row Column Resize Tests', () => { createMockCellInfo('test-col-cell-a').mockCell, createMockCellInfo('test-col-cell-b').mockCell, ]; - - // 模拟多选 - jest - .spyOn(Node, 'getAllLeaveNodes') - .mockImplementationOnce(() => [ - createMockCellInfo('test-cell-a').getNode(), - createMockCellInfo('test-cell-b').getNode(), - ]); }); test('should register events', () => { @@ -235,6 +248,7 @@ describe('Interaction Row Column Resize Tests', () => { isResizeArea: true, effect: ResizeAreaEffect.Cell, size: 3, + cell: mockCell, } as ResizeInfo; emitResizeEvent( @@ -286,6 +300,7 @@ describe('Interaction Row Column Resize Tests', () => { field: 'testField', id: 'testFieldId', } as ResizeInfo['meta'], + cell: mockCell, }; emitResizeEvent( @@ -361,6 +376,7 @@ describe('Interaction Row Column Resize Tests', () => { isResizeArea: true, effect: ResizeAreaEffect.Cell, size: 3, + cell: mockCell, } as ResizeInfo; emitResizeEvent( @@ -392,6 +408,16 @@ describe('Interaction Row Column Resize Tests', () => { const resize = jest.fn(); const rowWidthResize = jest.fn(); + s2.setOptions({ + style: { + rowCell: { + maxLines: 3, + }, + dataCell: { + maxLines: Infinity, + }, + }, + }); s2.on(S2Event.LAYOUT_RESIZE, resize); s2.on(S2Event.LAYOUT_RESIZE_ROW_HEIGHT, rowWidthResize); @@ -410,6 +436,7 @@ describe('Interaction Row Column Resize Tests', () => { meta: { field: 'testField', } as Node, + cell: mockCell, }; emitResizeEvent( @@ -442,6 +469,9 @@ describe('Interaction Row Column Resize Tests', () => { heightByField: { [resizeInfo.meta.field!]: 2, }, + maxLinesByField: { + [resizeInfo.meta.field!]: 1, + }, }, }, }; @@ -493,14 +523,14 @@ describe('Interaction Row Column Resize Tests', () => { info: { ...resizeInfo, resizedWidth: 5, resizedHeight: 0 }, style: { rowCell: { - width: 5, + treeWidth: 5, }, }, }; expect(resize).toHaveBeenCalledWith(newResizeInfo); expect(treeWidthResize).toHaveBeenCalledWith(newResizeInfo); - expect(s2.options.style!.rowCell!.width).toEqual(resizeInfo.width); + expect(s2.options.style!.rowCell!.treeWidth).toEqual(resizeInfo.width); }); test('should get horizontal filed resize style', () => { @@ -584,17 +614,34 @@ describe('Interaction Row Column Resize Tests', () => { }); test('should get vertical filed resize style', () => { - const resizeInfo = emitResize( - ResizeDirectionType.Vertical, - ResizeAreaEffect.Field, - ); + emitResize(ResizeDirectionType.Vertical, ResizeAreaEffect.Field); - expect(s2.options.style!.colCell!.heightByField).toEqual({ - [resizeInfo.meta.field!]: resizeInfo.height, + expect(s2.options.style!.colCell).toMatchSnapshot(); + }); + + test('should get vertical filed resize style for height adaptive', () => { + s2.setOptions({ + style: { + colCell: { + maxLines: 3, + }, + }, }); + + emitResize(ResizeDirectionType.Vertical, ResizeAreaEffect.Field); + + expect(s2.options.style!.colCell).toMatchSnapshot(); }); test('should get vertical custom filed resize style', () => { + s2.setOptions({ + style: { + colCell: { + maxLines: Infinity, + }, + }, + }); + jest.spyOn(s2, 'isCustomColumnFields').mockImplementationOnce(() => true); jest .spyOn(s2.facet, 'getColNodes') @@ -604,17 +651,12 @@ describe('Interaction Row Column Resize Tests', () => { createMockCellInfo('test-c', { level: 1 }).getNode(), ]); - const resizeInfo = emitResize( - ResizeDirectionType.Vertical, - ResizeAreaEffect.Field, - { level: 0 }, - ); + emitResize(ResizeDirectionType.Vertical, ResizeAreaEffect.Field, { + level: 0, + }); // 获取同 level 的 style - expect(s2.options.style!.colCell!.heightByField).toEqual({ - 'test-a': resizeInfo.height, - 'test-b': resizeInfo.height, - }); + expect(s2.options.style!.colCell).toMatchSnapshot(); }); test('should not reset interaction and hidden tooltip when resize start', () => { @@ -712,6 +754,7 @@ describe('Interaction Row Column Resize Tests', () => { resizedHeight: 0, resizedWidth: 0, size: 3, + cell: mockCell, } as ResizeInfo; emitResizeEvent( @@ -825,6 +868,9 @@ describe('Interaction Row Column Resize Tests', () => { }, }); + jest + .spyOn(s2.interaction, 'getActiveColCells') + .mockImplementationOnce(() => createCells()); jest .spyOn(s2.interaction, 'isSelectedState') .mockImplementationOnce(() => true); @@ -845,6 +891,9 @@ describe('Interaction Row Column Resize Tests', () => { }, }); + jest + .spyOn(s2.interaction, 'getActiveRowCells') + .mockImplementationOnce(() => createCells()); jest .spyOn(s2.interaction, 'isSelectedState') .mockImplementationOnce(() => true); @@ -858,10 +907,7 @@ describe('Interaction Row Column Resize Tests', () => { // 模拟多选 jest .spyOn(s2.interaction, 'getActiveRowCells') - .mockImplementationOnce(() => [ - createMockCellInfo('test-row-cell-1').mockCell, - createMockCellInfo('test-row-cell-2').mockCell, - ]); + .mockImplementationOnce(() => createCells()); jest .spyOn(s2.interaction, 'isSelectedState') .mockImplementationOnce(() => true); @@ -884,10 +930,7 @@ describe('Interaction Row Column Resize Tests', () => { // 模拟多选 jest .spyOn(s2.interaction, 'getActiveColCells') - .mockImplementationOnce(() => [ - createMockCellInfo('test-col-cell-1').mockCell, - createMockCellInfo('test-col-cell-2').mockCell, - ]); + .mockImplementationOnce(() => createCells()); jest .spyOn(s2.interaction, 'isSelectedState') .mockImplementationOnce(() => true); diff --git a/packages/s2-shared/__tests__/unit/utils/__snapshots__/drill-down-spec.ts.snap b/packages/s2-core/__tests__/unit/shared/utils/__snapshots__/drill-down-spec.ts.snap similarity index 100% rename from packages/s2-shared/__tests__/unit/utils/__snapshots__/drill-down-spec.ts.snap rename to packages/s2-core/__tests__/unit/shared/utils/__snapshots__/drill-down-spec.ts.snap diff --git a/packages/s2-shared/__tests__/unit/utils/__snapshots__/options-spec.ts.snap b/packages/s2-core/__tests__/unit/shared/utils/__snapshots__/options-spec.ts.snap similarity index 95% rename from packages/s2-shared/__tests__/unit/utils/__snapshots__/options-spec.ts.snap rename to packages/s2-core/__tests__/unit/shared/utils/__snapshots__/options-spec.ts.snap index fb966c7a85..a59fe91271 100644 --- a/packages/s2-shared/__tests__/unit/utils/__snapshots__/options-spec.ts.snap +++ b/packages/s2-core/__tests__/unit/shared/utils/__snapshots__/options-spec.ts.snap @@ -66,7 +66,7 @@ Object { "colResizeType": "current", "cornerCellHorizontal": true, "minCellHeight": 20, - "minCellWidth": 20, + "minCellWidth": 40, "rowCellVertical": true, "rowResizeType": "current", }, @@ -91,10 +91,8 @@ Object { "style": Object { "colCell": Object { "height": 30, - "heightByField": null, "maxLines": 1, "textOverflow": "ellipsis", - "widthByField": null, "wordWrap": true, }, "cornerCell": Object { @@ -111,11 +109,9 @@ Object { }, "layoutWidthType": "adaptive", "rowCell": Object { - "heightByField": null, "maxLines": 1, "showTreeLeafNodeAlignDot": false, "textOverflow": "ellipsis", - "widthByField": null, "wordWrap": true, }, "seriesNumberCell": Object { diff --git a/packages/s2-shared/__tests__/unit/utils/classnames-spec.ts b/packages/s2-core/__tests__/unit/shared/utils/classnames-spec.ts similarity index 79% rename from packages/s2-shared/__tests__/unit/utils/classnames-spec.ts rename to packages/s2-core/__tests__/unit/shared/utils/classnames-spec.ts index 8aaf270005..449817e2f7 100644 --- a/packages/s2-shared/__tests__/unit/utils/classnames-spec.ts +++ b/packages/s2-core/__tests__/unit/shared/utils/classnames-spec.ts @@ -1,4 +1,4 @@ -import { getStrategySheetTooltipClsName } from '../../../src/utils/classnames'; +import { getStrategySheetTooltipClsName } from '../../../../src/shared'; describe('classnames test', () => { test('#getStrategySheetTooltipClsName()', () => { diff --git a/packages/s2-shared/__tests__/unit/utils/drill-down-spec.ts b/packages/s2-core/__tests__/unit/shared/utils/drill-down-spec.ts similarity index 93% rename from packages/s2-shared/__tests__/unit/utils/drill-down-spec.ts rename to packages/s2-core/__tests__/unit/shared/utils/drill-down-spec.ts index e9bb7ae3a4..2c9c4fb2a0 100644 --- a/packages/s2-shared/__tests__/unit/utils/drill-down-spec.ts +++ b/packages/s2-core/__tests__/unit/shared/utils/drill-down-spec.ts @@ -1,20 +1,20 @@ import { - GEvent, - PivotDataSet, S2Event, Store, + type GEvent, type Node, + type PivotDataSet, type SpreadSheet, -} from '@antv/s2'; -import type { PartDrillDown } from '../../../src/interface'; +} from '../../../../src'; +import type { PartDrillDown } from '../../../../src/shared'; import { buildDrillDownOptions, defaultPartDrillDownDisplayCondition, getDrillDownCache, handleActionIconClick, handleDrillDown, -} from '../../../src/utils/drill-down'; -import { sleep } from '../../util/helpers'; +} from '../../../../src/shared'; +import { sleep } from '../../../util/helpers'; describe('drill-down test', () => { let s2: SpreadSheet; diff --git a/packages/s2-shared/__tests__/unit/utils/options-spec.ts b/packages/s2-core/__tests__/unit/shared/utils/options-spec.ts similarity index 84% rename from packages/s2-shared/__tests__/unit/utils/options-spec.ts rename to packages/s2-core/__tests__/unit/shared/utils/options-spec.ts index 909e1fe25b..22b1a80674 100644 --- a/packages/s2-shared/__tests__/unit/utils/options-spec.ts +++ b/packages/s2-core/__tests__/unit/shared/utils/options-spec.ts @@ -1,5 +1,5 @@ -import { type S2Options } from '@antv/s2'; -import { getBaseSheetComponentOptions } from '../../../src/utils/options'; +import type { S2Options } from '../../../../src'; +import { getBaseSheetComponentOptions } from '../../../../src/shared'; describe('Options Tests', () => { test('should get safety options', () => { diff --git a/packages/s2-shared/__tests__/unit/utils/resize-spec.ts b/packages/s2-core/__tests__/unit/shared/utils/resize-spec.ts similarity index 90% rename from packages/s2-shared/__tests__/unit/utils/resize-spec.ts rename to packages/s2-core/__tests__/unit/shared/utils/resize-spec.ts index 7097678881..5bb8e561bd 100644 --- a/packages/s2-shared/__tests__/unit/utils/resize-spec.ts +++ b/packages/s2-core/__tests__/unit/shared/utils/resize-spec.ts @@ -1,8 +1,5 @@ -import { PivotSheet } from '@antv/s2'; -import { - analyzeAdaptive, - createResizeObserver, -} from '../../../src/utils/resize'; +import { PivotSheet } from '../../../../src'; +import { analyzeAdaptive, createResizeObserver } from '../../../../src/shared'; describe('resize test', () => { test('#analyzeAdaptive()', () => { diff --git a/packages/s2-core/__tests__/unit/sheet-type/pivot-sheet-spec.ts b/packages/s2-core/__tests__/unit/sheet-type/pivot-sheet-spec.ts index 8f8558f25b..2f4d9a437a 100644 --- a/packages/s2-core/__tests__/unit/sheet-type/pivot-sheet-spec.ts +++ b/packages/s2-core/__tests__/unit/sheet-type/pivot-sheet-spec.ts @@ -25,7 +25,7 @@ import { cloneDeep, last } from 'lodash'; import dataCfg from 'tests/data/simple-data.json'; import { waitForRender } from 'tests/util'; import { createPivotSheet, getContainer, sleep } from 'tests/util/helpers'; -import { +import type { BaseEvent, BaseTooltipOperatorMenuOptions, CornerCell, @@ -629,11 +629,11 @@ describe('PivotSheet Tests', () => { }); test('should get content height', () => { - expect(s2.facet.getContentHeight()).toEqual(120); + expect(s2.facet.getContentHeight()).toEqual(122); }); test('should get content width', () => { - expect(s2.facet.getContentWidth()).toEqual(384); + expect(s2.facet.getContentWidth()).toEqual(386); }); test('should get layout width type', () => { @@ -773,7 +773,7 @@ describe('PivotSheet Tests', () => { test('should rebuild hidden columns detail by status', async () => { // 重新更新, 但是没有隐藏列信息 - await s2.render({ reloadData: false, reBuildHiddenColumnsDetail: true }); + await s2.render({ reloadData: false, rebuildHiddenColumnsDetail: true }); expect(mockHideColumnsByThunkGroup).toHaveBeenCalledTimes(0); @@ -781,16 +781,16 @@ describe('PivotSheet Tests', () => { null, ] as unknown as HiddenColumnsInfo[]); - // 重新更新, 有隐藏列信息, 但是 reBuildHiddenColumnsDetail 为 false + // 重新更新, 有隐藏列信息, 但是 rebuildHiddenColumnsDetail 为 false await s2.render({ reloadData: false, - reBuildHiddenColumnsDetail: false, + rebuildHiddenColumnsDetail: false, }); expect(mockHideColumnsByThunkGroup).toHaveBeenCalledTimes(0); - // 重新更新, 有隐藏列信息, 且 reBuildHiddenColumnsDetail 为 true - await s2.render({ reloadData: false, reBuildHiddenColumnsDetail: true }); + // 重新更新, 有隐藏列信息, 且 rebuildHiddenColumnsDetail 为 true + await s2.render({ reloadData: false, rebuildHiddenColumnsDetail: true }); expect(mockHideColumnsByThunkGroup).toHaveBeenCalledTimes(1); }); diff --git a/packages/s2-core/__tests__/unit/sheet-type/table-sheet-spec.ts b/packages/s2-core/__tests__/unit/sheet-type/table-sheet-spec.ts index 1eb95a4a7d..c45b5b7013 100644 --- a/packages/s2-core/__tests__/unit/sheet-type/table-sheet-spec.ts +++ b/packages/s2-core/__tests__/unit/sheet-type/table-sheet-spec.ts @@ -297,7 +297,7 @@ describe('TableSheet Tests', () => { }); test('should get content height', () => { - expect(s2.facet.getContentHeight()).toEqual(120); + expect(s2.facet.getContentHeight()).toEqual(122); }); test('should get content width', () => { diff --git a/packages/s2-core/__tests__/unit/utils/__snapshots__/merge-spec.ts.snap b/packages/s2-core/__tests__/unit/utils/__snapshots__/merge-spec.ts.snap index a1fa020502..c15107a693 100644 --- a/packages/s2-core/__tests__/unit/utils/__snapshots__/merge-spec.ts.snap +++ b/packages/s2-core/__tests__/unit/utils/__snapshots__/merge-spec.ts.snap @@ -47,7 +47,7 @@ Object { "colResizeType": "current", "cornerCellHorizontal": true, "minCellHeight": 20, - "minCellWidth": 20, + "minCellWidth": 40, "rowCellVertical": true, "rowResizeType": "current", }, @@ -72,10 +72,8 @@ Object { "style": Object { "colCell": Object { "height": 30, - "heightByField": null, "maxLines": 1, "textOverflow": "ellipsis", - "widthByField": null, "wordWrap": true, }, "cornerCell": Object { @@ -92,11 +90,9 @@ Object { }, "layoutWidthType": "adaptive", "rowCell": Object { - "heightByField": null, "maxLines": 1, "showTreeLeafNodeAlignDot": false, "textOverflow": "ellipsis", - "widthByField": null, "wordWrap": true, }, "seriesNumberCell": Object { @@ -121,14 +117,12 @@ Object { } `; -exports[`merge test should setup correctly compact layout width type style 1`] = ` +exports[`merge test should not setup correctly compact layout width type style 1`] = ` Object { "colCell": Object { "height": 30, - "heightByField": null, "maxLines": 1, "textOverflow": "ellipsis", - "widthByField": null, "wordWrap": true, }, "cornerCell": Object { @@ -141,15 +135,13 @@ Object { "maxLines": 1, "textOverflow": "ellipsis", "width": 96, - "wordWrap": false, + "wordWrap": true, }, "layoutWidthType": "compact", "rowCell": Object { - "heightByField": null, "maxLines": 1, "showTreeLeafNodeAlignDot": false, "textOverflow": "ellipsis", - "widthByField": null, "wordWrap": true, }, "seriesNumberCell": Object { diff --git a/packages/s2-core/__tests__/unit/utils/__snapshots__/tooltip-spec.ts.snap b/packages/s2-core/__tests__/unit/utils/__snapshots__/tooltip-spec.ts.snap index c3cd030d43..bcfd73a2c8 100644 --- a/packages/s2-core/__tests__/unit/utils/__snapshots__/tooltip-spec.ts.snap +++ b/packages/s2-core/__tests__/unit/utils/__snapshots__/tooltip-spec.ts.snap @@ -87,6 +87,32 @@ Object { } `; +exports[`Tooltip Utils Tests Tooltip Get Data Tests should get correctly data cell details 1`] = ` +Object { + "description": undefined, + "details": Array [ + Object { + "name": "number", + "value": 7789, + }, + ], + "headInfo": Object { + "cols": Array [], + "rows": Array [ + Object { + "name": undefined, + "value": "-", + }, + ], + }, + "infos": undefined, + "interpretation": undefined, + "name": null, + "summaries": Array [], + "tips": undefined, +} +`; + exports[`Tooltip Utils Tests Tooltip Get Data Tests should get custom tree row cell summary data 1`] = ` Object { "description": "指标1描述", diff --git a/packages/s2-core/__tests__/unit/utils/export/__snapshots__/export-pivot-spec.ts.snap b/packages/s2-core/__tests__/unit/utils/export/__snapshots__/export-pivot-spec.ts.snap index e5aab4ae9b..f19802e2cf 100644 --- a/packages/s2-core/__tests__/unit/utils/export/__snapshots__/export-pivot-spec.ts.snap +++ b/packages/s2-core/__tests__/unit/utils/export/__snapshots__/export-pivot-spec.ts.snap @@ -42,6 +42,19 @@ province city number number number number 四川省 乐山市 2330 2445 2458 352" `; +exports[`PivotSheet Export Test should export correct data in grid mode by custom calc grand totals 1`] = ` +"省份 城市 总计 数量 +浙江省 杭州市 15420 15420 +浙江省 绍兴市 5657 5657 +浙江省 宁波市 13779 13779 +浙江省 舟山市 8242 8242 +四川省 成都市 10513 10513 +四川省 绵阳市 7388 7388 +四川省 南充市 10284 10284 +四川省 乐山市 7585 7585 +总计 78868 78868" +`; + exports[`PivotSheet Export Test should export correct data in grid mode with totals in col 1`] = ` " 类别 家具 家具 家具 办公用品 办公用品 办公用品 总计 子类别 桌子 沙发 小计 笔 纸张 小计 diff --git a/packages/s2-core/__tests__/unit/utils/export/export-pivot-spec.ts b/packages/s2-core/__tests__/unit/utils/export/export-pivot-spec.ts index ab3f56c7d5..292fdd4464 100644 --- a/packages/s2-core/__tests__/unit/utils/export/export-pivot-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/export/export-pivot-spec.ts @@ -5,6 +5,7 @@ import { data as originData } from 'tests/data/mock-dataset.json'; import { assembleDataCfg, assembleOptions } from 'tests/util'; import { createPivotSheet, getContainer } from 'tests/util/helpers'; import { + Aggregation, PivotSheet, asyncGetAllPlainData, type DataItem, @@ -49,13 +50,14 @@ describe('PivotSheet Export Test', () => { ); await s2.render(); - const data = await asyncGetAllPlainData({ + const syncData = await asyncGetAllPlainData({ sheetInstance: s2, split: TAB_SEPARATOR, formatOptions: true, + async: false, }); - expect(data).toMatchSnapshot(); + expect(syncData).toMatchSnapshot(); const asyncData = await asyncGetAllPlainData({ sheetInstance: s2, @@ -605,4 +607,40 @@ describe('PivotSheet Export Test', () => { await expectMatchSnapshot(sheet); }); + + // https://github.com/antvis/S2/issues/2928 + it('should export correct data in grid mode by custom calc grand totals', async () => { + const sheet = new PivotSheet( + getContainer(), + assembleDataCfg({ + fields: { + rows: ['province', 'city'], + columns: [], + values: ['number'], + valueInCols: true, + }, + }), + assembleOptions({ + hierarchyType: 'grid', + totals: { + col: { + showGrandTotals: true, + showSubTotals: true, + reverseGrandTotalsLayout: true, + calcGrandTotals: { + aggregation: Aggregation.SUM, + }, + }, + row: { + showGrandTotals: true, + calcGrandTotals: { + aggregation: Aggregation.AVG, + }, + }, + }, + }), + ); + + await expectMatchSnapshot(sheet); + }); }); diff --git a/packages/s2-core/__tests__/unit/utils/interaction/__snapshots__/formatter-spec.ts.snap b/packages/s2-core/__tests__/unit/utils/interaction/__snapshots__/formatter-spec.ts.snap index a93b98952b..9e15b01982 100644 --- a/packages/s2-core/__tests__/unit/utils/interaction/__snapshots__/formatter-spec.ts.snap +++ b/packages/s2-core/__tests__/unit/utils/interaction/__snapshots__/formatter-spec.ts.snap @@ -4,6 +4,7 @@ exports[`#getBaseCellData() should get correctly cell data 1`] = ` Object { "target": Object { "cellType": undefined, + "children": Array [], "colId": "0", "colIndex": 0, "cornerType": "", @@ -11,10 +12,13 @@ Object { "getActualText": [MockFunction], "getBBoxByType": [MockFunction], "getFieldValue": [MockFunction], + "getMaxLinesByCustomHeight": [MockFunction], "getMeta": [Function], "getStyle": [MockFunction], + "getTextLineHeight": [MockFunction], "hideInteractionShape": [MockFunction], "id": "test-a", + "isLeaf": false, "isTextOverflowing": [MockFunction], "level": 0, "parentNode": [Circular], @@ -42,11 +46,13 @@ Object { "y": 0, }, "viewMeta": Object { + "children": Array [], "colId": "0", "colIndex": 0, "cornerType": "", "field": "test-a", "id": "test-a", + "isLeaf": false, "level": 0, "rowIndex": 0, "spreadsheet": Object { diff --git a/packages/s2-core/__tests__/unit/utils/interaction/hover-event-spec.ts b/packages/s2-core/__tests__/unit/utils/interaction/hover-event-spec.ts index e860d79cb1..e5d1b136bd 100644 --- a/packages/s2-core/__tests__/unit/utils/interaction/hover-event-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/interaction/hover-event-spec.ts @@ -3,7 +3,7 @@ import type { Node } from '@/facet/layout/node'; import type { SpreadSheet } from '@/sheet-type/spread-sheet'; import { getActiveHoverHeaderCells, - updateAllColHeaderCellState, + updateAllHeaderCellState, } from '@/utils/interaction/hover-event'; import { InteractionStateName } from '@/common'; @@ -51,7 +51,7 @@ describe('Hover Event Utils Tests', () => { new ColCell({} as unknown as Node, {} as unknown as SpreadSheet), ]; - updateAllColHeaderCellState( + updateAllHeaderCellState( 'root[&]city', cells, InteractionStateName.HOVER, diff --git a/packages/s2-core/__tests__/unit/utils/interaction/select-event-spec.ts b/packages/s2-core/__tests__/unit/utils/interaction/select-event-spec.ts index 0197de8611..5c363e9a0b 100644 --- a/packages/s2-core/__tests__/unit/utils/interaction/select-event-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/interaction/select-event-spec.ts @@ -1,5 +1,5 @@ import type { ViewMeta } from '@/common'; -import { InteractionKeyboardKey, S2Event } from '@/common/constant'; +import { InteractionKeyboardKey } from '@/common/constant'; import type { SpreadSheet } from '@/sheet-type/spread-sheet'; import { getCellMeta, @@ -11,7 +11,6 @@ import { getRowHeaderByCellId, isMouseEventWithMeta, isMultiSelectionKey, - selectCells, } from '@/utils/interaction/select-event'; import { createFakeSpreadSheet, createMockCellInfo } from 'tests/util/helpers'; import { TableSeriesNumberCell } from '../../../../src/cell'; @@ -109,18 +108,6 @@ describe('Select Event Utils Tests', () => { }); }); - test('#selectCells()', () => { - const s2 = createFakeSpreadSheet({ width: 100, height: 100 }); - const selected = jest.fn(); - - s2.on(S2Event.GLOBAL_SELECTED, selected); - const cell = createMockCellInfo('test-a').mockCell; - - selectCells(s2, [cell]); - - expect(selected).toHaveBeenCalled(); - }); - test('#getRangeIndex()', () => { expect( getRangeIndex({ rowIndex: 0, colIndex: 0 }, { rowIndex: 2, colIndex: 2 }), diff --git a/packages/s2-core/__tests__/unit/utils/merge-spec.ts b/packages/s2-core/__tests__/unit/utils/merge-spec.ts index 867c685beb..4ef0de9306 100644 --- a/packages/s2-core/__tests__/unit/utils/merge-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/merge-spec.ts @@ -175,7 +175,7 @@ describe('merge test', () => { expect(setupOptions(null)).toMatchSnapshot(); }); - test('should setup correctly compact layout width type style', () => { + test('should not setup correctly compact layout width type style', () => { expect( setupOptions({ style: { diff --git a/packages/s2-core/__tests__/unit/utils/sort-action-spec.ts b/packages/s2-core/__tests__/unit/utils/sort-action-spec.ts index 70b1d525af..59ef2ac5ce 100644 --- a/packages/s2-core/__tests__/unit/utils/sort-action-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/sort-action-spec.ts @@ -211,6 +211,30 @@ describe('Sort By Custom Test', () => { 'Wednesday[&]afternoon', ]); }); + + test('sort by custom with semblable value', () => { + const params = { + originValues: [ + '我也是测1试', + '我是测试', + '我也是测试', + '我也是测试1', + '我也是1测试', + '测试', + ], + sortByValues: ['测试', '我是测试'], + }; + + // 原来的处理是 endsWith 去模糊匹配维值, 导致其他维值会排序到最上方 + expect(sortByCustom(params)).toEqual([ + '测试', + '我是测试', + '我也是测1试', + '我也是测试', + '我也是测试1', + '我也是1测试', + ]); + }); }); }); @@ -772,7 +796,7 @@ describe('GetSortByMeasureValues Total Fallback Tests', () => { describe('total group dimension sort test', () => { let sheet: SpreadSheet; - beforeEach(() => { + beforeEach(async () => { const currentOptions = { totals: { col: { @@ -805,12 +829,13 @@ describe('total group dimension sort test', () => { }; sheet = new PivotSheet(getContainer(), dataConfig, currentOptions); - sheet.render(); + await sheet.render(); }); afterEach(() => { sheet.destroy(); }); + test('should sort by col total with group', () => { // 根据列(类别)的总和排序 const sortParam: SortParam = { diff --git a/packages/s2-core/__tests__/unit/utils/text-spec.ts b/packages/s2-core/__tests__/unit/utils/text-spec.ts index 960a86fae7..aa084ce7a9 100644 --- a/packages/s2-core/__tests__/unit/utils/text-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/text-spec.ts @@ -1,4 +1,4 @@ -import { ELLIPSIS_SYMBOL } from '@/common'; +import { ELLIPSIS_SYMBOL, EMPTY_FIELD_VALUE } from '@/common'; import { drawCustomContent, getCellWidth, @@ -8,6 +8,7 @@ import { isUnchangedValue, isUpDataValue, isZeroOrEmptyValue, + replaceEmptyFieldValue, } from '@/utils/text'; import { createFakeSpreadSheet, @@ -385,3 +386,19 @@ describe('getDisplayText', () => { expect(getDisplayText(value, '@')).toEqual(result); }); }); + +describe('replaceEmptyFieldValue', () => { + test.each` + value | result + ${'value'} | ${'value'} + ${EMPTY_FIELD_VALUE} | ${'-'} + ${undefined} | ${undefined} + ${0} | ${0} + ${NaN} | ${NaN} + `( + 'should get correct empty field display value for $value', + ({ value, result }) => { + expect(replaceEmptyFieldValue(value)).toEqual(result); + }, + ); +}); diff --git a/packages/s2-core/__tests__/unit/utils/tooltip-spec.ts b/packages/s2-core/__tests__/unit/utils/tooltip-spec.ts index 2503d8ebc6..a3ef6b164d 100644 --- a/packages/s2-core/__tests__/unit/utils/tooltip-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/tooltip-spec.ts @@ -29,6 +29,7 @@ import { getTooltipOptions, setTooltipContainerStyle, } from '@/utils/tooltip'; +import { DARK_THEME_CLS } from '@antv/s2'; import { omit } from 'lodash'; import * as dataConfig from 'tests/data/mock-dataset.json'; import { @@ -636,6 +637,30 @@ describe('Tooltip Utils Tests', () => { expect(tooltipData).toEqual(defaultTooltipData); }); + test('should get correctly data cell details', () => { + s2 = createPivotSheet(); + + const cell = createMockCellInfo('test-a'); + const tooltipData = getTooltipData({ + cellInfos: [ + getCellData(7789, false, { + sub_type: '桌子', + type: '家具', + }), + ], + options: { + enableFormat: true, + isTotals: false, + hideSummary: true, + onlyShowCellText: false, + }, + targetCell: cell.mockCell, + spreadsheet: s2, + }); + + expect(tooltipData).toMatchSnapshot(); + }); + test.each([ { count: 1, isTotalCell: true, name: '单选' }, { count: 4, isTotalCell: false, name: '多选' }, @@ -948,7 +973,7 @@ describe('Tooltip Utils Tests', () => { }); describe('Tooltip Get Data Tests For TableSheet', () => { - beforeEach(() => { + beforeEach(async () => { s2 = createTableSheet( { seriesNumber: { @@ -957,7 +982,7 @@ describe('Tooltip Utils Tests', () => { }, { useSimpleData: false }, ); - s2.render(); + await s2.render(); }); afterEach(() => { @@ -1197,6 +1222,16 @@ describe('Tooltip Utils Tests', () => { ); }); + test('should set container dark style', () => { + const container = document.createElement('div'); + + setTooltipContainerStyle(container, { + dark: true, + }); + + expect(container.classList.contains(DARK_THEME_CLS)).toBeTruthy(); + }); + test('should get custom fields summaries of custom tree', () => { const mockData = [ { diff --git a/packages/s2-core/__tests__/util/helpers.ts b/packages/s2-core/__tests__/util/helpers.ts index ee4d3591db..25c4cf3f31 100644 --- a/packages/s2-core/__tests__/util/helpers.ts +++ b/packages/s2-core/__tests__/util/helpers.ts @@ -23,6 +23,7 @@ import * as dataConfig from 'tests/data/mock-dataset.json'; import * as simpleDataConfig from 'tests/data/simple-data.json'; import { assembleDataCfg, assembleOptions } from '.'; import { + CELL_PADDING, DEFAULT_FROZEN_COUNTS, EventController, FrozenGroupArea, @@ -214,6 +215,7 @@ export const createFakeSpreadSheet = (config?: { s2.hideTooltip = jest.fn(); s2.showTooltip = jest.fn(); s2.showTooltipWithInfo = jest.fn(); + s2.getThemeName = jest.fn(); s2.isTableMode = jest.fn(); s2.isPivotMode = jest.fn(); s2.getCell = jest.fn(); @@ -231,6 +233,7 @@ export const createFakeSpreadSheet = (config?: { s2.getTotalsConfig = jest.fn(); s2.getLayoutWidthType = jest.fn(); s2.measureTextWidth = jest.fn(); + s2.measureTextWidthRoughly = jest.fn(); s2.isFrozenRowHeader = jest.fn(); s2.getSeriesNumberText = jest.fn(() => getDefaultSeriesNumberText()); s2.theme = getTheme({ @@ -256,6 +259,8 @@ export const createMockCellInfo = ( level = 0, cornerType = '', cellType = undefined, + children = [], + isLeaf = false, }: Partial = {}, ) => { const mockCellViewMeta: Partial = { @@ -265,10 +270,12 @@ export const createMockCellInfo = ( rowIndex, colId, level, - type: undefined, + type: cellType, cornerType, x: 0, y: 0, + children, + isLeaf, spreadsheet: { dataCfg: { meta: null, @@ -296,6 +303,8 @@ export const createMockCellInfo = ( 'colId', 'field', 'cornerType', + 'children', + 'isLeaf', ]); const mockCell = { ...mockCellViewMeta, @@ -305,10 +314,21 @@ export const createMockCellInfo = ( getActualText: jest.fn(), getFieldValue: jest.fn(), getBBoxByType: jest.fn(() => {}), - getStyle: jest.fn(() => {}), + getStyle: jest.fn(() => ({ + cell: { + padding: { + top: CELL_PADDING, + right: CELL_PADDING, + bottom: CELL_PADDING, + left: CELL_PADDING, + }, + }, + })), hideInteractionShape: jest.fn(), updateByState: jest.fn(), isTextOverflowing: jest.fn(), + getTextLineHeight: jest.fn(() => 16), + getMaxLinesByCustomHeight: jest.fn(() => 1), } as unknown as S2CellType; const getNode = () => mockCellViewMeta as unknown as Node; diff --git a/packages/s2-core/package.json b/packages/s2-core/package.json index 23fb5c9d9a..731c7e5dad 100644 --- a/packages/s2-core/package.json +++ b/packages/s2-core/package.json @@ -1,6 +1,6 @@ { "name": "@antv/s2", - "version": "2.0.0-next.29", + "version": "2.1.4", "private": false, "description": "effective spreadsheet render core lib", "keywords": [ @@ -26,8 +26,19 @@ "*.css", "dist/*" ], + "exports": { + ".": { + "import": "./esm/index.js", + "require": "./lib/index.js" + }, + "./extends": { + "import": "./esm/extends/index.js", + "require": "./lib/extends/index.js" + }, + "./*": "./*" + }, "main": "lib/index.js", - "unpkg": "dist/index.min.js", + "unpkg": "dist/s2.min.js", "module": "esm/index.js", "types": "esm/index.d.ts", "directories": { @@ -41,22 +52,20 @@ "README.md" ], "scripts": { - "build": "npm-run-all clean --parallel build:umd build:cjs build:esm build:dts", + "build": "npm-run-all clean --parallel build:cjs build:esm build:umd", "build:analysis": "cross-env FORMAT=esm ANALYSIS=true rollup -c rollup.config.mjs", - "build:cjs": "cross-env FORMAT=cjs rollup -c rollup.config.mjs", - "build:dts": "run-s dts:*", - "build:esm": "cross-env FORMAT=es rollup -c rollup.config.mjs", + "build:cjs": "tsc --module commonjs --outDir lib -p tsconfig.build.json && pnpm build:sync-assets lib/", + "build:esm": "tsc --module ESNext --outDir esm -p tsconfig.build.json && pnpm build:sync-assets esm/", "build:size-limit": "size-limit", "build:size-limit-json": "pnpm build:size-limit -- --json", + "build:sync-assets": "rsync -av --include='*/' --include='*.less' --include='*.svg' --exclude='*' src/", "build:umd": "cross-env FORMAT=umd rollup -c rollup.config.mjs", "clean": "rimraf lib esm dist temp", - "dts:build": "tsc -p tsconfig.declaration.json", - "dts:extract": "cross-env LIB=s2-core node ../../scripts/dts.js", "start": "pnpm test:live", "sync-event": "node ./scripts/sync-event.mjs", "test": "jest --passWithNoTests --detectOpenHandles", - "test:ci": "pnpm test -- --maxWorkers=3", - "test:ci-coverage": "pnpm test:coverage --maxWorkers=3", + "test:ci": "pnpm test", + "test:ci-coverage": "pnpm test:coverage", "test:coverage": "pnpm test -- --coverage", "test:live": "node ./scripts/test-live.mjs", "test:watch": "pnpm test -- --watch", @@ -65,9 +74,9 @@ }, "dependencies": { "@antv/event-emitter": "^0.1.3", - "@antv/g": "^6.0.14", - "@antv/g-canvas": "^2.0.15", - "@antv/g-lite": "^2.0.11", + "@antv/g": "^6.1.8", + "@antv/g-canvas": "^2.0.26", + "@antv/g-lite": "^2.2.3", "d3-ease": "^3.0.1", "d3-interpolate": "^1.3.2", "d3-timer": "^1.0.9", @@ -76,6 +85,7 @@ "tinycolor2": "^1.6.0" }, "devDependencies": { + "@antv/g2": "^5.1.21", "@testing-library/dom": "^10.1.0", "@types/d3-dsv": "^3.0.7", "@types/d3-ease": "^3.0.2", @@ -85,17 +95,25 @@ "csstype": "^3.1.3", "d3-dsv": "^1.1.1" }, + "peerDependencies": { + "@antv/g2": ">=5.1.21" + }, + "peerDependenciesMeta": { + "@antv/g2": { + "optional": true + } + }, "publishConfig": { "access": "public" }, "size-limit": [ { - "path": "./dist/index.min.js", + "path": "./dist/s2.min.js", "import": "{ createComponent }", - "limit": "200 kB" + "limit": "240 kB" }, { - "path": "./dist/style.min.css", + "path": "./dist/s2.min.css", "limit": "5 kB" } ], diff --git a/packages/s2-core/rollup.config.mjs b/packages/s2-core/rollup.config.mjs index c92c130032..a3d1d2046a 100644 --- a/packages/s2-core/rollup.config.mjs +++ b/packages/s2-core/rollup.config.mjs @@ -1,5 +1,4 @@ /* eslint-disable import/no-extraneous-dependencies */ -import alias from '@rollup/plugin-alias'; import commonjs from '@rollup/plugin-commonjs'; import resolve from '@rollup/plugin-node-resolve'; import replace from '@rollup/plugin-replace'; @@ -27,19 +26,11 @@ const output = { exports: 'named', name: 'S2', sourcemap: true, + dir: outDir, }; const plugins = [ peerDepsExternal(), - alias({ - entries: [ - { find: 'lodash', replacement: 'lodash-es' }, - { - find: /^(?.*).less\?inline$/, - replacement: '$1.less', - }, - ], - }), replace({ 'process.env.NODE_ENV': JSON.stringify('production'), preventAssignment: true, @@ -52,6 +43,10 @@ const plugins = [ tsconfigOverride: { outDir, include: ['src', '../../global.d.ts'], + compilerOptions: { + declaration: false, + useDefineForClassFields: false, + }, }, }), postcss({ @@ -62,7 +57,7 @@ const plugins = [ stylus: null, less: { javascriptEnabled: true }, }, - extract: `style${isUmdFormat ? '.min' : ''}.css`, + extract: `s2${isUmdFormat ? '.min' : ''}.css`, }), /** 主题变量 less 不需要 extract&inject */ postcss({ @@ -82,15 +77,32 @@ if (enableAnalysis) { } if (isUmdFormat) { - output.file = 'dist/index.min.js'; + output.globals = { + '@antv/s2': 'S2', + }; + output.entryFileNames = '[name].min.js'; plugins.push(terser()); -} else { - output.dir = outDir; } // eslint-disable-next-line import/no-default-export -export default { - input: 'src/index.ts', - output, - plugins, -}; +export default [ + { + input: { + s2: 'src/index.ts', + }, + output, + plugins, + }, + { + input: { + 's2-extends': 'src/extends/index.ts', + }, + output: { + ...output, + name: 'S2Extends', + }, + plugins, + + external: ['@antv/s2'], + }, +]; diff --git a/packages/s2-core/scripts/sync-event.mjs b/packages/s2-core/scripts/sync-event.mjs index 7d7f3593d2..b0a754e7f3 100644 --- a/packages/s2-core/scripts/sync-event.mjs +++ b/packages/s2-core/scripts/sync-event.mjs @@ -82,7 +82,6 @@ const readListLine = (question) => { const VUE_USE_EVENTS_PATH = 'packages/s2-vue/src/hooks/useEvents.ts'; const REACT_USE_EVENTS_PATH = 'packages/s2-react/src/hooks/useEvents.ts'; const VUE_INTERFACE_PATH = 'packages/s2-vue/src/utils/initPropAndEmits.ts'; -const COMMON_INTERFACE_PATH = 'packages/s2-shared/src/interface.ts'; function insertVueUseEvent(eventName, eventHookName) { const vueStr = vueEventTemplate(eventName, eventHookName); @@ -105,17 +104,6 @@ function insertVueInterface(eventName) { insertEventIntoFile(vuePath, `'${vueEventName}',`); } -function insertCommonInterface(eventName, eventHookName) { - const commonEventName = getReactEventName(eventName); - const commonInterfaceTemplate = getCommonInterfaceTemplate( - eventHookName, - commonEventName, - ); - const reactPath = resolve(process.cwd(), `../../${COMMON_INTERFACE_PATH}`); - - insertEventIntoFile(reactPath, `${commonInterfaceTemplate}`); -} - const syncEvent = async () => { const { eventName } = await readInputLine('请输入事件名称:'); const { eventHookName } = await readListLine( @@ -126,7 +114,6 @@ const syncEvent = async () => { insertVueUseEvent(eventName, eventHookName); insertVueInterface(eventName); insertReactUseEvent(eventName, eventHookName); - insertCommonInterface(eventName, eventHookName); // eslint-disable-next-line no-console console.warn(`✅${eventName}插入完成! ⚠️ 注意自己检查生成结果和格式化一下`); diff --git a/packages/s2-core/scripts/test-live.mjs b/packages/s2-core/scripts/test-live.mjs index a29a794bc4..ac491d2ea5 100644 --- a/packages/s2-core/scripts/test-live.mjs +++ b/packages/s2-core/scripts/test-live.mjs @@ -1,14 +1,14 @@ /* eslint-disable import/no-extraneous-dependencies */ import { execSync } from 'child_process'; -import ora from 'ora'; import { glob } from 'glob'; import { default as inquirer } from 'inquirer'; import { default as autoCompletePrompt } from 'inquirer-autocomplete-prompt'; +import ora from 'ora'; inquirer.registerPrompt('autocomplete', autoCompletePrompt); function run(path) { - const command = `cross-env DEBUG_MODE=1 npx jest ${path} --passWithNoTests --detectOpenHandles`; + const command = `cross-env DEBUG_MODE=1 npx jest ${path} --passWithNoTests`; const jestSpinner = ora(`[测试运行中]: ${command}`).start(); try { diff --git a/packages/s2-core/src/cell/base-cell.ts b/packages/s2-core/src/cell/base-cell.ts index 64c4992e16..8b607b1a12 100644 --- a/packages/s2-core/src/cell/base-cell.ts +++ b/packages/s2-core/src/cell/base-cell.ts @@ -24,6 +24,7 @@ import { import { CellType, DEFAULT_FONT_COLOR, + DEFAULT_TEXT_LINE_HEIGHT, InteractionStateName, REVERSE_FONT_COLOR, SHAPE_ATTRS_MAP, @@ -141,7 +142,7 @@ export abstract class BaseCell extends Group { protected abstract getBorderPositions(): CellBorderPosition[]; - protected abstract getTextStyle(): TextTheme; + protected abstract getTextStyle(): TextTheme & CellTextWordWrapStyle; protected abstract getFormattedFieldValue(): FormatResult; @@ -189,6 +190,8 @@ export abstract class BaseCell extends Group { // eslint-disable-next-line @typescript-eslint/no-unused-vars protected handleRestOptions(...options: unknown[]) {} + protected getResizedTextMaxLines(): number | void {} + /* -------------------------------------------------------------------------- */ /* common functions that will be used in subtype */ /* -------------------------------------------------------------------------- */ @@ -299,6 +302,16 @@ export abstract class BaseCell extends Group { return this.textShape?.getLineBoundingRects() || []; } + /** + * 获取文本行高 + */ + public getTextLineHeight() { + return ( + this.textShape?.parsedStyle?.metrics?.lineHeight || + DEFAULT_TEXT_LINE_HEIGHT + ); + } + /** * 获取单元格空值占位符 */ @@ -477,6 +490,7 @@ export abstract class BaseCell extends Group { // G 遵循浏览器的规范, 空间不足以展示省略号时, 会裁剪文字, 而不是展示省略号: https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#ellipsis const maxTextWidth = Math.max(this.getMaxTextWidth(), 0) + EXTRA_PIXEL; const textStyle = this.getTextStyle(); + const maxLines = this.getResizedTextMaxLines() || textStyle?.maxLines; // 在坐标计算 (getTextPosition) 之前, 预渲染一次, 提前生成 textShape, 获得文字宽度, 用于计算 icon 绘制坐标 this.renderTextShape({ @@ -485,6 +499,7 @@ export abstract class BaseCell extends Group { y: 0, text: this.getFieldValue()!, wordWrapWidth: maxTextWidth, + maxLines, }); if (this.isShallowRender()) { @@ -814,4 +829,35 @@ export abstract class BaseCell extends Group { backgroundColor: this.getStyle().cell.backgroundColor, }; } + + public getMaxLinesByCustomHeight(options: { + targetCell?: S2CellType; + displayHeight?: number; + isCustomHeight?: boolean; + }) { + const { + targetCell = this, + displayHeight = this.meta.height, + isCustomHeight = false, + } = options; + const cell = targetCell || this; + const cellStyle = this.spreadsheet.options.style?.[cell.cellType]; + const isEnableHeightAdaptive = + cellStyle?.maxLines! > 1 && cellStyle?.wordWrap; + + if (!isEnableHeightAdaptive || !isCustomHeight) { + return; + } + + const { cell: cellTheme } = cell?.getStyle() as DefaultCellTheme; + const padding = cellTheme!.padding!.top! + cellTheme!.padding!.bottom!; + const lineHeight = cell?.getTextLineHeight()!; + + const maxLines = Math.max( + 1, + Math.floor((displayHeight - padding) / lineHeight), + ); + + return maxLines; + } } diff --git a/packages/s2-core/src/cell/col-cell.ts b/packages/s2-core/src/cell/col-cell.ts index 58bc79dca4..e856de30d7 100644 --- a/packages/s2-core/src/cell/col-cell.ts +++ b/packages/s2-core/src/cell/col-cell.ts @@ -121,7 +121,6 @@ export class ColCell extends HeaderCell { viewportWidth, cornerWidth = 0, scrollX = 0, - position, } = this.getHeaderConfig(); const frozenGroupAreas = (this.spreadsheet.facet as FrozenFacet) @@ -138,18 +137,13 @@ export class ColCell extends HeaderCell { }; } - const scrollXUntilColStickToLeft = frozenColGroupWidth - ? cornerWidth - : position.x; - return { - start: - frozenColGroupWidth + Math.max(0, scrollX - scrollXUntilColStickToLeft), + start: frozenColGroupWidth + Math.max(0, scrollX - cornerWidth), size: viewportWidth - frozenColGroupWidth - frozenTrailingColGroupWidth + - Math.min(scrollX, scrollXUntilColStickToLeft), + Math.min(scrollX, cornerWidth), }; } @@ -265,6 +259,7 @@ export class ColCell extends HeaderCell { } const { y, height } = this.meta; + const { position } = this.getHeaderConfig(); const resizeStyle = this.getResizeAreaStyle(); const resizeArea = this.getColResizeArea(); @@ -282,6 +277,7 @@ export class ColCell extends HeaderCell { return; } + const offsetY = position.y + y; const resizeAreaWidth = this.getResizeAreaWidth(); // 列高调整热区 @@ -290,10 +286,11 @@ export class ColCell extends HeaderCell { type: ResizeDirectionType.Vertical, effect: ResizeAreaEffect.Field, offsetX: 0, - offsetY: y, + offsetY, width: resizeAreaWidth, height, meta: this.meta, + cell: this, }); resizeArea.appendChild( @@ -303,7 +300,7 @@ export class ColCell extends HeaderCell { style: { ...attrs.style, x: 0, - y: y + height - resizeStyle.size!, + y: offsetY + height - resizeStyle.size!, width: resizeAreaWidth, }, }, @@ -322,16 +319,19 @@ export class ColCell extends HeaderCell { } protected shouldAddVerticalResizeArea() { + if (this.getMeta().isFrozen) { + return true; + } + const { x, y, width, height } = this.meta; const { - scrollX, + scrollX = 0, scrollY, cornerWidth = 0, height: headerHeight, width: headerWidth, } = this.getHeaderConfig(); - const scrollContainsRowHeader = !this.spreadsheet.isFrozenRowHeader(); const resizeStyle = this.getResizeAreaStyle(); const resizeAreaBBox: SimpleBBox = { @@ -341,12 +341,29 @@ export class ColCell extends HeaderCell { height, }; - const resizeClipAreaBBox: SimpleBBox = { - x: scrollContainsRowHeader ? -cornerWidth : 0, - y: 0, - width: scrollContainsRowHeader ? cornerWidth + headerWidth : headerWidth, - height: headerHeight, - }; + const frozenGroupAreas = (this.spreadsheet.facet as FrozenFacet) + .frozenGroupAreas; + const colWidth = frozenGroupAreas[FrozenGroupArea.Col].width; + const trailingColWidth = + frozenGroupAreas[FrozenGroupArea.TrailingCol].width; + + let resizeClipAreaBBox: SimpleBBox; + + if (this.spreadsheet.isFrozenRowHeader()) { + resizeClipAreaBBox = { + x: colWidth, + y: 0, + width: headerWidth - colWidth - trailingColWidth, + height: headerHeight, + }; + } else { + resizeClipAreaBBox = { + x: colWidth - cornerWidth, + y: 0, + width: headerWidth - colWidth - trailingColWidth + cornerWidth, + height: headerHeight, + }; + } return shouldAddResizeArea(resizeAreaBBox, resizeClipAreaBBox, { scrollX, @@ -356,10 +373,41 @@ export class ColCell extends HeaderCell { protected getVerticalResizeAreaOffset() { const { x, y } = this.meta; - const { scrollX = 0, position } = this.getHeaderConfig(); + const { + scrollX = 0, + position, + cornerWidth = 0, + viewportWidth, + } = this.getHeaderConfig(); + + const isFrozenRowHeader = this.spreadsheet.isFrozenRowHeader(); + + const frozenGroupAreas = (this.spreadsheet.facet as FrozenFacet) + .frozenGroupAreas; + + const frozenColGroup = frozenGroupAreas[FrozenGroupArea.Col]; + const frozenTrailingColGroup = + frozenGroupAreas[FrozenGroupArea.TrailingCol]; + + let offsetX = position?.x; + + if (this.getMeta().isFrozenHead) { + offsetX += + x - + frozenColGroup.x - + (isFrozenRowHeader ? 0 : Math.min(scrollX, cornerWidth)); + } else if (this.getMeta().isFrozenTrailing) { + offsetX += + x - + frozenTrailingColGroup.x + + viewportWidth - + frozenTrailingColGroup.width; + } else { + offsetX += x - scrollX; + } return { - x: position?.x + x - scrollX, + x: offsetX, y: position?.y + y, }; } @@ -367,6 +415,7 @@ export class ColCell extends HeaderCell { protected drawVerticalResizeArea() { if ( !this.meta.isLeaf || + this.meta.hideColCellHorizontalResize || !this.shouldDrawResizeAreaByType('colCellHorizontal', this) ) { return; @@ -395,6 +444,7 @@ export class ColCell extends HeaderCell { width, height, meta: this.meta, + cell: this, }); resizeArea.appendChild( @@ -532,4 +582,20 @@ export class ColCell extends HeaderCell { return isNextSiblingNodeHidden && isPrevSiblingNodeHidden; } + + /** + * 以下场景根据当前高度动态计算 maxLines, 保证文本展示合理性 + * 1.手动拖拽 2.预设高度 + */ + protected getResizedTextMaxLines() { + const { colCell } = this.spreadsheet.options.style!; + + return ( + colCell?.maxLinesByField?.[this.meta.id] ?? + colCell?.maxLinesByField?.[this.meta.field] ?? + this.getMaxLinesByCustomHeight({ + isCustomHeight: this.meta.extra?.isCustomHeight, + }) + ); + } } diff --git a/packages/s2-core/src/cell/corner-cell.ts b/packages/s2-core/src/cell/corner-cell.ts index 240be80c55..55c8331ed8 100644 --- a/packages/s2-core/src/cell/corner-cell.ts +++ b/packages/s2-core/src/cell/corner-cell.ts @@ -24,6 +24,7 @@ import { getResizeAreaAttrs, shouldAddResizeArea, } from '../utils/interaction/resize'; +import { isMobile } from '../utils/is-mobile'; import { HeaderCell } from './header-cell'; export class CornerCell extends HeaderCell { @@ -55,6 +56,19 @@ export class CornerCell extends HeaderCell { this.update(); } + private onTreeIconClick(isCollapsed: boolean) { + if (isMobile()) { + return; + } + + this.emitCollapseEvent(isCollapsed); + } + + private emitCollapseEvent(isCollapsed: boolean) { + this.spreadsheet.facet.resetScrollY(); + this.spreadsheet.emit(S2Event.ROW_CELL_ALL_COLLAPSED__PRIVATE, isCollapsed); + } + /** * 绘制折叠展开的 icon */ @@ -85,13 +99,15 @@ export class CornerCell extends HeaderCell { }, isCollapsed, onClick: () => { - this.spreadsheet.facet.resetScrollY(); - this.spreadsheet.emit( - S2Event.ROW_CELL_ALL_COLLAPSED__PRIVATE, - isCollapsed, - ); + this.onTreeIconClick(isCollapsed); }, }); + // 移动端, 点击热区为整个单元格 + if (isMobile()) { + this.addEventListener('touchend', () => { + this.emitCollapseEvent(isCollapsed); + }); + } } protected isLastRowCornerCell() { @@ -181,6 +197,7 @@ export class CornerCell extends HeaderCell { width, height, meta: this.meta, + cell: this, }); resizeArea.appendChild( @@ -209,7 +226,7 @@ export class CornerCell extends HeaderCell { protected getTreeIconWidth() { const { size, margin } = this.getStyle()!.icon!; - return this.showTreeIcon() ? size! + margin!.right! : 0; + return this.spreadsheet.isHierarchyTreeType() ? size! + margin!.right! : 0; } public getMaxTextWidth(): number { @@ -271,4 +288,17 @@ export class CornerCell extends HeaderCell { this.spreadsheet.dataSet.getFieldName(this.meta.field), ); } + + protected getResizedTextMaxLines() { + // 角头和列头高度一致 + const { colCell } = this.spreadsheet.options.style!; + + return ( + colCell?.maxLinesByField?.[this.meta.id] ?? + colCell?.maxLinesByField?.[this.meta.field] ?? + this.getMaxLinesByCustomHeight({ + isCustomHeight: this.meta.extra?.isCustomHeight, + }) + ); + } } diff --git a/packages/s2-core/src/cell/data-cell.ts b/packages/s2-core/src/cell/data-cell.ts index 8a800de508..8c45cc3710 100644 --- a/packages/s2-core/src/cell/data-cell.ts +++ b/packages/s2-core/src/cell/data-cell.ts @@ -1,16 +1,7 @@ import type { PointLike } from '@antv/g'; -import { - find, - first, - get, - isEmpty, - isEqual, - isObject, - isPlainObject, - merge, -} from 'lodash'; +import { find, first, get, isEmpty, isEqual, isObject, merge } from 'lodash'; import { BaseCell } from '../cell/base-cell'; -import { G2_THEME_TYPE } from '../common'; +import { DEFAULT_STYLE } from '../common'; import { EMPTY_PLACEHOLDER } from '../common/constant/basic'; import { CellType, @@ -18,7 +9,6 @@ import { SHAPE_STYLE_MAP, } from '../common/constant/interaction'; import type { - BaseChartData, CellMeta, Condition, ConditionMappingResult, @@ -26,8 +16,6 @@ import type { HeaderActionNameOptions, IconCondition, InteractionStateTheme, - MiniChartData, - MultiData, TextTheme, ValueRange, ViewMeta, @@ -91,33 +79,6 @@ export class DataCell extends BaseCell { return isObject(fieldValue); } - public isChartData() { - const fieldValue = this.getFieldValue(); - - return isPlainObject( - (fieldValue as unknown as MultiData)?.values, - ); - } - - public getRenderChartData(): BaseChartData { - const { fieldValue } = this.meta; - - return (fieldValue as MultiData)?.values as BaseChartData; - } - - public getRenderChartOptions() { - const chartData = this.getRenderChartData(); - const cellArea = this.getBBoxByType(CellClipBox.CONTENT_BOX); - const themeName = this.spreadsheet.getThemeName(); - - return { - autoFit: true, - theme: { type: G2_THEME_TYPE[themeName] }, - ...cellArea, - ...chartData, - }; - } - protected getBorderPositions(): CellBorderPosition[] { return [CellBorderPosition.BOTTOM, CellBorderPosition.RIGHT]; } @@ -548,4 +509,17 @@ export class DataCell extends BaseCell { updateShapeAttr(this.conditionIconShapes, SHAPE_STYLE_MAP.opacity, opacity); } + + protected getResizedTextMaxLines() { + const { rowCell } = this.spreadsheet.options.style!; + + // 数值和行高保持一致, 同时兼容明细表 + return ( + rowCell?.maxLinesByField?.[this.meta.id] ?? + rowCell?.maxLinesByField?.[this.meta.rowId!] ?? + this.getMaxLinesByCustomHeight({ + isCustomHeight: this.meta.height !== DEFAULT_STYLE.dataCell?.height, + }) + ); + } } diff --git a/packages/s2-core/src/cell/header-cell.ts b/packages/s2-core/src/cell/header-cell.ts index 442175309f..553d543048 100644 --- a/packages/s2-core/src/cell/header-cell.ts +++ b/packages/s2-core/src/cell/header-cell.ts @@ -442,6 +442,15 @@ export abstract class HeaderCell< return this.leftIconPosition || this.rightIconPosition; } + protected getInteractedCells() { + return this.spreadsheet.interaction?.getCells([ + CellType.CORNER_CELL, + CellType.COL_CELL, + CellType.ROW_CELL, + CellType.SERIES_NUMBER_CELL, + ]); + } + public update() { const { interaction } = this.spreadsheet; const stateInfo = interaction?.getState(); @@ -452,12 +461,7 @@ export abstract class HeaderCell< return; } - const cells = interaction?.getCells([ - CellType.CORNER_CELL, - CellType.COL_CELL, - CellType.ROW_CELL, - CellType.SERIES_NUMBER_CELL, - ]); + const cells = this.getInteractedCells(); if (!first(cells)) { return; diff --git a/packages/s2-core/src/cell/merged-cell.ts b/packages/s2-core/src/cell/merged-cell.ts index 4c7ca45b8c..c344240eee 100644 --- a/packages/s2-core/src/cell/merged-cell.ts +++ b/packages/s2-core/src/cell/merged-cell.ts @@ -2,12 +2,12 @@ import { isEmpty } from 'lodash'; import { CellType } from '../common/constant'; import { CellBorderPosition, type ViewMeta } from '../common/interface'; import type { SpreadSheet } from '../sheet-type'; -import { getBorderPositionAndStyle } from '../utils'; -import { renderLine, renderPolygon } from '../utils/g-renders'; +import { getBorderPositionAndStyle } from '../utils/cell/cell'; import { getPolygonPoints, getRightAndBottomCells, -} from '../utils/interaction/merge-cell'; +} from '../utils/cell/merged-cell'; +import { renderLine, renderPolygon } from '../utils/g-renders'; import { drawCustomContent } from '../utils/text'; import { DataCell } from './data-cell'; diff --git a/packages/s2-core/src/cell/row-cell.ts b/packages/s2-core/src/cell/row-cell.ts index 026824986b..0acb6d7ae5 100644 --- a/packages/s2-core/src/cell/row-cell.ts +++ b/packages/s2-core/src/cell/row-cell.ts @@ -161,8 +161,8 @@ export class RowCell extends HeaderCell { iconCfg: { x: iconX, y: iconY, - width: size!, - height: size!, + width: size, + height: size, fill, }, isCollapsed, @@ -173,7 +173,7 @@ export class RowCell extends HeaderCell { // 移动端, 点击热区为整个单元格 if (isMobile()) { - this.addEventListener('click', () => { + this.addEventListener('touchend', () => { this.emitCollapseEvent(); }); } @@ -212,9 +212,17 @@ export class RowCell extends HeaderCell { return (!isLeaf && level === 0) || isTotals; } + protected getResizesArea() { + return getOrCreateResizeAreaGroupById( + this.spreadsheet, + KEY_GROUP_ROW_RESIZE_AREA, + ); + } + protected drawResizeAreaInLeaf() { if ( !this.meta.isLeaf || + this.meta.hideRowCellVerticalResize || !this.shouldDrawResizeAreaByType('rowCellVertical', this) ) { return; @@ -222,10 +230,7 @@ export class RowCell extends HeaderCell { const { x, y, width, height } = this.getBBoxByType(); const resizeStyle = this.getResizeAreaStyle(); - const resizeArea = getOrCreateResizeAreaGroupById( - this.spreadsheet, - KEY_GROUP_ROW_RESIZE_AREA, - ); + const resizeArea = this.getResizesArea(); if (!resizeArea) { return; @@ -288,6 +293,7 @@ export class RowCell extends HeaderCell { width, height, meta: this.meta, + cell: this, }); resizeArea.appendChild( @@ -438,8 +444,8 @@ export class RowCell extends HeaderCell { const textArea = this.getTextArea(); const textStyle = this.getTextStyle(); const { cell, icon: iconStyle } = this.getStyle(); - const viewport = this.handleViewport(); + const textHeight = this.getActualTextHeight(); const { textStart } = adjustTextIconPositionWhileScrolling( viewport, @@ -450,7 +456,7 @@ export class RowCell extends HeaderCell { { align: normalizeTextAlign(textStyle.textBaseline!), size: { - textSize: textStyle.fontSize!, + textSize: textHeight, }, padding: { start: cell.padding.top, @@ -470,7 +476,7 @@ export class RowCell extends HeaderCell { const iconY = getVerticalIconPosition( iconStyle?.size!, textStart, - textStyle.fontSize!, + textHeight, textStyle.textBaseline!, ); @@ -485,4 +491,16 @@ export class RowCell extends HeaderCell { return { x: textX, y: textStart }; } + + protected getResizedTextMaxLines() { + const { rowCell } = this.spreadsheet.options.style!; + + return ( + rowCell?.maxLinesByField?.[this.meta.id] ?? + rowCell?.maxLinesByField?.[this.meta.field] ?? + this.getMaxLinesByCustomHeight({ + isCustomHeight: this.meta.extra?.isCustomHeight, + }) + ); + } } diff --git a/packages/s2-core/src/cell/table-col-cell.ts b/packages/s2-core/src/cell/table-col-cell.ts index a907be4bec..11601f5eab 100644 --- a/packages/s2-core/src/cell/table-col-cell.ts +++ b/packages/s2-core/src/cell/table-col-cell.ts @@ -1,16 +1,10 @@ import { find } from 'lodash'; import { ColCell } from '../cell/col-cell'; -import { - FrozenGroupArea, - HORIZONTAL_RESIZE_AREA_KEY_PRE, -} from '../common/constant'; +import { HORIZONTAL_RESIZE_AREA_KEY_PRE } from '../common/constant'; import type { FormatResult } from '../common/interface'; -import type { SimpleBBox } from '../engine'; -import type { FrozenFacet } from '../facet/frozen-facet'; import type { BaseHeaderConfig } from '../facet/header'; import { formattedFieldValue } from '../utils/cell/header-cell'; import { renderRect } from '../utils/g-renders'; -import { shouldAddResizeArea } from '../utils/interaction/resize'; import { getSortTypeIcon } from '../utils/sort-action'; export class TableColCell extends ColCell { @@ -35,88 +29,21 @@ export class TableColCell extends ColCell { ); } - protected shouldAddVerticalResizeArea() { - if (this.getMeta().isFrozen) { - return true; - } - - const { - scrollX, - scrollY, - width: headerWidth, - height: headerHeight, - spreadsheet, - } = this.getHeaderConfig(); - const { x, y, width, height } = this.getBBoxByType(); - const resizeStyle = this.getResizeAreaStyle(); - - const resizeAreaBBox: SimpleBBox = { - x: x + width - resizeStyle.size!, - y, - width: resizeStyle.size!, - height, - }; - - const frozenGroupAreas = (spreadsheet.facet as FrozenFacet) - .frozenGroupAreas; - const colWidth = frozenGroupAreas[FrozenGroupArea.Col].width; - const trailingColWidth = - frozenGroupAreas[FrozenGroupArea.TrailingCol].width; - - const resizeClipAreaBBox: SimpleBBox = { - x: colWidth, - y: 0, - width: headerWidth - colWidth - trailingColWidth, - height: headerHeight, - }; - - return shouldAddResizeArea(resizeAreaBBox, resizeClipAreaBBox, { - scrollX, - scrollY, - }); - } - - protected getVerticalResizeAreaOffset() { - const { x, y } = this.meta; - const { - scrollX = 0, - position, - spreadsheet, - viewportWidth, - } = this.getHeaderConfig(); - - const frozenGroupAreas = (spreadsheet.facet as FrozenFacet) - .frozenGroupAreas; - - const frozenColGroup = frozenGroupAreas[FrozenGroupArea.Col]; - const frozenTrailingColGroup = - frozenGroupAreas[FrozenGroupArea.TrailingCol]; - let offsetX = position?.x; - - if (this.getMeta().isFrozenHead) { - offsetX += x - frozenColGroup.x; - } else if (this.getMeta().isFrozenTrailing) { - offsetX += - x - - frozenTrailingColGroup.x + - viewportWidth - - frozenTrailingColGroup.width; - } else { - offsetX += x - scrollX; - } - - return { - x: offsetX, - y: position?.y + y, - }; - } - protected isSortCell() { return true; } protected showSortIcon() { - return this.spreadsheet.options.showDefaultHeaderActionIcon; + const { extra } = this.meta; + const { options } = this.spreadsheet; + const { showDefaultHeaderActionIcon } = options; + + if (!extra?.isCustomNode) { + return showDefaultHeaderActionIcon; + } + + // 自定义列头时, 只在叶子节点展示 + return showDefaultHeaderActionIcon && this.meta.isLeaf; } protected getTextStyle() { diff --git a/packages/s2-core/src/cell/table-data-cell.ts b/packages/s2-core/src/cell/table-data-cell.ts index fc47f8f640..903881a18a 100644 --- a/packages/s2-core/src/cell/table-data-cell.ts +++ b/packages/s2-core/src/cell/table-data-cell.ts @@ -134,6 +134,7 @@ export class TableDataCell extends DataCell { width, height, meta: this.meta, + cell: this, }); resizeArea.appendChild( @@ -154,4 +155,18 @@ export class TableDataCell extends DataCell { protected isDisableHover(cellMeta: CellMeta) { return cellMeta?.type === CellType.COL_CELL; } + + protected getResizedTextMaxLines() { + const { facet, options } = this.spreadsheet; + const { rowCell } = options.style!; + const { id, rowId, rowIndex } = this.meta; + + return ( + rowCell?.maxLinesByField?.[id] ?? + rowCell?.maxLinesByField?.[rowId!] ?? + this.getMaxLinesByCustomHeight({ + isCustomHeight: facet?.customRowHeightStatusMap?.[rowIndex], + }) + ); + } } diff --git a/packages/s2-core/src/common/constant/basic.ts b/packages/s2-core/src/common/constant/basic.ts index 39ba5bbadc..8017fa9d86 100644 --- a/packages/s2-core/src/common/constant/basic.ts +++ b/packages/s2-core/src/common/constant/basic.ts @@ -41,9 +41,8 @@ export const KEY_GROUP_ROW_INDEX_RESIZE_AREA = 'rowIndexResizeAreaGroup'; * row */ export const KEY_GROUP_ROW_SCROLL = 'rowScrollGroup'; -export const KEY_GROUP_ROW_HEADER_FROZEN = 'rowHeaderFrozenGroup'; -export const KEY_GROUP_ROW_HEADER_FROZEN_TRAILING = - 'rowHeaderFrozenTrailingGroup'; +export const KEY_GROUP_ROW_FROZEN = 'rowHeaderFrozenGroup'; +export const KEY_GROUP_ROW_FROZEN_TRAILING = 'rowHeaderFrozenTrailingGroup'; export const KEY_GROUP_ROW_RESIZE_AREA = 'rowResizeAreaGroup'; /** @@ -90,3 +89,5 @@ export const getDefaultCornerText = () => i18n('指标'); // 省略号 export const ELLIPSIS_SYMBOL = '...'; + +export const DEFAULT_TEXT_LINE_HEIGHT = 16; diff --git a/packages/s2-core/src/common/constant/events/basic.ts b/packages/s2-core/src/common/constant/events/basic.ts index d48bfe21bb..d6aa997d1f 100644 --- a/packages/s2-core/src/common/constant/events/basic.ts +++ b/packages/s2-core/src/common/constant/events/basic.ts @@ -12,10 +12,13 @@ export enum S2Event { ROW_CELL_COLLAPSED = 'row-cell:collapsed', ROW_CELL_ALL_COLLAPSED = 'row-cell:all-collapsed', ROW_CELL_RENDER = 'row-cell:render', + ROW_CELL_SELECTED = 'row-cell:selected', // 内部用来通信的 event ROW_CELL_COLLAPSED__PRIVATE = 'row-cell:collapsed__private', ROW_CELL_ALL_COLLAPSED__PRIVATE = 'row-cell:all-collapsed__private', + DATA_CELL_HOVER_TRIGGERED_PRIVATE = 'data-cell:hover-trigger__private', + DATA_CELL_CLICK_TRIGGERED_PRIVATE = 'data-cell:click-trigger__private', /** ================ Col Cell ================ */ COL_CELL_HOVER = 'col-cell:hover', @@ -29,6 +32,7 @@ export enum S2Event { COL_CELL_EXPANDED = 'col-cell:expanded', COL_CELL_HIDDEN = 'col-cell:hidden', COL_CELL_RENDER = 'col-cell:render', + COL_CELL_SELECTED = 'col-cell:selected', /** ================ Data Cell ================ */ DATA_CELL_HOVER = 'data-cell:hover', @@ -41,6 +45,7 @@ export enum S2Event { DATA_CELL_BRUSH_SELECTION = 'data-cell:brush-selection', DATA_CELL_SELECT_MOVE = 'data-cell:select-move', DATA_CELL_RENDER = 'data-cell:render', + DATA_CELL_SELECTED = 'data-cell:selected', /** ================ Corner Cell ================ */ CORNER_CELL_HOVER = 'corner-cell:hover', @@ -51,6 +56,7 @@ export enum S2Event { CORNER_CELL_MOUSE_UP = 'corner-cell:mouse-up', CORNER_CELL_MOUSE_MOVE = 'corner-cell:mouse-move', CORNER_CELL_RENDER = 'corner-cell:render', + CORNER_CELL_SELECTED = 'corner-cell:selected', /** ================ Merged Cells ================ */ MERGED_CELLS_HOVER = 'merged-cells:hover', diff --git a/packages/s2-core/src/common/constant/events/origin.ts b/packages/s2-core/src/common/constant/events/origin.ts index 93a2856ecb..97386e02ad 100644 --- a/packages/s2-core/src/common/constant/events/origin.ts +++ b/packages/s2-core/src/common/constant/events/origin.ts @@ -12,7 +12,6 @@ export enum OriginEventType { KEY_UP = 'keyup', CLICK = 'click', HOVER = 'hover', - DOUBLE_CLICK = 'dblclick', CONTEXT_MENU = 'contextmenu', POINTER_DOWN = 'pointerdown', POINTER_MOVE = 'pointermove', diff --git a/packages/s2-core/src/common/constant/interaction.ts b/packages/s2-core/src/common/constant/interaction.ts index 77421de5bd..561c7472f8 100644 --- a/packages/s2-core/src/common/constant/interaction.ts +++ b/packages/s2-core/src/common/constant/interaction.ts @@ -1,6 +1,8 @@ export enum InteractionName { CORNER_CELL_CLICK = 'cornerCellClick', DATA_CELL_CLICK = 'dataCellClick', + ROW_CELL_CLICK = 'rowCellClick', + COL_CELL_CLICK = 'colCellClick', MERGED_CELLS_CLICK = 'mergedCellsClick', ROW_COLUMN_CLICK = 'rowColumnClick', HEADER_CELL_LINK_CLICK = 'headerCellLinkClick', @@ -10,8 +12,11 @@ export enum InteractionName { COL_CELL_BRUSH_SELECTION = 'colCellBrushSelection', COL_ROW_RESIZE = 'rowColResize', DATA_CELL_MULTI_SELECTION = 'dataCellMultiSelection', + ROW_CELL_MULTI_SELECTION = 'rowCellMultiSelection', + COL_CELL_MULTI_SELECTION = 'colCellMultiSelection', RANGE_SELECTION = 'rangeSelection', SELECTED_CELL_MOVE = 'selectedCellMove', + GLOBAL_RESET = 'globalReset', } export enum InteractionStateName { diff --git a/packages/s2-core/src/common/constant/options.ts b/packages/s2-core/src/common/constant/options.ts index e4c4f85e31..9d97167455 100644 --- a/packages/s2-core/src/common/constant/options.ts +++ b/packages/s2-core/src/common/constant/options.ts @@ -28,7 +28,9 @@ export enum LayoutWidthType { export const SPLIT_LINE_WIDTH = 1; -export const DEFAULT_TREE_ROW_CELL_WIDTH = 120; +export const DEFAULT_ROW_CELL_TREE_WIDTH = 120; +export const DEFAULT_CELL_WIDTH = 96; +export const DEFAULT_CELL_HEIGHT = 30; export const DEFAULT_CELL_TEXT_WORD_WRAP_STYLE: CellTextWordWrapStyle = { wordWrap: true, @@ -43,19 +45,15 @@ export const DEFAULT_STYLE: S2Style = { rowCell: { ...DEFAULT_CELL_TEXT_WORD_WRAP_STYLE, showTreeLeafNodeAlignDot: false, - widthByField: null, - heightByField: null, }, colCell: { ...DEFAULT_CELL_TEXT_WORD_WRAP_STYLE, - height: 30, - widthByField: null, - heightByField: null, + height: DEFAULT_CELL_HEIGHT, }, dataCell: { ...DEFAULT_CELL_TEXT_WORD_WRAP_STYLE, - width: 96, - height: 30, + width: DEFAULT_CELL_WIDTH, + height: DEFAULT_CELL_HEIGHT, }, } as const; diff --git a/packages/s2-core/src/common/constant/resize.ts b/packages/s2-core/src/common/constant/resize.ts index 775132d863..99b97f89f2 100644 --- a/packages/s2-core/src/common/constant/resize.ts +++ b/packages/s2-core/src/common/constant/resize.ts @@ -1,7 +1,7 @@ export const RESIZE_START_GUIDE_LINE_ID = 'RESIZE_START_GUIDE_LINE'; export const RESIZE_END_GUIDE_LINE_ID = 'RESIZE_END_GUIDE_LINE'; export const RESIZE_MASK_ID = 'RESIZE_MASK'; -export const RESIZE_MIN_CELL_WIDTH = 20; +export const RESIZE_MIN_CELL_WIDTH = 40; export const RESIZE_MIN_CELL_HEIGHT = 20; // resize 时鼠标移动方向类型 diff --git a/packages/s2-core/src/common/constant/theme.ts b/packages/s2-core/src/common/constant/theme.ts index 7d3fc453ac..56d6c82aee 100644 --- a/packages/s2-core/src/common/constant/theme.ts +++ b/packages/s2-core/src/common/constant/theme.ts @@ -5,7 +5,6 @@ import { paletteGray } from '../../theme/palette/gray'; import type { ThemeName } from '../interface'; import { S2_PREFIX_CLS } from './classnames'; -// Map of the theme export const PALETTE_MAP = { default: paletteDefault, colorful: paletteColorful, @@ -24,10 +23,7 @@ export const FONT_FAMILY = export const INTERVAL_BAR_HEIGHT = 12; -/** - * 注入主题 css 变量的节点名 - */ -export const STYLE_ELEMENT_ID = `${S2_PREFIX_CLS}-core-vars`; +export const DARK_THEME_CLS = `${S2_PREFIX_CLS}-dark-theme`; /** * 兼容 G2 主题: S2 和 G2 的主题名转换 @@ -39,3 +35,5 @@ export const G2_THEME_TYPE: Record = { gray: 'light', dark: 'dark', }; + +export const CELL_PADDING = 8; diff --git a/packages/s2-core/src/common/interface/basic.ts b/packages/s2-core/src/common/interface/basic.ts index 2a84236549..a9f57d981f 100644 --- a/packages/s2-core/src/common/interface/basic.ts +++ b/packages/s2-core/src/common/interface/basic.ts @@ -117,7 +117,7 @@ export interface Fields extends BaseFields { /** * 自定义指标维度在行列头中的层级顺序 (即 `values` 的 顺序,从 `0` 开始 */ - customValueOrder?: number; + customValueOrder?: number | null; } export enum Aggregation { @@ -442,7 +442,7 @@ export interface ViewMeta { height: number; /** 单元格数据 */ - data: ViewMetaData | SimpleData | undefined; + data: ViewMetaData | undefined; /** 行索引 */ rowIndex: number; diff --git a/packages/s2-core/src/common/interface/emitter.ts b/packages/s2-core/src/common/interface/emitter.ts index d6de4733d6..61ee22a844 100644 --- a/packages/s2-core/src/common/interface/emitter.ts +++ b/packages/s2-core/src/common/interface/emitter.ts @@ -7,7 +7,7 @@ import type { } from '../../cell'; import type { ColCell } from '../../cell/col-cell'; import type { DataCell } from '../../cell/data-cell'; -import type { S2Event } from '../../common/constant'; +import type { InteractionName, S2Event } from '../../common/constant'; import type { CellMeta, CellScrollPosition, @@ -37,9 +37,30 @@ type ResizeHandler = (data: { style?: S2Style; seriesNumberWidth?: number; }) => void; -type SelectedHandler = (cells: S2CellType[]) => void; type SortedHandler = (rangeData: RawData[]) => any; +export interface CellSelectedDetail { + /** + * 触发选中的交互名 + */ + interactionName?: `${InteractionName}`; + + /** + * 触发选中的单元格 + */ + targetCell?: S2CellType | null; + + /** + * 触发选中的事件对象 + */ + event?: CanvasEvent | KeyboardEvent | Event | null; +} + +export type CellSelectedHandler = ( + cells: S2CellType[], + detail: CellSelectedDetail, +) => void; + export interface EmitterType { /** ================ Global ================ */ [S2Event.GLOBAL_ACTION_ICON_CLICK]: CanvasEventHandler; @@ -58,7 +79,7 @@ export interface EmitterType { [S2Event.GLOBAL_DOUBLE_CLICK]: CanvasEventHandler; [S2Event.GLOBAL_RESET]: EventHandler; [S2Event.GLOBAL_HOVER]: CanvasEventHandler; - [S2Event.GLOBAL_SELECTED]: SelectedHandler; + [S2Event.GLOBAL_SELECTED]: CellSelectedHandler; [S2Event.GLOBAL_SCROLL]: (position: CellScrollPosition) => void; /** ================ Sort ================ */ @@ -87,6 +108,9 @@ export interface EmitterType { [S2Event.DATA_CELL_BRUSH_SELECTION]: (cells: (DataCell | CellMeta)[]) => void; [S2Event.DATA_CELL_SELECT_MOVE]: (metas: CellMeta[]) => void; [S2Event.DATA_CELL_RENDER]: (cell: DataCell) => void; + [S2Event.DATA_CELL_HOVER_TRIGGERED_PRIVATE]: (cell: DataCell) => void; + [S2Event.DATA_CELL_CLICK_TRIGGERED_PRIVATE]: (cell: DataCell) => void; + [S2Event.DATA_CELL_SELECTED]: CellSelectedHandler; /** ================ Row Cell ================ */ [S2Event.ROW_CELL_MOUSE_DOWN]: CanvasEventHandler; @@ -103,6 +127,7 @@ export interface EmitterType { [S2Event.ROW_CELL_ALL_COLLAPSED]: (isCollapsed: boolean) => void; [S2Event.ROW_CELL_ALL_COLLAPSED__PRIVATE]: (isCollapsed: boolean) => void; [S2Event.ROW_CELL_RENDER]: (cell: RowCell) => void; + [S2Event.ROW_CELL_SELECTED]: CellSelectedHandler; /** ================ Col Cell ================ */ [S2Event.COL_CELL_MOUSE_DOWN]: CanvasEventHandler; @@ -119,6 +144,7 @@ export interface EmitterType { hiddenColumnsDetail: HiddenColumnsInfo[], ) => void; [S2Event.COL_CELL_RENDER]: (cell: ColCell) => void; + [S2Event.COL_CELL_SELECTED]: CellSelectedHandler; /** ================ Corner Cell ================ */ [S2Event.CORNER_CELL_MOUSE_MOVE]: CanvasEventHandler; @@ -129,6 +155,7 @@ export interface EmitterType { [S2Event.CORNER_CELL_CONTEXT_MENU]: CanvasEventHandler; [S2Event.CORNER_CELL_MOUSE_UP]: CanvasEventHandler; [S2Event.CORNER_CELL_RENDER]: (cell: CornerCell) => void; + [S2Event.CORNER_CELL_SELECTED]: CellSelectedHandler; /** ================ Merged Cells ================ */ [S2Event.MERGED_CELLS_MOUSE_DOWN]: CanvasEventHandler; diff --git a/packages/s2-core/src/common/interface/interaction.ts b/packages/s2-core/src/common/interface/interaction.ts index 97a36df29c..bb55652e5f 100644 --- a/packages/s2-core/src/common/interface/interaction.ts +++ b/packages/s2-core/src/common/interface/interaction.ts @@ -19,6 +19,7 @@ import type { BaseEvent } from '../../interaction/base-event'; import type { SpreadSheet } from '../../sheet-type'; import type { CellType, + InteractionName, InteractionStateName, InterceptType, ScrollbarPositionType, @@ -105,11 +106,21 @@ export interface ChangeCellOptions extends CellScrollToOptions { */ stateName?: `${InteractionStateName}`; + /** + * 交互名 + */ + interactionName?: `${InteractionName}`; + /** * 如果单元格不在可视范围, 是否自动滚动 * @default true */ scrollIntoView?: boolean; + + /** + * 触发事件对象 + */ + event?: FederatedPointerEvent; } export type InteractionConstructor = new ( diff --git a/packages/s2-core/src/common/interface/resize.ts b/packages/s2-core/src/common/interface/resize.ts index 55e468756e..a69d4ceb87 100644 --- a/packages/s2-core/src/common/interface/resize.ts +++ b/packages/s2-core/src/common/interface/resize.ts @@ -64,8 +64,9 @@ export interface ResizeInfo { isResizeArea?: boolean; isResizeMask?: boolean; - /** 当前拖拽热区对应的节点信息 */ + /** 当前拖拽热区对应的单元格/节点信息 */ meta: Node | ViewMeta; + cell: S2CellType; /** 拖拽后的宽度 */ resizedWidth?: number; diff --git a/packages/s2-core/src/common/interface/s2Options.ts b/packages/s2-core/src/common/interface/s2Options.ts index 7c949a10c2..8639a59e2e 100644 --- a/packages/s2-core/src/common/interface/s2Options.ts +++ b/packages/s2-core/src/common/interface/s2Options.ts @@ -1,4 +1,5 @@ import type { CanvasConfig } from '@antv/g'; +import type { Renderer } from '@antv/g-canvas'; import type { ColCell, CornerCell, @@ -188,7 +189,7 @@ export interface S2BasicOptions< }, */ transformCanvasConfig?: ( - renderer: CanvasConfig['renderer'], + renderer: Renderer, spreadsheet: SpreadSheet, ) => (Partial | null | undefined) | void; @@ -385,5 +386,5 @@ export interface S2RenderOptions { /** * 是否重新生成列头隐藏信息 */ - reBuildHiddenColumnsDetail?: boolean; + rebuildHiddenColumnsDetail?: boolean; } diff --git a/packages/s2-core/src/common/interface/style.ts b/packages/s2-core/src/common/interface/style.ts index 03812c0733..262abccd94 100644 --- a/packages/s2-core/src/common/interface/style.ts +++ b/packages/s2-core/src/common/interface/style.ts @@ -39,7 +39,12 @@ export interface BaseCellStyle { } export interface CellTextWordWrapStyle - extends Pick {} + extends Pick { + /** + * @private 内部使用 + */ + maxLinesByField?: Record | null; +} export interface DataCellStyle extends CellTextWordWrapStyle { /** @@ -75,6 +80,11 @@ export interface DataCellStyle extends CellTextWordWrapStyle { } export interface RowCellStyle extends BaseCellStyle, CellTextWordWrapStyle { + /** + * 树状结构的行头宽度 + */ + treeWidth?: number; + /** * 是否展示树状分层下的层级占位点 */ diff --git a/packages/s2-core/src/common/interface/theme.ts b/packages/s2-core/src/common/interface/theme.ts index e5bc2c5684..504326c0ad 100644 --- a/packages/s2-core/src/common/interface/theme.ts +++ b/packages/s2-core/src/common/interface/theme.ts @@ -283,6 +283,7 @@ export interface SplitLine { /** 线性变化右侧颜色 */ right: string; }; + /** 分割线虚线 */ borderDash?: LineStyleProps['lineDash']; } @@ -357,12 +358,17 @@ export interface S2Theme extends CellThemes { export type ThemeName = keyof typeof PALETTE_MAP; +export type SimplePalette = Pick< + Palette, + 'basicColors' | 'semanticColors' | 'others' +>; + export interface ThemeCfg { /** 主题 */ theme?: S2Theme; /** 色板 */ - palette?: Pick; + palette?: SimplePalette; /** 主题名 */ name?: ThemeName; diff --git a/packages/s2-core/src/data-set/base-data-set.ts b/packages/s2-core/src/data-set/base-data-set.ts index 93e3cbf707..7287273809 100644 --- a/packages/s2-core/src/data-set/base-data-set.ts +++ b/packages/s2-core/src/data-set/base-data-set.ts @@ -37,7 +37,11 @@ import { } from '../utils/condition/state-controller'; import { generateExtraFieldMeta } from '../utils/dataset/pivot-data-set'; import type { Indexes } from '../utils/indexes'; -import { getDisplayText, getEmptyPlaceholder } from '../utils/text'; +import { + getDisplayText, + getEmptyPlaceholder, + replaceEmptyFieldValue, +} from '../utils/text'; import type { GetCellMultiDataParams } from './index'; import type { GetCellDataParams, Query } from './interface'; @@ -145,7 +149,7 @@ export abstract class BaseDataSet { return get( this.getFieldMeta(realField, this.meta), 'name', - defaultValue ?? realDefaultValue, + replaceEmptyFieldValue(defaultValue ?? realDefaultValue), ); } @@ -292,6 +296,15 @@ export abstract class BaseDataSet { return [] as unknown as Indexes; } + /** + * 获取 field 的取值范围 + * ! 取值范围是以传入的 data 作为的值做计算 + * ! 没有考虑总计、小计的情况,如果存在总计、小计,但是 data 里面并没有传,这里计算出来的范围就会不准确 + * ! 表格会采用计算明细数据得出,而这些计算出来的总计、小计是和布局结构强相关 + * ! 而要根据 totals 配置来覆盖所有情况,场景非常复杂 + * @param field values 中的具体数值字段 + * @returns 对应 field 的取值范围 + */ public getValueRangeByField(field: string): ValueRange { const cacheRange = getValueRangeState(this.spreadsheet, field); diff --git a/packages/s2-core/src/data-set/custom-grid-pivot-data-set.ts b/packages/s2-core/src/data-set/custom-grid-pivot-data-set.ts index 2ae06d0b1b..7fcd12a3f5 100644 --- a/packages/s2-core/src/data-set/custom-grid-pivot-data-set.ts +++ b/packages/s2-core/src/data-set/custom-grid-pivot-data-set.ts @@ -1,14 +1,12 @@ import { EXTRA_FIELD, i18n } from '../common'; import type { S2DataConfig } from '../common/interface'; -import { CustomTreePivotDataSet } from './custom-tree-pivot-data-set'; +import { PivotDataSet } from './pivot-data-set'; -export class CustomGridPivotDataSet extends CustomTreePivotDataSet { +export class CustomGridPivotDataSet extends PivotDataSet { processDataCfg(dataCfg: S2DataConfig): S2DataConfig { const valueInCols = !this.spreadsheet.isCustomRowFields(); const originalRows = dataCfg.fields.rows || []; - const rows = valueInCols - ? [...originalRows] - : [...originalRows, EXTRA_FIELD]; + const rows = valueInCols ? originalRows : [...originalRows, EXTRA_FIELD]; const meta = this.processMeta(dataCfg.meta!, i18n('数值')); return { diff --git a/packages/s2-core/src/data-set/custom-tree-pivot-data-set.ts b/packages/s2-core/src/data-set/custom-tree-pivot-data-set.ts deleted file mode 100644 index 229989b430..0000000000 --- a/packages/s2-core/src/data-set/custom-tree-pivot-data-set.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { get, type PropertyPath } from 'lodash'; -import { EXTRA_FIELD } from '../common/constant'; -import { i18n } from '../common/i18n'; -import type { Meta, S2DataConfig } from '../common/interface'; -import { - getDataPath, - getDataPathPrefix, - transformDimensionsValues, -} from '../utils/dataset/pivot-data-set'; -import { CellData } from './cell-data'; -import type { GetCellDataParams } from './interface'; -import { PivotDataSet } from './pivot-data-set'; - -export class CustomTreePivotDataSet extends PivotDataSet { - getCellData(params: GetCellDataParams) { - const { query = {} } = params || {}; - const { columns, rows } = this.fields; - const rowDimensionValues = transformDimensionsValues( - query, - rows as string[], - ); - const colDimensionValues = transformDimensionsValues( - query, - columns as string[], - ); - const path = getDataPath({ - rowDimensionValues, - colDimensionValues, - rowPivotMeta: this.rowPivotMeta, - colPivotMeta: this.colPivotMeta, - rowFields: rows as string[], - colFields: columns as string[], - prefix: getDataPathPrefix(rows as string[], columns as string[]), - }); - - const rawData = get(this.indexesData, path as PropertyPath); - - if (rawData) { - return CellData.getCellData(rawData, query[EXTRA_FIELD]); - } - } - - processDataCfg(dataCfg: S2DataConfig): S2DataConfig { - /** - * 自定义行头有如下几个特点 - * 1、rows配置必须是空,需要额外添加 $$extra$$ 定位数据(标记指标的id) - * 2、要有配置 fields.rowCustomTree(行头结构) - * 3、values 不需要参与计算,默认就在行头结构中 - */ - - const updatedDataCfg = super.processDataCfg(dataCfg); - const newMeta: Meta[] = this.processMeta(dataCfg.meta, i18n('指标')); - - return { - ...updatedDataCfg, - meta: newMeta, - fields: { - ...updatedDataCfg.fields, - rows: [EXTRA_FIELD], - valueInCols: false, - }, - }; - } -} diff --git a/packages/s2-core/src/data-set/index.ts b/packages/s2-core/src/data-set/index.ts index f0ffc95172..1e498c7cd4 100644 --- a/packages/s2-core/src/data-set/index.ts +++ b/packages/s2-core/src/data-set/index.ts @@ -1,17 +1,10 @@ import { BaseDataSet } from './base-data-set'; import { CustomGridPivotDataSet } from './custom-grid-pivot-data-set'; -import { CustomTreePivotDataSet } from './custom-tree-pivot-data-set'; import { PivotDataSet } from './pivot-data-set'; import { TableDataSet } from './table-data-set'; export { CellData } from './cell-data'; -export { - BaseDataSet, - CustomGridPivotDataSet, - CustomTreePivotDataSet, - PivotDataSet, - TableDataSet, -}; +export { BaseDataSet, CustomGridPivotDataSet, PivotDataSet, TableDataSet }; export * from './interface'; diff --git a/packages/s2-core/src/data-set/pivot-data-set.ts b/packages/s2-core/src/data-set/pivot-data-set.ts index 99631cf9a3..6039cbb8da 100644 --- a/packages/s2-core/src/data-set/pivot-data-set.ts +++ b/packages/s2-core/src/data-set/pivot-data-set.ts @@ -41,6 +41,7 @@ import type { S2DataConfig, SimpleData, ViewMeta, + ViewMetaData, } from '../common/interface'; import { Node } from '../facet/layout/node'; import { resolveNillString } from '../utils'; @@ -53,6 +54,7 @@ import { getDataPathPrefix, getExistValues, getFlattenDimensionValues, + getIndexFields, getSatisfiedPivotMetaValues, isMultiValue, transformDimensionsValues, @@ -103,22 +105,21 @@ export class PivotDataSet extends BaseDataSet { this.rowPivotMeta = new Map(); this.colPivotMeta = new Map(); this.dimensionValuesCache = new Map(); - this.transformIndexesData(this.originData, rows as string[]); + this.transformIndexesData(this.originData, rows); this.handleDimensionValuesSort(); } public transformIndexesData( data: RawData[], - rows: string[], + rows?: CustomHeaderFields, ): TransformResult { const { columns, values, valueInCols } = this.fields; - let result!: TransformResult; DebuggerUtil.getInstance().debugCallback(DEBUG_TRANSFORM_DATA, () => { result = transformIndexesData({ - rows: rows as string[], - columns: columns as string[], + rows: getIndexFields(rows), + columns: getIndexFields(columns), values: values!, valueInCols: valueInCols!, data, @@ -348,14 +349,14 @@ export class PivotDataSet extends BaseDataSet { if (rows.includes(field)) { return { - dimensions: rows as string[], + dimensions: getIndexFields(rows), pivotMeta: this.rowPivotMeta, }; } if (columns.includes(field)) { return { - dimensions: columns as string[], + dimensions: getIndexFields(columns), pivotMeta: this.colPivotMeta, }; } @@ -439,11 +440,11 @@ export class PivotDataSet extends BaseDataSet { } } - public getCellData(params: GetCellDataParams) { + public getCellData(params: GetCellDataParams): ViewMetaData | undefined { const { query = {}, rowNode, isTotals = false, totalStatus } = params || {}; const { rows: originRows, columns } = this.fields; - let rows = originRows as string[]; + let rows = originRows; const drillDownIdPathMap = this.spreadsheet?.store.get('drillDownIdPathMap'); @@ -457,23 +458,23 @@ export class PivotDataSet extends BaseDataSet { // 如果是下钻结点,行维度在 originRows 中并不存在 if (rowNode && isDrillDown) { - rows = - Node.getFieldPath(rowNode, isDrillDown) ?? (originRows as string[]); + rows = Node.getFieldPath(rowNode, isDrillDown) ?? originRows; } - const rowDimensionValues = transformDimensionsValues(query, rows); - const colDimensionValues = transformDimensionsValues( - query, - columns as string[], - ); + const indexRows = getIndexFields(rows); + const indexColumns = getIndexFields(columns); + + const rowDimensionValues = transformDimensionsValues(query, indexRows); + const colDimensionValues = transformDimensionsValues(query, indexColumns); + const path = getDataPath({ rowDimensionValues, colDimensionValues, rowPivotMeta: this.rowPivotMeta, colPivotMeta: this.colPivotMeta, - rowFields: rows as string[], - colFields: columns as string[], - prefix: getDataPathPrefix(rows as string[], columns as string[]), + rowFields: indexRows, + colFields: indexColumns, + prefix: getDataPathPrefix(indexRows, indexColumns), }); const rawData = get(this.indexesData, path as PropertyPath); @@ -490,21 +491,27 @@ export class PivotDataSet extends BaseDataSet { public getTotalStatus = (query: Query): TotalStatus => { const { columns, rows } = this.fields; - const isTotals = (dimensions: string[], isSubTotal?: boolean) => { + const isTotals = ( + dimensions?: CustomHeaderFields, + isSubTotal?: boolean, + ) => { if (isSubTotal) { - const firstDimension = find(dimensions, (item) => !has(query, item)); + const firstDimension = find( + dimensions, + (item) => !has(query, item as string), + ); return !!(firstDimension && firstDimension !== first(dimensions)); } - return every(dimensions, (item) => !has(query, item)); + return every(dimensions, (item) => !has(query, item as string)); }; return { - isRowGrandTotal: isTotals(filterExtraDimension(rows as string[])), - isRowSubTotal: isTotals(rows as string[], true), - isColGrandTotal: isTotals(filterExtraDimension(columns as string[])), - isColSubTotal: isTotals(columns as string[], true), + isRowGrandTotal: isTotals(filterExtraDimension(rows)), + isRowSubTotal: isTotals(rows, true), + isColGrandTotal: isTotals(filterExtraDimension(columns)), + isColSubTotal: isTotals(columns, true), }; }; @@ -535,18 +542,21 @@ export class PivotDataSet extends BaseDataSet { } const { rows, columns } = this.fields; - const totalRows: string[] = !isEmpty(drillDownFields) - ? (rows as string[]).concat(drillDownFields!) - : (rows as string[]); + const totalRows = !isEmpty(drillDownFields) + ? rows!.concat(drillDownFields!) + : rows!; + + const indexRows = getIndexFields(totalRows); + const indexColumns = getIndexFields(columns); const rowDimensionValues = transformDimensionsValues( query, - totalRows, + indexRows, MULTI_VALUE, ); const colDimensionValues = transformDimensionsValues( query, - columns as string[], + indexColumns, MULTI_VALUE, ); @@ -555,13 +565,13 @@ export class PivotDataSet extends BaseDataSet { colDimensionValues, rowPivotMeta: this.rowPivotMeta, colPivotMeta: this.colPivotMeta, - rowFields: totalRows, - colFields: columns as string[], + rowFields: indexRows, + colFields: indexColumns, sortedDimensionValues: this.sortedDimensionValues, queryType, }); - const prefix = getDataPathPrefix(totalRows, columns as string[]); + const prefix = getDataPathPrefix(indexRows, indexColumns); const all: RawData[] = []; for (const rowQuery of rowQueries) { @@ -571,8 +581,8 @@ export class PivotDataSet extends BaseDataSet { colDimensionValues: colQuery, rowPivotMeta: this.rowPivotMeta, colPivotMeta: this.colPivotMeta, - rowFields: totalRows, - colFields: columns as string[], + rowFields: indexRows, + colFields: indexColumns, prefix, }); @@ -660,7 +670,7 @@ export class PivotDataSet extends BaseDataSet { } // 是否开启自定义度量组位置值 - private isCustomMeasuresPosition(customValueOrder?: number) { + private isCustomMeasuresPosition(customValueOrder?: number | null) { return isNumber(customValueOrder); } diff --git a/packages/s2-core/src/extends/index.ts b/packages/s2-core/src/extends/index.ts new file mode 100644 index 0000000000..0b999cd768 --- /dev/null +++ b/packages/s2-core/src/extends/index.ts @@ -0,0 +1 @@ +export * from './pivot-chart'; diff --git a/packages/s2-core/src/extends/pivot-chart/cell/axis-col-cell.ts b/packages/s2-core/src/extends/pivot-chart/cell/axis-col-cell.ts new file mode 100644 index 0000000000..c46a74be3d --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/cell/axis-col-cell.ts @@ -0,0 +1,127 @@ +import { Group } from '@antv/g'; +import { corelib, renderToMountedElement, type AxisComponent } from '@antv/g2'; +import { + CellBorderPosition, + CellClipBox, + CellType, + ColCell, + customMerge, + getOrCreateResizeAreaGroupById, + waitForCellMounted, +} from '@antv/s2'; +import { isFunction } from 'lodash'; +import { DEFAULT_G2_SPEC, KEY_GROUP_COL_AXIS_RESIZE_AREA } from '../constant'; +import type { PivotChartSheet } from '../pivot-chart-sheet'; +import { + getAxisStyle, + getAxisXOptions, + getAxisYOptions, + getCoordinate, + getTheme, +} from '../utils/chart-options'; +import { AxisCellType } from './cell-type'; + +export class AxisColCell extends ColCell { + protected declare spreadsheet: PivotChartSheet; + + protected axisShape: Group; + + public get cellType() { + return AxisCellType.AXIS_COL_CELL as any; + } + + protected getBorderPositions(): CellBorderPosition[] { + return [ + CellBorderPosition.TOP, + CellBorderPosition.BOTTOM, + CellBorderPosition.RIGHT, + ]; + } + + protected isBolderText(): boolean { + return false; + } + + protected getInteractedCells() { + return this.spreadsheet.interaction?.getCells([ + CellType.COL_CELL, + AxisCellType.AXIS_COL_CELL as any, + ]); + } + + protected initCell(): void { + this.drawBackgroundShape(); + this.drawInteractiveBgShape(); + this.drawInteractiveBorderShape(); + this.drawTextShape(); + this.drawBorders(); + this.drawResizeArea(); + this.update(); + } + + protected getColResizeArea() { + return getOrCreateResizeAreaGroupById( + this.spreadsheet, + KEY_GROUP_COL_AXIS_RESIZE_AREA, + ); + } + + protected isCrossColumnLeafNode() { + return false; + } + + public drawTextShape(): void { + if (this.spreadsheet.isPolarCoordinate()) { + super.drawTextShape(); + + return; + } + + this.drawAxisShape(); + } + + getChartOptions(): AxisComponent { + const style = this.getStyle(); + + let customSpec = this.spreadsheet.options.chart?.axisColCellSpec; + + if (isFunction(customSpec)) { + customSpec = customSpec(this); + } + + return customMerge( + { + ...DEFAULT_G2_SPEC, + ...this.getBBoxByType(CellClipBox.CONTENT_BOX), + + ...getCoordinate(this.spreadsheet), + ...(this.spreadsheet.isValueInCols() + ? getAxisYOptions(this.meta, this.spreadsheet) + : getAxisXOptions(this.meta, this.spreadsheet)), + + ...getAxisStyle(style), + ...getTheme(this.spreadsheet), + } as AxisComponent, + customSpec, + ); + } + + drawAxisShape() { + const chartOptions = this.getChartOptions(); + + this.axisShape = this.appendChild(new Group({})); + + // delay 到实例被挂载到 parent 后,再渲染 chart + waitForCellMounted(() => { + if (this.destroyed) { + return; + } + + // https://g2.antv.antgroup.com/manual/extra-topics/bundle#g2corelib + renderToMountedElement(chartOptions, { + group: this.axisShape, + library: corelib(), + }); + }); + } +} diff --git a/packages/s2-core/src/extends/pivot-chart/cell/axis-corner-cell.ts b/packages/s2-core/src/extends/pivot-chart/cell/axis-corner-cell.ts new file mode 100644 index 0000000000..5f8528172a --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/cell/axis-corner-cell.ts @@ -0,0 +1,43 @@ +import { CellBorderPosition, CellClipBox, CornerCell } from '@antv/s2'; +import { AxisCellType } from './cell-type'; + +export class AxisCornerCell extends CornerCell { + public get cellType() { + return AxisCellType.AXIS_CORNER_CELL as any; + } + + protected getBorderPositions(): CellBorderPosition[] { + return [ + CellBorderPosition.TOP, + CellBorderPosition.BOTTOM, + CellBorderPosition.LEFT, + ]; + } + + protected isBolderText(): boolean { + return false; + } + + public getMaxTextWidth(): number { + const { width } = this.getBBoxByType(CellClipBox.CONTENT_BOX); + + return width; + } + + protected getTreeIconWidth() { + return 0; + } + + protected getInteractedCells() { + return this.spreadsheet.interaction?.getCells([ + AxisCellType.AXIS_CORNER_CELL as any, + ]); + } + + protected initCell(): void { + this.drawBackgroundShape(); + this.drawTextShape(); + this.drawBorders(); + this.update(); + } +} diff --git a/packages/s2-core/src/extends/pivot-chart/cell/axis-row-cell.ts b/packages/s2-core/src/extends/pivot-chart/cell/axis-row-cell.ts new file mode 100644 index 0000000000..aa8f92cb7f --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/cell/axis-row-cell.ts @@ -0,0 +1,119 @@ +import { Group } from '@antv/g'; +import { corelib, renderToMountedElement, type AxisComponent } from '@antv/g2'; +import { + CellBorderPosition, + CellClipBox, + CellType, + RowCell, + customMerge, + getOrCreateResizeAreaGroupById, + waitForCellMounted, +} from '@antv/s2'; +import { isFunction } from 'lodash'; +import { DEFAULT_G2_SPEC, KEY_GROUP_ROW_AXIS_RESIZE_AREA } from '../constant'; +import type { PivotChartSheet } from '../pivot-chart-sheet'; +import { + getAxisStyle, + getAxisXOptions, + getAxisYOptions, + getCoordinate, + getTheme, +} from '../utils/chart-options'; +import { AxisCellType } from './cell-type'; + +export class AxisRowCell extends RowCell { + protected declare spreadsheet: PivotChartSheet; + + protected axisShape: Group; + + public get cellType() { + return AxisCellType.AXIS_ROW_CELL as any; + } + + protected getBorderPositions(): CellBorderPosition[] { + return [CellBorderPosition.BOTTOM, CellBorderPosition.LEFT]; + } + + protected isBolderText(): boolean { + return false; + } + + protected getInteractedCells() { + return this.spreadsheet.interaction?.getCells([ + CellType.ROW_CELL, + AxisCellType.AXIS_ROW_CELL as any, + ]); + } + + protected initCell(): void { + this.drawBackgroundShape(); + this.drawInteractiveBgShape(); + this.drawInteractiveBorderShape(); + this.drawTextShape(); + this.drawBorders(); + this.drawResizeAreaInLeaf(); + this.update(); + } + + protected getResizesArea() { + return getOrCreateResizeAreaGroupById( + this.spreadsheet, + KEY_GROUP_ROW_AXIS_RESIZE_AREA, + ); + } + + public drawTextShape(): void { + if (this.spreadsheet.isPolarCoordinate()) { + super.drawTextShape(); + + return; + } + + this.drawAxisShape(); + } + + getChartOptions(): AxisComponent { + const style = this.getStyle(); + + let customSpec = this.spreadsheet.options.chart?.axisRowCellSpec; + + if (isFunction(customSpec)) { + customSpec = customSpec(this); + } + + return customMerge( + { + ...DEFAULT_G2_SPEC, + ...this.getBBoxByType(CellClipBox.CONTENT_BOX), + + ...getCoordinate(this.spreadsheet), + ...(this.spreadsheet.isValueInCols() + ? getAxisXOptions(this.meta, this.spreadsheet) + : getAxisYOptions(this.meta, this.spreadsheet)), + + ...getAxisStyle(style), + ...getTheme(this.spreadsheet), + } as AxisComponent, + customSpec, + ); + } + + drawAxisShape() { + const chartOptions = this.getChartOptions(); + + this.axisShape = this.appendChild(new Group({})); + + // delay 到实例被挂载到 parent 后,再渲染 chart + waitForCellMounted(() => { + if (this.destroyed) { + return; + } + + // https://g2.antv.antgroup.com/manual/extra-topics/bundle#g2corelib + renderToMountedElement(chartOptions, { + group: this.axisShape, + library: corelib(), + }); + }); + } +} diff --git a/packages/s2-core/src/extends/pivot-chart/cell/cell-type.ts b/packages/s2-core/src/extends/pivot-chart/cell/cell-type.ts new file mode 100644 index 0000000000..72bcd1c283 --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/cell/cell-type.ts @@ -0,0 +1,5 @@ +export enum AxisCellType { + AXIS_ROW_CELL = 'axisRowCell', + AXIS_COL_CELL = 'axisColCell', + AXIS_CORNER_CELL = 'axisCornerCell', +} diff --git a/packages/s2-core/src/extends/pivot-chart/cell/chart-data-cell.ts b/packages/s2-core/src/extends/pivot-chart/cell/chart-data-cell.ts new file mode 100644 index 0000000000..b43c3648b9 --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/cell/chart-data-cell.ts @@ -0,0 +1,66 @@ +import { Group } from '@antv/g-lite'; +import { corelib, renderToMountedElement } from '@antv/g2'; +import { + CellClipBox, + DataCell, + waitForCellMounted, + type BaseChartData, + type MultiData, +} from '@antv/s2'; +import { isPlainObject } from 'lodash'; +import { getTheme } from '../utils/chart-options'; + +export class ChartDataCell extends DataCell { + chartShape: Group; + + public drawTextShape() { + // 普通数值单元格正常展示 + if (!this.isChartData()) { + super.drawTextShape(); + + return; + } + + this.chartShape = this.appendChild(new Group({ style: { zIndex: 1 } })); + + const chartOptions = this.getChartOptions(); + + waitForCellMounted(() => { + if (this.destroyed) { + return; + } + + // https://g2.antv.antgroup.com/manual/extra-topics/bundle#g2corelib + renderToMountedElement(chartOptions, { + group: this.chartShape, + library: corelib(), + }); + }); + } + + public isChartData() { + const fieldValue = this.getFieldValue(); + + return isPlainObject( + (fieldValue as unknown as MultiData)?.values, + ); + } + + public getChartData(): BaseChartData { + const { fieldValue } = this.meta; + + return (fieldValue as MultiData)?.values as BaseChartData; + } + + public getChartOptions() { + const chartData = this.getChartData(); + const cellArea = this.getBBoxByType(CellClipBox.CONTENT_BOX); + + return { + autoFit: true, + ...getTheme(this.spreadsheet), + ...cellArea, + ...chartData, + }; + } +} diff --git a/packages/s2-core/src/extends/pivot-chart/cell/pivot-chart-data-cell.ts b/packages/s2-core/src/extends/pivot-chart/cell/pivot-chart-data-cell.ts new file mode 100644 index 0000000000..af1b49bac6 --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/cell/pivot-chart-data-cell.ts @@ -0,0 +1,102 @@ +import { Group } from '@antv/g'; +import { corelib, renderToMountedElement, type G2Spec } from '@antv/g2'; +import { + CellClipBox, + customMerge, + waitForCellMounted, + type CellMeta, +} from '@antv/s2'; +import { isFunction } from 'lodash'; +import { DEFAULT_CHART_SPEC } from '../constant'; +import type { PivotChartSheet } from '../pivot-chart-sheet'; +import { + getCoordinate, + getScaleY, + getTheme, + getTooltip, +} from '../utils/chart-options'; +import { AxisCellType } from './cell-type'; +import { ChartDataCell } from './chart-data-cell'; + +export class PivotChartDataCell extends ChartDataCell { + public isChartData(): boolean { + return true; + } + + public getChartData(): any { + const { data, xField, yField } = this.meta; + + return { + data, + encode: { + x: (this.spreadsheet as PivotChartSheet).isPolarCoordinate() + ? null + : xField, + y: yField, + color: xField, + }, + }; + } + + public getChartOptions(): any { + const { yField } = this.meta; + + let customSpec = this.spreadsheet.options.chart?.dataCellSpec; + + if (isFunction(customSpec)) { + customSpec = customSpec(this); + } + + return customMerge( + { + ...DEFAULT_CHART_SPEC, + ...this.getBBoxByType(CellClipBox.CONTENT_BOX), + ...getCoordinate(this.spreadsheet), + ...this.getChartData(), + ...getScaleY(yField!, this.spreadsheet), + + ...getTooltip(this.meta, this.spreadsheet), + ...getTheme(this.spreadsheet), + } as G2Spec, + customSpec, + ); + } + + public drawTextShape(): void { + const chartOptions = this.getChartOptions(); + + this.chartShape = this.appendChild(new Group({ style: { zIndex: 1 } })); + + waitForCellMounted(() => { + if (this.destroyed) { + return; + } + + // https://g2.antv.antgroup.com/manual/extra-topics/bundle#g2corelib + renderToMountedElement(chartOptions, { + group: this.chartShape, + library: corelib(), + }); + }); + } + + protected handleSelect(cells: CellMeta[]) { + super.handleSelect(cells); + + const currentCellType = cells?.[0]?.type as unknown as AxisCellType; + + switch (currentCellType) { + // 列多选 + case AxisCellType.AXIS_COL_CELL: + this.changeRowColSelectState('colIndex'); + break; + // 行多选 + case AxisCellType.AXIS_ROW_CELL: + this.changeRowColSelectState('rowIndex'); + break; + + default: + break; + } + } +} diff --git a/packages/s2-core/src/extends/pivot-chart/constant.ts b/packages/s2-core/src/extends/pivot-chart/constant.ts new file mode 100644 index 0000000000..6fd671ce6d --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/constant.ts @@ -0,0 +1,84 @@ +import type { G2Spec } from '@antv/g2'; +import { type S2DataConfig, type S2Options } from '@antv/s2'; +import { AxisRowColumnClick } from './interaction/axis-click'; +import { AxisHover } from './interaction/axis-hover'; + +export const DEFAULT_G2_SPEC = { + autoFit: true, + animate: false, + // https://g2.antv.antgroup.com/manual/core/size + margin: 1, +}; + +export const DEFAULT_CHART_SPEC: G2Spec = { + ...DEFAULT_G2_SPEC, + type: 'interval', + axis: false, + legend: false, +}; + +export const FIXED_OPTIONS: S2Options = { + hierarchyType: 'grid', + interaction: { + selectedCellsSpotlight: false, + copy: { + enable: false, + }, + }, + style: { + colCell: { + hideValue: false, + }, + }, +}; + +export const DEFAULT_OPTIONS: S2Options = { + chart: { + coordinate: 'cartesian', + }, + + interaction: { + customInteractions: [ + { + key: 'axisHover', + interaction: AxisHover, + }, + { + key: 'axisClick', + interaction: AxisRowColumnClick, + }, + ], + }, +}; + +export const FIXED_DATA_CONFIG: Partial = { + fields: { + customValueOrder: null, + }, +}; + +export const DEFAULT_MEASURE_SIZE = 200; +export const DEFAULT_ROW_AXIS_SIZE = 100; +export const DEFAULT_COL_AXIS_SIZE = 50; +export const DEFAULT_DIMENSION_SIZE = 50; + +/** + * row axis + */ +export const KEY_GROUP_ROW_AXIS_SCROLL = 'rowAxisScrollGroup'; +export const KEY_GROUP_ROW_AXIS_FROZEN = 'rowAxisHeaderFrozenGroup'; +export const KEY_GROUP_ROW_AXIS_HEADER_FROZEN_TRAILING = + 'rowAxisHeaderFrozenTrailingGroup'; +export const KEY_GROUP_ROW_AXIS_RESIZE_AREA = 'rowAxisHeaderResizeArea'; + +/** + * column axis + */ +export const KEY_GROUP_COL_AXIS_SCROLL = 'colAxisScrollGroup'; +export const KEY_GROUP_COL_AXIS_FROZEN = 'colAxisFrozenGroup'; +export const KEY_GROUP_COL_AXIS_FROZEN_TRAILING = 'colAxisFrozenTrailingGroup'; +export const KEY_GROUP_COL_AXIS_RESIZE_AREA = 'colAxisHeaderResizeArea'; + +export const PLACEHOLDER_FIELD = '$$placeholder$$'; + +export const X_FIELD_FORMATTER = '$$should_formatter$$'; diff --git a/packages/s2-core/src/extends/pivot-chart/facet/corner-bbox.ts b/packages/s2-core/src/extends/pivot-chart/facet/corner-bbox.ts new file mode 100644 index 0000000000..ec96e76cbe --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/facet/corner-bbox.ts @@ -0,0 +1,13 @@ +import { CornerBBox as OriginCornerBBox, floor } from '@antv/s2'; + +export class CornerBBox extends OriginCornerBBox { + protected calculateOriginWidth(): void { + const { rowsHierarchy, axisRowsHierarchy } = this.layoutResult; + + const rowAxisWidth = axisRowsHierarchy?.width ?? 0; + + this.originalWidth = floor( + this.facet.getSeriesNumberWidth() + rowsHierarchy.width + rowAxisWidth, + ); + } +} diff --git a/packages/s2-core/src/extends/pivot-chart/facet/frame.ts b/packages/s2-core/src/extends/pivot-chart/facet/frame.ts new file mode 100644 index 0000000000..a0a515779c --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/facet/frame.ts @@ -0,0 +1,79 @@ +import { Frame as OriginFrame, renderLine } from '@antv/s2'; + +export class Frame extends OriginFrame { + protected override getCornerRightBorderSizeForPivotMode() { + const { cornerHeight, viewportHeight, position, spreadsheet } = this.cfg; + + const { horizontalBorderWidth } = spreadsheet.theme?.splitLine!; + + const y = position.y; + const axisColsHierarchy = + spreadsheet.facet.getLayoutResult().axisColsHierarchy; + + const height = + cornerHeight + + horizontalBorderWidth! + + viewportHeight + + (axisColsHierarchy?.height ?? 0); + + return { y, height }; + } + + protected addCornerRightBottomHeaderBorder() { + // 为底部坐标轴执行一样的逻辑绘制分割线 + const axisColsHierarchy = + this.cfg.spreadsheet.facet.getLayoutResult().axisColsHierarchy; + + if (!axisColsHierarchy?.height) { + return; + } + + const { cornerWidth, cornerHeight, viewportHeight, position, spreadsheet } = + this.cfg; + const { verticalBorderColor, verticalBorderColorOpacity } = + spreadsheet.theme?.splitLine!; + const frameVerticalWidth = Frame.getVerticalBorderWidth(spreadsheet); + const frameHorizontalWidth = Frame.getVerticalBorderWidth(spreadsheet); + const x = position.x + cornerWidth + frameVerticalWidth! / 2; + + // 表头和表身的单元格背景色不同, 分割线不能一条线拉通, 不然视觉不协调. + // 分两条线绘制, 默认和分割线所在区域对应的单元格边框颜色保持一致 + const { + verticalBorderColor: headerVerticalBorderColor, + verticalBorderColorOpacity: headerVerticalBorderColorOpacity, + backgroundColor, + backgroundColorOpacity, + } = spreadsheet.theme.cornerCell!.cell!; + + const y1 = + position.y + cornerHeight + frameHorizontalWidth + viewportHeight; + + /** + * G 6.0 颜色混合模式有调整, 相同颜色的 Line 在不同背景色绘制, 实际渲染的颜色会不一致 + * 在绘制分割线前, 先填充一个和单元格相同的底色, 保证分割线和单元格边框表现一致 + */ + [ + { stroke: backgroundColor, strokeOpacity: backgroundColorOpacity }, + { + stroke: verticalBorderColor || headerVerticalBorderColor, + strokeOpacity: + verticalBorderColorOpacity || headerVerticalBorderColorOpacity, + }, + ].forEach(({ stroke, strokeOpacity }) => { + renderLine(this, { + x1: x, + y1, + x2: x, + y2: y1 + axisColsHierarchy.height, + lineWidth: frameVerticalWidth, + stroke, + strokeOpacity, + }); + }); + } + + protected addCornerRightBorder() { + super.addCornerRightBorder(); + this.addCornerRightBottomHeaderBorder(); + } +} diff --git a/packages/s2-core/src/extends/pivot-chart/facet/panel-bbox.ts b/packages/s2-core/src/extends/pivot-chart/facet/panel-bbox.ts new file mode 100644 index 0000000000..197e59e7af --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/facet/panel-bbox.ts @@ -0,0 +1,18 @@ +import { PanelBBox as OriginPanelBBox } from '@antv/s2'; + +export class PanelBBox extends OriginPanelBBox { + protected override getPanelHeight(): number { + const scrollBarSize = this.spreadsheet.theme.scrollBar!.size; + const { height: canvasHeight } = this.spreadsheet.options; + + const { axisColsHierarchy } = this.layoutResult; + const colAxisHeight = axisColsHierarchy?.height ?? 0; + + const panelHeight = Math.max( + 0, + canvasHeight! - this.y - scrollBarSize! - colAxisHeight, + ); + + return panelHeight; + } +} diff --git a/packages/s2-core/src/extends/pivot-chart/facet/pivot-chart-facet.ts b/packages/s2-core/src/extends/pivot-chart/facet/pivot-chart-facet.ts new file mode 100644 index 0000000000..a8d0e6e492 --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/facet/pivot-chart-facet.ts @@ -0,0 +1,678 @@ +import { + CellData, + EXTRA_FIELD, + Node, + ORIGIN_FIELD, + PivotFacet, + ScrollType, + getAllChildCells, + getCellWidth, + getDataCellId, + getHeaderTotalStatus, + type FrameConfig, + type LayoutResult, + type S2CellType, + type ScrollChangeParams, + type SelectedIds, + type ViewMeta, +} from '@antv/s2'; +import { + concat, + floor, + get, + isEmpty, + isNumber, + last, + merge, + sum, +} from 'lodash'; +import { + KEY_GROUP_COL_AXIS_RESIZE_AREA, + KEY_GROUP_ROW_AXIS_RESIZE_AREA, + X_FIELD_FORMATTER, +} from '../constant'; +import { AxisColHeader } from '../header/axis-col'; +import { AxisCornerHeader } from '../header/axis-corner'; +import { AxisRowHeader } from '../header/axis-row'; +import { CornerHeader } from '../header/corner'; + +import { AxisColCell } from '../cell/axis-col-cell'; +import { AxisCornerCell } from '../cell/axis-corner-cell'; +import { AxisRowCell } from '../cell/axis-row-cell'; +import { AxisCellType } from '../cell/cell-type'; +import type { PivotChartSheet } from '../pivot-chart-sheet'; +import { separateRowColLeafNodes } from '../utils/separate-axis'; +import { CornerBBox } from './corner-bbox'; +import { Frame } from './frame'; +import { PanelBBox } from './panel-bbox'; + +export class PivotChartFacet extends PivotFacet { + declare spreadsheet: PivotChartSheet; + + axisRowHeader: AxisRowHeader | null; + + axisColumnHeader: AxisColHeader | null; + + axisCornerHeader: AxisCornerHeader | null; + + protected override doLayout(): LayoutResult { + let layoutResult = this.buildAllHeaderHierarchy() as LayoutResult; + + layoutResult = separateRowColLeafNodes(layoutResult, this.spreadsheet); + + this.calculateHeaderNodesCoordinate(layoutResult); + + this.calculateAxisHierarchyCoordinate(layoutResult); + + const { + rowsHierarchy, + colsHierarchy, + axisRowsHierarchy, + axisColsHierarchy, + } = layoutResult; + + return { + axisRowsHierarchy, + axisColsHierarchy, + rowsHierarchy, + rowNodes: rowsHierarchy.getNodes(), + rowLeafNodes: rowsHierarchy.getLeaves(), + colsHierarchy, + colNodes: colsHierarchy.getNodes(), + colLeafNodes: colsHierarchy.getLeaves(), + }; + } + + protected getColLeafNodeRelatedCount(colNode: Node) { + const isValueInCols = this.spreadsheet.isValueInCols(); + const isPolar = this.spreadsheet.isPolarCoordinate(); + + const size = + !isValueInCols && !isPolar + ? get(colNode.relatedNode, 'children', []).length + : 1; + + return size; + } + + protected getRowLeafNodeRelatedCount(rowNode: Node) { + const isValueInCols = this.spreadsheet.isValueInCols(); + const isPolar = this.spreadsheet.isPolarCoordinate(); + + const size = + isValueInCols && !isPolar + ? get(rowNode.relatedNode, 'children', []).length + : 1; + + return size; + } + + protected getRowAxisWidth() { + const { rowCell } = this.spreadsheet.options.style!; + + const { rows = [] } = this.spreadsheet.dataSet.fields; + const lastRow = last(rows) as string; + + return rowCell?.widthByField?.[lastRow] ?? 0; + } + + protected getColAxisHeight() { + const { colCell } = this.spreadsheet.options.style!; + + const { columns = [] } = this.spreadsheet.dataSet.fields; + const lastCol = last(columns) as string; + + return colCell?.heightByField?.[lastCol] ?? 0; + } + + protected override getCompactGridColNodeWidth(colNode: Node) { + const { dataCell } = this.spreadsheet.options.style!; + const dataCellWidth = getCellWidth( + dataCell!, + this.getColLeafNodeRelatedCount(colNode), + ); + + return dataCellWidth; + } + + protected override getAdaptGridColWidth( + colLeafNodes: Node[], + colNode?: Node, + rowHeaderWidth?: number, + ) { + const { rows = [] } = this.spreadsheet.dataSet.fields; + const { dataCell } = this.spreadsheet.options.style!; + + const rowHeaderColSize = Math.max(0, rows.length - 1); + + const colHeaderColSize = sum( + colLeafNodes.map((node) => this.getColLeafNodeRelatedCount(node)), + ); + const { width } = this.getCanvasSize(); + const availableWidth = + width - + this.getSeriesNumberWidth() - + this.getRowAxisWidth() - + Frame.getVerticalBorderWidth(this.spreadsheet); + + const colSize = Math.max(1, rowHeaderColSize + colHeaderColSize); + + const currentSize = colNode ? this.getColLeafNodeRelatedCount(colNode) : 1; + + if (!rowHeaderWidth) { + return ( + currentSize * + Math.max(getCellWidth(dataCell!), floor(availableWidth / colSize)) + ); + } + + return ( + currentSize * + Math.max( + getCellWidth(dataCell!), + floor((availableWidth - rowHeaderWidth) / colHeaderColSize), + ) + ); + } + + protected getRowLeafNodeHeight(rowLeafNode: Node) { + const customHeight = this.getCustomRowCellHeight(rowLeafNode); + + // 1. 拖拽后的宽度优先级最高 + if (isNumber(customHeight)) { + return customHeight; + } + + const { dataCell } = this.spreadsheet.options.style!; + const dataCellHeight = dataCell?.height ?? 0; + + return this.getRowLeafNodeRelatedCount(rowLeafNode) * dataCellHeight; + } + + protected calculateAxisHierarchyCoordinate(layoutResult: LayoutResult) { + this.adjustTotalNodesCoordinateAfterSeparateAxisHierarchy(layoutResult); + this.calculateAxisRowsHierarchyCoordinate(layoutResult); + this.calculateAxisColsHierarchyCoordinate(layoutResult); + } + + protected adjustTotalNodesCoordinateAfterSeparateAxisHierarchy( + layoutResult: LayoutResult, + ) { + // 最后一个维度分离出去后,再存在总计、小计分组时,会存在总计、小计格子出现空缺,因为 pivot-facet 层是按照未拆分的逻辑做的补全。 + // 拆分后需要再处理一下,而且只需要针对维度拆分的部分做处理即可,指标拆分正常显示 + + const { rowsHierarchy, colsHierarchy } = layoutResult; + + if ( + !isEmpty(this.spreadsheet.options.totals?.row) && + this.spreadsheet.isValueInCols() + ) { + const sampleNodeForLastLevel = rowsHierarchy.sampleNodeForLastLevel!; + const maxX = sampleNodeForLastLevel.x + sampleNodeForLastLevel.width; + + rowsHierarchy.getLeaves().forEach((leaf) => { + const rightX = leaf.x + leaf.width; + + if (maxX > rightX) { + leaf.width += maxX - rightX; + } + }); + } + + if ( + !isEmpty(this.spreadsheet.options.totals?.col) && + !this.spreadsheet.isValueInCols() + ) { + const sampleNodeForLastLevel = colsHierarchy.sampleNodeForLastLevel!; + const maxY = sampleNodeForLastLevel.y + sampleNodeForLastLevel.height; + + colsHierarchy.getLeaves().forEach((leaf) => { + const bottomY = leaf.y + leaf.height; + + if (maxY > bottomY) { + leaf.height += maxY - bottomY; + } + }); + } + } + + protected calculateAxisRowsHierarchyCoordinate(layoutResult: LayoutResult) { + const { rowsHierarchy, axisRowsHierarchy } = layoutResult; + + if (!axisRowsHierarchy) { + return; + } + + const isValueInCols = this.spreadsheet.isValueInCols(); + const isPolar = this.spreadsheet.isPolarCoordinate(); + + rowsHierarchy.width = + rowsHierarchy.isPlaceholder && isValueInCols && !isPolar + ? 0 + : rowsHierarchy.width; + + const rowAxisWidth = this.getRowAxisWidth(); + + rowsHierarchy.getLeaves().forEach((leaf) => { + const relatedNode = leaf.relatedNode; + + if (!relatedNode) { + return; + } + + relatedNode.y = leaf.y; + relatedNode.width = rowAxisWidth; + relatedNode.height = leaf.height; + }); + + if (isValueInCols && isPolar) { + axisRowsHierarchy.width = 0; + axisRowsHierarchy.getNodes().forEach((node) => { + node.width = 0; + }); + } else { + axisRowsHierarchy.width = rowAxisWidth; + } + + axisRowsHierarchy.height = rowsHierarchy.height; + } + + protected calculateAxisColsHierarchyCoordinate(layoutResult: LayoutResult) { + const { colsHierarchy, axisColsHierarchy } = layoutResult; + + if (!axisColsHierarchy) { + return; + } + + const isValueInCols = this.spreadsheet.isValueInCols(); + const isPolar = this.spreadsheet.isPolarCoordinate(); + + const colAxisHeight = this.getColAxisHeight(); + + colsHierarchy.getLeaves().forEach((leaf) => { + const relatedNode = leaf.relatedNode; + + if (!relatedNode) { + return; + } + + relatedNode.x = leaf.x; + relatedNode.width = leaf.width; + relatedNode.height = colAxisHeight; + }); + + axisColsHierarchy.width = colsHierarchy.width; + + if (!isValueInCols && isPolar) { + axisColsHierarchy.height = 0; + axisColsHierarchy.getNodes().forEach((node) => { + node.height = 0; + }); + } else { + axisColsHierarchy.height = colAxisHeight; + } + } + + protected override calculateCornerBBox(): void { + this.cornerBBox = new CornerBBox(this, true); + } + + protected override calculatePanelBBox() { + this.panelBBox = new PanelBBox(this, true); + } + + protected override getCenterFrame() { + if (!this.centerFrame) { + const { viewportWidth, viewportHeight } = this.panelBBox; + const cornerWidth = this.cornerBBox.width; + const cornerHeight = this.cornerBBox.height; + const frame = this.spreadsheet.options?.frame; + const frameCfg: FrameConfig = { + position: { + x: this.cornerBBox.x, + y: this.cornerBBox.y, + }, + cornerWidth, + cornerHeight, + viewportWidth, + viewportHeight, + showViewportLeftShadow: false, + showViewportRightShadow: false, + spreadsheet: this.spreadsheet, + }; + + return frame ? frame(frameCfg) : new Frame(frameCfg); + } + + return this.centerFrame; + } + + protected override renderHeaders(): void { + super.renderHeaders(); + this.axisRowHeader = this.getAxisRowHeader(); + + if (this.axisRowHeader) { + this.foregroundGroup.appendChild(this.axisRowHeader); + } + + this.axisColumnHeader = this.getAxisColHeader(); + if (this.axisColumnHeader) { + this.foregroundGroup.appendChild(this.axisColumnHeader); + } + + this.axisCornerHeader = this.getAxisCornerHeader(); + if (this.axisCornerHeader) { + this.foregroundGroup.appendChild(this.axisCornerHeader); + } + } + + protected override getCornerHeader(): CornerHeader { + return ( + this.cornerHeader || + CornerHeader.getCornerHeader({ + panelBBox: this.panelBBox, + cornerBBox: this.cornerBBox, + seriesNumberWidth: this.getSeriesNumberWidth(), + layoutResult: this.layoutResult, + spreadsheet: this.spreadsheet, + }) + ); + } + + protected getAxisRowHeader(): AxisRowHeader | null { + if (this.axisRowHeader) { + return this.axisRowHeader; + } + + const { y, viewportHeight, viewportWidth, height } = this.panelBBox; + const { rowsHierarchy, axisRowsHierarchy } = this.layoutResult; + const seriesNumberWidth = this.getSeriesNumberWidth(); + + return new AxisRowHeader({ + width: this.cornerBBox.width, + height, + viewportWidth, + viewportHeight, + position: { x: seriesNumberWidth + rowsHierarchy.width, y }, + nodes: axisRowsHierarchy?.getNodes() ?? [], + spreadsheet: this.spreadsheet, + }); + } + + protected getAxisColHeader(): AxisColHeader | null { + if (this.axisColumnHeader) { + return this.axisColumnHeader; + } + + const { x, width, viewportWidth, y, viewportHeight } = this.panelBBox; + const { axisColsHierarchy } = this.layoutResult; + + return new AxisColHeader({ + width, + cornerWidth: this.cornerBBox.width, + height: axisColsHierarchy?.height ?? 0, + viewportWidth, + viewportHeight, + position: { x, y: y + viewportHeight }, + nodes: axisColsHierarchy?.getNodes() ?? [], + spreadsheet: this.spreadsheet, + }); + } + + protected getAxisCornerHeader(): AxisCornerHeader | null { + return ( + this.axisCornerHeader || + AxisCornerHeader.getCornerHeader({ + panelBBox: this.panelBBox, + cornerBBox: this.cornerBBox, + seriesNumberWidth: this.getSeriesNumberWidth(), + layoutResult: this.layoutResult, + spreadsheet: this.spreadsheet, + }) + ); + } + + protected override translateRelatedGroups( + scrollX: number, + scrollY: number, + hRowScroll: number, + ): void { + super.translateRelatedGroups(scrollX, scrollY, hRowScroll); + + this.axisRowHeader?.onScrollXY( + this.getRealScrollX(scrollX, hRowScroll), + scrollY, + KEY_GROUP_ROW_AXIS_RESIZE_AREA, + ); + + this.axisColumnHeader?.onColScroll(scrollX, KEY_GROUP_COL_AXIS_RESIZE_AREA); + + this.axisCornerHeader?.onCorScroll( + this.getRealScrollX(scrollX, hRowScroll), + ); + } + + protected override renderRowScrollBar(rowHeaderScrollX: number) { + super.renderRowScrollBar(rowHeaderScrollX); + + if (this.hRowScrollBar) { + const maxOffset = this.cornerBBox.originalWidth - this.cornerBBox.width; + + this.hRowScrollBar.addEventListener( + ScrollType.ScrollChange, + ({ offset }: ScrollChangeParams) => { + const newOffset = this.getValidScrollBarOffset(offset, maxOffset); + const newRowHeaderScrollX = floor(newOffset); + + this.setScrollOffset({ rowHeaderScrollX: newRowHeaderScrollX }); + + this.axisRowHeader?.onRowScrollX( + newRowHeaderScrollX, + KEY_GROUP_ROW_AXIS_RESIZE_AREA, + ); + + this.axisCornerHeader?.onRowScrollX(newRowHeaderScrollX); + }, + ); + } + } + + /** + * 根据行列索引获取单元格元数据 + */ + public override getCellMeta(rowIndex = 0, colIndex = 0) { + const { options, dataSet } = this.spreadsheet; + const { axisRowsHierarchy, axisColsHierarchy } = this.getLayoutResult(); + + const rowAxisLeafNodes = axisRowsHierarchy?.getLeaves() ?? []; + const colAxisLeafNodes = axisColsHierarchy?.getLeaves() ?? []; + + const rowAxis = rowAxisLeafNodes[rowIndex]; + const colAxis = colAxisLeafNodes[colIndex]; + + if (!rowAxis || !colAxis) { + return null; + } + + const data: any = []; + + const xField = + rowAxis.field === EXTRA_FIELD ? colAxis.field : rowAxis.field; + const yField = + rowAxis.field === EXTRA_FIELD ? rowAxis.value : colAxis.value; + + for (const rowChild of rowAxis.children) { + for (const colChild of colAxis.children) { + const rowQuery = rowChild.query; + const colQuery = colChild.query; + + const isTotals = + rowChild.isTotals || + rowChild.isTotalMeasure || + colChild.isTotals || + colChild.isTotalMeasure; + + const totalStatus = getHeaderTotalStatus(rowChild, colChild); + + const dataQuery = merge({}, rowQuery, colQuery); + const current = dataSet.getCellData({ + query: dataQuery, + isTotals, + totalStatus, + }) as CellData; + + let xValue; + let xValueShouldFormatter = true; + + if (rowChild.field === EXTRA_FIELD) { + xValue = colChild.value; + xValueShouldFormatter = !colChild.isTotalRoot; + } else { + xValue = rowChild.value; + xValueShouldFormatter = !rowChild.isTotalRoot; + } + + const origin = { + [xField]: xValue, + [X_FIELD_FORMATTER]: xValueShouldFormatter, + ...current?.[ORIGIN_FIELD], + }; + + data.push(origin); + } + } + + const cellMeta: ViewMeta = { + spreadsheet: this.spreadsheet, + x: colAxis.x, + y: rowAxis.y, + width: colAxis.width, + height: rowAxis.height, + data, + rowIndex, + colIndex, + rowId: rowAxis.id, + colId: colAxis.id, + fieldValue: data, + valueField: yField, + xField, + yField, + id: getDataCellId(rowAxis.id, colAxis.id), + }; + + return options.layoutCellMeta?.(cellMeta) ?? cellMeta; + } + + protected getFrozenColSplitLineSize() { + const { viewportHeight, y: panelBBoxStartY } = this.panelBBox; + const { axisColsHierarchy } = this.layoutResult; + const height = + viewportHeight + panelBBoxStartY + (axisColsHierarchy?.height ?? 0); + + return { + y: 0, + height, + }; + } + + public getAxisCornerCells(): AxisCornerCell[] { + const headerChildren = (this.getAxisCornerHeader()?.children || + []) as AxisCornerCell[]; + + return getAllChildCells(headerChildren, AxisCornerCell).filter( + (cell: S2CellType) => + cell.cellType === (AxisCellType.AXIS_CORNER_CELL as any), + ); + } + + public getAxisRowCells(): AxisRowCell[] { + const headerChildren = (this.getAxisRowHeader()?.children || + []) as AxisRowCell[]; + + return getAllChildCells(headerChildren, AxisRowCell).filter( + (cell: S2CellType) => + cell.cellType === (AxisCellType.AXIS_ROW_CELL as any), + ); + } + + public getAxisColCells(): AxisColCell[] { + const headerChildren = (this.getAxisColHeader()?.children || + []) as AxisColCell[]; + + return getAllChildCells(headerChildren, AxisColCell).filter( + (cell: S2CellType) => + cell.cellType === (AxisCellType.AXIS_COL_CELL as any), + ); + } + + /** + * 获取表头单元格 (序号,角头,行头,列头) (不含可视区域) + * @example 获取全部: facet.getHeaderCells() + * @example 获取一组 facet.getHeaderCells(['root[&]浙江省[&]宁波市', 'root[&]浙江省[&]杭州市']) + */ + public getHeaderCells( + cellIds?: string[] | SelectedIds, + ): S2CellType[] { + const headerCells = concat( + this.getCornerCells(), + this.getSeriesNumberCells(), + this.getRowCells(), + this.getColCells(), + this.getAxisCornerCells(), + this.getAxisRowCells(), + this.getAxisColCells(), + ); + + return this.filterCells(headerCells, cellIds); + } + + public getAxisCornerNodes(): Node[] { + return this.axisCornerHeader?.getNodes() || []; + } + + public getAxisRowNodes(): Node[] { + return this.axisRowHeader?.getNodes() || []; + } + + public getAxisColNodes(): Node[] { + return this.axisColumnHeader?.getNodes() || []; + } + + /** + * 获取表头节点 (角头,序号,行头,列头) (含可视区域) + * @example 获取全部: facet.getHeaderNodes() + * @example 获取一组 facet.getHeaderNodes(['root[&]浙江省[&]宁波市', 'root[&]浙江省[&]杭州市']) + */ + public getHeaderNodes(nodeIds?: string[]): Node[] { + const headerNodes = concat( + this.getCornerNodes(), + this.getSeriesNumberNodes(), + this.getRowNodes(), + this.getColNodes(), + this.getAxisCornerNodes(), + this.getAxisRowNodes(), + this.getAxisColNodes(), + ); + + if (!nodeIds) { + return headerNodes; + } + + return headerNodes.filter((node) => nodeIds.includes(node.id)); + } + + /** + * 获取单元格的所有子节点 (含非可视区域) + * @example + * const rowCell = facet.getRowCells()[0] + * facet.getCellChildrenNodes(rowCell) + */ + public getCellChildrenNodes = (cell: S2CellType): Node[] => { + const selectNode = cell?.getMeta?.() as Node; + + return Node.getAllChildrenNodes(selectNode, (node) => { + // 行列头区域,也把对应的 axis 区域 node 返回 + return node.relatedNode ? [node, node.relatedNode] : [node]; + }); + }; +} diff --git a/packages/s2-core/src/extends/pivot-chart/header/axis-col.ts b/packages/s2-core/src/extends/pivot-chart/header/axis-col.ts new file mode 100644 index 0000000000..e300351a90 --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/header/axis-col.ts @@ -0,0 +1,57 @@ +import { Group } from '@antv/g'; +import { + ColHeader, + FRONT_GROUND_GROUP_FROZEN_Z_INDEX, + FRONT_GROUND_GROUP_SCROLL_Z_INDEX, + FrozenFacet, + Node, +} from '@antv/s2'; +import { AxisColCell } from '../cell/axis-col-cell'; +import { + KEY_GROUP_COL_AXIS_FROZEN, + KEY_GROUP_COL_AXIS_SCROLL, +} from '../constant'; +import { getExtraFrozenColAxisNodes } from '../utils/frozen'; + +export class AxisColHeader extends ColHeader { + protected initGroups(): void { + this.scrollGroup = this.appendChild( + new Group({ + name: KEY_GROUP_COL_AXIS_SCROLL, + style: { zIndex: FRONT_GROUND_GROUP_SCROLL_Z_INDEX }, + }), + ); + + this.frozenGroup = this.appendChild( + new Group({ + name: KEY_GROUP_COL_AXIS_FROZEN, + style: { zIndex: FRONT_GROUND_GROUP_FROZEN_Z_INDEX }, + }), + ); + this.frozenTrailingGroup = this.appendChild( + new Group({ + name: KEY_GROUP_COL_AXIS_FROZEN, + style: { zIndex: FRONT_GROUND_GROUP_FROZEN_Z_INDEX }, + }), + ); + + const { spreadsheet, nodes } = this.getHeaderConfig(); + + this.extraFrozenNodes = getExtraFrozenColAxisNodes( + spreadsheet.facet as FrozenFacet, + nodes, + ); + } + + public getCellInstance(node: Node): any { + const headerConfig = this.getHeaderConfig(); + + const { spreadsheet } = headerConfig; + const { axisColCell: colAxisCell } = spreadsheet.options; + + return ( + colAxisCell?.(node, spreadsheet, headerConfig) || + new AxisColCell(node, spreadsheet, headerConfig) + ); + } +} diff --git a/packages/s2-core/src/extends/pivot-chart/header/axis-corner.ts b/packages/s2-core/src/extends/pivot-chart/header/axis-corner.ts new file mode 100644 index 0000000000..cc214925a0 --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/header/axis-corner.ts @@ -0,0 +1,111 @@ +import type { PointLike } from '@antv/g-lite'; +import { + CornerBBox, + CornerNodeType, + Node, + CornerHeader as OriginCornerHeader, + PanelBBox, + type BaseCornerOptions, +} from '@antv/s2'; +import { AxisCornerCell } from '../cell/axis-corner-cell'; + +export class AxisCornerHeader extends OriginCornerHeader { + /** + * Get corner Header by config + */ + public static getCornerHeader( + options: BaseCornerOptions & { + panelBBox: PanelBBox; + cornerBBox: CornerBBox; + }, + ) { + const { + panelBBox, + cornerBBox, + seriesNumberWidth, + layoutResult, + spreadsheet, + } = options; + const { y, viewportWidth, viewportHeight } = panelBBox; + const { originalWidth: cornerOriginalWidth, width: cornerWidth } = + cornerBBox; + + const { axisColsHierarchy } = layoutResult; + + const position = { + x: cornerBBox.x, + y: y + viewportHeight, + }; + + const height = axisColsHierarchy?.height ?? 0; + + const cornerNodes = this.getCornerNodes({ + position, + width: cornerOriginalWidth, + height, + layoutResult, + seriesNumberWidth, + spreadsheet, + }); + + return new AxisCornerHeader({ + nodes: cornerNodes, + position, + width: cornerWidth, + height, + originalWidth: cornerOriginalWidth, + originalHeight: height, + viewportWidth, + viewportHeight, + seriesNumberWidth, + spreadsheet, + }); + } + + public static getCornerNodes( + options: BaseCornerOptions & { + position: PointLike; + width: number; + height: number; + }, + ): Node[] { + const cornerNodes = []; + // 创建角头区域竖轴 + + const { layoutResult, spreadsheet } = options; + + const { axisColsHierarchy } = layoutResult; + + const colAxisNode = axisColsHierarchy?.sampleNodeForLastLevel; + + if (colAxisNode) { + const cornerNode = new Node({ + id: colAxisNode.id, + field: colAxisNode.field, + value: spreadsheet.dataSet.getFieldName(colAxisNode.field), + x: 0, + y: 0, + width: spreadsheet.facet.cornerBBox.originalWidth, + height: colAxisNode.height, + isPivotMode: true, + cornerType: CornerNodeType.Col, + spreadsheet, + }); + + cornerNodes.push(cornerNode); + } + + return cornerNodes; + } + + protected getCellInstance(node: Node): any { + const headerConfig = this.getHeaderConfig(); + const { spreadsheet } = headerConfig; + const { axisCornerCell } = spreadsheet.options; + + return ( + axisCornerCell?.(node, spreadsheet, headerConfig) || + new AxisCornerCell(node, spreadsheet, headerConfig) + ); + } +} diff --git a/packages/s2-core/src/extends/pivot-chart/header/axis-row.ts b/packages/s2-core/src/extends/pivot-chart/header/axis-row.ts new file mode 100644 index 0000000000..4e119f1ae3 --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/header/axis-row.ts @@ -0,0 +1,57 @@ +import { Group } from '@antv/g'; +import { + FRONT_GROUND_GROUP_FROZEN_Z_INDEX, + FRONT_GROUND_GROUP_SCROLL_Z_INDEX, + FrozenFacet, + Node, + RowHeader, +} from '@antv/s2'; +import { AxisRowCell } from '../cell/axis-row-cell'; +import { + KEY_GROUP_ROW_AXIS_FROZEN, + KEY_GROUP_ROW_AXIS_SCROLL, +} from '../constant'; +import { getExtraFrozenRowAxisNodes } from '../utils/frozen'; + +export class AxisRowHeader extends RowHeader { + protected initGroups(): void { + this.scrollGroup = this.appendChild( + new Group({ + name: KEY_GROUP_ROW_AXIS_SCROLL, + style: { zIndex: FRONT_GROUND_GROUP_SCROLL_Z_INDEX }, + }), + ); + + this.frozenGroup = this.appendChild( + new Group({ + name: KEY_GROUP_ROW_AXIS_FROZEN, + style: { zIndex: FRONT_GROUND_GROUP_FROZEN_Z_INDEX }, + }), + ); + this.frozenTrailingGroup = this.appendChild( + new Group({ + name: KEY_GROUP_ROW_AXIS_FROZEN, + style: { zIndex: FRONT_GROUND_GROUP_FROZEN_Z_INDEX }, + }), + ); + + const { spreadsheet, nodes } = this.getHeaderConfig(); + + this.extraFrozenNodes = getExtraFrozenRowAxisNodes( + spreadsheet.facet as FrozenFacet, + nodes, + ); + } + + public getCellInstance(node: Node): any { + const headerConfig = this.getHeaderConfig(); + + const { spreadsheet } = headerConfig; + const { axisRowCell: rowAxisCell } = spreadsheet.options; + + return ( + rowAxisCell?.(node, spreadsheet, headerConfig) || + new AxisRowCell(node, spreadsheet, headerConfig) + ); + } +} diff --git a/packages/s2-core/src/extends/pivot-chart/header/corner.ts b/packages/s2-core/src/extends/pivot-chart/header/corner.ts new file mode 100644 index 0000000000..a62c464767 --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/header/corner.ts @@ -0,0 +1,54 @@ +import type { PointLike } from '@antv/g-lite'; +import { + CornerNodeType, + Node, + CornerHeader as OriginCornerHeader, + type BaseCornerOptions, +} from '@antv/s2'; + +export class CornerHeader extends OriginCornerHeader { + public static getCornerNodes( + options: BaseCornerOptions & { + position: PointLike; + width: number; + height: number; + }, + ): Node[] { + const cornerNodes = super.getCornerNodes(options); + // 创建角头区域竖轴 + + const { seriesNumberWidth, layoutResult, spreadsheet } = options; + + const { rowsHierarchy, axisRowsHierarchy, colsHierarchy } = layoutResult; + + const rowAxisNode = axisRowsHierarchy?.sampleNodeForLastLevel; + + if (rowAxisNode) { + const leafNode = colsHierarchy?.sampleNodeForLastLevel; + + const cornerNode = new Node({ + id: rowAxisNode.id, + field: rowAxisNode.field, + value: spreadsheet.dataSet.getFieldName(rowAxisNode.field), + x: seriesNumberWidth + rowsHierarchy.width + rowAxisNode.x, + y: leafNode?.y ?? 0, + width: rowAxisNode.width, + height: + leafNode?.height ?? + spreadsheet.facet.getCellCustomSize( + null, + spreadsheet.options.style?.colCell?.height, + ) ?? + 0, + + isPivotMode: true, + cornerType: CornerNodeType.Row, + spreadsheet, + }); + + cornerNodes.push(cornerNode); + } + + return cornerNodes; + } +} diff --git a/packages/s2-core/src/extends/pivot-chart/index.ts b/packages/s2-core/src/extends/pivot-chart/index.ts new file mode 100644 index 0000000000..482fcc3a98 --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/index.ts @@ -0,0 +1,11 @@ +export * from './cell/axis-col-cell'; +export * from './cell/axis-corner-cell'; +export * from './cell/axis-row-cell'; +export * from './cell/chart-data-cell'; +export * from './cell/pivot-chart-data-cell'; +export * from './facet/pivot-chart-facet'; +export * from './header/axis-col'; +export * from './header/axis-corner'; +export * from './header/axis-row'; +export * from './interface'; +export * from './pivot-chart-sheet'; diff --git a/packages/s2-core/src/extends/pivot-chart/interaction/axis-click.ts b/packages/s2-core/src/extends/pivot-chart/interaction/axis-click.ts new file mode 100644 index 0000000000..5af6c77cb8 --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/interaction/axis-click.ts @@ -0,0 +1,43 @@ +import type { FederatedPointerEvent as CanvasEvent } from '@antv/g-lite'; +import { InteractionStateName, RowColumnClick, S2Event } from '@antv/s2'; +import { AxisCellType } from '../cell/cell-type'; +import { updateDataCellRelevantHeaderCells } from '../utils/handle-interaction'; + +export class AxisRowColumnClick extends RowColumnClick { + public bindEvents() { + this.bindKeyboardDown(); + this.bindKeyboardUp(); + this.bindAxisCellClick(); + this.bindDataCellClick(); + this.bindMouseMove(); + } + + protected bindAxisCellClick() { + this.spreadsheet.on(S2Event.GLOBAL_CLICK, (event: CanvasEvent) => { + const cell = this.spreadsheet.getCell(event.target); + + if (!cell) { + return; + } + + // axis col cell 在底部,点击后再往上选择 data cell 有点奇怪,暂时不处理 + if (cell.cellType === (AxisCellType.AXIS_ROW_CELL as any)) { + this.handleRowColClick(event); + } + }); + } + + protected bindDataCellClick() { + this.spreadsheet.on(S2Event.DATA_CELL_CLICK_TRIGGERED_PRIVATE, (cell) => { + const meta = cell.getMeta(); + + if (this.spreadsheet.options.interaction?.selectedCellHighlight) { + updateDataCellRelevantHeaderCells( + InteractionStateName.SELECTED, + meta, + this.spreadsheet, + ); + } + }); + } +} diff --git a/packages/s2-core/src/extends/pivot-chart/interaction/axis-hover.ts b/packages/s2-core/src/extends/pivot-chart/interaction/axis-hover.ts new file mode 100644 index 0000000000..5dbc0923c3 --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/interaction/axis-hover.ts @@ -0,0 +1,57 @@ +import type { FederatedPointerEvent as CanvasEvent } from '@antv/g'; +import { + DataCell, + HoverEvent, + InteractionStateName, + S2Event, + type ViewMeta, +} from '@antv/s2'; +import { isEmpty } from 'lodash'; +import { AxisCellType } from '../cell/cell-type'; +import { updateDataCellRelevantHeaderCells } from '../utils/handle-interaction'; + +export class AxisHover extends HoverEvent { + public shouldSkipDataCellHoverEvent(event: CanvasEvent) { + const cell = this.spreadsheet.getCell(event.target); + + if (isEmpty(cell)) { + return true; + } + } + + public bindDataCellHover() { + this.spreadsheet.on( + S2Event.DATA_CELL_HOVER_TRIGGERED_PRIVATE, + (cell: DataCell) => { + const { options } = this.spreadsheet; + const { interaction: interactionOptions } = options; + const meta = cell?.getMeta() as ViewMeta; + + if (interactionOptions?.hoverHighlight) { + updateDataCellRelevantHeaderCells( + InteractionStateName.HOVER, + meta, + this.spreadsheet, + ); + } + }, + ); + } + + public bindHeaderCellHover() { + this.spreadsheet.on(S2Event.GLOBAL_HOVER, (event) => { + const cell = this.spreadsheet.getCell(event.target); + + if (!cell) { + return; + } + + if ( + cell.cellType === (AxisCellType.AXIS_ROW_CELL as any) || + cell.cellType === (AxisCellType.AXIS_COL_CELL as any) + ) { + this.handleHeaderHover(event); + } + }); + } +} diff --git a/packages/s2-core/src/extends/pivot-chart/interaction/root.ts b/packages/s2-core/src/extends/pivot-chart/interaction/root.ts new file mode 100644 index 0000000000..ae4e2a2f59 --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/interaction/root.ts @@ -0,0 +1,30 @@ +import { + CellType, + RootInteraction as OriginRootInteraction, + type CellMeta, +} from '@antv/s2'; +import { isEqual, map, sortBy, uniq } from 'lodash'; +import { AxisCellType } from '../cell/cell-type'; + +const SameTypes = [ + sortBy([CellType.ROW_CELL, AxisCellType.AXIS_ROW_CELL]), + sortBy([CellType.COL_CELL, AxisCellType.AXIS_COL_CELL]), +]; + +export class RootInteraction extends OriginRootInteraction { + public shouldForbidHeaderCellSelected = (selectedCells: CellMeta[]) => { + // 禁止跨单元格选择, 这样计算出来的数据和交互没有任何意义 + + const types = sortBy(uniq(map(selectedCells, 'type'))); + + if (types.length <= 1) { + return false; + } + + if (SameTypes.some((same) => isEqual(same, types))) { + return false; + } + + return true; + }; +} diff --git a/packages/s2-core/src/extends/pivot-chart/interface.ts b/packages/s2-core/src/extends/pivot-chart/interface.ts new file mode 100644 index 0000000000..cac288eb64 --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/interface.ts @@ -0,0 +1,55 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ + +import { type AxisComponent, type G2Spec } from '@antv/g2'; +import type { + CellCallback, + ColHeaderConfig, + CornerHeaderConfig, + DefaultCellTheme, + Hierarchy, + RowHeaderConfig, +} from '@antv/s2'; +import type { AxisColCell } from './cell/axis-col-cell'; +import type { AxisCornerCell } from './cell/axis-corner-cell'; +import type { AxisRowCell } from './cell/axis-row-cell'; +import type { AxisCellType } from './cell/cell-type'; +import type { PivotChartDataCell } from './cell/pivot-chart-data-cell'; + +export type ChartCoordinate = 'cartesian' | 'polar'; + +export interface Chart { + /** + * 当前图表的坐标系类型,chartSheet 通过该类型判断是否需要在行列头区域绘制坐标系 + * 独立配置是因为要从 spec 里面判断是笛卡尔坐标还是极坐标,场景非常多,覆盖完全很困难 + */ + coordinate?: ChartCoordinate; + dataCellSpec?: G2Spec | ((cell: PivotChartDataCell) => G2Spec); + axisRowCellSpec?: AxisComponent | ((cell: AxisRowCell) => AxisComponent); + axisColCellSpec?: AxisComponent | ((cell: AxisColCell) => AxisComponent); +} + +// @ts-ignore +declare module '@antv/s2' { + interface LayoutResult { + axisRowsHierarchy?: Hierarchy; + axisColsHierarchy?: Hierarchy; + } + + interface S2PivotSheetOptions { + chart?: Chart; + axisRowCell?: CellCallback; + axisColCell?: CellCallback; + axisCornerCell?: CellCallback; + } + + type AxisCellThemes = { + [K in AxisCellType]?: DefaultCellTheme; + }; + + interface S2Theme extends AxisCellThemes {} + + interface ViewMeta { + xField?: string; + yField?: string; + } +} diff --git a/packages/s2-core/src/extends/pivot-chart/pivot-chart-sheet.ts b/packages/s2-core/src/extends/pivot-chart/pivot-chart-sheet.ts new file mode 100644 index 0000000000..f9d323e86b --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/pivot-chart-sheet.ts @@ -0,0 +1,166 @@ +import { + EXTRA_FIELD, + PivotSheet, + ResizeType, + setupDataConfig, + setupOptions, + type S2DataConfig, + type S2Options, + type ThemeCfg, + type ViewMeta, +} from '@antv/s2'; +import { last } from 'lodash'; +import { PivotChartDataCell } from './cell/pivot-chart-data-cell'; +import { + DEFAULT_COL_AXIS_SIZE, + DEFAULT_DIMENSION_SIZE, + DEFAULT_MEASURE_SIZE, + DEFAULT_OPTIONS, + DEFAULT_ROW_AXIS_SIZE, + FIXED_DATA_CONFIG, + FIXED_OPTIONS, +} from './constant'; +import { PivotChartFacet } from './facet/pivot-chart-facet'; +import { RootInteraction } from './interaction/root'; +import { getCustomTheme as defaultGetCustomTheme } from './utils/theme'; + +export class PivotChartSheet extends PivotSheet { + protected override initInteraction() { + this.interaction?.destroy?.(); + this.interaction = new RootInteraction(this); + } + + protected override setupDataConfig(dataCfg: S2DataConfig): void { + this.dataCfg = setupDataConfig(dataCfg, FIXED_DATA_CONFIG); + } + + protected override setupOptions(options: S2Options | null) { + this.options = setupOptions( + DEFAULT_OPTIONS, + this.getRuntimeDefaultOptions(options), + options, + this.getRuntimeFixedOptions(), + FIXED_OPTIONS, + ); + } + + public setThemeCfg( + themeCfg: ThemeCfg = {}, + getCustomTheme = defaultGetCustomTheme, + ) { + super.setThemeCfg(themeCfg, getCustomTheme); + } + + protected override buildFacet(): void { + if (this.isCustomRowFields() || this.isCustomColumnFields()) { + super.buildFacet(); + + return; + } + + const defaultCell = (viewMeta: ViewMeta) => + new PivotChartDataCell(viewMeta, this); + + this.options.dataCell ??= defaultCell; + this.facet?.destroy(); + this.facet = this.options.facet?.(this) ?? new PivotChartFacet(this); + this.facet.render(); + } + + protected getRuntimeDefaultOptions(options: S2Options | null): S2Options { + const { + rows = [], + columns = [], + valueInCols = true, + } = this.dataCfg.fields ?? {}; + + /** + * 下面的逻辑准则: + * 如果是笛卡尔坐标系,希望 x 轴 dimension 的每个维度默认宽度大致相同,y 轴 measure 的宽度始终保持都相同 + * 比如对于 rows: province-> city , value: number 来说 + * 四川下面有 n 个城市,北京下面有 m 个城市,那么四川的宽度是 n * width, 北京的宽度是 m * width + * 而不管是四川,还是北京, y 轴展示的都是 number 的值,那么 y 轴的宽度保持相同,能快速通过图形的尺寸看出数据的相对大小。 + * 如果是极坐标系, 希望 x 轴宽度相同,y 轴 measure 的宽度也都相同 + * 比如对于 rows: province-> city , value: number 来说 + * 四川下面有 n 个城市,北京下面有 m 个城市,那么四川的宽度是 width, 北京的宽度也是 width,不再以维度数量作为依据,能让数据的呈现效果更好 + */ + + const isPolar = this.isPolarCoordinate(options); + + if (valueInCols) { + const lastRow = last(rows) as string; + + return { + style: { + rowCell: { + widthByField: { + [lastRow]: DEFAULT_ROW_AXIS_SIZE, + }, + }, + colCell: { + heightByField: { + [EXTRA_FIELD]: DEFAULT_COL_AXIS_SIZE, + }, + }, + dataCell: { + width: DEFAULT_MEASURE_SIZE, + height: isPolar ? DEFAULT_MEASURE_SIZE : DEFAULT_DIMENSION_SIZE, + }, + }, + }; + } + + const lastCol = last(columns) as string; + + return { + style: { + rowCell: { + widthByField: { + [EXTRA_FIELD]: DEFAULT_ROW_AXIS_SIZE, + }, + }, + colCell: { + heightByField: { + [lastCol]: DEFAULT_COL_AXIS_SIZE, + }, + }, + dataCell: { + width: isPolar ? DEFAULT_MEASURE_SIZE : DEFAULT_DIMENSION_SIZE, + height: DEFAULT_MEASURE_SIZE, + }, + }, + }; + } + + protected getRuntimeFixedOptions(): S2Options { + const { valueInCols = true } = this.dataCfg.fields ?? {}; + + if (valueInCols) { + return { + interaction: { + resize: { + rowResizeType: ResizeType.CURRENT, + colResizeType: ResizeType.ALL, + }, + }, + }; + } + + return { + interaction: { + resize: { + rowResizeType: ResizeType.ALL, + colResizeType: ResizeType.CURRENT, + }, + }, + }; + } + + isPolarCoordinate(options: S2Options | null = this.options) { + return options?.chart?.coordinate === 'polar'; + } + + enableAsyncExport() { + return new Error("pivot chart doesn't support export all data"); + } +} diff --git a/packages/s2-core/src/extends/pivot-chart/utils/chart-options.ts b/packages/s2-core/src/extends/pivot-chart/utils/chart-options.ts new file mode 100644 index 0000000000..72acaea16c --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/utils/chart-options.ts @@ -0,0 +1,151 @@ +import type { AxisComponent, G2Spec } from '@antv/g2'; +import { + EXTRA_FIELD, + G2_THEME_TYPE, + type InternalFullyCellTheme, + type Node, + type SpreadSheet, + type ViewMeta, +} from '@antv/s2'; +import { map, unary } from 'lodash'; +import { X_FIELD_FORMATTER } from '../constant'; +import type { PivotChartSheet } from '../pivot-chart-sheet'; + +export function getTheme(s2: SpreadSheet): Pick { + const themeName = s2.getThemeName(); + + return { + theme: { + type: G2_THEME_TYPE[themeName] ?? 'light', + }, + }; +} + +export function getAxisStyle(cellStyle: InternalFullyCellTheme): AxisComponent { + return { + // title + titleSpacing: 0, + titleFontSize: cellStyle.bolderText.fontSize, + titleFontFamily: cellStyle.bolderText.fontFamily, + titleFontWeight: cellStyle.bolderText.fontWeight, + titleFill: cellStyle.bolderText.fill, + titleFillOpacity: cellStyle.bolderText.opacity, + + // label + labelAlign: 'horizontal', + labelAutoRotate: false, + labelFontSize: cellStyle.text.fontSize, + labelFontFamily: cellStyle.text.fontFamily, + labelFontWeight: cellStyle.text.fontWeight, + labelFill: cellStyle.text.fill, + labelFillOpacity: cellStyle.text.opacity, + labelStroke: cellStyle.text.fill, + labelStrokeOpacity: cellStyle.text.fill, + + // tick + tick: true, + tickStroke: cellStyle.text.fill, + tickStrokeOpacity: cellStyle.text.opacity, + + // line + line: false, + lineStroke: cellStyle.text.fill, + lineStrokeOpacity: cellStyle.text.opacity, + + // grid + grid: false, + }; +} + +export function getCoordinate(s2: SpreadSheet): Pick { + if ((s2 as PivotChartSheet).isPolarCoordinate?.()) { + return {}; + } + + return { + coordinate: { + transform: s2.isValueInCols() ? [{ type: 'transpose' }] : undefined, + }, + }; +} + +export function getAxisXOptions(meta: Node, s2: SpreadSheet): AxisComponent { + const domain = map(meta.children, (child) => { + const formatter = s2.dataSet.getFieldFormatter(child.field); + + return !child.isTotalRoot && formatter + ? formatter(child.value, undefined, child) + : child.value; + }); + + return { + type: 'axisX', + scale: { + x: { + type: 'band', + domain, + range: [0, 1], + }, + }, + }; +} + +export function getScaleY( + value: string, + s2: SpreadSheet, +): Pick { + if ((s2 as PivotChartSheet).isPolarCoordinate?.()) { + return {}; + } + + const range = s2.dataSet.getValueRangeByField(value); + + return { + scale: { + y: { + type: 'linear', + domain: [range.minValue, range.maxValue], + range: [1, 0], + }, + }, + }; +} + +export function getAxisYOptions(meta: Node, s2: SpreadSheet): AxisComponent { + const { field, value } = meta; + + const formatter = s2.dataSet.getFieldFormatter(value); + + return { + type: 'axisY', + ...getScaleY(value, s2), + labelFormatter: unary(formatter), + title: s2.dataSet.getFieldFormatter(field)?.(value), + }; +} + +export function getTooltip( + viewMeta: ViewMeta, + s2: SpreadSheet, +): Pick { + const { xField, yField } = viewMeta; + const dataSet = s2.dataSet; + + return { + tooltip: { + title: (data: any) => { + return data[X_FIELD_FORMATTER] + ? dataSet.getFieldFormatter(xField!)?.(data[xField!]) + : data[xField!]; + }, + items: [ + (data: any) => { + return { + name: dataSet.getFieldFormatter(EXTRA_FIELD)?.(yField), + value: dataSet.getFieldFormatter(yField!)?.(data[yField!]), + }; + }, + ], + }, + }; +} diff --git a/packages/s2-core/src/extends/pivot-chart/utils/frozen.ts b/packages/s2-core/src/extends/pivot-chart/utils/frozen.ts new file mode 100644 index 0000000000..d8763b8297 --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/utils/frozen.ts @@ -0,0 +1,92 @@ +import { Node, type FrozenFacet } from '@antv/s2'; + +function getNodesByRange( + nodes: Node[], + key: 'rowIndex' | 'colIndex', + minIndex: number, + maxIndex: number, +) { + return nodes.filter((node) => node[key] >= minIndex && node[key] <= maxIndex); +} + +export function getExtraFrozenColAxisNodes(facet: FrozenFacet, nodes: Node[]) { + const extraNodes: Node[] = []; + + const { colCount, trailingColCount } = facet.getFrozenOptions(); + + if (colCount) { + const frozenLeafNodes = getNodesByRange( + nodes, + 'colIndex', + 0, + colCount - 1, + )!; + + frozenLeafNodes.forEach((leafNode) => { + const newLeafNode = leafNode.clone(); + + newLeafNode.isFrozenHead = true; + extraNodes.push(newLeafNode); + }); + } + + if (trailingColCount) { + const total = nodes.length; + const frozenLeafNodes = getNodesByRange( + nodes, + 'colIndex', + total - trailingColCount, + total - 1, + )!; + + frozenLeafNodes.forEach((leafNode) => { + const newLeafNode = leafNode.clone(); + + newLeafNode.isFrozenTrailing = true; + extraNodes.push(newLeafNode); + }); + } + + return extraNodes; +} + +export function getExtraFrozenRowAxisNodes(facet: FrozenFacet, nodes: Node[]) { + const extraNodes: Node[] = []; + + const { start, end } = facet.getCellRange(); + const { rowCount, trailingRowCount } = facet.getFrozenOptions(); + + if (rowCount) { + const frozenLeafNodes = getNodesByRange( + nodes, + 'rowIndex', + start, + start + rowCount - 1, + )!; + + frozenLeafNodes.forEach((leafNode) => { + const newLeafNode = leafNode.clone(); + + newLeafNode.isFrozenHead = true; + extraNodes.push(newLeafNode); + }); + } + + if (trailingRowCount) { + const frozenLeafNodes = getNodesByRange( + nodes, + 'rowIndex', + end - trailingRowCount + 1, + end, + )!; + + frozenLeafNodes.forEach((leafNode) => { + const newLeafNode = leafNode.clone(); + + newLeafNode.isFrozenTrailing = true; + extraNodes.push(newLeafNode); + }); + } + + return extraNodes; +} diff --git a/packages/s2-core/src/extends/pivot-chart/utils/handle-interaction.ts b/packages/s2-core/src/extends/pivot-chart/utils/handle-interaction.ts new file mode 100644 index 0000000000..07bd873b8f --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/utils/handle-interaction.ts @@ -0,0 +1,55 @@ +import { InteractionStateName, type ViewMeta } from '../../../common'; +import type { SpreadSheet } from '../../../sheet-type'; +import { updateAllHeaderCellState } from '../../../utils'; +import type { PivotChartFacet } from '../facet/pivot-chart-facet'; + +function updateDataCellRelevantAxisRowCells( + stateName: InteractionStateName, + meta: ViewMeta, + spreadsheet: SpreadSheet, +) { + const { rowId } = meta; + const { facet, interaction } = spreadsheet; + const { rowHeader } = + stateName === InteractionStateName.HOVER + ? interaction.getHoverHighlight() + : interaction.getSelectedCellHighlight(); + + if (rowHeader && rowId) { + updateAllHeaderCellState( + rowId, + (facet as PivotChartFacet).getAxisRowCells(), + stateName, + ); + } +} + +function updateDataCellRelevantAxisColCells( + stateName: InteractionStateName, + meta: ViewMeta, + spreadsheet: SpreadSheet, +) { + const { colId } = meta; + const { facet, interaction } = spreadsheet; + const { colHeader } = + stateName === InteractionStateName.HOVER + ? interaction.getHoverHighlight() + : interaction.getSelectedCellHighlight(); + + if (colHeader && colId) { + updateAllHeaderCellState( + colId, + (facet as PivotChartFacet).getAxisColCells(), + stateName, + ); + } +} + +export function updateDataCellRelevantHeaderCells( + stateName: InteractionStateName, + meta: ViewMeta, + spreadsheet: SpreadSheet, +) { + updateDataCellRelevantAxisRowCells(stateName, meta, spreadsheet); + updateDataCellRelevantAxisColCells(stateName, meta, spreadsheet); +} diff --git a/packages/s2-core/src/extends/pivot-chart/utils/separate-axis.ts b/packages/s2-core/src/extends/pivot-chart/utils/separate-axis.ts new file mode 100644 index 0000000000..d9c4c69974 --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/utils/separate-axis.ts @@ -0,0 +1,393 @@ +import type { Pick } from '@antv/g2/lib/data'; +import { + EXTRA_FIELD, + Hierarchy, + Node, + ROOT_NODE_ID, + SpreadSheet, + generateId, + type LayoutResult, + type NodeProperties, + type Query, +} from '@antv/s2'; +import { + forEach, + head, + includes, + initial, + isEmpty, + last, + merge, + reduce, + uniq, +} from 'lodash'; +import { PLACEHOLDER_FIELD } from '../constant'; + +export function getAxisLeafNodes(hierarchy: Hierarchy) { + const axisLeafNodes = hierarchy.getLeaves().reduce((acc, leaf) => { + const parent = leaf.parent; + + if (parent) { + acc.push(parent); + } + + return acc; + }, [] as Node[]); + + return uniq(axisLeafNodes); +} + +type Index = 'rowIndex' | 'colIndex'; + +/** + * 需要考虑的场景: + * 1. 数值置于行头、列头 + * 2. 单指标、多指标 + * 3. 总计、小计分组 + */ + +function getMeasureValue(query: Query = {}, s2: SpreadSheet) { + return query[EXTRA_FIELD] ?? s2.dataSet.fields.values?.[0]; +} + +function createHierarchy() { + const axisHierarchy = new Hierarchy(); + + axisHierarchy.maxLevel = 0; + + return axisHierarchy; +} + +function pushAxisIndexNode( + axisHierarchy: Hierarchy, + axisNode: Node, + key: Index, +) { + axisNode.isLeaf = true; + + axisHierarchy.pushNode(axisNode); + axisHierarchy.pushIndexNode(axisNode); + axisNode[key] = axisHierarchy.getIndexNodes().length - 1; + + if (!axisNode.isTotals && isEmpty(axisHierarchy.sampleNodesForAllLevels)) { + axisHierarchy.sampleNodesForAllLevels.push(axisNode); + axisHierarchy.sampleNodeForLastLevel = axisNode; + } +} + +function pushIndexNode(hierarchy: Hierarchy, node: Node, key: Index) { + node.isLeaf = true; + node.children = []; + + hierarchy.pushIndexNode(node); + node[key] = hierarchy.getIndexNodes().length - 1; +} + +function shrinkHierarchy(hierarchy: Hierarchy) { + hierarchy.maxLevel--; + hierarchy.sampleNodesForAllLevels = initial( + hierarchy.sampleNodesForAllLevels, + ); + + hierarchy.sampleNodeForLastLevel = + last(hierarchy.sampleNodesForAllLevels) ?? null; +} + +function convertToMeasurePlaceholderHierarchy( + hierarchy: Hierarchy, + s2: SpreadSheet, +) { + const placeholderNode = new Node({ + id: generateId(ROOT_NODE_ID, PLACEHOLDER_FIELD), + field: PLACEHOLDER_FIELD, + value: s2.dataSet.getFieldName(hierarchy.sampleNodeForLastLevel!.field), + level: 0, + isLeaf: false, + parent: hierarchy.rootNode, + children: hierarchy.rootNode.children, + }); + + hierarchy.rootNode.children.forEach((child) => { + child.parent = placeholderNode; + child.level++; + }); + + hierarchy.rootNode.children = [placeholderNode]; + + hierarchy.pushNode(placeholderNode); + + hierarchy.sampleNodesForAllLevels = [placeholderNode]; + hierarchy.sampleNodeForLastLevel = placeholderNode; +} + +function separateMeasureNodes( + hierarchy: Hierarchy, + key: Index, + s2: SpreadSheet, +) { + const axisHierarchy = createHierarchy(); + + forEach(hierarchy.getLeaves(), (leaf: Node) => { + const axisNode = leaf.clone(); + + leaf.relatedNode = axisNode; + + leaf.hideColCellHorizontalResize = true; + leaf.hideRowCellVerticalResize = true; + + if (axisNode.field !== EXTRA_FIELD) { + // 总计、小计单指标时不展示 + axisNode.field = EXTRA_FIELD; + axisNode.value = getMeasureValue(axisNode.query, s2); + } + + axisNode.children = [axisNode]; + + pushAxisIndexNode(axisHierarchy, axisNode, key); + }); + + if (hierarchy.maxLevel === 0) { + convertToMeasurePlaceholderHierarchy(hierarchy, s2); + } else { + shrinkHierarchy(hierarchy); + } + + return { + axisHierarchy, + hierarchy, + }; +} + +function separateRowMeasureNodes( + rowsHierarchy: Hierarchy, + s2: SpreadSheet, +): Pick { + const { axisHierarchy, hierarchy } = separateMeasureNodes( + rowsHierarchy, + 'rowIndex', + s2, + ); + + return { + rowsHierarchy: hierarchy, + axisRowsHierarchy: axisHierarchy, + }; +} + +function separateColMeasureNodes( + colsHierarchy: Hierarchy, + s2: SpreadSheet, +): Pick { + const { axisHierarchy, hierarchy } = separateMeasureNodes( + colsHierarchy, + 'colIndex', + s2, + ); + + return { + colsHierarchy: hierarchy, + axisColsHierarchy: axisHierarchy, + }; +} + +function createDimensionPlaceholderHierarchy(nodeProperties: NodeProperties) { + const hierarchy = createHierarchy(); + + hierarchy.isPlaceholder = true; + + const placeholderNode = new Node({ + id: generateId(ROOT_NODE_ID, PLACEHOLDER_FIELD), + field: PLACEHOLDER_FIELD, + level: 0, + isLeaf: true, + rowIndex: 0, + colIndex: 0, + parent: hierarchy.rootNode, + ...nodeProperties, + }); + + hierarchy.rootNode.children = [placeholderNode]; + hierarchy.pushNode(placeholderNode); + hierarchy.pushIndexNode(placeholderNode); + + hierarchy.sampleNodesForAllLevels = [placeholderNode]; + hierarchy.sampleNodeForLastLevel = placeholderNode; + + return hierarchy; +} + +function separateDimensionNodes( + hierarchy: Hierarchy, + key: Index, + s2: SpreadSheet, +) { + const axisHierarchy = createHierarchy(); + + const sampleNodeForLastLevel = hierarchy.sampleNodeForLastLevel!; + + // 只有一个维度层级时,会被全部收敛到坐标轴中 + // 再给一个Node用于占位 + if (hierarchy.maxLevel === 0) { + const root = hierarchy.rootNode.clone(); + + root.id = generateId(ROOT_NODE_ID, PLACEHOLDER_FIELD); + root.field = sampleNodeForLastLevel.field; + pushAxisIndexNode(axisHierarchy, root, key); + + const value = s2.dataSet.getFieldName(sampleNodeForLastLevel.field); + + hierarchy = createDimensionPlaceholderHierarchy( + merge( + { + value, + relatedNode: root, + }, + key === 'rowIndex' && { field: sampleNodeForLastLevel.field }, + ), + ); + + return { + hierarchy, + axisHierarchy, + }; + } + + const leafNodeParentMapping = reduce( + hierarchy.getLeaves(), + (acc, leaf) => { + const parent = leaf.parent; + + if (!parent) { + return acc; + } + + if (!acc.get(parent)) { + acc.set(parent, []); + } + + const exist = acc.get(parent)!; + + exist.push(leaf); + + return acc; + }, + new Map(), + ); + + hierarchy.indexNode = []; + leafNodeParentMapping.forEach((children, parent) => { + let axisNode; + + // 总计、小计跨多行展示时,会出现不一致的情况下,只需要将 leaf 节点复制一份,无需剔除 + if (parent.children.length !== children.length) { + children.forEach((leaf) => { + axisNode = leaf.clone(); + axisNode.children = [axisNode]; + leaf.relatedNode = axisNode; + pushIndexNode(hierarchy, leaf, key); + }); + } else { + axisNode = parent.clone(); + + parent.relatedNode = axisNode; + pushIndexNode(hierarchy, parent, key); + axisNode.field = head(children)!.field; + + hierarchy.allNodesWithoutRoot = hierarchy.allNodesWithoutRoot.filter( + (node) => !includes(children, node), + ); + } + + if (axisNode) { + pushAxisIndexNode(axisHierarchy, axisNode, key); + } + }); + + shrinkHierarchy(hierarchy); + + return { + axisHierarchy, + hierarchy, + }; +} + +function separateRowDimensionNodes( + rowsHierarchy: Hierarchy, + s2: SpreadSheet, +): Pick { + const { axisHierarchy, hierarchy } = separateDimensionNodes( + rowsHierarchy, + 'rowIndex', + s2, + ); + + return { + axisRowsHierarchy: axisHierarchy, + rowsHierarchy: hierarchy, + }; +} + +function separateColDimensionNodes( + colsHierarchy: Hierarchy, + s2: SpreadSheet, +): Pick { + const { axisHierarchy, hierarchy } = separateDimensionNodes( + colsHierarchy, + 'colIndex', + s2, + ); + + return { + axisColsHierarchy: axisHierarchy, + colsHierarchy: hierarchy, + }; +} + +function separateRowNodesToAxis(hierarchy: Hierarchy, s2: SpreadSheet) { + if (hierarchy.maxLevel === -1) { + return null; + } + + const isValueInCols = s2.isValueInCols?.(); + + const { rowsHierarchy, axisRowsHierarchy } = isValueInCols + ? separateRowDimensionNodes(hierarchy, s2) + : separateRowMeasureNodes(hierarchy, s2); + + return { + rowsHierarchy, + rowLeafNodes: rowsHierarchy.getLeaves(), + axisRowsHierarchy, + }; +} + +function separateColNodesToAxis(hierarchy: Hierarchy, s2: SpreadSheet) { + if (hierarchy.maxLevel === -1) { + return null; + } + + const isValueInCols = s2.isValueInCols?.(); + + const { colsHierarchy, axisColsHierarchy } = isValueInCols + ? separateColMeasureNodes(hierarchy, s2) + : separateColDimensionNodes(hierarchy, s2); + + return { + colsHierarchy, + colLeafNodes: colsHierarchy.getLeaves(), + axisColsHierarchy, + }; +} + +export function separateRowColLeafNodes( + layoutResult: LayoutResult, + s2: SpreadSheet, +): LayoutResult { + const { rowsHierarchy, colsHierarchy } = layoutResult; + + return { + ...layoutResult, + ...separateRowNodesToAxis(rowsHierarchy, s2), + ...separateColNodesToAxis(colsHierarchy, s2), + }; +} diff --git a/packages/s2-core/src/extends/pivot-chart/utils/theme.ts b/packages/s2-core/src/extends/pivot-chart/utils/theme.ts new file mode 100644 index 0000000000..1dc4c1aa60 --- /dev/null +++ b/packages/s2-core/src/extends/pivot-chart/utils/theme.ts @@ -0,0 +1,25 @@ +import { + SpreadSheet, + getColCellTheme, + getCornerCellTheme, + getRowCellTheme, + type S2Theme, + type SimplePalette, +} from '@antv/s2'; +import { merge } from 'lodash'; +import { AxisCellType } from '../cell/cell-type'; + +export const getCustomTheme = ( + palette: SimplePalette, + spreadsheet?: SpreadSheet, +): S2Theme => { + return { + [AxisCellType.AXIS_CORNER_CELL]: getCornerCellTheme(palette), + [AxisCellType.AXIS_ROW_CELL]: getRowCellTheme(palette, spreadsheet), + [AxisCellType.AXIS_COL_CELL]: merge(getColCellTheme(palette), { + measureText: { + textAlign: 'center', + }, + }), + }; +}; diff --git a/packages/s2-core/src/facet/base-facet.ts b/packages/s2-core/src/facet/base-facet.ts index f9724e45db..b48ae22f58 100644 --- a/packages/s2-core/src/facet/base-facet.ts +++ b/packages/s2-core/src/facet/base-facet.ts @@ -15,12 +15,15 @@ import { filter, find, get, + includes, + isArray, isEmpty, isFunction, isNil, isNumber, isUndefined, last, + max, maxBy, reduce, size, @@ -65,18 +68,20 @@ import { DEBUG_VIEW_RENDER, DebuggerUtil, } from '../common/debug'; -import type { - AdjustLeafNodesParams, - CellCallbackParams, - CellCustomSize, - FrameConfig, - GridInfo, - HiddenColumnsInfo, - LayoutResult, - S2CellType, - ScrollChangeParams, - ScrollOffsetConfig, - ViewMeta, +import { + CornerNodeType, + type AdjustLeafNodesParams, + type CellCallbackParams, + type CellCustomSize, + type FrameConfig, + type GridInfo, + type HiddenColumnsInfo, + type LayoutResult, + type S2CellType, + type ScrollChangeParams, + type ScrollOffsetConfig, + type SimpleData, + type ViewMeta, } from '../common/interface'; import type { CellScrollOffset, @@ -86,6 +91,7 @@ import type { import { PanelScrollGroup } from '../group/panel-scroll-group'; import type { SpreadSheet } from '../sheet-type'; import { ScrollBar, ScrollType } from '../ui/scrollbar'; +import type { SelectedIds } from '../utils'; import { getAdjustedRowScrollX, getAdjustedScrollOffset } from '../utils/facet'; import { getAllChildCells } from '../utils/get-all-child-cells'; import { getColsForGrid, getRowsForGrid } from '../utils/grid'; @@ -170,10 +176,20 @@ export abstract class BaseFacet { protected textWrapNodeHeightCache: Map; + protected textWrapTempCornerCell: CornerCell | null; + protected textWrapTempRowCell: RowCell | DataCell; protected textWrapTempColCell: ColCell | TableColCell; + public customRowHeightStatusMap: Record; + + protected abstract getCornerCellInstance( + node: Node, + spreadsheet: SpreadSheet, + config: Partial, + ): CornerCell | null; + protected abstract getRowCellInstance( node: Node | ViewMeta, spreadsheet: SpreadSheet, @@ -232,6 +248,10 @@ export abstract class BaseFacet { this.init(); } + protected shouldRender() { + return !areAllFieldsEmpty(this.spreadsheet.dataCfg.fields); + } + public getLayoutResult = (): LayoutResult => { return { ...this.layoutResult, @@ -250,7 +270,9 @@ export abstract class BaseFacet { this.textWrapTempRowCell = this.getRowCellInstance(...args); this.textWrapTempColCell = this.getColCellInstance(...args); + this.textWrapTempCornerCell = this.getCornerCellInstance?.(...args); this.textWrapNodeHeightCache = new Map(); + this.customRowHeightStatusMap = {}; } protected initGroups() { @@ -259,7 +281,7 @@ export abstract class BaseFacet { this.initForegroundGroup(); } - private initForegroundGroup() { + protected initForegroundGroup() { this.foregroundGroup = this.spreadsheet.container.appendChild( new Group({ name: KEY_GROUP_FORE_GROUND, @@ -268,7 +290,7 @@ export abstract class BaseFacet { ); } - private initBackgroundGroup() { + protected initBackgroundGroup() { this.backgroundGroup = this.spreadsheet.container.appendChild( new Group({ name: KEY_GROUP_BACK_GROUND, @@ -292,8 +314,8 @@ export abstract class BaseFacet { this.panelGroup.appendChild(this.panelScrollGroup); } - protected getCellCustomSize(node: Node | null, size: CellCustomSize) { - return isFunction(size) ? size?.(node) : size; + public getCellCustomSize(node: Node | null, customSize: CellCustomSize) { + return isFunction(customSize) ? customSize(node) : customSize; } protected getRowCellDraggedWidth(node: Node): number | undefined { @@ -362,39 +384,86 @@ export abstract class BaseFacet { ); } - protected getColNodeHeight( - colNode: Node, - colsHierarchy: Hierarchy, - useCache: boolean = true, - ) { + protected getColNodeHeight(options: { + colNode: Node; + colsHierarchy: Hierarchy; + useCache?: boolean; + cornerNodes?: Node[]; + }) { + const { + colNode, + colsHierarchy, + useCache = true, + cornerNodes = [], + } = options; + if (!colNode) { return 0; } - const { colCell: colCellStyle } = this.spreadsheet.options.style!; + const { colCell: colCellStyle, cornerCell: cornerCellStyle } = + this.spreadsheet.options.style!; // 优先级: 列头拖拽 > 列头自定义高度 > 多行文本自适应高度 > 通用单元格高度 const height = this.getColCellDraggedHeight(colNode) ?? this.getCellCustomSize(colNode, colCellStyle?.height); if (isNumber(height) && height !== DEFAULT_STYLE.colCell?.height) { + // 标记为自定义高度, 方便计算文本 maxLines + colNode.extra.isCustomHeight = true; + return height; } - const isEnableHeightAdaptive = + const isEnableColNodeHeightAdaptive = colCellStyle?.maxLines! > 1 && colCellStyle?.wordWrap; + const isEnableCornerNodeHeightAdaptive = + cornerCellStyle?.maxLines! > 1 && cornerCellStyle?.wordWrap; const defaultHeight = this.getDefaultColNodeHeight(colNode, colsHierarchy); - if (!isEnableHeightAdaptive) { - return defaultHeight; + let colAdaptiveHeight = defaultHeight; + let cornerAdaptiveHeight = defaultHeight; + + // 1. 列头开启自动换行, 计算列头自适应高度 + if (isEnableColNodeHeightAdaptive) { + colAdaptiveHeight = this.getNodeAdaptiveHeight({ + meta: colNode, + cell: this.textWrapTempColCell, + defaultHeight, + useCache, + }); } - return this.getNodeAdaptiveHeight( - colNode, - this.textWrapTempColCell, - defaultHeight, - useCache, - ); + /** + * 2. 角头开启自动换行, 列头的高度除了自身以外, 还需要考虑当前整行对应的角头 + * 存在角头/列头同时换行, 只有角头换行, 只有列头换行等多种场景 + */ + if (isEnableCornerNodeHeightAdaptive) { + const currentCornerNodes = cornerNodes.filter((node) => { + // 兼容数值置于行/列的不同场景 + if (colNode.isLeaf) { + return node.cornerType === CornerNodeType.Row; + } + + return node.field === colNode.field; + }); + + if (!isEmpty(currentCornerNodes)) { + cornerAdaptiveHeight = max( + currentCornerNodes.map((cornerNode) => + this.getNodeAdaptiveHeight({ + meta: cornerNode, + cell: this.textWrapTempCornerCell!, + defaultHeight, + useCache: false, + }), + ), + ); + } + } + + // 两者要取最大, 保证高度自动撑高的合理性 + return Math.max(cornerAdaptiveHeight, colAdaptiveHeight, defaultHeight); } protected getDefaultColNodeHeight( @@ -422,13 +491,15 @@ export abstract class BaseFacet { return Math.max(defaultHeight, sampleMaxHeight); } - protected getNodeAdaptiveHeight( - meta: Node | ViewMeta, - cell: S2CellType, - defaultHeight: number = 0, - useCache = true, - ) { - if (!meta) { + protected getNodeAdaptiveHeight(options: { + meta: Node | ViewMeta; + cell: S2CellType; + defaultHeight?: number; + useCache?: boolean; + }) { + const { meta, cell, defaultHeight = 0, useCache = true } = options; + + if (!meta || !cell) { return defaultHeight; } @@ -455,6 +526,7 @@ export abstract class BaseFacet { const { padding } = cell.getStyle().cell; const textHeight = cell.getActualTextHeight(); const adaptiveHeight = textHeight + padding.top + padding.bottom; + const height = cell.isMultiLineText() && textHeight >= defaultHeight ? adaptiveHeight @@ -468,7 +540,10 @@ export abstract class BaseFacet { /** * 将每一层级的采样节点更新为高度最大的节点 (未隐藏, 非汇总节点) */ - protected updateColsHierarchySampleMaxHeightNodes(colsHierarchy: Hierarchy) { + protected updateColsHierarchySampleMaxHeightNodes( + colsHierarchy: Hierarchy, + rowsHierarchy?: Hierarchy, + ) { const sampleMaxHeightNodesForAllLevels = colsHierarchy.sampleNodesForAllLevels.map((sampleNode) => { const maxHeightNode = maxBy( @@ -476,7 +551,10 @@ export abstract class BaseFacet { .getNodes(sampleNode.level) .filter((node) => !node.isTotals), (levelSampleNode) => { - return this.getColNodeHeight(levelSampleNode, colsHierarchy); + return this.getColNodeHeight({ + colNode: levelSampleNode, + colsHierarchy, + }); }, )!; @@ -487,11 +565,27 @@ export abstract class BaseFacet { sampleMaxHeightNodesForAllLevels, ); + const cornerNodes = rowsHierarchy + ? CornerHeader.getCornerNodes({ + position: { x: 0, y: 0 }, + width: rowsHierarchy.width, + height: colsHierarchy.height, + layoutResult: { + rowsHierarchy, + colsHierarchy, + } as LayoutResult, + seriesNumberWidth: this.getSeriesNumberWidth(), + spreadsheet: this.spreadsheet, + }) + : []; + colsHierarchy.sampleNodesForAllLevels.forEach((levelSampleNode) => { - levelSampleNode.height = this.getColNodeHeight( - levelSampleNode, + levelSampleNode.height = this.getColNodeHeight({ + colNode: levelSampleNode, colsHierarchy, - ); + cornerNodes, + }); + if (levelSampleNode.level === 0) { levelSampleNode.y = 0; } else { @@ -507,6 +601,7 @@ export abstract class BaseFacet { colsHierarchy.height += levelSampleNode.height; }); + colsHierarchy.rootNode.height = colsHierarchy.height; } hideScrollBar = () => { @@ -603,11 +698,8 @@ export abstract class BaseFacet { this.emitPaginationEvent(); }; - /** - * Start render, call from outside - */ public render() { - if (areAllFieldsEmpty(this.spreadsheet.dataCfg.fields)) { + if (!this.shouldRender()) { return; } @@ -699,12 +791,13 @@ export abstract class BaseFacet { this.unbindEvents(); this.clearAllGroup(); this.preCellIndexes = null; + this.customRowHeightStatusMap = {}; this.textWrapNodeHeightCache.clear(); cancelAnimationFrame(this.scrollFrameId!); } public setScrollOffset = (scrollOffset: ScrollOffset) => { - Object.keys(scrollOffset).forEach((key) => { + Object.keys(scrollOffset || {}).forEach((key) => { const offset = get(scrollOffset, key); if (!isUndefined(offset)) { @@ -757,7 +850,7 @@ export abstract class BaseFacet { } }; - private unbindEvents = () => { + protected unbindEvents = () => { const canvas = this.spreadsheet.getCanvasElement(); canvas?.removeEventListener('wheel', this.onWheel); @@ -794,9 +887,9 @@ export abstract class BaseFacet { this.cornerBBox = new CornerBBox(this, true); } - protected calculatePanelBBox = () => { + protected calculatePanelBBox() { this.panelBBox = new PanelBBox(this, true); - }; + } getRealWidth = (): number => last(this.viewCellWidths) || 0; @@ -922,7 +1015,7 @@ export abstract class BaseFacet { this.dynamicRenderCell(skipScrollEvent); }; - private getRendererHeight = () => { + protected getRendererHeight = () => { const { start, end } = this.getCellRange(); return ( @@ -931,7 +1024,7 @@ export abstract class BaseFacet { ); }; - private getAdjustedScrollOffset = ({ + protected getAdjustedScrollOffset = ({ scrollX, scrollY, rowHeaderScrollX, @@ -954,7 +1047,7 @@ export abstract class BaseFacet { }; }; - private renderRowScrollBar = (rowHeaderScrollX: number) => { + protected renderRowScrollBar(rowHeaderScrollX: number) { if ( this.spreadsheet.isFrozenRowHeader() && this.cornerBBox.width < this.cornerBBox.originalWidth @@ -1026,12 +1119,13 @@ export abstract class BaseFacet { ); this.foregroundGroup.appendChild(this.hRowScrollBar); } - }; + } - getValidScrollBarOffset = (offset: number, maxOffset: number) => - clamp(offset, 0, maxOffset); + getValidScrollBarOffset(offset: number, maxOffset: number) { + return clamp(offset, 0, maxOffset); + } - renderHScrollBar = (width: number, realWidth: number, scrollX: number) => { + renderHScrollBar(width: number, realWidth: number, scrollX: number) { if (floor(width) < floor(realWidth)) { const halfScrollSize = this.scrollBarSize / 2; const { maxY } = this.getScrollbarPosition(); @@ -1090,7 +1184,7 @@ export abstract class BaseFacet { this.foregroundGroup.appendChild(this.hScrollBar); } - }; + } protected getScrollbarPosition() { const { maxX, maxY } = this.panelBBox; @@ -1105,7 +1199,7 @@ export abstract class BaseFacet { }; } - renderVScrollBar = (height: number, realHeight: number, scrollY: number) => { + renderVScrollBar(height: number, realHeight: number, scrollY: number) { if (height < realHeight) { const { scrollBar } = this.spreadsheet.theme; const thumbLen = Math.max( @@ -1147,7 +1241,7 @@ export abstract class BaseFacet { this.foregroundGroup.appendChild(this.vScrollBar); } - }; + } // (滑动 offset / 最大 offset(滚动对象真正长度 - 轨道长)) = (滑块 offset / 最大滑动距离(轨道长 - 滑块长)) getScrollBarOffset = (offset: number, scrollbar: ScrollBar) => { @@ -1309,7 +1403,7 @@ export abstract class BaseFacet { * 2. none => 临近滚动区域不受到滚动链影响,而且默认的滚动到边界的表现也被阻止 * 所以只要不为 `auto`, 或者表格内, 都需要阻止外部容器滚动 */ - private stopScrollChainingIfNeeded = (event: WheelEvent) => { + protected stopScrollChainingIfNeeded = (event: WheelEvent) => { const { interaction } = this.spreadsheet.options; if (interaction?.overscrollBehavior !== 'auto') { @@ -1318,7 +1412,7 @@ export abstract class BaseFacet { } }; - private stopScrollChaining = (event: WheelEvent) => { + protected stopScrollChaining = (event: WheelEvent) => { if (event?.cancelable) { event?.preventDefault?.(); } @@ -1816,7 +1910,7 @@ export abstract class BaseFacet { this.onAfterScroll(); } - private emitScrollEvent(position: CellScrollPosition) { + protected emitScrollEvent(position: CellScrollPosition) { this.spreadsheet.emit(S2Event.GLOBAL_SCROLL, position); } @@ -2260,6 +2354,31 @@ export abstract class BaseFacet { ); } + protected filterCells( + cells: S2CellType[], + filterIds?: string[] | SelectedIds, + ) { + if (isEmpty(filterIds)) { + return cells; + } + + if (isArray(filterIds)) { + return cells.filter((cell) => { + return includes(filterIds, cell.getMeta().id); + }); + } + + return cells.filter((cell) => { + const ids = filterIds[cell.cellType]; + + if (!ids) { + return false; + } + + return ids.includes(cell.getMeta().id); + }); + } + /** * 获取序号单元格 (不含可视区域) */ @@ -2272,7 +2391,9 @@ export abstract class BaseFacet { * @example 获取全部: facet.getHeaderCells() * @example 获取一组 facet.getHeaderCells(['root[&]浙江省[&]宁波市', 'root[&]浙江省[&]杭州市']) */ - public getHeaderCells(cellIds?: string[]): S2CellType[] { + public getHeaderCells( + cellIds?: string[] | SelectedIds, + ): S2CellType[] { const headerCells = concat( this.getCornerCells(), this.getSeriesNumberCells(), @@ -2280,11 +2401,7 @@ export abstract class BaseFacet { this.getColCells(), ); - if (!cellIds) { - return headerCells; - } - - return headerCells.filter((cell) => cellIds.includes(cell.getMeta().id)); + return this.filterCells(headerCells, cellIds); } /** @@ -2328,4 +2445,29 @@ export abstract class BaseFacet { public clearInitColLeafNodes() { this.spreadsheet.store.set('initColLeafNodes', undefined); } + + /** + * @tip 和 this.spreadsheet.measureTextWidth() 的区别在于: + * 1. 额外添加一像素余量,防止 maxLabel 有多个同样长度情况下,一些 label 不能展示完全, 出现省略号 + * 2. 测量时, 文本宽度取整, 避免子像素的不一致性 + * 3. TODO: 由于 G 测量文本是一个一个字符进行计算, 在数字/英文等场景会有较大误差, 这里为了防止紧凑模式出现省略号, 暂时保持一样的策略 + */ + protected measureTextWidth( + text: SimpleData, + font: unknown, + roughly = true, + ): number { + const EXTRA_PIXEL = 1; + + if (roughly) { + return ( + Math.ceil(this.spreadsheet.measureTextWidthRoughly(text, font)) + + EXTRA_PIXEL + ); + } + + return ( + Math.ceil(this.spreadsheet.measureTextWidth(text, font)) + EXTRA_PIXEL + ); + } } diff --git a/packages/s2-core/src/facet/bbox/corner-bbox.ts b/packages/s2-core/src/facet/bbox/corner-bbox.ts index 6aebf3f4b8..57c1574c63 100644 --- a/packages/s2-core/src/facet/bbox/corner-bbox.ts +++ b/packages/s2-core/src/facet/bbox/corner-bbox.ts @@ -5,8 +5,8 @@ import { BaseBBox } from './base-bbox'; export class CornerBBox extends BaseBBox { calculateBBox() { - const width = this.getCornerBBoxWidth(); - const height = this.getCornerBBoxHeight(); + const width = this.getWidth(); + const height = this.getHeight(); this.width = width; this.height = height; @@ -14,7 +14,7 @@ export class CornerBBox extends BaseBBox { this.maxY = height; } - private getCornerBBoxOriginalHeight() { + protected calculateOriginalHeight() { const { colsHierarchy } = this.layoutResult; const { colCell } = this.spreadsheet.options.style!; @@ -24,34 +24,38 @@ export class CornerBBox extends BaseBBox { * 2. 配置了 rows, values, 此时存在一级列头 (即 EXTRA_FIELD 数值节点), 但是隐藏了数值 (hideMeasureColumn), 此时列头为空 */ if (!colsHierarchy.sampleNodeForLastLevel) { - return colCell?.height; + this.originalHeight = + this.facet.getCellCustomSize(null, colCell?.height) ?? 0; + } else { + this.originalHeight = floor(colsHierarchy.height); } - - return floor(colsHierarchy.height); - } - - private getCornerBBoxHeight() { - this.originalHeight = this.getCornerBBoxOriginalHeight() as number; - - return this.originalHeight; } - private getCornerBBoxWidth() { + protected calculateOriginWidth() { const { rowsHierarchy } = this.layoutResult; this.originalWidth = floor( rowsHierarchy.width + this.facet.getSeriesNumberWidth(), ); + } + + protected getHeight() { + this.calculateOriginalHeight(); + + return this.originalHeight; + } + protected getWidth() { + this.calculateOriginWidth(); // 在行头固定时,需对角头 BBox 进行裁剪 if (this.spreadsheet.isFrozenRowHeader()) { - return this.adjustCornerBBoxWidth(); + return this.adjustWidth(); } return this.originalWidth; } - private adjustCornerBBoxWidth() { + protected adjustWidth() { const { colsHierarchy } = this.layoutResult; const { width: canvasWidth, frozen } = this.spreadsheet.options; @@ -62,7 +66,7 @@ export class CornerBBox extends BaseBBox { const maxCornerBBoxWidth = canvasWidth! * ratio; const colsHierarchyWidth = colsHierarchy?.width; - const panelWidthWidthUnClippedCorner = canvasWidth! - this.originalWidth; + const panelWidthWithoutUnClippedCorner = canvasWidth! - this.originalWidth; /* * 不需要裁剪条件: @@ -71,7 +75,7 @@ export class CornerBBox extends BaseBBox { */ if ( this.originalWidth <= maxCornerBBoxWidth || - colsHierarchyWidth <= panelWidthWidthUnClippedCorner + colsHierarchyWidth <= panelWidthWithoutUnClippedCorner ) { return this.originalWidth; } @@ -83,7 +87,7 @@ export class CornerBBox extends BaseBBox { if (colsHierarchyWidth <= maxPanelWidth) { clippedWidth = this.originalWidth - - (colsHierarchyWidth - panelWidthWidthUnClippedCorner); + (colsHierarchyWidth - panelWidthWithoutUnClippedCorner); } else { clippedWidth = maxCornerBBoxWidth; } diff --git a/packages/s2-core/src/facet/bbox/panel-bbox.ts b/packages/s2-core/src/facet/bbox/panel-bbox.ts index 2a29c56c75..a4a72be5e9 100644 --- a/packages/s2-core/src/facet/bbox/panel-bbox.ts +++ b/packages/s2-core/src/facet/bbox/panel-bbox.ts @@ -4,8 +4,8 @@ import { BaseBBox } from './base-bbox'; export class PanelBBox extends BaseBBox { calculateBBox() { - this.originalWidth = this.facet.getRealWidth(); - this.originalHeight = this.facet.getRealHeight(); + this.calculateOriginWidth(); + this.calculateOriginalHeight(); const { cornerBBox } = this.facet; const cornerPosition = { @@ -17,26 +17,41 @@ export class PanelBBox extends BaseBBox { this.x = cornerPosition.x + Frame.getVerticalBorderWidth(this.spreadsheet); this.y = cornerPosition.y + Frame.getHorizontalBorderWidth(this.spreadsheet); - this.minX = this.x; this.minY = this.y; - const scrollBarSize = this.spreadsheet.theme.scrollBar!.size; - const { width: canvasWidth, height: canvasHeight } = - this.spreadsheet.options; - - const panelWidth = Math.max(0, canvasWidth! - this.x); - const panelHeight = Math.max(0, canvasHeight! - this.y - scrollBarSize!); - - this.width = panelWidth; - this.height = panelHeight; + this.width = this.getPanelWidth(); + this.height = this.getPanelHeight(); this.viewportHeight = Math.abs( - floor(Math.min(panelHeight, this.originalHeight)), + floor(Math.min(this.height, this.originalHeight)), ); this.viewportWidth = Math.abs( - floor(Math.min(panelWidth, this.originalWidth)), + floor(Math.min(this.width, this.originalWidth)), ); this.maxX = this.x + this.viewportWidth; this.maxY = this.y + this.viewportHeight; } + + protected calculateOriginalHeight() { + this.originalHeight = this.facet.getRealHeight(); + } + + protected calculateOriginWidth() { + this.originalWidth = this.facet.getRealWidth(); + } + + protected getPanelWidth() { + const { width: canvasWidth } = this.spreadsheet.options; + const panelWidth = Math.max(0, canvasWidth! - this.x); + + return panelWidth; + } + + protected getPanelHeight() { + const scrollBarSize = this.spreadsheet.theme.scrollBar!.size; + const { height: canvasHeight } = this.spreadsheet.options; + const panelHeight = Math.max(0, canvasHeight! - this.y - scrollBarSize!); + + return panelHeight; + } } diff --git a/packages/s2-core/src/facet/frozen-facet.ts b/packages/s2-core/src/facet/frozen-facet.ts index 720a983589..2f4409c752 100644 --- a/packages/s2-core/src/facet/frozen-facet.ts +++ b/packages/s2-core/src/facet/frozen-facet.ts @@ -1,7 +1,7 @@ import { Group, Rect, type LineStyleProps } from '@antv/g'; import { last } from 'lodash'; import type { DataCell } from '../cell'; -import type { S2BaseFrozenOptions } from '../common'; +import type { S2BaseFrozenOptions, SplitLine } from '../common'; import { FRONT_GROUND_GROUP_FROZEN_Z_INDEX, FrozenGroupArea, @@ -18,7 +18,11 @@ import type { } from '../common/interface/frozen'; import type { SimpleBBox } from '../engine'; import { FrozenGroup } from '../group/frozen-group'; -import { getValidFrozenOptions, renderLine } from '../utils'; +import { + getValidFrozenOptions, + renderLine, + waitForCellMounted, +} from '../utils'; import { getColsForGrid, getFrozenRowsForGrid, @@ -260,10 +264,10 @@ export abstract class FrozenFacet extends BaseFacet { this.frozenGroups[frozenGroupType].appendChild(cell); } - setTimeout(() => { + waitForCellMounted(() => { this.spreadsheet.emit(S2Event.DATA_CELL_RENDER, cell); this.spreadsheet.emit(S2Event.LAYOUT_CELL_RENDER, cell); - }, 100); + }); }; addFrozenCell = (colIndex: number, rowIndex: number, group: Group) => { @@ -413,29 +417,9 @@ export abstract class FrozenFacet extends BaseFacet { // eslint-disable-next-line max-lines-per-function protected renderFrozenGroupSplitLine = (scrollX: number, scrollY: number) => { - const { - viewportWidth, - viewportHeight, - x: panelBBoxStartX, - y: panelBBoxStartY, - } = this.panelBBox; - - const cellRange = this.getCellRange(); - const { rowCount, colCount, trailingColCount, trailingRowCount } = - this.getFrozenOptions(); - // 在分页条件下需要额外处理 Y 轴滚动值 const relativeScrollY = Math.floor(scrollY - this.getPaginationScrollY()); - // scroll boundary - const maxScrollX = Math.max(0, last(this.viewCellWidths)! - viewportWidth); - const maxScrollY = Math.max( - 0, - this.viewCellHeights.getCellOffsetY(cellRange.end + 1) - - this.viewCellHeights.getCellOffsetY(cellRange.start) - - viewportHeight, - ); - // remove previous split line group this.foregroundGroup.getElementById(KEY_GROUP_FROZEN_SPLIT_LINE)?.remove(); @@ -461,6 +445,54 @@ export abstract class FrozenFacet extends BaseFacet { opacity: splitLine?.horizontalBorderColorOpacity, }; + this.renderFrozenColSplitLine( + splitLineGroup, + splitLine, + verticalBorderStyle, + scrollX, + ); + + this.renderFrozenTrailingColSplitLine( + splitLineGroup, + splitLine, + verticalBorderStyle, + scrollX, + ); + this.renderFrozenRowSplitLine( + splitLineGroup, + splitLine, + horizontalBorderStyle, + relativeScrollY, + ); + + this.renderFrozenTrailingRowSplitLine( + splitLineGroup, + splitLine, + horizontalBorderStyle, + relativeScrollY, + ); + }; + + protected getFrozenColSplitLineSize() { + const { viewportHeight, y: panelBBoxStartY } = this.panelBBox; + + const height = viewportHeight + panelBBoxStartY; + + return { + y: 0, + height, + }; + } + + protected renderFrozenColSplitLine( + splitLineGroup: Group, + splitLine: SplitLine, + verticalBorderStyle: Partial, + scrollX: number, + ) { + const { colCount } = this.getFrozenOptions(); + const { x: panelBBoxStartX } = this.panelBBox; + if (colCount > 0) { const cornerWidth = this.cornerBBox.width; const colOffset = getFrozenColOffset(this, cornerWidth, scrollX); @@ -469,14 +501,14 @@ export abstract class FrozenFacet extends BaseFacet { this.frozenGroupAreas[FrozenGroupArea.Col].width - colOffset; - const height = viewportHeight + panelBBoxStartY; + const { y, height } = this.getFrozenColSplitLineSize(); renderLine(splitLineGroup, { ...verticalBorderStyle, x1: x, x2: x, - y1: 0, - y2: height, + y1: y, + y2: y + height, }); if ( @@ -488,7 +520,7 @@ export abstract class FrozenFacet extends BaseFacet { new Rect({ style: { x, - y: 0, + y, width: splitLine?.shadowWidth!, height, fill: this.getShadowFill(0), @@ -497,6 +529,16 @@ export abstract class FrozenFacet extends BaseFacet { ); } } + } + + protected renderFrozenTrailingColSplitLine( + splitLineGroup: Group, + splitLine: SplitLine, + verticalBorderStyle: Partial, + scrollX: number, + ) { + const { trailingColCount } = this.getFrozenOptions(); + const { viewportWidth, x: panelBBoxStartX } = this.panelBBox; if (trailingColCount > 0) { const x = @@ -504,14 +546,19 @@ export abstract class FrozenFacet extends BaseFacet { this.frozenGroupAreas[FrozenGroupArea.TrailingCol].width + panelBBoxStartX; - const height = viewportHeight + panelBBoxStartY; + const { y, height } = this.getFrozenColSplitLineSize(); + + const maxScrollX = Math.max( + 0, + last(this.viewCellWidths)! - viewportWidth, + ); renderLine(splitLineGroup, { ...verticalBorderStyle, x1: x, x2: x, - y1: 0, - y2: height, + y1: y, + y2: y + height, }); if (splitLine?.showShadow && floor(scrollX) < floor(maxScrollX)) { @@ -519,7 +566,7 @@ export abstract class FrozenFacet extends BaseFacet { new Rect({ style: { x: x - splitLine.shadowWidth!, - y: 0, + y, width: splitLine.shadowWidth!, height, fill: this.getShadowFill(180), @@ -528,25 +575,45 @@ export abstract class FrozenFacet extends BaseFacet { ); } } + } + + protected getFrozenRowSplitLineSize() { + const { viewportWidth, x: panelBBoxStartX } = this.panelBBox; + const width = panelBBoxStartX + viewportWidth; + + return { + x: 0, + width, + }; + } + + protected renderFrozenRowSplitLine( + splitLineGroup: Group, + splitLine: SplitLine, + horizontalBorderStyle: Partial, + scrollY: number, + ) { + const { rowCount } = this.getFrozenOptions(); + const { y: panelBBoxStartY } = this.panelBBox; if (rowCount > 0) { const y = panelBBoxStartY + this.frozenGroupAreas[FrozenGroupArea.Row].height; - const width = panelBBoxStartX + viewportWidth; + const { x, width } = this.getFrozenRowSplitLineSize(); renderLine(splitLineGroup, { ...horizontalBorderStyle, - x1: 0, - x2: width, + x1: x, + x2: x + width, y1: y, y2: y, }); - if (splitLine?.showShadow && relativeScrollY > 0) { + if (splitLine?.showShadow && scrollY > 0) { splitLineGroup.appendChild( new Rect({ style: { - x: 0, + x, y, width, height: splitLine?.shadowWidth!, @@ -556,26 +623,46 @@ export abstract class FrozenFacet extends BaseFacet { ); } } + } + + protected renderFrozenTrailingRowSplitLine( + splitLineGroup: Group, + splitLine: SplitLine, + horizontalBorderStyle: Partial, + scrollY: number, + ) { + const { trailingRowCount } = this.getFrozenOptions(); + const { viewportHeight } = this.panelBBox; if (trailingRowCount > 0) { const y = this.panelBBox.maxY - this.frozenGroupAreas[FrozenGroupArea.TrailingRow].height; - const width = panelBBoxStartX + viewportWidth; + + const { x, width } = this.getFrozenRowSplitLineSize(); + + const cellRange = this.getCellRange(); + // scroll boundary + const maxScrollY = Math.max( + 0, + this.viewCellHeights.getCellOffsetY(cellRange.end + 1) - + this.viewCellHeights.getCellOffsetY(cellRange.start) - + viewportHeight, + ); renderLine(splitLineGroup, { ...horizontalBorderStyle, - x1: 0, - x2: width, + x1: x, + x2: x + width, y1: y, y2: y, }); - if (splitLine?.showShadow && relativeScrollY < floor(maxScrollY)) { + if (splitLine?.showShadow && scrollY < floor(maxScrollY)) { splitLineGroup.appendChild( new Rect({ style: { - x: 0, + x, y: y - splitLine.shadowWidth!, width, height: splitLine.shadowWidth!, @@ -585,9 +672,13 @@ export abstract class FrozenFacet extends BaseFacet { ); } } - }; + } public render() { + if (!this.shouldRender()) { + return; + } + this.calculateFrozenGroupInfo(); this.renderFrozenPanelCornerGroup(); super.render(); @@ -610,7 +701,7 @@ export abstract class FrozenFacet extends BaseFacet { cellRange, ); - (Object.keys(result) as (keyof typeof result)[]).forEach((key) => { + (Object.keys(result || {}) as (keyof typeof result)[]).forEach((key) => { const cells = result[key]; const group = this.frozenGroups[key]; diff --git a/packages/s2-core/src/facet/header/base.ts b/packages/s2-core/src/facet/header/base.ts index ed1eb601c9..4fe9e0dd4a 100644 --- a/packages/s2-core/src/facet/header/base.ts +++ b/packages/s2-core/src/facet/header/base.ts @@ -44,7 +44,7 @@ export abstract class BaseHeader extends Group { } // start render header - public render(type: string): void { + public render(type?: string): void { // clear resize group this.clearResizeAreaGroup(type); // clear self first @@ -63,7 +63,7 @@ export abstract class BaseHeader extends Group { * @param scrollY hScrollBar vertical offset * @param type */ - public onScrollXY(scrollX: number, scrollY: number, type: string): void { + public onScrollXY(scrollX: number, scrollY: number, type?: string): void { this.headerConfig.scrollX = scrollX; this.headerConfig.scrollY = scrollY; this.render(type); @@ -74,7 +74,7 @@ export abstract class BaseHeader extends Group { * @param rowHeaderScrollX hRowScrollbar horizontal offset * @param type */ - public onRowScrollX(rowHeaderScrollX: number, type: string): void { + public onRowScrollX(rowHeaderScrollX: number, type?: string): void { this.headerConfig.scrollX = rowHeaderScrollX; this.render(type); } @@ -83,7 +83,11 @@ export abstract class BaseHeader extends Group { * 清空热区,为重绘做准备,防止热区重复渲染 * @param type 当前重绘的header类型 */ - protected clearResizeAreaGroup(type: string) { + protected clearResizeAreaGroup(type?: string) { + if (!type) { + return; + } + const foregroundGroup = this.parentNode as Group; const resizerGroup = foregroundGroup?.getElementById(type); diff --git a/packages/s2-core/src/facet/header/col.ts b/packages/s2-core/src/facet/header/col.ts index 79754c95f5..2ef58f91ef 100644 --- a/packages/s2-core/src/facet/header/col.ts +++ b/packages/s2-core/src/facet/header/col.ts @@ -12,7 +12,7 @@ import { } from '../../common/constant'; import type { FrozenFacet } from '../frozen-facet'; import type { Node } from '../layout/node'; -import { translateGroupX } from '../utils'; +import { translateGroup } from '../utils'; import { BaseHeader } from './base'; import type { ColHeaderConfig } from './interface'; import { @@ -110,7 +110,7 @@ export class ColHeader extends BaseHeader { * @param cornerWidth only has real meaning when scroll contains rowCell * @param type */ - public onColScroll(scrollX: number, type: string) { + public onColScroll(scrollX: number, type?: string) { if (this.headerConfig.scrollX !== scrollX) { this.headerConfig.scrollX = scrollX; this.render(type); @@ -207,14 +207,18 @@ export class ColHeader extends BaseHeader { cornerWidth, } = this.getHeaderConfig(); - translateGroupX(this.scrollGroup, position.x - scrollX); + translateGroup(this.scrollGroup, position.x - scrollX, position.y); const facet = spreadsheet.facet as FrozenFacet; const colOffset = getFrozenColOffset(facet, cornerWidth, scrollX); const trailingColOffset = getFrozenTrailingColOffset(facet, viewportWidth); - translateGroupX(this.frozenGroup, position.x - colOffset); - translateGroupX(this.frozenTrailingGroup, position.x - trailingColOffset); + translateGroup(this.frozenGroup, position.x - colOffset, position.y); + translateGroup( + this.frozenTrailingGroup, + position.x - trailingColOffset, + position.y, + ); } } diff --git a/packages/s2-core/src/facet/header/corner.ts b/packages/s2-core/src/facet/header/corner.ts index 386e0e6baf..d9bf259089 100644 --- a/packages/s2-core/src/facet/header/corner.ts +++ b/packages/s2-core/src/facet/header/corner.ts @@ -3,10 +3,11 @@ import { includes } from 'lodash'; import { CornerCell } from '../../cell/corner-cell'; import { S2Event } from '../../common'; import { CornerNodeType } from '../../common/interface/node'; +import type { SpreadSheet } from '../../sheet-type'; import type { CornerBBox } from '../bbox/corner-bbox'; import type { PanelBBox } from '../bbox/panel-bbox'; import { Node } from '../layout/node'; -import { translateGroupX } from '../utils'; +import { translateGroup } from '../utils'; import { FRONT_GROUND_GROUP_SCROLL_Z_INDEX, KEY_GROUP_CORNER_SCROLL, @@ -89,8 +90,7 @@ export class CornerHeader extends BaseHeader { }); } - public static getTreeCornerText(options: BaseCornerOptions) { - const { spreadsheet } = options; + public static getTreeCornerText(spreadsheet: SpreadSheet) { const { rows = [] } = spreadsheet.dataSet.fields; const { cornerText: defaultCornerText } = spreadsheet.options; @@ -153,7 +153,7 @@ export class CornerHeader extends BaseHeader { } if (spreadsheet.isHierarchyTreeType()) { - const cornerText = this.getTreeCornerText(options); + const cornerText = this.getTreeCornerText(spreadsheet); const cornerNode: Node = new Node({ id: cornerText, field: '', @@ -191,7 +191,9 @@ export class CornerHeader extends BaseHeader { cornerNode.x = rowNode.x + seriesNumberWidth; cornerNode.y = leafNode?.y ?? 0; cornerNode.width = rowNode.width; - cornerNode.height = leafNode?.height! ?? (colCell?.height as number); + cornerNode.height = + leafNode?.height! ?? + spreadsheet.facet?.getCellCustomSize(null, colCell?.height); cornerNode.isPivotMode = true; cornerNode.cornerType = CornerNodeType.Row; cornerNode.spreadsheet = spreadsheet; @@ -234,7 +236,7 @@ export class CornerHeader extends BaseHeader { * Make cornerHeader scroll with hScrollBar * @param scrollX */ - public onCorScroll(scrollX: number, type: string): void { + public onCorScroll(scrollX: number, type?: string): void { this.headerConfig.scrollX = scrollX; this.render(type); } @@ -249,7 +251,15 @@ export class CornerHeader extends BaseHeader { return; } + const colNodes = spreadsheet.facet?.getColNodes() || []; + nodes.forEach((node) => { + // 自定义列头高度时, 需要同时标记下对应的角头 (兼容自定义列头场景) + const currentColNode = colNodes?.find( + (colNode) => node?.y === colNode?.y && node?.height === colNode?.height, + ); + + node.extra.isCustomHeight = currentColNode?.extra?.isCustomHeight; const cell = this.getCellInstance(node); this.scrollGroup.appendChild(cell); @@ -259,18 +269,18 @@ export class CornerHeader extends BaseHeader { } protected offset() { - const { scrollX = 0 } = this.getHeaderConfig(); + const { position, scrollX = 0 } = this.getHeaderConfig(); - translateGroupX(this.scrollGroup, -scrollX); + translateGroup(this.scrollGroup, position.x - scrollX, position.y); } protected clip(): void { - const { width, height } = this.getHeaderConfig(); + const { width, height, position } = this.getHeaderConfig(); this.scrollGroup.style.clipPath = new Rect({ style: { - x: 0, - y: 0, + x: position.x, + y: position.y, width, height, }, diff --git a/packages/s2-core/src/facet/header/frame.ts b/packages/s2-core/src/facet/header/frame.ts index bb777fd9fa..7ecdce8ac9 100644 --- a/packages/s2-core/src/facet/header/frame.ts +++ b/packages/s2-core/src/facet/header/frame.ts @@ -87,16 +87,23 @@ export class Frame extends Group { this.render(); } - private addCornerRightBorder() { - const { cornerWidth, cornerHeight, viewportHeight, position, spreadsheet } = - this.cfg; - const { - verticalBorderColor, - verticalBorderColorOpacity, - horizontalBorderWidth, - } = spreadsheet.theme?.splitLine!; + protected getCornerRightBorderSizeForPivotMode() { + const { cornerHeight, viewportHeight, position, spreadsheet } = this.cfg; + + const { horizontalBorderWidth } = spreadsheet.theme?.splitLine!; + + const y = position.y; + const height = cornerHeight + horizontalBorderWidth! + viewportHeight; + + return { y, height }; + } + protected addCornerRightHeadBorder() { + const { cornerWidth, cornerHeight, position, spreadsheet } = this.cfg; + const { verticalBorderColor, verticalBorderColorOpacity } = + spreadsheet.theme?.splitLine!; const frameVerticalWidth = Frame.getVerticalBorderWidth(spreadsheet); + const frameHorizontalWidth = Frame.getHorizontalBorderWidth(spreadsheet); const x = position.x + cornerWidth + frameVerticalWidth! / 2; // 表头和表身的单元格背景色不同, 分割线不能一条线拉通, 不然视觉不协调. @@ -104,40 +111,80 @@ export class Frame extends Group { const { verticalBorderColor: headerVerticalBorderColor, verticalBorderColorOpacity: headerVerticalBorderColorOpacity, - } = - spreadsheet.options.seriesNumber?.enable || spreadsheet.isPivotMode() - ? spreadsheet.theme.cornerCell!.cell! - : spreadsheet.theme.colCell!.cell!; + backgroundColor, + backgroundColorOpacity, + } = spreadsheet.options.seriesNumber?.enable || spreadsheet.isPivotMode() + ? spreadsheet.theme.cornerCell!.cell! + : spreadsheet.theme.colCell!.cell!; - renderLine(this, { - x1: x, - y1: position.y, - x2: x, - y2: position.y + cornerHeight, - stroke: verticalBorderColor || headerVerticalBorderColor, - lineWidth: frameVerticalWidth, - strokeOpacity: - verticalBorderColorOpacity || headerVerticalBorderColorOpacity, + /** + * G 6.0 颜色混合模式有调整, 相同颜色的 Line 在不同背景色绘制, 实际渲染的颜色会不一致 + * 在绘制分割线前, 先填充一个和单元格相同的底色, 保证分割线和单元格边框表现一致 + */ + [ + { stroke: backgroundColor, strokeOpacity: backgroundColorOpacity }, + { + stroke: verticalBorderColor || headerVerticalBorderColor, + strokeOpacity: + verticalBorderColorOpacity || headerVerticalBorderColorOpacity, + }, + ].forEach(({ stroke, strokeOpacity }) => { + renderLine(this, { + x1: x, + y1: position.y, + x2: x, + y2: position.y + cornerHeight + frameHorizontalWidth, + lineWidth: frameVerticalWidth, + stroke, + strokeOpacity, + }); }); + } + + protected addCornerRightBorder() { + const { cornerWidth, cornerHeight, viewportHeight, position, spreadsheet } = + this.cfg; + const { verticalBorderColor, verticalBorderColorOpacity } = + spreadsheet.theme?.splitLine!; + const frameVerticalWidth = Frame.getVerticalBorderWidth(spreadsheet); + const frameHorizontalWidth = Frame.getHorizontalBorderWidth(spreadsheet); + const x = position.x + cornerWidth + frameVerticalWidth! / 2; + + // 表头和表身的单元格背景色不同, 分割线不能一条线拉通, 不然视觉不协调. + // 分两条线绘制, 默认和分割线所在区域对应的单元格边框颜色保持一致 + this.addCornerRightHeadBorder(); const { verticalBorderColor: cellVerticalBorderColor, verticalBorderColorOpacity: cellVerticalBorderColorOpacity, + backgroundColor: cellBackgroundColor, + backgroundColorOpacity: cellBackgroundColorOpacity, } = spreadsheet.theme.dataCell!.cell!; - renderLine(this, { - x1: x, - y1: position.y + cornerHeight + horizontalBorderWidth!, - x2: x, - y2: position.y + cornerHeight + horizontalBorderWidth! + viewportHeight, - stroke: verticalBorderColor || cellVerticalBorderColor, - lineWidth: frameVerticalWidth, - strokeOpacity: - verticalBorderColorOpacity || cellVerticalBorderColorOpacity, + [ + { + stroke: cellBackgroundColor, + strokeOpacity: cellBackgroundColorOpacity, + }, + { + stroke: verticalBorderColor || cellVerticalBorderColor, + strokeOpacity: + verticalBorderColorOpacity || cellVerticalBorderColorOpacity, + }, + ].forEach(({ stroke, strokeOpacity }) => { + renderLine(this, { + x1: x, + y1: position.y + cornerHeight + frameHorizontalWidth!, + x2: x, + y2: position.y + cornerHeight + frameHorizontalWidth! + viewportHeight, + lineWidth: frameVerticalWidth, + stroke, + strokeOpacity, + }); }); } - private addCornerBottomBorder() { + protected addCornerBottomBorder() { const cfg = this.cfg; const { cornerWidth, @@ -182,7 +229,7 @@ export class Frame extends Group { }); } - private addSplitLineShadow() { + protected addSplitLineShadow() { const cfg = this.cfg; const { spreadsheet } = cfg; const splitLine = spreadsheet.theme?.splitLine; @@ -199,7 +246,7 @@ export class Frame extends Group { this.addSplitLineRightShadow(); } - private addSplitLineLeftShadow() { + protected addSplitLineLeftShadow() { if (!this.cfg.showViewportLeftShadow) { return; } @@ -225,28 +272,21 @@ export class Frame extends Group { ); } - private addSplitLineRightShadow() { + protected addSplitLineRightShadow() { if (!this.cfg.showViewportRightShadow) { return; } - const { - cornerWidth, - cornerHeight, - viewportHeight, - viewportWidth, - position, - spreadsheet, - } = this.cfg; - const { shadowColors, shadowWidth, horizontalBorderWidth } = - spreadsheet.theme?.splitLine!; + const { cornerWidth, viewportWidth, position, spreadsheet } = this.cfg; + const { shadowColors, shadowWidth } = spreadsheet.theme?.splitLine!; const x = position.x + cornerWidth + Frame.getVerticalBorderWidth(spreadsheet)! + viewportWidth - shadowWidth!; - const y = position.y; + + const { y, height } = this.getCornerRightBorderSizeForPivotMode(); this.appendChild( new Rect({ @@ -254,7 +294,7 @@ export class Frame extends Group { x, y, width: shadowWidth!, - height: cornerHeight + horizontalBorderWidth! + viewportHeight, + height, fill: `l (0) 0:${shadowColors?.right} 1:${shadowColors?.left}`, }, }), diff --git a/packages/s2-core/src/facet/header/index.ts b/packages/s2-core/src/facet/header/index.ts index 3001a3417d..00ae2b6947 100644 --- a/packages/s2-core/src/facet/header/index.ts +++ b/packages/s2-core/src/facet/header/index.ts @@ -5,3 +5,4 @@ export { RowHeader } from './row'; export { SeriesNumberHeader } from './series-number'; export * from './interface'; +export * from './util'; diff --git a/packages/s2-core/src/facet/header/row.ts b/packages/s2-core/src/facet/header/row.ts index b221f7cfdd..88774c00f3 100644 --- a/packages/s2-core/src/facet/header/row.ts +++ b/packages/s2-core/src/facet/header/row.ts @@ -5,8 +5,8 @@ import { FRONT_GROUND_GROUP_FROZEN_Z_INDEX, FRONT_GROUND_GROUP_SCROLL_Z_INDEX, FrozenGroupArea, - KEY_GROUP_ROW_HEADER_FROZEN, - KEY_GROUP_ROW_HEADER_FROZEN_TRAILING, + KEY_GROUP_ROW_FROZEN, + KEY_GROUP_ROW_FROZEN_TRAILING, KEY_GROUP_ROW_SCROLL, S2Event, } from '../../common'; @@ -31,13 +31,13 @@ export class RowHeader extends BaseHeader { this.frozenGroup = this.appendChild( new Group({ - name: KEY_GROUP_ROW_HEADER_FROZEN, + name: KEY_GROUP_ROW_FROZEN, style: { zIndex: FRONT_GROUND_GROUP_FROZEN_Z_INDEX }, }), ); this.frozenTrailingGroup = this.appendChild( new Group({ - name: KEY_GROUP_ROW_HEADER_FROZEN_TRAILING, + name: KEY_GROUP_ROW_FROZEN_TRAILING, style: { zIndex: FRONT_GROUND_GROUP_FROZEN_Z_INDEX }, }), ); diff --git a/packages/s2-core/src/facet/index.ts b/packages/s2-core/src/facet/index.ts index 080b7e7092..7ad8b0873c 100644 --- a/packages/s2-core/src/facet/index.ts +++ b/packages/s2-core/src/facet/index.ts @@ -1,7 +1,11 @@ -import { BaseFacet } from './base-facet'; -import { FrozenFacet } from './frozen-facet'; -import { PivotFacet } from './pivot-facet'; -import { TableFacet } from './table-facet'; +export { BaseFacet } from './base-facet'; +export { FrozenFacet } from './frozen-facet'; +export { PivotFacet } from './pivot-facet'; +export { TableFacet } from './table-facet'; + +export * from './bbox/corner-bbox'; +export * from './bbox/panel-bbox'; export * from './header'; -export { BaseFacet, FrozenFacet, PivotFacet, TableFacet }; +export * from './layout'; +export * from './utils'; diff --git a/packages/s2-core/src/facet/layout/build-gird-hierarchy.ts b/packages/s2-core/src/facet/layout/build-gird-hierarchy.ts index 87734069f8..c0a2517d94 100644 --- a/packages/s2-core/src/facet/layout/build-gird-hierarchy.ts +++ b/packages/s2-core/src/facet/layout/build-gird-hierarchy.ts @@ -76,6 +76,8 @@ const buildTotalGridHierarchy = (params: GridHeaderParams) => { level: index, parentNode, query, + // eslint-disable-next-line @typescript-eslint/no-use-before-define + handler: buildGridHierarchy, }); }; @@ -105,7 +107,6 @@ const buildNormalGridHierarchy = (params: GridHeaderParams) => { fieldValues.push(...((arrangedValues as FieldValue[]) || [])); // add skeleton for empty data - if (isEmpty(fieldValues) && currentField) { if (currentField === EXTRA_FIELD) { fieldValues.push(...values); @@ -114,7 +115,6 @@ const buildNormalGridHierarchy = (params: GridHeaderParams) => { } } - // add totals if needed addTotals({ currentField, lastField: fields[index - 1], @@ -131,18 +131,18 @@ const buildNormalGridHierarchy = (params: GridHeaderParams) => { level: index, parentNode, query, + // eslint-disable-next-line @typescript-eslint/no-use-before-define + handler: buildGridHierarchy, }); }; /** * Build grid hierarchy in rows or columns - * - * @param params */ -export const buildGridHierarchy = (params: GridHeaderParams) => { +export function buildGridHierarchy(params: GridHeaderParams) { if (params.parentNode.isTotals) { buildTotalGridHierarchy(params); } else { buildNormalGridHierarchy(params); } -}; +} diff --git a/packages/s2-core/src/facet/layout/build-header-hierarchy.ts b/packages/s2-core/src/facet/layout/build-header-hierarchy.ts index 1048f3e3ae..4f1e5613ae 100644 --- a/packages/s2-core/src/facet/layout/build-header-hierarchy.ts +++ b/packages/s2-core/src/facet/layout/build-header-hierarchy.ts @@ -5,17 +5,16 @@ import { type CustomTreeNode, } from '../../common'; import type { PivotDataSet } from '../../data-set'; -import { buildGridHierarchy } from '../layout/build-gird-hierarchy'; -import { buildCustomTreeHierarchy } from '../layout/build-row-custom-tree-hierarchy'; -import { buildRowTreeHierarchy } from '../layout/build-row-tree-hierarchy'; -import { buildTableHierarchy } from '../layout/build-table-hierarchy'; -import { Hierarchy } from '../layout/hierarchy'; import type { BuildHeaderParams, BuildHeaderResult, HeaderParams, } from '../layout/interface'; -import { Node } from '../layout/node'; +import { buildGridHierarchy } from './build-gird-hierarchy'; +import { buildCustomTreeHierarchy } from './build-row-custom-tree-hierarchy'; +import { buildRowTreeHierarchy } from './build-row-tree-hierarchy'; +import { buildTableHierarchy } from './build-table-hierarchy'; +import { Hierarchy } from './hierarchy'; const handleCustomTreeHierarchy = (params: HeaderParams) => { const { rootNode, hierarchy, fields, spreadsheet, isRowHeader } = params; @@ -168,7 +167,6 @@ export const buildHeaderHierarchy = ( const { rows = [], columns = [] } = spreadsheet.dataSet.fields; const isValueInCols = spreadsheet.isValueInCols(); const moreThanOneValue = spreadsheet.dataSet.moreThanOneValue(); - const rootNode = Node.rootNode(); const hierarchy = new Hierarchy(); const fields = isRowHeader ? rows : columns; const isCustomTreeFields = spreadsheet.isCustomHeaderFields( @@ -178,7 +176,7 @@ export const buildHeaderHierarchy = ( const headerParams: HeaderParams = { isValueInCols, moreThanOneValue, - rootNode, + rootNode: hierarchy.rootNode, hierarchy, spreadsheet, fields, diff --git a/packages/s2-core/src/facet/layout/build-table-hierarchy.ts b/packages/s2-core/src/facet/layout/build-table-hierarchy.ts index 7f2abfcacd..fd01a57540 100644 --- a/packages/s2-core/src/facet/layout/build-table-hierarchy.ts +++ b/packages/s2-core/src/facet/layout/build-table-hierarchy.ts @@ -1,5 +1,6 @@ import { SERIES_NUMBER_FIELD } from '../../common/constant'; import { generateHeaderNodes } from '../../utils/layout/generate-header-nodes'; +import { buildGridHierarchy } from './build-gird-hierarchy'; import type { HeaderParams } from './interface'; export const buildTableHierarchy = (params: HeaderParams) => { @@ -30,5 +31,6 @@ export const buildTableHierarchy = (params: HeaderParams) => { query: {}, addMeasureInTotalQuery: false, addTotalMeasureInTotal: false, + handler: buildGridHierarchy, }); }; diff --git a/packages/s2-core/src/facet/layout/hierarchy.ts b/packages/s2-core/src/facet/layout/hierarchy.ts index 876b4eae07..809560de3e 100644 --- a/packages/s2-core/src/facet/layout/hierarchy.ts +++ b/packages/s2-core/src/facet/layout/hierarchy.ts @@ -1,4 +1,4 @@ -import type { Node } from './node'; +import { Node } from './node'; /** * Row and Column hierarchy to handle all contained nodes @@ -16,6 +16,8 @@ export class Hierarchy { // just a mark to get node from each level public maxLevel = -1; + public rootNode: Node; + // each level's first node public sampleNodesForAllLevels: Node[] = []; @@ -23,10 +25,16 @@ export class Hierarchy { public sampleNodeForLastLevel: Node | null = null; // all nodes in this hierarchy - private allNodesWithoutRoot: Node[] = []; + public allNodesWithoutRoot: Node[] = []; // all nodes in the lastLevel - private indexNode: Node[] = []; + public indexNode: Node[] = []; + + public isPlaceholder = false; + + constructor() { + this.rootNode = Node.rootNode(); + } // get all leaf nodes public getLeaves(): Node[] { diff --git a/packages/s2-core/src/facet/layout/index.ts b/packages/s2-core/src/facet/layout/index.ts new file mode 100644 index 0000000000..7a167beddb --- /dev/null +++ b/packages/s2-core/src/facet/layout/index.ts @@ -0,0 +1,4 @@ +export { buildGridHierarchy } from './build-gird-hierarchy'; +export { buildTableHierarchy } from './build-table-hierarchy'; +export { Hierarchy } from './hierarchy'; +export { Node } from './node'; diff --git a/packages/s2-core/src/facet/layout/interface.ts b/packages/s2-core/src/facet/layout/interface.ts index ec30f09da9..f458f5a266 100644 --- a/packages/s2-core/src/facet/layout/interface.ts +++ b/packages/s2-core/src/facet/layout/interface.ts @@ -43,6 +43,7 @@ export interface HeaderNodesParams extends GridHeaderParams { fieldValues: FieldValue[]; level: number; query: Record; + handler: (params: HeaderNodesParams) => void; } export interface HeaderParams { diff --git a/packages/s2-core/src/facet/layout/node.ts b/packages/s2-core/src/facet/layout/node.ts index 6e396bb895..8c25b51c20 100644 --- a/packages/s2-core/src/facet/layout/node.ts +++ b/packages/s2-core/src/facet/layout/node.ts @@ -1,4 +1,4 @@ -import { head, isEmpty } from 'lodash'; +import { assign, head, isEmpty } from 'lodash'; import { SERIES_NUMBER_FIELD } from '../../common'; import { ROOT_NODE_ID } from '../../common/constant/node'; import type { @@ -10,46 +10,11 @@ import type { Query } from '../../data-set'; import type { SpreadSheet } from '../../sheet-type'; import type { Hierarchy } from './hierarchy'; -export interface BaseNodeConfig { - /** - * id 只在行头、列头 node 以及 hierarchy 中有用,是当前 node query 的拼接产物 - */ - id: string; - - /** - * 当前 node 的 field 属性, 在角头、行列头中 node 使用,和 dataCfg.fields 对应 - */ - field: string; - value: string; - level?: number; - rowIndex?: number; - colIndex?: number; - parent?: Node; - isTotals?: boolean; - isSubTotals?: boolean; - isCollapsed?: boolean | null; - isGrandTotals?: boolean; - isTotalRoot?: boolean; - hierarchy?: Hierarchy; - isPivotMode?: boolean; - seriesNumberWidth?: number; - spreadsheet?: SpreadSheet; - query?: Record; - belongsCell?: S2CellType; - isTotalMeasure?: boolean; - inCollapseNode?: boolean; - isLeaf?: boolean; - x?: number; - y?: number; - width?: number; - height?: number; - padding?: number; - children?: Node[]; - hiddenColumnsInfo?: HiddenColumnsInfo | null; - // 额外的节点信息 - extra?: Record; -} - +export type NodeProperties = { + [K in keyof Node as Node[K] extends (...args: any[]) => any + ? never + : K]?: Node[K]; +}; /** * Node for cornerHeader, colHeader, rowHeader */ @@ -84,7 +49,7 @@ export class Node { public rowIndex: number; // node's parent node - public parent: Node | undefined; + public parent?: Node; // check if node is leaf(the max level in tree) public isLeaf = false; @@ -92,13 +57,11 @@ export class Node { // node is grand total or subtotal(not normal node) public isTotals: boolean; - public colId: string; - // node represent total measure public isTotalMeasure: boolean; // node is collapsed - public isCollapsed: boolean; + public isCollapsed: boolean | null; // node's children public children: Node[] = []; @@ -116,7 +79,8 @@ export class Node { public seriesNumberWidth: number; /** - * 给序号列单元格用,标识该序号单元格对应了行头节点,有了关联关系后,就可以在行头冻结时做区分 + * 1. 给序号列单元格用,标识该序号单元格对应了行头节点,有了关联关系后,就可以在行头冻结时做区分 + * 2. 给 pivot chart sheet 用,关联当前格子和拆分的 axis 的格子 */ public relatedNode: Node; @@ -126,10 +90,12 @@ export class Node { // node self's query condition(represent where node stay) public query?: Query; - public belongsCell?: S2CellType | null | undefined; + public belongsCell?: S2CellType | null; public inCollapseNode?: boolean; + public hiddenColumnsInfo?: HiddenColumnsInfo | null; + public cornerType?: CornerNodeType; public isGrandTotals?: boolean; @@ -146,60 +112,23 @@ export class Node { public shallowRender?: boolean; - public extra?: { + /** 是否不绘制 col cell 水平 resize 热区 */ + public hideColCellHorizontalResize?: boolean; + + /** 是否不绘制 row cell 竖直 resize 热区 */ + public hideRowCellVerticalResize?: boolean; + + public extra: { description?: string; isCustomNode?: boolean; + isCustomHeight?: boolean; [key: string]: any; - }; + } = {}; [key: string]: any; - constructor(cfg: BaseNodeConfig) { - const { - id, - field, - value, - parent, - level, - rowIndex, - isTotals, - isGrandTotals, - isSubTotals, - isCollapsed, - isTotalRoot, - hierarchy, - isPivotMode, - seriesNumberWidth, - spreadsheet, - query, - belongsCell, - inCollapseNode, - isTotalMeasure, - isLeaf, - extra, - } = cfg; - - this.id = id; - this.field = field; - this.value = value; - this.parent = parent; - this.level = level!; - this.rowIndex = rowIndex!; - this.isTotals = isTotals!; - this.isCollapsed = isCollapsed!; - this.hierarchy = hierarchy!; - this.isPivotMode = isPivotMode!; - this.seriesNumberWidth = seriesNumberWidth!; - this.spreadsheet = spreadsheet!; - this.query = query; - this.inCollapseNode = inCollapseNode; - this.isTotalMeasure = isTotalMeasure!; - this.isLeaf = isLeaf!; - this.isGrandTotals = isGrandTotals; - this.isSubTotals = isSubTotals; - this.belongsCell = belongsCell; - this.isTotalRoot = isTotalRoot; - this.extra = extra; + constructor(cfg: NodeProperties) { + assign(this, cfg); } /** @@ -273,11 +202,16 @@ export class Node { * get a branch's all nodes(c1~c4, b1, b2) * @param node */ - public static getAllChildrenNodes(node: Node): Node[] { + public static getAllChildrenNodes( + node: Node, + push: (node: Node) => Node[] = (node) => [node], + ): Node[] { const all: Node[] = []; if (node.isLeaf) { - return [node]; + all.push(...push(node)); + + return all; } // current root node children @@ -285,7 +219,7 @@ export class Node { let current = nodes.shift(); while (current) { - all.push(current); + all.push(...push(current)); nodes.unshift(...current.children); current = nodes.shift(); } @@ -367,7 +301,7 @@ export class Node { } public clone() { - return Object.create(this) as Node; + return new Node({ ...this }); } public get isFrozen() { diff --git a/packages/s2-core/src/facet/layout/total-class.ts b/packages/s2-core/src/facet/layout/total-class.ts index 719687895f..1467cb620e 100644 --- a/packages/s2-core/src/facet/layout/total-class.ts +++ b/packages/s2-core/src/facet/layout/total-class.ts @@ -29,4 +29,8 @@ export class TotalClass { this.isGrandTotals = isGrandTotals; this.isTotalRoot = isTotalRoot; } + + static isTotalClassInstance(value: unknown): value is TotalClass { + return value instanceof TotalClass; + } } diff --git a/packages/s2-core/src/facet/layout/total-measure.ts b/packages/s2-core/src/facet/layout/total-measure.ts index 3d341d78b9..f5447b5740 100644 --- a/packages/s2-core/src/facet/layout/total-measure.ts +++ b/packages/s2-core/src/facet/layout/total-measure.ts @@ -4,4 +4,8 @@ export class TotalMeasure { public constructor(label: string) { this.label = label; } + + static isTotalMeasureInstance(value: unknown): value is TotalMeasure { + return value instanceof TotalMeasure; + } } diff --git a/packages/s2-core/src/facet/pivot-facet.ts b/packages/s2-core/src/facet/pivot-facet.ts index 5c6e45e950..cad5b22972 100644 --- a/packages/s2-core/src/facet/pivot-facet.ts +++ b/packages/s2-core/src/facet/pivot-facet.ts @@ -15,9 +15,9 @@ import { size, sumBy, } from 'lodash'; -import { ColCell, RowCell, SeriesNumberCell } from '../cell'; +import { ColCell, CornerCell, RowCell, SeriesNumberCell } from '../cell'; import { - DEFAULT_TREE_ROW_CELL_WIDTH, + DEFAULT_ROW_CELL_TREE_WIDTH, LAYOUT_SAMPLE_COUNT, type IconTheme, type MultiData, @@ -27,6 +27,7 @@ import { EXTRA_FIELD, LayoutWidthType, VALUE_FIELD } from '../common/constant'; import { CellType } from '../common/constant/interaction'; import { DebuggerUtil } from '../common/debug'; import type { + CellCallback, CellCallbackParams, LayoutResult, SimpleData, @@ -43,7 +44,7 @@ import { getAllChildCells } from '../utils/get-all-child-cells'; import { floor } from '../utils/math'; import { getCellWidth } from '../utils/text'; import { FrozenFacet } from './frozen-facet'; -import { Frame } from './header'; +import { CornerHeader, Frame, type CornerHeaderConfig } from './header'; import { buildHeaderHierarchy } from './layout/build-header-hierarchy'; import type { Hierarchy } from './layout/hierarchy'; import { layoutCoordinate } from './layout/layout-hooks'; @@ -54,6 +55,14 @@ export class PivotFacet extends FrozenFacet { return this.spreadsheet.theme.rowCell!.cell; } + protected override getCornerCellInstance(...args: CellCallbackParams) { + return ( + this.spreadsheet.options.cornerCell?.( + ...(args as Parameters>), + ) || new CornerCell(...args) + ); + } + protected override getRowCellInstance(...args: CellCallbackParams) { return this.spreadsheet.options.rowCell?.(...args) || new RowCell(...args); } @@ -83,7 +92,7 @@ export class PivotFacet extends FrozenFacet { }; } - private buildAllHeaderHierarchy() { + protected buildAllHeaderHierarchy() { const { leafNodes: rowLeafNodes, hierarchy: rowsHierarchy } = buildHeaderHierarchy({ isRowHeader: true, @@ -150,7 +159,7 @@ export class PivotFacet extends FrozenFacet { rowQuery!, colQuery!, ); - const data = dataSet.getCellData({ + const data = (dataSet as PivotDataSet).getCellData({ query: dataQuery, rowNode: row, isTotals, @@ -185,7 +194,7 @@ export class PivotFacet extends FrozenFacet { return options.layoutCellMeta?.(cellMeta) ?? cellMeta; } - private getPreLevelSampleNode(colNode: Node, colsHierarchy: Hierarchy) { + protected getPreLevelSampleNode(colNode: Node, colsHierarchy: Hierarchy) { // 之前是采样每一级第一个节点, 现在 sampleNodesForAllLevels 是采样每一级高度最大的节点 // 但是初始化布局时只有第一个节点有值, 所以这里需要适配下 return colsHierarchy @@ -193,20 +202,20 @@ export class PivotFacet extends FrozenFacet { .find((node) => !node.isTotals); } - private calculateHeaderNodesCoordinate(layoutResult: LayoutResult) { + protected calculateHeaderNodesCoordinate(layoutResult: LayoutResult) { this.calculateRowNodesCoordinate(layoutResult); this.calculateColNodesCoordinate(layoutResult); } - private calculateColNodesCoordinate(layoutResult: LayoutResult) { - const { colLeafNodes, colsHierarchy } = layoutResult; + protected calculateColNodesCoordinate(layoutResult: LayoutResult) { + const { colLeafNodes, colsHierarchy, rowsHierarchy } = layoutResult; // 1. 计算叶子节点宽度 this.calculateColLeafNodesWidth(layoutResult); // 2. 根据叶子节点宽度计算所有父级节点宽度和 x 坐标, 便于计算自动换行后节点的真实高度 this.calculateColNodeWidthAndX(colLeafNodes); // 3. 计算每一层级的采样节点 - this.updateColsHierarchySampleMaxHeightNodes(colsHierarchy); + this.updateColsHierarchySampleMaxHeightNodes(colsHierarchy, rowsHierarchy); // 4. 计算所有节点的高度 this.calculateColNodesHeight(colsHierarchy); // 5. 如果存在自定义多级列头, 还需要更新某一层级的采样 @@ -222,7 +231,7 @@ export class PivotFacet extends FrozenFacet { protected calculateRowOffsets(): void {} - private adjustColTotalNodesCoordinate(colsHierarchy: Hierarchy) { + protected adjustColTotalNodesCoordinate(colsHierarchy: Hierarchy) { if (!isEmpty(this.spreadsheet.options.totals?.col)) { this.adjustTotalNodesCoordinate({ hierarchy: colsHierarchy, @@ -237,7 +246,7 @@ export class PivotFacet extends FrozenFacet { } } - private calculateColLeafNodesWidth(layoutResult: LayoutResult) { + protected calculateColLeafNodesWidth(layoutResult: LayoutResult) { const { rowLeafNodes, colLeafNodes, rowsHierarchy, colsHierarchy } = layoutResult; let preLeafNode = Node.blankNode(); @@ -245,7 +254,7 @@ export class PivotFacet extends FrozenFacet { colsHierarchy.getLeaves().forEach((currentNode) => { currentNode.colIndex = currentColIndex; - currentColIndex += 1; + currentColIndex++; currentNode.x = preLeafNode.x + preLeafNode.width; currentNode.width = this.getColLeafNodesWidth( currentNode, @@ -258,7 +267,7 @@ export class PivotFacet extends FrozenFacet { }); } - private calculateColNodesHeight(colsHierarchy: Hierarchy) { + protected calculateColNodesHeight(colsHierarchy: Hierarchy) { const colNodes = colsHierarchy.getNodes(); colNodes.forEach((currentNode) => { @@ -270,15 +279,15 @@ export class PivotFacet extends FrozenFacet { colsHierarchy, ); - currentNode.y = preLevelSample?.y! + preLevelSample?.height! ?? 0; + currentNode.y = preLevelSample?.y! + preLevelSample?.height! || 0; } // 数值置于行头时, 列头的总计即叶子节点, 此时应该用列高: https://github.com/antvis/S2/issues/1715 - const colNodeHeight = this.getColNodeHeight( - currentNode, + const colNodeHeight = this.getColNodeHeight({ + colNode: currentNode, colsHierarchy, - false, - ); + useCache: false, + }); currentNode.height = currentNode.isGrandTotals && @@ -292,7 +301,7 @@ export class PivotFacet extends FrozenFacet { } // please read README-adjustTotalNodesCoordinate.md to understand this function - private getMultipleMap( + protected getMultipleMap( hierarchy: Hierarchy, isRowHeader?: boolean, isSubTotal?: boolean, @@ -313,7 +322,7 @@ export class PivotFacet extends FrozenFacet { for (let level = maxLevel; level > 0; level--) { const currentField = fields![level] as string; - // 若不符合【分组维度包含此维度】或【者指标维度下非单指标维度】,此表头单元格为空,将宽高合并到上级单元格 + // 若不符合【分组维度包含此维度】或者【指标维度下多指标维度】,此表头单元格为空,将宽高合并到上级单元格 const existValueField = currentField === EXTRA_FIELD && moreThanOneValue; if (!(dimensionGroup.includes(currentField) || existValueField)) { @@ -326,7 +335,7 @@ export class PivotFacet extends FrozenFacet { } // please read README-adjustTotalNodesCoordinate.md to understand this function - private adjustTotalNodesCoordinate(params: { + protected adjustTotalNodesCoordinate(params: { hierarchy: Hierarchy; isRowHeader?: boolean; isSubTotal?: boolean; @@ -371,7 +380,7 @@ export class PivotFacet extends FrozenFacet { * Auto column no-leaf node's width and x coordinate * @param colLeafNodes */ - private calculateColNodeWidthAndX(colLeafNodes: Node[]) { + protected calculateColNodeWidthAndX(colLeafNodes: Node[]) { let prevColParent: Node | null = null; let i = 0; @@ -388,7 +397,7 @@ export class PivotFacet extends FrozenFacet { (childNode) => childNode.width, ); // 父节点 x 坐标 = 第一个未隐藏的子节点的 x 坐标 - const parentNodeX = firstVisibleChildNode?.x ?? 0; + const parentNodeX = firstVisibleChildNode?.x || 0; // 父节点宽度 = 所有子节点宽度之和 const parentNodeWidth = sumBy(parentNode.children, 'width'); @@ -400,7 +409,7 @@ export class PivotFacet extends FrozenFacet { } } - private getColLeafNodesWidth( + protected getColLeafNodesWidth( colNode: Node, colLeafNodes: Node[], rowLeafNodes: Node[], @@ -436,10 +445,10 @@ export class PivotFacet extends FrozenFacet { } // 4.2 网格自定义 - return this.getAdaptGridColWidth(colLeafNodes, rowHeaderWidth); + return this.getAdaptGridColWidth(colLeafNodes, colNode, rowHeaderWidth); } - private getRowNodeHeight(rowNode: Node): number { + protected getRowNodeHeight(rowNode: Node): number { if (!rowNode) { return 0; } @@ -452,14 +461,16 @@ export class PivotFacet extends FrozenFacet { rowCellStyle?.maxLines! > 1 && rowCellStyle?.wordWrap; if (this.isCustomRowCellHeight(rowNode) || !isEnableHeightAdaptive) { + rowNode.extra.isCustomHeight = true; + return defaultHeight || 0; } - return this.getNodeAdaptiveHeight( - rowNode, - this.textWrapTempRowCell, + return this.getNodeAdaptiveHeight({ + meta: rowNode, + cell: this.textWrapTempRowCell, defaultHeight, - ); + }); } /** @@ -468,7 +479,7 @@ export class PivotFacet extends FrozenFacet { * @param iconStyle 图标样式 * @returns 宽度 */ - private getExpectedCellIconWidth( + protected getExpectedCellIconWidth( cellType: CellType, useDefaultIcon: boolean, iconStyle: IconTheme, @@ -495,7 +506,7 @@ export class PivotFacet extends FrozenFacet { cellType, ); - iconCount = customIcons?.icons.length ?? 0; + iconCount = customIcons?.icons.length || 0; } // calc width @@ -505,7 +516,7 @@ export class PivotFacet extends FrozenFacet { : 0; } - private calculateRowNodesAllLevelSampleNodes(layoutResult: LayoutResult) { + protected calculateRowNodesAllLevelSampleNodes(layoutResult: LayoutResult) { const { rowsHierarchy, colLeafNodes } = layoutResult; const isTree = this.spreadsheet.isHierarchyTreeType(); @@ -528,16 +539,39 @@ export class PivotFacet extends FrozenFacet { levelSample.x = preLevelSample?.x + preLevelSample?.width; }); } + + rowsHierarchy.rootNode.width = rowsHierarchy.width; + } + + protected getRowLeafNodeHeight(rowLeafNode: Node) { + const { rowCell: rowCellStyle } = this.spreadsheet.options.style!; + const isEnableHeightAdaptive = + rowCellStyle?.maxLines! > 1 && rowCellStyle?.wordWrap; + + const currentBranchNodeHeights = isEnableHeightAdaptive + ? Node.getBranchNodes(rowLeafNode).map((rowNode) => + this.getRowNodeHeight(rowNode), + ) + : []; + + const defaultHeight = this.getRowNodeHeight(rowLeafNode); + // 父节点的高度是叶子节点的高度之和, 由于存在多行文本, 叶子节点的高度以当前路径下节点高度最大的为准: https://github.com/antvis/S2/issues/2678 + // 自定义高度除外: https://github.com/antvis/S2/issues/2594 + const nodeHeight = this.isCustomRowCellHeight(rowLeafNode) + ? defaultHeight + : max(currentBranchNodeHeights) ?? defaultHeight; + + return nodeHeight; } - private calculateRowNodesBBox(rowsHierarchy: Hierarchy) { + protected calculateRowNodesBBox(rowsHierarchy: Hierarchy) { const isTree = this.spreadsheet.isHierarchyTreeType(); const sampleNodeByLevel = rowsHierarchy.sampleNodesForAllLevels || []; let preLeafNode = Node.blankNode(); const rowNodes = rowsHierarchy.getNodes(); - rowNodes.forEach((currentNode, i) => { + rowNodes.forEach((currentNode) => { // 树状模式都按叶子处理节点 const isLeaf = isTree || (!isTree && currentNode.isLeaf); @@ -554,21 +588,11 @@ export class PivotFacet extends FrozenFacet { if (isLeaf) { // 2.1. 普通树状结构, 叶子节点各占一行, 2.2. 自定义树状结构 (平铺模式) const rowIndex = (preLeafNode?.rowIndex ?? -1) + 1; - const currentBranchNodeHeights = Node.getBranchNodes(currentNode).map( - (rowNode) => this.getRowNodeHeight(rowNode), - ); - - const defaultHeight = this.getRowNodeHeight(currentNode); - // 父节点的高度是叶子节点的高度之和, 由于存在多行文本, 叶子节点的高度以当前路径下节点高度最大的为准: https://github.com/antvis/S2/issues/2678 - // 自定义高度除外: https://github.com/antvis/S2/issues/2594 - const nodeHeight = this.isCustomRowCellHeight(currentNode) - ? defaultHeight - : max(currentBranchNodeHeights) ?? defaultHeight; + // 文本超过 1 行时再自适应单元格高度, 不然会频繁触发 GC, 导致性能降低: https://github.com/antvis/S2/issues/2693 currentNode.rowIndex ??= rowIndex; - currentNode.colIndex ??= i; currentNode.y = preLeafNode.y + preLeafNode.height; - currentNode.height = nodeHeight; + currentNode.height = this.getRowLeafNodeHeight(currentNode); preLeafNode = currentNode; // mark row hierarchy's height rowsHierarchy.height += currentNode.height; @@ -586,7 +610,7 @@ export class PivotFacet extends FrozenFacet { }); } - private calculateRowNodesCoordinate(layoutResult: LayoutResult) { + protected calculateRowNodesCoordinate(layoutResult: LayoutResult) { const { rowsHierarchy, rowLeafNodes } = layoutResult; const isTree = this.spreadsheet.isHierarchyTreeType(); @@ -609,7 +633,7 @@ export class PivotFacet extends FrozenFacet { } } - private adjustRowTotalNodesCoordinate(rowsHierarchy: Hierarchy) { + protected adjustRowTotalNodesCoordinate(rowsHierarchy: Hierarchy) { if (!isEmpty(this.spreadsheet.options.totals?.row)) { this.adjustTotalNodesCoordinate({ hierarchy: rowsHierarchy, @@ -628,7 +652,7 @@ export class PivotFacet extends FrozenFacet { * @description Auto calculate row no-leaf node's height and y coordinate * @param rowLeafNodes */ - private calculateRowNodeHeightAndY(rowLeafNodes: Node[]) { + protected calculateRowNodeHeightAndY(rowLeafNodes: Node[]) { // 3、in grid type, all no-leaf node's height, y are auto calculated let prevRowParent: Node | null = null; let i = 0; @@ -651,10 +675,8 @@ export class PivotFacet extends FrozenFacet { /** * 计算 grid 模式下 node 宽度 - * @param node - * @returns */ - private getGridRowNodesWidth(node: Node, colLeafNodes: Node[]): number { + protected getGridRowNodesWidth(node: Node, colLeafNodes: Node[]): number { const { rowCell } = this.spreadsheet.options.style!; const cellDraggedWidth = this.getRowCellDraggedWidth(node); @@ -679,10 +701,9 @@ export class PivotFacet extends FrozenFacet { } /** - * 计算树状模式等宽条件下的列宽 - * @returns number + * 计算树状模式等宽条件下的列宽 */ - private getAdaptTreeColWidth( + protected getAdaptTreeColWidth( col: Node, colLeafNodes: Node[], rowLeafNodes: Node[], @@ -707,7 +728,7 @@ export class PivotFacet extends FrozenFacet { ); } - private getColLabelLength(col: Node, rowLeafNodes: Node[]) { + protected getColLabelLength(col: Node, rowLeafNodes: Node[]) { // 如果 label 字段形如 "["xx","xxx"]",直接获取其长度 const labels = safeJsonParse(col?.value); @@ -759,7 +780,12 @@ export class PivotFacet extends FrozenFacet { /** * 计算平铺模式等宽条件下的列宽 */ - private getAdaptGridColWidth(colLeafNodes: Node[], rowHeaderWidth?: number) { + protected getAdaptGridColWidth( + colLeafNodes: Node[], + // eslint-disable-next-line @typescript-eslint/no-unused-vars + colNode?: Node, + rowHeaderWidth?: number, + ) { const { rows = [] } = this.spreadsheet.dataSet.fields; const { dataCell } = this.spreadsheet.options.style!; const rowHeaderColSize = rows.length; @@ -784,13 +810,15 @@ export class PivotFacet extends FrozenFacet { /** * 计算树状结构行头宽度 - * @returns number */ - private getTreeRowHeaderWidth(): number { + protected getTreeRowHeaderWidth(): number { const { rowCell } = this.spreadsheet.options.style!; - const { rows = [] } = this.spreadsheet.dataSet.fields; // 1. 用户拖拽或手动指定的行头宽度优先级最高 + if (isNumber(rowCell?.treeWidth)) { + return rowCell.treeWidth; + } + const customRowCellWidth = this.getCellCustomSize(null, rowCell?.width!); if (isNumber(customRowCellWidth)) { @@ -798,9 +826,7 @@ export class PivotFacet extends FrozenFacet { } // 2. 然后是计算 (+ icon province/city/level) - const treeHeaderLabel = rows - .map((field) => this.spreadsheet.dataSet.getFieldName(field)) - .join('/'); + const treeHeaderLabel = CornerHeader.getTreeCornerText(this.spreadsheet); const { bolderText: cornerCellTextStyle, icon: cornerIconStyle } = this.spreadsheet.theme.cornerCell!; @@ -810,20 +836,19 @@ export class PivotFacet extends FrozenFacet { * 额外增加 1,当内容和容器宽度恰好相等时会出现换行 */ const maxLabelWidth = - this.spreadsheet.measureTextWidth(treeHeaderLabel, cornerCellTextStyle) + + this.measureTextWidth(treeHeaderLabel, cornerCellTextStyle, false) + cornerIconStyle.size * 2 + cornerIconStyle.margin?.left + cornerIconStyle.margin?.right + this.rowCellTheme.padding?.left + - this.rowCellTheme.padding?.right + - 1; + this.rowCellTheme.padding?.right; const width = Math.max( - customRowCellWidth ?? DEFAULT_TREE_ROW_CELL_WIDTH, + customRowCellWidth ?? DEFAULT_ROW_CELL_TREE_WIDTH, maxLabelWidth, ); - return Number.isNaN(width) ? DEFAULT_TREE_ROW_CELL_WIDTH : width; + return Number.isNaN(width) ? DEFAULT_ROW_CELL_TREE_WIDTH : width; } /** @@ -834,11 +859,8 @@ export class PivotFacet extends FrozenFacet { * | label - icon | <- node * | label - icon | * | label - icon | - * - * @param node 目标节点 - * @returns 宽度 */ - private getCompactGridRowNodeWidth(node: Node): number { + protected getCompactGridRowNodeWidth(node: Node): number { const { bolderText: rowTextStyle, icon: rowIconStyle, @@ -869,7 +891,7 @@ export class PivotFacet extends FrozenFacet { ); const maxLabel = maxBy(allLabels, (label) => `${label}`.length); const rowNodeWidth = - this.spreadsheet.measureTextWidth(maxLabel!, rowTextStyle) + + this.measureTextWidth(maxLabel!, rowTextStyle) + rowIconWidth + rowCellStyle!.padding!.left! + rowCellStyle!.padding!.right! + @@ -883,7 +905,7 @@ export class PivotFacet extends FrozenFacet { cornerIconStyle!, ); const fieldNameNodeWidth = - this.spreadsheet.measureTextWidth(fieldName, cornerTextStyle) + + this.measureTextWidth(fieldName, cornerTextStyle) + cornerIconWidth + cornerCellStyle!.padding!.left! + cornerCellStyle!.padding!.right!; @@ -897,7 +919,7 @@ export class PivotFacet extends FrozenFacet { return Math.max(rowNodeWidth, fieldNameNodeWidth); } - private getCompactGridColNodeWidth(colNode: Node, rowLeafNodes: Node[]) { + protected getCompactGridColNodeWidth(colNode: Node, rowLeafNodes: Node[]) { const { bolderText: colCellTextStyle, cell: colCellStyle, @@ -918,8 +940,7 @@ export class PivotFacet extends FrozenFacet { colIconStyle!, ); const leafNodeWidth = - this.spreadsheet.measureTextWidth(leafNodeLabel, colCellTextStyle) + - colIconWidth; + this.measureTextWidth(leafNodeLabel, colCellTextStyle) + colIconWidth; // 采样 50 个 label,逐个计算找出最长的 label let maxDataLabel = ''; @@ -964,7 +985,7 @@ export class PivotFacet extends FrozenFacet { dataCellIconStyle?.margin?.left + dataCellIconStyle?.margin?.right : 0; - const cellLabelWidth = this.spreadsheet.measureTextWidth( + const cellLabelWidth = this.measureTextWidth( cellLabel as string, dataCellTextStyle, ); @@ -993,7 +1014,7 @@ export class PivotFacet extends FrozenFacet { ); // 取列头/数值字体最大的文本宽度: https://github.com/antvis/S2/issues/2385 - const maxTextWidth = this.spreadsheet.measureTextWidth(maxLabel, { + const maxTextWidth = this.measureTextWidth(maxLabel, { ...colCellTextStyle, fontSize: Math.max(dataCellTextStyle.fontSize, colCellTextStyle.fontSize), }); @@ -1057,12 +1078,20 @@ export class PivotFacet extends FrozenFacet { public getContentWidth(): number { const { rowsHierarchy, colsHierarchy } = this.layoutResult; - return rowsHierarchy.width + colsHierarchy.width; + return ( + rowsHierarchy.width + + colsHierarchy.width + + Frame.getVerticalBorderWidth(this.spreadsheet) + ); } public getContentHeight(): number { const { rowsHierarchy, colsHierarchy } = this.layoutResult; - return rowsHierarchy.height + colsHierarchy.height; + return ( + rowsHierarchy.height + + colsHierarchy.height + + Frame.getHorizontalBorderWidth(this.spreadsheet) + ); } } diff --git a/packages/s2-core/src/facet/table-facet.ts b/packages/s2-core/src/facet/table-facet.ts index 452d8d1f67..1c566f91e9 100644 --- a/packages/s2-core/src/facet/table-facet.ts +++ b/packages/s2-core/src/facet/table-facet.ts @@ -10,7 +10,7 @@ import { set, } from 'lodash'; import { TableColCell, TableDataCell, TableSeriesNumberCell } from '../cell'; -import { i18n } from '../common'; +import { LAYOUT_SAMPLE_COUNT, i18n } from '../common'; import { EMPTY_PLACEHOLDER_GROUP_CONTAINER_Z_INDEX, KEY_GROUP_EMPTY_PLACEHOLDER, @@ -22,6 +22,7 @@ import { import { DebuggerUtil } from '../common/debug'; import type { CellCallbackParams, + Data, DataItem, FilterParam, LayoutResult, @@ -61,6 +62,10 @@ export class TableFacet extends FrozenFacet { this.spreadsheet.on(S2Event.RANGE_FILTER, this.onFilterHandler); } + protected getCornerCellInstance() { + return null; + } + protected override getRowCellInstance(node: ViewMeta) { const { dataCell } = this.spreadsheet.options; @@ -82,6 +87,10 @@ export class TableFacet extends FrozenFacet { } public render() { + if (!this.shouldRender()) { + return; + } + super.render(); this.renderEmptyPlaceholder(); } @@ -116,7 +125,7 @@ export class TableFacet extends FrozenFacet { const iconX = viewportWidth / 2 - icon.width / 2; const iconY = height / 2 + maxY - icon.height / 2 + icon.margin.top; const text = empty?.description ?? i18n('暂无数据'); - const descWidth = this.spreadsheet.measureTextWidth(text, description); + const descWidth = this.measureTextWidth(text, description, false); const descX = viewportWidth / 2 - descWidth / 2; const descY = iconY + icon.height + icon.margin.bottom; @@ -162,16 +171,19 @@ export class TableFacet extends FrozenFacet { const rowHeight = this.getRowCellHeight(node); if (this.isCustomRowCellHeight(node)) { + // 标记当前行是否为自定义高度 + this.customRowHeightStatusMap[viewMeta?.rowIndex] = true; + return rowHeight || 0; } const defaultHeight = this.getCellHeightByRowIndex(viewMeta?.rowIndex); - return this.getNodeAdaptiveHeight( - viewMeta, - this.textWrapTempRowCell, + return this.getNodeAdaptiveHeight({ + meta: viewMeta, + cell: this.textWrapTempRowCell, defaultHeight, - ); + }); } private getCellHeightByRowIndex(rowIndex: number) { @@ -216,11 +228,14 @@ export class TableFacet extends FrozenFacet { protected calculateRowOffsets() { const { style } = this.spreadsheet.options; const heightByField = style?.rowCell?.heightByField; + const isEnableHeightAdaptive = + style?.dataCell?.maxLines! > 1 && style?.dataCell?.wordWrap; - if (keys(heightByField!).length || style?.dataCell?.maxLines! > 1) { + if (keys(heightByField!).length || isEnableHeightAdaptive) { const data = this.spreadsheet.dataSet.getDisplayDataSet(); this.textWrapNodeHeightCache.clear(); + this.customRowHeightStatusMap = {}; this.rowOffsets = [0]; this.lastRowOffset = 0; @@ -376,7 +391,7 @@ export class TableFacet extends FrozenFacet { if (options.seriesNumber?.enable && colNode.field === SERIES_NUMBER_FIELD) { data = rowIndex + 1; } else { - data = dataSet.getCellData({ + data = (dataSet as TableDataSet).getCellData({ query: { field: colNode.field, rowIndex, @@ -397,7 +412,7 @@ export class TableFacet extends FrozenFacet { height: cellHeight, data: { [colNode.field]: data, - } as unknown as SimpleData, + } as unknown as Data, rowIndex, colIndex, isTotals: false, @@ -465,19 +480,18 @@ export class TableFacet extends FrozenFacet { private calculateColNodesHeight(colsHierarchy: Hierarchy) { const colNodes = colsHierarchy.getNodes(); - colNodes.forEach((currentNode) => { - if (currentNode.level === 0) { - currentNode.y = 0; + colNodes.forEach((colNode) => { + if (colNode.level === 0) { + colNode.y = 0; } else { - currentNode.y = - currentNode?.parent?.y! + currentNode?.parent?.height! ?? 0; + colNode.y = colNode?.parent?.y! + colNode?.parent?.height! || 0; } - currentNode.height = this.getColNodeHeight( - currentNode, + colNode.height = this.getColNodeHeight({ + colNode, colsHierarchy, - false, - ); + useCache: false, + }); }); } @@ -485,10 +499,11 @@ export class TableFacet extends FrozenFacet { colLeafNodes: Node[], colsHierarchy: Hierarchy, ) { + // 先计算宽度, 再计算高度, 确保计算多行文本时能获取到正确的最大文本宽度 this.calculateColLeafNodesWidth(colLeafNodes, colsHierarchy); + this.calculateColNodeWidthAndX(colLeafNodes); this.updateColsHierarchySampleMaxHeightNodes(colsHierarchy); this.calculateColNodesHeight(colsHierarchy); - this.calculateColNodeWidthAndX(colLeafNodes); this.updateCustomFieldsSampleNodes(colsHierarchy); this.adjustCustomColLeafNodesHeight({ leafNodes: colLeafNodes, @@ -521,14 +536,49 @@ export class TableFacet extends FrozenFacet { } } + private getCompactColNodeWidth(colNode: Node) { + const { theme, dataSet } = this.spreadsheet; + const { bolderText: colCellTextStyle } = theme.colCell!; + const { text: dataCellTextStyle, cell: cellStyle } = theme.dataCell!; + const data = dataSet.getDisplayDataSet(); + const formatter = dataSet.getFieldFormatter(colNode.field); + + // 采样前 50,找出表身最长的数据 + const maxLabel = maxBy( + data + ?.slice(0, LAYOUT_SAMPLE_COUNT) + .map( + (data) => + `${formatter?.(data[colNode.field]) ?? data[colNode.field]}`, + ), + (label) => this.measureTextWidth(label, dataCellTextStyle), + ); + + DebuggerUtil.getInstance().logger( + 'Max Label In Col:', + colNode.field, + maxLabel, + ); + + const maxLabelWidth = + this.measureTextWidth(maxLabel, dataCellTextStyle) + + cellStyle!.padding!.left! + + cellStyle!.padding!.right!; + + // 计算表头 label+icon 占用的空间 + const colHeaderNodeWidth = + this.measureTextWidth(colNode.value, colCellTextStyle) + + getOccupiedWidthForTableCol(this.spreadsheet, colNode, theme.colCell!); + + return Math.max(colHeaderNodeWidth, maxLabelWidth); + } + private getColLeafNodesWidth( colNode: Node, adaptiveColWidth: number, ): number { - const { spreadsheet } = this; - const { dataSet } = spreadsheet; - const { colCell } = spreadsheet.options.style!; - const layoutWidthType = spreadsheet.getLayoutWidthType(); + const { colCell } = this.spreadsheet.options.style!; + const layoutWidthType = this.spreadsheet.getLayoutWidthType(); const cellDraggedWidth = this.getColCellDraggedWidth(colNode); // 1. 拖拽后的宽度优先级最高 @@ -543,60 +593,18 @@ export class TableFacet extends FrozenFacet { return cellCustomWidth; } - let colWidth: number; - - if (layoutWidthType === LayoutWidthType.Compact) { - const data = dataSet.getDisplayDataSet(); - const formatter = dataSet.getFieldFormatter(colNode.field); - - // 采样前50,找出表身最长的数据 - const maxLabel = maxBy( - data - ?.slice(0, 50) - .map( - (data) => - `${formatter?.(data[colNode.field]) ?? data[colNode.field]}`, - ), - (label) => spreadsheet.measureTextWidthRoughly(label), - ); - - DebuggerUtil.getInstance().logger( - 'Max Label In Col:', - colNode.field, - maxLabel, - ); - - const { bolderText: colCellTextStyle } = spreadsheet.theme.colCell!; - const { text: dataCellTextStyle, cell: cellStyle } = - spreadsheet.theme.dataCell!; - - // 额外添加一像素余量,防止 maxLabel 有多个同样长度情况下,一些 label 不能展示完全 - const EXTRA_PIXEL = 1; - const maxLabelWidth = - spreadsheet.measureTextWidth(maxLabel, dataCellTextStyle) + - cellStyle!.padding!.left! + - cellStyle!.padding!.right! + - EXTRA_PIXEL; - - // 计算表头 label+icon 占用的空间 - const colHeaderNodeWidth = - spreadsheet.measureTextWidth(colNode.value, colCellTextStyle) + - getOccupiedWidthForTableCol( - this.spreadsheet, - colNode, - spreadsheet.theme.colCell!, - ); - - colWidth = Math.max(colHeaderNodeWidth, maxLabelWidth); - } else { - colWidth = adaptiveColWidth; + // 3. 序号列, 使用配置宽度 + if (colNode.field === SERIES_NUMBER_FIELD) { + return this.getSeriesNumberWidth(); } - if (colNode.field === SERIES_NUMBER_FIELD) { - colWidth = this.getSeriesNumberWidth(); + // 4. 紧凑模式 + if (layoutWidthType === LayoutWidthType.Compact) { + return this.getCompactColNodeWidth(colNode); } - return colWidth; + // 5. 默认自适应列宽 + return adaptiveColWidth; } public getViewCellHeights() { @@ -613,7 +621,6 @@ export class TableFacet extends FrozenFacet { this.spreadsheet.dataSet.getDisplayDataSet().length ); }, - getCellOffsetY: (offset: number) => { if (offset <= 0) { return 0; @@ -625,9 +632,7 @@ export class TableFacet extends FrozenFacet { return offset * defaultCellHeight; }, - getTotalLength: () => this.spreadsheet.dataSet.getDisplayDataSet().length, - getIndexRange: (minHeight: number, maxHeight: number) => { if (this.rowOffsets) { return getIndexRangeWithOffsets( @@ -743,6 +748,10 @@ export class TableFacet extends FrozenFacet { const { getTotalHeight } = this.getViewCellHeights(); const { colsHierarchy } = this.layoutResult; - return getTotalHeight() + colsHierarchy.height; + return ( + getTotalHeight() + + colsHierarchy.height + + Frame.getHorizontalBorderWidth(this.spreadsheet) + ); } } diff --git a/packages/s2-core/src/index.ts b/packages/s2-core/src/index.ts index fbb947e838..b7b9384f7b 100644 --- a/packages/s2-core/src/index.ts +++ b/packages/s2-core/src/index.ts @@ -1,14 +1,16 @@ export { FederatedPointerEvent as GEvent } from '@antv/g'; export { buildTableHierarchy } from './facet/layout/build-table-hierarchy'; export { Hierarchy } from './facet/layout/hierarchy'; -export { Node } from './facet/layout/node'; -export { getTheme } from './theme'; +export { Node, type NodeProperties } from './facet/layout/node'; export * from './cell'; export * from './common'; export * from './data-set'; export * from './facet'; export * from './interaction'; +export * from './shared'; export * from './sheet-type'; +export * from './theme'; +export * from './ui/scrollbar'; export * from './ui/tooltip'; export * from './utils'; diff --git a/packages/s2-core/src/interaction/base-event.ts b/packages/s2-core/src/interaction/base-event.ts index 6c99b129f3..b5e2c66dda 100644 --- a/packages/s2-core/src/interaction/base-event.ts +++ b/packages/s2-core/src/interaction/base-event.ts @@ -2,9 +2,14 @@ import type { FederatedPointerEvent as CanvasEvent, DisplayObject, } from '@antv/g'; -import type { CellAppendInfo } from '../common'; +import { + type CellAppendInfo, + type TooltipOperatorMenuItems, + type TooltipOperatorOptions, +} from '../common'; import type { SpreadSheet } from '../sheet-type'; import { getAppendInfo } from '../utils/interaction/common'; +import { getTooltipOptions, getTooltipVisibleOperator } from '../utils/tooltip'; export interface BaseEventImplement { bindEvents: () => void; @@ -30,6 +35,19 @@ export abstract class BaseEvent { return cellAppendInfo?.isLinkFieldText; }; + protected getTooltipOperator( + event: CanvasEvent, + defaultMenus: TooltipOperatorMenuItems = [], + ): TooltipOperatorOptions { + const cell = this.spreadsheet.getCell(event.target)!; + const { operation } = getTooltipOptions(this.spreadsheet, event)!; + + return getTooltipVisibleOperator(operation!, { + defaultMenus, + cell, + }); + } + public reset() {} public abstract bindEvents(): void; diff --git a/packages/s2-core/src/interaction/base-interaction/click/corner-cell-click.ts b/packages/s2-core/src/interaction/base-interaction/click/corner-cell-click.ts index ddfcd2ef0a..9c8031dd8c 100644 --- a/packages/s2-core/src/interaction/base-interaction/click/corner-cell-click.ts +++ b/packages/s2-core/src/interaction/base-interaction/click/corner-cell-click.ts @@ -4,8 +4,10 @@ import type { CornerCell } from '../../../cell'; import { CellType, CornerNodeType, + InteractionName, type CellMeta, type Data, + type S2CellType, } from '../../../common'; import { InteractionStateName, @@ -113,6 +115,14 @@ export class CornerCellClick extends BaseEvent implements BaseEventImplement { }); } + private emitSelectEvent(event: CanvasEvent, targetCell: S2CellType) { + this.spreadsheet.interaction.emitSelectEvent({ + event, + targetCell, + interactionName: InteractionName.CORNER_CELL_CLICK, + }); + } + private selectCells(nodes: Node[], event: CanvasEvent) { const { interaction } = this.spreadsheet; const sample = nodes[0]?.belongsCell; @@ -121,10 +131,7 @@ export class CornerCellClick extends BaseEvent implements BaseEventImplement { if (sample && interaction.isSelectedCell(sample)) { interaction.reset(); - this.spreadsheet.emit( - S2Event.GLOBAL_SELECTED, - interaction.getActiveCells(), - ); + this.emitSelectEvent(event, cornerCell); return; } @@ -142,17 +149,16 @@ export class CornerCellClick extends BaseEvent implements BaseEventImplement { cornerCell?.updateByState(InteractionStateName.SELECTED); this.showTooltip(event); - this.spreadsheet.emit( - S2Event.GLOBAL_SELECTED, - interaction.getActiveCells(), - ); + this.emitSelectEvent(event, cornerCell); } private showTooltip(event: CanvasEvent) { // 角头的选中是维值, 不需要计算数值总和, 显示 [`xx 项已选中`] 即可 const selectedData = this.spreadsheet.interaction.getActiveCells(); + const operator = this.getTooltipOperator(event); this.spreadsheet.showTooltipWithInfo(event, [], { + operator, data: { summaries: [ { diff --git a/packages/s2-core/src/interaction/base-interaction/click/data-cell-click.ts b/packages/s2-core/src/interaction/base-interaction/click/data-cell-click.ts index ccd696beef..57414b4f8f 100644 --- a/packages/s2-core/src/interaction/base-interaction/click/data-cell-click.ts +++ b/packages/s2-core/src/interaction/base-interaction/click/data-cell-click.ts @@ -1,13 +1,13 @@ import type { FederatedPointerEvent as CanvasEvent } from '@antv/g'; import type { DataCell } from '../../../cell/data-cell'; import { + InteractionName, InteractionStateName, InterceptType, S2Event, } from '../../../common/constant'; import type { TooltipData, - TooltipOperatorOptions, ViewMeta, ViewMetaData, } from '../../../common/interface'; @@ -15,10 +15,6 @@ import { afterSelectDataCells, getCellMeta, } from '../../../utils/interaction/select-event'; -import { - getTooltipOptions, - getTooltipVisibleOperator, -} from '../../../utils/tooltip'; import { BaseEvent, type BaseEventImplement } from '../../base-event'; export class DataCellClick extends BaseEvent implements BaseEventImplement { @@ -63,10 +59,11 @@ export class DataCellClick extends BaseEvent implements BaseEventImplement { interaction.reset(); // https://github.com/antvis/S2/issues/2447 - this.spreadsheet.emit( - S2Event.GLOBAL_SELECTED, - interaction.getActiveCells(), - ); + interaction.emitSelectEvent({ + event, + targetCell: cell, + interactionName: InteractionName.DATA_CELL_CLICK, + }); } return; @@ -77,7 +74,12 @@ export class DataCellClick extends BaseEvent implements BaseEventImplement { stateName: InteractionStateName.SELECTED, onUpdateCells: afterSelectDataCells, }); - this.spreadsheet.emit(S2Event.GLOBAL_SELECTED, [cell]); + interaction.emitSelectEvent({ + event, + targetCell: cell, + interactionName: InteractionName.DATA_CELL_CLICK, + cells: [cell], + }); this.showTooltip(event, meta); // 点击单元格,高亮对应的行头、列头 @@ -85,16 +87,7 @@ export class DataCellClick extends BaseEvent implements BaseEventImplement { InteractionStateName.SELECTED, meta, ); - }); - } - - private getTooltipOperator(event: CanvasEvent): TooltipOperatorOptions { - const cell = this.spreadsheet.getCell(event.target)!; - const { operation } = getTooltipOptions(this.spreadsheet, event)!; - - return getTooltipVisibleOperator(operation!, { - defaultMenus: [], - cell, + this.spreadsheet.emit(S2Event.DATA_CELL_CLICK_TRIGGERED_PRIVATE, cell); }); } diff --git a/packages/s2-core/src/interaction/base-interaction/click/row-column-click.ts b/packages/s2-core/src/interaction/base-interaction/click/row-column-click.ts index a8de1cd227..fcbac51fe7 100644 --- a/packages/s2-core/src/interaction/base-interaction/click/row-column-click.ts +++ b/packages/s2-core/src/interaction/base-interaction/click/row-column-click.ts @@ -3,6 +3,7 @@ import { difference, findLast } from 'lodash'; import { SeriesNumberCell } from '../../../cell'; import { CellType, + InteractionName, InterceptType, S2Event, getTooltipOperatorHiddenColumnsMenu, @@ -25,15 +26,11 @@ import { isMouseEventWithMeta, isMultiSelectionKey, } from '../../../utils/interaction/select-event'; -import { - getTooltipOptions, - getTooltipVisibleOperator, - mergeCellInfo, -} from '../../../utils/tooltip'; +import { getTooltipOptions, mergeCellInfo } from '../../../utils/tooltip'; import type { ViewMeta } from './../../../common/interface/basic'; export class RowColumnClick extends BaseEvent implements BaseEventImplement { - private isMultiSelection = false; + protected isMultiSelection = false; public bindEvents() { this.bindKeyboardDown(); @@ -49,7 +46,7 @@ export class RowColumnClick extends BaseEvent implements BaseEventImplement { this.spreadsheet.interaction.removeIntercepts([InterceptType.CLICK]); } - private bindKeyboardDown() { + protected bindKeyboardDown() { this.spreadsheet.on( S2Event.GLOBAL_KEYBOARD_DOWN, (event: KeyboardEvent) => { @@ -60,7 +57,7 @@ export class RowColumnClick extends BaseEvent implements BaseEventImplement { ); } - private bindKeyboardUp() { + protected bindKeyboardUp() { this.spreadsheet.on(S2Event.GLOBAL_KEYBOARD_UP, (event: KeyboardEvent) => { if (isMultiSelectionKey(event)) { this.reset(); @@ -68,7 +65,7 @@ export class RowColumnClick extends BaseEvent implements BaseEventImplement { }); } - private bindMouseMove() { + protected bindMouseMove() { this.spreadsheet.on(S2Event.GLOBAL_MOUSE_MOVE, (event) => { // 当快捷键被系统拦截后,按需补充调用一次 reset if (this.isMultiSelection && !isMouseEventWithMeta(event)) { @@ -77,19 +74,19 @@ export class RowColumnClick extends BaseEvent implements BaseEventImplement { }); } - private bindRowCellClick() { + protected bindRowCellClick() { this.spreadsheet.on(S2Event.ROW_CELL_CLICK, (event: CanvasEvent) => { this.handleRowColClick(event); }); } - private bindColCellClick() { + protected bindColCellClick() { this.spreadsheet.on(S2Event.COL_CELL_CLICK, (event: CanvasEvent) => { this.handleRowColClick(event); }); } - private handleRowColClick = (event: CanvasEvent) => { + protected handleRowColClick = (event: CanvasEvent) => { event.stopPropagation(); if (this.isLinkFieldText(event.target)) { @@ -106,10 +103,23 @@ export class RowColumnClick extends BaseEvent implements BaseEventImplement { const { multiSelection: enableMultiSelection } = options.interaction!; // 关闭了多选就算按下了 Ctrl/Commend, 行/列也按单选处理 const isMultiSelection = !!(enableMultiSelection && this.isMultiSelection); + const multiSelectionName = + cell.cellType === CellType.ROW_CELL + ? InteractionName.ROW_CELL_MULTI_SELECTION + : InteractionName.COL_CELL_MULTI_SELECTION; + + const defaultSelectionName = + cell.cellType === CellType.ROW_CELL + ? InteractionName.ROW_CELL_CLICK + : InteractionName.COL_CELL_CLICK; const success = interaction.changeCell({ + event, cell, isMultiSelection, + interactionName: isMultiSelection + ? multiSelectionName + : defaultSelectionName, // 能主动触发点击一定是在可视范围内, 无需额外触发滚动 scrollIntoView: false, }); @@ -119,7 +129,7 @@ export class RowColumnClick extends BaseEvent implements BaseEventImplement { } }; - private showTooltip(event: CanvasEvent) { + protected showTooltip(event: CanvasEvent) { const { operation, enable: showTooltip } = getTooltipOptions( this.spreadsheet, event, @@ -134,7 +144,7 @@ export class RowColumnClick extends BaseEvent implements BaseEventImplement { ? mergeCellInfo(interaction.getActiveCells()) : []; - const operator = this.getTooltipOperator(event, operation!); + const operator = this.getHeaderTooltipOperator(event, operation!); this.spreadsheet.showTooltipWithInfo(event, cellInfos, { onlyShowCellText: true, @@ -142,7 +152,7 @@ export class RowColumnClick extends BaseEvent implements BaseEventImplement { }); } - private getTooltipOperator( + protected getHeaderTooltipOperator( event: CanvasEvent, operation: TooltipOperation, ): TooltipOperatorOptions { @@ -172,19 +182,16 @@ export class RowColumnClick extends BaseEvent implements BaseEventImplement { const menus = enableHiddenColumnOperator ? [hiddenColumnsMenu] : []; - return getTooltipVisibleOperator(operation, { - defaultMenus: menus, - cell, - }); + return this.getTooltipOperator(event, menus); } - private bindTableColExpand() { + protected bindTableColExpand() { this.spreadsheet.on(S2Event.COL_CELL_EXPANDED, (node) => { this.handleExpandIconClick(node); }); } - private getHideColumnField = (node: Node | ViewMeta) => { + protected getHideColumnField = (node: Node | ViewMeta) => { if ((node as Node).extra?.isCustomNode) { return node.id; } @@ -217,7 +224,7 @@ export class RowColumnClick extends BaseEvent implements BaseEventImplement { await hideColumnsByThunkGroup(this.spreadsheet, selectedColumnFields, true); } - private async handleExpandIconClick(node: Node) { + protected async handleExpandIconClick(node: Node) { const lastHiddenColumnsDetail = this.spreadsheet.store.get( 'hiddenColumnsDetail', [], diff --git a/packages/s2-core/src/interaction/base-interaction/hover.ts b/packages/s2-core/src/interaction/base-interaction/hover.ts index 663af4dad1..07c66584f1 100644 --- a/packages/s2-core/src/interaction/base-interaction/hover.ts +++ b/packages/s2-core/src/interaction/base-interaction/hover.ts @@ -1,5 +1,6 @@ import type { FederatedPointerEvent as CanvasEvent } from '@antv/g'; import { isBoolean, isEmpty } from 'lodash'; +import { DataCell } from '../../cell'; import { S2Event } from '../../common/constant'; import { HOVER_FOCUS_DURATION, @@ -25,7 +26,7 @@ export class HoverEvent extends BaseEvent implements BaseEventImplement { this.bindHeaderCellHover(); } - private changeStateToHoverFocus(cell: S2CellType, event: CanvasEvent) { + private changeStateToHoverFocus(cell: DataCell, event: CanvasEvent) { if (!cell) { return; } @@ -60,6 +61,8 @@ export class HoverEvent extends BaseEvent implements BaseEventImplement { ); } + this.spreadsheet.emit(S2Event.DATA_CELL_HOVER_TRIGGERED_PRIVATE, cell); + const data = this.getCellData(meta, onlyShowCellText); this.spreadsheet.showTooltipWithInfo(event, data, options); @@ -85,7 +88,7 @@ export class HoverEvent extends BaseEvent implements BaseEventImplement { * @description handle the row or column header hover state * @param event */ - private handleHeaderHover(event: CanvasEvent) { + protected handleHeaderHover(event: CanvasEvent) { const cell = this.spreadsheet.getCell(event.target) as S2CellType; if (isEmpty(cell)) { @@ -163,21 +166,22 @@ export class HoverEvent extends BaseEvent implements BaseEventImplement { public bindDataCellHover() { this.spreadsheet.on(S2Event.DATA_CELL_HOVER, (event: CanvasEvent) => { // FIXME: 趋势分析表 hover 的时候拿到的 event target 是错误的 - const cell = this.spreadsheet.getCell(event.target); + const cell = this.spreadsheet.getCell(event.target); if (isEmpty(cell)) { return; } const { interaction, options } = this.spreadsheet; - const { interaction: interactionOptions } = options; - const meta = cell?.getMeta() as ViewMeta; // 避免在同一单元格内鼠标移动造成的多次渲染 if (interaction.isActiveCell(cell)) { return; } + const { interaction: interactionOptions } = options; + const meta = cell?.getMeta() as ViewMeta; + interaction.changeState({ cells: [getCellMeta(cell)], stateName: InteractionStateName.HOVER, @@ -193,6 +197,8 @@ export class HoverEvent extends BaseEvent implements BaseEventImplement { if (interactionOptions?.hoverFocus) { this.changeStateToHoverFocus(cell, event); } + + this.spreadsheet.emit(S2Event.DATA_CELL_HOVER_TRIGGERED_PRIVATE, cell); }); } diff --git a/packages/s2-core/src/interaction/brush-selection/base-brush-selection.ts b/packages/s2-core/src/interaction/brush-selection/base-brush-selection.ts index e20ac3f6cd..fb70510a8e 100644 --- a/packages/s2-core/src/interaction/brush-selection/base-brush-selection.ts +++ b/packages/s2-core/src/interaction/brush-selection/base-brush-selection.ts @@ -23,6 +23,7 @@ import type { BrushAutoScrollConfig, BrushPoint, BrushRange, + CellSelectedDetail, OnUpdateCells, S2CellType, ScrollOffsetConfig, @@ -157,8 +158,11 @@ export class BaseBrushSelection let newX = this.endBrushPoint?.x + x; let newY = this.endBrushPoint?.y + y; - let needScrollForX = true; - let needScrollForY = true; + // 有滚动条才需要滚动 + let needScrollForX = isRowHeader + ? !!facet.hRowScrollBar + : !!facet.hScrollBar; + let needScrollForY = !!facet.vScrollBar; const vScrollBarWidth = facet.vScrollBar?.getBBox()?.width; // 额外加缩进,保证 getShape 在 panelBox 内 const extraPixel = 2; @@ -697,7 +701,7 @@ export class BaseBrushSelection if (this.isValidBrushSelection()) { this.addBrushIntercepts(); - this.updateSelectedCells(); + this.updateSelectedCells(event); const tooltipData = getCellsTooltipData(this.spreadsheet); @@ -785,9 +789,14 @@ export class BaseBrushSelection public emitBrushSelectionEvent( event: S2Event, scrollBrushRangeCells: S2CellType[], + detail: CellSelectedDetail, ) { - this.spreadsheet.emit(event, scrollBrushRangeCells); - this.spreadsheet.emit(S2Event.GLOBAL_SELECTED, scrollBrushRangeCells); + this.spreadsheet.emit(event, scrollBrushRangeCells, detail); + this.spreadsheet.emit( + S2Event.GLOBAL_SELECTED, + scrollBrushRangeCells, + detail, + ); // 未刷选到有效单元格, 允许 hover if (isEmpty(scrollBrushRangeCells)) { @@ -813,7 +822,8 @@ export class BaseBrushSelection protected bindMouseMove() {} - protected updateSelectedCells() {} + // eslint-disable-next-line @typescript-eslint/no-unused-vars + protected updateSelectedCells(event: MouseEvent) {} protected getPrepareSelectMaskPosition(brushRange: BrushRange): PointLike { return { diff --git a/packages/s2-core/src/interaction/brush-selection/col-brush-selection.ts b/packages/s2-core/src/interaction/brush-selection/col-brush-selection.ts index 8b2d4f9f16..2f905c818b 100644 --- a/packages/s2-core/src/interaction/brush-selection/col-brush-selection.ts +++ b/packages/s2-core/src/interaction/brush-selection/col-brush-selection.ts @@ -1,9 +1,10 @@ import type { FederatedPointerEvent as CanvasEvent, PointLike } from '@antv/g'; -import { isEmpty, map } from 'lodash'; +import { map } from 'lodash'; import type { ColCell } from '../../cell/col-cell'; import { InterceptType, S2Event } from '../../common/constant'; import { InteractionBrushSelectionStage, + InteractionName, InteractionStateName, } from '../../common/constant/interaction'; import type { OnUpdateCells, ViewMeta } from '../../common/interface'; @@ -98,7 +99,7 @@ export class ColCellBrushSelection extends BaseBrushSelection { } // 最终刷选的 cell - protected updateSelectedCells() { + protected updateSelectedCells(event: MouseEvent) { const { interaction, facet } = this.spreadsheet; interaction.changeState({ @@ -109,15 +110,15 @@ export class ColCellBrushSelection extends BaseBrushSelection { stateName: InteractionStateName.COL_CELL_BRUSH_SELECTED, }); - this.spreadsheet.emit( + this.emitBrushSelectionEvent( S2Event.COL_CELL_BRUSH_SELECTION, this.brushRangeCells, + { + event, + targetCell: this.brushRangeCells[0], + interactionName: InteractionName.COL_CELL_BRUSH_SELECTION, + }, ); - this.spreadsheet.emit(S2Event.GLOBAL_SELECTED, this.brushRangeCells); - // 未刷选到有效格子, 允许 hover - if (isEmpty(this.brushRangeCells)) { - interaction.removeIntercepts([InterceptType.HOVER]); - } } protected addBrushIntercepts() { diff --git a/packages/s2-core/src/interaction/brush-selection/data-cell-brush-selection.ts b/packages/s2-core/src/interaction/brush-selection/data-cell-brush-selection.ts index 49acbdccd5..729022cf3d 100644 --- a/packages/s2-core/src/interaction/brush-selection/data-cell-brush-selection.ts +++ b/packages/s2-core/src/interaction/brush-selection/data-cell-brush-selection.ts @@ -5,6 +5,7 @@ import { S2Event } from '../../common/constant'; import { CellType, InteractionBrushSelectionStage, + InteractionName, InteractionStateName, } from '../../common/constant/interaction'; import type { BrushRange, CellMeta, ViewMeta } from '../../common/interface'; @@ -99,7 +100,7 @@ export class DataCellBrushSelection extends BaseBrushSelection { }; // 最终刷选的 cell - protected updateSelectedCells() { + protected updateSelectedCells(event: MouseEvent) { const brushRange = this.getBrushRange(); const selectedCellMetas = this.getSelectedCellMetas(brushRange); @@ -115,6 +116,11 @@ export class DataCellBrushSelection extends BaseBrushSelection { this.emitBrushSelectionEvent( S2Event.DATA_CELL_BRUSH_SELECTION, scrollBrushRangeCells, + { + event, + targetCell: scrollBrushRangeCells[0], + interactionName: InteractionName.DATA_CELL_BRUSH_SELECTION, + }, ); } diff --git a/packages/s2-core/src/interaction/brush-selection/row-brush-selection.ts b/packages/s2-core/src/interaction/brush-selection/row-brush-selection.ts index 5298437bb3..c49c50a241 100644 --- a/packages/s2-core/src/interaction/brush-selection/row-brush-selection.ts +++ b/packages/s2-core/src/interaction/brush-selection/row-brush-selection.ts @@ -4,6 +4,7 @@ import { RowCell } from '../../cell'; import { InterceptType, S2Event } from '../../common/constant'; import { InteractionBrushSelectionStage, + InteractionName, InteractionStateName, ScrollDirection, } from '../../common/constant/interaction'; @@ -95,7 +96,7 @@ export class RowCellBrushSelection extends BaseBrushSelection { }; // 最终刷选的 cells - protected updateSelectedCells() { + protected updateSelectedCells(event: MouseEvent) { const selectedRowNodes = this.getSelectedRowNodes(); const scrollBrushRangeCells = this.getScrollBrushRangeCells(selectedRowNodes); @@ -110,6 +111,11 @@ export class RowCellBrushSelection extends BaseBrushSelection { this.emitBrushSelectionEvent( S2Event.ROW_CELL_BRUSH_SELECTION, scrollBrushRangeCells, + { + event, + targetCell: scrollBrushRangeCells[0], + interactionName: InteractionName.ROW_CELL_BRUSH_SELECTION, + }, ); } diff --git a/packages/s2-core/src/interaction/data-cell-multi-selection.ts b/packages/s2-core/src/interaction/data-cell-multi-selection.ts index ca3162ec09..e51c54a322 100644 --- a/packages/s2-core/src/interaction/data-cell-multi-selection.ts +++ b/packages/s2-core/src/interaction/data-cell-multi-selection.ts @@ -3,6 +3,7 @@ import { isEmpty } from 'lodash'; import type { DataCell } from '../cell'; import { CellType, + InteractionName, InteractionStateName, InterceptType, S2Event, @@ -86,7 +87,7 @@ export class DataCellMultiSelection private bindDataCellClick() { this.spreadsheet.on(S2Event.DATA_CELL_CLICK, (event: Event) => { event.stopPropagation(); - const cell = this.spreadsheet.getCell(event.target) as DataCell; + const cell = this.spreadsheet.getCell(event.target)!; const meta = cell.getMeta(); const { interaction } = this.spreadsheet; @@ -96,10 +97,11 @@ export class DataCellMultiSelection if (isEmpty(selectedCells)) { interaction.clearState(); this.spreadsheet.hideTooltip(); - this.spreadsheet.emit( - S2Event.GLOBAL_SELECTED, - interaction.getActiveCells(), - ); + interaction.emitSelectEvent({ + event, + targetCell: cell, + interactionName: InteractionName.DATA_CELL_MULTI_SELECTION, + }); return; } @@ -112,10 +114,11 @@ export class DataCellMultiSelection stateName: InteractionStateName.SELECTED, onUpdateCells: afterSelectDataCells, }); - this.spreadsheet.emit( - S2Event.GLOBAL_SELECTED, - interaction.getActiveCells(), - ); + interaction.emitSelectEvent({ + event, + targetCell: cell, + interactionName: InteractionName.DATA_CELL_MULTI_SELECTION, + }); this.spreadsheet.showTooltipWithInfo( event, getCellsTooltipData(this.spreadsheet), diff --git a/packages/s2-core/src/interaction/event-controller.ts b/packages/s2-core/src/interaction/event-controller.ts index 24575920e2..c2d61bb555 100644 --- a/packages/s2-core/src/interaction/event-controller.ts +++ b/packages/s2-core/src/interaction/event-controller.ts @@ -6,7 +6,7 @@ import { type PointLike, } from '@antv/g'; import { each, get, hasIn, isEmpty, isFunction, isNil } from 'lodash'; -import { GuiIcon } from '../common'; +import { GuiIcon, InteractionName } from '../common'; import { CellType, InteractionKeyboardKey, @@ -21,7 +21,6 @@ import type { SpreadSheet } from '../sheet-type'; import { getSelectedData } from '../utils/export/copy'; import { keyEqualTo } from '../utils/export/method'; import { getAppendInfo } from '../utils/interaction/common'; -import { isMobile } from '../utils/is-mobile'; import { verifyTheElementInTooltip } from '../utils/tooltip'; interface EventListener { @@ -78,7 +77,6 @@ export class EventController { this.clearAllEvents(); // canvas events - this.addCanvasEvent(OriginEventType.CLICK, this.onCanvasClick); this.addCanvasEvent(OriginEventType.MOUSE_DOWN, this.onCanvasMousedown); this.addCanvasEvent(OriginEventType.TOUCH_START, (event) => { this.target = event.target; @@ -86,6 +84,7 @@ export class EventController { this.addCanvasEvent(OriginEventType.POINTER_MOVE, this.onCanvasMousemove); this.addCanvasEvent(OriginEventType.MOUSE_OUT, this.onCanvasMouseout); this.addCanvasEvent(OriginEventType.POINTER_UP, this.onCanvasMouseup); + this.addCanvasEvent(OriginEventType.CLICK, this.onCanvasDoubleClick); /** * 如果监听 G Canvas, 右键对应的是 rightup/rightdown 事件, 如需禁用右键菜单 (preventDefault), 需要监听 DOM * https://g.antv.antgroup.com/api/event/faq#%E7%A6%81%E7%94%A8%E5%8F%B3%E9%94%AE%E8%8F%9C%E5%8D%95 @@ -199,6 +198,11 @@ export class EventController { this.spreadsheet.emit( S2Event.GLOBAL_SELECTED, interaction.getActiveCells(), + { + event, + targetCell: null, + interactionName: InteractionName.GLOBAL_RESET, + }, ); } @@ -245,6 +249,11 @@ export class EventController { return false; } + // 开启 CSS transform 时, 降级处理, 不做 canvas 内的空白检测: https://github.com/antvis/S2/issues/2879 + if (this.spreadsheet.container.getConfig().supportsCSSTransform) { + return this.isMatchElement(event); + } + return this.isMatchElement(event) && this.isMatchPoint(event); } @@ -484,6 +493,26 @@ export class EventController { if (cell) { const cellType = cell.cellType; + // 通用的 mouseup 事件 + switch (cellType) { + case CellType.DATA_CELL: + this.spreadsheet.emit(S2Event.DATA_CELL_MOUSE_UP, event); + break; + case CellType.ROW_CELL: + this.spreadsheet.emit(S2Event.ROW_CELL_MOUSE_UP, event); + break; + case CellType.COL_CELL: + this.spreadsheet.emit(S2Event.COL_CELL_MOUSE_UP, event); + break; + case CellType.CORNER_CELL: + this.spreadsheet.emit(S2Event.CORNER_CELL_MOUSE_UP, event); + break; + case CellType.MERGED_CELL: + this.spreadsheet.emit(S2Event.MERGED_CELLS_MOUSE_UP, event); + break; + default: + break; + } // target 相同,说明是一个 cell 内的 click 事件 if (this.target === event.target) { // 屏蔽 actionIcons 的点击,字段标记增加的 icon 除外. @@ -494,6 +523,8 @@ export class EventController { return; } + this.spreadsheet.emit(S2Event.GLOBAL_CLICK, event); + switch (cellType) { case CellType.DATA_CELL: this.spreadsheet.emit(S2Event.DATA_CELL_CLICK, event); @@ -514,49 +545,16 @@ export class EventController { break; } } - - // 通用的 mouseup 事件 - switch (cellType) { - case CellType.DATA_CELL: - this.spreadsheet.emit(S2Event.DATA_CELL_MOUSE_UP, event); - break; - case CellType.ROW_CELL: - this.spreadsheet.emit(S2Event.ROW_CELL_MOUSE_UP, event); - break; - case CellType.COL_CELL: - this.spreadsheet.emit(S2Event.COL_CELL_MOUSE_UP, event); - break; - case CellType.CORNER_CELL: - this.spreadsheet.emit(S2Event.CORNER_CELL_MOUSE_UP, event); - break; - case CellType.MERGED_CELL: - this.spreadsheet.emit(S2Event.MERGED_CELLS_MOUSE_UP, event); - break; - default: - break; - } - } - }; - - private onCanvasClick = (event: CanvasEvent) => { - this.spreadsheet.emit(S2Event.GLOBAL_CLICK, event); - if (isMobile()) { - this.onCanvasMouseup(event); - } - - // 双击的 detail 是 2 - if ( - event.detail === 2 || - event.nativeEvent?.detail === 2 || - event.originalEvent?.detail === 2 - ) { - this.onCanvasDoubleClick(event); } }; private onCanvasDoubleClick = (event: CanvasEvent) => { const spreadsheet = this.spreadsheet; + if (event.detail !== 2) { + return; + } + if (this.isResizeArea(event)) { spreadsheet.emit(S2Event.LAYOUT_RESIZE_MOUSE_UP, event); diff --git a/packages/s2-core/src/interaction/range-selection.ts b/packages/s2-core/src/interaction/range-selection.ts index 739c676d9f..3e16c0e014 100644 --- a/packages/s2-core/src/interaction/range-selection.ts +++ b/packages/s2-core/src/interaction/range-selection.ts @@ -1,16 +1,21 @@ import type { FederatedPointerEvent } from '@antv/g'; import { inRange, isEmpty, isNil, range } from 'lodash'; -import { DataCell } from '../cell'; +import { DataCell, type ColCell } from '../cell'; import { CellType, InteractionKeyboardKey, + InteractionName, InteractionStateName, InterceptType, S2Event, } from '../common/constant'; import type { S2CellType, ViewMeta } from '../common/interface'; import type { Node } from '../facet/layout/node'; -import { getCellMeta, getRangeIndex } from '../utils/interaction/select-event'; +import { + getCellMeta, + getRangeIndex, + groupSelectedCells, +} from '../utils/interaction/select-event'; import { getCellsTooltipData } from '../utils/tooltip'; import { BaseEvent, type BaseEventImplement } from './base-interaction'; @@ -60,13 +65,6 @@ export class RangeSelection extends BaseEvent implements BaseEventImplement { } private bindColCellClick() { - if (this.spreadsheet.isTableMode()) { - // series-number click - this.spreadsheet.on(S2Event.ROW_CELL_CLICK, (event) => { - this.handleColClick(event); - }); - } - this.spreadsheet.on(S2Event.COL_CELL_CLICK, (event) => { this.handleColClick(event); }); @@ -75,7 +73,7 @@ export class RangeSelection extends BaseEvent implements BaseEventImplement { private bindDataCellClick() { this.spreadsheet.on(S2Event.DATA_CELL_CLICK, (event) => { event.stopPropagation(); - const cell = this.spreadsheet.getCell(event.target) as DataCell; + const cell = this.spreadsheet.getCell(event.target)!; const meta = cell.getMeta(); const { interaction } = this.spreadsheet; @@ -126,17 +124,18 @@ export class RangeSelection extends BaseEvent implements BaseEventImplement { event, getCellsTooltipData(this.spreadsheet), ); - this.spreadsheet.emit( - S2Event.GLOBAL_SELECTED, - interaction.getActiveCells(), - ); + interaction.emitSelectEvent({ + targetCell: cell, + event, + interactionName: InteractionName.RANGE_SELECTION, + }); }); } private handleColClick = (event: FederatedPointerEvent) => { event.stopPropagation(); const { interaction, facet } = this.spreadsheet; - const cell = this.spreadsheet.getCell(event.target); + const cell = this.spreadsheet.getCell(event.target)!; const meta = cell?.getMeta() as Node; if (!isNil(meta?.x)) { @@ -184,31 +183,25 @@ export class RangeSelection extends BaseEvent implements BaseEventImplement { ); } - /* - * 兼容行列多选 - * Set the header cells (colCell or RowCell) selected information and update the dataCell state. - */ interaction.changeState({ cells: selectedCells, stateName: InteractionStateName.SELECTED, }); + const selectedCellIds = groupSelectedCells(selectedCells); + + interaction.updateCells(facet.getHeaderCells(selectedCellIds)); + interaction.emitSelectEvent({ + event, + targetCell: cell, + interactionName: InteractionName.RANGE_SELECTION, + }); } else { if (isEmpty(interaction.getCells())) { - interaction.removeIntercepts([InterceptType.HOVER]); + interaction.reset(); } this.spreadsheet.store.set('lastClickedCell', cell); } - - const selectedCellIds = selectedCells.map(({ id }) => id); - - // Update the interaction state of all the selected cells: header cells(colCell or RowCell) and dataCells belong to them. - interaction.updateCells(facet.getHeaderCells(selectedCellIds)); - - this.spreadsheet.emit( - S2Event.GLOBAL_SELECTED, - interaction.getActiveCells(), - ); } }; diff --git a/packages/s2-core/src/interaction/root.ts b/packages/s2-core/src/interaction/root.ts index 5d018fc7f5..a5c0fdca63 100644 --- a/packages/s2-core/src/interaction/root.ts +++ b/packages/s2-core/src/interaction/root.ts @@ -22,6 +22,7 @@ import type { BrushSelectionOptions, CellMeta, CellScrollToOptions, + CellSelectedDetail, ChangeCellOptions, CustomInteraction, InteractionCellHighlightOptions, @@ -38,12 +39,13 @@ import { customMerge } from '../utils'; import { hideColumnsByThunkGroup } from '../utils/hide-columns'; import { getActiveHoverHeaderCells, - updateAllColHeaderCellState, + updateAllHeaderCellState, } from '../utils/interaction/hover-event'; import { mergeCell, unmergeCell } from '../utils/interaction/merge-cell'; import { getCellMeta, getRowCellForSelectedCell, + groupSelectedCells, } from '../utils/interaction/select-event'; import { clearState, setState } from '../utils/interaction/state-controller'; import { isMobile } from '../utils/is-mobile'; @@ -268,9 +270,16 @@ export class RootInteraction { * @example s2.interaction.isActiveCell(cell) */ public isActiveCell(cell: S2CellType): boolean { - return !!this.getCells().find((meta) => cell.getMeta().id === meta.id); + return !!this.getCells().find( + (meta) => cell.getMeta().id === meta.id && cell.cellType === meta.type, + ); } + public shouldForbidHeaderCellSelected = (selectedCells: CellMeta[]) => { + // 禁止跨单元格选择, 这样计算出来的数据和交互没有任何意义 + return unionBy(selectedCells, 'type').length > 1; + }; + /** * 是否是选中的单元格 * @example s2.interaction.isSelectedCell(cell) @@ -572,8 +581,10 @@ export class RootInteraction { */ public changeCell(options: ChangeCellOptions = {} as ChangeCellOptions) { const { + event, cell, stateName = InteractionStateName.SELECTED, + interactionName, scrollIntoView = true, animate = true, skipScrollEvent = true, @@ -617,13 +628,16 @@ export class RootInteraction { if (isEmpty(selectedCells)) { this.reset(); - this.spreadsheet.emit(S2Event.GLOBAL_SELECTED, this.getActiveCells()); + this.emitSelectEvent({ + event, + targetCell: cell, + interactionName, + }); return; } - // 禁止跨单元格选择, 这样计算出来的数据和交互没有任何意义. - if (unionBy(selectedCells, 'type').length > 1) { + if (this.shouldForbidHeaderCellSelected(selectedCells)) { return; } @@ -638,7 +652,7 @@ export class RootInteraction { stateName, }); - const selectedCellIds = selectedCells.map(({ id }) => id); + const selectedCellIds = groupSelectedCells(selectedCells); this.updateCells(this.spreadsheet.facet.getHeaderCells(selectedCellIds)); @@ -657,7 +671,11 @@ export class RootInteraction { // 由于绘制的顺序问题, 交互背景图层展示后, 会遮挡边框, 需要让边框展示在前面. this.spreadsheet.facet.centerFrame?.toFront(); - this.spreadsheet.emit(S2Event.GLOBAL_SELECTED, this.getActiveCells()); + this.emitSelectEvent({ + event, + targetCell: cell, + interactionName, + }); return true; } @@ -819,10 +837,12 @@ export class RootInteraction { forEach(customInteractions, (customInteraction: CustomInteraction) => { const CustomInteractionClass = customInteraction.interaction; - this.interactions.set( - customInteraction.key, - new CustomInteractionClass(this.spreadsheet), - ); + if (CustomInteractionClass) { + this.interactions.set( + customInteraction.key, + new CustomInteractionClass(this.spreadsheet), + ); + } }); } } @@ -1091,7 +1111,39 @@ export class RootInteraction { : interaction.getSelectedCellHighlight(); if (colHeader && colId) { - updateAllColHeaderCellState(colId, facet.getColCells(), stateName); + updateAllHeaderCellState(colId, facet.getColCells(), stateName); + } + } + + public emitSelectEvent( + options: CellSelectedDetail & { cells?: S2CellType[] }, + ) { + const { interaction } = this.spreadsheet; + const { cells, ...defaultCellSelectedDetail } = options; + const activeCells = cells || interaction.getActiveCells(); + const targetCell = defaultCellSelectedDetail?.targetCell || activeCells[0]; + const cellSelectedDetail = { + ...defaultCellSelectedDetail, + targetCell, + }; + const cellType = targetCell?.cellType as string; + + const eventName = { + [CellType.CORNER_CELL]: S2Event.CORNER_CELL_SELECTED, + [CellType.ROW_CELL]: S2Event.ROW_CELL_SELECTED, + [CellType.COL_CELL]: S2Event.COL_CELL_SELECTED, + [CellType.DATA_CELL]: S2Event.DATA_CELL_SELECTED, + }[cellType]; + + if (!eventName) { + return; } + + this.spreadsheet.emit(eventName, activeCells, cellSelectedDetail); + this.spreadsheet.emit( + S2Event.GLOBAL_SELECTED, + activeCells, + cellSelectedDetail, + ); } } diff --git a/packages/s2-core/src/interaction/row-column-resize.ts b/packages/s2-core/src/interaction/row-column-resize.ts index c0f0bbf8bc..2f9514392a 100644 --- a/packages/s2-core/src/interaction/row-column-resize.ts +++ b/packages/s2-core/src/interaction/row-column-resize.ts @@ -7,9 +7,9 @@ import { } from '@antv/g'; import { clone, isEmpty, throttle } from 'lodash'; import type { + CellTextWordWrapStyle, ResizeInteractionOptions, ResizeParams, - RowCellStyle, } from '../common'; import { InterceptType, @@ -350,7 +350,7 @@ export class RowColumnResize extends BaseEvent implements BaseEventImplement { eventType: S2Event.LAYOUT_RESIZE_TREE_WIDTH, style: { rowCell: { - width: displayWidth, + treeWidth: displayWidth, }, }, }; @@ -380,6 +380,7 @@ export class RowColumnResize extends BaseEvent implements BaseEventImplement { } private getResizeHeightDetail(): ResizeDetail | null { + const { style } = this.spreadsheet.options; const resizeInfo = this.getResizeInfo(); const { displayHeight } = this.getDisAllowResizeInfo(); @@ -388,9 +389,11 @@ export class RowColumnResize extends BaseEvent implements BaseEventImplement { return { eventType: S2Event.LAYOUT_RESIZE_COL_HEIGHT, style: { - colCell: { - heightByField: this.getHeightByField(resizeInfo, displayHeight!), - }, + colCell: this.getResizedCellStyleByField( + this.getColCellHeightByField(resizeInfo, displayHeight!), + style?.colCell!, + displayHeight, + ), }, }; @@ -399,10 +402,14 @@ export class RowColumnResize extends BaseEvent implements BaseEventImplement { eventType: S2Event.LAYOUT_RESIZE_ROW_HEIGHT, style: { rowCell: { + ...this.getResizedCellStyleByField( + this.getCellStyleByField(displayHeight), + style?.rowCell!, + displayHeight, + ), height: !this.isEffectRowOf(ResizeType.ALL) ? undefined : displayHeight, - heightByField: this.getCellStyleByField(displayHeight), }, }, }; @@ -412,10 +419,46 @@ export class RowColumnResize extends BaseEvent implements BaseEventImplement { } } - private getHeightByField( + private getResizedCellStyleByField( + heightByField: Record, + cellStyle: CellTextWordWrapStyle, + displayHeight: number, + ) { + const isEnableHeightAdaptive = + cellStyle?.maxLines! > 1 && cellStyle?.wordWrap; + + if (!isEnableHeightAdaptive) { + return { + heightByField, + }; + } + + // 如果开启了换行, 高度拖拽后动态计算 maxLines 的值, 已保证展示合理性. + const { cell } = this.getResizeInfo(); + const maxLines = cell.getMaxLinesByCustomHeight({ + targetCell: cell, + displayHeight, + isCustomHeight: true, + }); + + const maxLinesByField = Object.keys(heightByField || {}).reduce< + Record + >((result, field) => { + result![field] = maxLines!; + + return result; + }, {}); + + return { + heightByField, + maxLinesByField, + }; + } + + private getColCellHeightByField( resizeInfo: ResizeInfo, displayHeight: number, - ): RowCellStyle['heightByField'] { + ): Record { // 1. 自定义列头: 给同一层级且同高度的单元格设置高度. 2. 明细表: 列高一致 if ( this.spreadsheet.isCustomColumnFields() || @@ -428,7 +471,7 @@ export class RowColumnResize extends BaseEvent implements BaseEventImplement { node.level === resizeInfo.meta?.level && node.height === resizeInfo.meta?.height, ) - .reduce((result, node) => { + .reduce>((result, node) => { result![node.field] = displayHeight; return result; diff --git a/packages/s2-core/src/interaction/selected-cell-move.ts b/packages/s2-core/src/interaction/selected-cell-move.ts index 2c1acefbc6..dc7c792476 100644 --- a/packages/s2-core/src/interaction/selected-cell-move.ts +++ b/packages/s2-core/src/interaction/selected-cell-move.ts @@ -2,6 +2,8 @@ import type { FederatedPointerEvent as Event } from '@antv/g'; import { CellType, FrozenGroupArea, + InteractionName, + InteractionStateName, type CellMeta, type ViewMeta, } from '../common'; @@ -9,7 +11,7 @@ import { InteractionKeyboardKey, S2Event } from '../common/constant'; import type { FrozenFacet } from '../facet'; import type { SpreadSheet } from '../sheet-type'; import { getDataCellId } from '../utils'; -import { getRangeIndex, selectCells } from '../utils/interaction/select-event'; +import { getRangeIndex } from '../utils/interaction/select-event'; import { BaseEvent, type BaseEventImplement } from './base-interaction'; const SelectedCellMoveMap = [ @@ -82,6 +84,7 @@ export class SelectedCellMove extends BaseEvent implements BaseEventImplement { } }, ); + this.spreadsheet.on(S2Event.DATA_CELL_CLICK, (event: Event) => { const cell = this.spreadsheet.getCell(event.target); const cellMeta = cell?.getMeta() as ViewMeta; @@ -109,7 +112,7 @@ export class SelectedCellMove extends BaseEvent implements BaseEventImplement { isJumpMode, isSingleSelection, }: { - event: any; + event: KeyboardEvent; changeStartCell: boolean; isJumpMode: boolean; isSingleSelection: boolean; @@ -125,17 +128,26 @@ export class SelectedCellMove extends BaseEvent implements BaseEventImplement { const [rowIndex, colIndex] = [rowCol.row, rowCol.col]; this.scrollToActiveCell(spreadsheet, rowIndex, colIndex); + const movedCell = this.generateCellMeta(spreadsheet, rowIndex, colIndex); const selectedCells = isSingleSelection ? [movedCell] : this.getRangeCells(spreadsheet, startCell!, movedCell); - selectCells(spreadsheet, selectedCells); if (changeStartCell) { this.startCell = movedCell; } this.endCell = movedCell; + + spreadsheet.interaction.changeState({ + stateName: InteractionStateName.SELECTED, + cells: selectedCells, + }); + spreadsheet.interaction.emitSelectEvent({ + event, + interactionName: InteractionName.SELECTED_CELL_MOVE, + }); this.spreadsheet.emit(S2Event.DATA_CELL_SELECT_MOVE, selectedCells); } diff --git a/packages/s2-shared/src/constant/classnames.ts b/packages/s2-core/src/shared/constant/classnames.ts similarity index 70% rename from packages/s2-shared/src/constant/classnames.ts rename to packages/s2-core/src/shared/constant/classnames.ts index 29b190edfb..5f42e2f6f4 100644 --- a/packages/s2-shared/src/constant/classnames.ts +++ b/packages/s2-core/src/shared/constant/classnames.ts @@ -1,4 +1,4 @@ -import { S2_PREFIX_CLS } from '@antv/s2'; +import { S2_PREFIX_CLS } from '../../common/constant/classnames'; export const DRILL_DOWN_PRE_CLASS = `${S2_PREFIX_CLS}-drill-down`; diff --git a/packages/s2-shared/src/constant/i18n/en_US.ts b/packages/s2-core/src/shared/constant/i18n/en_US.ts similarity index 100% rename from packages/s2-shared/src/constant/i18n/en_US.ts rename to packages/s2-core/src/shared/constant/i18n/en_US.ts diff --git a/packages/s2-shared/src/constant/i18n/index.ts b/packages/s2-core/src/shared/constant/i18n/index.ts similarity index 76% rename from packages/s2-shared/src/constant/i18n/index.ts rename to packages/s2-core/src/shared/constant/i18n/index.ts index 5ad2364fba..1ed7ac81db 100644 --- a/packages/s2-shared/src/constant/i18n/index.ts +++ b/packages/s2-core/src/shared/constant/i18n/index.ts @@ -1,4 +1,4 @@ -import type { LocaleType } from '@antv/s2'; +import type { LocaleType } from '../../../common/i18n'; import { EN_US } from './en_US'; import { RU } from './ru_RU'; import { ZH_CN } from './zh_CN'; diff --git a/packages/s2-shared/src/constant/i18n/ru_RU.ts b/packages/s2-core/src/shared/constant/i18n/ru_RU.ts similarity index 100% rename from packages/s2-shared/src/constant/i18n/ru_RU.ts rename to packages/s2-core/src/shared/constant/i18n/ru_RU.ts diff --git a/packages/s2-shared/src/constant/i18n/zh_CN.ts b/packages/s2-core/src/shared/constant/i18n/zh_CN.ts similarity index 100% rename from packages/s2-shared/src/constant/i18n/zh_CN.ts rename to packages/s2-core/src/shared/constant/i18n/zh_CN.ts diff --git a/packages/s2-shared/src/constant/index.ts b/packages/s2-core/src/shared/constant/index.ts similarity index 100% rename from packages/s2-shared/src/constant/index.ts rename to packages/s2-core/src/shared/constant/index.ts diff --git a/packages/s2-shared/src/constant/option.ts b/packages/s2-core/src/shared/constant/option.ts similarity index 84% rename from packages/s2-shared/src/constant/option.ts rename to packages/s2-core/src/shared/constant/option.ts index 8c4e359e48..98808b3be5 100644 --- a/packages/s2-shared/src/constant/option.ts +++ b/packages/s2-core/src/shared/constant/option.ts @@ -1,4 +1,4 @@ -import type { S2Options } from '@antv/s2'; +import type { S2Options } from '../../common'; export const SHEET_COMPONENT_DEFAULT_OPTIONS: S2Options = { tooltip: { diff --git a/packages/s2-shared/src/constant/resize.ts b/packages/s2-core/src/shared/constant/resize.ts similarity index 100% rename from packages/s2-shared/src/constant/resize.ts rename to packages/s2-core/src/shared/constant/resize.ts diff --git a/packages/s2-shared/src/constant/sort.ts b/packages/s2-core/src/shared/constant/sort.ts similarity index 90% rename from packages/s2-shared/src/constant/sort.ts rename to packages/s2-core/src/shared/constant/sort.ts index 8464aa5467..d8b92ce702 100644 --- a/packages/s2-shared/src/constant/sort.ts +++ b/packages/s2-core/src/shared/constant/sort.ts @@ -1,4 +1,4 @@ -import { S2_PREFIX_CLS, i18n } from '@antv/s2'; +import { i18n, S2_PREFIX_CLS } from '../../common'; export const getSortMethod = () => [ { diff --git a/packages/s2-core/src/shared/index.ts b/packages/s2-core/src/shared/index.ts new file mode 100644 index 0000000000..28e208300f --- /dev/null +++ b/packages/s2-core/src/shared/index.ts @@ -0,0 +1,5 @@ +export * from './constant'; +export * from './interface'; +export * from './utils'; + +export * from './interface'; diff --git a/packages/s2-shared/src/interface.ts b/packages/s2-core/src/shared/interface.ts similarity index 91% rename from packages/s2-shared/src/interface.ts rename to packages/s2-core/src/shared/interface.ts index 6e7d5c4fd2..18b10d2780 100644 --- a/packages/s2-shared/src/interface.ts +++ b/packages/s2-core/src/shared/interface.ts @@ -1,16 +1,21 @@ +import { FederatedPointerEvent as GEvent } from '@antv/g'; import type { - BaseTooltipOperatorMenuOptions, - CellScrollPosition, ColCell, - CopyableList, CornerCell, DataCell, - GEvent, + MergedCell, + RowCell, + SeriesNumberCell, + TableDataCell, +} from '../cell'; +import type { + BaseTooltipOperatorMenuOptions, + CellScrollPosition, + CellSelectedHandler, + CopyableList, HeaderActionIcon, HiddenColumnsInfo, LayoutResult, - MergedCell, - Node, Pagination, RawData, ResizeInfo, @@ -21,17 +26,16 @@ import type { S2MountContainer, S2Options, S2RenderOptions, - SeriesNumberCell, SortParams, - SpreadSheet, - TableDataCell, TargetCellInfo, ThemeCfg, TooltipContentType, TooltipOperatorOptions, ViewMeta, ViewMetaData, -} from '@antv/s2'; +} from '../common'; +import type { Node } from '../facet/layout/node'; +import type { SpreadSheet } from '../sheet-type'; // 是否开启自适应宽高,并指定容器 export type Adaptive = @@ -46,6 +50,7 @@ export type SheetType = | 'pivot' | 'table' | 'chart' + | 'pivotChart' | 'gridAnalysis' | 'strategy' | 'editable'; @@ -59,27 +64,10 @@ export type LayoutPaginationParams = { total: number; current: number; }; -type _ShowPagination = - | boolean - | { - onShowSizeChange?: (pageSize: number) => void; - onChange?: (current: number) => void; - }; - -type ShowPagination = - OverrideShowPagination extends true - ? Options extends { - pagination?: { onShowSizeChange?: unknown; onChange?: unknown }; - } - ? boolean | Options['pagination'] - : _ShowPagination - : _ShowPagination; export interface BaseSheetComponentProps< PartialDrillDown = PartDrillDown, - Header = unknown, Options = S2Options, - OverrideShowPagination = false, > { sheetType?: SheetType; spreadsheet?: ( @@ -92,9 +80,7 @@ export interface BaseSheetComponentProps< loading?: boolean; partDrillDown?: PartialDrillDown; adaptive?: Adaptive; - showPagination?: ShowPagination; themeCfg?: ThemeCfg; - header?: Header; // ============== Row Cell ==================== onRowCellHover?: (data: TargetCellInfo) => void; @@ -107,7 +93,8 @@ export interface BaseSheetComponentProps< onRowCellCollapsed?: (params: RowCellCollapsedParams) => void; onRowCellAllCollapsed?: (isCollapsed: boolean) => void; onRowCellScroll?: (position: CellScrollPosition) => void; - onRowCellRender?: (cell: ColCell) => void; + onRowCellRender?: (cell: RowCell) => void; + onRowCellSelected?: CellSelectedHandler; // ============== Col Cell ==================== onColCellHover?: (data: TargetCellInfo) => void; @@ -123,6 +110,7 @@ export interface BaseSheetComponentProps< hiddenColumnsDetail: HiddenColumnsInfo[]; }) => void; onColCellRender?: (cell: ColCell) => void; + onColCellSelected?: CellSelectedHandler; // ============== Data Cell ==================== onDataCellHover?: (data: TargetCellInfo) => void; @@ -137,6 +125,7 @@ export interface BaseSheetComponentProps< onDataCellRender?: (cell: DataCell) => void; onDataCellEditStart?: (meta: ViewMeta, cell: TableDataCell) => void; onDataCellEditEnd?: (meta: ViewMeta, cell: TableDataCell) => void; + onDataCellSelected?: CellSelectedHandler; // ============== Corner Cell ==================== onCornerCellHover?: (data: TargetCellInfo) => void; @@ -147,6 +136,7 @@ export interface BaseSheetComponentProps< onCornerCellMouseUp?: (data: TargetCellInfo) => void; onCornerCellMouseMove?: (data: TargetCellInfo) => void; onCornerCellRender?: (cell: CornerCell) => void; + onCornerCellSelected?: CellSelectedHandler; // ============== Merged Cells ==================== onMergedCellsHover?: (data: TargetCellInfo) => void; @@ -179,8 +169,9 @@ export interface BaseSheetComponentProps< onBeforeRender?: () => void; onAfterRender?: () => void; onMounted?: (spreadsheet: SpreadSheet) => void; - onUpdate?: (renderOptions: S2RenderOptions) => S2RenderOptions; + onUpdate?: (renderOptions: S2RenderOptions) => S2RenderOptions | void; onUpdateAfterRender?: (renderOptions: S2RenderOptions) => void; + onLoading?: (loading: boolean) => void; onDestroy?: () => void; // ============== Resize ==================== @@ -219,7 +210,7 @@ export interface BaseSheetComponentProps< onMouseUp?: (event: MouseEvent) => void; onMouseDown?: (event: MouseEvent) => void; onMouseMove?: (event: MouseEvent) => void; - onSelected?: (cells: S2CellType[]) => void; + onSelected?: CellSelectedHandler; onReset?: (event: KeyboardEvent) => void; onLinkFieldJump?: (data: { field: string; record: RawData }) => void; onScroll?: (position: CellScrollPosition) => void; @@ -252,18 +243,21 @@ export interface TooltipOperatorProps

} // 下钻相关类型 -export interface BaseDataSet { +export interface BaseDrillDownDataSet { name: string; value: string; type?: 'text' | 'location' | 'date'; disabled?: boolean; } -export interface BaseDrillDownComponentProps { +export interface BaseDrillDownComponentProps< + DataSet = BaseDrillDownDataSet, + Text = string, +> { className?: string; - titleText?: string; + title?: Text; searchText?: string; - clearButtonText?: string; + clearText?: Text; dataSet?: DataSet[] | undefined; drillFields?: string[]; disabledFields?: string[]; diff --git a/packages/s2-shared/src/styles/drill-down.less b/packages/s2-core/src/shared/styles/drill-down.less similarity index 94% rename from packages/s2-shared/src/styles/drill-down.less rename to packages/s2-core/src/shared/styles/drill-down.less index 40beb64006..4d4ec9e556 100644 --- a/packages/s2-shared/src/styles/drill-down.less +++ b/packages/s2-core/src/shared/styles/drill-down.less @@ -12,14 +12,15 @@ font-size: 14px; padding: 0 16px; margin-top: 16px; + align-items: center; + justify-content: space-between; button { position: absolute; right: 0; - top: -4px; + top: 0; font-size: 12px; color: #1890ff; - letter-spacing: -0.2px; line-height: 20px; } } diff --git a/packages/s2-shared/src/styles/tooltip/index.less b/packages/s2-core/src/shared/styles/tooltip/index.less similarity index 98% rename from packages/s2-shared/src/styles/tooltip/index.less rename to packages/s2-core/src/shared/styles/tooltip/index.less index 9276ce94a4..9918ab9578 100644 --- a/packages/s2-shared/src/styles/tooltip/index.less +++ b/packages/s2-core/src/shared/styles/tooltip/index.less @@ -1,4 +1,4 @@ -@import '../variables.less'; +@import '../../../ui/tooltip/index.less'; .@{tooltip-cls-prefix} { &-tips, diff --git a/packages/s2-shared/src/styles/tooltip/operator.less b/packages/s2-core/src/shared/styles/tooltip/operator.less similarity index 71% rename from packages/s2-shared/src/styles/tooltip/operator.less rename to packages/s2-core/src/shared/styles/tooltip/operator.less index 12bf087eeb..873b87f7c8 100644 --- a/packages/s2-shared/src/styles/tooltip/operator.less +++ b/packages/s2-core/src/shared/styles/tooltip/operator.less @@ -14,6 +14,10 @@ border: 0; cursor: pointer; + .ant-menu { + font-size: @tooltip-menu-font-size; + } + .ant-menu-horizontal:not(.ant-menu-dark) { background: transparent; line-height: @tooltip-menu-item-height; @@ -29,7 +33,6 @@ color: var(~'@{css-var-prefix}-font', ~'@{tooltip-menu-item-text-color}'); border: 0; user-select: none; - padding: 4px; width: 100%; .ant-menu-item { @@ -51,7 +54,7 @@ &.ant-menu-submenu-selected { background-color: var( - --antv-s2-tooltip-operator-menu-selected-background, + ~'@{css-var-prefix}-tooltip-operator-menu-selected-background', #e6f4ff ); } @@ -122,51 +125,3 @@ } } } - -// mobile style -@media only screen and (max-device-width: 480px) { - .@{tooltip-operator-cls-prefix} { - &-menus.ant-menu-vertical.ant-menu { - font-size: @tooltip-menu-font-size; - - .ant-menu-item { - height: @tooltip-menu-item-height; - } - } - - &-menus.ant-dropdown-menu-vertical, - &-menus.ant-menu-vertical { - .ant-dropdown-menu-item, - .ant-menu-item { - line-height: @tooltip-menu-item-height; - } - - .ant-dropdown-menu-submenu, - .ant-dropdown-menu-submenu-vertical, - .ant-menu-submenu, - .ant-menu-submenu-vertical { - .ant-menu-submenu-title { - .with-menu-item-color(); - - font-size: @tooltip-menu-font-size; - } - } - } - - &-submenu-popup { - .ant-dropdown-menu-item, - .ant-menu-item { - .with-menu-item-color(); - - font-size: @tooltip-menu-font-size; - } - } - - &-icon { - svg { - width: @tooltip-menu-font-size; - height: @tooltip-menu-font-size; - } - } - } -} diff --git a/packages/s2-shared/src/styles/variables.less b/packages/s2-core/src/shared/styles/variables.less similarity index 84% rename from packages/s2-shared/src/styles/variables.less rename to packages/s2-core/src/shared/styles/variables.less index 8dacd99a63..aeacc6a3a3 100644 --- a/packages/s2-shared/src/styles/variables.less +++ b/packages/s2-core/src/shared/styles/variables.less @@ -1,4 +1,4 @@ -@import '@antv/s2/src/styles/variables.less'; +@import '../../styles/variables.less'; @tooltip-operator-cls-prefix: ~'@{s2-cls-prefix}-tooltip-operator'; @tooltip-menu-item-text-color: rgba(0, 0, 0, 0.65); @@ -19,6 +19,3 @@ // 头部组件 @header-cls-prefix: ~'@{s2-cls-prefix}-header'; - -// 图标 -@icon-cls-prefix: ~'@{s2-cls-prefix}-icon'; diff --git a/packages/s2-shared/src/utils/classnames.ts b/packages/s2-core/src/shared/utils/classnames.ts similarity index 100% rename from packages/s2-shared/src/utils/classnames.ts rename to packages/s2-core/src/shared/utils/classnames.ts diff --git a/packages/s2-shared/src/utils/drill-down.ts b/packages/s2-core/src/shared/utils/drill-down.ts similarity index 95% rename from packages/s2-shared/src/utils/drill-down.ts rename to packages/s2-core/src/shared/utils/drill-down.ts index 22b3e82b19..3bceec5f95 100644 --- a/packages/s2-shared/src/utils/drill-down.ts +++ b/packages/s2-core/src/shared/utils/drill-down.ts @@ -1,14 +1,14 @@ +import { FederatedPointerEvent as GEvent } from '@antv/g'; +import { clone, filter, isEmpty, size } from 'lodash'; import { S2Event, - type GEvent, type HeaderActionIcon, - type Node, type PartDrillDownDataCache, - type PivotDataSet, type S2Options, - type SpreadSheet, -} from '@antv/s2'; -import { clone, filter, isEmpty, size } from 'lodash'; +} from '../../common'; +import type { PivotDataSet } from '../../data-set'; +import type { Node } from '../../facet/layout/node'; +import type { SpreadSheet } from '../../sheet-type'; import type { PartDrillDown, PartDrillDownInfo } from '../interface'; export interface DrillDownParams { diff --git a/packages/s2-core/src/shared/utils/index.ts b/packages/s2-core/src/shared/utils/index.ts new file mode 100644 index 0000000000..c02e3a9f01 --- /dev/null +++ b/packages/s2-core/src/shared/utils/index.ts @@ -0,0 +1,4 @@ +export * from './classnames'; +export * from './drill-down'; +export * from './options'; +export * from './resize'; diff --git a/packages/s2-shared/src/utils/options.ts b/packages/s2-core/src/shared/utils/options.ts similarity index 72% rename from packages/s2-shared/src/utils/options.ts rename to packages/s2-core/src/shared/utils/options.ts index 52be6f8424..c33f488184 100644 --- a/packages/s2-shared/src/utils/options.ts +++ b/packages/s2-core/src/shared/utils/options.ts @@ -1,4 +1,5 @@ -import { customMerge, DEFAULT_OPTIONS, type S2Options } from '@antv/s2'; +import { DEFAULT_OPTIONS, type S2Options } from '../../common'; +import { customMerge } from '../../utils'; import { SHEET_COMPONENT_DEFAULT_OPTIONS } from '../constant/option'; export const getBaseSheetComponentOptions = ( diff --git a/packages/s2-shared/src/utils/resize.ts b/packages/s2-core/src/shared/utils/resize.ts similarity index 98% rename from packages/s2-shared/src/utils/resize.ts rename to packages/s2-core/src/shared/utils/resize.ts index 5e0c1fd46a..8d278c1f12 100644 --- a/packages/s2-shared/src/utils/resize.ts +++ b/packages/s2-core/src/shared/utils/resize.ts @@ -1,5 +1,5 @@ -import { floor } from '@antv/s2'; import { debounce, isBoolean } from 'lodash'; +import { floor } from '../../utils'; import { RESIZE_RENDER_DELAY } from '../constant/resize'; import type { Adaptive, ResizeEffectParams } from '../interface'; diff --git a/packages/s2-core/src/sheet-type/pivot-sheet.ts b/packages/s2-core/src/sheet-type/pivot-sheet.ts index a9ffcd66ef..804a5b94f3 100644 --- a/packages/s2-core/src/sheet-type/pivot-sheet.ts +++ b/packages/s2-core/src/sheet-type/pivot-sheet.ts @@ -144,10 +144,10 @@ export class PivotSheet extends SpreadSheet { const { rows, columns } = this.dataCfg.fields; const { hideValue } = this.options.style!.colCell!; const sortField = this.isValueInCols() ? last(rows) : last(columns); - const { query, value } = meta; + const { query, field, value, extra } = meta; const sortQuery = clone(query); - let sortValue = value; + let sortValue = extra?.isCustomNode ? field : value; // 数值置于列头且隐藏了指标列头的情况, 会默认取第一个指标做组内排序, 需要还原指标列的 query, 所以多指标时请不要这么用…… if (hideValue && this.isValueInCols()) { diff --git a/packages/s2-core/src/sheet-type/spread-sheet.ts b/packages/s2-core/src/sheet-type/spread-sheet.ts index 97fcb456ee..4d213c23e3 100644 --- a/packages/s2-core/src/sheet-type/spread-sheet.ts +++ b/packages/s2-core/src/sheet-type/spread-sheet.ts @@ -45,6 +45,7 @@ import type { S2RenderOptions, S2Theme, SimpleData, + SimplePalette, SortMethod, ThemeCfg, ThemeName, @@ -69,8 +70,9 @@ import { clearValueRangeState } from '../utils/condition/state-controller'; import { hideColumnsByThunkGroup } from '../utils/hide-columns'; import { isMobile } from '../utils/is-mobile'; import { customMerge, setupDataConfig, setupOptions } from '../utils/merge'; -import { injectThemeVars } from '../utils/theme'; import { getTooltipData, getTooltipOptions } from '../utils/tooltip'; +import type { PivotSheet } from './pivot-sheet'; +import type { TableSheet } from './table-sheet'; export abstract class SpreadSheet extends EE { public themeName: ThemeName; @@ -98,13 +100,15 @@ export abstract class SpreadSheet extends EE { /** * 表格是否已销毁 */ - private destroyed = false; + public destroyed = false; protected abstract bindEvents(): void; public abstract getDataSet(): BaseDataSet; - public abstract isPivotMode(): boolean; + public abstract isPivotMode(): this is PivotSheet; + + public abstract isTableMode(): this is TableSheet; public abstract isCustomRowFields(): boolean; @@ -112,8 +116,6 @@ export abstract class SpreadSheet extends EE { public abstract isFrozenRowHeader(): boolean; - public abstract isTableMode(): boolean; - public abstract isValueInCols(): boolean; protected abstract buildFacet(): void; @@ -134,8 +136,8 @@ export abstract class SpreadSheet extends EE { options: S2Options | null, ) { super(); - this.dataCfg = setupDataConfig(dataCfg); - this.options = setupOptions(options); + this.setupDataConfig(dataCfg); + this.setupOptions(options); this.dataSet = this.getDataSet(); this.setDebug(); this.initTooltip(); @@ -149,6 +151,14 @@ export abstract class SpreadSheet extends EE { this.mountSheetInstance(); } + protected setupDataConfig(dataCfg: S2DataConfig) { + this.dataCfg = setupDataConfig(dataCfg); + } + + protected setupOptions(options: S2Options | null | undefined) { + this.options = setupOptions(options); + } + public isCustomHeaderFields( fieldType?: keyof Pick, ): boolean { @@ -197,7 +207,7 @@ export abstract class SpreadSheet extends EE { DebuggerUtil.getInstance().setDebug(this.options.debug!); } - private initTheme() { + protected initTheme() { // When calling spreadsheet directly, there is no theme and initialization is required this.setThemeCfg({ name: 'default', @@ -221,7 +231,7 @@ export abstract class SpreadSheet extends EE { } } - private initInteraction() { + protected initInteraction() { this.interaction?.destroy?.(); this.interaction = new RootInteraction(this); } @@ -376,7 +386,7 @@ export abstract class SpreadSheet extends EE { this.hideTooltip(); if (reset) { - this.options = setupOptions(options); + this.setupOptions(options); } else { this.options = customMerge(this.options, options); } @@ -423,7 +433,7 @@ export abstract class SpreadSheet extends EE { const { reloadData = true, rebuildDataSet = false, - reBuildHiddenColumnsDetail = true, + rebuildHiddenColumnsDetail = true, } = options || {}; this.emit(S2Event.LAYOUT_BEFORE_RENDER); @@ -439,7 +449,7 @@ export abstract class SpreadSheet extends EE { this.buildFacet(); - if (reBuildHiddenColumnsDetail) { + if (rebuildHiddenColumnsDetail) { await this.initHiddenColumnsDetail(); } @@ -456,7 +466,7 @@ export abstract class SpreadSheet extends EE { s2.render({ reloadData: true; rebuildDataSet: true; - reBuildHiddenColumnsDetail: true; + rebuildHiddenColumnsDetail: true; }) */ public async render(options?: S2RenderOptions | boolean): Promise { @@ -488,6 +498,7 @@ export abstract class SpreadSheet extends EE { const canvas = this.getCanvasElement(); if (canvas) { + // @ts-ignore // eslint-disable-next-line no-underscore-dangle delete canvas.__s2_instance__; } @@ -516,17 +527,26 @@ export abstract class SpreadSheet extends EE { removeOffscreenCanvas(); } - private setThemeName(name: ThemeName) { + protected setThemeName(name: ThemeName) { this.themeName = name; } - public setThemeCfg(themeCfg: ThemeCfg = {}) { + public setThemeCfg( + themeCfg: ThemeCfg = {}, + getCustomTheme?: ( + palette: SimplePalette, + spreadsheet?: SpreadSheet, + ) => S2Theme, + ) { const theme = themeCfg?.theme || {}; - const newTheme = getTheme({ ...themeCfg, spreadsheet: this }); + const newTheme = getTheme({ + ...themeCfg, + spreadsheet: this, + getCustomTheme, + }); this.theme = customMerge(newTheme, theme); this.setThemeName(themeCfg?.name!); - injectThemeVars(themeCfg?.name); } public setTheme(theme: S2Theme) { @@ -698,7 +718,7 @@ export abstract class SpreadSheet extends EE { protected initContainer(dom: S2MountContainer) { const { width, height, device, transformCanvasConfig } = this.options; - const renderer = new Renderer() as unknown as CanvasConfig['renderer']; + const renderer = new Renderer(); const canvasConfig = transformCanvasConfig?.(renderer, this); /** * https://github.com/antvis/S2/issues/2857 @@ -817,7 +837,10 @@ export abstract class SpreadSheet extends EE { * @param font 文本 css 样式 * @returns 文本宽度 */ - public measureTextWidthRoughly = (text: any, font: any = {}): number => { + public measureTextWidthRoughly = ( + text: SimpleData, + font: unknown, + ): number => { const alphaWidth = this.measureTextWidth('a', font); const chineseWidth = this.measureTextWidth('蚂', font); @@ -828,7 +851,7 @@ export abstract class SpreadSheet extends EE { } // eslint-disable-next-line no-restricted-syntax - for (const char of text) { + for (const char of String(text)) { const code = char.charCodeAt(0); // /[\u0000-\u00ff]/ @@ -893,4 +916,8 @@ export abstract class SpreadSheet extends EE { return text ?? getDefaultSeriesNumberText(); } + + public enableAsyncExport(): Error | true { + return true; + } } diff --git a/packages/s2-core/src/styles/theme/dark.less b/packages/s2-core/src/styles/theme/dark.less index 3a2fd87c3a..f5907e92ae 100644 --- a/packages/s2-core/src/styles/theme/dark.less +++ b/packages/s2-core/src/styles/theme/dark.less @@ -1,9 +1,27 @@ @import '../variables.less'; -:root { +.@{s2-cls-prefix}-dark-theme { + @white: #fff; + // container @{css-var-prefix}-background: #000; @{css-var-prefix}-tooltip-background: rgba(43, 43, 43, 0.95); @{css-var-prefix}-tooltip-operator-background: rgba(43, 43, 43, 0.95); @{css-var-prefix}-tooltip-operator-menu-selected-background: #1677ff; + + // container + @{css-var-prefix}-container-background: #191919; + @{css-var-prefix}-block-background: #232323; + + // text + @{css-var-prefix}-font: @white; + + each(range(19), { + @fadePercent: 100 - @value * 5; + @{css-var-prefix}-font-@{fadePercent}: fade(@white, @fadePercent); + }); + + // border + @{css-var-prefix}-border: fade(@white, 15); + @{css-var-prefix}-divider: fade(@white, 10); } diff --git a/packages/s2-core/src/styles/variables.less b/packages/s2-core/src/styles/variables.less index 9bf51d15f8..a74d8d3dab 100644 --- a/packages/s2-core/src/styles/variables.less +++ b/packages/s2-core/src/styles/variables.less @@ -1,8 +1,11 @@ // s2 类名前缀 @s2-cls-prefix: antv-s2; +// css 变量前缀 +@css-var-prefix: ~'--@{s2-cls-prefix}'; + // Tooltip @tooltip-cls-prefix: ~'@{s2-cls-prefix}-tooltip'; -// css 变量前缀 -@css-var-prefix: ~'--@{s2-cls-prefix}'; +// 图标 +@icon-cls-prefix: ~'@{s2-cls-prefix}-icon'; diff --git a/packages/s2-core/src/theme/index.ts b/packages/s2-core/src/theme/index.ts index 6bd4410e1a..77c8333c15 100644 --- a/packages/s2-core/src/theme/index.ts +++ b/packages/s2-core/src/theme/index.ts @@ -1,27 +1,360 @@ /* eslint-disable max-lines-per-function */ -import { FONT_FAMILY, INTERVAL_BAR_HEIGHT } from '../common/constant'; -import type { DefaultCellTheme, S2Theme, ThemeCfg } from '../common/interface'; +import { merge } from 'lodash'; +import { + CELL_PADDING, + FONT_FAMILY, + INTERVAL_BAR_HEIGHT, +} from '../common/constant'; +import type { + DefaultCellTheme, + S2Theme, + SimplePalette, + ThemeCfg, +} from '../common/interface'; import type { SpreadSheet } from '../sheet-type'; import { isMobile, isWindows } from '../utils/is-mobile'; import { getPalette } from '../utils/theme'; -/** - * @describe generate the theme according to the type - * @param themeCfg - */ -export const getTheme = ( - themeCfg: Omit & { spreadsheet?: SpreadSheet }, -): S2Theme => { - const { - basicColors, - semanticColors, - others: otherColors, - } = themeCfg?.palette || getPalette(themeCfg?.name); +export const getCornerCellTheme = ( + palette: SimplePalette, + spreadsheet?: SpreadSheet, +): DefaultCellTheme => { + const { basicColors, others: otherColors } = palette; + + const isTable = spreadsheet?.isTableMode(); + const boldTextDefaultFontWeight = isWindows() ? 'bold' : 700; + + return { + text: { + fontFamily: FONT_FAMILY, + fontSize: 12, + fontWeight: boldTextDefaultFontWeight, + fill: basicColors[0], + opacity: 1, + textAlign: isTable ? 'center' : 'left', + textBaseline: 'middle', + }, + bolderText: { + fontFamily: FONT_FAMILY, + fontSize: 12, + fontWeight: boldTextDefaultFontWeight, + fill: basicColors[0], + opacity: 1, + textAlign: isTable ? 'center' : 'right', + textBaseline: 'middle', + }, + measureText: { + fontFamily: FONT_FAMILY, + fontSize: 12, + fontWeight: boldTextDefaultFontWeight, + fill: basicColors[0], + opacity: 1, + textAlign: 'left', + textBaseline: 'middle', + }, + cell: { + // ----------- background color ----------- + backgroundColor: basicColors[3], + backgroundColorOpacity: 1, + // ----------- border color -------------- + horizontalBorderColor: basicColors[10], + horizontalBorderColorOpacity: 1, + verticalBorderColor: basicColors[10], + verticalBorderColorOpacity: 1, + // ----------- border width -------------- + horizontalBorderWidth: 1, + verticalBorderWidth: 1, + // -------------- border dash ----------------- + borderDash: [], + // -------------- layout ----------------- + padding: { + top: CELL_PADDING, + right: CELL_PADDING, + bottom: CELL_PADDING, + left: CELL_PADDING, + }, + + /* ---------- interaction state ----------- */ + interactionState: { + // -------------- hover ------------------- + hover: { + backgroundColor: basicColors[4], + backgroundOpacity: 0.6, + }, + // -------------- selected ------------------- + selected: { + backgroundColor: basicColors[4], + backgroundOpacity: 0.6, + }, + // -------------- unselected ------------------- + unselected: { + backgroundOpacity: 0.3, + textOpacity: 0.3, + opacity: 0.3, + }, + // -------------- prepare select -------------- + prepareSelect: { + borderColor: basicColors[14], + borderOpacity: 1, + borderWidth: 1, + }, + // -------------- searchResult ------------------- + searchResult: { + backgroundColor: otherColors?.results ?? basicColors[2], + backgroundOpacity: 1, + }, + // -------------- highlight ------------------- + highlight: { + backgroundColor: otherColors?.highlight ?? basicColors[6], + backgroundOpacity: 1, + }, + }, + }, + icon: { + fill: basicColors[0], + size: 10, + margin: { + right: 4, + left: 4, + }, + }, + }; +}; + +export const getRowCellTheme = ( + palette: SimplePalette, + spreadsheet?: SpreadSheet, +): DefaultCellTheme => { + const { basicColors, others: otherColors } = palette; + + const isTable = spreadsheet?.isTableMode(); + const boldTextDefaultFontWeight = isWindows() ? 'bold' : 700; + + return { + seriesText: { + fontFamily: FONT_FAMILY, + fontSize: 12, + fontWeight: 'normal', + fill: basicColors[14], + linkTextFill: basicColors[6], + opacity: 1, + textBaseline: 'middle', + textAlign: 'center', + }, + measureText: { + fontFamily: FONT_FAMILY, + fontSize: 12, + fontWeight: 'normal', + fill: basicColors[14], + linkTextFill: basicColors[6], + opacity: 1, + textAlign: isTable ? 'center' : 'left', + textBaseline: 'middle', + }, + bolderText: { + fontFamily: FONT_FAMILY, + fontSize: 12, + fontWeight: boldTextDefaultFontWeight, + fill: basicColors[14], + linkTextFill: basicColors[6], + opacity: 1, + textAlign: isTable ? 'center' : 'left', + textBaseline: 'middle', + }, + text: { + fontFamily: FONT_FAMILY, + fontSize: 12, + fontWeight: 'normal', + fill: basicColors[14], + linkTextFill: basicColors[6], + opacity: 1, + textBaseline: 'middle', + // default align center for row cell in table mode + textAlign: isTable ? 'center' : 'left', + }, + cell: { + // ----------- background color ----------- + backgroundColor: basicColors[1], + backgroundColorOpacity: 1, + // ----------- bottom border color -------------- + horizontalBorderColor: basicColors[9], + horizontalBorderColorOpacity: 1, + verticalBorderColor: basicColors[9], + verticalBorderColorOpacity: 1, + // ----------- bottom border width -------------- + horizontalBorderWidth: 1, + verticalBorderWidth: 1, + // -------------- border dash ----------------- + borderDash: [], + // -------------- layout ----------------- + padding: { + top: CELL_PADDING, + right: CELL_PADDING, + bottom: CELL_PADDING, + left: CELL_PADDING, + }, + /* ---------- interaction state ----------- */ + interactionState: { + // -------------- hover ------------------- + hover: { + backgroundColor: basicColors[2], + backgroundOpacity: 0.6, + }, + // -------------- selected ------------------- + selected: { + backgroundColor: basicColors[2], + backgroundOpacity: 0.6, + }, + // -------------- unselected ------------------- + unselected: { + backgroundOpacity: 0.3, + textOpacity: 0.3, + opacity: 0.3, + }, + // -------------- prepare select -------------- + prepareSelect: { + borderColor: basicColors[14], + borderOpacity: 1, + borderWidth: 1, + }, + // -------------- searchResult ------------------- + searchResult: { + backgroundColor: otherColors?.results ?? basicColors[2], + backgroundOpacity: 1, + }, + // -------------- highlight ------------------- + highlight: { + backgroundColor: otherColors?.highlight ?? basicColors[6], + backgroundOpacity: 1, + }, + }, + }, + icon: { + fill: basicColors[14], + size: 10, + margin: { + right: 4, + left: 4, + }, + }, + seriesNumberWidth: 80, + }; +}; + +export const getColCellTheme = (palette: SimplePalette): DefaultCellTheme => { + const { basicColors, others: otherColors } = palette; + + const boldTextDefaultFontWeight = isWindows() ? 'bold' : 700; + + return { + measureText: { + fontFamily: FONT_FAMILY, + fontSize: 12, + fontWeight: 'normal', + fill: basicColors[0], + opacity: 1, + // 默认列头的数值字段和 dataCell 数值对齐 + textAlign: 'right', + textBaseline: 'middle', + linkTextFill: basicColors[6], + }, + bolderText: { + fontFamily: FONT_FAMILY, + fontSize: 12, + fontWeight: boldTextDefaultFontWeight, + fill: basicColors[0], + opacity: 1, + textAlign: 'center', + textBaseline: 'middle', + linkTextFill: basicColors[6], + }, + text: { + fontFamily: FONT_FAMILY, + fontSize: 12, + fontWeight: 'normal', + fill: basicColors[0], + opacity: 1, + textAlign: 'center', + textBaseline: 'middle', + linkTextFill: basicColors[6], + }, + cell: { + // ----------- background color ----------- + backgroundColor: basicColors[3], + backgroundColorOpacity: 1, + // ----------- border color -------------- + horizontalBorderColor: basicColors[10], + horizontalBorderColorOpacity: 1, + verticalBorderColor: basicColors[10], + verticalBorderColorOpacity: 1, + // ----------- border width -------------- + horizontalBorderWidth: 1, + verticalBorderWidth: 1, + // -------------- border dash ----------------- + borderDash: [], + // -------------- layout ----------------- + padding: { + top: CELL_PADDING, + right: CELL_PADDING, + bottom: CELL_PADDING, + left: CELL_PADDING, + }, + + /* ---------- interaction state ----------- */ + interactionState: { + // -------------- hover ------------------- + hover: { + backgroundColor: basicColors[4], + backgroundOpacity: 0.6, + }, + // -------------- selected ------------------- + selected: { + backgroundColor: basicColors[4], + backgroundOpacity: 0.6, + }, + // -------------- unselected ------------------- + unselected: { + backgroundOpacity: 0.3, + textOpacity: 0.3, + opacity: 0.3, + }, + // -------------- prepare select -------------- + prepareSelect: { + borderColor: basicColors[14], + borderOpacity: 1, + borderWidth: 1, + }, + // -------------- searchResult ------------------- + searchResult: { + backgroundColor: otherColors?.results ?? basicColors[2], + backgroundOpacity: 1, + }, + // -------------- highlight ------------------- + highlight: { + backgroundColor: otherColors?.highlight ?? basicColors[6], + backgroundOpacity: 1, + }, + }, + }, + icon: { + fill: basicColors[0], + size: 10, + margin: { + top: 6, + right: 4, + bottom: 6, + left: 4, + }, + }, + }; +}; + +export const getDataCellTheme = (palette: SimplePalette): DefaultCellTheme => { + const { basicColors, others: otherColors, semanticColors } = palette; - const isTable = themeCfg?.spreadsheet?.isTableMode(); const boldTextDefaultFontWeight = isWindows() ? 'bold' : 700; - const getDataCell = (): DefaultCellTheme => ({ + return { bolderText: { fontFamily: FONT_FAMILY, fontSize: 12, @@ -57,12 +390,11 @@ export const getTheme = ( verticalBorderWidth: 1, // -------------- layout ----------------- padding: { - top: 8, - right: 8, - bottom: 8, - left: 8, + top: CELL_PADDING, + right: CELL_PADDING, + bottom: CELL_PADDING, + left: CELL_PADDING, }, - /* ---------- interaction state ----------- */ interactionState: { // -------------- hover ------------------- @@ -162,380 +494,114 @@ export const getTheme = ( left: 4, }, }, - }); + }; +}; - return { - // ------------- Headers ------------------- - cornerCell: { - text: { - fontFamily: FONT_FAMILY, - fontSize: 12, - fontWeight: boldTextDefaultFontWeight, - fill: basicColors[0], - opacity: 1, - textAlign: isTable ? 'center' : 'left', - textBaseline: 'middle', - }, - bolderText: { - fontFamily: FONT_FAMILY, - fontSize: 12, - fontWeight: boldTextDefaultFontWeight, - fill: basicColors[0], - opacity: 1, - textAlign: isTable ? 'center' : 'right', - textBaseline: 'middle', - }, - cell: { - // ----------- background color ----------- - backgroundColor: basicColors[3], - backgroundColorOpacity: 1, - // ----------- border color -------------- - horizontalBorderColor: basicColors[10], - horizontalBorderColorOpacity: 1, - verticalBorderColor: basicColors[10], - verticalBorderColorOpacity: 1, - // ----------- border width -------------- - horizontalBorderWidth: 1, - verticalBorderWidth: 1, - // -------------- border dash ----------------- - borderDash: [], - // -------------- layout ----------------- - padding: { - top: 4, - right: 8, - bottom: 4, - left: 8, - }, +/** + * @describe generate the theme according to the type + * @param themeCfg + */ +export const getTheme = ( + themeCfg: Omit & { + spreadsheet?: SpreadSheet; + getCustomTheme?: ( + palette: SimplePalette, + spreadsheet?: SpreadSheet, + ) => S2Theme; + }, +): S2Theme => { + const palette = themeCfg?.palette || getPalette(themeCfg?.name); + const { basicColors } = palette; - /* ---------- interaction state ----------- */ - interactionState: { - // -------------- hover ------------------- - hover: { - backgroundColor: basicColors[4], - backgroundOpacity: 0.6, - }, - // -------------- selected ------------------- - selected: { - backgroundColor: basicColors[4], - backgroundOpacity: 0.6, - }, - // -------------- unselected ------------------- - unselected: { - backgroundOpacity: 0.3, - textOpacity: 0.3, - opacity: 0.3, - }, - // -------------- prepare select -------------- - prepareSelect: { - borderColor: basicColors[14], - borderOpacity: 1, - borderWidth: 1, - }, - // -------------- searchResult ------------------- - searchResult: { - backgroundColor: otherColors?.results ?? basicColors[2], - backgroundOpacity: 1, - }, - // -------------- highlight ------------------- - highlight: { - backgroundColor: otherColors?.highlight ?? basicColors[6], - backgroundOpacity: 1, - }, - }, - }, - icon: { - fill: basicColors[0], - size: 10, - margin: { - right: 4, - left: 4, - }, - }, - }, - rowCell: { - seriesText: { - fontFamily: FONT_FAMILY, - fontSize: 12, - fontWeight: 'normal', - fill: basicColors[14], - linkTextFill: basicColors[6], - opacity: 1, - textBaseline: 'middle', - textAlign: 'center', - }, - measureText: { - fontFamily: FONT_FAMILY, - fontSize: 12, - fontWeight: 'normal', - fill: basicColors[14], - linkTextFill: basicColors[6], - opacity: 1, - textAlign: isTable ? 'center' : 'left', - textBaseline: 'middle', - }, - bolderText: { - fontFamily: FONT_FAMILY, - fontSize: 12, - fontWeight: boldTextDefaultFontWeight, - fill: basicColors[14], - linkTextFill: basicColors[6], - opacity: 1, - textAlign: isTable ? 'center' : 'left', - textBaseline: 'middle', - }, - text: { - fontFamily: FONT_FAMILY, - fontSize: 12, - fontWeight: 'normal', - fill: basicColors[14], - linkTextFill: basicColors[6], - opacity: 1, - textBaseline: 'middle', - // default align center for row cell in table mode - textAlign: isTable ? 'center' : 'left', - }, - cell: { - // ----------- background color ----------- - backgroundColor: basicColors[1], - backgroundColorOpacity: 1, - // ----------- bottom border color -------------- - horizontalBorderColor: basicColors[9], - horizontalBorderColorOpacity: 1, - verticalBorderColor: basicColors[9], - verticalBorderColorOpacity: 1, - // ----------- bottom border width -------------- - horizontalBorderWidth: 1, - verticalBorderWidth: 1, - // -------------- border dash ----------------- - borderDash: [], - // -------------- layout ----------------- - padding: { - top: 4, - right: 8, - bottom: 4, - left: 8, - }, + const spreadsheet = themeCfg?.spreadsheet; + + const customTheme = themeCfg?.getCustomTheme?.(palette, spreadsheet); + + return merge( + { + // ------------- Headers ------------------- + cornerCell: getCornerCellTheme(palette, spreadsheet), + rowCell: getRowCellTheme(palette, spreadsheet), + colCell: getColCellTheme(palette), + // ------------- DataCell ------------------- + dataCell: getDataCellTheme(palette), + // ------------- MergedCell ------------------- + mergedCell: getDataCellTheme(palette), + // resize active area + resizeArea: { + size: 3, + background: basicColors[7], + backgroundOpacity: 0, + guideLineColor: basicColors[7], + guideLineDisableColor: 'rgba(0,0,0,0.25)', + guideLineDash: [3, 3], /* ---------- interaction state ----------- */ interactionState: { - // -------------- hover ------------------- hover: { - backgroundColor: basicColors[2], - backgroundOpacity: 0.6, - }, - // -------------- selected ------------------- - selected: { - backgroundColor: basicColors[2], - backgroundOpacity: 0.6, - }, - // -------------- unselected ------------------- - unselected: { - backgroundOpacity: 0.3, - textOpacity: 0.3, - opacity: 0.3, - }, - // -------------- prepare select -------------- - prepareSelect: { - borderColor: basicColors[14], - borderOpacity: 1, - borderWidth: 1, - }, - // -------------- searchResult ------------------- - searchResult: { - backgroundColor: otherColors?.results ?? basicColors[2], - backgroundOpacity: 1, - }, - // -------------- highlight ------------------- - highlight: { - backgroundColor: otherColors?.highlight ?? basicColors[6], + backgroundColor: basicColors[7], backgroundOpacity: 1, }, }, }, - icon: { - fill: basicColors[14], - size: 10, - margin: { - right: 4, - left: 4, - }, + // ------------- scrollBar ------------------- + scrollBar: { + trackColor: 'rgba(0,0,0,0.01)', + thumbHoverColor: 'rgba(0,0,0,0.25)', + thumbColor: 'rgba(0,0,0,0.15)', + thumbHorizontalMinSize: 32, + thumbVerticalMinSize: 32, + size: isMobile() ? 3 : 6, + hoverSize: isMobile() ? 4 : 8, + lineCap: 'round', }, - seriesNumberWidth: 80, - }, - colCell: { - measureText: { - fontFamily: FONT_FAMILY, - fontSize: 12, - fontWeight: 'normal', - fill: basicColors[0], - linkTextFill: basicColors[6], - opacity: 1, - // 默认列头的数值字段和 dataCell 数值对齐 - textAlign: 'right', - textBaseline: 'middle', + // ------------- split line ----------------- + splitLine: { + horizontalBorderColor: basicColors[12], + horizontalBorderColorOpacity: 0.2, + horizontalBorderWidth: 2, + verticalBorderColor: basicColors[11], + verticalBorderColorOpacity: 0.25, + verticalBorderWidth: 2, + showShadow: true, + shadowWidth: 8, + shadowColors: { + left: 'rgba(0,0,0,0.1)', + right: 'rgba(0,0,0,0)', + }, + borderDash: [], }, - bolderText: { - fontFamily: FONT_FAMILY, - fontSize: 12, - fontWeight: boldTextDefaultFontWeight, - fill: basicColors[0], - linkTextFill: basicColors[6], - opacity: 1, - textAlign: 'center', - textBaseline: 'middle', + // ------------- prepareSelectMask ----------------- + prepareSelectMask: { + backgroundColor: basicColors[5], + backgroundOpacity: 0.3, }, - text: { - fontFamily: FONT_FAMILY, - fontSize: 12, - fontWeight: 'normal', - fill: basicColors[0], - linkTextFill: basicColors[6], + // ------------- canvas background + background: { + color: basicColors[8], opacity: 1, - textAlign: 'center', - textBaseline: 'middle', }, - cell: { - // ----------- background color ----------- - backgroundColor: basicColors[3], - backgroundColorOpacity: 1, - // ----------- border color -------------- - horizontalBorderColor: basicColors[10], - horizontalBorderColorOpacity: 1, - verticalBorderColor: basicColors[10], - verticalBorderColorOpacity: 1, - // ----------- border width -------------- - horizontalBorderWidth: 1, - verticalBorderWidth: 1, - // -------------- border dash ----------------- - borderDash: [], - // -------------- layout ----------------- - padding: { - top: 4, - right: 8, - bottom: 4, - left: 8, - }, - - /* ---------- interaction state ----------- */ - interactionState: { - // -------------- hover ------------------- - hover: { - backgroundColor: basicColors[4], - backgroundOpacity: 0.6, - }, - // -------------- selected ------------------- - selected: { - backgroundColor: basicColors[4], - backgroundOpacity: 0.6, - }, - // -------------- unselected ------------------- - unselected: { - backgroundOpacity: 0.3, - textOpacity: 0.3, - opacity: 0.3, - }, - // -------------- prepare select -------------- - prepareSelect: { - borderColor: basicColors[14], - borderOpacity: 1, - borderWidth: 1, - }, - // -------------- searchResult ------------------- - searchResult: { - backgroundColor: otherColors?.results ?? basicColors[2], - backgroundOpacity: 1, - }, - // -------------- highlight ------------------- - highlight: { - backgroundColor: otherColors?.highlight ?? basicColors[6], - backgroundOpacity: 1, + empty: { + icon: { + fill: '', + width: 64, + height: 41, + margin: { + top: 0, + right: 0, + bottom: 24, + left: 0, }, }, - }, - icon: { - fill: basicColors[0], - size: 10, - margin: { - top: 6, - right: 4, - bottom: 6, - left: 4, - }, - }, - }, - // ------------- DataCell ------------------- - dataCell: getDataCell(), - // ------------- MergedCell ------------------- - mergedCell: getDataCell(), - // resize active area - resizeArea: { - size: 3, - background: basicColors[7], - backgroundOpacity: 0, - guideLineColor: basicColors[7], - guideLineDisableColor: 'rgba(0,0,0,0.25)', - guideLineDash: [3, 3], - - /* ---------- interaction state ----------- */ - interactionState: { - hover: { - backgroundColor: basicColors[7], - backgroundOpacity: 1, - }, - }, - }, - // ------------- scrollBar ------------------- - scrollBar: { - trackColor: 'rgba(0,0,0,0.01)', - thumbHoverColor: 'rgba(0,0,0,0.25)', - thumbColor: 'rgba(0,0,0,0.15)', - thumbHorizontalMinSize: 32, - thumbVerticalMinSize: 32, - size: isMobile() ? 3 : 6, - hoverSize: isMobile() ? 4 : 8, - lineCap: 'round', - }, - // ------------- split line ----------------- - splitLine: { - horizontalBorderWidth: 2, - verticalBorderWidth: 2, - showShadow: true, - shadowWidth: 8, - shadowColors: { - left: 'rgba(0,0,0,0.1)', - right: 'rgba(0,0,0,0)', - }, - borderDash: [], - }, - // ------------- prepareSelectMask ----------------- - prepareSelectMask: { - backgroundColor: basicColors[5], - backgroundOpacity: 0.3, - }, - // ------------- canvas background - background: { - color: basicColors[8], - opacity: 1, - }, - empty: { - icon: { - fill: '', - width: 64, - height: 41, - margin: { - top: 0, - right: 0, - bottom: 24, - left: 0, + description: { + fontFamily: FONT_FAMILY, + fontSize: 12, + fontWeight: 'normal', + fill: basicColors[14], + opacity: 1, }, }, - description: { - fontFamily: FONT_FAMILY, - fontSize: 12, - fontWeight: 'normal', - fill: basicColors[14], - opacity: 1, - }, }, - }; + customTheme, + ); }; diff --git a/packages/s2-core/src/ui/hd-adapter/index.ts b/packages/s2-core/src/ui/hd-adapter/index.ts index 9d326b9bbb..9bb2dac7b1 100644 --- a/packages/s2-core/src/ui/hd-adapter/index.ts +++ b/packages/s2-core/src/ui/hd-adapter/index.ts @@ -110,6 +110,10 @@ export class HdAdapter { private renderByDevicePixelRatio = async ( ratio = window.devicePixelRatio, ) => { + if (this.spreadsheet.destroyed) { + return; + } + const { container, options: { width, height }, @@ -130,6 +134,10 @@ export class HdAdapter { }; private renderByZoomScale = debounce(async (event: Event) => { + if (this.spreadsheet.destroyed) { + return; + } + const target = event.target as VisualViewport; const ratio = Math.ceil(target?.scale); diff --git a/packages/s2-core/src/ui/tooltip/index.less b/packages/s2-core/src/ui/tooltip/index.less index a5be94f521..075d337a43 100644 --- a/packages/s2-core/src/ui/tooltip/index.less +++ b/packages/s2-core/src/ui/tooltip/index.less @@ -1,4 +1,5 @@ @import '../../styles/variables.less'; +@import '../../styles/theme/dark.less'; .@{tooltip-cls-prefix} { &-container { diff --git a/packages/s2-core/src/ui/tooltip/index.ts b/packages/s2-core/src/ui/tooltip/index.ts index fa34348899..b971c3db96 100644 --- a/packages/s2-core/src/ui/tooltip/index.ts +++ b/packages/s2-core/src/ui/tooltip/index.ts @@ -11,7 +11,6 @@ import { getAutoAdjustPosition, setTooltipContainerStyle, } from '../../utils/tooltip'; - import './index.less'; /** @@ -73,6 +72,7 @@ export class BaseTooltip< pointerEvents: 'all', }, visible: true, + dark: this.spreadsheet.getThemeName() === 'dark', }); } diff --git a/packages/s2-core/src/utils/cell/header-cell.ts b/packages/s2-core/src/utils/cell/header-cell.ts index eb16aee33c..cca3206659 100644 --- a/packages/s2-core/src/utils/cell/header-cell.ts +++ b/packages/s2-core/src/utils/cell/header-cell.ts @@ -14,16 +14,17 @@ import type { import type { Node } from '../../facet/layout/node'; const normalizeIcons = ( - icons: HeaderActionName[], + icons: HeaderActionName[] = [], position: IconPosition = 'right', -) => - icons.map((icon) => { +) => { + return icons.map((icon) => { if (typeof icon === 'string') { return { name: icon, position }; } return icon; }); +}; const normalizeActionIconCfg = (actionIconList: HeaderActionIcon[] = []) => actionIconList.map( diff --git a/packages/s2-core/src/utils/cell/index.ts b/packages/s2-core/src/utils/cell/index.ts new file mode 100644 index 0000000000..e7b8f4e0bc --- /dev/null +++ b/packages/s2-core/src/utils/cell/index.ts @@ -0,0 +1,6 @@ +export * from './cell'; +export * from './data-cell'; +export * from './header-cell'; +export * from './merged-cell'; +export * from './table-col-cell'; +export * from './text-scrolling'; diff --git a/packages/s2-core/src/utils/cell/merged-cell.ts b/packages/s2-core/src/utils/cell/merged-cell.ts new file mode 100644 index 0000000000..378335f457 --- /dev/null +++ b/packages/s2-core/src/utils/cell/merged-cell.ts @@ -0,0 +1,140 @@ +import { find, forEach, includes, isEqual } from 'lodash'; +import type { DataCell } from '../../cell'; + +/** + * according to the coordinates of the starting point of the rectangle, + * return the four sides of the rectangle in a clockwise direction. + * [TopLeft] --- [TopRight] + * | | + * [BottomLeft] -[BottomRight] + * @param x + * @param y + * @param width + * @param height + */ +export const getRectangleEdges = ( + x: number, + y: number, + width: number, + height: number, +) => { + const topLeft: [number, number] = [x, y]; + + const topRight: [number, number] = [x + width, y]; + + const bottomRight: [number, number] = [x + width, y + height]; + + const bottomLeft: [number, number] = [x, y + height]; + + return [ + [topLeft, topRight], + [topRight, bottomRight], + [bottomRight, bottomLeft], + [bottomLeft, topLeft], + ]; +}; + +/** + * return the edges without overlapping edges + * @param edges the collection of edges + */ +export const unique = (edges: [number, number][][]) => { + const result: [number, number][][] = []; + + forEach(edges, (edge) => { + const reverseEdge = [edge[1], edge[0]]; + + if (!JSON.stringify(edges).includes(JSON.stringify(reverseEdge))) { + result.push(edge); + } + }); + + return result; +}; + +/** + * return the edge according to the coordinate of current edge + * eg: curEdge: [[0,0], [100,0]] then the next edge: [[100, 0 ], [100, 100]] + * @param curEdge the coordinate of current edge + * @param edges the collection of edges + */ +export const getNextEdge = ( + curEdge: [number, number][], + edges: [number, number][][], +): [number, number][] | undefined => + find(edges, (edge) => isEqual(edge[0], curEdge[1])); +/** + * return all the points of the polygon + * @param cells the collection of information of cells which needed be merged + */ +export const getPolygonPoints = (cells: DataCell[]) => { + let allEdges: [number, number][][] = []; + + cells.forEach((cell) => { + const meta = cell.getMeta(); + const { x, y, width, height } = meta; + + allEdges = allEdges.concat(getRectangleEdges(x, y, width, height)); + }); + allEdges = unique(allEdges); + + let allPoints: [number, number][] = []; + const startEdge = allEdges[0]; + let curEdge = startEdge; + let nextEdge: [number, number][] | undefined = []; + + while (!isEqual(startEdge, nextEdge)) { + allPoints = allPoints.concat(curEdge); + nextEdge = getNextEdge(curEdge, allEdges); + curEdge = nextEdge!; + } + + return allPoints; +}; + +export const getRightAndBottomCells = (cells: DataCell[]) => { + const right: DataCell[] = []; + const bottom: DataCell[] = []; + const bottomRightCornerCell: DataCell[] = []; + + cells.forEach((cell) => { + const [row, col] = cell.position || []; + + if ( + !find( + cells, + (temp) => temp.position?.[0] === row + 1 && temp.position?.[1] === col, + ) + ) { + bottom.push(cell); + } + + if ( + !find( + cells, + (temp) => temp.position?.[1] === col + 1 && temp.position?.[0] === row, + ) + ) { + right.push(cell); + } + }); + + // 在绘制了 right border 后,如果它上面的 cell 也是 merge cell 中的,且无需绘制 right 时,需要单独为其位置 bottomRight corner 的 border,反正连线会断 + right.forEach((cell) => { + const [row, col] = cell.position || []; + const top = find( + cells, + (temp) => temp.position?.[0] === row - 1 && temp.position?.[1] === col, + ); + + if (top && !includes(right, top)) { + bottomRightCornerCell.push(top); + } + }); + + return { + bottom, + right, + bottomRightCornerCell, + }; +}; diff --git a/packages/s2-core/src/utils/condition/condition.ts b/packages/s2-core/src/utils/condition/condition.ts index b1e3b0bcbd..6b9cd9d9e6 100644 --- a/packages/s2-core/src/utils/condition/condition.ts +++ b/packages/s2-core/src/utils/condition/condition.ts @@ -1,4 +1,4 @@ -import { clamp, findLast } from 'lodash'; +import { clamp, compact, findLast } from 'lodash'; import type { Condition, IconCondition } from '../../common/interface'; import { parseNumberWithPrecision } from '../formatter'; @@ -60,7 +60,7 @@ export const findFieldCondition = ( conditions: T[] = [], field: string, ): T | undefined => { - return findLast(conditions, (item) => { + return findLast(compact(conditions), (item) => { return item.field instanceof RegExp ? item.field.test(field) : item.field === field; diff --git a/packages/s2-core/src/utils/dataset/pivot-data-set.ts b/packages/s2-core/src/utils/dataset/pivot-data-set.ts index 015a9d2864..022eb8c7aa 100644 --- a/packages/s2-core/src/utils/dataset/pivot-data-set.ts +++ b/packages/s2-core/src/utils/dataset/pivot-data-set.ts @@ -8,10 +8,11 @@ import { isArray, isEmpty, isNull, + isString, last, set, } from 'lodash'; -import type { RawData } from '../../common'; +import type { CustomHeaderFields, RawData } from '../../common'; import { EMPTY_EXTRA_FIELD_PLACEHOLDER, EXTRA_FIELD, @@ -37,7 +38,7 @@ import type { import type { Node } from '../../facet/layout/node'; import { generateNillString } from '../layout/generate-id'; -export function filterExtraDimension(dimensions: string[] = []) { +export function filterExtraDimension(dimensions: CustomHeaderFields = []) { return dimensions.filter((d) => d !== EXTRA_FIELD); } @@ -89,7 +90,7 @@ export function getExistValues(data: RawData, values: string[]) { return result; } -export function transformDimensionsValuesWithExtraFields( +function transformDimensionsValuesWithExtraFields( record: RawData = {}, dimensions: string[] = [], values: string[] | null, @@ -293,13 +294,20 @@ export interface TransformResult { sortedDimensionValues: SortedDimensionValues; } +/** + * 获取用于数据 transform 中定位的 string 的字段,自定义布局中,自定义字段是 object 类型,这些类型不应该参与到数据处理的流程中 + */ +export function getIndexFields(fields: CustomHeaderFields = []) { + return fields.filter(isString); +} + /** * 转换原始数据为二维数组数据 */ export function transformIndexesData(params: Param): TransformResult { const { - rows, - columns, + rows = [], + columns = [], values, valueInCols, data = [], @@ -337,7 +345,7 @@ export function transformIndexesData(params: Param): TransformResult { ).push(dimensionPath); }; - const prefix = getDataPathPrefix(rows, columns as string[]); + const prefix = getDataPathPrefix(rows, columns); data.forEach((item: RawData) => { // 空数据没有意义,直接跳过 diff --git a/packages/s2-core/src/utils/export/copy/common.ts b/packages/s2-core/src/utils/export/copy/common.ts index d47f3ef743..5737cd1a38 100644 --- a/packages/s2-core/src/utils/export/copy/common.ts +++ b/packages/s2-core/src/utils/export/copy/common.ts @@ -1,5 +1,5 @@ import { escape, map, max } from 'lodash'; -import type { DataItem, SimpleData } from '../../../common'; +import type { CellMeta, DataItem, SimpleData } from '../../../common'; import { LINE_SEPARATOR, ROOT_NODE_ID, TAB_SEPARATOR } from '../../../common'; import { CopyMIMEType, @@ -13,6 +13,7 @@ import { type Transformer, } from '../../../common/interface/export'; import type { Node } from '../../../facet/layout/node'; +import type { SpreadSheet } from '../../../sheet-type/spread-sheet'; // 把 string[][] 矩阵转换成 CopyablePlain export const matrixPlainTextTransformer = ( @@ -228,3 +229,13 @@ export const getNodeFormatData = (leafNode: Node) => { return line; }; + +export const getHeaderNodeFromMeta = ( + meta: CellMeta, + spreadsheet: SpreadSheet, +) => { + const { rowIndex, colIndex } = meta; + const { facet } = spreadsheet; + + return [facet.getRowNodeByIndex(rowIndex), facet.getColNodeByIndex(colIndex)]; +}; diff --git a/packages/s2-core/src/utils/export/copy/core.ts b/packages/s2-core/src/utils/export/copy/core.ts index 109f9dd6da..b17c4c474f 100644 --- a/packages/s2-core/src/utils/export/copy/core.ts +++ b/packages/s2-core/src/utils/export/copy/core.ts @@ -27,16 +27,6 @@ import { processSelectedTableByHeader, } from './table-copy'; -export const getHeaderNodeFromMeta = ( - meta: CellMeta, - spreadsheet: SpreadSheet, -) => { - const { rowIndex, colIndex } = meta; - const { facet } = spreadsheet; - - return [facet.getRowNodeByIndex(rowIndex), facet.getColNodeByIndex(colIndex)]; -}; - /** * 返回选中数据单元格生成的二维数组( CellMeta[][]) * @param { CellMeta[] } cells @@ -216,9 +206,64 @@ export const asyncProcessAllSelected = ( ): Promise => { const { sheetInstance } = params; + const check = sheetInstance.enableAsyncExport(); + + if (check instanceof Error) { + // eslint-disable-next-line no-console + console.warn(check); + throw check; + } + if (sheetInstance.isPivotMode()) { return asyncProcessSelectedAllPivot(params); } return asyncProcessSelectedAllTable(params); }; + +/** + * 异步获取文本数据 (text/plain) + * @example + const data = await asyncGetAllPlainData({ + sheetInstance: s2, + split: '\t', + formatOptions: true, + }); + */ +export const asyncGetAllPlainData = async (params: CopyAllDataParams) => { + const result = await asyncProcessAllSelected(params); + + return result[0].content; +}; + +/** + * 异步获取富文本数据 (text/html) + * @example + const data = await asyncGetAllHtmlData({ + sheetInstance: s2, + split: '\t', + formatOptions: true, + }); + */ +export const asyncGetAllHtmlData = async (params: CopyAllDataParams) => { + const result = await asyncProcessAllSelected(params); + + return result[1].content; +}; + +/** + * 异步获取数据 + * - 文本 (text/plain) + * - 富文本 (text/html) + * @example + const data = await asyncGetAllData({ + sheetInstance: s2, + split: '\t', + formatOptions: true, + }); + */ +export const asyncGetAllData = async (params: CopyAllDataParams) => { + const result = await asyncProcessAllSelected(params); + + return result; +}; diff --git a/packages/s2-core/src/utils/export/copy/index.ts b/packages/s2-core/src/utils/export/copy/index.ts index dd7fcf3393..330a27906b 100644 --- a/packages/s2-core/src/utils/export/copy/index.ts +++ b/packages/s2-core/src/utils/export/copy/index.ts @@ -1,6 +1,9 @@ -import type { SheetCopyConstructorParams } from '../../../common/interface/export'; -import { getSelectedData } from './core'; -import { PivotDataCellCopy } from './pivot-data-cell-copy'; - -export { PivotDataCellCopy, getSelectedData }; -export type { SheetCopyConstructorParams }; +export type { SheetCopyConstructorParams } from '../../../common/interface/export'; +export { + asyncGetAllData, + asyncGetAllHtmlData, + asyncGetAllPlainData, + getSelectedData, +} from './core'; +export { PivotDataCellCopy } from './pivot-data-cell-copy'; +export { strategyCopy } from './strategy-copy'; diff --git a/packages/s2-core/src/utils/export/copy/pivot-data-cell-copy.ts b/packages/s2-core/src/utils/export/copy/pivot-data-cell-copy.ts index 6ee4fe1db7..72e21f42cb 100644 --- a/packages/s2-core/src/utils/export/copy/pivot-data-cell-copy.ts +++ b/packages/s2-core/src/utils/export/copy/pivot-data-cell-copy.ts @@ -24,9 +24,10 @@ import type { MeasureQuery, SheetCopyConstructorParams, } from '../../../common/interface/export'; -import type { CellData } from '../../../data-set'; +import type { CellData, Query } from '../../../data-set'; import type { Node } from '../../../facet/layout/node'; import type { SpreadSheet } from '../../../sheet-type'; +import { getHeaderTotalStatus } from '../../dataset/pivot-data-set'; import { convertString, getColNodeFieldFromNode, @@ -37,10 +38,10 @@ import { BaseDataCellCopy } from './base-data-cell-copy'; import { assembleMatrix, completeMatrix, + getHeaderNodeFromMeta, getMaxRowLen, getNodeFormatData, } from './common'; -import { getHeaderNodeFromMeta } from './core'; export class PivotDataCellCopy extends BaseDataCellCopy { protected leafRowNodes: Node[] = []; @@ -213,18 +214,22 @@ export class PivotDataCellCopy extends BaseDataCellCopy { }; }): DataItem => { const { measureQuery } = config; + const query: Query = { + ...rowNode.query, + ...colNode.query, + ...measureQuery, + }; + const isTotals = + rowNode.isTotals || + rowNode.isTotalMeasure || + colNode.isTotals || + colNode.isTotalMeasure; + const cellData = this.spreadsheet.dataSet.getCellData({ - query: { - ...rowNode.query, - ...colNode.query, - ...measureQuery, - }, + query, rowNode, - isTotals: - rowNode.isTotals || - rowNode.isTotalMeasure || - colNode.isTotals || - colNode.isTotalMeasure, + isTotals, + totalStatus: getHeaderTotalStatus(rowNode, colNode), }); const formatNode = this.spreadsheet.isValueInCols() ? colNode : rowNode; diff --git a/packages/s2-react/src/components/export/strategy-copy.ts b/packages/s2-core/src/utils/export/copy/strategy-copy.ts similarity index 91% rename from packages/s2-react/src/components/export/strategy-copy.ts rename to packages/s2-core/src/utils/export/copy/strategy-copy.ts index a7f838c3e4..f5d635ae8e 100644 --- a/packages/s2-react/src/components/export/strategy-copy.ts +++ b/packages/s2-core/src/utils/export/copy/strategy-copy.ts @@ -1,18 +1,17 @@ -import { - PivotDataCellCopy, - assembleMatrix, - getEmptyPlaceholder, - getHeaderList, - getNodeFormatData, - safeJsonParse, - type CopyAllDataParams, - type CopyableList, - type Node, - type SheetCopyConstructorParams, - type SimpleData, - type ViewMeta, -} from '@antv/s2'; import { flatten, forEach, get, isArray, isNil, isObject, map } from 'lodash'; +import type { + CopyAllDataParams, + CopyableList, + SheetCopyConstructorParams, + SimpleData, + ViewMeta, +} from '../../../common'; +import type { Node } from '../../../facet/layout/node'; +import { safeJsonParse } from '../../common'; +import { getEmptyPlaceholder } from '../../text'; +import { getHeaderList } from '../method'; +import { assembleMatrix, getNodeFormatData } from './common'; +import { PivotDataCellCopy } from './pivot-data-cell-copy'; /** * Process the multi-measure with single-lines diff --git a/packages/s2-core/src/utils/export/copy/table-copy.ts b/packages/s2-core/src/utils/export/copy/table-copy.ts index 22d281044e..92dbda7abb 100644 --- a/packages/s2-core/src/utils/export/copy/table-copy.ts +++ b/packages/s2-core/src/utils/export/copy/table-copy.ts @@ -18,8 +18,7 @@ import { getSelectedRows, } from '../method'; import { BaseDataCellCopy } from './base-data-cell-copy'; -import { assembleMatrix } from './common'; -import { getHeaderNodeFromMeta } from './core'; +import { assembleMatrix, getHeaderNodeFromMeta } from './common'; class TableDataCellCopy extends BaseDataCellCopy { private displayData: RawData[]; diff --git a/packages/s2-core/src/utils/export/index.ts b/packages/s2-core/src/utils/export/index.ts index f5998817fc..694abfb13a 100644 --- a/packages/s2-core/src/utils/export/index.ts +++ b/packages/s2-core/src/utils/export/index.ts @@ -1,11 +1,11 @@ -import type { +export type { CopyableList, FormatOptions, } from '../../common/interface/export'; -import { assembleMatrix, getMaxRowLen, getNodeFormatData } from './copy/common'; -import { getHeaderList } from './method'; + +export { assembleMatrix, getMaxRowLen, getNodeFormatData } from './copy/common'; +export { asyncGetAllPlainData } from './copy/core'; +export { getHeaderList } from './method'; export * from './copy'; export * from './utils'; -export { assembleMatrix, getHeaderList, getMaxRowLen, getNodeFormatData }; -export type { CopyableList, FormatOptions }; diff --git a/packages/s2-core/src/utils/export/method.ts b/packages/s2-core/src/utils/export/method.ts index 16a7e8bb50..1437cb3f18 100644 --- a/packages/s2-core/src/utils/export/method.ts +++ b/packages/s2-core/src/utils/export/method.ts @@ -14,6 +14,7 @@ import { import type { Node } from '../../facet/layout/node'; import type { SpreadSheet } from '../../sheet-type'; import { resolveNillString } from '../layout'; +import { replaceEmptyFieldValue } from '../text'; export function keyEqualTo(key: string, compareKey: string) { if (!key || !compareKey) { @@ -64,8 +65,9 @@ export const getHeaderMeasureFieldNames = ( } // https://github.com/antvis/S2/issues/2688 + // https://github.com/antvis/S2/pull/2829 if (!formatHeader) { - return resolveNillString(field); + return replaceEmptyFieldValue(resolveNillString(field)!); } return spreadsheet.dataSet.getFieldName(field); diff --git a/packages/s2-core/src/utils/export/utils.ts b/packages/s2-core/src/utils/export/utils.ts index d12f34dbf3..7799d081bf 100644 --- a/packages/s2-core/src/utils/export/utils.ts +++ b/packages/s2-core/src/utils/export/utils.ts @@ -1,11 +1,9 @@ import { concat, get } from 'lodash'; import { CopyMIMEType, - type CopyAllDataParams, type Copyable, type CopyableItem, } from '../../common/interface/export'; -import { asyncProcessAllSelected } from './copy/core'; /** * 同步复制 @@ -114,50 +112,3 @@ export const download = (dataString: string, fileName: string) => { console.error(error); } }; - -/** - * 异步获取文本数据 (text/plain) - * @example - const data = await asyncGetAllPlainData({ - sheetInstance: s2, - split: '\t', - formatOptions: true, - }); - */ -export const asyncGetAllPlainData = async (params: CopyAllDataParams) => { - const result = await asyncProcessAllSelected(params); - - return result[0].content; -}; - -/** - * 异步获取富文本数据 (text/html) - * @example - const data = await asyncGetAllHtmlData({ - sheetInstance: s2, - split: '\t', - formatOptions: true, - }); - */ -export const asyncGetAllHtmlData = async (params: CopyAllDataParams) => { - const result = await asyncProcessAllSelected(params); - - return result[1].content; -}; - -/** - * 异步获取数据 - * - 文本 (text/plain) - * - 富文本 (text/html) - * @example - const data = await asyncGetAllData({ - sheetInstance: s2, - split: '\t', - formatOptions: true, - }); - */ -export const asyncGetAllData = async (params: CopyAllDataParams) => { - const result = await asyncProcessAllSelected(params); - - return result; -}; diff --git a/packages/s2-core/src/utils/hide-columns.ts b/packages/s2-core/src/utils/hide-columns.ts index 2c71b16ea7..9c59de0128 100644 --- a/packages/s2-core/src/utils/hide-columns.ts +++ b/packages/s2-core/src/utils/hide-columns.ts @@ -131,7 +131,7 @@ export const hideColumns = async ( spreadsheet.store.set('hiddenColumnsDetail', hiddenColumnsDetail); await spreadsheet.render({ reloadData: false, - reBuildHiddenColumnsDetail: false, + rebuildHiddenColumnsDetail: false, }); }; diff --git a/packages/s2-core/src/utils/index.ts b/packages/s2-core/src/utils/index.ts index 74db754040..99004a5424 100644 --- a/packages/s2-core/src/utils/index.ts +++ b/packages/s2-core/src/utils/index.ts @@ -1,13 +1,15 @@ export { auto } from './formatter'; export * from './canvas'; -export * from './cell/cell'; -export * from './cell/data-cell'; +export * from './cell'; export * from './color'; export * from './common'; +export * from './dataset/pivot-data-set'; export * from './export'; +export * from './facet'; export * from './g-mini-charts'; export * from './g-renders'; +export * from './get-all-child-cells'; export * from './get-classnames'; export * from './inject-css-text'; export * from './interaction'; @@ -15,6 +17,7 @@ export * from './is-mobile'; export * from './layout'; export * from './math'; export * from './merge'; +export * from './schedule'; export * from './sort-action'; export * from './text'; export * from './theme'; diff --git a/packages/s2-core/src/utils/indexes.ts b/packages/s2-core/src/utils/indexes.ts index 141200d4e2..bd422a0494 100644 --- a/packages/s2-core/src/utils/indexes.ts +++ b/packages/s2-core/src/utils/indexes.ts @@ -106,7 +106,7 @@ export const diffPanelIndexes = ( const allAdd: Diff['add'] = []; const allRemove: Diff['remove'] = []; - Object.keys(targetIndexes).forEach((key) => { + Object.keys(targetIndexes || {}).forEach((key) => { const { add, remove } = diffIndexes( sourceIndexes?.[key as keyof PanelIndexes] || ([] as unknown as Indexes), targetIndexes[key as keyof PanelIndexes]!, diff --git a/packages/s2-core/src/utils/interaction/formatter.ts b/packages/s2-core/src/utils/interaction/formatter.ts index 20c05c24cb..c346f26ada 100644 --- a/packages/s2-core/src/utils/interaction/formatter.ts +++ b/packages/s2-core/src/utils/interaction/formatter.ts @@ -1,12 +1,18 @@ import type { DisplayObject, FederatedPointerEvent as Event } from '@antv/g'; import type { S2CellType, TargetCellInfo } from '../../common/interface'; +import type { SpreadSheet } from '../../sheet-type'; import { getAppendInfo } from './common'; /* formate the base Event data */ -export const getBaseCellData = (event: Event): TargetCellInfo => { +export const getBaseCellData = ( + event: Event, + s2?: SpreadSheet, +): TargetCellInfo => { const targetElement = event?.target as unknown as DisplayObject; const currentCellMeta = getAppendInfo(targetElement)?.meta; - const target = targetElement?.parentNode as S2CellType; + // https://github.com/antvis/S2/issues/2985 + const target = + s2?.getCell?.(targetElement)! || (targetElement?.parentNode as S2CellType); const viewMeta = target?.getMeta?.() || currentCellMeta; return { diff --git a/packages/s2-core/src/utils/interaction/hover-event.ts b/packages/s2-core/src/utils/interaction/hover-event.ts index 139983aa08..cca4c5d284 100644 --- a/packages/s2-core/src/utils/interaction/hover-event.ts +++ b/packages/s2-core/src/utils/interaction/hover-event.ts @@ -1,5 +1,5 @@ import { filter, forEach } from 'lodash'; -import type { ColCell, HeaderCell } from '../../cell'; +import type { HeaderCell } from '../../cell'; import { InteractionStateName, NODE_ID_SEPARATOR } from '../../common/constant'; import { generateId } from '../layout/generate-id'; @@ -33,13 +33,13 @@ export const getActiveHoverHeaderCells = ( return allHeaderCells; }; -export const updateAllColHeaderCellState = ( - colId: string | undefined, - colHeaderCells: ColCell[], +export const updateAllHeaderCellState = ( + id: string | undefined, + headerCells: HeaderCell[], stateName: InteractionStateName, ) => { - if (colId) { - const allColHeaderCells = getActiveHoverHeaderCells(colId, colHeaderCells); + if (id) { + const allColHeaderCells = getActiveHoverHeaderCells(id, headerCells); forEach(allColHeaderCells, (cell) => { cell.updateByState(stateName); diff --git a/packages/s2-core/src/utils/interaction/index.ts b/packages/s2-core/src/utils/interaction/index.ts index 813cf7b201..9a72c1e0f1 100644 --- a/packages/s2-core/src/utils/interaction/index.ts +++ b/packages/s2-core/src/utils/interaction/index.ts @@ -2,6 +2,7 @@ export * from './formatter'; export * from './hover-event'; export * from './link-field'; export * from './merge-cell'; +export * from './resize'; export * from './scroll'; export * from './select-event'; export * from './state-controller'; diff --git a/packages/s2-core/src/utils/interaction/merge-cell.ts b/packages/s2-core/src/utils/interaction/merge-cell.ts index 4804104755..4d4329c089 100644 --- a/packages/s2-core/src/utils/interaction/merge-cell.ts +++ b/packages/s2-core/src/utils/interaction/merge-cell.ts @@ -4,7 +4,6 @@ import { filter, find, forEach, - includes, isEmpty, isEqual, map, @@ -20,145 +19,6 @@ import type { } from '../../common/interface'; import type { SpreadSheet } from '../../sheet-type'; -/** - * according to the coordinates of the starting point of the rectangle, - * return the four sides of the rectangle in a clockwise direction. - * [TopLeft] --- [TopRight] - * | | - * [BottomLeft] -[BottomRight] - * @param x - * @param y - * @param width - * @param height - */ -export const getRectangleEdges = ( - x: number, - y: number, - width: number, - height: number, -) => { - const topLeft: [number, number] = [x, y]; - - const topRight: [number, number] = [x + width, y]; - - const bottomRight: [number, number] = [x + width, y + height]; - - const bottomLeft: [number, number] = [x, y + height]; - - return [ - [topLeft, topRight], - [topRight, bottomRight], - [bottomRight, bottomLeft], - [bottomLeft, topLeft], - ]; -}; - -/** - * return the edges without overlapping edges - * @param edges the collection of edges - */ -export const unique = (edges: [number, number][][]) => { - const result: [number, number][][] = []; - - forEach(edges, (edge) => { - const reverseEdge = [edge[1], edge[0]]; - - if (!JSON.stringify(edges).includes(JSON.stringify(reverseEdge))) { - result.push(edge); - } - }); - - return result; -}; - -/** - * return the edge according to the coordinate of current edge - * eg: curEdge: [[0,0], [100,0]] then the next edge: [[100, 0 ], [100, 100]] - * @param curEdge the coordinate of current edge - * @param edges the collection of edges - */ -export const getNextEdge = ( - curEdge: [number, number][], - edges: [number, number][][], -): [number, number][] | undefined => - find(edges, (edge) => isEqual(edge[0], curEdge[1])); - -/** - * return all the points of the polygon - * @param cells the collection of information of cells which needed be merged - */ -export const getPolygonPoints = (cells: DataCell[]) => { - let allEdges: [number, number][][] = []; - - cells.forEach((cell) => { - const meta = cell.getMeta(); - const { x, y, width, height } = meta; - - allEdges = allEdges.concat(getRectangleEdges(x, y, width, height)); - }); - allEdges = unique(allEdges); - - let allPoints: [number, number][] = []; - const startEdge = allEdges[0]; - let curEdge = startEdge; - let nextEdge: [number, number][] | undefined = []; - - while (!isEqual(startEdge, nextEdge)) { - allPoints = allPoints.concat(curEdge); - nextEdge = getNextEdge(curEdge, allEdges); - curEdge = nextEdge!; - } - - return allPoints; -}; - -export const getRightAndBottomCells = (cells: DataCell[]) => { - const right: DataCell[] = []; - const bottom: DataCell[] = []; - const bottomRightCornerCell: DataCell[] = []; - - cells.forEach((cell) => { - const [row, col] = cell.position || []; - - if ( - !find( - cells, - (temp) => temp.position?.[0] === row + 1 && temp.position?.[1] === col, - ) - ) { - bottom.push(cell); - } - - if ( - !find( - cells, - (temp) => temp.position?.[1] === col + 1 && temp.position?.[0] === row, - ) - ) { - right.push(cell); - } - }); - - // 在绘制了 right border 后,如果它上面的 cell 也是 merge cell 中的,且无需绘制 right 时,需要单独为其位置 bottomRight corner 的 border,反正连线会断 - right.forEach((cell) => { - const [row, col] = cell.position || []; - const top = find( - cells, - (temp) => temp.position?.[0] === row - 1 && temp.position?.[1] === col, - ); - - if (top && !includes(right, top)) { - bottomRightCornerCell.push(top); - } - }); - - return { - bottom, - right, - bottomRightCornerCell, - }; -}; - /** * get cells on the outside of visible area through mergeCellInfo * @param invisibleCellInfo diff --git a/packages/s2-core/src/utils/interaction/select-event.ts b/packages/s2-core/src/utils/interaction/select-event.ts index b88ab0f515..d960b0727e 100644 --- a/packages/s2-core/src/utils/interaction/select-event.ts +++ b/packages/s2-core/src/utils/interaction/select-event.ts @@ -1,11 +1,6 @@ -import { reduce, uniqBy } from 'lodash'; +import { groupBy, map, mapValues, reduce, uniqBy } from 'lodash'; import { HeaderCell, TableSeriesNumberCell } from '../../cell'; -import { - CellType, - InteractionKeyboardKey, - InteractionStateName, - S2Event, -} from '../../common/constant'; +import { CellType, InteractionKeyboardKey } from '../../common/constant'; import type { CellMeta, OnUpdateCells, @@ -45,16 +40,6 @@ export const getCellMeta = (cell: S2CellType): CellMeta => { }; }; -export const selectCells = (spreadsheet: SpreadSheet, cells: CellMeta[]) => { - const { interaction } = spreadsheet; - - interaction.changeState({ - stateName: InteractionStateName.SELECTED, - cells, - }); - spreadsheet.emit(S2Event.GLOBAL_SELECTED, interaction.getActiveCells()); -}; - export function getRangeIndex( start: T, end: T, @@ -169,3 +154,9 @@ export const afterSelectDataCells: OnUpdateCells = (root, updateDataCells) => { updateDataCells(); }; + +export type SelectedIds = { [type in CellType]?: string[] }; + +export const groupSelectedCells = (selectedCells: CellMeta[]): SelectedIds => { + return mapValues(groupBy(selectedCells, 'type'), (cells) => map(cells, 'id')); +}; diff --git a/packages/s2-core/src/utils/layout/generate-header-nodes.ts b/packages/s2-core/src/utils/layout/generate-header-nodes.ts index b17e6ca92c..da200117c0 100644 --- a/packages/s2-core/src/utils/layout/generate-header-nodes.ts +++ b/packages/s2-core/src/utils/layout/generate-header-nodes.ts @@ -1,6 +1,5 @@ import { EMPTY_FIELD_VALUE, EXTRA_FIELD } from '../../common/constant'; import { i18n } from '../../common/i18n'; -import { buildGridHierarchy } from '../../facet/layout/build-gird-hierarchy'; import type { FieldValue, HeaderNodesParams, @@ -25,6 +24,7 @@ export const generateHeaderNodes = (params: HeaderNodesParams) => { addMeasureInTotalQuery, addTotalMeasureInTotal, spreadsheet, + handler, } = params; const isTableMode = spreadsheet.isTableMode(); @@ -33,8 +33,8 @@ export const generateHeaderNodes = (params: HeaderNodesParams) => { const fieldValue = resolveNillString( originalFieldValue as string, ) as FieldValue; - const isTotals = fieldValue instanceof TotalClass; - const isTotalMeasure = fieldValue instanceof TotalMeasure; + const isTotals = TotalClass.isTotalClassInstance(fieldValue); + const isTotalMeasure = TotalMeasure.isTotalMeasureInstance(fieldValue); let value: string; let nodeQuery: Record; let isLeaf = false; @@ -44,14 +44,12 @@ export const generateHeaderNodes = (params: HeaderNodesParams) => { let adjustedField = currentField; if (isTotals) { - const totalClass = fieldValue as TotalClass; - - isGrandTotals = totalClass.isGrandTotals; - isSubTotals = totalClass.isSubTotals; - isTotalRoot = totalClass.isTotalRoot; - value = i18n((fieldValue as TotalClass).label); + isGrandTotals = fieldValue.isGrandTotals; + isSubTotals = fieldValue.isSubTotals; + isTotalRoot = fieldValue.isTotalRoot; + value = i18n(fieldValue.label); if (isTotalRoot) { - nodeQuery = query; + nodeQuery = { ...query }; } else { // root[&]四川[&]总计 => {province: '四川'} nodeQuery = { ...query, [currentField]: value }; @@ -64,7 +62,7 @@ export const generateHeaderNodes = (params: HeaderNodesParams) => { isLeaf = whetherLeafByLevel({ spreadsheet, level, fields }); } else if (isTotalMeasure) { - value = i18n((fieldValue as TotalMeasure).label); + value = i18n(fieldValue.label); // root[&]四川[&]总计[&]price => {province: '四川',EXTRA_FIELD: 'price' } nodeQuery = { ...query, [EXTRA_FIELD]: value }; adjustedField = EXTRA_FIELD; @@ -150,7 +148,7 @@ export const generateHeaderNodes = (params: HeaderNodesParams) => { hierarchy.pushIndexNode(node); node.rowIndex = hierarchy.getIndexNodes().length - 1; } else { - buildGridHierarchy({ + handler?.({ addTotalMeasureInTotal, addMeasureInTotalQuery, parentNode: node, @@ -158,7 +156,7 @@ export const generateHeaderNodes = (params: HeaderNodesParams) => { fields, hierarchy, spreadsheet, - }); + } as HeaderNodesParams); } } }; diff --git a/packages/s2-core/src/utils/merge.ts b/packages/s2-core/src/utils/merge.ts index 173a84607d..96ae47baf7 100644 --- a/packages/s2-core/src/utils/merge.ts +++ b/packages/s2-core/src/utils/merge.ts @@ -1,6 +1,6 @@ import { isArray, isEmpty, isEqual, isString, mergeWith, uniq } from 'lodash'; import { DEFAULT_DATA_CONFIG } from '../common/constant/dataConfig'; -import { DEFAULT_OPTIONS, LayoutWidthType } from '../common/constant/options'; +import { DEFAULT_OPTIONS } from '../common/constant/options'; import type { CustomHeaderFields, Fields, @@ -66,16 +66,7 @@ export const setupDataConfig = ( }; export const setupOptions = ( - options: Partial | null | undefined, + ...options: (Partial | null | undefined)[] ): S2Options => { - const mergedOptions = customMerge(DEFAULT_OPTIONS, options); - - if ( - mergedOptions.style?.layoutWidthType === LayoutWidthType.Compact && - mergedOptions.style?.dataCell!.maxLines! <= 1 - ) { - mergedOptions.style.dataCell!.wordWrap = false; - } - - return mergedOptions; + return customMerge(DEFAULT_OPTIONS, ...options); }; diff --git a/packages/s2-core/src/utils/schedule.ts b/packages/s2-core/src/utils/schedule.ts new file mode 100644 index 0000000000..2ed0cce391 --- /dev/null +++ b/packages/s2-core/src/utils/schedule.ts @@ -0,0 +1,5 @@ +export function waitForCellMounted(cb: () => void) { + Promise.resolve().then(() => { + cb(); + }); +} diff --git a/packages/s2-core/src/utils/sort-action.ts b/packages/s2-core/src/utils/sort-action.ts index 2d48cf58ef..da5ccf36b0 100644 --- a/packages/s2-core/src/utils/sort-action.ts +++ b/packages/s2-core/src/utils/sort-action.ts @@ -1,12 +1,12 @@ import { compact, - endsWith, flatMap, includes, indexOf, isEmpty, isNil, keys, + last, map, sortBy, split, @@ -108,8 +108,10 @@ export const sortByCustom = (params: SortActionParams): string[] => { const { sortByValues = [], originValues = [] } = params; // 从 originValues 中过滤出所有包含 sortByValue 的 id - const idWithPre = originValues.filter((originItem) => - sortByValues.find((value) => endsWith(originItem, value)), + const idWithPre = originValues.filter((originValue) => + sortByValues.find((value) => { + return last(split(originValue, NODE_ID_SEPARATOR)) === value; + }), ); // 将 id 拆分为父节点和目标节点 const idListWithPre = idWithPre.map((idStr) => { @@ -320,17 +322,17 @@ export const getSortByMeasureValues = ( const isSortFieldInRow = includes(fields.rows, sortFieldId); // 排序字段所在一侧的全部字段 const sortFields = filterExtraDimension( - (isSortFieldInRow ? fields.rows : columns) as string[], + isSortFieldInRow ? fields.rows : columns, ); // 与排序交叉的另一侧全部字段 const oppositeFields = filterExtraDimension( - (isSortFieldInRow ? columns : fields.rows) as string[], + isSortFieldInRow ? columns : fields.rows, ); const fieldAfterSortField = sortFields[sortFields.indexOf(sortFieldId) + 1]; const queryKeys = keys(query); const missedOppositeFields = oppositeFields.filter( - (field) => !queryKeys.includes(field), + (field) => !queryKeys.includes(field as string), ); const totalDataList = dataList.filter((dataItem) => { @@ -345,7 +347,7 @@ export const getSortByMeasureValues = ( return false; } - if (dataItemKeys.has(fieldAfterSortField)) { + if (dataItemKeys.has(fieldAfterSortField as string)) { /* * 若排序数据包含`排序字段`的后一个维度字段,则过滤 * 不需要比排序字段更 “明细” 的数据,只需取到 sortFieldId 当级的汇总 @@ -359,7 +361,7 @@ export const getSortByMeasureValues = ( * 如 query={ type: 'xx',EXTRA_FIELD=price },代表了最高可以取到 type 的小计汇总数据 */ const allMissed = missedOppositeFields.every( - (missedField) => !dataItemKeys.has(missedField), + (missedField) => !dataItemKeys.has(missedField as string), ); // 返回符合要求的汇总数据 diff --git a/packages/s2-core/src/utils/theme.ts b/packages/s2-core/src/utils/theme.ts index f84f16242e..6681c78bdf 100644 --- a/packages/s2-core/src/utils/theme.ts +++ b/packages/s2-core/src/utils/theme.ts @@ -1,7 +1,5 @@ -import { PALETTE_MAP, STYLE_ELEMENT_ID } from '../common/constant'; +import { PALETTE_MAP } from '../common/constant'; import type { Palette, ThemeName } from '../common/interface/theme'; -import DarkVars from '../styles/theme/dark.less?inline'; -import { injectCssText } from './inject-css-text'; /** * 获取当前的主题色板 @@ -9,11 +7,3 @@ import { injectCssText } from './inject-css-text'; export const getPalette = (themeName?: ThemeName): Palette => { return PALETTE_MAP[themeName!] || PALETTE_MAP['default']; }; - -/** - * 根据主题注入组件的 CSS 变量 - */ -export const injectThemeVars = (themeName?: ThemeName) => { - // 目前仅 dark 主题需要定制 - injectCssText(STYLE_ELEMENT_ID, themeName === 'dark' ? DarkVars : ''); -}; diff --git a/packages/s2-core/src/utils/tooltip.ts b/packages/s2-core/src/utils/tooltip.ts index 3232d595fa..b9dad19c2d 100644 --- a/packages/s2-core/src/utils/tooltip.ts +++ b/packages/s2-core/src/utils/tooltip.ts @@ -29,6 +29,7 @@ import { } from 'lodash'; import { CellType, + DARK_THEME_CLS, EXTRA_FIELD, PRECISION, VALUE_FIELD, @@ -153,13 +154,14 @@ export const setTooltipContainerStyle = ( visible?: boolean; style?: CSS.Properties; className?: string[]; + dark?: boolean; }, ) => { if (!container) { return; } - const { style, className = [], visible } = options; + const { style, className = [], visible, dark = false } = options; if (style) { Object.assign(container.style, style); @@ -173,6 +175,7 @@ export const setTooltipContainerStyle = ( container.classList.toggle(TOOLTIP_CONTAINER_SHOW_CLS, visible); container.classList.toggle(TOOLTIP_CONTAINER_HIDE_CLS, !visible); + container.classList.toggle(DARK_THEME_CLS, dark); }; export const getListItem = ( @@ -191,9 +194,11 @@ export const getListItem = ( targetCell?: S2CellType; }, ): TooltipDetailListItem => { - const name = - spreadsheet?.dataSet.getCustomRowFieldName(targetCell!) || - spreadsheet?.dataSet?.getFieldName(field); + const defaultFieldName = spreadsheet?.dataSet?.getFieldName(field); + const name = spreadsheet.isCustomRowFields() + ? spreadsheet?.dataSet.getCustomRowFieldName(targetCell!) || + defaultFieldName + : defaultFieldName; const formatter = spreadsheet?.dataSet?.getFieldFormatter(field); @@ -452,7 +457,7 @@ export const getCustomFieldsSummaries = ( ): TooltipSummaryOptions[] => { const customFieldGroup = groupBy(summaries, 'name'); - return Object.keys(customFieldGroup).map((name) => { + return Object.keys(customFieldGroup || {}).map((name) => { const cellsData = customFieldGroup[name]; const selectedData = flatMap( cellsData, diff --git a/packages/s2-core/tsconfig.build.json b/packages/s2-core/tsconfig.build.json new file mode 100644 index 0000000000..1b0f0c69dc --- /dev/null +++ b/packages/s2-core/tsconfig.build.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "include": ["src/**/*", "./typings.d.ts", "../../global.d.ts"], + "compilerOptions": { + "target": "es2015", + "paths": { + "@antv/s2": ["s2-core/src/index.ts"] + } + } +} diff --git a/packages/s2-core/tsconfig.declaration.json b/packages/s2-core/tsconfig.declaration.json deleted file mode 100644 index 2dc92e6c64..0000000000 --- a/packages/s2-core/tsconfig.declaration.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "declarationDir": "temp", - "declaration": true, - "emitDeclarationOnly": true, - "paths": {} - }, - "include": ["src", "../../global.d.ts"] -} diff --git a/packages/s2-core/tsconfig.json b/packages/s2-core/tsconfig.json index 0c0c597cfc..42ce828b30 100644 --- a/packages/s2-core/tsconfig.json +++ b/packages/s2-core/tsconfig.json @@ -3,7 +3,7 @@ "compilerOptions": { "paths": { "@antv/s2": ["s2-core/src/index.ts"], - "@antv/s2-shared": ["s2-shared/src/index.ts"], + "@antv/s2/*":["s2-core/src/*"], "@/*": ["s2-core/src/*"], "tests/*": ["s2-core/__tests__/*"] }, diff --git a/packages/s2-react-components/CHANGELOG.md b/packages/s2-react-components/CHANGELOG.md index ee9f3b8c91..3f187362aa 100644 --- a/packages/s2-react-components/CHANGELOG.md +++ b/packages/s2-react-components/CHANGELOG.md @@ -1,12 +1,60 @@ -# [@antv/s2-react-components-v1.0.1-next.1](https://github.com/antvis/S2/compare/@antv/s2-react-components-v1.0.0...@antv/s2-react-components-v1.0.1-next.1) (2024-10-12) +# [@antv/s2-react-components-v2.1.2](https://github.com/antvis/S2/compare/@antv/s2-react-components-v2.1.1...@antv/s2-react-components-v2.1.2) (2024-12-13) ### Bug Fixes -* 调整分割线的颜色绘制逻辑, 优化和单元格边框颜色不一致的问题 ([#2919](https://github.com/antvis/S2/issues/2919)) ([3f766d0](https://github.com/antvis/S2/commit/3f766d02b14bf6d6ebac34b302a0232a58afe500)) +* 构建产物编译到 es2015 close [#3025](https://github.com/antvis/S2/issues/3025) ([#3026](https://github.com/antvis/S2/issues/3026)) ([0a7977c](https://github.com/antvis/S2/commit/0a7977c1793a8171b14b07a22847b4dd9ed85d5f)) -# @antv/s2-react-components-v1.0.0-next.1 (2024-09-18) +# [@antv/s2-react-components-v2.1.1](https://github.com/antvis/S2/compare/@antv/s2-react-components-v2.1.0...@antv/s2-react-components-v2.1.1) (2024-12-04) + + +### Bug Fixes + +* 修复下钻组件展示错误操作 icon & 兼容低版本 menu 写法 ([#3011](https://github.com/antvis/S2/issues/3011)) ([7d171f0](https://github.com/antvis/S2/commit/7d171f037e7f52cc49ad02ddf56598aa477bf043)) + +# [@antv/s2-react-components-v2.1.0](https://github.com/antvis/S2/compare/@antv/s2-react-components-v2.0.1...@antv/s2-react-components-v2.1.0) (2024-11-29) + + +### Bug Fixes + +* 修复 react, vue component 层的 svg 问题 close [#2990](https://github.com/antvis/S2/issues/2990) ([#2999](https://github.com/antvis/S2/issues/2999)) ([b626986](https://github.com/antvis/S2/commit/b626986827a4cd6439d06bdd2e9fb8aa6e19fdc4)) + + +### Features + +* 增加树状模式下行头宽度配置 rowCell.treeWidth ([#2998](https://github.com/antvis/S2/issues/2998)) ([b8fdd2a](https://github.com/antvis/S2/commit/b8fdd2a700a9a3bdc5d565c2bf89a85427c66a88)) + +# [@antv/s2-react-components-v2.0.1](https://github.com/antvis/S2/compare/@antv/s2-react-components-v2.0.0...@antv/s2-react-components-v2.0.1) (2024-11-21) + + +### Bug Fixes +* 修改包 peerDependencies 版本和样式依赖问题 ([11df5d5](https://github.com/antvis/S2/commit/11df5d511515817047b09d6e3dd37000f7b189f2)) + +# [@antv/s2-react-components-v2.0.0](#) (2024-11-21) + +* 2.0 正式版已发布,请查看 [升级指南](https://s2.antv.antgroup.com/manual/migration-v2) + +# [@antv/s2-react-components-v1.1.0-next.1](https://github.com/antvis/S2/compare/@antv/s2-react-components-v1.0.1-next.1...@antv/s2-react-components-v1.1.0-next.1) (2024-11-15) + + +### Bug Fixes + +* 修复分割线在深色背景下颜色渲染异常 & 内容宽高未包含分割线的问题 ([#2961](https://github.com/antvis/S2/issues/2961)) ([e759891](https://github.com/antvis/S2/commit/e759891865eee0940d0f5c92345d5490e10eb57c)) +* 修复开启自定义指标层级后, 角头数值文本未对齐 close [#2957](https://github.com/antvis/S2/issues/2957) ([#2966](https://github.com/antvis/S2/issues/2966)) ([6558a0d](https://github.com/antvis/S2/commit/6558a0df55dc324e1810e2f2a5d314de7389e2b1)) + + +### Features + +* 调整单元格默认 padding, 优化多行文本时的展示效果 ([#2970](https://github.com/antvis/S2/issues/2970)) ([599d7a4](https://github.com/antvis/S2/commit/599d7a4e76d2b606bdb0509eb684f47870a9e69d)) + +# [@antv/s2-react-components-v1.0.1-next.1](https://github.com/antvis/S2/compare/@antv/s2-react-components-v1.0.0...@antv/s2-react-components-v1.0.1-next.1) (2024-10-12) + +### Bug Fixes + +* 调整分割线的颜色绘制逻辑,优化和单元格边框颜色不一致的问题 ([#2919](https://github.com/antvis/S2/issues/2919)) ([3f766d0](https://github.com/antvis/S2/commit/3f766d02b14bf6d6ebac34b302a0232a58afe500)) + +# @antv/s2-react-components-v1.0.0-next.1 (2024-09-18) ### Features @@ -15,5 +63,5 @@ * **interaction:** 新增选中/高亮单元格 & 滚动 API ([#2586](https://github.com/antvis/S2/issues/2586)) ([ac4f5ab](https://github.com/antvis/S2/commit/ac4f5ab9d87bf9bf725b2ef872342a597823ebf6)) * **text-align-panel:** 新增文字对齐配置组件 ([#2779](https://github.com/antvis/S2/issues/2779)) ([db9c900](https://github.com/antvis/S2/commit/db9c9005e4cda64e84d95c0bdc432a55209c2f3b)) * **theme-panel:** 新增主题风格配置组件 ([#2770](https://github.com/antvis/S2/issues/2770)) ([b559947](https://github.com/antvis/S2/commit/b559947ae2695dc3e4b581b10785ce34956d3702)) -* 更新 G 版本, 支持透传 dblClickSpeed ([ce11006](https://github.com/antvis/S2/commit/ce110069c855bc68fd89e014f8436d6e8bf92a49)) -* 统一链接跳转字段绘制逻辑, 支持标记列头 close [#2430](https://github.com/antvis/S2/issues/2430) ([#2796](https://github.com/antvis/S2/issues/2796)) ([637f651](https://github.com/antvis/S2/commit/637f651bbaaf1fcb696afe12c03e5c7042f95fae)) +* 更新 G 版本,支持透传 dblClickSpeed ([ce11006](https://github.com/antvis/S2/commit/ce110069c855bc68fd89e014f8436d6e8bf92a49)) +* 统一链接跳转字段绘制逻辑,支持标记列头 close [#2430](https://github.com/antvis/S2/issues/2430) ([#2796](https://github.com/antvis/S2/issues/2796)) ([637f651](https://github.com/antvis/S2/commit/637f651bbaaf1fcb696afe12c03e5c7042f95fae)) diff --git a/packages/s2-react-components/README.md b/packages/s2-react-components/README.md index d31c6b5198..bae4ec683b 100644 --- a/packages/s2-react-components/README.md +++ b/packages/s2-react-components/README.md @@ -10,9 +10,6 @@ S2 多维分析表格配置套的 React 分析/配置组件库。 Version - - - Version ci test status @@ -34,7 +31,7 @@ $ pnpm add @antv/s2-react-components ```tsx import React from 'React' import { ThemePanel, TextAlignPanel, FrozenPanel } from '@antv/s2-react-components' -import '@antv/s2-components/dist/style.min.css' +import '@antv/s2-react-components/dist/s2-react-components.min.css' const App = () => { return ( @@ -84,7 +81,7 @@ const App = () => { ```tsx import React from 'React' import { ThemePanel } from '@antv/s2-react-components' -import '@antv/s2-components/dist/style.min.css' +import '@antv/s2-react-components/dist/s2-react-components.min.css' const App = () => { const s2Ref = React.useRef(); diff --git a/packages/s2-react-components/__tests__/__mocks__/svg.ts b/packages/s2-react-components/__tests__/__mocks__/svg.ts new file mode 100644 index 0000000000..828bbe5d33 --- /dev/null +++ b/packages/s2-react-components/__tests__/__mocks__/svg.ts @@ -0,0 +1,4 @@ +// eslint-disable-next-line import/no-default-export +export default 'SvgrURL'; + +export const ReactComponent = 'div'; diff --git a/packages/s2-react/__tests__/bugs/issue-1736-spec.tsx b/packages/s2-react-components/__tests__/bugs/issue-1736-spec.tsx similarity index 58% rename from packages/s2-react/__tests__/bugs/issue-1736-spec.tsx rename to packages/s2-react-components/__tests__/bugs/issue-1736-spec.tsx index 57b683e029..c919df4ca2 100644 --- a/packages/s2-react/__tests__/bugs/issue-1736-spec.tsx +++ b/packages/s2-react-components/__tests__/bugs/issue-1736-spec.tsx @@ -3,11 +3,14 @@ * https://github.com/antvis/S2/issues/1736 * Export dropdown visible state error */ -import { Export } from '@/components/export'; +import { Export } from '@/components'; import { waitFor } from '@testing-library/react'; import React from 'react'; import type { Root } from 'react-dom/client'; -import { getMockSheetInstance, renderComponent } from 'tests/util/helpers'; +import { + getMockSheetInstance, + renderComponent, +} from '../../../s2-react/__tests__/util/helpers'; describe('header export component render tests', () => { let unmount: Root['unmount']; @@ -16,27 +19,12 @@ describe('header export component render tests', () => { unmount?.(); }); - test('should render export and dropdown keep invisible', async () => { - const sheet = getMockSheetInstance(); - - unmount = renderComponent(); - - await waitFor(() => { - // export 组件 - expect(document.querySelector('.antv-s2-export')).toBeDefined(); - - // dropdown 不应该渲染 - expect(document.querySelector('.ant-dropdown')).toBe(null); - }); - }); - test('should render export dropdown menu', async () => { const sheet = getMockSheetInstance(); unmount = renderComponent( +
+ +
+ +`; + +exports[`AdvancedSort Component Tests should render custom icon and text 1`] = ` + +
+ +
+
+`; diff --git a/packages/s2-react-components/__tests__/unit/components/advanced-sort/__snapshots__/custom-sort-spec.tsx.snap b/packages/s2-react-components/__tests__/unit/components/advanced-sort/__snapshots__/custom-sort-spec.tsx.snap new file mode 100644 index 0000000000..42d036cd3f --- /dev/null +++ b/packages/s2-react-components/__tests__/unit/components/advanced-sort/__snapshots__/custom-sort-spec.tsx.snap @@ -0,0 +1,646 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`CustomSort Component Tests should render component 1`] = ` + +
+
+
  • + + 杭州市 + + + + + + + + + + + + + + + + +
  • +
  • + + 绍兴市 + + + + + + + + + + + + + + + + +
  • +
  • + + 宁波市 + + + + + + + + + + + + + + + + +
  • +
  • + + 舟山市 + + + + + + + + + + + + + + + + +
  • +
  • + + 成都市 + + + + + + + + + + + + + + + + +
  • +
  • + + 绵阳市 + + + + + + + + + + + + + + + + +
  • +
  • + + 南充市 + + + + + + + + + + + + + + + + +
  • +
  • + + 乐山市 + + + + + + + + + + + + + + + + +
  • +
    +
    +
    +`; diff --git a/packages/s2-react-components/__tests__/unit/components/advanced-sort/advanced-sort-spec.tsx b/packages/s2-react-components/__tests__/unit/components/advanced-sort/advanced-sort-spec.tsx new file mode 100644 index 0000000000..3a725ae3dd --- /dev/null +++ b/packages/s2-react-components/__tests__/unit/components/advanced-sort/advanced-sort-spec.tsx @@ -0,0 +1,68 @@ +import { AdvancedSort } from '@/components'; +import { StepForwardOutlined } from '@ant-design/icons'; +import type { BaseDataSet } from '@antv/s2'; +import { fireEvent, render, screen } from '@testing-library/react'; +import React from 'react'; +import { getMockSheetInstance } from '../../../../../s2-react/__tests__/util/helpers'; + +describe('AdvancedSort Component Tests', () => { + const sheetInstance = getMockSheetInstance(); + + sheetInstance.dataCfg = { + data: [], + fields: { + rows: ['a', 'b'], + columns: ['c', 'd'], + values: ['e', 'f'], + }, + }; + sheetInstance.dataSet = { + ...sheetInstance.dataCfg, + getFieldName: jest.fn(), + getDimensionValues: jest.fn(), + } as unknown as BaseDataSet; + + test('should render component', () => { + const { asFragment, container } = render( + , + ); + + expect(asFragment()).toMatchSnapshot(); + expect(screen.getByText('高级排序')).toBeDefined(); + expect(container.querySelector('.antv-s2-advanced-sort-btn')).toBeDefined(); + }); + + test('should render custom icon and text', () => { + const { asFragment, container } = render( + } + text="自定义" + className="test" + sheetInstance={sheetInstance} + />, + ); + + expect(asFragment()).toMatchSnapshot(); + expect(container.querySelector('.test')).toBeDefined(); + expect(container.querySelector('.anticon-step-forward')).toBeDefined(); + expect(screen.getByText('自定义')).toBeDefined(); + }); + + test('should open sort panel', () => { + const onSortOpen = jest.fn(); + const onSortConfirm = jest.fn(); + + render( + , + ); + + fireEvent.click(screen.getByText('高级排序')); + + expect(screen.getByText('可选字段')).toBeDefined(); + expect(onSortOpen).toHaveBeenCalledTimes(1); + }); +}); diff --git a/packages/s2-react-components/__tests__/unit/components/advanced-sort/custom-sort-spec.tsx b/packages/s2-react-components/__tests__/unit/components/advanced-sort/custom-sort-spec.tsx new file mode 100644 index 0000000000..6886ef22fb --- /dev/null +++ b/packages/s2-react-components/__tests__/unit/components/advanced-sort/custom-sort-spec.tsx @@ -0,0 +1,24 @@ +import { CustomSort } from '@/components'; +import { render } from '@testing-library/react'; +import React from 'react'; + +describe('CustomSort Component Tests', () => { + test('should render component', () => { + const { asFragment } = render( + , + ); + + expect(asFragment()).toMatchSnapshot(); + }); +}); diff --git a/packages/s2-react-components/__tests__/unit/components/drill-down/__snapshots__/drill-down-spec.tsx.snap b/packages/s2-react-components/__tests__/unit/components/drill-down/__snapshots__/drill-down-spec.tsx.snap new file mode 100644 index 0000000000..4741c578be --- /dev/null +++ b/packages/s2-react-components/__tests__/unit/components/drill-down/__snapshots__/drill-down-spec.tsx.snap @@ -0,0 +1,819 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`DrillDown Component Tests should render component 1`] = ` + +
    +
    +
    + 选择下钻维度 +
    + +
    + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + +
    +
    + No data +
    +
    +