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/workflows/auto-release.yml b/.github/workflows/auto-release.yml index 000f900171..93cca60d9f 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -54,6 +54,9 @@ jobs: - name: Install dependencies run: pnpm bootstrap:ci + - name: Build doctor + run: pnpm build:doctor + - name: Build run: pnpm build 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/.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/CONTRIBUTING.md b/CONTRIBUTING.md index d65dbc444b..891e15c6c4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,7 +7,11 @@ "我代码水平不行", "会不会受到鄙视?", "会不会不太好?", 放心,不存在的! -我们欢迎任何形式的贡献,不管是一个**错别字的修改**,还是**一次友好的建议**,不管是通过提交 [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) 里看见你的头像。 +我们欢迎任何形式的贡献,不管是一个**错别字的修改**,还是**一次友好的建议**,不管是通过提交 [Issue](https://github.com/antvis/S2/issues/new/choose), 还是一个帅气 [pull request](https://github.com/antvis/S2/pulls), 亦或是参与 [discussions](https://github.com/antvis/S2/discussions) 的讨论。 + +这是一个开源项目,我们也有繁忙的业务要做,是用自己的业余时间在维护,为爱发电,精力有限,所以有时候 issue 响应速度不是那么及时。 + +如果你遇到了问题,或者对 Issues 和 Discussions 列表的问题感兴趣,可以直接认领并尝试修复,帮助 S2 变得更好,期待在 [贡献者列表](https://github.com/antvis/S2/graphs/contributors) 里看见你的头像。 ## 分支管理 diff --git a/README.en-US.md b/README.en-US.md index 95392e2148..9623c6c970 100644 --- a/README.en-US.md +++ b/README.en-US.md @@ -30,7 +30,7 @@ A practical visualization library for tabular analysis.

- npm bundle size + npm bundle size GitHub discussions @@ -77,9 +77,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 +208,13 @@ 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 | 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?logo=npm) | ![next](https://img.shields.io/npm/v/@antv/s2/next.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) | ![next](https://img.shields.io/npm/v/@antv/s2-react/next.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) | ![next](https://img.shields.io/npm/v/@antv/s2-react-components/next.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) | ![next](https://img.shields.io/npm/v/@antv/s2-vue/next.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 diff --git a/README.md b/README.md index ebb7941e60..677a3404f0 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@

- npm bundle size + npm bundle size GitHub discussions @@ -73,9 +73,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 +204,13 @@ 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) | +| Package | Latest | 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?logo=npm) | ![next](https://img.shields.io/npm/v/@antv/s2/next.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) | ![next](https://img.shields.io/npm/v/@antv/s2-react/next.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) | ![next](https://img.shields.io/npm/v/@antv/s2-react-components/next.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) | ![next](https://img.shields.io/npm/v/@antv/s2-vue/next.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) | ### 🖥️ 兼容环境 diff --git a/build.config.base.mjs b/build.config.base.mjs new file mode 100644 index 0000000000..04968185cb --- /dev/null +++ b/build.config.base.mjs @@ -0,0 +1,163 @@ +/* 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: /^(.*)\/theme\/(.*)\.less$/, + replacement: '$1/theme/$2.less?inline', + }, + { + 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..1bb0193f5e 100644 --- a/jest.config.base.js +++ b/jest.config.base.js @@ -43,16 +43,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 5c777cfebe..32bbc30fea 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "url": "https://github.com/antvis/S2.git" }, "license": "MIT", + "files": [], "scripts": { "preinstall": "npx only-allow pnpm", "bootstrap": "pnpm install", @@ -32,6 +33,7 @@ "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", @@ -55,7 +57,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 --filter !@antv/s2-react-components --workspace-concurrency=1 exec npx --no-install semantic-release", + "release": "pnpm -r --filter !@antv/s2-site --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 +79,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 +163,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 7ca8b0e953..6838b60b89 100644 --- a/packages/s2-core/CHANGELOG.md +++ b/packages/s2-core/CHANGELOG.md @@ -1,3 +1,91 @@ +# [@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) + + +### Bug Fixes + +* 修复存在字段标记的 icon 时, 紧凑模式列宽计算错误出现省略号的问题 ([#2920](https://github.com/antvis/S2/issues/2920)) ([75acbfe](https://github.com/antvis/S2/commit/75acbfe4540bf8dc702a3a068c214c9217239261)) +* 修复拖拽列宽后, 默认的自定义列宽失效 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)) +* 修复自定义列宽对虚拟数值列不生效 ([#2921](https://github.com/antvis/S2/issues/2921)) ([c53cea4](https://github.com/antvis/S2/commit/c53cea4a2fa2d7b18939abfb984629a94eab936d)) +* 调整分割线的颜色绘制逻辑, 优化和单元格边框颜色不一致的问题 ([#2919](https://github.com/antvis/S2/issues/2919)) ([3f766d0](https://github.com/antvis/S2/commit/3f766d02b14bf6d6ebac34b302a0232a58afe500)) + +# [@antv/s2-v2.0.0-next.28](https://github.com/antvis/S2/compare/@antv/s2-v2.0.0-next.27...@antv/s2-v2.0.0-next.28) (2024-09-18) + + +### Bug Fixes + +* 修复 expandDepth 在自定义行头场景下不生效 ([#2895](https://github.com/antvis/S2/issues/2895)) ([d83a816](https://github.com/antvis/S2/commit/d83a81674e587eab129630c0d3bc4f87b6550471)) +* 修复浏览器窗口多次放大后表格渲染模糊 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)) +* 移动端关闭 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)) + + +### Features + +* 新增 s2.facet.getContentWidth() API ([#2883](https://github.com/antvis/S2/issues/2883)) ([395db7e](https://github.com/antvis/S2/commit/395db7e313fd1de6e42ee5dd4d6c475c517609d4)) + + +### BREAKING CHANGES + +* 移除 s2.getContentHeight() API + +* docs: 补充迁移文档 + # [@antv/s2-v2.0.0-next.27](https://github.com/antvis/S2/compare/@antv/s2-v2.0.0-next.26...@antv/s2-v2.0.0-next.27) (2024-08-23) diff --git a/packages/s2-core/README.en-US.md b/packages/s2-core/README.en-US.md index dfdd422fa8..bd7894d5a1 100644 --- a/packages/s2-core/README.en-US.md +++ b/packages/s2-core/README.en-US.md @@ -211,8 +211,8 @@ 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-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/dist/s2-react.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/dist/s2-vue.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg) | ## 👤 Author diff --git a/packages/s2-core/README.md b/packages/s2-core/README.md index c6dca6a56e..3c03e975aa 100644 --- a/packages/s2-core/README.md +++ b/packages/s2-core/README.md @@ -29,7 +29,7 @@

- npm bundle size + npm bundle size GitHub discussions @@ -207,8 +207,8 @@ 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-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/s2-react.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/s2-vue.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg) | ## 问题反馈 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..4eb99c5a55 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,16 @@ 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, "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 +24,16 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": 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 +50,16 @@ 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, "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 +67,16 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": 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 +84,16 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": 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 +110,20 @@ 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, "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 +137,16 @@ 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, "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 +154,20 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": 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 +181,16 @@ 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, "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 +198,16 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": 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 +224,16 @@ 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, "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 +241,16 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": 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 +258,16 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": 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 +284,16 @@ 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, "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 +311,16 @@ 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, "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 +328,16 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": 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 +355,16 @@ 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, "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 +372,16 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": 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 +398,16 @@ 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, "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 +415,16 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": 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 +432,16 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": 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 +458,16 @@ 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, "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 +485,16 @@ 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, "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 +502,16 @@ Array [ "y": 0, }, Object { - "belongsCell": undefined, "children": Array [], "colIndex": -1, "cornerType": "row", - "extra": 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 ca96ad096d..c9eb35e66e 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 @@ -63,18 +63,38 @@ Array [ exports[`SpreadSheet Custom Cell Style Tests PivotSheet Custom Cell Style Tests #ColCell should get custom col cell style by field id 1`] = ` Array [ Object { - "height": 60, - "id": "root[&]浙江", - "width": 149.5, + "height": 30, + "id": "root[&]笔", + "width": 199.5, }, Object { - "height": 30, - "id": "root[&]浙江[&]义乌", + "height": 300, + "id": "root[&]笔[&]price", + "width": 50, + }, + Object { + "height": 300, + "id": "root[&]笔[&]cost", "width": 149.5, }, +] +`; + +exports[`SpreadSheet Custom Cell Style Tests PivotSheet Custom Cell Style Tests #ColCell should get custom col cell style by value field 1`] = ` +Array [ Object { "height": 30, - "id": "root[&]浙江[&]杭州", + "id": "root[&]笔", + "width": 199.5, + }, + Object { + "height": 300, + "id": "root[&]笔[&]price", + "width": 50, + }, + Object { + "height": 300, + "id": "root[&]笔[&]cost", "width": 149.5, }, ] @@ -135,6 +155,46 @@ Array [ ] `; +exports[`SpreadSheet Custom Cell Style Tests PivotSheet Custom Cell Style Tests #RowCell should get custom row cell style by extra field 1`] = ` +Array [ + Object { + "height": 1200, + "id": "root[&]浙江", + "width": 149.5, + }, + Object { + "height": 600, + "id": "root[&]浙江[&]义乌", + "width": 149.5, + }, + Object { + "height": 300, + "id": "root[&]浙江[&]义乌[&]price", + "width": 50, + }, + Object { + "height": 300, + "id": "root[&]浙江[&]义乌[&]cost", + "width": 50, + }, + Object { + "height": 600, + "id": "root[&]浙江[&]杭州", + "width": 149.5, + }, + Object { + "height": 300, + "id": "root[&]浙江[&]杭州[&]price", + "width": 50, + }, + Object { + "height": 300, + "id": "root[&]浙江[&]杭州[&]cost", + "width": 50, + }, +] +`; + exports[`SpreadSheet Custom Cell Style Tests PivotSheet Custom Cell Style Tests #RowCell should get custom row cell style by field 1`] = ` Array [ Object { 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..8e0d395141 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 @@ -6,7 +6,7 @@ Array [ "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 68, + "height": 76, "multiLineActualTexts": Array [ "序号", ], @@ -17,7 +17,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 68, + "height": 76, "multiLineActualTexts": Array [ "省份", ], @@ -28,7 +28,7 @@ Array [ "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", "actualTextHeight": 64, "actualTextWidth": 292, - "height": 68, + "height": 76, "multiLineActualTexts": Array [ "城市城市城市", "城市城市城市", @@ -42,7 +42,7 @@ Array [ "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 16, "actualTextWidth": 241, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "类别类别类别类别类别类别类别类别类别类别", ], @@ -53,7 +53,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "子类别", ], @@ -69,7 +69,7 @@ Array [ "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "1", ], @@ -91,7 +91,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "3", ], @@ -118,7 +118,7 @@ Array [ "actualText": "纸张纸张纸张纸张纸张", "actualTextHeight": 32, "actualTextWidth": 122, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "纸张纸张纸张", "纸张纸张", @@ -130,7 +130,7 @@ Array [ "actualText": "-", "actualTextHeight": 16, "actualTextWidth": 4, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "-", ], @@ -141,7 +141,7 @@ Array [ "actualText": "数量数量数量数量数量数量数量数量数量数量数量", "actualTextHeight": 60, "actualTextWidth": 268, - "height": 68, + "height": 76, "multiLineActualTexts": Array [ "数量数量数量", "数量数量数量", @@ -155,7 +155,7 @@ Array [ "actualText": "家具", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "家具", ], @@ -166,7 +166,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "桌子", ], @@ -177,7 +177,7 @@ Array [ "actualText": "数量数量数量数量数量数量数量数量数量数量数量", "actualTextHeight": 60, "actualTextWidth": 268, - "height": 68, + "height": 76, "multiLineActualTexts": Array [ "数量数量数量", "数量数量数量", @@ -191,7 +191,7 @@ Array [ "actualText": "沙发", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "沙发", ], @@ -202,7 +202,7 @@ Array [ "actualText": "数量数量数量数量数量数量数量数量数量数量数量", "actualTextHeight": 60, "actualTextWidth": 268, - "height": 68, + "height": 76, "multiLineActualTexts": Array [ "数量数量数量", "数量数量数量", @@ -216,7 +216,7 @@ Array [ "actualText": "家具家具家具家具家具家具家具家具家具家具家具家...", "actualTextHeight": 64, "actualTextWidth": 290, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "家具家具家具", "家具家具家具", @@ -230,7 +230,7 @@ Array [ "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌...", "actualTextHeight": 64, "actualTextWidth": 290, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "桌子桌子桌子", "桌子桌子桌子", @@ -244,7 +244,7 @@ Array [ "actualText": "数量数量数量数量数量数量数量数量数量数量数量", "actualTextHeight": 60, "actualTextWidth": 268, - "height": 68, + "height": 76, "multiLineActualTexts": Array [ "数量数量数量", "数量数量数量", @@ -258,7 +258,7 @@ Array [ "actualText": "办公用品", "actualTextHeight": 16, "actualTextWidth": 49, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "办公用品", ], @@ -269,7 +269,7 @@ Array [ "actualText": "笔", "actualTextHeight": 16, "actualTextWidth": 13, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "笔", ], @@ -280,7 +280,7 @@ Array [ "actualText": "数量数量数量数量数量数量数量数量数量数量数量", "actualTextHeight": 60, "actualTextWidth": 268, - "height": 68, + "height": 76, "multiLineActualTexts": Array [ "数量数量数量", "数量数量数量", @@ -294,7 +294,7 @@ Array [ "actualText": "纸张", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "纸张", ], @@ -305,7 +305,7 @@ Array [ "actualText": "数量数量数量数量数量数量数量数量数量数量数量", "actualTextHeight": 60, "actualTextWidth": 268, - "height": 68, + "height": 76, "multiLineActualTexts": Array [ "数量数量数量", "数量数量数量", @@ -324,7 +324,7 @@ Array [ "actualText": "浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙...", "actualTextHeight": 64, "actualTextWidth": 290, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "浙江浙江浙江", "浙江浙江浙江", @@ -338,7 +338,7 @@ Array [ "actualText": "杭州杭州杭州杭州", "actualTextHeight": 30, "actualTextWidth": 98, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "杭州杭州杭州", "杭州", @@ -405,7 +405,7 @@ Array [ "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江...", "actualTextHeight": 64, "actualTextWidth": 290, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "浙江省浙江省", "浙江省浙江省", @@ -419,7 +419,7 @@ Array [ "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州...", "actualTextHeight": 60, "actualTextWidth": 290, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "杭州市杭州市", "杭州市杭州市", @@ -473,17 +473,6 @@ Array [ "originalText": "南充市", "width": 96, }, - Object { - "actualText": "乐山市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "乐山市", - ], - "originalText": "乐山市", - "width": 96, - }, ] `; @@ -493,7 +482,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "-", ], @@ -548,18 +537,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 72, - "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 96, - }, - Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 30, + "height": 80, "multiLineActualTexts": Array [ "-", ], @@ -603,7 +581,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "-", ], @@ -659,7 +637,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "-", ], @@ -699,22 +677,11 @@ Array [ "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": 72, + "height": 80, "multiLineActualTexts": Array [ "-", ], @@ -769,7 +736,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "-", ], @@ -809,22 +776,11 @@ Array [ "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": 72, + "height": 80, "multiLineActualTexts": Array [ "-", ], @@ -879,7 +835,7 @@ Array [ "actualText": "7789778977897789778977897789", "actualTextHeight": 45, "actualTextWidth": 189, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "77897789778", "97789778977", @@ -925,18 +881,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 30, - "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 96, - }, - Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "-", ], @@ -991,7 +936,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "-", ], @@ -1031,22 +976,11 @@ Array [ "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": 72, + "height": 80, "multiLineActualTexts": Array [ "-", ], @@ -1101,7 +1035,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "-", ], @@ -1141,17 +1075,6 @@ Array [ "originalText": 3551, "width": 96, }, - Object { - "actualText": "352", - "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 30, - "multiLineActualTexts": Array [ - "352", - ], - "originalText": 352, - "width": 96, - }, ] `; @@ -2234,7 +2157,7 @@ Array [ "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 53, + "height": 61, "multiLineActualTexts": Array [ "序号", ], @@ -2245,7 +2168,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 53, + "height": 61, "multiLineActualTexts": Array [ "省份", ], @@ -2256,7 +2179,7 @@ Array [ "actualText": "城市城市城市城市城市城市城市城市城市城市...", "actualTextHeight": 48, "actualTextWidth": 253, - "height": 53, + "height": 61, "multiLineActualTexts": Array [ "城市城市城市城", "市城市城市城市", @@ -2269,7 +2192,7 @@ Array [ "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 16, "actualTextWidth": 241, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "类别类别类别类别类别类别类别类别类别类别", ], @@ -2280,7 +2203,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "子类别", ], @@ -2334,7 +2257,7 @@ Array [ "actualText": "家具", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "家具", ], @@ -2345,7 +2268,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "桌子", ], @@ -2356,7 +2279,7 @@ Array [ "actualText": "数量数量数量数量数量数量数量数量数量数量...", "actualTextHeight": 45, "actualTextWidth": 253, - "height": 53, + "height": 61, "multiLineActualTexts": Array [ "数量数量数量数", "量数量数量数量", @@ -2369,7 +2292,7 @@ Array [ "actualText": "沙发", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "沙发", ], @@ -2380,7 +2303,7 @@ Array [ "actualText": "数量数量数量数量数量数量数量数量数量数量...", "actualTextHeight": 45, "actualTextWidth": 253, - "height": 53, + "height": 61, "multiLineActualTexts": Array [ "数量数量数量数", "量数量数量数量", @@ -2393,7 +2316,7 @@ Array [ "actualText": "家具家具家具家具家具家具家具家具家具家具...", "actualTextHeight": 48, "actualTextWidth": 253, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "家具家具家具家", "具家具家具家具", @@ -2406,7 +2329,7 @@ Array [ "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子...", "actualTextHeight": 48, "actualTextWidth": 253, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "桌子桌子桌子桌", "子桌子桌子桌子", @@ -2419,7 +2342,7 @@ Array [ "actualText": "数量数量数量数量数量数量数量数量数量数量...", "actualTextHeight": 45, "actualTextWidth": 253, - "height": 53, + "height": 61, "multiLineActualTexts": Array [ "数量数量数量数", "量数量数量数量", @@ -2432,7 +2355,7 @@ Array [ "actualText": "办公用品", "actualTextHeight": 16, "actualTextWidth": 49, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "办公用品", ], @@ -2443,7 +2366,7 @@ Array [ "actualText": "笔", "actualTextHeight": 16, "actualTextWidth": 13, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "笔", ], @@ -2454,7 +2377,7 @@ Array [ "actualText": "数量数量数量数量数量数量数量数量数量数量...", "actualTextHeight": 45, "actualTextWidth": 253, - "height": 53, + "height": 61, "multiLineActualTexts": Array [ "数量数量数量数", "量数量数量数量", @@ -2467,7 +2390,7 @@ Array [ "actualText": "纸张", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "纸张", ], @@ -2478,7 +2401,7 @@ Array [ "actualText": "数量数量数量数量数量数量数量数量数量数量...", "actualTextHeight": 45, "actualTextWidth": 253, - "height": 53, + "height": 61, "multiLineActualTexts": Array [ "数量数量数量数", "量数量数量数量", @@ -3212,7 +3135,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "2", ], @@ -3312,7 +3235,7 @@ Array [ "actualText": "浙江省浙江省浙江省浙江...", "actualTextHeight": 32, "actualTextWidth": 144, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "浙江省浙江省", "浙江省浙江...", @@ -3385,7 +3308,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "-", ], @@ -3484,7 +3407,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "-", ], @@ -3616,7 +3539,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "2", ], @@ -3716,7 +3639,7 @@ Array [ "actualText": "浙江省浙江省浙江省浙江...", "actualTextHeight": 32, "actualTextWidth": 144, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "浙江省浙江省", "浙江省浙江...", @@ -3789,7 +3712,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "-", ], @@ -3888,7 +3811,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "-", ], @@ -3948,7 +3871,7 @@ Array [ "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 38, + "height": 46, "multiLineActualTexts": Array [ "序号", ], @@ -3959,7 +3882,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 38, + "height": 46, "multiLineActualTexts": Array [ "省份", ], @@ -3970,7 +3893,7 @@ Array [ "actualText": "城市城市城市城市城市城...", "actualTextHeight": 32, "actualTextWidth": 144, - "height": 38, + "height": 46, "multiLineActualTexts": Array [ "城市城市城市", "城市城市城...", @@ -3982,7 +3905,7 @@ Array [ "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 16, "actualTextWidth": 241, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "类别类别类别类别类别类别类别类别类别类别", ], @@ -3993,7 +3916,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "子类别", ], @@ -4047,7 +3970,7 @@ Array [ "actualText": "家具", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "家具", ], @@ -4058,7 +3981,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "桌子", ], @@ -4069,7 +3992,7 @@ Array [ "actualText": "数量数量数量数量数量数...", "actualTextHeight": 30, "actualTextWidth": 144, - "height": 38, + "height": 46, "multiLineActualTexts": Array [ "数量数量数量", "数量数量数...", @@ -4081,7 +4004,7 @@ Array [ "actualText": "沙发", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "沙发", ], @@ -4092,7 +4015,7 @@ Array [ "actualText": "数量数量数量数量数量数...", "actualTextHeight": 30, "actualTextWidth": 144, - "height": 38, + "height": 46, "multiLineActualTexts": Array [ "数量数量数量", "数量数量数...", @@ -4352,7 +4275,7 @@ Array [ "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 38, + "height": 46, "multiLineActualTexts": Array [ "序号", ], @@ -4363,7 +4286,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 38, + "height": 46, "multiLineActualTexts": Array [ "省份", ], @@ -4374,7 +4297,7 @@ Array [ "actualText": "城市城市城市城市城市城...", "actualTextHeight": 32, "actualTextWidth": 144, - "height": 38, + "height": 46, "multiLineActualTexts": Array [ "城市城市城市", "城市城市城...", @@ -4386,7 +4309,7 @@ Array [ "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 16, "actualTextWidth": 241, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "类别类别类别类别类别类别类别类别类别类别", ], @@ -4397,7 +4320,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "子类别", ], @@ -4451,7 +4374,7 @@ Array [ "actualText": "家具", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "家具", ], @@ -4462,7 +4385,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "桌子", ], @@ -4473,7 +4396,7 @@ Array [ "actualText": "数量数量数量数量数量数...", "actualTextHeight": 30, "actualTextWidth": 144, - "height": 38, + "height": 46, "multiLineActualTexts": Array [ "数量数量数量", "数量数量数...", @@ -4485,7 +4408,7 @@ Array [ "actualText": "沙发", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "沙发", ], @@ -4496,7 +4419,7 @@ Array [ "actualText": "数量数量数量数量数量数...", "actualTextHeight": 30, "actualTextWidth": 144, - "height": 38, + "height": 46, "multiLineActualTexts": Array [ "数量数量数量", "数量数量数...", @@ -4756,7 +4679,7 @@ Array [ "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 38, + "height": 46, "multiLineActualTexts": Array [ "序号", ], @@ -4767,7 +4690,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 38, + "height": 46, "multiLineActualTexts": Array [ "省份", ], @@ -4778,7 +4701,7 @@ Array [ "actualText": "城市城市城市城市城市城...", "actualTextHeight": 32, "actualTextWidth": 144, - "height": 38, + "height": 46, "multiLineActualTexts": Array [ "城市城市城市", "城市城市城...", @@ -4790,7 +4713,7 @@ Array [ "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 16, "actualTextWidth": 241, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "类别类别类别类别类别类别类别类别类别类别", ], @@ -4801,7 +4724,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "子类别", ], @@ -4855,7 +4778,7 @@ Array [ "actualText": "家具", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "家具", ], @@ -4866,7 +4789,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "桌子", ], @@ -4877,7 +4800,7 @@ Array [ "actualText": "数量数量数量数量数量数...", "actualTextHeight": 30, "actualTextWidth": 144, - "height": 38, + "height": 46, "multiLineActualTexts": Array [ "数量数量数量", "数量数量数...", @@ -4889,7 +4812,7 @@ Array [ "actualText": "沙发", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "沙发", ], @@ -4900,7 +4823,7 @@ Array [ "actualText": "数量数量数量数量数量数...", "actualTextHeight": 30, "actualTextWidth": 144, - "height": 38, + "height": 46, "multiLineActualTexts": Array [ "数量数量数量", "数量数量数...", @@ -5398,7 +5321,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "2", ], @@ -5491,7 +5414,7 @@ Array [ "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江...", "actualTextHeight": 64, "actualTextWidth": 290, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "浙江省浙江省", "浙江省浙江省", @@ -5555,7 +5478,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "-", ], @@ -5610,7 +5533,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 72, + "height": 80, "multiLineActualTexts": Array [ "-", ], @@ -5626,7 +5549,7 @@ Array [ "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 38, + "height": 46, "multiLineActualTexts": Array [ "序号", ], @@ -5637,7 +5560,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 38, + "height": 46, "multiLineActualTexts": Array [ "省份", ], @@ -5648,7 +5571,7 @@ Array [ "actualText": "城市城市城市城市城市城...", "actualTextHeight": 32, "actualTextWidth": 144, - "height": 38, + "height": 46, "multiLineActualTexts": Array [ "城市城市城市", "城市城市城...", @@ -5660,7 +5583,7 @@ Array [ "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 16, "actualTextWidth": 241, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "类别类别类别类别类别类别类别类别类别类别", ], @@ -5671,7 +5594,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "子类别", ], @@ -5725,7 +5648,7 @@ Array [ "actualText": "家具", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "家具", ], @@ -5736,7 +5659,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "桌子", ], @@ -5747,7 +5670,7 @@ Array [ "actualText": "数量数量数量数量数量数...", "actualTextHeight": 30, "actualTextWidth": 144, - "height": 38, + "height": 46, "multiLineActualTexts": Array [ "数量数量数量", "数量数量数...", @@ -5759,7 +5682,7 @@ Array [ "actualText": "沙发", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "沙发", ], @@ -5770,7 +5693,7 @@ Array [ "actualText": "数量数量数量数量数量数...", "actualTextHeight": 30, "actualTextWidth": 144, - "height": 38, + "height": 46, "multiLineActualTexts": Array [ "数量数量数量", "数量数量数...", @@ -5900,17 +5823,6 @@ Array [ "originalText": 1822, "width": 96, }, - Object { - "actualText": "1943", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 35, - "multiLineActualTexts": Array [ - "1943", - ], - "originalText": 1943, - "width": 96, - }, Object { "actualText": "632", "actualTextHeight": 15, @@ -5988,21 +5900,98 @@ Array [ "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": "2333", + "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": 27, - "height": 35, + "actualTextWidth": 7, + "height": 120, "multiLineActualTexts": Array [ - "2333", + "1", ], - "originalText": 2333, - "width": 96, + "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 not adaptive adjust cell height if hidden col cell 1`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should not adaptive adjust cell height if hidden col cell 3`] = ` Array [ Object { "actualText": undefined, @@ -6011,95 +6000,7 @@ Array [ "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": "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, + "width": 192, }, Object { "actualText": undefined, @@ -6780,7 +6681,310 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render custom text overflow text 1`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render by infinity maxLines 1`] = ` +Array [ + Object { + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 76, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 76, + "multiLineActualTexts": Array [ + "省份", + ], + "originalText": "省份", + "width": 96, + }, + Object { + "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "actualTextHeight": 64, + "actualTextWidth": 292, + "height": 76, + "multiLineActualTexts": Array [ + "城市城市城市", + "城市城市城市", + "城市城市城市", + "城市城市城市", + ], + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "width": 96, + }, + Object { + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 16, + "actualTextWidth": 241, + "height": 96, + "multiLineActualTexts": Array [ + "类别类别类别类别类别类别类别类别类别类别", + ], + "originalText": "类别类别类别类别类别类别类别类别类别类别", + "width": 272, + }, + Object { + "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": "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, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render by infinity maxLines 3`] = ` +Array [ + Object { + "actualText": "家具", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 96, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 192, + }, + Object { + "actualText": "桌子", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 96, + "multiLineActualTexts": Array [ + "桌子", + ], + "originalText": "桌子", + "width": 96, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 60, + "actualTextWidth": 268, + "height": 76, + "multiLineActualTexts": Array [ + "数量数量数量", + "数量数量数量", + "数量数量数量", + "数量数量", + ], + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 96, + }, + Object { + "actualText": "沙发", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 96, + "multiLineActualTexts": Array [ + "沙发", + ], + "originalText": "沙发", + "width": 96, + }, + Object { + "actualText": "数量数量数量数量数量数量数量数量数量数量数量", + "actualTextHeight": 60, + "actualTextWidth": 268, + "height": 76, + "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, + }, + Object { + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "actualTextHeight": 80, + "actualTextWidth": 365, + "height": 96, + "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 [ + "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": 96, + "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": 96, + "multiLineActualTexts": Array [ + "-", + ], + "originalText": "-", + "width": 96, + }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render by maxLines if actual text contains "\\n" 1`] = ` Array [ Object { "actualText": "序号", @@ -6805,12 +7009,12 @@ Array [ "width": 96, }, Object { - "actualText": "城市城@@@", + "actualText": "城市城市城...", "actualTextHeight": 16, - "actualTextWidth": 72, + "actualTextWidth": 71, "height": 30, "multiLineActualTexts": Array [ - "城市城@@@", + "城市城市城...", ], "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", "width": 96, @@ -6840,13 +7044,13 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render custom text overflow text 2`] = ` +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": 120, + "height": 30, "multiLineActualTexts": Array [ "1", ], @@ -6857,7 +7061,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 120, "multiLineActualTexts": Array [ "2", ], @@ -6868,18 +7072,63 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 120, + "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 custom text overflow text 3`] = ` +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, @@ -6903,12 +7152,12 @@ Array [ "width": 96, }, Object { - "actualText": "数量数@@@", + "actualText": "数量数量数...", "actualTextHeight": 15, - "actualTextWidth": 73, + "actualTextWidth": 71, "height": 30, "multiLineActualTexts": Array [ - "数量数@@@", + "数量数量数...", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 96, @@ -6925,474 +7174,399 @@ Array [ "width": 96, }, Object { - "actualText": "数量数@@@", + "actualText": "数量数量数...", "actualTextHeight": 15, - "actualTextWidth": 73, + "actualTextWidth": 71, "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": "浙江省@@@", + "actualText": "家具家具家...", "actualTextHeight": 16, - "actualTextWidth": 72, + "actualTextWidth": 71, "height": 30, "multiLineActualTexts": Array [ - "浙江省@@@", + "家具家具家...", ], - "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", "width": 96, }, Object { - "actualText": "四川省", + "actualText": "桌子桌子桌...", "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 120, + "actualTextWidth": 71, + "height": 30, "multiLineActualTexts": Array [ - "四川省", + "桌子桌子桌...", ], - "originalText": "四川省", + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", "width": 96, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render custom text overflow text 5`] = ` -Array [ Object { - "actualText": "236723@@@", + "actualText": "数量数量数...", "actualTextHeight": 15, - "actualTextWidth": 77, + "actualTextWidth": 71, "height": 30, "multiLineActualTexts": Array [ - "236723@@@", + "数量数量数...", ], - "originalText": 236723672361111, + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 96, }, Object { - "actualText": "3877", - "actualTextHeight": 15, - "actualTextWidth": 27, + "actualText": "办公用品", + "actualTextHeight": 16, + "actualTextWidth": 49, "height": 30, "multiLineActualTexts": Array [ - "3877", + "办公用品", ], - "originalText": 3877, - "width": 96, + "originalText": "办公用品", + "width": 192, }, Object { - "actualText": "4342", - "actualTextHeight": 15, - "actualTextWidth": 27, + "actualText": "笔", + "actualTextHeight": 16, + "actualTextWidth": 13, "height": 30, "multiLineActualTexts": Array [ - "4342", + "笔", ], - "originalText": 4342, + "originalText": "笔", "width": 96, }, Object { - "actualText": "-", + "actualText": "数量数量数...", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 71, "height": 30, "multiLineActualTexts": Array [ - "-", + "数量数量数...", ], - "originalText": "-", + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 96, }, Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, + "actualText": "纸张", + "actualTextHeight": 16, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "-", + "纸张", ], - "originalText": "-", + "originalText": "纸张", "width": 96, }, Object { - "actualText": "1723", + "actualText": "数量数量数...", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 71, "height": 30, "multiLineActualTexts": Array [ - "1723", + "数量数量数...", ], - "originalText": 1723, + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 96, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render by maxLines if actual text contains "\\n" 4`] = ` +Array [ Object { - "actualText": "1822", - "actualTextHeight": 15, - "actualTextWidth": 27, + "actualText": "浙江...", + "actualTextHeight": 16, + "actualTextWidth": 35, "height": 30, "multiLineActualTexts": Array [ - "1822", + "浙江...", ], - "originalText": 1822, + "originalText": "浙江 +浙江", "width": 96, }, Object { - "actualText": "1943", + "actualText": "杭州...", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 35, "height": 30, "multiLineActualTexts": Array [ - "1943", + "杭州...", ], - "originalText": 1943, + "originalText": "杭州 +杭州 +杭州", "width": 96, }, Object { - "actualText": "2330", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualText": "浙江省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 120, "multiLineActualTexts": Array [ - "2330", + "浙江省", ], - "originalText": 2330, + "originalText": "浙江省", "width": 96, }, Object { - "actualText": "632", + "actualText": "绍兴市", "actualTextHeight": 15, - "actualTextWidth": 21, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "632", + "绍兴市", ], - "originalText": 632, + "originalText": "绍兴市", "width": 96, }, Object { - "actualText": "7234", + "actualText": "宁波市", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "7234", + "宁波市", ], - "originalText": 7234, + "originalText": "宁波市", "width": 96, }, Object { - "actualText": "834", + "actualText": "舟山市", "actualTextHeight": 15, - "actualTextWidth": 21, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "834", + "舟山市", ], - "originalText": 834, + "originalText": "舟山市", "width": 96, }, Object { - "actualText": "5343", + "actualText": "杭州市", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "5343", + "杭州市", ], - "originalText": 5343, + "originalText": "杭州市", "width": 96, }, Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, + "actualText": "浙江省浙江...", + "actualTextHeight": 16, + "actualTextWidth": 71, "height": 30, "multiLineActualTexts": Array [ - "-", + "浙江省浙江...", ], - "originalText": "-", + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 96, }, Object { - "actualText": "2451", + "actualText": "杭州市杭州...", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 71, "height": 30, "multiLineActualTexts": Array [ - "2451", + "杭州市杭州...", ], - "originalText": 2451, + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", "width": 96, }, Object { - "actualText": "2244", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualText": "四川省", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 120, "multiLineActualTexts": Array [ - "2244", + "四川省", ], - "originalText": 2244, + "originalText": "四川省", "width": 96, }, Object { - "actualText": "2333", + "actualText": "成都市", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "2333", + "成都市", ], - "originalText": 2333, + "originalText": "成都市", "width": 96, }, Object { - "actualText": "2445", + "actualText": "绵阳市", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 37, "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": 53, - "multiLineActualTexts": Array [ - "序号", - ], - "originalText": "序号", - "width": 80, - }, - Object { - "actualText": "省份", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 53, - "multiLineActualTexts": Array [ - "省份", + "绵阳市", ], - "originalText": "省份", + "originalText": "绵阳市", "width": 96, }, Object { - "actualText": "城市城市城市城市城市城市城市城市城...", - "actualTextHeight": 48, - "actualTextWidth": 217, - "height": 53, + "actualText": "南充市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "城市城市城市", - "城市城市城市", - "城市城市城...", + "南充市", ], - "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "originalText": "南充市", "width": 96, }, Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", - "actualTextHeight": 16, - "actualTextWidth": 241, - "height": 56, - "multiLineActualTexts": Array [ - "类别类别类别类别类别类别类别类别类别类别", - ], - "originalText": "类别类别类别类别类别类别类别类别类别类别", - "width": 272, - }, - Object { - "actualText": "子类别", - "actualTextHeight": 16, + "actualText": "乐山市", + "actualTextHeight": 15, "actualTextWidth": 37, - "height": 56, + "height": 30, "multiLineActualTexts": Array [ - "子类别", + "乐山市", ], - "originalText": "子类别", - "width": 272, + "originalText": "乐山市", + "width": 96, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines 2`] = ` +exports[`SpreadSheet Multi Line Text Tests PivotSheet should render by maxLines if actual text contains "\\n" 5`] = ` 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": 56, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "2", + "-", ], - "originalText": "2", - "width": 80, + "originalText": "-", + "width": 96, }, Object { - "actualText": "3", + "actualText": "-", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 120, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "3", + "-", ], - "originalText": "3", - "width": 80, + "originalText": "-", + "width": 96, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines 3`] = ` -Array [ Object { - "actualText": "家具", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 56, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "家具", + "-", ], - "originalText": "家具", - "width": 192, + "originalText": "-", + "width": 96, }, Object { - "actualText": "桌子", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 56, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "桌子", + "-", ], - "originalText": "桌子", + "originalText": "-", "width": 96, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数...", - "actualTextHeight": 45, - "actualTextWidth": 217, - "height": 53, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量", - "数量数量数量", - "数量数量数...", + "-", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "originalText": "-", "width": 96, }, Object { - "actualText": "沙发", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 56, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "沙发", + "-", ], - "originalText": "沙发", + "originalText": "-", "width": 96, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数...", - "actualTextHeight": 45, - "actualTextWidth": 217, - "height": 53, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量", - "数量数量数量", - "数量数量数...", + "-", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "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, + "actualText": "-", + "actualTextHeight": 15, + "actualTextWidth": 4, + "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "-", ], - "originalText": "浙江省", + "originalText": "-", "width": 96, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙江省浙江...", - "actualTextHeight": 48, - "actualTextWidth": 217, - "height": 56, + "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": 30, "multiLineActualTexts": Array [ - "四川省", + "-", ], - "originalText": "四川省", + "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, + "actualText": "2367236723...", + "actualTextHeight": 15, + "actualTextWidth": 77, "height": 30, "multiLineActualTexts": Array [ - "23672367236", - "1111", + "2367236723...", ], "originalText": 236723672361111, "width": 96, @@ -7434,7 +7608,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 56, + "height": 30, "multiLineActualTexts": Array [ "-", ], @@ -7463,6 +7637,39 @@ Array [ "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, @@ -7511,7 +7718,7 @@ Array [ "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 56, + "height": 30, "multiLineActualTexts": Array [ "-", ], @@ -7540,345 +7747,7036 @@ Array [ "originalText": 2244, "width": 96, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines for tree mode 1`] = ` + 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": 76, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 76, + "multiLineActualTexts": Array [ + "省份", + ], + "originalText": "省份", + "width": 102.57, + }, + Object { + "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "actualTextHeight": 64, + "actualTextWidth": 292, + "height": 76, + "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": 76, + "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": 76, + "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": 76, + "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": 76, + "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": 76, + "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": 61, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 61, + "multiLineActualTexts": Array [ + "省份", + ], + "originalText": "省份", + "width": 96, + }, + Object { + "actualText": "城市城市城市城市城市城市城市城市城...", + "actualTextHeight": 48, + "actualTextWidth": 217, + "height": 61, + "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": 61, + "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": 61, + "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": 61, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份/城市城市城市城市城市城市...", + "actualTextHeight": 48, + "actualTextWidth": 184, + "height": 61, + "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": 61, + "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": 61, + "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": 61, + "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": 61, + "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": 61, + "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": 61, + "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": 46, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 46, + "multiLineActualTexts": Array [ + "省份", + ], + "originalText": "省份", + "width": 96, + }, + Object { + "actualText": "城市城市城市城市城市城...", + "actualTextHeight": 32, + "actualTextWidth": 144, + "height": 46, + "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": 46, + "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": 46, + "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": 76, + "multiLineActualTexts": Array [ + "序号", + ], + "originalText": "序号", + "width": 80, + }, + Object { + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 76, + "multiLineActualTexts": Array [ + "省份", + ], + "originalText": "省份", + "width": 102.57, + }, + Object { + "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "actualTextHeight": 64, + "actualTextWidth": 292, + "height": 76, + "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": 76, + "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": 76, + "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": 76, + "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": 76, + "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": 76, + "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": "序号", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 53, + "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": "序号", + "originalText": 15, "width": 80, }, Object { - "actualText": "省份/城市城市城市城市城市城市...", - "actualTextHeight": 48, - "actualTextWidth": 184, - "height": 53, + "actualText": "16", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, "multiLineActualTexts": Array [ - "省份/城市城", - "市城市城市", - "城市城市...", + "16", ], - "originalText": "省份/城市城市城市城市城市城市城市城市城市城市城市城市", - "width": 100, + "originalText": 16, + "width": 80, }, Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", - "actualTextHeight": 32, - "actualTextWidth": 242, - "height": 56, + "actualText": "17", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, "multiLineActualTexts": Array [ - "类别类别类别类别类别类别类", - "别类别类别类别", + "17", ], - "originalText": "类别类别类别类别类别类别类别类别类别类别", - "width": 180, + "originalText": 17, + "width": 80, }, Object { - "actualText": "子类别", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 56, + "actualText": "浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江", + "actualTextHeight": 30, + "actualTextWidth": 242, + "height": 46, "multiLineActualTexts": Array [ - "子类别", + "浙江浙江浙江浙江浙江", + "浙江浙江浙江浙江浙江", ], - "originalText": "子类别", - "width": 180, + "originalText": "浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江", + "width": 143.8, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render three max text lines for tree mode 2`] = ` -Array [ Object { - "actualText": "1", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 112, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "1", + "浙江省", ], - "originalText": "1", - "width": 80, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "2", - "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 150, + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "actualTextHeight": 45, + "actualTextWidth": 363, + "height": 61, "multiLineActualTexts": Array [ - "2", + "浙江省浙江省浙江省浙", + "江省浙江省浙江省浙江", + "省浙江省浙江省浙江省", ], - "originalText": "2", - "width": 80, + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", + "width": 143.8, }, Object { - "actualText": "3", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 112, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "3", + "浙江省", ], - "originalText": "3", - "width": 80, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "4", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 7, - "height": 150, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "4", + "浙江省", ], - "originalText": "4", - "width": 80, + "originalText": "浙江省", + "width": 143.8, }, -] -`; - -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": 56, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "纸张纸张纸张纸", - "张纸张", + "浙江省", ], - "originalText": "纸张纸张纸张纸张纸张", - "width": 103, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "-", - "actualTextHeight": 16, - "actualTextWidth": 4, - "height": 56, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "-", + "浙江省", ], - "originalText": "-", - "width": 103, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 53, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量...", + "浙江省", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 103, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "家具", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 56, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "家具", + "浙江省", ], - "originalText": "家具", - "width": 206, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "桌子", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 56, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "桌子", + "浙江省", ], - "originalText": "桌子", - "width": 103, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 53, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量...", + "浙江省", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 103, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "沙发", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 56, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "沙发", + "浙江省", ], - "originalText": "沙发", - "width": 103, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 53, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量...", + "浙江省", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 103, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "家具家具家具家具家具家具家具家具家具家具...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 56, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "家具家具家具家", - "具家具家具家具", - "家具家具家具...", + "浙江省", ], - "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "width": 103, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 56, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "桌子桌子桌子桌", - "子桌子桌子桌子", - "桌子桌子桌子...", + "浙江省", ], - "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", - "width": 103, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 53, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量...", + "浙江省", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 103, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "办公用品", - "actualTextHeight": 16, - "actualTextWidth": 49, - "height": 56, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "办公用品", + "浙江省", ], - "originalText": "办公用品", - "width": 206, + "originalText": "浙江省", + "width": 143.8, }, Object { - "actualText": "笔", - "actualTextHeight": 16, - "actualTextWidth": 13, - "height": 56, + "actualText": "杭州杭州杭州杭州", + "actualTextHeight": 15, + "actualTextWidth": 97, + "height": 46, "multiLineActualTexts": Array [ - "笔", + "杭州杭州杭州杭州", ], - "originalText": "笔", - "width": 103, + "originalText": "杭州杭州杭州杭州", + "width": 143.8, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 53, + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量...", + "绍兴市", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 103, + "originalText": "绍兴市", + "width": 143.8, }, Object { - "actualText": "纸张", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 56, + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "actualTextHeight": 45, + "actualTextWidth": 363, + "height": 61, "multiLineActualTexts": Array [ - "纸张", + "杭州市杭州市杭州市杭", + "州市杭州市杭州市杭州", + "市杭州市杭州市杭州市", ], - "originalText": "纸张", - "width": 103, + "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", + "width": 143.8, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 53, + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量...", + "绍兴市", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 103, + "originalText": "绍兴市", + "width": 143.8, }, -] -`; - -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": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "浙江浙江浙", - "江浙江浙江", - "浙江浙江...", + "宁波市", ], - "originalText": "浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江浙江", - "width": 100, + "originalText": "宁波市", + "width": 143.8, }, Object { - "actualText": "杭州杭州杭州杭州", - "actualTextHeight": 30, - "actualTextWidth": 98, - "height": 56, + "actualText": "舟山市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "杭州杭州杭", - "州杭州", + "舟山市", ], - "originalText": "杭州杭州杭州杭州", - "width": 100, + "originalText": "舟山市", + "width": 143.8, }, Object { - "actualText": "浙江省", - "actualTextHeight": 16, + "actualText": "杭州市", + "actualTextHeight": 15, "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "浙江省", + "杭州市", ], - "originalText": "浙江省", - "width": 100, + "originalText": "杭州市", + "width": 143.8, }, Object { "actualText": "绍兴市", @@ -7889,7 +14787,7 @@ Array [ "绍兴市", ], "originalText": "绍兴市", - "width": 100, + "width": 143.8, }, Object { "actualText": "宁波市", @@ -7900,7 +14798,7 @@ Array [ "宁波市", ], "originalText": "宁波市", - "width": 100, + "width": 143.8, }, Object { "actualText": "舟山市", @@ -7911,7 +14809,7 @@ Array [ "舟山市", ], "originalText": "舟山市", - "width": 100, + "width": 143.8, }, Object { "actualText": "杭州市", @@ -7922,690 +14820,606 @@ Array [ "杭州市", ], "originalText": "杭州市", - "width": 100, + "width": 143.8, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙江...", - "actualTextHeight": 48, - "actualTextWidth": 181, - "height": 56, + "actualText": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "浙江省浙江", - "省浙江省浙", - "江省浙江...", + "绍兴市", ], - "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", - "width": 100, + "originalText": "绍兴市", + "width": 143.8, }, Object { - "actualText": "杭州市杭州市杭州市杭州市杭州...", - "actualTextHeight": 45, - "actualTextWidth": 181, - "height": 56, + "actualText": "宁波市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "杭州市杭州", - "市杭州市杭", - "州市杭州...", + "宁波市", ], - "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", - "width": 100, + "originalText": "宁波市", + "width": 143.8, }, Object { - "actualText": "四川省", - "actualTextHeight": 16, + "actualText": "舟山市", + "actualTextHeight": 15, "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "四川省", + "舟山市", ], - "originalText": "四川省", - "width": 100, + "originalText": "舟山市", + "width": 143.8, }, Object { - "actualText": "成都市", + "actualText": "杭州市", "actualTextHeight": 15, "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "成都市", + "杭州市", ], - "originalText": "成都市", - "width": 100, + "originalText": "杭州市", + "width": 143.8, }, -] -`; - -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": "绍兴市", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, + "multiLineActualTexts": Array [ + "绍兴市", + ], + "originalText": "绍兴市", + "width": 143.8, }, Object { - "actualText": "-", + "actualText": "宁波市", "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 56, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "-", + "宁波市", ], - "originalText": "-", - "width": 103, + "originalText": "宁波市", + "width": 143.8, }, Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, + "actualText": "纸张纸张纸张纸张纸张", + "actualTextHeight": 15, + "actualTextWidth": 121, + "height": 46, + "multiLineActualTexts": Array [ + "纸张纸张纸张纸张纸张", + ], + "originalText": "纸张纸张纸张纸张纸张", + "width": 143.8, + }, + Object { + "actualText": "家具", + "actualTextHeight": 15, + "actualTextWidth": 25, "height": 30, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "multiLineActualTexts": Array [ + "家具", + ], + "originalText": "家具", + "width": 143.8, + }, + Object { + "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "actualTextHeight": 45, + "actualTextWidth": 339, + "height": 61, + "multiLineActualTexts": Array [ + "家具家具家具家具家具", + "家具家具家具家具家具", + "家具家具家具家具", + ], + "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", + "width": 143.8, }, Object { - "actualText": "-", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "-", + "家具", ], - "originalText": "-", - "width": 103, + "originalText": "家具", + "width": 143.8, }, Object { - "actualText": "-", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "-", + "家具", ], - "originalText": "-", - "width": 103, + "originalText": "家具", + "width": 143.8, }, Object { - "actualText": "-", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "-", + "家具", ], - "originalText": "-", - "width": 103, + "originalText": "家具", + "width": 143.8, }, Object { - "actualText": "-", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "-", + "家具", ], - "originalText": "-", - "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": 25, + "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": "-", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "-", + "家具", ], - "originalText": "-", - "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": 25, + "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": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, "height": 30, "multiLineActualTexts": Array [ - "2367236723611", - "11", + "办公用品", ], - "originalText": 236723672361111, - "width": 103, + "originalText": "办公用品", + "width": 143.8, }, Object { - "actualText": "3877", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 49, "height": 30, "multiLineActualTexts": Array [ - "3877", + "办公用品", ], - "originalText": 3877, - "width": 103, + "originalText": "办公用品", + "width": 143.8, }, Object { - "actualText": "4342", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 49, "height": 30, "multiLineActualTexts": Array [ - "4342", + "办公用品", ], - "originalText": 4342, - "width": 103, + "originalText": "办公用品", + "width": 143.8, }, Object { - "actualText": "-", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 49, "height": 30, "multiLineActualTexts": Array [ - "-", + "办公用品", ], - "originalText": "-", - "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": 49, + "height": 30, "multiLineActualTexts": Array [ - "-", + "办公用品", ], - "originalText": "-", - "width": 103, + "originalText": "办公用品", + "width": 143.8, }, Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, + "actualText": "办公用品", + "actualTextHeight": 15, + "actualTextWidth": 49, "height": 30, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "multiLineActualTexts": Array [ + "办公用品", + ], + "originalText": "办公用品", + "width": 143.8, }, Object { - "actualText": "1723", + "actualText": "办公用品", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 49, "height": 30, "multiLineActualTexts": Array [ - "1723", + "办公用品", ], - "originalText": 1723, - "width": 103, - }, - Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 56, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "originalText": "办公用品", + "width": 143.8, }, Object { "actualText": "-", "actualTextHeight": 15, "actualTextWidth": 4, - "height": 56, + "height": 46, "multiLineActualTexts": Array [ "-", ], "originalText": "-", - "width": 103, - }, - Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 30, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "width": 143.8, }, Object { - "actualText": "632", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 21, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "632", + "桌子", ], - "originalText": 632, - "width": 103, + "originalText": "桌子", + "width": 143.8, }, Object { - "actualText": "7234", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "actualTextHeight": 45, + "actualTextWidth": 363, + "height": 61, "multiLineActualTexts": Array [ - "7234", + "桌子桌子桌子桌子桌子", + "桌子桌子桌子桌子桌子", + "桌子桌子桌子桌子桌子", ], - "originalText": 7234, - "width": 103, + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", + "width": 143.8, }, Object { - "actualText": "834", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 21, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "834", + "桌子", ], - "originalText": 834, - "width": 103, + "originalText": "桌子", + "width": 143.8, }, Object { - "actualText": "5343", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "5343", + "桌子", ], - "originalText": 5343, - "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": 25, + "height": 30, "multiLineActualTexts": Array [ - "-", + "桌子", ], - "originalText": "-", - "width": 103, + "originalText": "桌子", + "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": "2451", + "actualText": "沙发", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "2451", + "沙发", ], - "originalText": 2451, - "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": 25, + "height": 30, "multiLineActualTexts": Array [ - "-", + "沙发", ], - "originalText": "-", - "width": 103, + "originalText": "沙发", + "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": "-", + "actualText": "笔", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 13, "height": 30, "multiLineActualTexts": Array [ - "-", + "笔", ], - "originalText": "-", - "width": 103, + "originalText": "笔", + "width": 143.8, }, Object { - "actualText": "-", + "actualText": "笔", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 13, "height": 30, "multiLineActualTexts": Array [ - "-", + "笔", ], - "originalText": "-", - "width": 103, + "originalText": "笔", + "width": 143.8, }, Object { - "actualText": "-", + "actualText": "笔", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 13, "height": 30, "multiLineActualTexts": Array [ - "-", + "笔", ], - "originalText": "-", - "width": 103, + "originalText": "笔", + "width": 143.8, }, Object { - "actualText": "-", + "actualText": "笔", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 13, "height": 30, "multiLineActualTexts": Array [ - "-", + "笔", ], - "originalText": "-", - "width": 103, - }, - Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 56, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "originalText": "笔", + "width": 143.8, }, Object { - "actualText": "7789778977897789778977897789", - "actualTextHeight": 45, - "actualTextWidth": 189, - "height": 56, + "actualText": "纸张", + "actualTextHeight": 15, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "7789778977897", - "7897789778977", - "89", + "纸张", ], - "originalText": "7789778977897789778977897789", - "width": 103, + "originalText": "纸张", + "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": "-", + "actualText": "纸张", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "-", + "纸张", ], - "originalText": "-", - "width": 103, - }, - Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 56, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "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": "236723672361111", + "actualTextHeight": 15, + "actualTextWidth": 98, "height": 30, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "multiLineActualTexts": Array [ + "236723672361111", + ], + "originalText": 236723672361111, + "width": 143.8, }, Object { - "actualText": "1304", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualText": "7789778977897789778977897789", + "actualTextHeight": 30, + "actualTextWidth": 188, + "height": 61, "multiLineActualTexts": Array [ - "1304", + "7789778977897789778", + "977897789", ], - "originalText": 1304, - "width": 103, + "originalText": "7789778977897789778977897789", + "width": 143.8, }, Object { - "actualText": "1145", + "actualText": "236723672361111", "actualTextHeight": 15, - "actualTextWidth": 26, + "actualTextWidth": 98, "height": 30, "multiLineActualTexts": Array [ - "1145", + "236723672361111", ], - "originalText": 1145, - "width": 103, + "originalText": 236723672361111, + "width": 143.8, }, Object { - "actualText": "1432", + "actualText": "3877", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "1432", + "3877", ], - "originalText": 1432, - "width": 103, + "originalText": 3877, + "width": 143.8, }, 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": 143.8, }, Object { - "actualText": "-", + "actualText": "5343", "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 56, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 103, + "5343", + ], + "originalText": 5343, + "width": 143.8, }, Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, + "actualText": "632", + "actualTextHeight": 15, + "actualTextWidth": 21, "height": 30, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "multiLineActualTexts": Array [ + "632", + ], + "originalText": 632, + "width": 143.8, }, Object { - "actualText": "2335", + "actualText": "7234", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "2335", + "7234", ], - "originalText": 2335, - "width": 103, - }, - Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 56, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "originalText": 7234, + "width": 143.8, }, Object { - "actualText": "-", + "actualText": "834", "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 56, + "actualTextWidth": 21, + "height": 30, "multiLineActualTexts": Array [ - "-", + "834", ], - "originalText": "-", - "width": 103, + "originalText": 834, + "width": 143.8, }, Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, + "actualText": "945", + "actualTextHeight": 15, + "actualTextWidth": 21, "height": 30, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "multiLineActualTexts": Array [ + "945", + ], + "originalText": 945, + "width": 143.8, }, Object { - "actualText": "1354", + "actualText": "1304", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "1354", + "1304", ], - "originalText": 1354, - "width": 103, + "originalText": 1304, + "width": 143.8, }, Object { - "actualText": "1523", + "actualText": "1145", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 26, "height": 30, "multiLineActualTexts": Array [ - "1523", + "1145", ], - "originalText": 1523, - "width": 103, + "originalText": 1145, + "width": 143.8, }, Object { - "actualText": "1634", + "actualText": "1432", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "1634", + "1432", ], - "originalText": 1634, - "width": 103, + "originalText": 1432, + "width": 143.8, }, Object { "actualText": "1343", @@ -8616,1381 +15430,1140 @@ Array [ "1343", ], "originalText": 1343, - "width": 103, - }, - Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 56, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "width": 143.8, }, Object { - "actualText": "-", + "actualText": "1354", "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 56, + "actualTextWidth": 27, + "height": 30, "multiLineActualTexts": Array [ - "-", + "1354", ], - "originalText": "-", - "width": 103, - }, - Object { - "actualText": undefined, - "actualTextHeight": 0, - "actualTextWidth": 0, - "height": 30, - "multiLineActualTexts": Array [], - "originalText": undefined, - "width": 103, + "originalText": 1354, + "width": 143.8, }, Object { - "actualText": "4004", + "actualText": "1523", "actualTextHeight": 15, "actualTextWidth": 27, "height": 30, "multiLineActualTexts": Array [ - "4004", + "1523", ], - "originalText": 4004, - "width": 103, + "originalText": 1523, + "width": 143.8, }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render two max text lines 1`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should default render one line text 1`] = ` Array [ Object { "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 38, + "height": 30, "multiLineActualTexts": Array [ "序号", ], "originalText": "序号", "width": 80, }, - Object { - "actualText": "省份", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 38, - "multiLineActualTexts": Array [ - "省份", - ], - "originalText": "省份", - "width": 96, - }, - Object { - "actualText": "城市城市城市城市城市城...", - "actualTextHeight": 32, - "actualTextWidth": 144, - "height": 38, - "multiLineActualTexts": Array [ - "城市城市城市", - "城市城市城...", - ], - "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "width": 96, - }, - Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", - "actualTextHeight": 16, - "actualTextWidth": 241, - "height": 40, - "multiLineActualTexts": Array [ - "类别类别类别类别类别类别类别类别类别类别", - ], - "originalText": "类别类别类别类别类别类别类别类别类别类别", - "width": 272, - }, - Object { - "actualText": "子类别", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 40, - "multiLineActualTexts": Array [ - "子类别", - ], - "originalText": "子类别", - "width": 272, - }, ] `; -exports[`SpreadSheet Multi Line Text Tests PivotSheet should render two max text lines 2`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should default render one line text 2`] = ` 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": 40, + "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 render two max text lines 3`] = ` -Array [ - Object { - "actualText": "家具", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 40, - "multiLineActualTexts": Array [ - "家具", - ], - "originalText": "家具", - "width": 192, - }, - Object { - "actualText": "桌子", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 40, - "multiLineActualTexts": Array [ - "桌子", - ], - "originalText": "桌子", - "width": 96, - }, - Object { - "actualText": "数量数量数量数量数量数...", - "actualTextHeight": 30, - "actualTextWidth": 144, - "height": 38, - "multiLineActualTexts": Array [ - "数量数量数量", - "数量数量数...", - ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 96, - }, - Object { - "actualText": "沙发", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 40, - "multiLineActualTexts": Array [ - "沙发", - ], - "originalText": "沙发", - "width": 96, - }, - Object { - "actualText": "数量数量数量数量数量数...", - "actualTextHeight": 30, - "actualTextWidth": 144, - "height": 38, - "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": 40, - "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", + "actualText": "4", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "3877", + "4", ], - "originalText": 3877, - "width": 96, + "originalText": 4, + "width": 80, }, Object { - "actualText": "4342", + "actualText": "5", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "4342", + "5", ], - "originalText": 4342, - "width": 96, + "originalText": 5, + "width": 80, }, Object { - "actualText": "-", + "actualText": "6", "actualTextHeight": 15, - "actualTextWidth": 4, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "-", - ], - "originalText": "-", - "width": 96, - }, - Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 40, - "multiLineActualTexts": Array [ - "-", + "6", ], - "originalText": "-", - "width": 96, + "originalText": 6, + "width": 80, }, Object { - "actualText": "1723", + "actualText": "7", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "1723", + "7", ], - "originalText": 1723, - "width": 96, + "originalText": 7, + "width": 80, }, Object { - "actualText": "1822", + "actualText": "8", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "1822", + "8", ], - "originalText": 1822, - "width": 96, + "originalText": 8, + "width": 80, }, Object { - "actualText": "1943", + "actualText": "9", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 7, "height": 30, "multiLineActualTexts": Array [ - "1943", + "9", ], - "originalText": 1943, - "width": 96, + "originalText": 9, + "width": 80, }, Object { - "actualText": "2330", + "actualText": "10", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 14, "height": 30, "multiLineActualTexts": Array [ - "2330", + "10", ], - "originalText": 2330, - "width": 96, + "originalText": 10, + "width": 80, }, Object { - "actualText": "632", + "actualText": "11", "actualTextHeight": 15, - "actualTextWidth": 21, + "actualTextWidth": 13, "height": 30, "multiLineActualTexts": Array [ - "632", + "11", ], - "originalText": 632, - "width": 96, + "originalText": 11, + "width": 80, }, Object { - "actualText": "7234", + "actualText": "12", "actualTextHeight": 15, - "actualTextWidth": 27, + "actualTextWidth": 14, "height": 30, "multiLineActualTexts": Array [ - "7234", + "12", ], - "originalText": 7234, - "width": 96, + "originalText": 12, + "width": 80, }, Object { - "actualText": "834", + "actualText": "13", "actualTextHeight": 15, - "actualTextWidth": 21, + "actualTextWidth": 14, "height": 30, "multiLineActualTexts": Array [ - "834", + "13", ], - "originalText": 834, - "width": 96, + "originalText": 13, + "width": 80, }, +] +`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should default render one line text 3`] = ` +Array [ Object { - "actualText": "5343", - "actualTextHeight": 15, - "actualTextWidth": 27, + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "5343", + "序号", ], - "originalText": 5343, - "width": 96, + "originalText": "序号", + "width": 80, }, Object { - "actualText": "-", - "actualTextHeight": 15, - "actualTextWidth": 4, - "height": 40, + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 30, "multiLineActualTexts": Array [ - "-", + "省份", ], - "originalText": "-", - "width": 96, + "originalText": "省份", + "width": 103.8, }, Object { - "actualText": "2451", - "actualTextHeight": 15, - "actualTextWidth": 27, + "actualText": "城市城市城市...", + "actualTextHeight": 16, + "actualTextWidth": 83, "height": 30, "multiLineActualTexts": Array [ - "2451", + "城市城市城市...", ], - "originalText": 2451, - "width": 96, + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "width": 103.8, }, Object { - "actualText": "2244", - "actualTextHeight": 15, - "actualTextWidth": 27, + "actualText": "类别类别类别...", + "actualTextHeight": 16, + "actualTextWidth": 83, "height": 30, "multiLineActualTexts": Array [ - "2244", + "类别类别类别...", ], - "originalText": 2244, - "width": 96, + "originalText": "类别类别类别类别类别类别类别类别类别类别", + "width": 103.8, }, Object { - "actualText": "2333", - "actualTextHeight": 15, - "actualTextWidth": 27, + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "2333", + "子类别", ], - "originalText": 2333, - "width": 96, + "originalText": "子类别", + "width": 103.8, }, Object { - "actualText": "2445", - "actualTextHeight": 15, - "actualTextWidth": 27, + "actualText": "数量数量数量...", + "actualTextHeight": 16, + "actualTextWidth": 83, "height": 30, "multiLineActualTexts": Array [ - "2445", + "数量数量数量...", ], - "originalText": 2445, - "width": 96, + "originalText": "数量数量数量数量数量数量数量数量数量数量数量", + "width": 103.8, }, ] `; -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 4`] = `Array []`; + +exports[`SpreadSheet Multi Line Text Tests TableSheet should default render one line text 5`] = ` Array [ Object { - "actualText": "序号", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 68, + "actualText": "1", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "序号", + "1", ], - "originalText": "序号", + "originalText": 1, "width": 80, }, Object { - "actualText": "省份", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 68, + "actualText": "2", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "省份", + "2", ], - "originalText": "省份", - "width": 102.57, + "originalText": 2, + "width": 80, }, Object { - "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "actualTextHeight": 64, - "actualTextWidth": 292, - "height": 68, + "actualText": "3", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "城市城市城市城", - "市城市城市城市", - "城市城市城市城", - "市城市", + "3", ], - "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", - "width": 102.57, + "originalText": 3, + "width": 80, }, Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", - "actualTextHeight": 16, - "actualTextWidth": 241, - "height": 72, + "actualText": "4", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "类别类别类别类别类别类别类别类别类别类别", + "4", ], - "originalText": "类别类别类别类别类别类别类别类别类别类别", - "width": 285.14, + "originalText": 4, + "width": 80, }, Object { - "actualText": "子类别", - "actualTextHeight": 16, - "actualTextWidth": 37, - "height": 88, + "actualText": "5", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "子类别", + "5", ], - "originalText": "子类别", - "width": 285.14, + "originalText": 5, + "width": 80, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests PivotSheet should use actual text height for large max line 2`] = ` -Array [ Object { - "actualText": "1", + "actualText": "6", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 120, + "height": 30, "multiLineActualTexts": Array [ - "1", + "6", ], - "originalText": "1", + "originalText": 6, "width": 80, }, Object { - "actualText": "2", + "actualText": "7", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 88, + "height": 30, "multiLineActualTexts": Array [ - "2", + "7", ], - "originalText": "2", + "originalText": 7, "width": 80, }, Object { - "actualText": "3", + "actualText": "8", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 120, + "height": 30, "multiLineActualTexts": Array [ - "3", + "8", ], - "originalText": "3", + "originalText": 8, "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": "9", + "actualTextHeight": 15, + "actualTextWidth": 7, + "height": 30, "multiLineActualTexts": Array [ - "家具", + "9", ], - "originalText": "家具", - "width": 205.14, + "originalText": 9, + "width": 80, }, Object { - "actualText": "桌子", - "actualTextHeight": 16, - "actualTextWidth": 25, - "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": 25, - "height": 88, + "actualText": "12", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, "multiLineActualTexts": Array [ - "沙发", + "12", ], - "originalText": "沙发", - "width": 102.57, + "originalText": 12, + "width": 80, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量数量", - "actualTextHeight": 60, - "actualTextWidth": 268, - "height": 68, + "actualText": "13", + "actualTextHeight": 15, + "actualTextWidth": 14, + "height": 30, "multiLineActualTexts": Array [ - "数量数量数量数", - "量数量数量数量", - "数量数量数量数", - "量", + "13", ], - "originalText": "数量数量数量数量数量数量数量数量数量数量数量", - "width": 102.57, + "originalText": 13, + "width": 80, }, Object { - "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "actualTextHeight": 64, - "actualTextWidth": 340, - "height": 72, + "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": 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, }, Object { - "actualText": "办公用品", - "actualTextHeight": 16, - "actualTextWidth": 49, - "height": 72, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "height": 30, "multiLineActualTexts": Array [ - "办公用品", + "浙江省", ], - "originalText": "办公用品", - "width": 205.14, + "originalText": "浙江省", + "width": 103.8, }, Object { - "actualText": "笔", - "actualTextHeight": 16, - "actualTextWidth": 13, - "height": 88, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "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, }, Object { - "actualText": "纸张", - "actualTextHeight": 16, - "actualTextWidth": 25, - "height": 88, + "actualText": "浙江省", + "actualTextHeight": 15, + "actualTextWidth": 37, + "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": 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 +16573,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 +16590,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 76, + "height": 61, "multiLineActualTexts": Array [ "2", ], @@ -10104,13 +16677,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 +16691,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 +16773,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 76, + "height": 61, "multiLineActualTexts": Array [ "2", ], @@ -10293,15 +16869,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 +16970,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 +17071,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 +17172,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 +17277,7 @@ Array [ "actualText": "7789778977897789778977897789", "actualTextHeight": 45, "actualTextWidth": 189, - "height": 76, + "height": 61, "multiLineActualTexts": Array [ "7789778977897", "7897789778977", @@ -10795,13 +17367,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 +17383,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 +17400,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 76, + "height": 61, "multiLineActualTexts": Array [ "2", ], @@ -10915,13 +17487,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 +17504,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 72, + "height": 64, "multiLineActualTexts": Array [ "省份", ], @@ -10940,15 +17512,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 +17528,7 @@ Array [ "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 48, "actualTextWidth": 243, - "height": 72, + "height": 64, "multiLineActualTexts": Array [ "类别类别类别类", "别类别类别类别", @@ -10970,7 +17541,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 72, + "height": 64, "multiLineActualTexts": Array [ "子类别", ], @@ -10978,15 +17549,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 +17564,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 +17583,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 76, + "height": 61, "multiLineActualTexts": Array [ "2", ], @@ -11109,15 +17679,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 +17780,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, @@ -11310,18 +17878,17 @@ Array [ "家具", ], "originalText": "家具", - "width": 103.8, - }, - Object { - "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "actualTextHeight": 60, - "actualTextWidth": 340, - "height": 76, + "width": 103.8, + }, + Object { + "actualText": "家具家具家具家具家具家具家具家具家具家具...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 61, "multiLineActualTexts": Array [ "家具家具家具家", "具家具家具家具", - "家具家具家具家", - "具家具家具家具", + "家具家具家具...", ], "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", "width": 103.8, @@ -11415,15 +17982,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 +18087,7 @@ Array [ "actualText": "7789778977897789778977897789", "actualTextHeight": 45, "actualTextWidth": 189, - "height": 76, + "height": 61, "multiLineActualTexts": Array [ "7789778977897", "7897789778977", @@ -11601,562 +18167,23 @@ Array [ "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, - "multiLineActualTexts": Array [ - "2367236723611", - "11", - ], - "originalText": 236723672361111, - "width": 103.8, - }, - Object { - "actualText": "7789778977897789778977897789", - "actualTextHeight": 45, - "actualTextWidth": 189, - "height": 76, - "multiLineActualTexts": Array [ - "7789778977897", - "7897789778977", - "89", + "height": 30, + "multiLineActualTexts": Array [ + "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 +18193,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 +18210,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "2", ], @@ -12194,7 +18221,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 61, + "height": 30, "multiLineActualTexts": Array [ "3", ], @@ -12216,7 +18243,7 @@ Array [ "actualText": "5", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 100, "multiLineActualTexts": Array [ "5", ], @@ -12289,82 +18316,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 +18333,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 +18409,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "2", ], @@ -12464,7 +18420,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 61, + "height": 30, "multiLineActualTexts": Array [ "3", ], @@ -12486,7 +18442,7 @@ Array [ "actualText": "5", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 100, "multiLineActualTexts": Array [ "5", ], @@ -12559,141 +18515,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 +18524,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 +18546,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "浙江省", @@ -12736,18 +18557,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 +18579,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "浙江省", @@ -12769,7 +18590,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "浙江省", @@ -12780,7 +18601,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "浙江省", @@ -12791,7 +18612,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "浙江省", @@ -12802,7 +18623,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "浙江省", @@ -12813,97 +18634,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 +18645,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 +18667,7 @@ Array [ "杭州市", ], "originalText": "杭州市", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "绍兴市", @@ -12947,18 +18678,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 +18700,7 @@ Array [ "舟山市", ], "originalText": "舟山市", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "杭州市", @@ -12980,7 +18711,7 @@ Array [ "杭州市", ], "originalText": "杭州市", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "绍兴市", @@ -12991,7 +18722,7 @@ Array [ "绍兴市", ], "originalText": "绍兴市", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "宁波市", @@ -13002,64 +18733,29 @@ 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, + "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": "家具", + "actualText": "杭州市", "actualTextHeight": 15, - "actualTextWidth": 25, + "actualTextWidth": 37, "height": 30, "multiLineActualTexts": Array [ - "家具", + "杭州市", ], - "originalText": "家具", - "width": 143.8, + "originalText": "杭州市", + "width": 103.8, }, Object { "actualText": "家具", @@ -13070,18 +18766,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": "家具", @@ -13092,7 +18788,7 @@ Array [ "家具", ], "originalText": "家具", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "家具", @@ -13103,40 +18799,29 @@ Array [ "家具", ], "originalText": "家具", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 100, "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": "办公用品", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 49, + "actualTextWidth": 25, "height": 30, "multiLineActualTexts": Array [ - "办公用品", + "家具", ], - "originalText": "办公用品", - "width": 143.8, + "originalText": "家具", + "width": 103.8, }, Object { "actualText": "办公用品", @@ -13147,7 +18832,7 @@ Array [ "办公用品", ], "originalText": "办公用品", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "办公用品", @@ -13158,7 +18843,7 @@ Array [ "办公用品", ], "originalText": "办公用品", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "办公用品", @@ -13169,7 +18854,7 @@ Array [ "办公用品", ], "originalText": "办公用品", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "办公用品", @@ -13180,7 +18865,7 @@ Array [ "办公用品", ], "originalText": "办公用品", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "办公用品", @@ -13191,53 +18876,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 +18887,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 +18909,7 @@ Array [ "沙发", ], "originalText": "沙发", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "沙发", @@ -13281,18 +18920,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 +18942,7 @@ Array [ "沙发", ], "originalText": "沙发", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "笔", @@ -13314,7 +18953,7 @@ Array [ "笔", ], "originalText": "笔", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "笔", @@ -13325,7 +18964,7 @@ Array [ "笔", ], "originalText": "笔", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "笔", @@ -13336,7 +18975,7 @@ Array [ "笔", ], "originalText": "笔", - "width": 143.8, + "width": 103.8, }, Object { "actualText": "笔", @@ -13347,29 +18986,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 +18997,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 +19008,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 +19030,7 @@ Array [ "5343", ], "originalText": 5343, - "width": 143.8, + "width": 103.8, }, Object { "actualText": "632", @@ -13469,18 +19041,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 +19063,7 @@ Array [ "834", ], "originalText": 834, - "width": 143.8, + "width": 103.8, }, Object { "actualText": "945", @@ -13502,7 +19074,7 @@ Array [ "945", ], "originalText": 945, - "width": 143.8, + "width": 103.8, }, Object { "actualText": "1304", @@ -13513,7 +19085,7 @@ Array [ "1304", ], "originalText": 1304, - "width": 143.8, + "width": 103.8, }, Object { "actualText": "1145", @@ -13524,7 +19096,7 @@ Array [ "1145", ], "originalText": 1145, - "width": 143.8, + "width": 103.8, }, Object { "actualText": "1432", @@ -13535,7 +19107,7 @@ Array [ "1432", ], "originalText": 1432, - "width": 143.8, + "width": 103.8, }, Object { "actualText": "1343", @@ -13546,40 +19118,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 +19139,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 +19156,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 100, "multiLineActualTexts": Array [ "2", ], @@ -13617,7 +19167,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 46, "multiLineActualTexts": Array [ "3", ], @@ -13668,82 +19218,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 +19238,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 30, + "height": 70, "multiLineActualTexts": Array [ "省份", ], @@ -13762,23 +19246,27 @@ 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, @@ -13787,7 +19275,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 30, + "height": 70, "multiLineActualTexts": Array [ "子类别", ], @@ -13795,11 +19283,13 @@ Array [ "width": 103.8, }, Object { - "actualText": "数量数量数量...", - "actualTextHeight": 16, - "actualTextWidth": 83, - "height": 30, + "actualText": "数量数量数量数量数量数量数量数量数量数量...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 70, "multiLineActualTexts": Array [ + "数量数量数量数", + "量数量数量数量", "数量数量数量...", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", @@ -13808,15 +19298,15 @@ Array [ ] `; -exports[`SpreadSheet Multi Line Text Tests TableSheet should default render one line text 4`] = `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 default render one line text 5`] = ` +exports[`SpreadSheet Multi Line Text Tests TableSheet should get correctly cell height priority if actual text wrap 5`] = ` Array [ Object { "actualText": "1", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 70, "multiLineActualTexts": Array [ "1", ], @@ -13827,7 +19317,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 100, "multiLineActualTexts": Array [ "2", ], @@ -13838,7 +19328,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 46, "multiLineActualTexts": Array [ "3", ], @@ -13868,164 +19358,32 @@ Array [ "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": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, - "multiLineActualTexts": Array [ - "浙江省", - ], - "originalText": "浙江省", - "width": 103.8, - }, - Object { - "actualText": "浙江省浙江省...", - "actualTextHeight": 15, - "actualTextWidth": 83, - "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": "浙江省", + "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 +19391,23 @@ Array [ "width": 103.8, }, Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 100, "multiLineActualTexts": Array [ - "浙江省", + "浙江省浙江省浙", + "江省浙江省浙江", + "省浙江省浙江...", ], - "originalText": "浙江省", + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 103.8, }, Object { "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 46, "multiLineActualTexts": Array [ "浙江省", ], @@ -14102,7 +19462,7 @@ Array [ "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 70, "multiLineActualTexts": Array [ "绍兴市", ], @@ -14110,12 +19470,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "杭州市杭州市...", - "actualTextHeight": 15, - "actualTextWidth": 83, - "height": 30, + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 100, "multiLineActualTexts": Array [ - "杭州市杭州市...", + "杭州市杭州市杭", + "州市杭州市杭州", + "市杭州市杭州...", ], "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", "width": 103.8, @@ -14124,51 +19486,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 +19537,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,11 +19549,13 @@ Array [ "width": 103.8, }, Object { - "actualText": "家具家具家具...", - "actualTextHeight": 15, - "actualTextWidth": 83, - "height": 30, + "actualText": "家具家具家具家具家具家具家具家具家具家具...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 100, "multiLineActualTexts": Array [ + "家具家具家具家", + "具家具家具家具", "家具家具家具...", ], "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", @@ -14267,29 +19565,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 +19616,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,11 +19628,13 @@ Array [ "width": 103.8, }, Object { - "actualText": "桌子桌子桌子...", - "actualTextHeight": 15, - "actualTextWidth": 83, - "height": 30, + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 100, "multiLineActualTexts": Array [ + "桌子桌子桌子桌", + "子桌子桌子桌子", "桌子桌子桌子...", ], "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", @@ -14410,7 +19644,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 46, "multiLineActualTexts": Array [ "桌子", ], @@ -14462,100 +19696,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 +19776,90 @@ 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": "7234", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 70, "multiLineActualTexts": Array [ - "7234", + "序号", ], - "originalText": 7234, - "width": 103.8, + "originalText": "序号", + "width": 80, }, Object { - "actualText": "834", - "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 30, + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 70, "multiLineActualTexts": Array [ - "834", + "省份", ], - "originalText": 834, + "originalText": "省份", "width": 103.8, }, Object { - "actualText": "945", - "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 30, + "actualText": "城市城市城市城市城市城市城...", + "actualTextHeight": 32, + "actualTextWidth": 168, + "height": 70, "multiLineActualTexts": Array [ - "945", + "城市城市城市城", + "市城市城市城...", ], - "originalText": 945, + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", "width": 103.8, }, Object { - "actualText": "1304", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualText": "类别类别类别类别类别类别类...", + "actualTextHeight": 32, + "actualTextWidth": 168, + "height": 70, "multiLineActualTexts": Array [ - "1304", + "类别类别类别类", + "别类别类别类...", ], - "originalText": 1304, + "originalText": "类别类别类别类别类别类别类别类别类别类别", "width": 103.8, }, Object { - "actualText": "1145", - "actualTextHeight": 15, - "actualTextWidth": 26, - "height": 30, + "actualText": "子类别", + "actualTextHeight": 16, + "actualTextWidth": 37, + "height": 70, "multiLineActualTexts": Array [ - "1145", + "子类别", ], - "originalText": 1145, + "originalText": "子类别", "width": 103.8, }, Object { - "actualText": "1432", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 30, + "actualText": "数量数量数量数量数量数量数...", + "actualTextHeight": 32, + "actualTextWidth": 168, + "height": 70, "multiLineActualTexts": Array [ - "1432", + "数量数量数量数", + "量数量数量数...", ], - "originalText": 1432, + "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.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 +19869,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 +19886,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 61, + "height": 76, "multiLineActualTexts": Array [ "2", ], @@ -14779,38 +19959,16 @@ 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, - }, ] `; -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 +19979,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 100, "multiLineActualTexts": Array [ "省份", ], @@ -14829,14 +19987,15 @@ 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, @@ -14845,7 +20004,7 @@ Array [ "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 48, "actualTextWidth": 243, - "height": 56, + "height": 50, "multiLineActualTexts": Array [ "类别类别类别类", "别类别类别类别", @@ -14858,7 +20017,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 56, + "height": 100, "multiLineActualTexts": Array [ "子类别", ], @@ -14866,14 +20025,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 +20041,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 +20060,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 61, + "height": 76, "multiLineActualTexts": Array [ "2", ], @@ -14973,28 +20133,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 +20145,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 +20224,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 +20236,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 +20315,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 +20327,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 +20406,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 +20418,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 +20497,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 +20513,7 @@ Array [ "actualText": "7789778977897789778977897789", "actualTextHeight": 45, "actualTextWidth": 189, - "height": 61, + "height": 76, "multiLineActualTexts": Array [ "7789778977897", "7897789778977", @@ -15535,38 +20589,16 @@ Array [ "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, - }, ] `; -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 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 +20608,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 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 +20625,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 61, + "height": 20, "multiLineActualTexts": Array [ "2", ], @@ -15604,7 +20636,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "3", ], @@ -15615,7 +20647,7 @@ Array [ "actualText": "4", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "4", ], @@ -15626,7 +20658,7 @@ Array [ "actualText": "5", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "5", ], @@ -15637,7 +20669,7 @@ Array [ "actualText": "6", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "6", ], @@ -15648,7 +20680,7 @@ Array [ "actualText": "7", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "7", ], @@ -15659,7 +20691,7 @@ Array [ "actualText": "8", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "8", ], @@ -15670,7 +20702,7 @@ Array [ "actualText": "9", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "9", ], @@ -15681,23 +20713,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 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 +20828,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 48, "multiLineActualTexts": Array [ "省份", ], @@ -15716,27 +20836,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 +20863,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 56, + "height": 48, "multiLineActualTexts": Array [ "子类别", ], @@ -15753,14 +20871,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 +20885,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 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 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 +20904,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 61, + "height": 20, "multiLineActualTexts": Array [ "2", ], @@ -15798,7 +20915,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "3", ], @@ -15809,84 +20926,172 @@ Array [ "actualText": "4", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "4", ], - "originalText": 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 [ + "12", + ], + "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 +21099,13 @@ Array [ "width": 103.8, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 61, + "actualText": "浙江省浙江省浙江省浙江省浙...", + "actualTextHeight": 30, + "actualTextWidth": 168, + "height": 20, "multiLineActualTexts": Array [ "浙江省浙江省浙", - "江省浙江省浙江", - "省浙江省浙江...", + "江省浙江省浙...", ], "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 103.8, @@ -15910,7 +21114,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -15921,7 +21125,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -15932,7 +21136,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -15943,7 +21147,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -15954,7 +21158,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -15965,7 +21169,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -15976,7 +21180,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -15987,7 +21191,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -15995,1411 +21199,1318 @@ 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, + "height": 20, "multiLineActualTexts": Array [ - "家具", + "绍兴市", ], - "originalText": "家具", + "originalText": "绍兴市", "width": 103.8, }, Object { - "actualText": "家具家具家具家具家具家具家具家具家具家具...", - "actualTextHeight": 45, - "actualTextWidth": 253, - "height": 61, + "actualText": "杭州市杭州市杭州市杭州市杭...", + "actualTextHeight": 30, + "actualTextWidth": 168, + "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": 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, + "actualTextWidth": 25, + "height": 20, "multiLineActualTexts": Array [ - "7789778977897", - "7897789778977", - "89", + "家具", ], - "originalText": "7789778977897789778977897789", + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "236723672361111", + "actualText": "家具家具家具家具家具家具家...", "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, + "actualTextWidth": 168, + "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, }, 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, + "originalText": "家具", + "width": 103.8, }, -] -`; - -exports[`SpreadSheet Multi Line Text Tests TableSheet should get correctly cell height priority if actual text not wrap 2`] = ` -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": 49, + "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, + "actualText": "家具", + "actualTextHeight": 15, "actualTextWidth": 25, "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": 30, + "actualTextWidth": 168, "height": 20, "multiLineActualTexts": Array [ - "city", + "桌子桌子桌子桌", + "子桌子桌子桌...", ], - "originalText": "city", + "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", "width": 103.8, }, Object { - "actualText": "type", - "actualTextHeight": 16, + "actualText": "桌子", + "actualTextHeight": 15, "actualTextWidth": 25, "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": 13, + "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": 25, + "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": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 20, "multiLineActualTexts": Array [ - "浙江省", + "2367236723611", + "11", ], - "originalText": "浙江省", + "originalText": 236723672361111, "width": 103.8, }, Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 30, + "actualText": "778977897789778977897789...", + "actualTextHeight": 30, + "actualTextWidth": 172, + "height": 20, "multiLineActualTexts": Array [ - "浙江省", + "7789778977897", + "78977897789...", ], - "originalText": "浙江省", + "originalText": "7789778977897789778977897789", "width": 103.8, }, Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 100, + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 20, "multiLineActualTexts": Array [ - "浙江省", + "2367236723611", + "11", ], - "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, - "height": 30, + "actualTextWidth": 21, + "height": 20, "multiLineActualTexts": Array [ - "宁波市", + "945", ], - "originalText": "宁波市", + "originalText": 945, "width": 103.8, }, Object { - "actualText": "舟山市", + "actualText": "1304", "actualTextHeight": 15, - "actualTextWidth": 37, + "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": 30, + "actualTextWidth": 27, + "height": 20, "multiLineActualTexts": Array [ - "绍兴市", + "1432", ], - "originalText": "绍兴市", + "originalText": 1432, "width": 103.8, }, Object { - "actualText": "宁波市", + "actualText": "1343", "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 100, + "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 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 if custom cell style more than actual text height by dataCell.height 2`] = ` +Array [ Object { - "actualText": "杭州市", + "actualText": "1", "actualTextHeight": 15, - "actualTextWidth": 37, - "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": 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": 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": 30, + "actualTextWidth": 7, + "height": 100, "multiLineActualTexts": Array [ - "家具", + "4", ], - "originalText": "家具", - "width": 103.8, + "originalText": 4, + "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`] = ` +Array [ Object { - "actualText": "家具", - "actualTextHeight": 15, + "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 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 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": 30, + "actualTextWidth": 168, + "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": 30, + "actualTextWidth": 168, + "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": 30, + "actualTextWidth": 168, + "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": 30, + "actualTextWidth": 168, "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": "778977897789778977897789...", + "actualTextHeight": 30, + "actualTextWidth": 172, + "height": 100, "multiLineActualTexts": Array [ - "1145", + "7789778977897", + "78977897789...", ], - "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 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 +22520,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 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 +22537,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 100, + "height": 46, "multiLineActualTexts": Array [ "2", ], @@ -17488,16 +22599,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 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 +22663,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 70, + "height": 20, "multiLineActualTexts": Array [ "省份", ], @@ -17516,27 +22671,25 @@ Array [ "width": 103.8, }, Object { - "actualText": "城市城市城市城市城市城市城市城市城市城市...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 70, + "actualText": "城市城市城市城市城市城市城...", + "actualTextHeight": 32, + "actualTextWidth": 168, + "height": 20, "multiLineActualTexts": Array [ "城市城市城市城", - "市城市城市城市", - "城市城市城市...", + "市城市城市城...", ], "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", "width": 103.8, - }, - Object { - "actualText": "类别类别类别类别类别类别类别类别类别类别", - "actualTextHeight": 48, - "actualTextWidth": 243, - "height": 70, + }, + Object { + "actualText": "类别类别类别类别类别类别类...", + "actualTextHeight": 32, + "actualTextWidth": 168, + "height": 20, "multiLineActualTexts": Array [ "类别类别类别类", - "别类别类别类别", - "类别类别类别", + "别类别类别类...", ], "originalText": "类别类别类别类别类别类别类别类别类别类别", "width": 103.8, @@ -17545,7 +22698,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 70, + "height": 20, "multiLineActualTexts": Array [ "子类别", ], @@ -17553,14 +22706,13 @@ Array [ "width": 103.8, }, Object { - "actualText": "数量数量数量数量数量数量数量数量数量数量...", - "actualTextHeight": 48, - "actualTextWidth": 253, - "height": 70, + "actualText": "数量数量数量数量数量数量数...", + "actualTextHeight": 32, + "actualTextWidth": 168, + "height": 20, "multiLineActualTexts": Array [ "数量数量数量数", - "量数量数量数量", - "数量数量数量...", + "量数量数量数...", ], "originalText": "数量数量数量数量数量数量数量数量数量数量数量", "width": 103.8, @@ -17568,15 +22720,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 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 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 +22739,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 100, + "height": 46, "multiLineActualTexts": Array [ "2", ], @@ -17649,11 +22801,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 +22857,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 +22923,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 +22979,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 +23045,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 +23101,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 +23167,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 +23223,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 +23289,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 +23346,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 +23413,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 +23476,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 +23493,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 76, + "height": 20, "multiLineActualTexts": Array [ "2", ], @@ -18167,7 +23504,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "3", ], @@ -18178,7 +23515,7 @@ Array [ "actualText": "4", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "4", ], @@ -18189,7 +23526,7 @@ Array [ "actualText": "5", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "5", ], @@ -18200,7 +23537,7 @@ Array [ "actualText": "6", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "6", ], @@ -18211,7 +23548,7 @@ Array [ "actualText": "7", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "7", ], @@ -18222,23 +23559,122 @@ Array [ "actualText": "8", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "8", ], - "originalText": 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 +23685,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 100, + "height": 64, "multiLineActualTexts": Array [ "省份", ], @@ -18257,15 +23693,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 +23709,7 @@ Array [ "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 48, "actualTextWidth": 243, - "height": 50, + "height": 64, "multiLineActualTexts": Array [ "类别类别类别类", "别类别类别类别", @@ -18287,7 +23722,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 100, + "height": 64, "multiLineActualTexts": Array [ "子类别", ], @@ -18295,15 +23730,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 +23745,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 +23764,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 76, + "height": 20, "multiLineActualTexts": Array [ "2", ], @@ -18341,7 +23775,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "3", ], @@ -18352,7 +23786,7 @@ Array [ "actualText": "4", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "4", ], @@ -18363,7 +23797,7 @@ Array [ "actualText": "5", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "5", ], @@ -18374,7 +23808,7 @@ Array [ "actualText": "6", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "6", ], @@ -18385,7 +23819,7 @@ Array [ "actualText": "7", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "7", ], @@ -18396,18 +23830,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,15 +23948,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省...", - "actualTextHeight": 60, - "actualTextWidth": 338, - "height": 76, + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 20, "multiLineActualTexts": Array [ "浙江省浙江省浙", "江省浙江省浙江", - "省浙江省浙江省", - "浙江省浙江省...", + "省浙江省浙江...", ], "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 103.8, @@ -18432,7 +23964,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -18443,7 +23975,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -18454,7 +23986,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -18465,7 +23997,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -18476,7 +24008,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "浙江省", ], @@ -18487,7 +24019,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 +24129,7 @@ Array [ "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "绍兴市", ], @@ -18506,15 +24137,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市...", - "actualTextHeight": 60, - "actualTextWidth": 338, - "height": 76, + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 20, "multiLineActualTexts": Array [ "杭州市杭州市杭", "州市杭州市杭州", - "市杭州市杭州市", - "杭州市杭州市...", + "市杭州市杭州...", ], "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", "width": 103.8, @@ -18523,7 +24153,7 @@ Array [ "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "绍兴市", ], @@ -18534,7 +24164,7 @@ Array [ "actualText": "宁波市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "宁波市", ], @@ -18545,7 +24175,7 @@ Array [ "actualText": "舟山市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "舟山市", ], @@ -18556,7 +24186,7 @@ Array [ "actualText": "杭州市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "杭州市", ], @@ -18567,7 +24197,7 @@ Array [ "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "绍兴市", ], @@ -18578,18 +24208,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 +24326,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", - "actualTextHeight": 60, - "actualTextWidth": 340, - "height": 76, + "actualText": "家具家具家具家具家具家具家具家具家具家具...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 20, "multiLineActualTexts": Array [ "家具家具家具家", "具家具家具家具", - "家具家具家具家", - "具家具家具家具", + "家具家具家具...", ], "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", "width": 103.8, @@ -18614,7 +24342,7 @@ Array [ "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "家具", ], @@ -18625,7 +24353,51 @@ 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 [ "家具", ], @@ -18635,52 +24407,107 @@ Array [ Object { "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 30, + "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 +24515,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌...", - "actualTextHeight": 60, - "actualTextWidth": 338, - "height": 76, + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "height": 20, "multiLineActualTexts": Array [ "桌子桌子桌子桌", "子桌子桌子桌子", - "桌子桌子桌子桌", - "子桌子桌子桌...", + "桌子桌子桌子...", ], "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", "width": 103.8, @@ -18705,7 +24531,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 46, + "height": 20, "multiLineActualTexts": Array [ "桌子", ], @@ -18716,7 +24542,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "桌子", ], @@ -18727,7 +24553,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "桌子", ], @@ -18738,7 +24564,7 @@ Array [ "actualText": "沙发", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "沙发", ], @@ -18749,7 +24575,7 @@ Array [ "actualText": "沙发", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "沙发", ], @@ -18760,7 +24586,7 @@ Array [ "actualText": "沙发", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 30, + "height": 20, "multiLineActualTexts": Array [ "沙发", ], @@ -18768,402 +24594,321 @@ 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", - "actualTextHeight": 15, - "actualTextWidth": 7, + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, "height": 20, "multiLineActualTexts": Array [ - "2", + "2367236723611", + "11", ], - "originalText": 2, - "width": 80, + "originalText": 236723672361111, + "width": 103.8, }, Object { - "actualText": "3", - "actualTextHeight": 15, - "actualTextWidth": 7, + "actualText": "7789778977897789778977897789", + "actualTextHeight": 45, + "actualTextWidth": 189, "height": 20, "multiLineActualTexts": Array [ - "3", + "7789778977897", + "7897789778977", + "89", ], - "originalText": 3, - "width": 80, + "originalText": "7789778977897789778977897789", + "width": 103.8, }, Object { - "actualText": "4", - "actualTextHeight": 15, - "actualTextWidth": 7, + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, "height": 20, "multiLineActualTexts": Array [ - "4", + "2367236723611", + "11", ], - "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 +24930,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 46, "multiLineActualTexts": Array [ "3", ], @@ -19196,7 +24941,7 @@ Array [ "actualText": "4", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "4", ], @@ -19207,7 +24952,7 @@ Array [ "actualText": "5", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 100, "multiLineActualTexts": Array [ "5", ], @@ -19218,7 +24963,7 @@ Array [ "actualText": "6", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "6", ], @@ -19229,7 +24974,7 @@ Array [ "actualText": "7", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "7", ], @@ -19240,239 +24985,190 @@ Array [ "actualText": "8", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "8", ], "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": "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, + "actualText": "序号", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, "multiLineActualTexts": Array [ - "15", + "序号", ], - "originalText": 15, + "originalText": "序号", "width": 80, }, Object { - "actualText": "16", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, + "actualText": "省份", + "actualTextHeight": 16, + "actualTextWidth": 25, + "height": 64, "multiLineActualTexts": Array [ - "16", + "省份", ], - "originalText": 16, - "width": 80, + "originalText": "省份", + "width": 103.8, }, Object { - "actualText": "17", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, + "actualText": "城市城市城市城市城市城市城市城市城市城市...", + "actualTextHeight": 48, + "actualTextWidth": 253, + "height": 64, "multiLineActualTexts": Array [ - "17", + "城市城市城市城", + "市城市城市城市", + "城市城市城市...", ], - "originalText": 17, - "width": 80, + "originalText": "城市城市城市城市城市城市城市城市城市城市城市城市", + "width": 103.8, }, Object { - "actualText": "18", - "actualTextHeight": 15, - "actualTextWidth": 14, - "height": 20, + "actualText": "类别类别类别类别类别类别类别类别类别类别", + "actualTextHeight": 48, + "actualTextWidth": 243, + "height": 64, "multiLineActualTexts": Array [ - "18", + "类别类别类别类", + "别类别类别类别", + "类别类别类别", ], - "originalText": 18, - "width": 80, + "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": 30, - "actualTextWidth": 168, - "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 [ "浙江省", ], @@ -19480,21 +25176,23 @@ Array [ "width": 103.8, }, Object { - "actualText": "浙江省", - "actualTextHeight": 15, - "actualTextWidth": 37, + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江...", + "actualTextHeight": 45, + "actualTextWidth": 253, "height": 20, "multiLineActualTexts": Array [ - "浙江省", + "浙江省浙江省浙", + "江省浙江省浙江", + "省浙江省浙江...", ], - "originalText": "浙江省", + "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 103.8, }, Object { "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 46, "multiLineActualTexts": Array [ "浙江省", ], @@ -19505,7 +25203,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "浙江省", ], @@ -19516,7 +25214,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 100, "multiLineActualTexts": Array [ "浙江省", ], @@ -19527,7 +25225,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "浙江省", ], @@ -19538,7 +25236,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "浙江省", ], @@ -19546,21 +25244,21 @@ Array [ "width": 103.8, }, Object { - "actualText": "四川省", + "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ - "四川省", + "浙江省", ], - "originalText": "四川省", + "originalText": "浙江省", "width": 103.8, }, Object { "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 46, "multiLineActualTexts": Array [ "绍兴市", ], @@ -19568,13 +25266,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "杭州市杭州市杭州市杭州市杭...", - "actualTextHeight": 30, - "actualTextWidth": 168, + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州...", + "actualTextHeight": 45, + "actualTextWidth": 253, "height": 20, "multiLineActualTexts": Array [ "杭州市杭州市杭", - "州市杭州市杭...", + "州市杭州市杭州", + "市杭州市杭州...", ], "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", "width": 103.8, @@ -19583,51 +25282,7 @@ Array [ "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, + "height": 46, "multiLineActualTexts": Array [ "绍兴市", ], @@ -19638,7 +25293,7 @@ Array [ "actualText": "宁波市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "宁波市", ], @@ -19649,7 +25304,7 @@ Array [ "actualText": "舟山市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 100, "multiLineActualTexts": Array [ "舟山市", ], @@ -19660,7 +25315,7 @@ Array [ "actualText": "杭州市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "杭州市", ], @@ -19671,7 +25326,7 @@ Array [ "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "绍兴市", ], @@ -19682,7 +25337,7 @@ Array [ "actualText": "宁波市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "宁波市", ], @@ -19690,99 +25345,78 @@ Array [ "width": 103.8, }, Object { - "actualText": "舟山市", - "actualTextHeight": 15, - "actualTextWidth": 37, - "height": 20, - "multiLineActualTexts": Array [ - "舟山市", - ], - "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, + "actualText": "家具家具家具家具家具家具家具家具家具家具...", + "actualTextHeight": 45, + "actualTextWidth": 253, "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": "家具", "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 [ "家具", ], @@ -19793,7 +25427,7 @@ Array [ "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "家具", ], @@ -19801,569 +25435,622 @@ Array [ "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, + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子...", + "actualTextHeight": 45, + "actualTextWidth": 253, "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": 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": "办公用品", + "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": "办公用品", - "actualTextHeight": 15, - "actualTextWidth": 49, + "actualText": "7789778977897789778977897789", + "actualTextHeight": 45, + "actualTextWidth": 189, "height": 20, "multiLineActualTexts": Array [ - "办公用品", + "7789778977897", + "7897789778977", + "89", ], - "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": 25, - "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": "桌子桌子桌子桌子桌子桌子桌...", - "actualTextHeight": 30, - "actualTextWidth": 168, - "height": 20, + "actualText": "7234", + "actualTextHeight": 15, + "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": 15, + "actualText": "序号", + "actualTextHeight": 16, "actualTextWidth": 25, - "height": 20, + "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": 13, - "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": 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, }, Object { - "actualText": "桌子", + "actualText": "浙江省", "actualTextHeight": 15, - "actualTextWidth": 25, - "height": 20, + "actualTextWidth": 37, + "height": 100, "multiLineActualTexts": Array [ - "桌子", + "浙江省", ], - "originalText": "桌子", + "originalText": "浙江省", "width": 103.8, }, Object { - "actualText": "236723672361111", - "actualTextHeight": 30, - "actualTextWidth": 100, - "height": 20, + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "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", + "actualText": "绍兴市", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualTextWidth": 37, + "height": 100, "multiLineActualTexts": Array [ - "3877", + "绍兴市", ], - "originalText": 3877, + "originalText": "绍兴市", "width": 103.8, }, Object { - "actualText": "4342", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "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": 37, + "height": 100, "multiLineActualTexts": Array [ - "632", + "宁波市", ], - "originalText": 632, + "originalText": "宁波市", "width": 103.8, }, Object { - "actualText": "7234", + "actualText": "家具", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualTextWidth": 25, + "height": 100, "multiLineActualTexts": Array [ - "7234", + "家具", ], - "originalText": 7234, + "originalText": "家具", "width": 103.8, }, Object { - "actualText": "834", - "actualTextHeight": 15, - "actualTextWidth": 21, - "height": 20, + "actualText": "家具家具家具家具家具家具家具家具家具家具...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "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", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 26, - "height": 20, + "actualTextWidth": 25, + "height": 100, "multiLineActualTexts": Array [ - "1145", + "桌子", ], - "originalText": 1145, + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "1432", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子...", + "actualTextHeight": 45, + "actualTextWidth": 253, + "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", + "actualText": "桌子", "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualTextWidth": 25, + "height": 100, "multiLineActualTexts": Array [ - "1354", + "桌子", ], - "originalText": 1354, + "originalText": "桌子", "width": 103.8, }, Object { - "actualText": "1523", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 100, "multiLineActualTexts": Array [ - "1523", + "2367236723611", + "11", ], - "originalText": 1523, + "originalText": 236723672361111, "width": 103.8, }, Object { - "actualText": "1634", - "actualTextHeight": 15, - "actualTextWidth": 27, - "height": 20, + "actualText": "7789778977897789778977897789", + "actualTextHeight": 45, + "actualTextWidth": 189, + "height": 100, "multiLineActualTexts": Array [ - "1634", + "7789778977897", + "7897789778977", + "89", ], - "originalText": 1634, + "originalText": "7789778977897789778977897789", "width": 103.8, }, Object { - "actualText": "1723", + "actualText": "236723672361111", + "actualTextHeight": 30, + "actualTextWidth": 100, + "height": 100, + "multiLineActualTexts": Array [ + "2367236723611", + "11", + ], + "originalText": 236723672361111, + "width": 103.8, + }, + Object { + "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 +26060,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 +26088,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 100, + "height": 46, "multiLineActualTexts": Array [ "3", ], @@ -20412,23 +26099,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 +26148,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 64, "multiLineActualTexts": Array [ "省份", ], @@ -20447,25 +26156,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 +26185,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 40, + "height": 64, "multiLineActualTexts": Array [ "子类别", ], @@ -20482,13 +26193,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 +26208,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 +26238,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 100, + "height": 46, "multiLineActualTexts": Array [ "3", ], @@ -20537,13 +26249,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 +26290,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "浙江省浙江省浙江省浙江省浙...", - "actualTextHeight": 30, - "actualTextWidth": 168, + "actualText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江...", + "actualTextHeight": 45, + "actualTextWidth": 253, "height": 100, "multiLineActualTexts": Array [ "浙江省浙江省浙", - "江省浙江省浙...", + "江省浙江省浙江", + "省浙江省浙江...", ], "originalText": "浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省浙江省", "width": 103.8, @@ -20571,7 +26306,7 @@ Array [ "actualText": "浙江省", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 100, + "height": 46, "multiLineActualTexts": Array [ "浙江省", ], @@ -20582,7 +26317,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 +26358,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "杭州市杭州市杭州市杭州市杭...", - "actualTextHeight": 30, - "actualTextWidth": 168, + "actualText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州...", + "actualTextHeight": 45, + "actualTextWidth": 253, "height": 100, "multiLineActualTexts": Array [ "杭州市杭州市杭", - "州市杭州市杭...", + "州市杭州市杭州", + "市杭州市杭州...", ], "originalText": "杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市杭州市", "width": 103.8, @@ -20616,7 +26374,7 @@ Array [ "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 100, + "height": 46, "multiLineActualTexts": Array [ "绍兴市", ], @@ -20627,13 +26385,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 +26426,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "家具家具家具家具家具家具家...", - "actualTextHeight": 30, - "actualTextWidth": 168, + "actualText": "家具家具家具家具家具家具家具家具家具家具...", + "actualTextHeight": 45, + "actualTextWidth": 253, "height": 100, "multiLineActualTexts": Array [ "家具家具家具家", - "具家具家具家...", + "具家具家具家具", + "家具家具家具...", ], "originalText": "家具家具家具家具家具家具家具家具家具家具家具家具家具家具", "width": 103.8, @@ -20661,7 +26442,7 @@ Array [ "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 100, + "height": 46, "multiLineActualTexts": Array [ "家具", ], @@ -20672,7 +26453,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 +26494,14 @@ Array [ "width": 103.8, }, Object { - "actualText": "桌子桌子桌子桌子桌子桌子桌...", - "actualTextHeight": 30, - "actualTextWidth": 168, + "actualText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子...", + "actualTextHeight": 45, + "actualTextWidth": 253, "height": 100, "multiLineActualTexts": Array [ "桌子桌子桌子桌", - "子桌子桌子桌...", + "子桌子桌子桌子", + "桌子桌子桌子...", ], "originalText": "桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子桌子", "width": 103.8, @@ -20706,7 +26510,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 100, + "height": 46, "multiLineActualTexts": Array [ "桌子", ], @@ -20717,13 +26521,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 +26563,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 +26579,7 @@ Array [ "actualText": "236723672361111", "actualTextHeight": 30, "actualTextWidth": 100, - "height": 100, + "height": 46, "multiLineActualTexts": Array [ "2367236723611", "11", @@ -20764,23 +26591,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 +26639,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 +26656,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "2", ], @@ -20818,7 +26667,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "3", ], @@ -20913,16 +26762,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 +26804,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "省份", ], @@ -20941,25 +26812,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 +26837,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "子类别", ], @@ -20976,13 +26845,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 +26858,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 +26877,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "2", ], @@ -21020,7 +26888,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "3", ], @@ -21115,11 +26983,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 +27017,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 +27031,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 +27152,7 @@ Array [ "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "绍兴市", ], @@ -21249,13 +27160,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 +27174,7 @@ Array [ "actualText": "绍兴市", "actualTextHeight": 15, "actualTextWidth": 37, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "绍兴市", ], @@ -21359,11 +27269,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 +27303,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 +27317,7 @@ Array [ "actualText": "家具", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "家具", ], @@ -21481,11 +27412,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 +27446,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 +27460,7 @@ Array [ "actualText": "桌子", "actualTextHeight": 15, "actualTextWidth": 25, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "桌子", ], @@ -21603,38 +27555,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 +27698,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 +27739,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 +27756,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 91, "multiLineActualTexts": Array [ "2", ], @@ -21774,7 +27767,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 46, "multiLineActualTexts": Array [ "3", ], @@ -21785,7 +27778,7 @@ Array [ "actualText": "4", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "4", ], @@ -21796,7 +27789,7 @@ Array [ "actualText": "5", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "5", ], @@ -21804,147 +27797,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 +27849,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 80, "multiLineActualTexts": Array [ "省份", ], @@ -21963,14 +27857,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 +27874,7 @@ Array [ "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 48, "actualTextWidth": 243, - "height": 56, + "height": 80, "multiLineActualTexts": Array [ "类别类别类别类", "别类别类别类别", @@ -21992,7 +27887,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 56, + "height": 80, "multiLineActualTexts": Array [ "子类别", ], @@ -22000,14 +27895,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 +27911,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 +27930,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 91, "multiLineActualTexts": Array [ "2", ], @@ -22045,7 +27941,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 46, "multiLineActualTexts": Array [ "3", ], @@ -22056,7 +27952,7 @@ Array [ "actualText": "4", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "4", ], @@ -22067,7 +27963,7 @@ Array [ "actualText": "5", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "5", ], @@ -22078,7 +27974,7 @@ Array [ "actualText": "6", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "6", ], @@ -22089,7 +27985,7 @@ Array [ "actualText": "7", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "7", ], @@ -22100,7 +27996,7 @@ Array [ "actualText": "8", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "8", ], @@ -22108,1061 +28004,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 +29154,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 +29171,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 20, + "height": 30, "multiLineActualTexts": Array [ "2", ], @@ -23200,7 +29182,7 @@ Array [ "actualText": "3", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 46, + "height": 30, "multiLineActualTexts": Array [ "3", ], @@ -23222,7 +29204,7 @@ Array [ "actualText": "5", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 100, + "height": 30, "multiLineActualTexts": Array [ "5", ], @@ -23273,1710 +29255,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 +30720,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 +30737,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 61, "multiLineActualTexts": Array [ "2", ], @@ -25131,16 +30865,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 +30929,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 +31007,7 @@ Array [ "actualText": "2", "actualTextHeight": 15, "actualTextWidth": 7, - "height": 30, + "height": 61, "multiLineActualTexts": Array [ "2", ], @@ -25352,6 +31135,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 +31188,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 +31288,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "浙江省", @@ -25394,7 +31299,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "浙江省", @@ -25405,7 +31310,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "浙江省", @@ -25416,7 +31321,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "浙江省", @@ -25427,7 +31332,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "浙江省", @@ -25438,7 +31343,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "浙江省", @@ -25449,7 +31354,7 @@ Array [ "浙江省", ], "originalText": "浙江省", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "浙江省", @@ -25460,62 +31365,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 +31443,7 @@ Array [ "绍兴市", ], "originalText": "绍兴市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "宁波市", @@ -25537,7 +31454,7 @@ Array [ "宁波市", ], "originalText": "宁波市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "舟山市", @@ -25548,7 +31465,7 @@ Array [ "舟山市", ], "originalText": "舟山市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "杭州市", @@ -25559,7 +31476,7 @@ Array [ "杭州市", ], "originalText": "杭州市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "绍兴市", @@ -25570,7 +31487,7 @@ Array [ "绍兴市", ], "originalText": "绍兴市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "宁波市", @@ -25581,7 +31498,7 @@ Array [ "宁波市", ], "originalText": "宁波市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "舟山市", @@ -25592,7 +31509,7 @@ Array [ "舟山市", ], "originalText": "舟山市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "杭州市", @@ -25603,7 +31520,7 @@ Array [ "杭州市", ], "originalText": "杭州市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "绍兴市", @@ -25614,7 +31531,7 @@ Array [ "绍兴市", ], "originalText": "绍兴市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "宁波市", @@ -25625,7 +31542,7 @@ Array [ "宁波市", ], "originalText": "宁波市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "舟山市", @@ -25636,7 +31553,7 @@ Array [ "舟山市", ], "originalText": "舟山市", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "家具", @@ -25647,18 +31564,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 +31587,7 @@ Array [ "家具", ], "originalText": "家具", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "家具", @@ -25680,7 +31598,7 @@ Array [ "家具", ], "originalText": "家具", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "家具", @@ -25691,7 +31609,7 @@ Array [ "家具", ], "originalText": "家具", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "家具", @@ -25702,7 +31620,7 @@ Array [ "家具", ], "originalText": "家具", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "家具", @@ -25713,7 +31631,7 @@ Array [ "家具", ], "originalText": "家具", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "家具", @@ -25724,7 +31642,7 @@ Array [ "家具", ], "originalText": "家具", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "家具", @@ -25735,7 +31653,7 @@ Array [ "家具", ], "originalText": "家具", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "办公用品", @@ -25746,7 +31664,7 @@ Array [ "办公用品", ], "originalText": "办公用品", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "办公用品", @@ -25757,7 +31675,7 @@ Array [ "办公用品", ], "originalText": "办公用品", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "办公用品", @@ -25768,7 +31686,7 @@ Array [ "办公用品", ], "originalText": "办公用品", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "办公用品", @@ -25779,7 +31697,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 +31752,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 +31775,7 @@ Array [ "桌子", ], "originalText": "桌子", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "桌子", @@ -25823,7 +31786,7 @@ Array [ "桌子", ], "originalText": "桌子", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "桌子", @@ -25834,7 +31797,7 @@ Array [ "桌子", ], "originalText": "桌子", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "沙发", @@ -25845,7 +31808,7 @@ Array [ "沙发", ], "originalText": "沙发", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "沙发", @@ -25856,7 +31819,7 @@ Array [ "沙发", ], "originalText": "沙发", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "沙发", @@ -25867,7 +31830,7 @@ Array [ "沙发", ], "originalText": "沙发", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "沙发", @@ -25878,7 +31841,7 @@ Array [ "沙发", ], "originalText": "沙发", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "笔", @@ -25889,7 +31852,7 @@ Array [ "笔", ], "originalText": "笔", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "笔", @@ -25900,7 +31863,7 @@ Array [ "笔", ], "originalText": "笔", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "笔", @@ -25911,7 +31874,7 @@ Array [ "笔", ], "originalText": "笔", - "width": 103.8, + "width": 143.8, }, Object { "actualText": "笔", @@ -25922,7 +31885,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 +31940,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 +31963,7 @@ Array [ "236723672361111", ], "originalText": 236723672361111, - "width": 103.8, + "width": 143.8, }, Object { "actualText": "3877", @@ -25966,7 +31974,7 @@ Array [ "3877", ], "originalText": 3877, - "width": 103.8, + "width": 143.8, }, Object { "actualText": "4342", @@ -25977,7 +31985,7 @@ Array [ "4342", ], "originalText": 4342, - "width": 103.8, + "width": 143.8, }, Object { "actualText": "5343", @@ -25988,7 +31996,7 @@ Array [ "5343", ], "originalText": 5343, - "width": 103.8, + "width": 143.8, }, Object { "actualText": "632", @@ -25999,7 +32007,7 @@ Array [ "632", ], "originalText": 632, - "width": 103.8, + "width": 143.8, }, Object { "actualText": "7234", @@ -26010,7 +32018,7 @@ Array [ "7234", ], "originalText": 7234, - "width": 103.8, + "width": 143.8, }, Object { "actualText": "834", @@ -26021,7 +32029,7 @@ Array [ "834", ], "originalText": 834, - "width": 103.8, + "width": 143.8, }, Object { "actualText": "945", @@ -26032,7 +32040,7 @@ Array [ "945", ], "originalText": 945, - "width": 103.8, + "width": 143.8, }, Object { "actualText": "1304", @@ -26043,7 +32051,7 @@ Array [ "1304", ], "originalText": 1304, - "width": 103.8, + "width": 143.8, }, Object { "actualText": "1145", @@ -26054,7 +32062,7 @@ Array [ "1145", ], "originalText": 1145, - "width": 103.8, + "width": 143.8, }, Object { "actualText": "1432", @@ -26065,7 +32073,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 +33228,7 @@ Array [ "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "序号", ], @@ -27287,209 +33339,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 +33623,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 +33724,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 +33825,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 +33926,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 +34029,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 +34038,7 @@ Array [ "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "序号", ], @@ -28185,17 +34160,6 @@ Array [ "originalText": 10, "width": 80, }, - Object { - "actualText": "11", - "actualTextHeight": 15, - "actualTextWidth": 13, - "height": 30, - "multiLineActualTexts": Array [ - "11", - ], - "originalText": 11, - "width": 80, - }, ] `; @@ -28205,7 +34169,7 @@ Array [ "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "序号", ], @@ -28216,7 +34180,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "省份", ], @@ -28227,7 +34191,7 @@ Array [ "actualText": "城市城市城市城市城市城市城...", "actualTextHeight": 32, "actualTextWidth": 168, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "城市城市城市城", "市城市城市城...", @@ -28239,7 +34203,7 @@ Array [ "actualText": "类别类别类别类别类别类别类...", "actualTextHeight": 32, "actualTextWidth": 168, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "类别类别类别类", "别类别类别类...", @@ -28251,7 +34215,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "子类别", ], @@ -28262,7 +34226,7 @@ Array [ "actualText": "数量数量数量数量数量数量数...", "actualTextHeight": 32, "actualTextWidth": 168, - "height": 40, + "height": 48, "multiLineActualTexts": Array [ "数量数量数量数", "量数量数量数...", @@ -28387,17 +34351,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 +34462,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 +34573,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 +34684,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 +34795,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 +34908,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 +34917,7 @@ Array [ "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "序号", ], @@ -29227,7 +35125,7 @@ Array [ "actualText": "序号", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "序号", ], @@ -29238,7 +35136,7 @@ Array [ "actualText": "省份", "actualTextHeight": 16, "actualTextWidth": 25, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "省份", ], @@ -29249,7 +35147,7 @@ Array [ "actualText": "城市城市城市城市城市城市城市城市城市城市城市城市", "actualTextHeight": 48, "actualTextWidth": 291, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "城市城市城市城市城市", "城市城市城市城市城市", @@ -29262,7 +35160,7 @@ Array [ "actualText": "类别类别类别类别类别类别类别类别类别类别", "actualTextHeight": 32, "actualTextWidth": 242, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "类别类别类别类别类别", "类别类别类别类别类别", @@ -29274,7 +35172,7 @@ Array [ "actualText": "子类别", "actualTextHeight": 16, "actualTextWidth": 37, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "子类别", ], @@ -29285,7 +35183,7 @@ Array [ "actualText": "数量数量数量数量数量数量数量数量数量数量数量", "actualTextHeight": 48, "actualTextWidth": 267, - "height": 56, + "height": 64, "multiLineActualTexts": Array [ "数量数量数量数量数量", "数量数量数量数量数量", @@ -30434,3 +36332,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-collapse-spec.ts.snap b/packages/s2-core/__tests__/spreadsheet/__snapshots__/spread-sheet-collapse-spec.ts.snap index f9c60166c0..697679fd89 100644 --- a/packages/s2-core/__tests__/spreadsheet/__snapshots__/spread-sheet-collapse-spec.ts.snap +++ b/packages/s2-core/__tests__/spreadsheet/__snapshots__/spread-sheet-collapse-spec.ts.snap @@ -27,3 +27,18 @@ Array [ "root[&]四川省", ] `; + +exports[`SpreadSheet Collapse/Expand Tests should support expandDepth for custom tree 1`] = ` +Array [ + "root[&]a-1", + "root[&]a-1[&]a-1-1", + "root[&]a-1[&]a-1-2", + "root[&]a-2", + "root[&]a-2[&]a-2-1", + "root[&]a-2[&]a-2-2", + "root[&]a-3", + "root[&]a-3[&]a-3-1", + "root[&]a-3[&]a-3-2", + "root[&]a-3[&]measure-5", +] +`; 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 281de69170..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, @@ -632,10 +641,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#0647b1", "verticalBorderColorOpacity": 1, @@ -718,10 +727,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#0647b1", "verticalBorderColorOpacity": 1, @@ -735,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", @@ -1081,10 +1099,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#1e2436", "verticalBorderColorOpacity": 1, @@ -1211,10 +1229,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#CCDBFC", "verticalBorderColorOpacity": 1, @@ -1297,10 +1315,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#CCDBFC", "verticalBorderColorOpacity": 1, @@ -1314,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", @@ -1660,10 +1687,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#E0E9FD", "verticalBorderColorOpacity": 1, @@ -1790,10 +1817,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#E7E9ED", "verticalBorderColorOpacity": 1, @@ -1876,10 +1903,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#E7E9ED", "verticalBorderColorOpacity": 1, @@ -1893,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", @@ -2239,10 +2275,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#F0F2F4", "verticalBorderColorOpacity": 1, @@ -2369,10 +2405,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#CCDBFC", "verticalBorderColorOpacity": 1, @@ -2455,10 +2491,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#CCDBFC", "verticalBorderColorOpacity": 1, @@ -2472,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", @@ -2818,10 +2863,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#E0E9FD", "verticalBorderColorOpacity": 1, @@ -2948,10 +2993,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#CCDBFC", "verticalBorderColorOpacity": 1, @@ -3034,10 +3079,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#CCDBFC", "verticalBorderColorOpacity": 1, @@ -3051,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", @@ -3397,10 +3451,10 @@ Object { }, }, "padding": Object { - "bottom": 4, + "bottom": 8, "left": 8, "right": 8, - "top": 4, + "top": 8, }, "verticalBorderColor": "#E0E9FD", "verticalBorderColorOpacity": 1, diff --git a/packages/s2-core/__tests__/bugs/issue-2385-spec.ts b/packages/s2-core/__tests__/spreadsheet/compare-layout-spec.ts similarity index 64% rename from packages/s2-core/__tests__/bugs/issue-2385-spec.ts rename to packages/s2-core/__tests__/spreadsheet/compare-layout-spec.ts index bdf59d2f33..7980c50b89 100644 --- a/packages/s2-core/__tests__/bugs/issue-2385-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,16 +122,18 @@ 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.skip.each([ + test.each([ { showDefaultHeaderActionIcon: true }, { showDefaultHeaderActionIcon: false }, ])( @@ -137,12 +171,13 @@ describe('Compare Layout Tests', () => { expect(dataCellWidthList).toEqual( options.showDefaultHeaderActionIcon - ? [197, 197, 197, 197, 116, 116, 116, 116, 81, 81, 81, 81] - : [197, 197, 197, 197, 116, 116, 116, 116, 62, 62, 62, 62], + ? [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 ? [197, 116, 81] : [197, 116, 62], + 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..0ce3904ee2 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,10 @@ 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(), + }); // 取消选中 s2.emit(S2Event.CORNER_CELL_CLICK, {} as unknown as GEvent); @@ -277,7 +283,10 @@ 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(), + }); getCellSpy.mockClear(); }, @@ -391,4 +400,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 60c2ce7bca..fbea95055f 100644 --- a/packages/s2-core/__tests__/spreadsheet/custom-cell-style-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/custom-cell-style-spec.ts @@ -156,6 +156,30 @@ describe('SpreadSheet Custom Cell Style Tests', () => { expect(mapNodeSize(s2.facet.getRowNodes())).toMatchSnapshot(); }); + test('should get custom row cell style by extra field', async () => { + s2.setDataCfg({ + fields: { + valueInCols: false, + }, + }); + + s2.setOptions({ + style: { + rowCell: { + widthByField: { + [EXTRA_FIELD]: 50, + }, + heightByField: { + [EXTRA_FIELD]: 300, + }, + }, + }, + }); + await s2.render(); + + expect(mapNodeSize(s2.facet.getRowNodes())).toMatchSnapshot(); + }); + test('should not get custom row cell style if not leaf node by field', async () => { const width = 100; const height = 200; @@ -306,7 +330,27 @@ describe('SpreadSheet Custom Cell Style Tests', () => { }); await s2.render(); - expect(mapNodeSize(s2.facet.getRowNodes())).toMatchSnapshot(); + expect(mapNodeSize(s2.facet.getColNodes())).toMatchSnapshot(); + }); + + test('should get custom col cell style by value field', async () => { + const priceValueField = `price`; + + s2.setOptions({ + style: { + colCell: { + widthByField: { + [priceValueField]: 50, + }, + heightByField: { + [priceValueField]: 300, + }, + }, + }, + }); + await s2.render(); + + expect(mapNodeSize(s2.facet.getColNodes())).toMatchSnapshot(); }); test('should not get custom col cell style if not leaf node by field', async () => { 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..f2a256984d 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'; @@ -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(); }); 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..7e6b1aa366 100644 --- a/packages/s2-core/__tests__/spreadsheet/multi-line-text-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/multi-line-text-spec.ts @@ -13,6 +13,7 @@ import type { S2CellType, S2Options, } from '../../src/common'; +import { customColSimpleMultipleTextColumns } from '../data/custom-table-col-fields'; import { PivotSheetMultiLineTextDataCfg, TableSheetMultiLineTextDataCfg, @@ -160,7 +161,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { await s2.render(false); matchCellStyleSnapshot(); - expectColHierarchyHeight(118, 80, 38); + expectColHierarchyHeight(142, 96, 46); }); test('should render three max text lines', async () => { @@ -168,7 +169,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { await s2.render(false); matchCellStyleSnapshot(); - expectColHierarchyHeight(165, 112, 53); + expectColHierarchyHeight(189, 128, 61); }); test('should render custom text overflow text', async () => { @@ -213,6 +214,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { // wordWrap 关闭时, 不会渲染省略号 cells.forEach((cell) => { expect(cell.getActualText()).not.toContain('...'); + expect(cell.isTextOverflowing()).toBeFalsy(); }); }); expectColHierarchyHeight(90); @@ -335,7 +337,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { await s2.render(false); matchCellStyleSnapshot(); - expectColHierarchyHeight(118, 80, 38); + expectColHierarchyHeight(142, 96, 46); }); test('should not adaptive adjust cell height if custom cell style more than actual text height', async () => { @@ -386,7 +388,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { updateStyle(3); await s2.render(false); - expectColHierarchyHeight(149, 96, 53); + expectColHierarchyHeight(173, 112, 61); }); test('should render correctly layout if only enable grand totals', async () => { @@ -442,8 +444,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(236, 160, 76); }); test('should render three max text lines for tree mode', async () => { @@ -473,7 +475,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 +530,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))( @@ -545,6 +547,61 @@ 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(); + }); }); describe('TableSheet', () => { @@ -579,7 +636,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 +645,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,6 +685,7 @@ describe('SpreadSheet Multi Line Text Tests', () => { // wordWrap 关闭时, 不会渲染省略号 cells.forEach((cell) => { expect(cell.getActualText()).not.toContain('...'); + expect(cell.isTextOverflowing()).toBeFalsy(); }); }); }); @@ -687,7 +745,7 @@ 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 @@ -971,7 +1029,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 +1076,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-collapse-spec.ts b/packages/s2-core/__tests__/spreadsheet/spread-sheet-collapse-spec.ts index 1159c57726..bc4a67a851 100644 --- a/packages/s2-core/__tests__/spreadsheet/spread-sheet-collapse-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/spread-sheet-collapse-spec.ts @@ -401,4 +401,28 @@ describe('SpreadSheet Collapse/Expand Tests', () => { expect(s2.facet.getRowNodes().map(({ id }) => id)).toMatchSnapshot(); }); }); + + test('should support expandDepth for custom tree', async () => { + const customRowDataCfg: S2DataConfig = { + data: CustomGridData, + fields: customRowGridFields, + }; + + s2 = createPivotSheet({ + ...s2Options, + style: { + rowCell: { + expandDepth: 0, + // expandDepth > collapseAll + collapseAll: true, + }, + }, + }); + + s2.setDataCfg(customRowDataCfg); + await s2.render(); + + expectCornerIconName(s2, 'Minus'); + expect(s2.facet.getRowNodes().map(({ id }) => id)).toMatchSnapshot(); + }); }); diff --git a/packages/s2-core/__tests__/spreadsheet/spread-sheet-spec.ts b/packages/s2-core/__tests__/spreadsheet/spread-sheet-spec.ts index f3d65ec151..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); @@ -307,6 +307,22 @@ describe('SpreadSheet Tests', () => { await expect(render()).resolves.toBe(undefined); }, ); + + // https://github.com/antvis/S2/issues/2857 + test('should enable touch action on mobile device', async () => { + const s2 = createPivotSheet({ + ...s2Options, + device: 'mobile', + }); + + await s2.render(); + + const { supportsPointerEvents } = s2.container.getConfig(); + const canvas = s2.getCanvasElement(); + + expect(supportsPointerEvents).toBeFalsy(); + expect(canvas.style.touchAction).not.toEqual('none'); + }); }); describe('Destroy Sheet Tests', () => { 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/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..799b2e54cf 100644 --- a/packages/s2-core/__tests__/unit/facet/pivot-facet-spec.ts +++ b/packages/s2-core/__tests__/unit/facet/pivot-facet-spec.ts @@ -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()), }; }), 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 67e7c97998..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,10 +16,9 @@ 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": null, + "width": undefined, "widthByField": Object { "testFieldId": 5, }, @@ -31,10 +29,9 @@ 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": null, + "width": undefined, "widthByField": Object { "testField": 5, }, @@ -45,12 +42,12 @@ 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": null, + "width": undefined, "widthByField": Object { - "testFieldId": 5, + "test-cell-a": 5, + "test-cell-b": 5, }, "wordWrap": true, } @@ -59,10 +56,9 @@ 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": null, + "width": undefined, "widthByField": Object { "test-cell-a": 5, "test-cell-b": 5, @@ -73,7 +69,7 @@ Object { exports[`Interaction Row Column Resize Tests should get multiple vertical filed resize style by field for selected resize type 1`] = ` Object { - "height": null, + "height": undefined, "heightByField": Object { "test-cell-a": 2, "test-cell-b": 2, @@ -81,7 +77,6 @@ Object { "maxLines": 1, "showTreeLeafNodeAlignDot": false, "textOverflow": "ellipsis", - "widthByField": null, "wordWrap": true, } `; @@ -95,7 +90,6 @@ Object { "maxLines": 1, "showTreeLeafNodeAlignDot": false, "textOverflow": "ellipsis", - "widthByField": null, "wordWrap": true, } `; @@ -103,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, } `; @@ -121,30 +113,58 @@ 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": null, + "height": undefined, "heightByField": Object { "testFieldId": 2, }, "maxLines": 1, "showTreeLeafNodeAlignDot": false, "textOverflow": "ellipsis", - "widthByField": null, "wordWrap": true, } `; exports[`Interaction Row Column Resize Tests should get vertical filed resize style by field for selected resize type 1`] = ` Object { - "height": null, + "height": undefined, "heightByField": Object { - "testFieldId": 2, + "test-cell-a": 2, + "test-cell-b": 2, }, "maxLines": 1, "showTreeLeafNodeAlignDot": false, "textOverflow": "ellipsis", - "widthByField": null, "wordWrap": true, } `; @@ -158,7 +178,34 @@ 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, +} +`; + +exports[`Interaction Row Column Resize Tests should not effect default resize style by field for selected resize type 1`] = ` +Object { + "height": 30, + "maxLines": 1, + "textOverflow": "ellipsis", + "width": 50, + "widthByField": Object { + "testFieldId": 5, + }, "wordWrap": true, } `; @@ -166,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, @@ -183,10 +229,12 @@ Object { "heightByField": Object { "testField": 2, }, - "maxLines": 1, + "maxLines": 3, + "maxLinesByField": Object { + "testField": 1, + }, "showTreeLeafNodeAlignDot": false, "textOverflow": "ellipsis", - "widthByField": null, "wordWrap": true, } `; @@ -194,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..77df5ac102 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; 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..aff0f8da5f 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,10 @@ 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(), + }); }); // https://github.com/antvis/S2/issues/2447 @@ -106,7 +112,10 @@ describe('Interaction Data Cell Click Tests', () => { }, } as unknown as GEvent); - expect(selected).toHaveBeenCalledWith([]); + expect(selected).toHaveBeenCalledWith([], { + interactionName: 'dataCellClick', + targetCell: s2.getCell(), + }); }); 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..c75f1d308e 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,11 @@ 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(), + }); // 取消选中 s2.emit(event, { @@ -231,7 +239,11 @@ 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(), + }); }, ); @@ -258,7 +270,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 +286,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/data-cell-multi-selection-spec.ts b/packages/s2-core/__tests__/unit/interaction/data-cell-multi-selection-spec.ts index e5e44df723..a226f050d4 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,13 @@ 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(), + }, + ); 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..0ffc98d561 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,10 @@ describe('Interaction Event Controller Tests', () => { } as MouseEventInit), ); - expect(selected).toHaveBeenCalledWith([]); + expect(selected).toHaveBeenCalledWith([], { + interactionName: 'globalReset', + targetCell: null, + }); expect(reset).toHaveBeenCalled(); expect(spreadsheet.interaction.reset).toHaveBeenCalled(); }); @@ -594,7 +597,10 @@ describe('Interaction Event Controller Tests', () => { new KeyboardEvent('keydown', { key: InteractionKeyboardKey.ESC }), ); - expect(selected).toHaveBeenCalledWith([]); + expect(selected).toHaveBeenCalledWith([], { + interactionName: 'globalReset', + targetCell: null, + }); 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..6175a1c439 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,10 @@ describe('Interaction Range Selection Tests', () => { ], stateName: InteractionStateName.SELECTED, }); - expect(selected).toHaveBeenCalledWith(activeCells); + expect(selected).toHaveBeenCalledWith(activeCells, { + interactionName: 'rangeSelection', + targetCell: s2.getCell(), + }); expect( s2.interaction.hasIntercepts([InterceptType.CLICK, InterceptType.HOVER]), ).toBeTruthy(); @@ -207,10 +229,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 +287,10 @@ describe('Interaction Range Selection Tests', () => { ], stateName: InteractionStateName.SELECTED, }); - expect(selected).toHaveBeenCalledWith(activeCells); + expect(selected).toHaveBeenCalledWith(activeCells, { + interactionName: 'rangeSelection', + targetCell: s2.getCell(), + }); 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 49d0664cda..d674efcfb3 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(); @@ -160,19 +181,13 @@ describe('Interaction Row Column Resize Tests', () => { s2.hideTooltip = jest.fn(); s2.interaction.reset = jest.fn(); s2.interaction.getActiveRowCells = () => [ - createMockCellInfo('test-row-cell').mockCell, + createMockCellInfo('test-row-cell-a').mockCell, + createMockCellInfo('test-row-cell-b').mockCell, ]; s2.interaction.getActiveColCells = () => [ - createMockCellInfo('test-col-cell').mockCell, + 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', () => { @@ -233,6 +248,7 @@ describe('Interaction Row Column Resize Tests', () => { isResizeArea: true, effect: ResizeAreaEffect.Cell, size: 3, + cell: mockCell, } as ResizeInfo; emitResizeEvent( @@ -284,6 +300,7 @@ describe('Interaction Row Column Resize Tests', () => { field: 'testField', id: 'testFieldId', } as ResizeInfo['meta'], + cell: mockCell, }; emitResizeEvent( @@ -359,6 +376,7 @@ describe('Interaction Row Column Resize Tests', () => { isResizeArea: true, effect: ResizeAreaEffect.Cell, size: 3, + cell: mockCell, } as ResizeInfo; emitResizeEvent( @@ -390,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); @@ -408,6 +436,7 @@ describe('Interaction Row Column Resize Tests', () => { meta: { field: 'testField', } as Node, + cell: mockCell, }; emitResizeEvent( @@ -440,6 +469,9 @@ describe('Interaction Row Column Resize Tests', () => { heightByField: { [resizeInfo.meta.field!]: 2, }, + maxLinesByField: { + [resizeInfo.meta.field!]: 1, + }, }, }, }; @@ -582,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') @@ -602,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', () => { @@ -710,6 +754,7 @@ describe('Interaction Row Column Resize Tests', () => { resizedHeight: 0, resizedWidth: 0, size: 3, + cell: mockCell, } as ResizeInfo; emitResizeEvent( @@ -823,6 +868,13 @@ describe('Interaction Row Column Resize Tests', () => { }, }); + jest + .spyOn(s2.interaction, 'getActiveColCells') + .mockImplementationOnce(() => createCells()); + jest + .spyOn(s2.interaction, 'isSelectedState') + .mockImplementationOnce(() => true); + emitResize(ResizeDirectionType.Horizontal, ResizeAreaEffect.Cell); expect(s2.options.style!.colCell).toMatchSnapshot(); @@ -839,6 +891,13 @@ describe('Interaction Row Column Resize Tests', () => { }, }); + jest + .spyOn(s2.interaction, 'getActiveRowCells') + .mockImplementationOnce(() => createCells()); + jest + .spyOn(s2.interaction, 'isSelectedState') + .mockImplementationOnce(() => true); + emitResize(ResizeDirectionType.Vertical, ResizeAreaEffect.Cell); expect(s2.options.style!.rowCell).toMatchSnapshot(); @@ -848,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); @@ -874,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); @@ -895,4 +948,25 @@ describe('Interaction Row Column Resize Tests', () => { expect(s2.options.style!.colCell).toMatchSnapshot(); }); + + // https://github.com/antvis/S2/issues/2910 + test('should not effect default resize style by field for selected resize type', () => { + s2.setOptions({ + style: { + colCell: { + width: 50, + }, + }, + interaction: { + resize: { + rowResizeType: ResizeType.CURRENT, + colResizeType: ResizeType.CURRENT, + }, + }, + }); + + emitResize(ResizeDirectionType.Horizontal, ResizeAreaEffect.Cell); + + expect(s2.options.style!.colCell).toMatchSnapshot(); + }); }); 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 96% 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 index 92dae3708f..2348751b3c 100644 --- 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 @@ -11,7 +11,7 @@ Object { "headerActionIcons": Array [ Object { "belongsCell": "rowCell", - "defaultHide": false, + "defaultHide": true, "displayCondition": [Function], "icons": Array [ Object { 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 5160acf6c8..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,7 +629,11 @@ describe('PivotSheet Tests', () => { }); test('should get content height', () => { - expect(s2.getContentHeight()).toEqual(120); + expect(s2.facet.getContentHeight()).toEqual(122); + }); + + test('should get content width', () => { + expect(s2.facet.getContentWidth()).toEqual(386); }); test('should get layout width type', () => { @@ -769,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); @@ -777,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 75e2e1b7ec..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,11 @@ describe('TableSheet Tests', () => { }); test('should get content height', () => { - expect(s2.getContentHeight()).toEqual(120); + expect(s2.facet.getContentHeight()).toEqual(122); + }); + + test('should get content width', () => { + expect(s2.facet.getContentWidth()).toEqual(480); }); test('get sheetInstance from canvas', () => { 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..ea7481eb04 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": "", @@ -13,8 +14,10 @@ Object { "getFieldValue": [MockFunction], "getMeta": [Function], "getStyle": [MockFunction], + "getTextLineHeight": [MockFunction], "hideInteractionShape": [MockFunction], "id": "test-a", + "isLeaf": false, "isTextOverflowing": [MockFunction], "level": 0, "parentNode": [Circular], @@ -42,11 +45,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..ca1afcb811 100644 --- a/packages/s2-core/__tests__/unit/utils/sort-action-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/sort-action-spec.ts @@ -772,7 +772,7 @@ describe('GetSortByMeasureValues Total Fallback Tests', () => { describe('total group dimension sort test', () => { let sheet: SpreadSheet; - beforeEach(() => { + beforeEach(async () => { const currentOptions = { totals: { col: { @@ -805,12 +805,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/tooltip-spec.ts b/packages/s2-core/__tests__/unit/utils/tooltip-spec.ts index 2503d8ebc6..062823c0e5 100644 --- a/packages/s2-core/__tests__/unit/utils/tooltip-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/tooltip-spec.ts @@ -636,6 +636,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 +972,7 @@ describe('Tooltip Utils Tests', () => { }); describe('Tooltip Get Data Tests For TableSheet', () => { - beforeEach(() => { + beforeEach(async () => { s2 = createTableSheet( { seriesNumber: { @@ -957,7 +981,7 @@ describe('Tooltip Utils Tests', () => { }, { useSimpleData: false }, ); - s2.render(); + await s2.render(); }); afterEach(() => { diff --git a/packages/s2-core/__tests__/util/helpers.ts b/packages/s2-core/__tests__/util/helpers.ts index ee4d3591db..b66bb26d5b 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, @@ -231,6 +232,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 +258,8 @@ export const createMockCellInfo = ( level = 0, cornerType = '', cellType = undefined, + children = [], + isLeaf = false, }: Partial = {}, ) => { const mockCellViewMeta: Partial = { @@ -265,10 +269,12 @@ export const createMockCellInfo = ( rowIndex, colId, level, - type: undefined, + type: cellType, cornerType, x: 0, y: 0, + children, + isLeaf, spreadsheet: { dataCfg: { meta: null, @@ -296,6 +302,8 @@ export const createMockCellInfo = ( 'colId', 'field', 'cornerType', + 'children', + 'isLeaf', ]); const mockCell = { ...mockCellViewMeta, @@ -305,10 +313,20 @@ 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), } 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 8884137d8d..b25c4b45e7 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.27", + "version": "2.0.0-next.33", "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,20 +52,18 @@ "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": "jest --passWithNoTests", "test:ci": "pnpm test -- --maxWorkers=3", "test:ci-coverage": "pnpm test:coverage --maxWorkers=3", "test:coverage": "pnpm test -- --coverage", @@ -65,9 +74,9 @@ }, "dependencies": { "@antv/event-emitter": "^0.1.3", - "@antv/g": "^6.0.12", - "@antv/g-canvas": "^2.0.10", - "@antv/g-lite": "^2.0.8", + "@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..4fd868cdc3 100644 --- a/packages/s2-core/rollup.config.mjs +++ b/packages/s2-core/rollup.config.mjs @@ -27,13 +27,13 @@ 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', @@ -52,6 +52,10 @@ const plugins = [ tsconfigOverride: { outDir, include: ['src', '../../global.d.ts'], + compilerOptions: { + declaration: false, + useDefineForClassFields: false, + }, }, }), postcss({ @@ -62,7 +66,7 @@ const plugins = [ stylus: null, less: { javascriptEnabled: true }, }, - extract: `style${isUmdFormat ? '.min' : ''}.css`, + extract: `s2${isUmdFormat ? '.min' : ''}.css`, }), /** 主题变量 less 不需要 extract&inject */ postcss({ @@ -82,15 +86,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..7749941daf 100644 --- a/packages/s2-core/src/cell/base-cell.ts +++ b/packages/s2-core/src/cell/base-cell.ts @@ -141,7 +141,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 +189,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 +301,13 @@ export abstract class BaseCell extends Group { return this.textShape?.getLineBoundingRects() || []; } + /** + * 获取文本包围盒 + */ + public getTextLineHeight() { + return this.textShape?.parsedStyle?.metrics?.lineHeight; + } + /** * 获取单元格空值占位符 */ @@ -477,6 +486,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 +495,7 @@ export abstract class BaseCell extends Group { y: 0, text: this.getFieldValue()!, wordWrapWidth: maxTextWidth, + maxLines, }); if (this.isShallowRender()) { diff --git a/packages/s2-core/src/cell/col-cell.ts b/packages/s2-core/src/cell/col-cell.ts index 58bc79dca4..16e4f09f48 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,13 @@ export class ColCell extends HeaderCell { return isNextSiblingNodeHidden && isPrevSiblingNodeHidden; } + + protected getResizedTextMaxLines() { + const { colCell } = this.spreadsheet.options.style!; + + return ( + colCell?.maxLinesByField?.[this.meta.id] ?? + colCell?.maxLinesByField?.[this.meta.field] + ); + } } diff --git a/packages/s2-core/src/cell/corner-cell.ts b/packages/s2-core/src/cell/corner-cell.ts index 240be80c55..bfc193d61c 100644 --- a/packages/s2-core/src/cell/corner-cell.ts +++ b/packages/s2-core/src/cell/corner-cell.ts @@ -181,6 +181,7 @@ export class CornerCell extends HeaderCell { width, height, meta: this.meta, + cell: this, }); resizeArea.appendChild( @@ -209,7 +210,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 +272,14 @@ 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] + ); + } } diff --git a/packages/s2-core/src/cell/data-cell.ts b/packages/s2-core/src/cell/data-cell.ts index 1d17bc9fa8..7db9a1fcae 100644 --- a/packages/s2-core/src/cell/data-cell.ts +++ b/packages/s2-core/src/cell/data-cell.ts @@ -1,17 +1,6 @@ import type { PointLike } from '@antv/g'; -import { - find, - findLast, - 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 { EMPTY_PLACEHOLDER } from '../common/constant/basic'; import { CellType, @@ -19,7 +8,6 @@ import { SHAPE_STYLE_MAP, } from '../common/constant/interaction'; import type { - BaseChartData, CellMeta, Condition, ConditionMappingResult, @@ -27,8 +15,6 @@ import type { HeaderActionNameOptions, IconCondition, InteractionStateTheme, - MiniChartData, - MultiData, TextTheme, ValueRange, ViewMeta, @@ -48,7 +34,10 @@ import { updateBySelectedCellsHighlight, } from '../utils/cell/data-cell'; import { groupIconsByPosition } from '../utils/cell/header-cell'; -import { getIconPosition } from '../utils/condition/condition'; +import { + findFieldCondition, + getIconPosition, +} from '../utils/condition/condition'; import { drawInterval } from '../utils/g-mini-charts'; import { updateShapeAttr } from '../utils/g-renders'; import type { RawData } from './../common/interface/s2DataConfig'; @@ -89,33 +78,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]; } @@ -491,14 +453,10 @@ export class DataCell extends BaseCell { * Find current field related condition * @param conditions */ - public findFieldCondition( - conditions: Con[] = [], - ): Con | undefined { - return findLast(conditions, (item) => - item.field instanceof RegExp - ? item.field.test(this.meta.valueField) - : item.field === this.meta.valueField, - ); + public findFieldCondition( + conditions: T[] = [], + ): T | undefined { + return findFieldCondition(conditions, this.meta.valueField); } /** @@ -516,7 +474,7 @@ export class DataCell extends BaseCell { }) : CellData.getFieldValue(this.meta.data as ViewMetaData); - return condition.mapping(value, rowDataInfo as RawData, this); + return condition.mapping?.(value, rowDataInfo as RawData, this); } public updateByState(stateName: `${InteractionStateName}`) { @@ -550,4 +508,14 @@ 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!] + ); + } } diff --git a/packages/s2-core/src/cell/header-cell.ts b/packages/s2-core/src/cell/header-cell.ts index ffe4864ff7..553d543048 100644 --- a/packages/s2-core/src/cell/header-cell.ts +++ b/packages/s2-core/src/cell/header-cell.ts @@ -5,7 +5,6 @@ import type { } from '@antv/g'; import { find, - findLast, first, forEach, get, @@ -42,6 +41,7 @@ import { getActionIconConfig, groupIconsByPosition, } from '../utils/cell/header-cell'; +import { findFieldCondition } from '../utils/condition/condition'; import { renderIcon } from '../utils/g-renders'; import { getSortTypeIcon } from '../utils/sort-action'; @@ -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; @@ -499,17 +503,13 @@ export abstract class HeaderCell< ): ConditionMappingResult { const value = this.getMeta().value; - return condition.mapping(value, this.meta, this); + return condition.mapping?.(value, this.meta, this); } - public findFieldCondition( - conditions: Con[] = [], - ): Con | undefined { - return findLast(conditions, (item) => - item.field instanceof RegExp - ? item.field.test(this.meta.field) - : item.field === this.meta.field, - ); + public findFieldCondition( + conditions: T[] = [], + ): T | undefined { + return findFieldCondition(conditions, this.meta.field); } public getTreeIcon() { 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..03840d442b 100644 --- a/packages/s2-core/src/cell/row-cell.ts +++ b/packages/s2-core/src/cell/row-cell.ts @@ -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( @@ -485,4 +491,13 @@ 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] + ); + } } 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..3ad235f2bc 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( diff --git a/packages/s2-core/src/common/constant/basic.ts b/packages/s2-core/src/common/constant/basic.ts index 39ba5bbadc..655ea65ee6 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'; /** 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..d68512f8fd 100644 --- a/packages/s2-core/src/common/constant/options.ts +++ b/packages/s2-core/src/common/constant/options.ts @@ -43,14 +43,10 @@ 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, }, dataCell: { ...DEFAULT_CELL_TEXT_WORD_WRAP_STYLE, 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..12d307d31d 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, @@ -39,3 +38,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/condition.ts b/packages/s2-core/src/common/interface/condition.ts index 4b665f336e..287e7f2abb 100644 --- a/packages/s2-core/src/common/interface/condition.ts +++ b/packages/s2-core/src/common/interface/condition.ts @@ -1,4 +1,4 @@ -import type { DataCell, HeaderCell } from '../../cell'; +import type { S2CellType } from './interaction'; import type { RawData } from './s2DataConfig'; import type { TextTheme } from './theme'; @@ -40,7 +40,7 @@ export type ConditionMappingResult = T | undefined | null; export type ConditionMapping = ( fieldValue: number | string, data: RawData, - cell?: DataCell | HeaderCell, + cell: S2CellType, ) => ConditionMappingResult; /** diff --git a/packages/s2-core/src/common/interface/emitter.ts b/packages/s2-core/src/common/interface/emitter.ts index d6de4733d6..219ac0226d 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,24 @@ 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; +} + +export type CellSelectedHandler = ( + cells: S2CellType[], + detail: CellSelectedDetail, +) => void; + export interface EmitterType { /** ================ Global ================ */ [S2Event.GLOBAL_ACTION_ICON_CLICK]: CanvasEventHandler; @@ -58,7 +73,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 +102,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 +121,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 +138,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 +149,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..2b35e86dd9 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,6 +106,11 @@ export interface ChangeCellOptions extends CellScrollToOptions { */ stateName?: `${InteractionStateName}`; + /** + * 交互名 + */ + interactionName?: `${InteractionName}`; + /** * 如果单元格不在可视范围, 是否自动滚动 * @default true 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/s2DataConfig.ts b/packages/s2-core/src/common/interface/s2DataConfig.ts index 8822fc8769..83791c7f91 100644 --- a/packages/s2-core/src/common/interface/s2DataConfig.ts +++ b/packages/s2-core/src/common/interface/s2DataConfig.ts @@ -92,6 +92,7 @@ export interface CustomTreeNode { title?: string; /** * 是否收起(默认都展开) + * @description 优先级 `collapseFields` > `expandDepth` > `collapseAll` > `collapsed` */ collapsed?: boolean; /** 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 da2b8f6410..5bfae42052 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 { /** @@ -82,19 +87,21 @@ export interface RowCellStyle extends BaseCellStyle, CellTextWordWrapStyle { /** * 收起所有 (对应角头收起展开按钮) + * @description 优先级 `collapseFields` > `expandDepth` > `collapseAll` */ collapseAll?: boolean | null; /** * 折叠节点 - * 优先级大于 collapseAll 和 expandDepth * id 级别: { ['root[&]浙江省']: true, ['root[&]河南省']: false } 即 只有 浙江省 对应的节点才会被折叠 * field 级别: { city: true, type: false } : 即 所有 city 对应的维值都会被折叠 + * @description 优先级 `collapseFields` > `expandDepth` > `collapseAll` */ collapseFields?: Record | null; /** - * 行头默认展开到第几层 (从 0 开始) + * 行头节点默认展开到第几层 (从 0 开始) + * @description 优先级 `collapseFields` > `expandDepth` > `collapseAll` */ expandDepth?: number | null; } 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..ae29e5e356 100644 --- a/packages/s2-core/src/data-set/base-data-set.ts +++ b/packages/s2-core/src/data-set/base-data-set.ts @@ -292,6 +292,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 7730fe5ce0..df23062ccc 100644 --- a/packages/s2-core/src/facet/base-facet.ts +++ b/packages/s2-core/src/facet/base-facet.ts @@ -15,6 +15,8 @@ import { filter, find, get, + includes, + isArray, isEmpty, isFunction, isNil, @@ -40,6 +42,7 @@ import { BACK_GROUND_GROUP_CONTAINER_Z_INDEX, CellType, DEFAULT_STYLE, + EXTRA_FIELD, FRONT_GROUND_GROUP_CONTAINER_Z_INDEX, InterceptType, KEY_GROUP_BACK_GROUND, @@ -75,6 +78,7 @@ import type { S2CellType, ScrollChangeParams, ScrollOffsetConfig, + SimpleData, ViewMeta, } from '../common/interface'; import type { @@ -85,6 +89,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'; @@ -207,6 +212,10 @@ export abstract class BaseFacet { colIndex: number, ): ViewMeta | null; + public abstract getContentWidth(): number; + + public abstract getContentHeight(): number; + protected scrollFrameId: ReturnType | null = null; @@ -254,7 +263,7 @@ export abstract class BaseFacet { this.initForegroundGroup(); } - private initForegroundGroup() { + protected initForegroundGroup() { this.foregroundGroup = this.spreadsheet.container.appendChild( new Group({ name: KEY_GROUP_FORE_GROUND, @@ -263,7 +272,7 @@ export abstract class BaseFacet { ); } - private initBackgroundGroup() { + protected initBackgroundGroup() { this.backgroundGroup = this.spreadsheet.container.appendChild( new Group({ name: KEY_GROUP_BACK_GROUND, @@ -287,8 +296,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 { @@ -337,17 +346,23 @@ export abstract class BaseFacet { protected getColCellDraggedWidth(node: Node): number | undefined { const { colCell } = this.spreadsheet.options.style!; + // 指标的 field 是 $$extra$$, 对用户来说其实是 s2DataConfig.fields.values 里面的 field + // 此时应该按 $$extra$$ 对应的 value field 匹配 return ( - colCell?.widthByField?.[node?.id] ?? colCell?.widthByField?.[node?.field] + colCell?.widthByField?.[node?.id] ?? + colCell?.widthByField?.[node?.field] ?? + colCell?.widthByField?.[node?.query?.[EXTRA_FIELD]] ); } protected getColCellDraggedHeight(node: Node): number | undefined { const { colCell } = this.spreadsheet.options.style!; + // 高度同理 return ( colCell?.heightByField?.[node?.id] ?? - colCell?.heightByField?.[node?.field] + colCell?.heightByField?.[node?.field] ?? + colCell?.heightByField?.[node?.query?.[EXTRA_FIELD]] ); } @@ -444,6 +459,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 @@ -496,6 +512,7 @@ export abstract class BaseFacet { colsHierarchy.height += levelSampleNode.height; }); + colsHierarchy.rootNode.height = colsHierarchy.height; } hideScrollBar = () => { @@ -637,12 +654,6 @@ export abstract class BaseFacet { }; } - public getContentHeight(): number { - const { rowsHierarchy, colsHierarchy } = this.layoutResult; - - return rowsHierarchy.height + colsHierarchy.height; - } - /** * @alias s2.interaction.scrollTo(offsetConfig) */ @@ -752,7 +763,7 @@ export abstract class BaseFacet { } }; - private unbindEvents = () => { + protected unbindEvents = () => { const canvas = this.spreadsheet.getCanvasElement(); canvas?.removeEventListener('wheel', this.onWheel); @@ -789,9 +800,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; @@ -917,7 +928,7 @@ export abstract class BaseFacet { this.dynamicRenderCell(skipScrollEvent); }; - private getRendererHeight = () => { + protected getRendererHeight = () => { const { start, end } = this.getCellRange(); return ( @@ -926,7 +937,7 @@ export abstract class BaseFacet { ); }; - private getAdjustedScrollOffset = ({ + protected getAdjustedScrollOffset = ({ scrollX, scrollY, rowHeaderScrollX, @@ -949,7 +960,7 @@ export abstract class BaseFacet { }; }; - private renderRowScrollBar = (rowHeaderScrollX: number) => { + protected renderRowScrollBar(rowHeaderScrollX: number) { if ( this.spreadsheet.isFrozenRowHeader() && this.cornerBBox.width < this.cornerBBox.originalWidth @@ -1021,12 +1032,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(); @@ -1085,7 +1097,7 @@ export abstract class BaseFacet { this.foregroundGroup.appendChild(this.hScrollBar); } - }; + } protected getScrollbarPosition() { const { maxX, maxY } = this.panelBBox; @@ -1100,7 +1112,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( @@ -1142,7 +1154,7 @@ export abstract class BaseFacet { this.foregroundGroup.appendChild(this.vScrollBar); } - }; + } // (滑动 offset / 最大 offset(滚动对象真正长度 - 轨道长)) = (滑块 offset / 最大滑动距离(轨道长 - 滑块长)) getScrollBarOffset = (offset: number, scrollbar: ScrollBar) => { @@ -1304,7 +1316,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') { @@ -1313,12 +1325,12 @@ export abstract class BaseFacet { } }; - private stopScrollChaining = (event: WheelEvent) => { + protected stopScrollChaining = (event: WheelEvent) => { if (event?.cancelable) { event?.preventDefault?.(); } - // 移动端的 prevent 存在于 originalEvent上 + // 移动端的 prevent 存在于 originalEvent 上 const mobileEvent = (event as unknown as GraphEvent)?.originalEvent; if (mobileEvent?.cancelable) { @@ -1772,7 +1784,7 @@ export abstract class BaseFacet { this.onAfterScroll(); } - private emitScrollEvent(position: CellScrollPosition) { + protected emitScrollEvent(position: CellScrollPosition) { this.spreadsheet.emit(S2Event.GLOBAL_SCROLL, position); } @@ -2216,6 +2228,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); + }); + } + /** * 获取序号单元格 (不含可视区域) */ @@ -2228,7 +2265,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(), @@ -2236,11 +2275,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); } /** @@ -2284,4 +2319,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..e68fc1cfbf 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,7 +672,7 @@ export abstract class FrozenFacet extends BaseFacet { ); } } - }; + } public render() { this.calculateFrozenGroupInfo(); 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..b58dd2f708 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); } @@ -259,18 +261,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 3389b2a95d..53ad65bda7 100644 --- a/packages/s2-core/src/facet/header/frame.ts +++ b/packages/s2-core/src/facet/header/frame.ts @@ -20,11 +20,11 @@ export class Frame extends Group { } public layout() { - // corner底部的横线条 + // corner 底部的横线条 this.addCornerBottomBorder(); - // corner右边的竖线条 + // corner 右边的竖线条 this.addCornerRightBorder(); - // 一级纵向分割线两侧的shadow + // 一级纵向分割线两侧的 shadow this.addSplitLineShadow(); } @@ -43,7 +43,6 @@ export class Frame extends Group { } public static getVerticalBorderWidth(spreadsheet: SpreadSheet): number { - // 交叉表一条竖线拉通即可 const { splitLine, cornerCell, colCell, dataCell } = spreadsheet.theme; if (spreadsheet.isPivotMode()) { @@ -88,71 +87,103 @@ 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 frameVerticalWidth = Frame.getVerticalBorderWidth(spreadsheet); - const x = position.x + cornerWidth + frameVerticalWidth! / 2; + const { horizontalBorderWidth } = spreadsheet.theme?.splitLine!; - if (spreadsheet.isPivotMode()) { - const y2 = - position.y + cornerHeight + horizontalBorderWidth! + viewportHeight; + const y = position.y; + const height = cornerHeight + horizontalBorderWidth! + viewportHeight; - this.cornerRightBorder = renderLine(this, { - x1: x, - y1: position.y, - x2: x, - y2, - stroke: verticalBorderColor, - lineWidth: frameVerticalWidth, - strokeOpacity: verticalBorderColorOpacity, - }); + return { y, height }; + } - return; - } + protected addCornerRightHeadBorder() { + const { cornerWidth, cornerHeight, position, spreadsheet } = this.cfg; + const { verticalBorderColor, verticalBorderColorOpacity } = + spreadsheet.theme?.splitLine!; + const frameVerticalWidth = Frame.getVerticalBorderWidth(spreadsheet); + const x = position.x + cornerWidth + frameVerticalWidth! / 2; - // 明细表需要区分头部的边框和明细格子的边框 + // 表头和表身的单元格背景色不同, 分割线不能一条线拉通, 不然视觉不协调. + // 分两条线绘制, 默认和分割线所在区域对应的单元格边框颜色保持一致 const { verticalBorderColor: headerVerticalBorderColor, verticalBorderColorOpacity: headerVerticalBorderColorOpacity, - } = spreadsheet.options.seriesNumber?.enable + 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: headerVerticalBorderColor, - lineWidth: frameVerticalWidth, - strokeOpacity: 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, + 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: cellVerticalBorderColor, - lineWidth: frameVerticalWidth, - strokeOpacity: 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, @@ -167,6 +198,15 @@ export class Frame extends Group { horizontalBorderWidth, horizontalBorderColorOpacity, } = spreadsheet.theme?.splitLine!; + + const { + horizontalBorderColor: headerHorizontalBorderColor, + horizontalBorderColorOpacity: headerHorizontalBorderColorOpacity, + } = + spreadsheet.options.seriesNumber?.enable || spreadsheet.isPivotMode() + ? spreadsheet.theme.cornerCell!.cell! + : spreadsheet.theme.colCell!.cell!; + const x1 = position.x; const x2 = x1 + @@ -181,13 +221,14 @@ export class Frame extends Group { y1: y, x2, y2: y, - stroke: horizontalBorderColor, + stroke: horizontalBorderColor || headerHorizontalBorderColor, lineWidth: horizontalBorderWidth, - opacity: horizontalBorderColorOpacity, + opacity: + horizontalBorderColorOpacity || headerHorizontalBorderColorOpacity, }); } - private addSplitLineShadow() { + protected addSplitLineShadow() { const cfg = this.cfg; const { spreadsheet } = cfg; const splitLine = spreadsheet.theme?.splitLine; @@ -200,12 +241,11 @@ export class Frame extends Group { return; } - // do render... this.addSplitLineLeftShadow(); this.addSplitLineRightShadow(); } - private addSplitLineLeftShadow() { + protected addSplitLineLeftShadow() { if (!this.cfg.showViewportLeftShadow) { return; } @@ -231,28 +271,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({ @@ -260,7 +293,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-row-custom-tree-hierarchy.ts b/packages/s2-core/src/facet/layout/build-row-custom-tree-hierarchy.ts index a64d209113..253f4ecc89 100644 --- a/packages/s2-core/src/facet/layout/build-row-custom-tree-hierarchy.ts +++ b/packages/s2-core/src/facet/layout/build-row-custom-tree-hierarchy.ts @@ -1,4 +1,4 @@ -import { isEmpty } from 'lodash'; +import { isEmpty, isNumber } from 'lodash'; import type { CustomTreeNode } from '../../common'; import { EXTRA_FIELD } from '../../common/constant'; import { generateId } from '../../utils/layout/generate-id'; @@ -24,7 +24,8 @@ export const buildCustomTreeHierarchy = (params: CustomTreeHeaderParams) => { spreadsheet, isRowHeader, } = params; - const { collapseFields, collapseAll } = spreadsheet.options.style?.rowCell!; + const { collapseFields, collapseAll, expandDepth } = + spreadsheet.options.style?.rowCell!; const hiddenColumnsDetail = spreadsheet.store.get('hiddenColumnsDetail') || []; @@ -48,10 +49,14 @@ export const buildCustomTreeHierarchy = (params: CustomTreeHeaderParams) => { const defaultCollapsed = collapsed ?? false; const isDefaultCollapsed = collapseFields?.[nodeId] ?? collapseFields?.[field]; - const isCollapsed = isDefaultCollapsed ?? (collapseAll || defaultCollapsed); + // 如果 level 大于 rowExpandDepth 或者没有配置层级展开配置时,返回 null,保证能正确降级到 collapseAll + const isLevelCollapsed = isNumber(expandDepth) ? level > expandDepth : null; + const isCollapsed = + isDefaultCollapsed ?? + isLevelCollapsed ?? + (collapseAll || defaultCollapsed); - // TODO: 平铺模式支持 折叠/展开 - // https://github.com/antvis/S2/issues/2019 + // TODO: 平铺模式支持 折叠/展开: https://github.com/antvis/S2/issues/2019 const isCollapsedNode = spreadsheet.isHierarchyTreeType() && isRowHeader && isCollapsed; const isLeaf = isEmpty(children); diff --git a/packages/s2-core/src/facet/layout/build-row-tree-hierarchy.ts b/packages/s2-core/src/facet/layout/build-row-tree-hierarchy.ts index 54e56c35d2..8595623d7a 100644 --- a/packages/s2-core/src/facet/layout/build-row-tree-hierarchy.ts +++ b/packages/s2-core/src/facet/layout/build-row-tree-hierarchy.ts @@ -103,7 +103,7 @@ export const buildRowTreeHierarchy = (params: TreeHeaderParams) => { */ const isDefaultCollapsed = collapseFields?.[nodeId] ?? collapseFields?.[currentField]; - // 如果 level 大于 rowExpandDepth或者没有配置层级展开配置时,返回 null,保证能正确降级到 collapseAll + // 如果 level 大于 rowExpandDepth 或者没有配置层级展开配置时,返回 null,保证能正确降级到 collapseAll const isLevelCollapsed = isNumber(expandDepth) ? level > expandDepth : null; const isCollapsed = isDefaultCollapsed ?? isLevelCollapsed ?? collapseAll; 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..4f4bd01592 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,6 +112,12 @@ export class Node { public shallowRender?: boolean; + /** 是否不绘制 col cell 水平 resize 热区 */ + public hideColCellHorizontalResize?: boolean; + + /** 是否不绘制 row cell 竖直 resize 热区 */ + public hideRowCellVerticalResize?: boolean; + public extra?: { description?: string; isCustomNode?: boolean; @@ -154,52 +126,8 @@ export class Node { [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 +201,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 +218,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 +300,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 495066ebb0..3a0f4bdace 100644 --- a/packages/s2-core/src/facet/pivot-facet.ts +++ b/packages/s2-core/src/facet/pivot-facet.ts @@ -31,17 +31,19 @@ import type { LayoutResult, SimpleData, } from '../common/interface'; +import type { Query } from '../data-set/interface'; import type { PivotDataSet } from '../data-set/pivot-data-set'; import { getValidFrozenOptionsForPivot, safeJsonParse } from '../utils'; import { getDataCellId } from '../utils/cell/data-cell'; import { getActionIconConfig } from '../utils/cell/header-cell'; +import { findFieldCondition } from '../utils/condition/condition'; import { getHeaderTotalStatus } from '../utils/dataset/pivot-data-set'; import { getIndexRangeWithOffsets } from '../utils/facet'; 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 } from './header'; import { buildHeaderHierarchy } from './layout/build-header-hierarchy'; import type { Hierarchy } from './layout/hierarchy'; import { layoutCoordinate } from './layout/layout-hooks'; @@ -81,7 +83,7 @@ export class PivotFacet extends FrozenFacet { }; } - private buildAllHeaderHierarchy() { + protected buildAllHeaderHierarchy() { const { leafNodes: rowLeafNodes, hierarchy: rowsHierarchy } = buildHeaderHierarchy({ isRowHeader: true, @@ -101,6 +103,30 @@ export class PivotFacet extends FrozenFacet { }; } + private getDataQueryInfo(rowQuery: Query, colQuery: Query) { + const { options, dataSet } = this.spreadsheet; + const hideMeasure = options.style?.colCell?.hideValue ?? false; + + /** + * 如果在非自定义目录情况下hide measure query中是没有度量信息的,所以需要自动补上 + * 存在一个场景的冲突,如果是多个度量,定位数据数据是无法知道哪一列代表什么 + * 因此默认只会去 第一个度量拼接query + */ + const measureInfo = hideMeasure + ? { + [EXTRA_FIELD]: dataSet.fields.values?.[0], + } + : {}; + + const dataQuery = merge({}, rowQuery, colQuery, measureInfo) as Query; + const valueField = dataQuery[EXTRA_FIELD]!; + + return { + dataQuery, + valueField, + }; + } + /** * 根据行列索引获取单元格元数据 */ @@ -120,27 +146,17 @@ export class PivotFacet extends FrozenFacet { row.isTotals || row.isTotalMeasure || col.isTotals || col.isTotalMeasure; const totalStatus = getHeaderTotalStatus(row, col); - const hideMeasure = options.style?.colCell?.hideValue ?? false; - - /* - * 如果在非自定义目录情况下hide measure query中是没有度量信息的,所以需要自动补上 - * 存在一个场景的冲突,如果是多个度量,定位数据数据是无法知道哪一列代表什么 - * 因此默认只会去 第一个度量拼接query - */ - const measureInfo = hideMeasure - ? { - [EXTRA_FIELD]: dataSet.fields.values?.[0], - } - : {}; - const dataQuery = merge({}, rowQuery, colQuery, measureInfo); - const data = dataSet.getCellData({ + const { dataQuery, valueField } = this.getDataQueryInfo( + rowQuery!, + colQuery!, + ); + const data = (dataSet as PivotDataSet).getCellData({ query: dataQuery, rowNode: row, isTotals, totalStatus, }); - const valueField = dataQuery[EXTRA_FIELD]!; const fieldValue = get(data, VALUE_FIELD, null); const cellMeta: ViewMeta = { @@ -169,7 +185,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 @@ -177,12 +193,12 @@ 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) { + protected calculateColNodesCoordinate(layoutResult: LayoutResult) { const { colLeafNodes, colsHierarchy } = layoutResult; // 1. 计算叶子节点宽度 @@ -206,7 +222,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, @@ -221,7 +237,7 @@ export class PivotFacet extends FrozenFacet { } } - private calculateColLeafNodesWidth(layoutResult: LayoutResult) { + protected calculateColLeafNodesWidth(layoutResult: LayoutResult) { const { rowLeafNodes, colLeafNodes, rowsHierarchy, colsHierarchy } = layoutResult; let preLeafNode = Node.blankNode(); @@ -229,7 +245,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, @@ -242,7 +258,7 @@ export class PivotFacet extends FrozenFacet { }); } - private calculateColNodesHeight(colsHierarchy: Hierarchy) { + protected calculateColNodesHeight(colsHierarchy: Hierarchy) { const colNodes = colsHierarchy.getNodes(); colNodes.forEach((currentNode) => { @@ -254,7 +270,7 @@ 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 @@ -276,7 +292,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, @@ -297,7 +313,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)) { @@ -310,7 +326,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; @@ -355,7 +371,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; @@ -372,7 +388,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'); @@ -384,7 +400,7 @@ export class PivotFacet extends FrozenFacet { } } - private getColLeafNodesWidth( + protected getColLeafNodesWidth( colNode: Node, colLeafNodes: Node[], rowLeafNodes: Node[], @@ -420,10 +436,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,7 +468,7 @@ export class PivotFacet extends FrozenFacet { * @param iconStyle 图标样式 * @returns 宽度 */ - private getExpectedCellIconWidth( + protected getExpectedCellIconWidth( cellType: CellType, useDefaultIcon: boolean, iconStyle: IconTheme, @@ -479,7 +495,7 @@ export class PivotFacet extends FrozenFacet { cellType, ); - iconCount = customIcons?.icons.length ?? 0; + iconCount = customIcons?.icons.length || 0; } // calc width @@ -489,7 +505,7 @@ export class PivotFacet extends FrozenFacet { : 0; } - private calculateRowNodesAllLevelSampleNodes(layoutResult: LayoutResult) { + protected calculateRowNodesAllLevelSampleNodes(layoutResult: LayoutResult) { const { rowsHierarchy, colLeafNodes } = layoutResult; const isTree = this.spreadsheet.isHierarchyTreeType(); @@ -512,16 +528,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); @@ -538,21 +577,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; @@ -570,7 +599,7 @@ export class PivotFacet extends FrozenFacet { }); } - private calculateRowNodesCoordinate(layoutResult: LayoutResult) { + protected calculateRowNodesCoordinate(layoutResult: LayoutResult) { const { rowsHierarchy, rowLeafNodes } = layoutResult; const isTree = this.spreadsheet.isHierarchyTreeType(); @@ -593,7 +622,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, @@ -612,7 +641,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; @@ -635,10 +664,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); @@ -663,10 +690,9 @@ export class PivotFacet extends FrozenFacet { } /** - * 计算树状模式等宽条件下的列宽 - * @returns number + * 计算树状模式等宽条件下的列宽 */ - private getAdaptTreeColWidth( + protected getAdaptTreeColWidth( col: Node, colLeafNodes: Node[], rowLeafNodes: Node[], @@ -691,7 +717,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); @@ -743,7 +769,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; @@ -768,11 +799,9 @@ 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. 用户拖拽或手动指定的行头宽度优先级最高 const customRowCellWidth = this.getCellCustomSize(null, rowCell?.width!); @@ -782,9 +811,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!; @@ -794,13 +821,12 @@ 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, @@ -818,11 +844,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, @@ -853,7 +876,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! + @@ -867,7 +890,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!; @@ -881,13 +904,14 @@ 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, icon: colIconStyle, } = this.spreadsheet.theme.colCell!; - const { text: dataCellTextStyle } = this.spreadsheet.theme.dataCell; + const { text: dataCellTextStyle, icon: dataCellIconStyle } = + this.spreadsheet.theme.dataCell; // leaf node width const cellFormatter = this.spreadsheet.dataSet.getFieldFormatter( @@ -901,12 +925,12 @@ export class PivotFacet extends FrozenFacet { colIconStyle!, ); const leafNodeWidth = - this.spreadsheet.measureTextWidth(leafNodeLabel, colCellTextStyle) + - colIconWidth; + this.measureTextWidth(leafNodeLabel, colCellTextStyle) + colIconWidth; // 采样 50 个 label,逐个计算找出最长的 label let maxDataLabel = ''; let maxDataLabelWidth = 0; + let iconWidthOfMaxDataLabel = 0; for (let index = 0; index < LAYOUT_SAMPLE_COUNT; index++) { const rowNode = rowLeafNodes[index]; @@ -932,7 +956,21 @@ export class PivotFacet extends FrozenFacet { valueData, ) ?? valueData; const cellLabel = formattedValue; - const cellLabelWidth = this.spreadsheet.measureTextWidth( + // 考虑字段标记 icon 的宽度: https://github.com/antvis/S2/pull/2673 + const { valueField } = this.getDataQueryInfo( + rowNode.query!, + colNode.query!, + ); + const hasIcon = findFieldCondition( + this.spreadsheet.options.conditions?.icon, + valueField!, + ); + const dataCellIconWidth = hasIcon + ? dataCellIconStyle?.size + + dataCellIconStyle?.margin?.left + + dataCellIconStyle?.margin?.right + : 0; + const cellLabelWidth = this.measureTextWidth( cellLabel as string, dataCellTextStyle, ); @@ -940,25 +978,28 @@ export class PivotFacet extends FrozenFacet { if (cellLabelWidth > maxDataLabelWidth) { maxDataLabel = cellLabel as string; maxDataLabelWidth = cellLabelWidth; + iconWidthOfMaxDataLabel = dataCellIconWidth; } } } } - // compare result const isLeafNodeWidthLonger = leafNodeWidth > maxDataLabelWidth; const maxLabel = isLeafNodeWidthLonger ? leafNodeLabel : maxDataLabel; - const appendedWidth = isLeafNodeWidthLonger ? colIconWidth : 0; + const appendedWidth = isLeafNodeWidthLonger + ? colIconWidth + : iconWidthOfMaxDataLabel; DebuggerUtil.getInstance().logger( 'Max Label In Col:', colNode.field, maxLabel, maxDataLabelWidth, + iconWidthOfMaxDataLabel, ); - // 取列头/数值字体最大的文本宽度 https://github.com/antvis/S2/issues/2385 - const maxTextWidth = this.spreadsheet.measureTextWidth(maxLabel, { + // 取列头/数值字体最大的文本宽度: https://github.com/antvis/S2/issues/2385 + const maxTextWidth = this.measureTextWidth(maxLabel, { ...colCellTextStyle, fontSize: Math.max(dataCellTextStyle.fontSize, colCellTextStyle.fontSize), }); @@ -1018,4 +1059,24 @@ export class PivotFacet extends FrozenFacet { return this.validFrozenOptions; } + + public getContentWidth(): number { + const { rowsHierarchy, colsHierarchy } = this.layoutResult; + + return ( + rowsHierarchy.width + + colsHierarchy.width + + Frame.getVerticalBorderWidth(this.spreadsheet) + ); + } + + public getContentHeight(): number { + const { rowsHierarchy, colsHierarchy } = this.layoutResult; + + 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 26c107bb8c..d62c326d5a 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, @@ -116,7 +117,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; @@ -376,7 +377,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 +398,7 @@ export class TableFacet extends FrozenFacet { height: cellHeight, data: { [colNode.field]: data, - } as unknown as SimpleData, + } as unknown as Data, rowIndex, colIndex, isTotals: false, @@ -439,13 +440,6 @@ export class TableFacet extends FrozenFacet { return dataCell?.width ?? 0; } - public getContentHeight(): number { - const { getTotalHeight } = this.getViewCellHeights(); - const { colsHierarchy } = this.layoutResult; - - return getTotalHeight() + colsHierarchy.height; - } - private calculateColLeafNodesWidth( colLeafNodes: Node[], colsHierarchy: Hierarchy, @@ -477,7 +471,7 @@ export class TableFacet extends FrozenFacet { currentNode.y = 0; } else { currentNode.y = - currentNode?.parent?.y! + currentNode?.parent?.height! ?? 0; + currentNode?.parent?.y! + currentNode?.parent?.height! || 0; } currentNode.height = this.getColNodeHeight( @@ -492,10 +486,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, @@ -528,14 +523,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. 拖拽后的宽度优先级最高 @@ -550,60 +580,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() { @@ -620,7 +608,6 @@ export class TableFacet extends FrozenFacet { this.spreadsheet.dataSet.getDisplayDataSet().length ); }, - getCellOffsetY: (offset: number) => { if (offset <= 0) { return 0; @@ -632,9 +619,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( @@ -739,4 +724,21 @@ export class TableFacet extends FrozenFacet { return cell.getMeta().valueField === SERIES_NUMBER_FIELD; }) as TableSeriesNumberCell[]; } + + public getContentWidth(): number { + const { colsHierarchy } = this.layoutResult; + + return colsHierarchy.width; + } + + public getContentHeight(): number { + const { getTotalHeight } = this.getViewCellHeights(); + const { colsHierarchy } = this.layoutResult; + + 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..7e0d2fcf6e 100644 --- a/packages/s2-core/src/interaction/base-event.ts +++ b/packages/s2-core/src/interaction/base-event.ts @@ -2,7 +2,7 @@ import type { FederatedPointerEvent as CanvasEvent, DisplayObject, } from '@antv/g'; -import type { CellAppendInfo } from '../common'; +import { type CellAppendInfo } from '../common'; import type { SpreadSheet } from '../sheet-type'; import { getAppendInfo } from '../utils/interaction/common'; 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..bfefa750ae 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,13 @@ export class CornerCellClick extends BaseEvent implements BaseEventImplement { }); } + private emitSelectEvent(targetCell: S2CellType) { + this.spreadsheet.interaction.emitSelectEvent({ + targetCell, + interactionName: InteractionName.CORNER_CELL_CLICK, + }); + } + private selectCells(nodes: Node[], event: CanvasEvent) { const { interaction } = this.spreadsheet; const sample = nodes[0]?.belongsCell; @@ -121,10 +130,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(cornerCell); return; } @@ -142,10 +148,7 @@ export class CornerCellClick extends BaseEvent implements BaseEventImplement { cornerCell?.updateByState(InteractionStateName.SELECTED); this.showTooltip(event); - this.spreadsheet.emit( - S2Event.GLOBAL_SELECTED, - interaction.getActiveCells(), - ); + this.emitSelectEvent(cornerCell); } private showTooltip(event: CanvasEvent) { 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 6fb67cea23..0615e9839f 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,6 +1,7 @@ import type { FederatedPointerEvent as CanvasEvent } from '@antv/g'; import type { DataCell } from '../../../cell/data-cell'; import { + InteractionName, InteractionStateName, InterceptType, S2Event, @@ -55,14 +56,18 @@ export class DataCellClick extends BaseEvent implements BaseEventImplement { if (interaction.isSelectedCell(cell)) { // https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail,使用 detail 属性来判断是否是双击,双击时不触发选择态 reset - if ((event.originalEvent as UIEvent)?.detail === 1) { + if ( + event.detail === 1 || + event.nativeEvent?.detail === 1 || + event.originalEvent?.detail === 1 + ) { interaction.reset(); // https://github.com/antvis/S2/issues/2447 - this.spreadsheet.emit( - S2Event.GLOBAL_SELECTED, - interaction.getActiveCells(), - ); + interaction.emitSelectEvent({ + targetCell: cell, + interactionName: InteractionName.DATA_CELL_CLICK, + }); } return; @@ -73,7 +78,11 @@ export class DataCellClick extends BaseEvent implements BaseEventImplement { stateName: InteractionStateName.SELECTED, onUpdateCells: afterSelectDataCells, }); - this.spreadsheet.emit(S2Event.GLOBAL_SELECTED, [cell]); + interaction.emitSelectEvent({ + targetCell: cell, + interactionName: InteractionName.DATA_CELL_CLICK, + cells: [cell], + }); this.showTooltip(event, meta); // 点击单元格,高亮对应的行头、列头 @@ -81,6 +90,7 @@ export class DataCellClick extends BaseEvent implements BaseEventImplement { InteractionStateName.SELECTED, meta, ); + 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..51487aef9e 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, @@ -33,7 +34,7 @@ import { 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 +50,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 +61,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 +69,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 +78,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 +107,22 @@ 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({ cell, isMultiSelection, + interactionName: isMultiSelection + ? multiSelectionName + : defaultSelectionName, // 能主动触发点击一定是在可视范围内, 无需额外触发滚动 scrollIntoView: false, }); @@ -119,7 +132,7 @@ export class RowColumnClick extends BaseEvent implements BaseEventImplement { } }; - private showTooltip(event: CanvasEvent) { + protected showTooltip(event: CanvasEvent) { const { operation, enable: showTooltip } = getTooltipOptions( this.spreadsheet, event, @@ -142,7 +155,7 @@ export class RowColumnClick extends BaseEvent implements BaseEventImplement { }); } - private getTooltipOperator( + protected getTooltipOperator( event: CanvasEvent, operation: TooltipOperation, ): TooltipOperatorOptions { @@ -178,13 +191,13 @@ export class RowColumnClick extends BaseEvent implements BaseEventImplement { }); } - 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 +230,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 03c9cdcd6d..21e42aaf02 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, @@ -664,6 +665,8 @@ export class BaseBrushSelection }; protected mouseDown(event: CanvasEvent) { + event?.preventDefault?.(); + if (this.spreadsheet.interaction.hasIntercepts([InterceptType.CLICK])) { return; } @@ -783,9 +786,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)) { 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..87ca5b20ab 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'; @@ -109,15 +110,14 @@ export class ColCellBrushSelection extends BaseBrushSelection { stateName: InteractionStateName.COL_CELL_BRUSH_SELECTED, }); - this.spreadsheet.emit( + this.emitBrushSelectionEvent( S2Event.COL_CELL_BRUSH_SELECTION, this.brushRangeCells, + { + 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..ee8eb3179b 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'; @@ -115,6 +116,10 @@ export class DataCellBrushSelection extends BaseBrushSelection { this.emitBrushSelectionEvent( S2Event.DATA_CELL_BRUSH_SELECTION, scrollBrushRangeCells, + { + 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..9a27fec4ba 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'; @@ -110,6 +111,10 @@ export class RowCellBrushSelection extends BaseBrushSelection { this.emitBrushSelectionEvent( S2Event.ROW_CELL_BRUSH_SELECTION, scrollBrushRangeCells, + { + 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..a451c41533 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,10 @@ export class DataCellMultiSelection if (isEmpty(selectedCells)) { interaction.clearState(); this.spreadsheet.hideTooltip(); - this.spreadsheet.emit( - S2Event.GLOBAL_SELECTED, - interaction.getActiveCells(), - ); + interaction.emitSelectEvent({ + targetCell: cell, + interactionName: InteractionName.DATA_CELL_MULTI_SELECTION, + }); return; } @@ -112,10 +113,10 @@ export class DataCellMultiSelection stateName: InteractionStateName.SELECTED, onUpdateCells: afterSelectDataCells, }); - this.spreadsheet.emit( - S2Event.GLOBAL_SELECTED, - interaction.getActiveCells(), - ); + interaction.emitSelectEvent({ + 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 b8f19514fa..595f8968ef 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,10 @@ export class EventController { this.spreadsheet.emit( S2Event.GLOBAL_SELECTED, interaction.getActiveCells(), + { + targetCell: null, + interactionName: InteractionName.GLOBAL_RESET, + }, ); } @@ -245,6 +248,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 +492,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 +522,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,45 +544,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) { - 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..2e6450f116 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,17 @@ export class RangeSelection extends BaseEvent implements BaseEventImplement { event, getCellsTooltipData(this.spreadsheet), ); - this.spreadsheet.emit( - S2Event.GLOBAL_SELECTED, - interaction.getActiveCells(), - ); + interaction.emitSelectEvent({ + targetCell: cell, + 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 +182,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({ + 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..2502dddaa0 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) @@ -574,6 +583,7 @@ export class RootInteraction { const { cell, stateName = InteractionStateName.SELECTED, + interactionName, scrollIntoView = true, animate = true, skipScrollEvent = true, @@ -617,13 +627,15 @@ export class RootInteraction { if (isEmpty(selectedCells)) { this.reset(); - this.spreadsheet.emit(S2Event.GLOBAL_SELECTED, this.getActiveCells()); + this.emitSelectEvent({ + targetCell: cell, + interactionName, + }); return; } - // 禁止跨单元格选择, 这样计算出来的数据和交互没有任何意义. - if (unionBy(selectedCells, 'type').length > 1) { + if (this.shouldForbidHeaderCellSelected(selectedCells)) { return; } @@ -638,7 +650,7 @@ export class RootInteraction { stateName, }); - const selectedCellIds = selectedCells.map(({ id }) => id); + const selectedCellIds = groupSelectedCells(selectedCells); this.updateCells(this.spreadsheet.facet.getHeaderCells(selectedCellIds)); @@ -657,7 +669,10 @@ export class RootInteraction { // 由于绘制的顺序问题, 交互背景图层展示后, 会遮挡边框, 需要让边框展示在前面. this.spreadsheet.facet.centerFrame?.toFront(); - this.spreadsheet.emit(S2Event.GLOBAL_SELECTED, this.getActiveCells()); + this.emitSelectEvent({ + targetCell: cell, + interactionName, + }); return true; } @@ -819,10 +834,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 +1108,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 0d63ba518e..a1e2aa53eb 100644 --- a/packages/s2-core/src/interaction/row-column-resize.ts +++ b/packages/s2-core/src/interaction/row-column-resize.ts @@ -7,9 +7,10 @@ import { } from '@antv/g'; import { clone, isEmpty, throttle } from 'lodash'; import type { + CellTextWordWrapStyle, + DefaultCellTheme, ResizeInteractionOptions, ResizeParams, - RowCellStyle, } from '../common'; import { InterceptType, @@ -303,8 +304,8 @@ export class RowColumnResize extends BaseEvent implements BaseEventImplement { // 非多选: 正常设置即可 if ( - !this.isEffectRowOf(ResizeType.SELECTED) || - !this.isEffectColOf(ResizeType.SELECTED) || + (!this.isEffectRowOf(ResizeType.SELECTED) && + !this.isEffectColOf(ResizeType.SELECTED)) || !isMultiSelected ) { return { @@ -360,7 +361,9 @@ export class RowColumnResize extends BaseEvent implements BaseEventImplement { eventType: S2Event.LAYOUT_RESIZE_COL_WIDTH, style: { colCell: { - width: !this.isEffectColOf(ResizeType.ALL) ? null : displayWidth, + width: !this.isEffectColOf(ResizeType.ALL) + ? undefined + : displayWidth, widthByField: this.getCellStyleByField(displayWidth), }, }, @@ -378,6 +381,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(); @@ -386,9 +390,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, + ), }, }; @@ -397,10 +403,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) - ? null + ? undefined : displayHeight, - heightByField: this.getCellStyleByField(displayHeight), }, }, }; @@ -410,10 +420,49 @@ 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 { 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), + ); + + 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() || @@ -426,7 +475,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..c9d912737f 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,25 @@ 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({ + 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-shared/src/constant/theme.ts b/packages/s2-core/src/shared/constant/theme.ts similarity index 71% rename from packages/s2-shared/src/constant/theme.ts rename to packages/s2-core/src/shared/constant/theme.ts index b9691f0832..8bb0c51171 100644 --- a/packages/s2-shared/src/constant/theme.ts +++ b/packages/s2-core/src/shared/constant/theme.ts @@ -1,4 +1,4 @@ -import { S2_PREFIX_CLS } from '@antv/s2'; +import { S2_PREFIX_CLS } from '../../common'; /** * 注入主题 css 变量的节点名 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 90% rename from packages/s2-shared/src/styles/drill-down.less rename to packages/s2-core/src/shared/styles/drill-down.less index 46d6655c34..4d4ec9e556 100644 --- a/packages/s2-shared/src/styles/drill-down.less +++ b/packages/s2-core/src/shared/styles/drill-down.less @@ -4,7 +4,7 @@ width: 260px; min-height: 20px; position: relative; - color: var(--antv-s2-font-70, #fff); + color: var(--antv-s2-font-70, rgba(0, 0, 0, 0.9)); &-header { display: flex; @@ -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; } } @@ -42,10 +43,6 @@ } } - &-extra { - margin: 4px 16px; - } - &-menu { max-height: 314px; overflow: hidden auto; diff --git a/packages/s2-shared/src/styles/theme/dark.less b/packages/s2-core/src/shared/styles/theme/dark.less similarity index 100% rename from packages/s2-shared/src/styles/theme/dark.less rename to packages/s2-core/src/shared/styles/theme/dark.less 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 73% rename from packages/s2-shared/src/styles/tooltip/operator.less rename to packages/s2-core/src/shared/styles/tooltip/operator.less index 12bf087eeb..d55b166b3f 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 { @@ -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 f030bfc7b6..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 { @@ -154,7 +154,7 @@ export const buildDrillDownOptions = >( }, ], belongsCell: 'rowCell', - defaultHide: false, + defaultHide: true, displayCondition: partDrillDown?.displayCondition || defaultPartDrillDownDisplayCondition, }; 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 47524b7ea6..14e48d5816 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, @@ -67,9 +68,12 @@ import { BaseTooltip } from '../ui/tooltip'; import { removeOffscreenCanvas } from '../utils/canvas'; 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; @@ -97,13 +101,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; @@ -111,8 +117,6 @@ export abstract class SpreadSheet extends EE { public abstract isFrozenRowHeader(): boolean; - public abstract isTableMode(): boolean; - public abstract isValueInCols(): boolean; protected abstract buildFacet(): void; @@ -133,8 +137,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(); @@ -148,6 +152,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 { @@ -196,7 +208,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', @@ -220,7 +232,7 @@ export abstract class SpreadSheet extends EE { } } - private initInteraction() { + protected initInteraction() { this.interaction?.destroy?.(); this.interaction = new RootInteraction(this); } @@ -375,7 +387,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); } @@ -422,7 +434,7 @@ export abstract class SpreadSheet extends EE { const { reloadData = true, rebuildDataSet = false, - reBuildHiddenColumnsDetail = true, + rebuildHiddenColumnsDetail = true, } = options || {}; this.emit(S2Event.LAYOUT_BEFORE_RENDER); @@ -438,7 +450,7 @@ export abstract class SpreadSheet extends EE { this.buildFacet(); - if (reBuildHiddenColumnsDetail) { + if (rebuildHiddenColumnsDetail) { await this.initHiddenColumnsDetail(); } @@ -455,7 +467,7 @@ export abstract class SpreadSheet extends EE { s2.render({ reloadData: true; rebuildDataSet: true; - reBuildHiddenColumnsDetail: true; + rebuildHiddenColumnsDetail: true; }) */ public async render(options?: S2RenderOptions | boolean): Promise { @@ -487,6 +499,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__; } @@ -515,13 +528,23 @@ 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!); @@ -541,8 +564,7 @@ export abstract class SpreadSheet extends EE { } /** - * Update pagination config which store in {@see options} - * @param pagination + * 更新分页配置 */ public updatePagination(pagination: Pagination) { this.options = customMerge(this.options, { @@ -553,13 +575,6 @@ export abstract class SpreadSheet extends EE { this.facet.resetScrollOffset(); } - /** - * 获取当前表格实际内容高度 - */ - public getContentHeight(): number { - return this.facet.getContentHeight(); - } - /** * 修改表格画布大小,不用重新加载数据 * @param width @@ -703,16 +718,22 @@ export abstract class SpreadSheet extends EE { * @private */ protected initContainer(dom: S2MountContainer) { - const { width, height, transformCanvasConfig } = this.options; + 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 + * 开启 supportsPointerEvents 后, G Canvas 会禁用 `touchAction`: https://github.com/antvis/G/blob/910c58e9bcba48cfa7bb0585064d27d3ae0bff4c/packages/g-plugin-dom-interaction/src/DOMInteractionPlugin.ts#L135 + */ + const supportsPointerEvents = !isMobile(device); this.container = new Canvas({ container: this.getMountContainer(dom) as HTMLElement, width, height, renderer, + supportsPointerEvents, ...canvasConfig, }); @@ -818,7 +839,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); @@ -829,7 +853,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]/ @@ -894,4 +918,8 @@ export abstract class SpreadSheet extends EE { return text ?? getDefaultSeriesNumberText(); } + + public enableAsyncExport(): Error | true { + return true; + } } 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 124303bda9..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,384 +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: { - 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: [], - }, - // ------------- 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 e2bef607cd..9bb2dac7b1 100644 --- a/packages/s2-core/src/ui/hd-adapter/index.ts +++ b/packages/s2-core/src/ui/hd-adapter/index.ts @@ -2,6 +2,12 @@ import { debounce } from 'lodash'; import type { SpreadSheet } from '../../sheet-type'; import { isMobile } from '../../utils/is-mobile'; +/** + * 基于 Canvas 的高清适配方案 + * 1. 双屏切换, devicePixelRatio 变化时 + * 2. Mac 触控板缩放 + * 3. 浏览器窗口缩放 + */ export class HdAdapter { private viewport = window as typeof window & { visualViewport: VisualViewport; @@ -13,6 +19,8 @@ export class HdAdapter { private isDevicePixelRatioChange = false; + private zoomOffsetLeft: number | undefined; + constructor(spreadsheet: SpreadSheet) { this.spreadsheet = spreadsheet; } @@ -91,6 +99,9 @@ export class HdAdapter { await this.renderByZoomScale(event); }; + /** + * 如果是浏览器窗口的放大缩小 (command +/-), 也会触发 + */ private renderByDevicePixelRatioChanged = async () => { this.isDevicePixelRatioChange = true; await this.renderByDevicePixelRatio(); @@ -99,29 +110,47 @@ export class HdAdapter { private renderByDevicePixelRatio = async ( ratio = window.devicePixelRatio, ) => { + if (this.spreadsheet.destroyed) { + return; + } + const { container, options: { width, height }, } = this.spreadsheet; const canvas = this.spreadsheet.getCanvasElement(); + const currentRatio = Math.ceil(ratio); const lastRatio = container.getConfig().devicePixelRatio ?? 1; - if (lastRatio === ratio || !canvas) { + if (lastRatio === currentRatio || !canvas) { return; } // https://github.com/antvis/G/issues/1143 - container.getConfig().devicePixelRatio = ratio; + container.getConfig().devicePixelRatio = currentRatio; container.resize(width!, height!); await this.spreadsheet.render(false); }; private renderByZoomScale = debounce(async (event: Event) => { - const ratio = Math.ceil((event.target as VisualViewport)?.scale); + if (this.spreadsheet.destroyed) { + return; + } + + const target = event.target as VisualViewport; + const ratio = Math.ceil(target?.scale); + + /** + * github.com/antvis/S2/issues/2884 + * 如果是触控板双指缩放触发的 resize 事件, offsetLeft 可以获取到值 + * 如果是浏览器窗口的放大缩小 (command +/-), offsetLeft 始终是 0 + */ + const isTouchPadZoom = this.zoomOffsetLeft !== target.offsetLeft; - if (ratio >= 1 && !this.isDevicePixelRatioChange) { + if (ratio >= 1 && isTouchPadZoom && !this.isDevicePixelRatioChange) { await this.renderByDevicePixelRatio(ratio); + this.zoomOffsetLeft = target.offsetLeft; } }, 350); } 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 f1e54652ac..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'; @@ -56,13 +56,13 @@ export const getIntervalScale = (minValue = 0, maxValue = 0) => { }; }; -export const findFieldCondition = ( - conditions: Condition[], - valueField: string, -) => { - return findLast(conditions, (item) => { +export const findFieldCondition = ( + conditions: T[] = [], + field: string, +): T | undefined => { + return findLast(compact(conditions), (item) => { return item.field instanceof RegExp - ? item.field.test(valueField) - : item.field === valueField; + ? 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/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/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..1259f9f9be 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,15 +40,15 @@ export const getCellMeta = (cell: S2CellType): CellMeta => { }; }; -export const selectCells = (spreadsheet: SpreadSheet, cells: CellMeta[]) => { - const { interaction } = spreadsheet; +// export const selectCells = (spreadsheet: SpreadSheet, cells: CellMeta[]) => { +// const { interaction } = spreadsheet; - interaction.changeState({ - stateName: InteractionStateName.SELECTED, - cells, - }); - spreadsheet.emit(S2Event.GLOBAL_SELECTED, interaction.getActiveCells()); -}; +// interaction.changeState({ +// stateName: InteractionStateName.SELECTED, +// cells, +// }); +// spreadsheet.emit(S2Event.GLOBAL_SELECTED, interaction.getActiveCells()); +// }; export function getRangeIndex( start: T, @@ -169,3 +164,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..171b00ceec 100644 --- a/packages/s2-core/src/utils/sort-action.ts +++ b/packages/s2-core/src/utils/sort-action.ts @@ -320,17 +320,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 +345,7 @@ export const getSortByMeasureValues = ( return false; } - if (dataItemKeys.has(fieldAfterSortField)) { + if (dataItemKeys.has(fieldAfterSortField as string)) { /* * 若排序数据包含`排序字段`的后一个维度字段,则过滤 * 不需要比排序字段更 “明细” 的数据,只需取到 sortFieldId 当级的汇总 @@ -359,7 +359,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/text.ts b/packages/s2-core/src/utils/text.ts index d11738d930..ec4af717cb 100644 --- a/packages/s2-core/src/utils/text.ts +++ b/packages/s2-core/src/utils/text.ts @@ -162,6 +162,7 @@ const getCurrentTextStyle = ({ data, textStyle, textCondition, + cell, }: { rowIndex: number; colIndex: number; @@ -169,12 +170,17 @@ const getCurrentTextStyle = ({ data: string | number; textStyle?: TextTheme; textCondition?: TextCondition; + cell: S2CellType; }): TextTheme => { - const style = textCondition?.mapping?.(data, { - rowIndex, - colIndex, - meta, - }); + const style = textCondition?.mapping?.( + data, + { + rowIndex, + colIndex, + meta, + }, + cell, + ); return { ...textStyle, ...style }; }; @@ -340,6 +346,7 @@ export const drawCustomContent = ( data: curText, textStyle, textCondition, + cell, }) : textStyle!; @@ -391,11 +398,15 @@ export const drawCustomContent = ( // 绘制条件格式的 icon if (iconCondition && useCondition) { - const attrs = iconCondition?.mapping?.(curText, { - rowIndex: i, - colIndex: j, - meta: cell?.getMeta(), - }); + const attrs = iconCondition?.mapping?.( + curText, + { + rowIndex: i, + colIndex: j, + meta: cell?.getMeta(), + }, + cell, + ); const iconX = iconCfg?.position === 'left' ? leftIconX : rightIconX; const iconY = getVerticalIconPosition( diff --git a/packages/s2-core/src/utils/theme.ts b/packages/s2-core/src/utils/theme.ts index f84f16242e..6cbf01a3e5 100644 --- a/packages/s2-core/src/utils/theme.ts +++ b/packages/s2-core/src/utils/theme.ts @@ -1,6 +1,6 @@ import { PALETTE_MAP, STYLE_ELEMENT_ID } from '../common/constant'; import type { Palette, ThemeName } from '../common/interface/theme'; -import DarkVars from '../styles/theme/dark.less?inline'; +import DarkVars from '../styles/theme/dark.less'; import { injectCssText } from './inject-css-text'; /** @@ -15,5 +15,8 @@ export const getPalette = (themeName?: ThemeName): Palette => { */ export const injectThemeVars = (themeName?: ThemeName) => { // 目前仅 dark 主题需要定制 - injectCssText(STYLE_ELEMENT_ID, themeName === 'dark' ? DarkVars : ''); + injectCssText( + STYLE_ELEMENT_ID, + themeName === 'dark' ? (DarkVars as string) : '', + ); }; diff --git a/packages/s2-core/src/utils/tooltip.ts b/packages/s2-core/src/utils/tooltip.ts index 3232d595fa..87822b2c6f 100644 --- a/packages/s2-core/src/utils/tooltip.ts +++ b/packages/s2-core/src/utils/tooltip.ts @@ -191,9 +191,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); diff --git a/packages/s2-core/tsconfig.build.json b/packages/s2-core/tsconfig.build.json new file mode 100644 index 0000000000..8f867a0a66 --- /dev/null +++ b/packages/s2-core/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "include": ["src/**/*", "./typings.d.ts", "../../global.d.ts"], + "compilerOptions": { + "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..264d5dd7d8 100644 --- a/packages/s2-core/tsconfig.json +++ b/packages/s2-core/tsconfig.json @@ -3,11 +3,12 @@ "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__/*"] }, }, + "exclude": ["node_modules", "coverage", "esm", "lib", "dist", "temp"], "include": ["src", "../../global.d.ts"] } diff --git a/packages/s2-react-components/CHANGELOG.md b/packages/s2-react-components/CHANGELOG.md new file mode 100644 index 0000000000..cae56d328d --- /dev/null +++ b/packages/s2-react-components/CHANGELOG.md @@ -0,0 +1,30 @@ +# [@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 + +* ✨ v0.1.0 ([#66](https://github.com/antvis/S2/issues/66)) ([a8cff41](https://github.com/antvis/S2/commit/a8cff413a15a4c050c82e87808e9ec2af8eb576d)), closes [#7](https://github.com/antvis/S2/issues/7) [#10](https://github.com/antvis/S2/issues/10) [#12](https://github.com/antvis/S2/issues/12) [#13](https://github.com/antvis/S2/issues/13) [#16](https://github.com/antvis/S2/issues/16) [#17](https://github.com/antvis/S2/issues/17) [#11](https://github.com/antvis/S2/issues/11) [#19](https://github.com/antvis/S2/issues/19) [#18](https://github.com/antvis/S2/issues/18) [#21](https://github.com/antvis/S2/issues/21) [#23](https://github.com/antvis/S2/issues/23) [#20](https://github.com/antvis/S2/issues/20) [#24](https://github.com/antvis/S2/issues/24) [#20](https://github.com/antvis/S2/issues/20) [#26](https://github.com/antvis/S2/issues/26) [#27](https://github.com/antvis/S2/issues/27) [#28](https://github.com/antvis/S2/issues/28) [#29](https://github.com/antvis/S2/issues/29) [#35](https://github.com/antvis/S2/issues/35) [#37](https://github.com/antvis/S2/issues/37) [#38](https://github.com/antvis/S2/issues/38) [#39](https://github.com/antvis/S2/issues/39) [#42](https://github.com/antvis/S2/issues/42) [#43](https://github.com/antvis/S2/issues/43) [#44](https://github.com/antvis/S2/issues/44) [#45](https://github.com/antvis/S2/issues/45) [#47](https://github.com/antvis/S2/issues/47) [#46](https://github.com/antvis/S2/issues/46) [#48](https://github.com/antvis/S2/issues/48) [#32](https://github.com/antvis/S2/issues/32) [#31](https://github.com/antvis/S2/issues/31) [#49](https://github.com/antvis/S2/issues/49) [#32](https://github.com/antvis/S2/issues/32) [#31](https://github.com/antvis/S2/issues/31) [#50](https://github.com/antvis/S2/issues/50) [#51](https://github.com/antvis/S2/issues/51) [#52](https://github.com/antvis/S2/issues/52) [#55](https://github.com/antvis/S2/issues/55) [#57](https://github.com/antvis/S2/issues/57) [#58](https://github.com/antvis/S2/issues/58) [#59](https://github.com/antvis/S2/issues/59) [#14](https://github.com/antvis/S2/issues/14) [#30](https://github.com/antvis/S2/issues/30) [#60](https://github.com/antvis/S2/issues/60) [#61](https://github.com/antvis/S2/issues/61) [#64](https://github.com/antvis/S2/issues/64) [#65](https://github.com/antvis/S2/issues/65) +* **frozen-panel:** 增加行列头冻结配置面板 ([#2782](https://github.com/antvis/S2/issues/2782)) ([d2fa5c9](https://github.com/antvis/S2/commit/d2fa5c958cee04a09d95ae481d62fd035728c7ae)) +* **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)) diff --git a/packages/s2-react-components/README.md b/packages/s2-react-components/README.md index ead1e8dba7..e06763c763 100644 --- a/packages/s2-react-components/README.md +++ b/packages/s2-react-components/README.md @@ -34,7 +34,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/s2-react-components.min.css' +import '@antv/s2-react-components/dist/s2-react-components.min.css' const App = () => { return ( @@ -84,7 +84,7 @@ const App = () => { ```tsx import React from 'React' import { ThemePanel } from '@antv/s2-react-components' -import '@antv/s2-components/dist/s2-react-components.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..a57365cea4 --- /dev/null +++ b/packages/s2-react-components/__tests__/unit/components/drill-down/__snapshots__/drill-down-spec.tsx.snap @@ -0,0 +1,688 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`DrillDown Component Tests should render component 1`] = ` + +
    +
    +
    + 选择下钻维度 +
    + +
    + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + +
    +
    + No data +
    +
    +