diff --git a/.eslintignore b/.eslintignore index 950b6f04d7..29ae199862 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,7 +1,6 @@ s2-site node_modules .cache -package.json .history esm lib diff --git a/.eslintrc.js b/.eslintrc.js index aab38a6338..d0205f56a7 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -44,10 +44,26 @@ module.exports = { trailingComma: 'all', printWidth: 80, proseWrap: 'never', - overrides: [{ files: '.prettierrc', options: { parser: 'json' } }], + overrides: [ + { files: '.eslintrc', options: { parser: 'json' } }, + { files: '.prettierrc', options: { parser: 'json' } }, + ], + plugins: [ + require.resolve('prettier-plugin-packagejson'), + require.resolve('prettier-plugin-organize-imports'), + ], + pluginSearchDirs: false, + }, + ], + 'import/no-duplicates': [2, { considerQueryString: true }], + 'import/no-deprecated': 1, + 'import/no-cycle': 1, + 'import/order': [ + 2, + { + warnOnUnassignedImports: false, }, ], - 'import/order': 2, 'import/no-default-export': 0, 'no-restricted-syntax': 0, semi: 0, @@ -115,7 +131,7 @@ module.exports = { 'no-useless-computed-key': 2, 'block-spacing': [2, 'always'], 'lines-between-class-members': [2, 'always'], - 'no-unused-vars': 'off', + 'no-unused-vars': 0, '@typescript-eslint/no-unused-vars': 2, '@typescript-eslint/no-non-null-asserted-optional-chain': 0, 'no-unsafe-optional-chaining': 0, @@ -157,6 +173,7 @@ module.exports = { // 'as-needed', // { requireReturnForObjectLiteral: true }, // ], + 'no-promise-executor-return': 2, 'no-unneeded-ternary': 2, 'array-callback-return': 2, 'dot-notation': 0, @@ -216,6 +233,7 @@ module.exports = { rules: { 'max-lines-per-function': 0, 'line-comment-position': 0, + 'import/order': 0, }, }, ], diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index 1f7d825c29..000f900171 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -24,9 +24,9 @@ jobs: with: python-version: '3.10' - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 with: - version: 8 + version: 9 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ee18ab6b2b..5ba5e74eb3 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -42,11 +42,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -57,7 +57,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v3 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -71,4 +71,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/compressed-size.yml b/.github/workflows/compressed-size.yml index c25c7f9a23..fe79eec36a 100644 --- a/.github/workflows/compressed-size.yml +++ b/.github/workflows/compressed-size.yml @@ -23,9 +23,9 @@ jobs: with: python-version: '3.10' - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 with: - version: 7 + version: 9 - uses: preactjs/compressed-size-action@v2 with: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c43309deac..d1ba901521 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -23,9 +23,9 @@ jobs: with: python-version: '3.10' - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 with: - version: 8 + version: 9 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 diff --git a/.github/workflows/release-success.yml b/.github/workflows/release-success.yml index eba155ea2b..a0f5742508 100644 --- a/.github/workflows/release-success.yml +++ b/.github/workflows/release-success.yml @@ -28,7 +28,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - cache: 'yarn' + cache: 'pnpm' - name: Git bootstrap run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7a6b58f018..51251dfb66 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,9 +26,9 @@ jobs: with: python-version: '3.10' - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 with: - version: 8 + version: 9 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 diff --git a/.prettierignore b/.prettierignore index 4fdde6c84a..1fe6728b63 100644 --- a/.prettierignore +++ b/.prettierignore @@ -16,7 +16,6 @@ yarn.lock yarn-error.log npm-debug.log lerna-debug.log -package.json tsconfig.json CNAME LICENSE @@ -26,6 +25,3 @@ s2-site/public esm dist lib - - - diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 3280834f82..0000000000 --- a/.prettierrc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "endOfLine": "lf", - "semi": true, - "singleQuote": true, - "tabWidth": 2, - "trailingComma": "all", - "printWidth": 80, - "arrowParens": "always", - "proseWrap": "never", - "overrides": [ - { "files": ".eslintrc", "options": { "parser": "json" } }, - { "files": ".prettierrc", "options": { "parser": "json" } } - ] -} diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000000..9a6b3dd133 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,19 @@ +module.exports = { + endOfLine: 'lf', + semi: true, + singleQuote: true, + tabWidth: 2, + trailingComma: 'all', + printWidth: 80, + arrowParens: 'always', + proseWrap: 'never', + overrides: [ + { files: '.eslintrc', options: { parser: 'json' } }, + { files: '.prettierrc', options: { parser: 'json' } }, + ], + plugins: [ + require.resolve('prettier-plugin-packagejson'), + require.resolve('prettier-plugin-organize-imports'), + ], + pluginSearchDirs: false, +}; diff --git a/.releaserc.base.js b/.releaserc.base.js index 544d514383..7b318d03ec 100644 --- a/.releaserc.base.js +++ b/.releaserc.base.js @@ -19,6 +19,7 @@ module.exports = { { type: 'perf', release: 'patch' }, { type: 'refactor', release: 'patch' }, { type: 'style', release: 'patch' }, + { type: 'docs', release: false }, { scope: 'no-release', release: false }, ], }, @@ -28,9 +29,9 @@ module.exports = { '@semantic-release/npm', [ '@semantic-release/git', - { + { message: 'chore(release): 🤖 ${nextRelease.gitTag} [skip ci]', - }, + }, ], '@semantic-release/github', [ diff --git a/global.d.ts b/global.d.ts index d342be9582..2d4ff1eede 100644 --- a/global.d.ts +++ b/global.d.ts @@ -1,6 +1,6 @@ declare global { interface HTMLCanvasElement { - __s2_instance__?: any; + __s2_instance__?: any; } } -export {} \ No newline at end of file +export {}; diff --git a/package.json b/package.json index e581fe59f8..f03c70a303 100644 --- a/package.json +++ b/package.json @@ -7,12 +7,20 @@ "s2", "@antv/s2", "@antv/s2-react", + "@antv/s2-react-components", "@antv/s2-vue", "pivot table", + "pivot sheet", + "pivot chart", "table", "sheet", "spreadsheet" ], + "repository": { + "type": "git", + "url": "https://github.com/antvis/S2.git" + }, + "license": "MIT", "scripts": { "preinstall": "npx only-allow pnpm", "bootstrap": "pnpm install", @@ -37,6 +45,11 @@ "vue:build": "pnpm --filter @antv/s2-vue build", "vue:test": "pnpm --filter @antv/s2-vue test", "vue:watch": " pnpm --filter @antv/s2-vue watch", + "react-components:start": "pnpm --filter @antv/s2-react-components test:live", + "react-components:playground": "pnpm --filter @antv/s2-react-components start", + "react-components:build": "pnpm --filter @antv/s2-react-components build", + "react-components:test": "pnpm --filter @antv/s2-react-components test", + "react-components:test-coverage": "pnpm --filter @antv/s2-react-components test:coverage", "build": "pnpm -r --filter './packages/*' --stream build", "build:esm": "pnpm -r --filter './packages/*' --stream build:esm", "build:umd": "pnpm -r --filter './packages/*' --stream build:umd", @@ -51,7 +64,7 @@ "test:ci-coverage": "pnpm -r --filter './packages/*' --stream test:ci-coverage", "lint": "run-s lint:type lint:script lint:style lint:docs lint:word", "lint:type": "pnpm -r --filter './packages/*' --stream tsc", - "lint:script": "eslint . --ext '.js,.jsx,.ts,.tsx,.vue'", + "lint:script": "eslint . --ext '.js,.jsx,.ts,.tsx,.vue' --quiet", "lint:style": "stylelint packages/**/*.less", "lint:docs": "markdownlint '**/*.md'", "lint:word": "case-police '**/*.md'", @@ -64,7 +77,8 @@ "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" + "share:test": "pnpm --filter @antv/s2-shared test", + "format": "prettier . --write" }, "commitlint": { "extends": [ @@ -88,50 +102,52 @@ ] }, "devDependencies": { - "@babel/core": "^7.24.0", - "@commitlint/cli": "^19.0.3", - "@commitlint/config-conventional": "^19.0.3", - "@microsoft/api-extractor": "^7.38.1", + "@babel/core": "^7.24.6", + "@commitlint/cli": "^19.3.0", + "@commitlint/config-conventional": "^19.2.2", + "@microsoft/api-extractor": "^7.46.2", "@originjs/vite-plugin-commonjs": "^1.0.3", - "@rollup/plugin-alias": "^5.0.1", - "@rollup/plugin-commonjs": "^25.0.7", + "@rollup/plugin-alias": "^5.1.0", + "@rollup/plugin-commonjs": "^25.0.8", "@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-replace": "^5.0.5", "@rollup/plugin-terser": "^0.4.4", - "@rollup/plugin-typescript": "^11.1.5", - "@rushstack/eslint-patch": "^1.5.1", + "@rollup/plugin-typescript": "^11.1.6", + "@rushstack/eslint-patch": "^1.10.3", "@semantic-release/changelog": "^6.0.3", "@semantic-release/exec": "^6.0.3", "@semantic-release/git": "^10.0.1", - "@swc/core": "^1.4.5", + "@size-limit/esbuild": "^11.1.4", + "@size-limit/esbuild-why": "^11.1.4", + "@size-limit/file": "^11.1.4", + "@swc/core": "^1.5.24", "@swc/jest": "^0.2.36", "@types/jest": "^27.5.2", - "@types/lodash": "4.14.199", - "@types/node": "^20.8.6", - "@types/rollup-plugin-peer-deps-external": "^2.2.2", - "@typescript-eslint/eslint-plugin": "^6.8.0", - "@typescript-eslint/parser": "^6.8.0", - "@vitejs/plugin-react": "^4.2.1", - "@vitejs/plugin-vue": "^5.0.4", - "@vitejs/plugin-vue-jsx": "^3.1.0", - "@vue/eslint-config-prettier": "^8.0.0", - "@vue/eslint-config-typescript": "^12.0.0", + "@types/lodash": "4.17.4", + "@types/node": "^20.14.0", + "@types/rollup-plugin-peer-deps-external": "^2.2.5", + "@typescript-eslint/eslint-plugin": "^7.11.0", + "@typescript-eslint/parser": "^7.11.0", + "@vitejs/plugin-react": "^4.3.0", + "@vitejs/plugin-vue": "^5.0.5", + "@vitejs/plugin-vue-jsx": "^4.0.0", + "@vue/eslint-config-prettier": "^9.0.0", + "@vue/eslint-config-typescript": "^13.0.0", "@vue/vue3-jest": "^29.2.6", "babel-core": "^7.0.0-bridge.0", - "bundlesize": "^0.18.1", "case-police": "^0.6.1", "concurrently": "^8.2.2", "cpx": "^1.5.0", "cross-env": "^7.0.3", "eslint": "^8.57.0", "eslint-config-airbnb-base": "^15.0.0", - "eslint-config-prettier": "^9.0.0", - "eslint-plugin-import": "^2.29.0", - "eslint-plugin-jest": "^27.6.0", - "eslint-plugin-jsx-a11y": "^6.7.1", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-import": "^2.29.1", + "eslint-plugin-jest": "^28.5.0", + "eslint-plugin-jsx-a11y": "^6.8.0", "eslint-plugin-prettier": "^5.1.3", - "eslint-plugin-react": "^7.34.0", - "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-react": "^7.34.2", + "eslint-plugin-react-hooks": "^4.6.2", "eslint-plugin-vue": "^9.17.0", "gh-pages": "^3.2.3", "glob": "^10.3.10", @@ -145,43 +161,35 @@ "jest-raw-loader": "^1.0.1", "jest-url-loader": "^0.1.0", "less": "^4.2.0", - "lint-staged": "^15.2.2", + "lint-staged": "^15.2.5", "lodash-es": "^4.17.21", - "markdownlint-cli": "^0.39.0", + "markdownlint-cli": "^0.41.0", "npm-run-all": "^4.1.5", "ora": "^8.0.1", - "postcss": "^8.4.35", + "postcss": "^8.4.38", "postcss-less": "^6.0.0", - "prettier": "3.2.5", - "rimraf": "^5.0.5", - "rollup": "^4.12.1", + "prettier": "3.3.0", + "prettier-plugin-organize-imports": "^3.2.4", + "prettier-plugin-packagejson": "^2.5.0", + "rimraf": "^5.0.7", + "rollup": "^4.18.0", "rollup-plugin-peer-deps-external": "^2.2.4", "rollup-plugin-postcss": "^4.0.2", "rollup-plugin-typescript2": "^0.36.0", "rollup-plugin-visualizer": "^5.12.0", "semantic-release": "^19.0.5", "semantic-release-monorepo": "^7.0.8", - "size-limit": "^11.0.0", + "size-limit": "^11.1.4", "stylelint": "^15.11.0", "stylelint-config-prettier": "^9.0.5", "stylelint-config-standard": "^34.0.0", "tslib": "^2.6.2", - "typescript": "^5.2.2", - "vite": "^5.1.5", + "typescript": "^5.4.5", + "vite": "^5.2.12", "vite-plugin-imp": "^2.4.0", "vue-jest": "^5.0.0-alpha.10" }, - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/antvis/S2.git" - }, "tnpm": { "mode": "pnpm" - }, - "dependencies": { - "@size-limit/esbuild": "^11.0.2", - "@size-limit/esbuild-why": "^11.0.2", - "@size-limit/file": "^11.0.2" } } diff --git a/packages/s2-core/__tests__/bugs/issue-1014-spec.ts b/packages/s2-core/__tests__/bugs/issue-1014-spec.ts index 6d0c87a455..4d9024faf9 100644 --- a/packages/s2-core/__tests__/bugs/issue-1014-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-1014-spec.ts @@ -4,11 +4,11 @@ * Column should not be formatted * */ +import type { S2DataConfig, S2Options } from '@/common/interface'; +import { PivotSheet, SpreadSheet } from '@/sheet-type'; import { get } from 'lodash'; import * as mockDataConfig from 'tests/data/simple-data.json'; import { getContainer } from 'tests/util/helpers'; -import { PivotSheet, SpreadSheet } from '@/sheet-type'; -import type { S2DataConfig, S2Options } from '@/common/interface'; const s2options: S2Options = { // 让被测试的单元格在首屏显示出来 diff --git a/packages/s2-core/__tests__/bugs/issue-1191-spec.ts b/packages/s2-core/__tests__/bugs/issue-1191-spec.ts index b648bff8b0..d34307be38 100644 --- a/packages/s2-core/__tests__/bugs/issue-1191-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-1191-spec.ts @@ -5,10 +5,10 @@ * link field should use linkFieldFill color * */ -import * as mockDataConfig from 'tests/data/simple-data.json'; -import { getContainer } from 'tests/util/helpers'; import type { S2DataConfig, S2Options } from '@/common/interface'; import { PivotSheet, SpreadSheet } from '@/sheet-type'; +import * as mockDataConfig from 'tests/data/simple-data.json'; +import { getContainer } from 'tests/util/helpers'; const s2options: S2Options = { width: 300, diff --git a/packages/s2-core/__tests__/bugs/issue-1201-spec.ts b/packages/s2-core/__tests__/bugs/issue-1201-spec.ts index 2af1b5b5bb..817cdd2780 100644 --- a/packages/s2-core/__tests__/bugs/issue-1201-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-1201-spec.ts @@ -4,10 +4,10 @@ * https://github.com/antvis/S2/issues/1201 * fillOpacity */ +import { PivotSheet } from '@/sheet-type'; import type { S2Options } from '../../src'; import * as mockDataConfig from '../data/data-issue-292.json'; import { getContainer } from '../util/helpers'; -import { PivotSheet } from '@/sheet-type'; const s2Options: S2Options = { width: 800, diff --git a/packages/s2-core/__tests__/bugs/issue-1337-spec.ts b/packages/s2-core/__tests__/bugs/issue-1337-spec.ts index 1886c380ad..9798942fbc 100644 --- a/packages/s2-core/__tests__/bugs/issue-1337-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-1337-spec.ts @@ -4,9 +4,9 @@ * https://github.com/antvis/S2/issues/1337 * Row with only value field should not render total node */ -import { getContainer } from 'tests/util/helpers'; -import { assembleDataCfg, assembleOptions } from 'tests/util'; import { PivotSheet } from '@/sheet-type'; +import { assembleDataCfg, assembleOptions } from 'tests/util'; +import { getContainer } from 'tests/util/helpers'; describe('Totals Tests', () => { let spreadsheet: PivotSheet; diff --git a/packages/s2-core/__tests__/bugs/issue-1520-spec.ts b/packages/s2-core/__tests__/bugs/issue-1520-spec.ts index 42529edc0d..b0e9b60b12 100644 --- a/packages/s2-core/__tests__/bugs/issue-1520-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-1520-spec.ts @@ -3,10 +3,10 @@ * https://github.com/antvis/S2/issues/1520 * 数据为0时,图标标记中的图标不显示 */ -import { getContainer } from '../util/helpers'; -import * as mockDataConfig from '../data/data-issue-1520.json'; -import { PivotSheet, SpreadSheet } from '@/sheet-type'; import { GuiIcon, type S2Options } from '@/common'; +import { PivotSheet, SpreadSheet } from '@/sheet-type'; +import * as mockDataConfig from '../data/data-issue-1520.json'; +import { getContainer } from '../util/helpers'; const s2Options: S2Options = { width: 800, diff --git a/packages/s2-core/__tests__/bugs/issue-1539-spec.ts b/packages/s2-core/__tests__/bugs/issue-1539-spec.ts index fb10718516..ad8f72b420 100644 --- a/packages/s2-core/__tests__/bugs/issue-1539-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-1539-spec.ts @@ -4,11 +4,11 @@ * 明细表,开启序号时,左侧边框丢失 * */ -import { getContainer } from 'tests/util/helpers'; +import type { S2Options } from '@/common/interface'; +import { TableSheet } from '@/sheet-type'; import type { Line } from '@antv/g'; +import { getContainer } from 'tests/util/helpers'; import dataCfg from '../data/simple-table-data.json'; -import { TableSheet } from '@/sheet-type'; -import type { S2Options } from '@/common/interface'; const s2Options: S2Options = { width: 600, diff --git a/packages/s2-core/__tests__/bugs/issue-1561-spec.ts b/packages/s2-core/__tests__/bugs/issue-1561-spec.ts index 058eeb32c2..71cb4a8bc0 100644 --- a/packages/s2-core/__tests__/bugs/issue-1561-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-1561-spec.ts @@ -4,11 +4,11 @@ * 内容未填充整个画布且存在滚动条(横向或者纵向)情况下,拖动滚动条会导致边框绘制到内容区之外 * */ -import { getContainer } from 'tests/util/helpers'; +import type { S2Options } from '@/common/interface'; +import { TableSheet } from '@/sheet-type'; import type { Group } from '@antv/g'; +import { getContainer } from 'tests/util/helpers'; import dataCfg from '../data/simple-table-data.json'; -import { TableSheet } from '@/sheet-type'; -import type { S2Options } from '@/common/interface'; const s2Options: S2Options = { width: 200, diff --git a/packages/s2-core/__tests__/bugs/issue-1587-spec.ts b/packages/s2-core/__tests__/bugs/issue-1587-spec.ts index c39d5c3903..9eeade0a09 100644 --- a/packages/s2-core/__tests__/bugs/issue-1587-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-1587-spec.ts @@ -3,10 +3,10 @@ * https://github.com/antvis/S2/issues/1587 */ -import { getContainer } from '../util/helpers'; -import * as mockDataConfig from '../data/simple-data.json'; -import type { S2Options } from '../../src'; import { PivotSheet } from '@/sheet-type'; +import type { S2Options } from '../../src'; +import * as mockDataConfig from '../data/simple-data.json'; +import { getContainer } from '../util/helpers'; const s2Options: S2Options = { width: 800, diff --git a/packages/s2-core/__tests__/bugs/issue-1624-spec.ts b/packages/s2-core/__tests__/bugs/issue-1624-spec.ts index cc74b2a846..09ce730957 100644 --- a/packages/s2-core/__tests__/bugs/issue-1624-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-1624-spec.ts @@ -4,10 +4,10 @@ * https://github.com/antvis/S2/issues/1624 */ -import * as mockDataConfig from '../data/simple-data.json'; -import { getContainer, sleep } from '../util/helpers'; import { S2Event, type S2Options } from '@/index'; import { PivotSheet } from '@/sheet-type'; +import * as mockDataConfig from '../data/simple-data.json'; +import { getContainer, sleep } from '../util/helpers'; const s2Options: S2Options = { width: 800, diff --git a/packages/s2-core/__tests__/bugs/issue-1668-spec.ts b/packages/s2-core/__tests__/bugs/issue-1668-spec.ts index 95cd6b24f3..45a0955f0e 100644 --- a/packages/s2-core/__tests__/bugs/issue-1668-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-1668-spec.ts @@ -2,12 +2,12 @@ * @description spec for issue #1668 * https://github.com/antvis/S2/issues/1668 */ +import type { CustomRect } from '@/engine'; +import { KEY_GROUP_COL_RESIZE_AREA, type S2Options } from '@/index'; +import { PivotSheet } from '@/sheet-type'; import type { Group } from '@antv/g'; -import { getContainer } from '../util/helpers'; import * as mockDataConfig from '../data/data-issue-1668.json'; -import { type S2Options, KEY_GROUP_COL_RESIZE_AREA } from '@/index'; -import { PivotSheet } from '@/sheet-type'; -import type { CustomRect } from '@/engine'; +import { getContainer } from '../util/helpers'; const s2Options: S2Options = { width: 800, diff --git a/packages/s2-core/__tests__/bugs/issue-1715-spec.ts b/packages/s2-core/__tests__/bugs/issue-1715-spec.ts index 4eaf9d183b..2e447dea3b 100644 --- a/packages/s2-core/__tests__/bugs/issue-1715-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-1715-spec.ts @@ -5,10 +5,10 @@ * https://github.com/antvis/S2/issues/2049 */ -import { getContainer } from '../util/helpers'; -import * as mockDataConfig from '../data/mock-dataset.json'; -import type { S2DataConfig, S2Options, SpreadSheet } from '../../src'; import { PivotSheet } from '@/sheet-type'; +import type { S2DataConfig, S2Options, SpreadSheet } from '../../src'; +import * as mockDataConfig from '../data/mock-dataset.json'; +import { getContainer } from '../util/helpers'; const s2Options: S2Options = { width: 800, diff --git a/packages/s2-core/__tests__/bugs/issue-1764-spec.ts b/packages/s2-core/__tests__/bugs/issue-1764-spec.ts index 32565aa676..199e8eb403 100644 --- a/packages/s2-core/__tests__/bugs/issue-1764-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-1764-spec.ts @@ -4,11 +4,11 @@ * https://github.com/antvis/S2/issues/1780 */ -import { FederatedMouseEvent } from '@antv/g'; -import { getContainer } from '../util/helpers'; -import * as mockDataConfig from '../data/data-issue-1668.json'; import type { S2Options } from '@/index'; import { PivotSheet } from '@/sheet-type'; +import { FederatedMouseEvent } from '@antv/g'; +import * as mockDataConfig from '../data/data-issue-1668.json'; +import { getContainer } from '../util/helpers'; const s2Options: S2Options = { width: 800, diff --git a/packages/s2-core/__tests__/bugs/issue-1781-spec.ts b/packages/s2-core/__tests__/bugs/issue-1781-spec.ts index c8a357c5b3..cd020df4f2 100644 --- a/packages/s2-core/__tests__/bugs/issue-1781-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-1781-spec.ts @@ -4,13 +4,6 @@ * https://github.com/antvis/S2/issues/1781 */ -import type { FederatedPointerEvent } from '@antv/g'; -import * as mockDataConfig from '../data/simple-table-data.json'; -import { - createFederatedMouseEvent, - getContainer, - sleep, -} from '../util/helpers'; import { OriginEventType, S2Event, @@ -18,6 +11,13 @@ import { type S2Options, } from '@/index'; import { TableSheet } from '@/sheet-type'; +import type { FederatedPointerEvent } from '@antv/g'; +import * as mockDataConfig from '../data/simple-table-data.json'; +import { + createFederatedMouseEvent, + getContainer, + sleep, +} from '../util/helpers'; const s2DataConfig: S2DataConfig = { ...mockDataConfig, diff --git a/packages/s2-core/__tests__/bugs/issue-2140-spec.ts b/packages/s2-core/__tests__/bugs/issue-2140-spec.ts index 8855f5fabc..fed4ecd3c1 100644 --- a/packages/s2-core/__tests__/bugs/issue-2140-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-2140-spec.ts @@ -4,10 +4,10 @@ * https://github.com/antvis/S2/issues/2140 */ -import { getContainer } from '../util/helpers'; -import * as mockDataConfig from '../data/simple-data.json'; import type { S2Options } from '@/index'; import { PivotSheet } from '@/sheet-type'; +import * as mockDataConfig from '../data/simple-data.json'; +import { getContainer } from '../util/helpers'; const s2Options: S2Options = { width: 400, diff --git a/packages/s2-core/__tests__/bugs/issue-2164-spec.ts b/packages/s2-core/__tests__/bugs/issue-2164-spec.ts index a9dde4113f..6e48a890ba 100644 --- a/packages/s2-core/__tests__/bugs/issue-2164-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-2164-spec.ts @@ -4,10 +4,10 @@ * https://github.com/antvis/S2/issues/2164 */ -import { getContainer } from '../util/helpers'; -import * as mockDataConfig from '../data/simple-data.json'; import { LayoutWidthType, type S2Options } from '@/index'; import { PivotSheet } from '@/sheet-type'; +import * as mockDataConfig from '../data/simple-data.json'; +import { getContainer } from '../util/helpers'; const s2Options: S2Options = { width: 400, diff --git a/packages/s2-core/__tests__/bugs/issue-2195-spec.ts b/packages/s2-core/__tests__/bugs/issue-2195-spec.ts index ed8c1e1d7f..7f4c6fa79d 100644 --- a/packages/s2-core/__tests__/bugs/issue-2195-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-2195-spec.ts @@ -5,9 +5,9 @@ * https://github.com/antvis/S2/issues/2195 */ -import { getContainer } from '../util/helpers'; import type { S2DataConfig, S2Options } from '@/index'; import { PivotSheet } from '@/sheet-type'; +import { getContainer } from '../util/helpers'; const modifiedMockDataConfig: S2DataConfig = { fields: { diff --git a/packages/s2-core/__tests__/bugs/issue-2199-spec.ts b/packages/s2-core/__tests__/bugs/issue-2199-spec.ts index 0df3c6c85b..f4bad022cc 100644 --- a/packages/s2-core/__tests__/bugs/issue-2199-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-2199-spec.ts @@ -3,10 +3,10 @@ * https://github.com/antvis/S2/issues/2199 * 明细表: 当有冻结列 + 列分组的情况下, 会出现列头文本不居中现象 */ +import type { S2Options } from '@/common/interface'; +import { TableSheet } from '@/sheet-type'; import { getContainer } from 'tests/util/helpers'; import dataCfg from '../data/data-issue-2199.json'; -import { TableSheet } from '@/sheet-type'; -import type { S2Options } from '@/common/interface'; const s2Options: S2Options = { width: 300, diff --git a/packages/s2-core/__tests__/bugs/issue-2322-spec.ts b/packages/s2-core/__tests__/bugs/issue-2322-spec.ts index cf8375ce0d..1fa4348ac1 100644 --- a/packages/s2-core/__tests__/bugs/issue-2322-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-2322-spec.ts @@ -3,11 +3,11 @@ * https://github.com/antvis/S2/issues/2322 * 明细表: 多列筛选后清空其中一列筛选,导致其他筛选也清空 */ -import { getContainer, sleep } from 'tests/util/helpers'; -import dataCfg from '../data/data-issue-2322.json'; import { S2Event } from '@/common'; import type { S2Options } from '@/common/interface'; import { TableSheet } from '@/sheet-type'; +import { getContainer, sleep } from 'tests/util/helpers'; +import dataCfg from '../data/data-issue-2322.json'; const s2Options: S2Options = { width: 800, diff --git a/packages/s2-core/__tests__/bugs/issue-2359-spec.ts b/packages/s2-core/__tests__/bugs/issue-2359-spec.ts index ec0d777158..03eefd7b4f 100644 --- a/packages/s2-core/__tests__/bugs/issue-2359-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-2359-spec.ts @@ -3,10 +3,10 @@ * https://github.com/antvis/S2/issues/2359 * 明细表: 自定义列头误用 dataCell 样式 */ +import type { S2CellType, S2Options } from '@/common/interface'; import { pick } from 'lodash'; import { createTableSheet } from 'tests/util/helpers'; import { TableColCell, drawCustomContent } from '../../src'; -import type { S2CellType, S2Options } from '@/common/interface'; class TestColCell extends TableColCell { drawTextShape() { diff --git a/packages/s2-core/__tests__/bugs/issue-2385-spec.ts b/packages/s2-core/__tests__/bugs/issue-2385-spec.ts index 3c3876f624..bdf59d2f33 100644 --- a/packages/s2-core/__tests__/bugs/issue-2385-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-2385-spec.ts @@ -2,10 +2,10 @@ * @description spec for issue #2385 * https://github.com/antvis/S2/issues/2385 */ +import { PivotSheet, SpreadSheet, TableSheet } from '@/sheet-type'; import { LayoutWidthType, type S2Options } from '../../src'; import * as mockDataConfig from '../data/data-issue-2385.json'; import { getContainer } from '../util/helpers'; -import { PivotSheet, SpreadSheet, TableSheet } from '@/sheet-type'; const s2Options: S2Options = { width: 800, diff --git a/packages/s2-core/__tests__/bugs/issue-2501-spec.ts b/packages/s2-core/__tests__/bugs/issue-2501-spec.ts index ac2670fce1..0d08b1eaaa 100644 --- a/packages/s2-core/__tests__/bugs/issue-2501-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-2501-spec.ts @@ -3,11 +3,11 @@ * https://github.com/antvis/S2/issues/2501 */ +import type { S2DataConfig, S2Options, SpreadSheet } from '@/index'; +import { TableSheet } from '@/sheet-type'; import type { TableFacet } from '../../src/facet'; import * as mockDataConfig from '../data/simple-table-data.json'; import { getContainer } from '../util/helpers'; -import type { SpreadSheet, S2DataConfig, S2Options } from '@/index'; -import { TableSheet } from '@/sheet-type'; const s2DataConfig: S2DataConfig = { ...mockDataConfig, diff --git a/packages/s2-core/__tests__/bugs/issue-2528-spec.ts b/packages/s2-core/__tests__/bugs/issue-2528-spec.ts index 7685c19cf6..a8d116a4f1 100644 --- a/packages/s2-core/__tests__/bugs/issue-2528-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-2528-spec.ts @@ -3,10 +3,10 @@ * https://github.com/antvis/S2/issues/2528 */ +import type { S2DataConfig, S2Options, SpreadSheet } from '@/index'; +import { TableSheet } from '@/sheet-type'; import * as mockDataConfig from '../data/simple-table-data.json'; import { getContainer } from '../util/helpers'; -import type { SpreadSheet, S2DataConfig, S2Options } from '@/index'; -import { TableSheet } from '@/sheet-type'; const s2DataConfig: S2DataConfig = { ...mockDataConfig, diff --git a/packages/s2-core/__tests__/bugs/issue-2582-spec.ts b/packages/s2-core/__tests__/bugs/issue-2582-spec.ts index f4755f351e..2aad883a9c 100644 --- a/packages/s2-core/__tests__/bugs/issue-2582-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-2582-spec.ts @@ -4,8 +4,8 @@ * https://github.com/antvis/S2/issues/2582 */ -import { createPivotSheet } from '../util/helpers'; import type { S2Options, SpreadSheet } from '@/index'; +import { createPivotSheet } from '../util/helpers'; const s2Options: S2Options = { width: 400, diff --git a/packages/s2-core/__tests__/bugs/issue-2684-spec.ts b/packages/s2-core/__tests__/bugs/issue-2684-spec.ts index c2c561a93d..57cb5e6eb5 100644 --- a/packages/s2-core/__tests__/bugs/issue-2684-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-2684-spec.ts @@ -4,12 +4,12 @@ * https://github.com/antvis/S2/issues/2684 */ +import type { CellMeta, S2Options, SpreadSheet } from '@/index'; import { isEmpty } from 'lodash'; import { InteractionStateName } from '../../src'; import { getSelectedData } from '../../src/utils/export/copy'; import * as mockDataConfig from '../data/data-issue-2684.json'; import { createPivotSheet } from '../util/helpers'; -import type { CellMeta, S2Options, SpreadSheet } from '@/index'; const s2Options: S2Options = { width: 600, diff --git a/packages/s2-core/__tests__/bugs/issue-2707-spec.ts b/packages/s2-core/__tests__/bugs/issue-2707-spec.ts index c07e6229ad..dd9c52a801 100644 --- a/packages/s2-core/__tests__/bugs/issue-2707-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-2707-spec.ts @@ -5,10 +5,10 @@ * https://github.com/antvis/S2/issues/2707 */ +import type { S2Options, SpreadSheet } from '@/index'; import { EMPTY_PLACEHOLDER } from '../../src'; import * as mockDataConfig from '../data/data-issue-2707.json'; import { createTableSheet } from '../util/helpers'; -import type { S2Options, SpreadSheet } from '@/index'; const s2Options: S2Options = { width: 800, diff --git a/packages/s2-core/__tests__/bugs/issue-2726-spec.ts b/packages/s2-core/__tests__/bugs/issue-2726-spec.ts index 991cfdafab..be7f61da6d 100644 --- a/packages/s2-core/__tests__/bugs/issue-2726-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-2726-spec.ts @@ -2,9 +2,9 @@ * @description spec for issue #2726 * https://github.com/antvis/S2/issues/2726 */ +import { SpreadSheet } from '@/sheet-type'; import { LayoutWidthType, type S2Options } from '../../src'; import { createPivotSheet } from '../util/helpers'; -import { SpreadSheet } from '@/sheet-type'; const s2Options: S2Options = { width: 800, diff --git a/packages/s2-core/__tests__/bugs/issue-292-spec.ts b/packages/s2-core/__tests__/bugs/issue-292-spec.ts index 6e9075ebda..4d0a878e75 100644 --- a/packages/s2-core/__tests__/bugs/issue-292-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-292-spec.ts @@ -4,10 +4,10 @@ * discussions: https://github.com/antvis/S2/discussions/384 * Wrong order of multi-values */ -import { getContainer } from '../util/helpers'; -import * as mockDataConfig from '../data/data-issue-292.json'; -import type { S2Options } from '../../src'; import { PivotSheet } from '@/sheet-type'; +import type { S2Options } from '../../src'; +import * as mockDataConfig from '../data/data-issue-292.json'; +import { getContainer } from '../util/helpers'; const s2Options: S2Options = { width: 800, diff --git a/packages/s2-core/__tests__/bugs/issue-368-spec.ts b/packages/s2-core/__tests__/bugs/issue-368-spec.ts index 816ca548b1..c5c0d2c427 100644 --- a/packages/s2-core/__tests__/bugs/issue-368-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-368-spec.ts @@ -4,10 +4,10 @@ * Wrong style when show the totals in multi-value mode * */ +import { PivotSheet, SpreadSheet } from '@/sheet-type'; import type { S2Options } from '../../src'; import * as mockDataConfig from '../data/data-issue-368.json'; import { getContainer } from '../util/helpers'; -import { PivotSheet, SpreadSheet } from '@/sheet-type'; const s2Options: S2Options = { width: 800, diff --git a/packages/s2-core/__tests__/bugs/issue-372-spec.ts b/packages/s2-core/__tests__/bugs/issue-372-spec.ts index 9daa59634e..c5c1ca769f 100644 --- a/packages/s2-core/__tests__/bugs/issue-372-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-372-spec.ts @@ -4,12 +4,12 @@ * Wrong position of grandTotal cells in multi-value mode * */ +import type { S2Options } from '@/common'; +import type { Node } from '@/facet/layout/node'; +import { PivotSheet } from '@/sheet-type'; import { find } from 'lodash'; import * as mockDataConfig from 'tests/data/data-issue-372.json'; import { getContainer } from 'tests/util/helpers'; -import { PivotSheet } from '@/sheet-type'; -import type { Node } from '@/facet/layout/node'; -import type { S2Options } from '@/common'; const s2Options: S2Options = { width: 800, diff --git a/packages/s2-core/__tests__/bugs/issue-446-spec.ts b/packages/s2-core/__tests__/bugs/issue-446-spec.ts index 459fb24ddc..929a678774 100644 --- a/packages/s2-core/__tests__/bugs/issue-446-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-446-spec.ts @@ -4,11 +4,11 @@ * #asyncGetAllPlainData error in table mode * */ -import { getContainer } from '../util/helpers'; -import * as mockDataConfig from '../data/data-issue-446.json'; -import { TAB_SEPARATOR, type S2Options } from '../../src'; import { TableSheet } from '@/sheet-type'; import { asyncGetAllPlainData } from '@/utils'; +import { TAB_SEPARATOR, type S2Options } from '../../src'; +import * as mockDataConfig from '../data/data-issue-446.json'; +import { getContainer } from '../util/helpers'; const s2Options: S2Options = { width: 800, diff --git a/packages/s2-core/__tests__/bugs/issue-507-spec.ts b/packages/s2-core/__tests__/bugs/issue-507-spec.ts index e05898ce9b..4211e28ac8 100644 --- a/packages/s2-core/__tests__/bugs/issue-507-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-507-spec.ts @@ -5,10 +5,10 @@ * */ +import { PivotSheet, type S2Options } from '@/index'; import { cloneDeep } from 'lodash'; -import { getContainer } from '../util/helpers'; import { valueInCols } from '../data/data-issue-507.json'; -import { type S2Options, PivotSheet } from '@/index'; +import { getContainer } from '../util/helpers'; const valueInRows = cloneDeep(valueInCols); diff --git a/packages/s2-core/__tests__/bugs/issue-511-spec.ts b/packages/s2-core/__tests__/bugs/issue-511-spec.ts index 6da5de900b..b100c2b0b1 100644 --- a/packages/s2-core/__tests__/bugs/issue-511-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-511-spec.ts @@ -3,10 +3,10 @@ * https://github.com/antvis/S2/issues/511 * The rendering data order does not match the data order */ -import { getContainer } from '../util/helpers'; -import * as mockDataConfig from '../data/data-issue-511.json'; -import type { S2Options } from '../../src'; import { PivotSheet } from '@/sheet-type'; +import type { S2Options } from '../../src'; +import * as mockDataConfig from '../data/data-issue-511.json'; +import { getContainer } from '../util/helpers'; const s2Options: S2Options = { width: 800, diff --git a/packages/s2-core/__tests__/bugs/issue-565-spec.ts b/packages/s2-core/__tests__/bugs/issue-565-spec.ts index d38bf67c43..811719d785 100644 --- a/packages/s2-core/__tests__/bugs/issue-565-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-565-spec.ts @@ -4,11 +4,11 @@ * #asyncGetAllPlainData error in tree mode * */ +import { PivotSheet } from '@/sheet-type'; +import { asyncGetAllPlainData } from '@/utils'; import * as mockDataConfig from 'tests/data/data-issue-565.json'; import { getContainer } from 'tests/util/helpers'; import { TAB_SEPARATOR, type S2Options } from '../../src'; -import { PivotSheet } from '@/sheet-type'; -import { asyncGetAllPlainData } from '@/utils'; const s2Options: S2Options = { width: 800, diff --git a/packages/s2-core/__tests__/bugs/issue-720-spec.ts b/packages/s2-core/__tests__/bugs/issue-720-spec.ts index 38a511b00f..81a6f3cc30 100644 --- a/packages/s2-core/__tests__/bugs/issue-720-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-720-spec.ts @@ -4,11 +4,11 @@ * Sync row scroll offset when corner cell resized * */ -import { getContainer } from 'tests/util/helpers'; -import * as mockDataConfig from 'tests/data/simple-data.json'; import { S2Event } from '@/common/constant'; -import { PivotSheet, SpreadSheet } from '@/sheet-type'; import type { S2Options } from '@/common/interface'; +import { PivotSheet, SpreadSheet } from '@/sheet-type'; +import * as mockDataConfig from 'tests/data/simple-data.json'; +import { getContainer } from 'tests/util/helpers'; const s2Options: S2Options = { width: 200, diff --git a/packages/s2-core/__tests__/bugs/issue-725-spec.ts b/packages/s2-core/__tests__/bugs/issue-725-spec.ts index ad503c135b..c80ad53757 100644 --- a/packages/s2-core/__tests__/bugs/issue-725-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-725-spec.ts @@ -5,11 +5,11 @@ * Wrong group sort */ -import * as mockDataConfig from 'tests/data/data-issue-725.json'; -import { assembleDataCfg } from '../util'; import type { S2DataConfig } from '@/common/interface'; import { PivotDataSet } from '@/data-set'; import { PivotSheet } from '@/sheet-type'; +import * as mockDataConfig from 'tests/data/data-issue-725.json'; +import { assembleDataCfg } from '../util'; jest.mock('@/sheet-type'); diff --git a/packages/s2-core/__tests__/bugs/issue-836-spec.ts b/packages/s2-core/__tests__/bugs/issue-836-spec.ts index 1a3493816c..d3697d7642 100644 --- a/packages/s2-core/__tests__/bugs/issue-836-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-836-spec.ts @@ -4,12 +4,12 @@ * 当列小记项大于两个时出现列头列小计总计漂移问题 * */ +import type { S2Options } from '@/common'; +import type { Node } from '@/facet/layout/node'; +import { PivotSheet } from '@/sheet-type'; import { find } from 'lodash'; import * as mockDataConfig from 'tests/data/data-issue-836.json'; import { getContainer } from 'tests/util/helpers'; -import { PivotSheet } from '@/sheet-type'; -import type { Node } from '@/facet/layout/node'; -import type { S2Options } from '@/common'; const s2Options: S2Options = { width: 1200, diff --git a/packages/s2-core/__tests__/bugs/issue-840-spec.ts b/packages/s2-core/__tests__/bugs/issue-840-spec.ts index f1ca1f2aa9..8e857f81f4 100644 --- a/packages/s2-core/__tests__/bugs/issue-840-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-840-spec.ts @@ -4,10 +4,10 @@ * Column should not be formatted * */ -import { getContainer } from 'tests/util/helpers'; -import * as mockDataConfig from 'tests/data/simple-data.json'; -import { TableSheet, SpreadSheet } from '@/sheet-type'; import type { S2DataConfig, S2Options } from '@/common/interface'; +import { SpreadSheet, TableSheet } from '@/sheet-type'; +import * as mockDataConfig from 'tests/data/simple-data.json'; +import { getContainer } from 'tests/util/helpers'; const s2Options: S2Options = { // 让被测试的单元格在首屏显示出来 diff --git a/packages/s2-core/__tests__/bugs/issue-860-spec.ts b/packages/s2-core/__tests__/bugs/issue-860-spec.ts index b0ee550371..51aeb52af5 100644 --- a/packages/s2-core/__tests__/bugs/issue-860-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-860-spec.ts @@ -4,10 +4,10 @@ * Column should not be formatted * */ +import type { S2Options } from '@/common/interface'; +import { PivotSheet, SpreadSheet } from '@/sheet-type'; import { getContainer } from 'tests/util/helpers'; import dataCfg from '../data/data-issue-860.json'; -import { PivotSheet, SpreadSheet } from '@/sheet-type'; -import type { S2Options } from '@/common/interface'; const s2Options: S2Options = { width: 600, diff --git a/packages/s2-core/__tests__/bugs/issue-868-spec.ts b/packages/s2-core/__tests__/bugs/issue-868-spec.ts index 9b7cac6a4c..0118fbca71 100644 --- a/packages/s2-core/__tests__/bugs/issue-868-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-868-spec.ts @@ -4,10 +4,10 @@ * measure not show the data type of the row header is number */ -import { getContainer } from '../util/helpers'; -import * as mockDataConfig from '../data/data-issue-868.json'; -import type { S2Options } from '../../src'; import { PivotSheet } from '@/sheet-type'; +import type { S2Options } from '../../src'; +import * as mockDataConfig from '../data/data-issue-868.json'; +import { getContainer } from '../util/helpers'; const s2Options: S2Options = { width: 800, 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 b87f851208..60c2ce7bca 100644 --- a/packages/s2-core/__tests__/spreadsheet/custom-cell-style-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/custom-cell-style-spec.ts @@ -1,16 +1,16 @@ +import { EXTRA_FIELD, type S2DataConfig } from '@/common'; +import type { S2Options } from '@/common/interface'; +import type { ViewMeta } from '@/common/interface/basic'; +import type { Node } from '@/facet/layout/node'; +import { PivotSheet, TableSheet, type SpreadSheet } from '@/sheet-type'; +import * as dataConfig from 'tests/data/mock-dataset.json'; +import * as simpleDataConfig from 'tests/data/simple-data.json'; import { createPivotSheet, createTableSheet, getContainer, } from 'tests/util/helpers'; -import * as dataConfig from 'tests/data/mock-dataset.json'; -import * as simpleDataConfig from 'tests/data/simple-data.json'; import { customColSimpleColumns } from '../data/custom-table-col-fields'; -import { EXTRA_FIELD, type S2DataConfig } from '@/common'; -import type { ViewMeta } from '@/common/interface/basic'; -import type { Node } from '@/facet/layout/node'; -import type { S2Options } from '@/common/interface'; -import { TableSheet, type SpreadSheet, PivotSheet } from '@/sheet-type'; describe('SpreadSheet Custom Cell Style Tests', () => { let s2: SpreadSheet; diff --git a/packages/s2-core/__tests__/spreadsheet/custom-grid-spec.ts b/packages/s2-core/__tests__/spreadsheet/custom-grid-spec.ts index 7726276e2c..f664bc8e7b 100644 --- a/packages/s2-core/__tests__/spreadsheet/custom-grid-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/custom-grid-spec.ts @@ -1,3 +1,5 @@ +import type { S2DataConfig, S2Options } from '@/common/interface'; +import { PivotSheet, SpreadSheet } from '@/sheet-type'; import type { Group } from '@antv/g'; import { pick } from 'lodash'; import { CustomGridData } from 'tests/data/data-custom-grid'; @@ -16,8 +18,6 @@ import { getTestTooltipData, mapCellNodeValues, } from '../util/interaction'; -import { PivotSheet, SpreadSheet } from '@/sheet-type'; -import type { S2DataConfig, S2Options } from '@/common/interface'; const s2Options: S2Options = { width: 600, 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 1a16ba40e9..71e247ad4e 100644 --- a/packages/s2-core/__tests__/spreadsheet/custom-table-col-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/custom-table-col-spec.ts @@ -1,6 +1,9 @@ +import type { S2DataConfig, S2Options } from '@/common/interface'; +import type { CustomRect } from '@/engine'; +import { SpreadSheet, TableSheet } from '@/sheet-type'; import type { Group } from '@antv/g'; -import { getContainer } from 'tests/util/helpers'; import { waitForRender } from 'tests/util'; +import { getContainer } from 'tests/util/helpers'; import { KEY_GROUP_COL_RESIZE_AREA } from '../../src/common/constant'; import { customColMultipleColumns, @@ -11,9 +14,6 @@ import { expectHighlightActiveNodes, mapCellNodeValues, } from '../util/interaction'; -import { SpreadSheet, TableSheet } from '@/sheet-type'; -import type { S2DataConfig, S2Options } from '@/common/interface'; -import type { CustomRect } from '@/engine'; const s2Options: S2Options = { width: 600, diff --git a/packages/s2-core/__tests__/spreadsheet/custom-tree-spec.ts b/packages/s2-core/__tests__/spreadsheet/custom-tree-spec.ts index 6a7d54f4a6..f3620ccf6f 100644 --- a/packages/s2-core/__tests__/spreadsheet/custom-tree-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/custom-tree-spec.ts @@ -1,3 +1,5 @@ +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'; @@ -10,8 +12,6 @@ import { getSelectedSum, getTestTooltipData, } from '../util/interaction'; -import { PivotSheet, SpreadSheet } from '@/sheet-type'; -import type { S2DataConfig, S2Options } from '@/common/interface'; const s2Options: S2Options = { width: 600, diff --git a/packages/s2-core/__tests__/spreadsheet/custom-value-order-spec.ts b/packages/s2-core/__tests__/spreadsheet/custom-value-order-spec.ts index 69f1752ae5..7f496e8090 100644 --- a/packages/s2-core/__tests__/spreadsheet/custom-value-order-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/custom-value-order-spec.ts @@ -1,7 +1,7 @@ +import type { S2DataConfig, S2Options } from '@/common/interface'; +import { PivotSheet, SpreadSheet } from '@/sheet-type'; import { getContainer } from 'tests/util/helpers'; import { pickMap } from '../util/fp'; -import { PivotSheet, SpreadSheet } from '@/sheet-type'; -import type { S2DataConfig, S2Options } from '@/common/interface'; const s2Options: S2Options = { width: 600, diff --git a/packages/s2-core/__tests__/spreadsheet/empty-dataset-spec.ts b/packages/s2-core/__tests__/spreadsheet/empty-dataset-spec.ts index 9f70f1426c..a8efa01132 100644 --- a/packages/s2-core/__tests__/spreadsheet/empty-dataset-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/empty-dataset-spec.ts @@ -1,8 +1,8 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ +import type { S2Options } from '@/common/interface/s2Options'; +import { PivotSheet, TableSheet } from '@/sheet-type'; import { getContainer } from 'tests/util/helpers'; import type { S2DataConfig } from '../../src'; -import { PivotSheet, TableSheet } from '@/sheet-type'; -import type { S2Options } from '@/common/interface/s2Options'; const s2Options: S2Options = { width: 400, 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 ea9933c33e..851bf34a5e 100644 --- a/packages/s2-core/__tests__/spreadsheet/empty-string-values-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/empty-string-values-spec.ts @@ -1,6 +1,6 @@ -import { getContainer } from 'tests/util/helpers'; import { LayoutWidthType, type S2DataConfig, type S2Options } from '@/common'; import { PivotSheet, SpreadSheet } from '@/sheet-type'; +import { getContainer } from 'tests/util/helpers'; const s2Options: S2Options = { debug: true, diff --git a/packages/s2-core/__tests__/spreadsheet/header-action-icons-spec.ts b/packages/s2-core/__tests__/spreadsheet/header-action-icons-spec.ts index 8f117c565a..c8133e48ee 100644 --- a/packages/s2-core/__tests__/spreadsheet/header-action-icons-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/header-action-icons-spec.ts @@ -1,5 +1,5 @@ import { get, pick } from 'lodash'; -import { type SpreadSheet, type S2Options, OriginEventType } from '../../src'; +import { OriginEventType, type S2Options, type SpreadSheet } from '../../src'; import { createFederatedMouseEvent, createPivotSheet } from '../util/helpers'; const s2Options: S2Options = { diff --git a/packages/s2-core/__tests__/spreadsheet/hidden-columns-spec.ts b/packages/s2-core/__tests__/spreadsheet/hidden-columns-spec.ts index 23c9a314b2..33e9d41edc 100644 --- a/packages/s2-core/__tests__/spreadsheet/hidden-columns-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/hidden-columns-spec.ts @@ -1,3 +1,5 @@ +import type { HiddenColumnsInfo, S2DataConfig, S2Options } from '@/common'; +import { PivotSheet, TableSheet } from '@/sheet-type'; import { difference, pick } from 'lodash'; import * as mockDataConfig from 'tests/data/mock-dataset.json'; import * as mockPivotDataConfig from 'tests/data/simple-data.json'; @@ -6,8 +8,6 @@ import { waitForRender } from 'tests/util'; import { createPivotSheet, getContainer } from 'tests/util/helpers'; import { customColGridSimpleFields } from '../data/custom-grid-simple-fields'; import { customColMultipleColumns } from '../data/custom-table-col-fields'; -import { PivotSheet, TableSheet } from '@/sheet-type'; -import type { HiddenColumnsInfo, S2DataConfig, S2Options } from '@/common'; const s2Options: S2Options = { width: 400, 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 d0d83bcb9a..9e40a0681e 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 @@ -1,22 +1,22 @@ /* eslint-disable jest/expect-expect */ -import { - createPivotSheet, - getContainer, - getMockData, - sleep, -} from 'tests/util/helpers'; import { BaseBrushSelection, DeviceType, InteractionName, - type S2DataConfig, + LayoutWidthType, S2Event, - type S2Options, - TableSheet, SpreadSheet, + TableSheet, type S2CellType, - LayoutWidthType, + type S2DataConfig, + type S2Options, } from '@/index'; +import { + createPivotSheet, + getContainer, + getMockData, + sleep, +} from 'tests/util/helpers'; const data = getMockData( '../../../s2-react/__tests__/data/tableau-supermarket.csv', diff --git a/packages/s2-core/__tests__/spreadsheet/interaction-corner-click-spec.ts b/packages/s2-core/__tests__/spreadsheet/interaction-corner-click-spec.ts index 51af0504ab..901968196d 100644 --- a/packages/s2-core/__tests__/spreadsheet/interaction-corner-click-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/interaction-corner-click-spec.ts @@ -1,3 +1,7 @@ +import { S2Event, SERIES_NUMBER_FIELD } from '@/common/constant'; +import { CornerNodeType, type S2Options } from '@/common/interface'; +import type { GEvent, HierarchyType, S2DataConfig } from '@/index'; +import { PivotSheet, SpreadSheet } from '@/sheet-type'; import { createMockCellInfo, createPivotSheet, @@ -8,10 +12,6 @@ import { customRowGridSimpleFields, } from '../data/custom-grid-simple-fields'; import { CustomGridData } from '../data/data-custom-grid'; -import { S2Event, SERIES_NUMBER_FIELD } from '@/common/constant'; -import { CornerNodeType, type S2Options } from '@/common/interface'; -import type { GEvent, HierarchyType, S2DataConfig } from '@/index'; -import { PivotSheet, SpreadSheet } from '@/sheet-type'; const s2Options: S2Options = { width: 600, 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 6cfd7af2e3..e1653d5431 100644 --- a/packages/s2-core/__tests__/spreadsheet/interaction-multi-selection-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/interaction-multi-selection-spec.ts @@ -1,3 +1,5 @@ +import type { HierarchyType, S2Options } from '@/common/interface'; +import { PivotSheet, SpreadSheet } from '@/sheet-type'; import * as mockDataConfig from 'tests/data/simple-data.json'; import { createMockCellInfo, @@ -5,15 +7,13 @@ import { getContainer, sleep, } from 'tests/util/helpers'; +import { CellType, InteractionStateName } from '../../src'; import { expectHighlightActiveNodes, getSelectedCount, getSelectedSum, getTestTooltipData, } from '../util/interaction'; -import { CellType, InteractionStateName } from '../../src'; -import { PivotSheet, SpreadSheet } from '@/sheet-type'; -import type { HierarchyType, S2Options } from '@/common/interface'; const s2Options: S2Options = { width: 600, diff --git a/packages/s2-core/__tests__/spreadsheet/interaction-spotlight-spec.ts b/packages/s2-core/__tests__/spreadsheet/interaction-spotlight-spec.ts index 7ed909c342..9e70b2837c 100644 --- a/packages/s2-core/__tests__/spreadsheet/interaction-spotlight-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/interaction-spotlight-spec.ts @@ -1,8 +1,8 @@ -import { createPivotSheet } from 'tests/util/helpers'; +import { InteractionStateName } from '@/common'; import type { S2Options } from '@/common/interface'; import type { SpreadSheet } from '@/sheet-type'; import { getCellMeta } from '@/utils'; -import { InteractionStateName } from '@/common'; +import { createPivotSheet } from 'tests/util/helpers'; const s2Options: S2Options = { width: 600, diff --git a/packages/s2-core/__tests__/spreadsheet/interaction-tooltip-spec.ts b/packages/s2-core/__tests__/spreadsheet/interaction-tooltip-spec.ts index 3a87cb1724..242c4ca05e 100644 --- a/packages/s2-core/__tests__/spreadsheet/interaction-tooltip-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/interaction-tooltip-spec.ts @@ -1,9 +1,9 @@ -import * as mockDataConfig from 'tests/data/simple-data.json'; -import { createMockCellInfo, getContainer } from 'tests/util/helpers'; +import { S2Event } from '@/common/constant'; +import type { S2Options } from '@/common/interface'; import type { GEvent } from '@/index'; import { PivotSheet, SpreadSheet } from '@/sheet-type'; -import type { S2Options } from '@/common/interface'; -import { S2Event } from '@/common/constant'; +import * as mockDataConfig from 'tests/data/simple-data.json'; +import { createMockCellInfo, getContainer } from 'tests/util/helpers'; const s2Options: S2Options = { width: 600, diff --git a/packages/s2-core/__tests__/spreadsheet/layout-hooks-spec.ts b/packages/s2-core/__tests__/spreadsheet/layout-hooks-spec.ts index f65d059715..08c46180d7 100644 --- a/packages/s2-core/__tests__/spreadsheet/layout-hooks-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/layout-hooks-spec.ts @@ -1,12 +1,12 @@ import { + Node, + PivotSheet, + generateId, + type LayoutHierarchyReturnType, type S2DataConfig, + type S2Options, type SpreadSheet, - type LayoutHierarchyReturnType, - generateId, type ViewMeta, - type S2Options, - PivotSheet, - Node, } from '../../src'; import { getContainer, getMockData } from '../util/helpers'; diff --git a/packages/s2-core/__tests__/spreadsheet/miss-dimension-values-spec.ts b/packages/s2-core/__tests__/spreadsheet/miss-dimension-values-spec.ts index 61a54f9528..5074c64f24 100644 --- a/packages/s2-core/__tests__/spreadsheet/miss-dimension-values-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/miss-dimension-values-spec.ts @@ -1,4 +1,3 @@ -import { getContainer } from 'tests/util/helpers'; import { EMPTY_FIELD_VALUE, LayoutWidthType, @@ -7,6 +6,7 @@ import { type S2Options, } from '@/common'; import { PivotSheet, SpreadSheet } from '@/sheet-type'; +import { getContainer } from 'tests/util/helpers'; const s2Options: S2Options = { debug: true, 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 bf07f1fb05..d631b8a822 100644 --- a/packages/s2-core/__tests__/spreadsheet/multi-line-text-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/multi-line-text-spec.ts @@ -1,10 +1,10 @@ /* eslint-disable jest/expect-expect */ -import { getContainer } from 'tests/util/helpers'; import { range } from 'lodash'; +import { getContainer } from 'tests/util/helpers'; import { + EXTRA_FIELD, PivotSheet, TableSheet, - EXTRA_FIELD, type SpreadSheet, type TableFacet, } from '../../src'; diff --git a/packages/s2-core/__tests__/spreadsheet/row-link-spec.ts b/packages/s2-core/__tests__/spreadsheet/row-link-spec.ts index 18dd45ec8e..1c133e8cff 100644 --- a/packages/s2-core/__tests__/spreadsheet/row-link-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/row-link-spec.ts @@ -1,7 +1,7 @@ -import { getContainer } from 'tests/util/helpers'; -import { noop } from 'lodash'; -import { PivotSheet } from '@/sheet-type'; import { S2Event, type S2DataConfig, type S2Options } from '@/common'; +import { PivotSheet } from '@/sheet-type'; +import { noop } from 'lodash'; +import { getContainer } from 'tests/util/helpers'; const s2Options: S2Options = { width: 400, diff --git a/packages/s2-core/__tests__/spreadsheet/scroll-spec.ts b/packages/s2-core/__tests__/spreadsheet/scroll-spec.ts index cf1085f568..755742254f 100644 --- a/packages/s2-core/__tests__/spreadsheet/scroll-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/scroll-spec.ts @@ -1,16 +1,5 @@ /* eslint-disable jest/expect-expect */ /* eslint-disable jest/no-conditional-expect */ -import * as mockDataConfig from 'tests/data/simple-data.json'; -import { createMockCellInfo, getContainer, sleep } from 'tests/util/helpers'; -import { cloneDeep, get } from 'lodash'; -import { ScrollBar, ScrollType } from '../../src/ui/scrollbar'; -import type { CellScrollPosition } from './../../src/common/interface/scroll'; -import { PivotSheet, SpreadSheet } from '@/sheet-type'; -import type { - CellMeta, - InteractionOptions, - S2Options, -} from '@/common/interface'; import { InteractionStateName, InterceptType, @@ -19,6 +8,17 @@ import { S2Event, ScrollbarPositionType, } from '@/common/constant'; +import type { + CellMeta, + InteractionOptions, + S2Options, +} from '@/common/interface'; +import { PivotSheet, SpreadSheet } from '@/sheet-type'; +import { cloneDeep, get } from 'lodash'; +import * as mockDataConfig from 'tests/data/simple-data.json'; +import { createMockCellInfo, getContainer, sleep } from 'tests/util/helpers'; +import { ScrollBar, ScrollType } from '../../src/ui/scrollbar'; +import type { CellScrollPosition } from './../../src/common/interface/scroll'; const s2Options: S2Options = { width: 200, diff --git a/packages/s2-core/__tests__/spreadsheet/sort-by-order-spec.ts b/packages/s2-core/__tests__/spreadsheet/sort-by-order-spec.ts index 18a1c7d09f..e0c57aa402 100644 --- a/packages/s2-core/__tests__/spreadsheet/sort-by-order-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/sort-by-order-spec.ts @@ -1,7 +1,7 @@ /* eslint-disable jest/expect-expect */ -import { getContainer } from 'tests/util/helpers'; +import { EXTRA_FIELD, S2DataConfig, S2Options, TOTAL_VALUE } from '@/common'; import { PivotSheet } from '@/sheet-type'; -import { S2DataConfig, S2Options, TOTAL_VALUE, EXTRA_FIELD } from '@/common'; +import { getContainer } from 'tests/util/helpers'; const s2Options: S2Options = { width: 400, 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 a791828dc0..1e31d020dd 100644 --- a/packages/s2-core/__tests__/spreadsheet/spread-sheet-collapse-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/spread-sheet-collapse-spec.ts @@ -1,3 +1,5 @@ +import type { Node } from '@/facet/layout/node'; +import { PivotSheet, SpreadSheet } from '@/sheet-type'; import * as mockDataConfig from 'tests/data/simple-data.json'; import { createPivotSheet, getContainer, sleep } from 'tests/util/helpers'; import { @@ -9,8 +11,6 @@ import { import { customRowGridFields } from '../data/custom-grid-fields'; import { CustomGridData } from '../data/data-custom-grid'; import { S2Event } from './../../src/common/constant/events/basic'; -import { PivotSheet, SpreadSheet } from '@/sheet-type'; -import type { Node } from '@/facet/layout/node'; describe('SpreadSheet Collapse/Expand Tests', () => { let container: HTMLElement; diff --git a/packages/s2-core/__tests__/spreadsheet/spread-sheet-frozen-spec.ts b/packages/s2-core/__tests__/spreadsheet/spread-sheet-frozen-spec.ts index 57a5eb3932..601fbf1660 100644 --- a/packages/s2-core/__tests__/spreadsheet/spread-sheet-frozen-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/spread-sheet-frozen-spec.ts @@ -1,11 +1,11 @@ -import * as mockDataConfig from 'tests/data/mock-dataset.json'; -import { getContainer } from 'tests/util/helpers'; import { map, merge } from 'lodash'; -import { CustomGridData } from 'tests/data/data-custom-grid'; import { customRowGridFields } from 'tests/data/custom-grid-fields'; +import { CustomGridData } from 'tests/data/data-custom-grid'; +import * as mockDataConfig from 'tests/data/mock-dataset.json'; +import { getContainer } from 'tests/util/helpers'; import { - type FrozenFacet, PivotSheet, + type FrozenFacet, type S2DataConfig, type S2Options, } from '../../src'; diff --git a/packages/s2-core/__tests__/spreadsheet/spread-sheet-resize-spec.ts b/packages/s2-core/__tests__/spreadsheet/spread-sheet-resize-spec.ts index 4c2abe2f06..1c9b3ecfe8 100644 --- a/packages/s2-core/__tests__/spreadsheet/spread-sheet-resize-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/spread-sheet-resize-spec.ts @@ -1,12 +1,12 @@ +import type { Group } from '@antv/g'; import * as mockDataConfig from 'tests/data/simple-data.json'; import { getContainer } from 'tests/util/helpers'; -import type { Group } from '@antv/g'; import { - type S2Options, - PivotSheet, - KEY_GROUP_ROW_RESIZE_AREA, - KEY_GROUP_CORNER_RESIZE_AREA, KEY_GROUP_COL_RESIZE_AREA, + KEY_GROUP_CORNER_RESIZE_AREA, + KEY_GROUP_ROW_RESIZE_AREA, + PivotSheet, + type S2Options, } from '../../src'; async function renderSheet(options?: S2Options) { diff --git a/packages/s2-core/__tests__/spreadsheet/spread-sheet-series-number-spec.ts b/packages/s2-core/__tests__/spreadsheet/spread-sheet-series-number-spec.ts index 5153995acc..bfdef1978b 100644 --- a/packages/s2-core/__tests__/spreadsheet/spread-sheet-series-number-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/spread-sheet-series-number-spec.ts @@ -1,6 +1,6 @@ import * as mockDataConfig from 'tests/data/simple-data.json'; import { getContainer } from 'tests/util/helpers'; -import { type S2Options, PivotSheet } from '../../src'; +import { PivotSheet, type S2Options } from '../../src'; const s2Options: S2Options = { width: 400, diff --git a/packages/s2-core/__tests__/spreadsheet/spread-sheet-spec.ts b/packages/s2-core/__tests__/spreadsheet/spread-sheet-spec.ts index f81b5d606b..95b7bfcda6 100644 --- a/packages/s2-core/__tests__/spreadsheet/spread-sheet-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/spread-sheet-spec.ts @@ -1,14 +1,14 @@ -import * as mockDataConfig from 'tests/data/simple-data.json'; -import { createPivotSheet, getContainer, sleep } from 'tests/util/helpers'; -import { pick } from 'lodash'; -import { CanvasEvent, type CanvasContext } from '@antv/g'; -import { PivotSheet, SpreadSheet, TableSheet } from '@/sheet-type'; import { DEFAULT_OPTIONS, S2Event, type S2Options, type TextTheme, } from '@/common'; +import { PivotSheet, SpreadSheet, TableSheet } from '@/sheet-type'; +import { CanvasEvent, type CanvasContext } from '@antv/g'; +import { pick } from 'lodash'; +import * as mockDataConfig from 'tests/data/simple-data.json'; +import { createPivotSheet, getContainer, sleep } from 'tests/util/helpers'; const s2Options: S2Options = { width: 200, diff --git a/packages/s2-core/__tests__/spreadsheet/spread-sheet-totals-spec.ts b/packages/s2-core/__tests__/spreadsheet/spread-sheet-totals-spec.ts index 666aff715c..a4ff8986f1 100644 --- a/packages/s2-core/__tests__/spreadsheet/spread-sheet-totals-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/spread-sheet-totals-spec.ts @@ -1,10 +1,10 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ -import { merge } from 'lodash'; -import { assembleDataCfg, assembleOptions, TOTALS_OPTIONS } from 'tests/util'; -import { getContainer } from 'tests/util/helpers'; import type { RawData, S2DataConfig, S2Options } from '@/common'; import type { Node } from '@/facet/layout/node'; import { PivotSheet } from '@/sheet-type'; +import { merge } from 'lodash'; +import { TOTALS_OPTIONS, assembleDataCfg, assembleOptions } from 'tests/util'; +import { getContainer } from 'tests/util/helpers'; describe('Spreadsheet Totals Tests', () => { let spreadsheet: PivotSheet; diff --git a/packages/s2-core/__tests__/spreadsheet/spread-sheet-tree-mode-spec.ts b/packages/s2-core/__tests__/spreadsheet/spread-sheet-tree-mode-spec.ts index 0134c6e6c9..4e29a6a7cf 100644 --- a/packages/s2-core/__tests__/spreadsheet/spread-sheet-tree-mode-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/spread-sheet-tree-mode-spec.ts @@ -1,7 +1,7 @@ +import type { S2DataConfig, S2Options } from '@/common'; import * as mockDataConfig from 'tests/data/simple-data.json'; import { createPivotSheet, getContainer } from 'tests/util/helpers'; import { CornerNodeType, PivotSheet } from '../../src'; -import type { S2DataConfig, S2Options } from '@/common'; const s2Options: S2Options = { width: 200, diff --git a/packages/s2-core/__tests__/spreadsheet/table-resize-spec.ts b/packages/s2-core/__tests__/spreadsheet/table-resize-spec.ts index bd1d301376..724d1bf965 100644 --- a/packages/s2-core/__tests__/spreadsheet/table-resize-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/table-resize-spec.ts @@ -1,8 +1,8 @@ +import { KEY_GROUP_ROW_RESIZE_AREA } from '@/common/constant'; +import { TableSheet } from '@/sheet-type'; import type { Group } from '@antv/g'; -import { getContainer } from '../util/helpers'; import * as mockDataConfig from '../data/simple-table-data.json'; -import { TableSheet } from '@/sheet-type'; -import { KEY_GROUP_ROW_RESIZE_AREA } from '@/common/constant'; +import { getContainer } from '../util/helpers'; describe('Table Sheet Resize Test', () => { test('should draw resize area in series cell when show series', async () => { diff --git a/packages/s2-core/__tests__/spreadsheet/table-sheet-spec.ts b/packages/s2-core/__tests__/spreadsheet/table-sheet-spec.ts index d758d29d69..c3a8e156dd 100644 --- a/packages/s2-core/__tests__/spreadsheet/table-sheet-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/table-sheet-spec.ts @@ -1,16 +1,16 @@ /* eslint-disable jest/expect-expect */ -import { getContainer, getMockData, sleep } from 'tests/util/helpers'; -import type { TableColHeader } from '../../src/facet/header/table-col'; -import { SpreadSheet, TableFacet, setLang } from '../../src'; import { DeviceType, + LayoutWidthType, ResizeType, TableSheet, type RawData, type S2DataConfig, type S2Options, - LayoutWidthType, } from '@/index'; +import { getContainer, getMockData, sleep } from 'tests/util/helpers'; +import { SpreadSheet, TableFacet, setLang } from '../../src'; +import type { TableColHeader } from '../../src/facet/header/table-col'; const data = getMockData( '../../../s2-react/__tests__/data/tableau-supermarket.csv', diff --git a/packages/s2-core/__tests__/spreadsheet/theme-spec.ts b/packages/s2-core/__tests__/spreadsheet/theme-spec.ts index 400f4900f5..1bccef59be 100644 --- a/packages/s2-core/__tests__/spreadsheet/theme-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/theme-spec.ts @@ -1,5 +1,4 @@ /* eslint-disable jest/expect-expect */ -import { createPivotSheet, createTableSheet } from 'tests/util/helpers'; import { CellType, EXTRA_COLUMN_FIELD, @@ -15,6 +14,7 @@ import type { } from '@/common/interface/theme'; import type { Node } from '@/facet/layout/node'; import type { PivotSheet } from '@/sheet-type'; +import { createPivotSheet, createTableSheet } from 'tests/util/helpers'; describe('SpreadSheet Theme Tests', () => { let s2: PivotSheet; diff --git a/packages/s2-core/__tests__/spreadsheet/tooltip-spec.ts b/packages/s2-core/__tests__/spreadsheet/tooltip-spec.ts index e45018bd36..531a477fda 100644 --- a/packages/s2-core/__tests__/spreadsheet/tooltip-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/tooltip-spec.ts @@ -1,5 +1,5 @@ -import { createPivotSheet } from 'tests/util/helpers'; import type { S2Options } from '@/common/interface'; +import { createPivotSheet } from 'tests/util/helpers'; const s2Options: S2Options = { width: 300, diff --git a/packages/s2-core/__tests__/spreadsheet/total-group-spec.ts b/packages/s2-core/__tests__/spreadsheet/total-group-spec.ts index ad9dc88e11..b69aa009ba 100644 --- a/packages/s2-core/__tests__/spreadsheet/total-group-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/total-group-spec.ts @@ -1,10 +1,10 @@ -import { getContainer } from 'tests/util/helpers'; +import { ORIGIN_FIELD, type S2Options } from '@/common'; +import { PivotSheet } from '@/sheet-type'; import { map } from 'lodash'; -import { s2Options, dataCfg } from '../data/total-group-data'; +import { getContainer } from 'tests/util/helpers'; import { CellData, S2DataConfig } from '../../src'; import type { PivotFacet } from '../../src/facet'; -import { PivotSheet } from '@/sheet-type'; -import { type S2Options, ORIGIN_FIELD } from '@/common'; +import { dataCfg, s2Options } from '../data/total-group-data'; describe('Total Group Dimension Test', () => { let container: HTMLDivElement; diff --git a/packages/s2-core/__tests__/unit/cell/col-cell-spec.ts b/packages/s2-core/__tests__/unit/cell/col-cell-spec.ts index b1a6e65f93..379237665c 100644 --- a/packages/s2-core/__tests__/unit/cell/col-cell-spec.ts +++ b/packages/s2-core/__tests__/unit/cell/col-cell-spec.ts @@ -1,14 +1,14 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ -import { set } from 'lodash'; -import { createFakeSpreadSheet, createPivotSheet } from 'tests/util/helpers'; -import type { ColHeaderConfig } from '../../../src/facet/header'; -import { FrozenGroupArea } from '../../../src/common'; -import { getContainer } from './../../util/helpers'; import { ColCell } from '@/cell'; import { EXTRA_FIELD, type Formatter, type TextAlign } from '@/common'; import { PivotDataSet } from '@/data-set'; import type { Node } from '@/facet/layout/node'; import { PivotSheet, SpreadSheet } from '@/sheet-type'; +import { set } from 'lodash'; +import { createFakeSpreadSheet, createPivotSheet } from 'tests/util/helpers'; +import { FrozenGroupArea } from '../../../src/common'; +import type { ColHeaderConfig } from '../../../src/facet/header'; +import { getContainer } from './../../util/helpers'; const MockPivotSheet = PivotSheet as unknown as jest.Mock; const MockPivotDataSet = PivotDataSet as unknown as jest.Mock; diff --git a/packages/s2-core/__tests__/unit/cell/corner-cell-spec.ts b/packages/s2-core/__tests__/unit/cell/corner-cell-spec.ts index 1cd114bdcd..8bed57963d 100644 --- a/packages/s2-core/__tests__/unit/cell/corner-cell-spec.ts +++ b/packages/s2-core/__tests__/unit/cell/corner-cell-spec.ts @@ -1,8 +1,8 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ -import { createPivotSheet } from 'tests/util/helpers'; -import { CornerCell } from './../../../src/cell/corner-cell'; import type { Node } from '@/facet/layout/node'; import type { SpreadSheet } from '@/sheet-type'; +import { createPivotSheet } from 'tests/util/helpers'; +import { CornerCell } from './../../../src/cell/corner-cell'; describe('Corner Cell Tests', () => { let s2: SpreadSheet; diff --git a/packages/s2-core/__tests__/unit/cell/custom-tree-corner-cell-spec.ts b/packages/s2-core/__tests__/unit/cell/custom-tree-corner-cell-spec.ts index 68d3041791..0ace3d1977 100644 --- a/packages/s2-core/__tests__/unit/cell/custom-tree-corner-cell-spec.ts +++ b/packages/s2-core/__tests__/unit/cell/custom-tree-corner-cell-spec.ts @@ -1,12 +1,12 @@ /** * custom-tree mode. */ +import type { S2DataConfig } from '@/common/interface'; +import { type S2Options } from '@/index'; +import { PivotSheet, SpreadSheet } from '@/sheet-type'; import { customTreeNodes } from 'tests/data/custom-tree-nodes'; import { CustomTreeData } from 'tests/data/data-custom-tree'; import { getContainer } from 'tests/util/helpers'; -import type { S2DataConfig } from '@/common/interface'; -import { PivotSheet, SpreadSheet } from '@/sheet-type'; -import { type S2Options } from '@/index'; describe('test for corner text', () => { const values: string[] = [ 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 de72f7ae68..2f40170167 100644 --- a/packages/s2-core/__tests__/unit/cell/data-cell-spec.ts +++ b/packages/s2-core/__tests__/unit/cell/data-cell-spec.ts @@ -1,13 +1,10 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ -import type { Rect } from '@antv/g'; -import { find, get, keys } from 'lodash'; -import { createPivotSheet, createTableSheet } from 'tests/util/helpers'; import { DataCell } from '@/cell'; -import type { TextAlign } from '@/common'; import { CellType, GuiIcon, S2Event, + TextAlign, type Formatter, type OriginalEvent, type S2CellType, @@ -21,6 +18,9 @@ import { EXTRA_FIELD, VALUE_FIELD } from '@/common/constant/field'; import { PivotDataSet } from '@/data-set'; import type { PivotFacet } from '@/facet'; import { PivotSheet, SpreadSheet } from '@/sheet-type'; +import type { Rect } from '@antv/g'; +import { find, get, keys } from 'lodash'; +import { createPivotSheet, createTableSheet } from 'tests/util/helpers'; const MockPivotSheet = PivotSheet as unknown as jest.Mock; const MockPivotDataSet = PivotDataSet as unknown as jest.Mock; diff --git a/packages/s2-core/__tests__/unit/cell/header-cell-spec.ts b/packages/s2-core/__tests__/unit/cell/header-cell-spec.ts index 0a95b1cbe2..bcc625fe99 100644 --- a/packages/s2-core/__tests__/unit/cell/header-cell-spec.ts +++ b/packages/s2-core/__tests__/unit/cell/header-cell-spec.ts @@ -1,14 +1,14 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ +import { ColCell, CornerCell, RowCell, TableColCell } from '@/cell'; import { FrozenGroupArea, type Formatter, type HeaderActionIcon, } from '@/common'; import { PivotDataSet, TableDataSet } from '@/data-set'; -import { PivotSheet, SpreadSheet, TableSheet } from '@/sheet-type'; -import { ColCell, CornerCell, RowCell, TableColCell } from '@/cell'; import { TableFacet } from '@/facet'; import { Node } from '@/facet/layout/node'; +import { PivotSheet, SpreadSheet, TableSheet } from '@/sheet-type'; const MockPivotSheet = PivotSheet as unknown as jest.Mock; const MockPivotDataSet = PivotDataSet as unknown as jest.Mock; diff --git a/packages/s2-core/__tests__/unit/cell/merged-cell-spec.ts b/packages/s2-core/__tests__/unit/cell/merged-cell-spec.ts index 46a89dc7de..7e789162c4 100644 --- a/packages/s2-core/__tests__/unit/cell/merged-cell-spec.ts +++ b/packages/s2-core/__tests__/unit/cell/merged-cell-spec.ts @@ -1,6 +1,4 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ -import { CellType } from '../../../src/common/constant'; -import { createMockCellInfo } from '../../util/helpers'; import { MergedCell } from '@/cell'; import { GuiIcon, type ViewMeta } from '@/common'; import { EXTRA_FIELD, VALUE_FIELD } from '@/common/constant/field'; @@ -8,6 +6,8 @@ import { PivotDataSet } from '@/data-set'; import type { PivotFacet } from '@/facet'; import { PivotSheet, SpreadSheet } from '@/sheet-type'; import { renderText } from '@/utils/g-renders'; +import { CellType } from '../../../src/common/constant'; +import { createMockCellInfo } from '../../util/helpers'; const MockPivotSheet = PivotSheet as unknown as jest.Mock; const MockPivotDataSet = PivotDataSet as unknown as jest.Mock; diff --git a/packages/s2-core/__tests__/unit/cell/row-cell-spec.ts b/packages/s2-core/__tests__/unit/cell/row-cell-spec.ts index e3fe33cb58..326839459d 100644 --- a/packages/s2-core/__tests__/unit/cell/row-cell-spec.ts +++ b/packages/s2-core/__tests__/unit/cell/row-cell-spec.ts @@ -1,7 +1,7 @@ -import { createPivotSheet } from 'tests/util/helpers'; -import { RowCell } from '../../../src/cell/row-cell'; import type { TextAlign } from '@/common'; import type { SpreadSheet } from '@/sheet-type'; +import { createPivotSheet } from 'tests/util/helpers'; +import { RowCell } from '../../../src/cell/row-cell'; describe('Row Cell Tests', () => { describe('Link Shape Tests', () => { diff --git a/packages/s2-core/__tests__/unit/common/icons/gui-icon-spec.ts b/packages/s2-core/__tests__/unit/common/icons/gui-icon-spec.ts index f8a705c71d..2e906ade8d 100644 --- a/packages/s2-core/__tests__/unit/common/icons/gui-icon-spec.ts +++ b/packages/s2-core/__tests__/unit/common/icons/gui-icon-spec.ts @@ -1,9 +1,9 @@ -import { Group } from '@antv/g'; -import { registerIcon } from '../../../../src/common/icons'; -import { sleep, createPivotSheet } from '../../../util/helpers'; -import { CustomImage } from '@/engine/CustomImage'; import { GuiIcon } from '@/common/icons/gui-icon'; import { ArrowDown } from '@/common/icons/svg/svgs'; +import { CustomImage } from '@/engine/CustomImage'; +import { Group } from '@antv/g'; +import { registerIcon } from '../../../../src/common/icons'; +import { createPivotSheet, sleep } from '../../../util/helpers'; describe('GuiIcon Tests', () => { test('should get gui icon static type', () => { diff --git a/packages/s2-core/__tests__/unit/data-process/pivot-spec.tsx b/packages/s2-core/__tests__/unit/data-process/pivot-spec.tsx index 46aad739bd..750a37fead 100644 --- a/packages/s2-core/__tests__/unit/data-process/pivot-spec.tsx +++ b/packages/s2-core/__tests__/unit/data-process/pivot-spec.tsx @@ -2,15 +2,15 @@ * 透视表核心数据流程(保证基本数据正确) * */ -import { flattenDeep, get, uniq } from 'lodash'; -import { assembleDataCfg, assembleOptions } from '../../util'; -import { getContainer } from '../../util/helpers'; -import { data } from '../../data/mock-dataset.json'; -import type { ViewMeta } from '../../../src/common'; -import type { CellData } from '../../../src'; import { VALUE_FIELD } from '@/common/constant'; import type { PivotDataSet } from '@/data-set/pivot-data-set'; import { PivotSheet, SpreadSheet } from '@/sheet-type'; +import { flattenDeep, get, uniq } from 'lodash'; +import type { CellData } from '../../../src'; +import type { ViewMeta } from '../../../src/common'; +import { data } from '../../data/mock-dataset.json'; +import { assembleDataCfg, assembleOptions } from '../../util'; +import { getContainer } from '../../util/helpers'; describe('Pivot Table Core Data Process', () => { let s2: SpreadSheet; diff --git a/packages/s2-core/__tests__/unit/data-process/table-spec.tsx b/packages/s2-core/__tests__/unit/data-process/table-spec.tsx index 547cec9ed5..92fac68bab 100644 --- a/packages/s2-core/__tests__/unit/data-process/table-spec.tsx +++ b/packages/s2-core/__tests__/unit/data-process/table-spec.tsx @@ -4,10 +4,10 @@ * - 明细表不需要计算二维数组数据 * - 明细表不需要生成 Row Hierarchy(但为了流程一致会生成空结构) */ +import { SpreadSheet, TableSheet } from '@/sheet-type'; +import { ROOT_NODE_ID } from '../../../src'; import { assembleDataCfg, assembleOptions } from '../../util'; import { getContainer } from '../../util/helpers'; -import { ROOT_NODE_ID } from '../../../src'; -import { SpreadSheet, TableSheet } from '@/sheet-type'; describe('List Table Core Data Process', () => { let s2: SpreadSheet; 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-tree-data-set-spec.ts index 34b2cc9a8c..4c7a8110f3 100644 --- a/packages/s2-core/__tests__/unit/data-set/custom-tree-data-set-spec.ts +++ b/packages/s2-core/__tests__/unit/data-set/custom-tree-data-set-spec.ts @@ -1,13 +1,13 @@ /** * custom-tree mode base data-set test. */ +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 { 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 type { S2DataConfig } from '@/common/interface'; -import { EXTRA_FIELD, ORIGIN_FIELD } from '@/common/constant'; -import { PivotSheet } from '@/sheet-type'; -import { CustomTreePivotDataSet } from '@/data-set/custom-tree-pivot-data-set'; jest.mock('@/sheet-type'); diff --git a/packages/s2-core/__tests__/unit/data-set/pivot-data-set-row-value-spec.ts b/packages/s2-core/__tests__/unit/data-set/pivot-data-set-row-value-spec.ts index 40ba2a4ccf..c04b7dd624 100644 --- a/packages/s2-core/__tests__/unit/data-set/pivot-data-set-row-value-spec.ts +++ b/packages/s2-core/__tests__/unit/data-set/pivot-data-set-row-value-spec.ts @@ -1,15 +1,15 @@ /** * pivot mode data-set test when value in row. */ -import { get, keys } from 'lodash'; -import { data } from 'tests/data/mock-dataset.json'; -import { assembleDataCfg } from '../../util'; import { EXTRA_FIELD, VALUE_FIELD } from '@/common/constant'; import type { S2DataConfig } from '@/common/interface'; -import { PivotSheet } from '@/sheet-type'; -import { PivotDataSet } from '@/data-set/pivot-data-set'; import { Store } from '@/common/store'; +import { PivotDataSet } from '@/data-set/pivot-data-set'; +import { PivotSheet } from '@/sheet-type'; import { getDimensionsWithoutPathPre } from '@/utils/dataset/pivot-data-set'; +import { get, keys } from 'lodash'; +import { data } from 'tests/data/mock-dataset.json'; +import { assembleDataCfg } from '../../util'; jest.mock('@/sheet-type'); jest.mock('@/facet/layout/node'); diff --git a/packages/s2-core/__tests__/unit/data-set/pivot-data-set-spec.ts b/packages/s2-core/__tests__/unit/data-set/pivot-data-set-spec.ts index 998e7acf04..e5212971ff 100644 --- a/packages/s2-core/__tests__/unit/data-set/pivot-data-set-spec.ts +++ b/packages/s2-core/__tests__/unit/data-set/pivot-data-set-spec.ts @@ -1,31 +1,31 @@ /** * pivot mode base data-set test. */ -import { get, keys } from 'lodash'; -import { assembleDataCfg } from 'tests/util'; -import { - data as drillDownData, - totalData as drillDownTotalData, -} from 'tests/data/mock-drill-down-dataset.json'; -import { data } from 'tests/data/mock-dataset.json'; -import type { - ViewMeta, - SortMethod, - CustomHeaderField, -} from '@/common/interface'; import { EXTRA_FIELD, ORIGIN_FIELD, - TOTAL_VALUE, SERIES_NUMBER_FIELD, + TOTAL_VALUE, } from '@/common/constant'; -import type { S2DataConfig } from '@/common/interface'; -import { PivotSheet } from '@/sheet-type'; -import { PivotDataSet } from '@/data-set/pivot-data-set'; +import type { + CustomHeaderField, + S2DataConfig, + SortMethod, + ViewMeta, +} from '@/common/interface'; import { Store } from '@/common/store'; +import { PivotDataSet } from '@/data-set/pivot-data-set'; import { Node } from '@/facet/layout/node'; import { RootInteraction } from '@/interaction/root'; +import { PivotSheet } from '@/sheet-type'; import { getDimensionsWithoutPathPre } from '@/utils/dataset/pivot-data-set'; +import { get, keys } from 'lodash'; +import { data } from 'tests/data/mock-dataset.json'; +import { + data as drillDownData, + totalData as drillDownTotalData, +} from 'tests/data/mock-drill-down-dataset.json'; +import { assembleDataCfg } from 'tests/util'; jest.mock('@/sheet-type'); diff --git a/packages/s2-core/__tests__/unit/data-set/pivot-data-set-total-spec.ts b/packages/s2-core/__tests__/unit/data-set/pivot-data-set-total-spec.ts index d1236fe44d..e72206d189 100644 --- a/packages/s2-core/__tests__/unit/data-set/pivot-data-set-total-spec.ts +++ b/packages/s2-core/__tests__/unit/data-set/pivot-data-set-total-spec.ts @@ -1,11 +1,6 @@ /** * pivot mode base data-set test. */ -import { get, keys } from 'lodash'; -import * as mockData from 'tests/data/mock-dataset.json'; -import * as multiDataCfg from 'tests/data/simple-data.json'; -import type { Query } from '../../../src/data-set/interface'; -import { TOTALS_OPTIONS, assembleDataCfg } from '../../util'; import { EXTRA_FIELD, ORIGIN_FIELD, @@ -22,6 +17,11 @@ import { Store } from '@/common/store'; import { PivotDataSet } from '@/data-set/pivot-data-set'; import { PivotSheet } from '@/sheet-type'; import { getDimensionsWithoutPathPre } from '@/utils/dataset/pivot-data-set'; +import { get, keys } from 'lodash'; +import * as mockData from 'tests/data/mock-dataset.json'; +import * as multiDataCfg from 'tests/data/simple-data.json'; +import type { Query } from '../../../src/data-set/interface'; +import { TOTALS_OPTIONS, assembleDataCfg } from '../../util'; jest.mock('@/sheet-type'); jest.mock('@/facet/layout/node'); diff --git a/packages/s2-core/__tests__/unit/data-set/table-data-set-spec.ts b/packages/s2-core/__tests__/unit/data-set/table-data-set-spec.ts index e76bc821db..af9be08ede 100644 --- a/packages/s2-core/__tests__/unit/data-set/table-data-set-spec.ts +++ b/packages/s2-core/__tests__/unit/data-set/table-data-set-spec.ts @@ -1,7 +1,11 @@ -import { assembleDataCfg } from 'tests/util'; -import { type S2DataConfig, SERIES_NUMBER_FIELD } from '@/common'; -import { SpreadSheet, TableSheet } from '@/sheet-type'; +/** + * table mode data-set test. + */ +import { SERIES_NUMBER_FIELD } from '@/common'; +import type { S2DataConfig } from '@/common/interface'; import { TableDataSet } from '@/data-set/table-data-set'; +import { SpreadSheet, TableSheet } from '@/sheet-type'; +import { assembleDataCfg } from 'tests/util'; jest.mock('@/sheet-type'); jest.mock('@/facet/layout/node'); diff --git a/packages/s2-core/__tests__/unit/dataset/table-dataset-spec.ts b/packages/s2-core/__tests__/unit/dataset/table-dataset-spec.ts index 1fd0419369..64ee345135 100644 --- a/packages/s2-core/__tests__/unit/dataset/table-dataset-spec.ts +++ b/packages/s2-core/__tests__/unit/dataset/table-dataset-spec.ts @@ -1,12 +1,12 @@ /** * table mode data-set test. */ -import { first, last, orderBy, uniq } from 'lodash'; -import { data } from 'tests/data/mock-dataset.json'; -import { assembleDataCfg } from '../../util'; import type { S2DataConfig, SortParam } from '@/common/interface'; import { TableDataSet } from '@/data-set/table-data-set'; import { TableSheet } from '@/sheet-type'; +import { first, last, orderBy, uniq } from 'lodash'; +import { data } from 'tests/data/mock-dataset.json'; +import { assembleDataCfg } from '../../util'; jest.mock('@/sheet-type'); jest.mock('@/facet/layout/node'); diff --git a/packages/s2-core/__tests__/unit/facet/header/frozen-row-spec.ts b/packages/s2-core/__tests__/unit/facet/header/frozen-row-spec.ts index b589b0a642..a9b40a163d 100644 --- a/packages/s2-core/__tests__/unit/facet/header/frozen-row-spec.ts +++ b/packages/s2-core/__tests__/unit/facet/header/frozen-row-spec.ts @@ -1,9 +1,9 @@ -import { createPivotSheet } from 'tests/util/helpers'; +import { RowCell } from '@/cell'; +import { DEFAULT_OPTIONS, FrozenGroupArea } from '@/common'; import { get } from 'lodash'; +import { createPivotSheet } from 'tests/util/helpers'; import type { HierarchyType, RowHeader } from '../../../../src'; import type { FrozenFacet } from '../../../../src/facet/frozen-facet'; -import { DEFAULT_OPTIONS, FrozenGroupArea } from '@/common'; -import { RowCell } from '@/cell'; const s2 = createPivotSheet( { diff --git a/packages/s2-core/__tests__/unit/facet/layout/build-row-tree-hierarchy-spec.ts b/packages/s2-core/__tests__/unit/facet/layout/build-row-tree-hierarchy-spec.ts index a55b90e75c..91ebff1031 100644 --- a/packages/s2-core/__tests__/unit/facet/layout/build-row-tree-hierarchy-spec.ts +++ b/packages/s2-core/__tests__/unit/facet/layout/build-row-tree-hierarchy-spec.ts @@ -1,8 +1,8 @@ +import type { S2DataConfig, S2Options } from '@/common'; +import { EXTRA_FIELD } from '@/common'; +import { PivotSheet } from '@/sheet-type'; import { sortData } from 'tests/data/sort-advanced'; import { getContainer } from 'tests/util/helpers'; -import { PivotSheet } from '@/sheet-type'; -import { EXTRA_FIELD } from '@/common'; -import type { S2DataConfig, S2Options } from '@/common'; const s2Options: S2Options = { width: 400, 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 49ec4d43c6..49dab0bdf0 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 @@ -1,8 +1,8 @@ +import { LayoutWidthType, type S2DataConfig, type S2Options } from '@/common'; +import { PivotSheet, TableSheet } from '@/sheet-type'; import * as mockDataConfig from 'tests/data/simple-data.json'; import * as mockTableDataConfig from 'tests/data/simple-table-data.json'; import { getContainer } from 'tests/util/helpers'; -import { PivotSheet, TableSheet } from '@/sheet-type'; -import { LayoutWidthType, type S2DataConfig, type S2Options } from '@/common'; const s2options: S2Options = { width: 800, diff --git a/packages/s2-core/__tests__/unit/facet/layout/layout-hooks-spec.ts b/packages/s2-core/__tests__/unit/facet/layout/layout-hooks-spec.ts index d973f34ab5..207c687d4c 100644 --- a/packages/s2-core/__tests__/unit/facet/layout/layout-hooks-spec.ts +++ b/packages/s2-core/__tests__/unit/facet/layout/layout-hooks-spec.ts @@ -1,10 +1,10 @@ -import { createFakeSpreadSheet } from 'tests/util/helpers'; import { layoutArrange, layoutCoordinate, layoutHierarchy, } from '@/facet/layout/layout-hooks'; import { Hierarchy, Node } from '@/index'; +import { createFakeSpreadSheet } from 'tests/util/helpers'; describe('layout-hooks test', () => { const s2 = createFakeSpreadSheet({ 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 788ce9c846..e6735e5e24 100644 --- a/packages/s2-core/__tests__/unit/facet/layout/node-spec.ts +++ b/packages/s2-core/__tests__/unit/facet/layout/node-spec.ts @@ -1,5 +1,5 @@ -import { SERIES_NUMBER_FIELD } from '../../../../src'; import { Node } from '@/facet/layout/node'; +import { SERIES_NUMBER_FIELD } from '../../../../src'; describe('Node Test', () => { const root = new Node({ diff --git a/packages/s2-core/__tests__/unit/facet/layout/row-node-width-spec.ts b/packages/s2-core/__tests__/unit/facet/layout/row-node-width-spec.ts index a2c2141155..c579f41dd4 100644 --- a/packages/s2-core/__tests__/unit/facet/layout/row-node-width-spec.ts +++ b/packages/s2-core/__tests__/unit/facet/layout/row-node-width-spec.ts @@ -1,7 +1,7 @@ +import { LayoutWidthType, type S2Options } from '@/common'; +import { PivotSheet } from '@/sheet-type'; import * as mockDataConfig from 'tests/data/data-issue-372.json'; import { getContainer } from 'tests/util/helpers'; -import { PivotSheet } from '@/sheet-type'; -import { LayoutWidthType, type S2Options } from '@/common'; const s2options: S2Options = { width: 800, 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 2f4106c086..06878d82d3 100644 --- a/packages/s2-core/__tests__/unit/facet/pivot-facet-spec.ts +++ b/packages/s2-core/__tests__/unit/facet/pivot-facet-spec.ts @@ -1,13 +1,6 @@ /** * pivot mode pivot test. */ -import { Canvas, Group, Rect, type CanvasConfig } from '@antv/g'; -import { Renderer } from '@antv/g-canvas'; -import { find, size } from 'lodash'; -import { assembleDataCfg, assembleOptions } from 'tests/util'; -import { getDefaultSeriesNumberText } from '../../../src'; -import { createFakeSpreadSheet } from '../../util/helpers'; -import { getMockPivotMeta } from './util'; import { CornerCell, DataCell } from '@/cell'; import { DEFAULT_OPTIONS, @@ -25,6 +18,13 @@ import type { PanelScrollGroup } from '@/group/panel-scroll-group'; import { RootInteraction } from '@/interaction/root'; import { SpreadSheet } from '@/sheet-type'; import { getTheme } from '@/theme'; +import { Canvas, Group, Rect, type CanvasConfig } from '@antv/g'; +import { Renderer } from '@antv/g-canvas'; +import { find, size } from 'lodash'; +import { assembleDataCfg, assembleOptions } from 'tests/util'; +import { getDefaultSeriesNumberText } from '../../../src'; +import { createFakeSpreadSheet } from '../../util/helpers'; +import { getMockPivotMeta } from './util'; jest.mock('@/interaction/root'); 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 7d3c0afc2d..0ab1fd7c08 100644 --- a/packages/s2-core/__tests__/unit/facet/table-facet-spec.ts +++ b/packages/s2-core/__tests__/unit/facet/table-facet-spec.ts @@ -1,13 +1,6 @@ /** * table mode pivot test. */ -import { Canvas, Group, type CanvasConfig } from '@antv/g'; -import { Renderer } from '@antv/g-canvas'; -import { assembleDataCfg, assembleOptions } from 'tests/util'; -import { pick } from 'lodash'; -import { data } from '../../data/mock-dataset.json'; -import { createFakeSpreadSheet } from '../../util/helpers'; -import { getDefaultSeriesNumberText } from '../../../src'; import { LayoutWidthType, ROOT_NODE_ID } from '@/common/constant'; import { Store } from '@/common/store'; import { TableDataSet } from '@/data-set/table-data-set'; @@ -21,6 +14,13 @@ import { } from '@/index'; import { SpreadSheet } from '@/sheet-type'; import { getTheme } from '@/theme'; +import { Canvas, Group, type CanvasConfig } from '@antv/g'; +import { Renderer } from '@antv/g-canvas'; +import { pick } from 'lodash'; +import { assembleDataCfg, assembleOptions } from 'tests/util'; +import { getDefaultSeriesNumberText } from '../../../src'; +import { data } from '../../data/mock-dataset.json'; +import { createFakeSpreadSheet } from '../../util/helpers'; const actualDataSet = jest.requireActual( '@/data-set/base-data-set', diff --git a/packages/s2-core/__tests__/unit/facet/util.ts b/packages/s2-core/__tests__/unit/facet/util.ts index 45aed17f8c..2cfe2c49e7 100644 --- a/packages/s2-core/__tests__/unit/facet/util.ts +++ b/packages/s2-core/__tests__/unit/facet/util.ts @@ -1,8 +1,10 @@ -import { assembleDataCfg } from 'tests/util'; +/* eslint-disable import/order */ +// eslint-disable-next-line prettier/prettier import { getExistValues, transformIndexesData, } from '@/utils/dataset/pivot-data-set'; +import { assembleDataCfg } from '../../util'; /** * 获取 Mock 数据 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 cb3f451460..b6b9701ab0 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 @@ -1,3 +1,8 @@ +import { InterceptType, S2Event } from '@/common/constant'; +import type { HierarchyType, S2Options } from '@/common/interface'; +import type { GEvent } from '@/index'; +import { CornerCellClick } from '@/interaction'; +import type { SpreadSheet } from '@/sheet-type'; import { createFakeSpreadSheet, createMockCellInfo, @@ -8,11 +13,6 @@ import { InteractionStateName, type Node, } from '../../../../../src'; -import { InterceptType, S2Event } from '@/common/constant'; -import type { HierarchyType, S2Options } from '@/common/interface'; -import type { GEvent } from '@/index'; -import { CornerCellClick } from '@/interaction'; -import type { SpreadSheet } from '@/sheet-type'; jest.mock('@/interaction/event-controller'); 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 a8823d2063..c1efbf1faf 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 @@ -1,8 +1,3 @@ -import { - createFakeSpreadSheet, - createMockCellInfo, - sleep, -} from 'tests/util/helpers'; import { HOVER_FOCUS_DURATION, InteractionName, @@ -14,6 +9,11 @@ import type { InteractionCellHighlightOptions } from '@/common/interface'; import { CustomRect } from '@/engine'; import type { GEvent } from '@/index'; import type { SpreadSheet } from '@/sheet-type'; +import { + createFakeSpreadSheet, + createMockCellInfo, + sleep, +} from 'tests/util/helpers'; jest.mock('@/interaction/event-controller'); 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 52bcd2b273..044abca971 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 @@ -1,22 +1,22 @@ -import { omit } from 'lodash'; -import { createFakeSpreadSheet, createMockCellInfo } from 'tests/util/helpers'; -import type { GEvent } from '@/index'; -import { RowColumnClick } from '@/interaction/base-interaction/click'; -import type { - HiddenColumnsInfo, - S2CellType, - S2Options, - ViewMeta, -} from '@/common/interface'; -import type { SpreadSheet } from '@/sheet-type'; import { InteractionKeyboardKey, InteractionStateName, InterceptType, S2Event, } from '@/common/constant'; -import type { Node } from '@/facet/layout/node'; +import type { + HiddenColumnsInfo, + S2CellType, + S2Options, + ViewMeta, +} from '@/common/interface'; import { CustomRect } from '@/engine'; +import type { Node } from '@/facet/layout/node'; +import type { GEvent } from '@/index'; +import { RowColumnClick } from '@/interaction/base-interaction/click'; +import type { SpreadSheet } from '@/sheet-type'; +import { omit } from 'lodash'; +import { createFakeSpreadSheet, createMockCellInfo } from 'tests/util/helpers'; jest.mock('@/interaction/event-controller'); diff --git a/packages/s2-core/__tests__/unit/interaction/base-interaction/click/row-text-click-spec.ts b/packages/s2-core/__tests__/unit/interaction/base-interaction/click/row-text-click-spec.ts index 211456388b..347ee77614 100644 --- a/packages/s2-core/__tests__/unit/interaction/base-interaction/click/row-text-click-spec.ts +++ b/packages/s2-core/__tests__/unit/interaction/base-interaction/click/row-text-click-spec.ts @@ -1,7 +1,7 @@ -import { createFakeSpreadSheet } from 'tests/util/helpers'; -import { RowTextClick } from '@/interaction/base-interaction/click'; import type { RawData, S2DataConfig, S2Options } from '@/common/interface'; +import { RowTextClick } from '@/interaction/base-interaction/click'; import type { SpreadSheet } from '@/sheet-type'; +import { createFakeSpreadSheet } from 'tests/util/helpers'; jest.mock('@/interaction/event-controller'); jest.mock('@/interaction/base-interaction/click/row-column-click'); diff --git a/packages/s2-core/__tests__/unit/interaction/base-interaction/hover-spec.ts b/packages/s2-core/__tests__/unit/interaction/base-interaction/hover-spec.ts index 29b29fc180..c3bb8d2760 100644 --- a/packages/s2-core/__tests__/unit/interaction/base-interaction/hover-spec.ts +++ b/packages/s2-core/__tests__/unit/interaction/base-interaction/hover-spec.ts @@ -1,13 +1,3 @@ -import { omit } from 'lodash'; -import { - createFakeSpreadSheet, - createFederatedMouseEvent, - sleep, -} from 'tests/util/helpers'; -import type { GEvent } from '@/index'; -import type { CellEventTarget, S2Options, ViewMeta } from '@/common/interface'; -import { HoverEvent } from '@/interaction/base-interaction/hover'; -import type { SpreadSheet } from '@/sheet-type'; import { ELLIPSIS_SYMBOL, HOVER_FOCUS_DURATION, @@ -15,6 +5,16 @@ import { OriginEventType, S2Event, } from '@/common/constant'; +import type { CellEventTarget, S2Options, ViewMeta } from '@/common/interface'; +import type { GEvent } from '@/index'; +import { HoverEvent } from '@/interaction/base-interaction/hover'; +import type { SpreadSheet } from '@/sheet-type'; +import { omit } from 'lodash'; +import { + createFakeSpreadSheet, + createFederatedMouseEvent, + sleep, +} from 'tests/util/helpers'; describe('Interaction Hover Tests', () => { let hoverEvent: HoverEvent; diff --git a/packages/s2-core/__tests__/unit/interaction/brush-selection/base-brush-selection-spec.ts b/packages/s2-core/__tests__/unit/interaction/brush-selection/base-brush-selection-spec.ts index f5320e24c9..a727b76c35 100644 --- a/packages/s2-core/__tests__/unit/interaction/brush-selection/base-brush-selection-spec.ts +++ b/packages/s2-core/__tests__/unit/interaction/brush-selection/base-brush-selection-spec.ts @@ -1,10 +1,9 @@ -import { Group } from '@antv/g'; -import { getContainer } from 'tests/util/helpers'; import { DataCell } from '@/cell/data-cell'; import type { BBox } from '@/engine'; import { BaseBrushSelection, DataCellBrushSelection, + EventController, InteractionBrushSelectionStage, InterceptType, PivotSheet, @@ -13,9 +12,10 @@ import { type OriginalEvent, type S2DataConfig, type ViewMeta, - EventController, } from '@/index'; import { RootInteraction } from '@/interaction/root'; +import { Group } from '@antv/g'; +import { getContainer } from 'tests/util/helpers'; jest.mock('@/interaction/event-controller'); jest.mock('@/interaction/root'); diff --git a/packages/s2-core/__tests__/unit/interaction/brush-selection/col-brush-selection-spec.ts b/packages/s2-core/__tests__/unit/interaction/brush-selection/col-brush-selection-spec.ts index b14452a3de..4575a41ee3 100644 --- a/packages/s2-core/__tests__/unit/interaction/brush-selection/col-brush-selection-spec.ts +++ b/packages/s2-core/__tests__/unit/interaction/brush-selection/col-brush-selection-spec.ts @@ -1,8 +1,7 @@ -import { getContainer } from 'tests/util/helpers'; -import * as data from '../../../data/mock-dataset.json'; import { ColCell, ColCellBrushSelection, + EventController, InteractionBrushSelectionStage, Node, PivotSheet, @@ -11,8 +10,9 @@ import { SpreadSheet, type OriginalEvent, type S2DataConfig, - EventController, } from '@/index'; +import { getContainer } from 'tests/util/helpers'; +import * as data from '../../../data/mock-dataset.json'; jest.mock('@/interaction/event-controller'); jest.mock('@/interaction/root'); diff --git a/packages/s2-core/__tests__/unit/interaction/brush-selection/data-brush-selection-spec.ts b/packages/s2-core/__tests__/unit/interaction/brush-selection/data-brush-selection-spec.ts index 82449732eb..d0c6f25e57 100644 --- a/packages/s2-core/__tests__/unit/interaction/brush-selection/data-brush-selection-spec.ts +++ b/packages/s2-core/__tests__/unit/interaction/brush-selection/data-brush-selection-spec.ts @@ -1,11 +1,10 @@ -import { Group } from '@antv/g'; -import { range } from 'lodash'; -import { getContainer } from 'tests/util/helpers'; import { DataCell } from '@/cell/data-cell'; import type { TableFacet } from '@/facet'; import { CellType, DataCellBrushSelection, + EventController, + FrozenGroupArea, InteractionBrushSelectionStage, Node, PivotSheet, @@ -19,10 +18,11 @@ import { type S2DataConfig, type S2Options, type ViewMeta, - EventController, - FrozenGroupArea, } from '@/index'; import { RootInteraction } from '@/interaction/root'; +import { Group } from '@antv/g'; +import { range } from 'lodash'; +import { getContainer } from 'tests/util/helpers'; jest.mock('@/interaction/event-controller'); jest.mock('@/interaction/root'); diff --git a/packages/s2-core/__tests__/unit/interaction/brush-selection/row-brush-selection-spec.ts b/packages/s2-core/__tests__/unit/interaction/brush-selection/row-brush-selection-spec.ts index 568d236cc3..9c3e303185 100644 --- a/packages/s2-core/__tests__/unit/interaction/brush-selection/row-brush-selection-spec.ts +++ b/packages/s2-core/__tests__/unit/interaction/brush-selection/row-brush-selection-spec.ts @@ -1,6 +1,5 @@ -import { getContainer } from 'tests/util/helpers'; -import * as data from '../../../data/mock-dataset.json'; import { + EventController, InteractionBrushSelectionStage, Node, PivotSheet, @@ -11,8 +10,9 @@ import { SpreadSheet, type OriginalEvent, type S2DataConfig, - EventController, } from '@/index'; +import { getContainer } from 'tests/util/helpers'; +import * as data from '../../../data/mock-dataset.json'; jest.mock('@/interaction/event-controller'); jest.mock('@/interaction/root'); 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 31ce8676bf..e5e44df723 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 @@ -1,14 +1,14 @@ -import { createFakeSpreadSheet, createMockCellInfo } from 'tests/util/helpers'; -import type { GEvent } from '@/index'; -import { DataCellMultiSelection } from '@/interaction/data-cell-multi-selection'; -import type { CellMeta } from '@/common/interface'; -import type { SpreadSheet } from '@/sheet-type'; import { InteractionKeyboardKey, InteractionStateName, InterceptType, S2Event, } from '@/common/constant'; +import type { CellMeta } from '@/common/interface'; +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'; jest.mock('@/interaction/event-controller'); jest.mock('@/ui/hd-adapter'); 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 ff3b1d9d39..a00201f9c1 100644 --- a/packages/s2-core/__tests__/unit/interaction/event-controller-spec.ts +++ b/packages/s2-core/__tests__/unit/interaction/event-controller-spec.ts @@ -1,11 +1,28 @@ /* eslint-disable jest/expect-expect */ +import { GuiIcon } from '@/common'; +import { + CellType, + InteractionKeyboardKey, + InteractionStateName, + InterceptType, + OriginEventType, + S2Event, +} from '@/common/constant'; +import type { CellMeta, S2Options } from '@/common/interface'; +import type { EmitterType } from '@/common/interface/emitter'; +import type { BBox } from '@/engine'; +import type { BaseFacet } from '@/facet'; +import { EventController } from '@/interaction/event-controller'; +import { RootInteraction } from '@/interaction/root'; +import type { SpreadSheet } from '@/sheet-type'; import { Canvas, + CustomEvent, FederatedEvent, Image, - CustomEvent, type CanvasConfig, } from '@antv/g'; +import { Renderer } from '@antv/g-canvas'; import { createFakeSpreadSheet, createFederatedMouseEvent, @@ -13,23 +30,6 @@ import { getClientPointOnCanvas, sleep, } from 'tests/util/helpers'; -import { Renderer } from '@antv/g-canvas'; -import { GuiIcon } from '@/common'; -import type { EmitterType } from '@/common/interface/emitter'; -import { - CellType, - InteractionKeyboardKey, - InteractionStateName, - InterceptType, - OriginEventType, - S2Event, -} from '@/common/constant'; -import { EventController } from '@/interaction/event-controller'; -import type { SpreadSheet } from '@/sheet-type'; -import { RootInteraction } from '@/interaction/root'; -import type { CellMeta, S2Options } from '@/common/interface'; -import type { BaseFacet } from '@/facet'; -import type { BBox } from '@/engine'; const MOCK_COPY_DATA = 'data'; 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 20da43616f..36f11c236f 100644 --- a/packages/s2-core/__tests__/unit/interaction/range-selection-spec.ts +++ b/packages/s2-core/__tests__/unit/interaction/range-selection-spec.ts @@ -1,16 +1,16 @@ -import { createFakeSpreadSheet, createMockCellInfo } from 'tests/util/helpers'; -import type { PivotFacet } from '../../../src/facet'; -import type { GEvent } from '@/index'; -import type { S2CellType } from '@/common/interface/interaction'; -import type { SpreadSheet } from '@/sheet-type'; import { InteractionKeyboardKey, InteractionStateName, InterceptType, S2Event, } from '@/common/constant'; +import type { S2CellType } from '@/common/interface/interaction'; +import type { GEvent } from '@/index'; import { RangeSelection } from '@/interaction/range-selection'; +import type { SpreadSheet } from '@/sheet-type'; import { getCellMeta } from '@/utils'; +import { createFakeSpreadSheet, createMockCellInfo } from 'tests/util/helpers'; +import type { PivotFacet } from '../../../src/facet'; jest.mock('@/utils/tooltip'); jest.mock('@/interaction/event-controller'); diff --git a/packages/s2-core/__tests__/unit/interaction/root-spec.ts b/packages/s2-core/__tests__/unit/interaction/root-spec.ts index 4dc45923a9..236c5c5906 100644 --- a/packages/s2-core/__tests__/unit/interaction/root-spec.ts +++ b/packages/s2-core/__tests__/unit/interaction/root-spec.ts @@ -1,7 +1,3 @@ -import type { Canvas } from '@antv/g'; -import { get } from 'lodash'; -import { createMockCellInfo, sleep } from 'tests/util/helpers'; -import type { PivotFacet } from '../../../src/facet'; import { Store } from '@/common/store'; import { BaseEvent, @@ -32,6 +28,10 @@ import { 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'; jest.mock('@/sheet-type'); jest.mock('@/interaction/event-controller'); 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 174d64c08f..49d0664cda 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 @@ -1,36 +1,36 @@ -import { - Group, - DisplayObject, - type RectStyleProps, - type ParsedRectStyleProps, - Path, - FederatedPointerEvent, -} from '@antv/g'; -import { get, pick } from 'lodash'; -import { createMockCellInfo } from '../../util/helpers'; +import { CustomRect } from '@/engine'; import type { BBox } from '@/engine/interface'; -import { RootInteraction } from '@/interaction/root'; +import type { BaseFacet } from '@/facet/base-facet'; import { + Node, PivotSheet, - ResizeAreaEffect, - ResizeDirectionType, - type ResizeInfo, RESIZE_END_GUIDE_LINE_ID, RESIZE_MASK_ID, RESIZE_START_GUIDE_LINE_ID, + ResizeAreaEffect, + ResizeDirectionType, + ResizeType, RowColumnResize, S2Event, - type S2Options, SpreadSheet, + type ResizeInfo, + type ResizeParams, + type S2DataConfig, + type S2Options, type ThemeCfg, - Node, type ViewMeta, - type S2DataConfig, - type ResizeParams, - ResizeType, } from '@/index'; -import type { BaseFacet } from '@/facet/base-facet'; -import { CustomRect } from '@/engine'; +import { RootInteraction } from '@/interaction/root'; +import { + DisplayObject, + FederatedPointerEvent, + Group, + Path, + type ParsedRectStyleProps, + type RectStyleProps, +} from '@antv/g'; +import { get, pick } from 'lodash'; +import { createMockCellInfo } from '../../util/helpers'; jest.mock('@/interaction/event-controller'); jest.mock('@/facet'); diff --git a/packages/s2-core/__tests__/unit/interaction/selected-cell-move-spec.ts b/packages/s2-core/__tests__/unit/interaction/selected-cell-move-spec.ts index 6903469bca..d00a09534d 100644 --- a/packages/s2-core/__tests__/unit/interaction/selected-cell-move-spec.ts +++ b/packages/s2-core/__tests__/unit/interaction/selected-cell-move-spec.ts @@ -1,13 +1,13 @@ -import { createFakeSpreadSheet, createMockCellInfo } from 'tests/util/helpers'; -import type { BaseFacet } from '../../../src/facet'; -import type { InternalFullyTheme, OffsetConfig } from '@/common/interface'; -import type { SpreadSheet } from '@/sheet-type'; import { FrozenGroupArea, InteractionKeyboardKey, S2Event, } from '@/common/constant'; +import type { InternalFullyTheme, OffsetConfig } from '@/common/interface'; import { SelectedCellMove } from '@/interaction/selected-cell-move'; +import type { SpreadSheet } from '@/sheet-type'; +import { createFakeSpreadSheet, createMockCellInfo } from 'tests/util/helpers'; +import type { BaseFacet } from '../../../src/facet'; jest.mock('@/interaction/event-controller'); 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 bd4b7c11fd..fa0cf8ade5 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 @@ -1,23 +1,4 @@ // eslint-disable-next-line max-classes-per-file -import { Canvas, CanvasEvent } from '@antv/g'; -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 type { - BaseEvent, - BaseTooltipOperatorMenuOptions, - HeaderCell, - TooltipOptions, -} from '../../../src'; -import { PivotDataSet } from '../../../src/data-set'; -import { PivotFacet } from '../../../src/facet'; -import { createMockCellInfo } from '../../util/helpers'; -import { customMerge, setupDataConfig } from '@/utils'; -import { BaseTooltip } from '@/ui/tooltip'; -import { PivotSheet, SpreadSheet } from '@/sheet-type'; -import type { GEvent } from '@/index'; -import { Node } from '@/facet/layout/node'; import { CellType, InterceptType, @@ -34,6 +15,25 @@ import { type S2Options, type TooltipShowOptions, } from '@/common'; +import { Node } from '@/facet/layout/node'; +import type { GEvent } from '@/index'; +import { PivotSheet, SpreadSheet } from '@/sheet-type'; +import { BaseTooltip } from '@/ui/tooltip'; +import { customMerge, setupDataConfig } from '@/utils'; +import { Canvas, CanvasEvent } from '@antv/g'; +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 type { + BaseEvent, + BaseTooltipOperatorMenuOptions, + HeaderCell, + TooltipOptions, +} from '../../../src'; +import { PivotDataSet } from '../../../src/data-set'; +import { PivotFacet } from '../../../src/facet'; +import { createMockCellInfo } from '../../util/helpers'; jest.mock('@/utils/hide-columns'); 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 0f660c8f46..35d7230184 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 @@ -1,11 +1,11 @@ -import * as dataCfg from 'tests/data/simple-table-data.json'; -import { getContainer } from 'tests/util/helpers'; -import { TableDataSet } from '../../../src/data-set'; -import { TableFacet } from '../../../src/facet'; import { S2Event, setLang, type LangType, type S2Options } from '@/common'; import { Node } from '@/facet/layout/node'; import type { GEvent, TooltipOptions } from '@/index'; import { TableSheet } from '@/sheet-type'; +import * as dataCfg from 'tests/data/simple-table-data.json'; +import { getContainer } from 'tests/util/helpers'; +import { TableDataSet } from '../../../src/data-set'; +import { TableFacet } from '../../../src/facet'; describe('TableSheet Tests', () => { let s2: TableSheet; diff --git a/packages/s2-core/__tests__/unit/ui/hd-adapter/index-spec.ts b/packages/s2-core/__tests__/unit/ui/hd-adapter/index-spec.ts index 46bfd931d6..2a23ff130c 100644 --- a/packages/s2-core/__tests__/unit/ui/hd-adapter/index-spec.ts +++ b/packages/s2-core/__tests__/unit/ui/hd-adapter/index-spec.ts @@ -1,8 +1,8 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ /* eslint-disable jest/expect-expect */ +import type { SpreadSheet } from '@/sheet-type/spread-sheet'; import { createPivotSheet, sleep } from 'tests/util/helpers'; import type { S2Options } from '../../../../src'; -import type { SpreadSheet } from '@/sheet-type/spread-sheet'; jest.mock('@/interaction/event-controller'); jest.mock('@/interaction/root'); diff --git a/packages/s2-core/__tests__/unit/ui/scrollbar/index-spec.ts b/packages/s2-core/__tests__/unit/ui/scrollbar/index-spec.ts index 104f61c34f..2eb6b31178 100644 --- a/packages/s2-core/__tests__/unit/ui/scrollbar/index-spec.ts +++ b/packages/s2-core/__tests__/unit/ui/scrollbar/index-spec.ts @@ -1,8 +1,8 @@ /* eslint-disable jest/expect-expect */ import { Group } from '@antv/g'; +import { customMerge } from '../../../../src'; import { ScrollBar, ScrollType } from '../../../../src/ui/scrollbar'; import type { ScrollBarCfg } from '../../../../src/ui/scrollbar/interface'; -import { customMerge } from '../../../../src'; import { sleep } from '../../../util/helpers'; describe('Scrollbar Tests', () => { diff --git a/packages/s2-core/__tests__/unit/ui/tooltip/index-spec.ts b/packages/s2-core/__tests__/unit/ui/tooltip/index-spec.ts index c702729c4c..34b89a3c91 100644 --- a/packages/s2-core/__tests__/unit/ui/tooltip/index-spec.ts +++ b/packages/s2-core/__tests__/unit/ui/tooltip/index-spec.ts @@ -1,6 +1,3 @@ -import { createFakeSpreadSheet, sleep } from 'tests/util/helpers'; -import type { SpreadSheet } from '@/sheet-type/spread-sheet'; -import { BaseTooltip } from '@/ui/tooltip'; import { TOOLTIP_CONTAINER_CLS, TOOLTIP_CONTAINER_HIDE_CLS, @@ -8,6 +5,9 @@ import { TOOLTIP_POSITION_OFFSET, type S2Options, } from '@/common'; +import type { SpreadSheet } from '@/sheet-type/spread-sheet'; +import { BaseTooltip } from '@/ui/tooltip'; +import { createFakeSpreadSheet, sleep } from 'tests/util/helpers'; jest.mock('@/interaction/event-controller'); jest.mock('@/interaction/root'); diff --git a/packages/s2-core/__tests__/unit/utils/canvas-spec.ts b/packages/s2-core/__tests__/unit/utils/canvas-spec.ts index 3196b10005..c4c1161a7a 100644 --- a/packages/s2-core/__tests__/unit/utils/canvas-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/canvas-spec.ts @@ -1,5 +1,5 @@ -import { sleep } from './../../util/helpers'; import { getOffscreenCanvas, removeOffscreenCanvas } from '@/utils'; +import { sleep } from './../../util/helpers'; describe('Canvas Utils Tests', () => { const ID = 's2-offscreen-canvas'; diff --git a/packages/s2-core/__tests__/unit/utils/cell/header-cell-spec.ts b/packages/s2-core/__tests__/unit/utils/cell/header-cell-spec.ts index 00a3b2988b..d0c2422bf4 100644 --- a/packages/s2-core/__tests__/unit/utils/cell/header-cell-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/cell/header-cell-spec.ts @@ -1,6 +1,6 @@ -import type { Node } from '@antv/s2'; import { CellType, type HeaderActionIcon } from '@/common'; import { getActionIconConfig } from '@/utils/cell/header-cell'; +import type { Node } from '@antv/s2'; describe('Header Cell Utils Tests', () => { describe('getActionIconConfig Tests', () => { diff --git a/packages/s2-core/__tests__/unit/utils/color-spec.ts b/packages/s2-core/__tests__/unit/utils/color-spec.ts index b9142c193c..cc9d8f2043 100644 --- a/packages/s2-core/__tests__/unit/utils/color-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/color-spec.ts @@ -1,4 +1,4 @@ -import { getPalette, shouldReverseFontColor, isReadableText } from '@/utils'; +import { getPalette, isReadableText, shouldReverseFontColor } from '@/utils'; import { generatePalette, generateStandardColors } from '@/utils/color'; const expectThemeColor = '#F1535F'; diff --git a/packages/s2-core/__tests__/unit/utils/condition/condition-spec.ts b/packages/s2-core/__tests__/unit/utils/condition/condition-spec.ts index 1adc53c196..af550e3bc8 100644 --- a/packages/s2-core/__tests__/unit/utils/condition/condition-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/condition/condition-spec.ts @@ -1,9 +1,9 @@ -import type { RawData, TextCondition } from '../../../../src/common/interface'; import { findFieldCondition, getIconPosition, getIntervalScale, } from '@/utils/condition/condition'; +import type { RawData, TextCondition } from '../../../../src/common/interface'; describe('getIconLayoutPosition Test', () => { test('should return right by default', () => { diff --git a/packages/s2-core/__tests__/unit/utils/data-set-operate-spec.ts b/packages/s2-core/__tests__/unit/utils/data-set-operate-spec.ts index 41d1aa57c4..c1a437eb67 100644 --- a/packages/s2-core/__tests__/unit/utils/data-set-operate-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/data-set-operate-spec.ts @@ -1,21 +1,21 @@ +import { Aggregation } from '@/common/interface'; +import { + getAggregationAndCalcFuncByQuery, + getListBySorted, +} from '@/utils/data-set-operate'; import { keys, set } from 'lodash'; -import { flattenIndexesData } from '../../../src/utils/dataset/pivot-data-set'; import { - QueryDataType, - type FlattingIndexesData, EMPTY_EXTRA_FIELD_PLACEHOLDER, + QueryDataType, TOTAL_VALUE, + type FlattingIndexesData, } from '../../../src'; import { customFlattenDeep, filterOutDetail, sortByItems, } from '../../../src/utils/data-set-operate'; -import { Aggregation } from '@/common/interface'; -import { - getAggregationAndCalcFuncByQuery, - getListBySorted, -} from '@/utils/data-set-operate'; +import { flattenIndexesData } from '../../../src/utils/dataset/pivot-data-set'; describe('Data Set Operate Test', () => { const data: FlattingIndexesData = []; diff --git a/packages/s2-core/__tests__/unit/utils/export/copy-spec.ts b/packages/s2-core/__tests__/unit/utils/export/copy-spec.ts index 0b50d8f6b0..ede508cc8c 100644 --- a/packages/s2-core/__tests__/unit/utils/export/copy-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/export/copy-spec.ts @@ -1,3 +1,16 @@ +import { TableSeriesNumberCell } from '@/cell'; +import { LINE_SEPARATOR, S2Event, TAB_SEPARATOR } from '@/common/constant'; +import { + InteractionStateName, + SortMethodType, +} from '@/common/constant/interaction'; +import type { Meta } from '@/common/interface'; +import { Aggregation } from '@/common/interface'; +import { CopyMIMEType } from '@/common/interface/export'; +import { PivotSheet, SpreadSheet, TableSheet } from '@/sheet-type'; +import { getSelectedData } from '@/utils/export/copy'; +import { convertString } from '@/utils/export/method'; +import { getCellMeta } from '@/utils/interaction/select-event'; import { map } from 'lodash'; import { data as originalData, totalData } from 'tests/data/mock-dataset.json'; import { @@ -10,19 +23,6 @@ import { getContainer } from 'tests/util/helpers'; import type { S2CellType, S2DataConfig } from '../../../../src/common'; import { customRowGridSimpleFields } from '../../../data/custom-grid-simple-fields'; import { CustomGridData } from '../../../data/data-custom-grid'; -import { TableSeriesNumberCell } from '@/cell'; -import { LINE_SEPARATOR, TAB_SEPARATOR, S2Event } from '@/common/constant'; -import { - InteractionStateName, - SortMethodType, -} from '@/common/constant/interaction'; -import type { Meta } from '@/common/interface'; -import { Aggregation } from '@/common/interface'; -import { PivotSheet, SpreadSheet, TableSheet } from '@/sheet-type'; -import { getSelectedData } from '@/utils/export/copy'; -import { CopyMIMEType } from '@/common/interface/export'; -import { convertString } from '@/utils/export/method'; -import { getCellMeta } from '@/utils/interaction/select-event'; const newLineTest = `### 问题摘要 ${LINE_SEPARATOR}- **会话地址**:`; 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 a07a56309c..576b1287a8 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 @@ -1,22 +1,22 @@ /* eslint-disable jest/expect-expect */ +import { CopyMIMEType } from '@/common/interface/export'; import { map, omit } from 'lodash'; import { data as originData } from 'tests/data/mock-dataset.json'; import { assembleDataCfg, assembleOptions } from 'tests/util'; import { createPivotSheet, getContainer } from 'tests/util/helpers'; -import { - customColGridSimpleFields, - customRowGridSimpleFields, -} from '../../../data/custom-grid-simple-fields'; -import { CustomGridData } from '../../../data/data-custom-grid'; -import { expectMatchSnapshot } from '../../../util/helpers'; +import { PivotSheet, asyncGetAllPlainData } from '../../../../src'; import { CSV_SEPARATOR, LINE_SEPARATOR, TAB_SEPARATOR, } from '../../../../src/common/constant'; -import { asyncGetAllPlainData, PivotSheet } from '../../../../src'; +import { + customColGridSimpleFields, + customRowGridSimpleFields, +} from '../../../data/custom-grid-simple-fields'; +import { CustomGridData } from '../../../data/data-custom-grid'; import { generateRawData } from '../../../util'; -import { CopyMIMEType } from '@/common/interface/export'; +import { expectMatchSnapshot } from '../../../util/helpers'; describe('PivotSheet Export Test', () => { let pivotSheet: PivotSheet; diff --git a/packages/s2-core/__tests__/unit/utils/export/export-spec.ts b/packages/s2-core/__tests__/unit/utils/export/export-spec.ts index ae5673dec1..7eae467905 100644 --- a/packages/s2-core/__tests__/unit/utils/export/export-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/export/export-spec.ts @@ -1,4 +1,5 @@ /* eslint-disable jest/expect-expect */ +import { PivotSheet, TableSheet } from '@/sheet-type'; import type { S2DataConfig, S2Options, SpreadSheet } from '../../../../src'; import { customRowGridSimpleFields } from '../../../data/custom-grid-simple-fields'; import { CustomGridData } from '../../../data/data-custom-grid'; @@ -8,7 +9,6 @@ import { expectMatchSnapshot, getContainer, } from '../../../util/helpers'; -import { PivotSheet, TableSheet } from '@/sheet-type'; describe('TableSheet Export Test', () => { it('should export correct data with series number', async () => { diff --git a/packages/s2-core/__tests__/unit/utils/export/export-table-spec.ts b/packages/s2-core/__tests__/unit/utils/export/export-table-spec.ts index 590ef81507..e291cd7730 100644 --- a/packages/s2-core/__tests__/unit/utils/export/export-table-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/export/export-table-spec.ts @@ -1,6 +1,18 @@ /* eslint-disable jest/expect-expect */ +import { CopyMIMEType } from '@/common/interface/export'; +import { TableSheet } from '@/sheet-type'; +import { asyncGetAllPlainData } from '@/utils'; import { slice } from 'lodash'; import { data as originData } from 'tests/data/mock-dataset.json'; +import { + CSV_SEPARATOR, + FormatOptions, + LINE_SEPARATOR, + S2DataConfig, + S2Options, + TAB_SEPARATOR, +} from '../../../../src'; +import { customColSimpleColumns } from '../../../data/custom-table-col-fields'; import { assembleDataCfg, assembleOptions, @@ -11,18 +23,6 @@ import { expectMatchSnapshot, getContainer, } from '../../../util/helpers'; -import { - CSV_SEPARATOR, - type FormatOptions, - type S2DataConfig, - type S2Options, - LINE_SEPARATOR, - TAB_SEPARATOR, -} from '../../../../src'; -import { customColSimpleColumns } from '../../../data/custom-table-col-fields'; -import { CopyMIMEType } from '@/common/interface/export'; -import { TableSheet } from '@/sheet-type'; -import { asyncGetAllPlainData } from '@/utils'; describe('TableSheet Export Test', () => { const expectColumnsFormatterMatchSnapshot = async ( diff --git a/packages/s2-core/__tests__/unit/utils/facet-spec.ts b/packages/s2-core/__tests__/unit/utils/facet-spec.ts index b44bff8a28..a6571634fc 100644 --- a/packages/s2-core/__tests__/unit/utils/facet-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/facet-spec.ts @@ -1,7 +1,7 @@ import { - getIndexRangeWithOffsets, getAdjustedRowScrollX, getAdjustedScrollOffset, + getIndexRangeWithOffsets, } from '@/utils/facet'; describe('Facet util test', () => { diff --git a/packages/s2-core/__tests__/unit/utils/frozen-util-spec.ts b/packages/s2-core/__tests__/unit/utils/frozen-util-spec.ts index b98c8ba491..30966dc194 100644 --- a/packages/s2-core/__tests__/unit/utils/frozen-util-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/frozen-util-spec.ts @@ -1,14 +1,14 @@ -import { FrozenGroupType } from '../../../src'; import type { S2BaseFrozenOptions } from '@/common/interface/s2Options'; -import { getValidFrozenOptions } from '@/utils/layout/frozen'; +import type { ViewCellHeights } from '@/facet/layout/interface'; import { - getFrozenGroupTypeByCell, calculateFrozenCornerCells, - splitInViewIndexesWithFrozen, getCellRange, + getFrozenGroupTypeByCell, + splitInViewIndexesWithFrozen, } from '@/facet/utils'; import type { Indexes } from '@/utils/indexes'; -import type { ViewCellHeights } from '@/facet/layout/interface'; +import { getValidFrozenOptions } from '@/utils/layout/frozen'; +import { FrozenGroupType } from '../../../src'; describe('Frozen util test', () => { describe('getCellRange', () => { diff --git a/packages/s2-core/__tests__/unit/utils/g-mini-charts-spec.ts b/packages/s2-core/__tests__/unit/utils/g-mini-charts-spec.ts index 7db2eb73dd..42d36a3656 100644 --- a/packages/s2-core/__tests__/unit/utils/g-mini-charts-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/g-mini-charts-spec.ts @@ -1,9 +1,3 @@ -import { forEach, last, map } from 'lodash'; -import { data } from 'tests/data/mock-dataset.json'; -import { assembleDataCfg, assembleOptions } from 'tests/util'; -import { createPivotSheet, getContainer } from 'tests/util/helpers'; -import type { IElement } from '@antv/g-lite'; -import type { RangeColors } from '../../../src/common/interface/theme'; import type { DataCell } from '@/cell'; import { CellType, @@ -22,6 +16,12 @@ import { scale, transformRatioToPercent, } from '@/utils/g-mini-charts'; +import type { IElement } from '@antv/g-lite'; +import { forEach, last, map } from 'lodash'; +import { data } from 'tests/data/mock-dataset.json'; +import { assembleDataCfg, assembleOptions } from 'tests/util'; +import { createPivotSheet, getContainer } from 'tests/util/helpers'; +import type { RangeColors } from '../../../src/common/interface/theme'; const getChartData = (type: MiniChartType) => { return { diff --git a/packages/s2-core/__tests__/unit/utils/get-all-child-cells-spec.ts b/packages/s2-core/__tests__/unit/utils/get-all-child-cells-spec.ts index 38512b2af8..dcbf092df0 100644 --- a/packages/s2-core/__tests__/unit/utils/get-all-child-cells-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/get-all-child-cells-spec.ts @@ -1,6 +1,6 @@ /* eslint-disable max-classes-per-file */ -import { Group } from '@antv/g'; import { getAllChildCells } from '@/utils/get-all-child-cells'; +import { Group } from '@antv/g'; class MockDataCell extends Group {} class MockTableRowCell extends Group {} diff --git a/packages/s2-core/__tests__/unit/utils/get-all-children-node-height-spec.ts b/packages/s2-core/__tests__/unit/utils/get-all-children-node-height-spec.ts index 58ef808323..084f9dd729 100644 --- a/packages/s2-core/__tests__/unit/utils/get-all-children-node-height-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/get-all-children-node-height-spec.ts @@ -1,5 +1,5 @@ -import { getAllChildrenNodeHeight } from '@/utils/get-all-children-node-height'; import { Node } from '@/facet/layout/node'; +import { getAllChildrenNodeHeight } from '@/utils/get-all-children-node-height'; function generateChildren(height?: number | undefined) { const children: Node[] = []; diff --git a/packages/s2-core/__tests__/unit/utils/grid-spec.ts b/packages/s2-core/__tests__/unit/utils/grid-spec.ts index 853a09c097..bf225d6b31 100644 --- a/packages/s2-core/__tests__/unit/utils/grid-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/grid-spec.ts @@ -1,5 +1,5 @@ -import type { Node } from '@/facet/layout/node'; import type { ViewCellHeights } from '@/facet/layout/interface'; +import type { Node } from '@/facet/layout/node'; import { getColsForGrid, getFrozenRowsForGrid, diff --git a/packages/s2-core/__tests__/unit/utils/hide-columns-spec.ts b/packages/s2-core/__tests__/unit/utils/hide-columns-spec.ts index 03c02f07c8..7563ccd365 100644 --- a/packages/s2-core/__tests__/unit/utils/hide-columns-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/hide-columns-spec.ts @@ -1,22 +1,22 @@ -import { getContainer } from 'tests/util/helpers'; -import type { PivotFacet } from '../../../src/facet'; -import type { HiddenColumnsInfo } from './../../../src/common/interface/store'; -import type { RootInteraction } from '@/interaction/root'; +import { S2Event } from '@/common/constant'; import type { Node } from '@/facet/layout/node'; +import type { RootInteraction } from '@/interaction/root'; +import { PivotSheet, SpreadSheet } from '@/sheet-type'; import { - getHiddenColumnNodes, + getColumns, getHiddenColumnDisplaySiblingNode, + getHiddenColumnNodes, getHiddenColumnsThunkGroup, - isLastColumnAfterHidden, - hideColumns, - hideColumnsByThunkGroup, getValidDisplaySiblingNode, getValidDisplaySiblingNodeId, + hideColumns, + hideColumnsByThunkGroup, isEqualDisplaySiblingNodeId, - getColumns, + isLastColumnAfterHidden, } from '@/utils/hide-columns'; -import { PivotSheet, SpreadSheet } from '@/sheet-type'; -import { S2Event } from '@/common/constant'; +import { getContainer } from 'tests/util/helpers'; +import type { PivotFacet } from '../../../src/facet'; +import type { HiddenColumnsInfo } from './../../../src/common/interface/store'; describe('Hide Columns Tests', () => { let sheet: SpreadSheet; 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 d6fc55570a..e860d79cb1 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 @@ -1,10 +1,10 @@ +import { ColCell } from '@/cell'; import type { Node } from '@/facet/layout/node'; +import type { SpreadSheet } from '@/sheet-type/spread-sheet'; import { getActiveHoverHeaderCells, updateAllColHeaderCellState, } from '@/utils/interaction/hover-event'; -import type { SpreadSheet } from '@/sheet-type/spread-sheet'; -import { ColCell } from '@/cell'; import { InteractionStateName } from '@/common'; diff --git a/packages/s2-core/__tests__/unit/utils/interaction/resize-spec.ts b/packages/s2-core/__tests__/unit/utils/interaction/resize-spec.ts index 8da6764df0..abf4e61519 100644 --- a/packages/s2-core/__tests__/unit/utils/interaction/resize-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/interaction/resize-spec.ts @@ -1,14 +1,14 @@ -import { Group } from '@antv/g'; +import { + ResizeAreaEffect, + ResizeDirectionType, +} from '@/common/constant/resize'; import type { ResizeArea, ResizeInfo } from '@/common/interface'; import { SpreadSheet } from '@/sheet-type'; import { - getResizeAreaAttrs, getOrCreateResizeAreaGroupById, + getResizeAreaAttrs, } from '@/utils/interaction/resize'; -import { - ResizeAreaEffect, - ResizeDirectionType, -} from '@/common/constant/resize'; +import { Group } from '@antv/g'; jest.mock('@/sheet-type'); jest.mock('@/interaction/event-controller'); 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 c288e25e0c..0197de8611 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,3 @@ -import { createFakeSpreadSheet, createMockCellInfo } from 'tests/util/helpers'; -import { TableSeriesNumberCell } from '../../../../src/cell'; import type { ViewMeta } from '@/common'; import { InteractionKeyboardKey, S2Event } from '@/common/constant'; import type { SpreadSheet } from '@/sheet-type/spread-sheet'; @@ -15,6 +13,8 @@ import { isMultiSelectionKey, selectCells, } from '@/utils/interaction/select-event'; +import { createFakeSpreadSheet, createMockCellInfo } from 'tests/util/helpers'; +import { TableSeriesNumberCell } from '../../../../src/cell'; jest.mock('@/cell', () => { return { diff --git a/packages/s2-core/__tests__/unit/utils/interaction/state-controller-spec.ts b/packages/s2-core/__tests__/unit/utils/interaction/state-controller-spec.ts index 93faee639f..85f9e345e3 100644 --- a/packages/s2-core/__tests__/unit/utils/interaction/state-controller-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/interaction/state-controller-spec.ts @@ -1,4 +1,3 @@ -import type { RowCell } from '../../../../src/cell'; import { CellType, InteractionStateName } from '@/common/constant/interaction'; import type { S2Options } from '@/common/interface'; import { Store } from '@/common/store'; @@ -6,6 +5,7 @@ import { RootInteraction } from '@/interaction/root'; import { SpreadSheet } from '@/sheet-type'; import { getCellMeta } from '@/utils/interaction/select-event'; import { clearState, setState } from '@/utils/interaction/state-controller'; +import type { RowCell } from '../../../../src/cell'; jest.mock('@/sheet-type'); jest.mock('@/interaction/event-controller'); diff --git a/packages/s2-core/__tests__/unit/utils/merge-cell-spec.ts b/packages/s2-core/__tests__/unit/utils/merge-cell-spec.ts index 739dccc01a..e52e80ef13 100644 --- a/packages/s2-core/__tests__/unit/utils/merge-cell-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/merge-cell-spec.ts @@ -1,4 +1,3 @@ -import type { Group } from '@antv/g'; import type { DataCell, MergedCell } from '@/cell'; import type { MergedCellInfo, @@ -28,6 +27,7 @@ import { unmergeCell, updateMergedCells, } from '@/utils'; +import type { Group } from '@antv/g'; jest.mock('@/sheet-type'); diff --git a/packages/s2-core/__tests__/unit/utils/number-calculate-spec.ts b/packages/s2-core/__tests__/unit/utils/number-calculate-spec.ts index 9c5105f536..fd1718699e 100644 --- a/packages/s2-core/__tests__/unit/utils/number-calculate-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/number-calculate-spec.ts @@ -1,9 +1,9 @@ import { CellData } from '@/data-set/cell-data'; import { - isNotNumber, - getDataSumByField, - getDataExtremumByField, getDataAvgByField, + getDataExtremumByField, + getDataSumByField, + isNotNumber, } from '@/utils/number-calculate'; describe('Number Calculate Test', () => { 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 1031a7f419..70b1d525af 100644 --- a/packages/s2-core/__tests__/unit/utils/sort-action-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/sort-action-spec.ts @@ -1,22 +1,22 @@ -import { getContainer } from 'tests/util/helpers'; -import { sortData } from 'tests/data/sort-advanced'; -import { - getSortByMeasureValues, - sortAction, - sortByCustom, - sortByFunc, -} from '@/utils/sort-action'; import { EXTRA_FIELD, - type S2Options, - type SortParam, TOTAL_VALUE, - type S2DataConfig, VALUE_FIELD, + type S2DataConfig, + type S2Options, + type SortParam, } from '@/common'; -import { PivotSheet, SpreadSheet } from '@/sheet-type'; import { PivotDataSet, type SortActionParams } from '@/data-set'; import { CellData } from '@/data-set/cell-data'; +import { PivotSheet, SpreadSheet } from '@/sheet-type'; +import { + getSortByMeasureValues, + sortAction, + sortByCustom, + sortByFunc, +} from '@/utils/sort-action'; +import { sortData } from 'tests/data/sort-advanced'; +import { getContainer } from 'tests/util/helpers'; describe('Sort Action Test', () => { describe('Sort Action', () => { diff --git a/packages/s2-core/__tests__/unit/utils/text-spec.ts b/packages/s2-core/__tests__/unit/utils/text-spec.ts index ff463bd036..e2147ab798 100644 --- a/packages/s2-core/__tests__/unit/utils/text-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/text-spec.ts @@ -1,10 +1,4 @@ -import { - createFakeSpreadSheet, - createMockCellInfo, - createPivotSheet, -} from 'tests/util/helpers'; -import type { TextTheme } from '../../../src/common'; -import { safeJsonParse } from '../../../src/utils/common'; +import { ELLIPSIS_SYMBOL } from '@/common'; import { drawCustomContent, getCellWidth, @@ -14,7 +8,13 @@ import { isUpDataValue, isZeroOrEmptyValue, } from '@/utils/text'; -import { ELLIPSIS_SYMBOL } from '@/common'; +import { + createFakeSpreadSheet, + createMockCellInfo, + createPivotSheet, +} from 'tests/util/helpers'; +import type { TextTheme } from '../../../src/common'; +import { safeJsonParse } from '../../../src/utils/common'; jest.mock('@/utils/g-mini-charts'); diff --git a/packages/s2-core/__tests__/unit/utils/tooltip-spec.ts b/packages/s2-core/__tests__/unit/utils/tooltip-spec.ts index eaeb2d78de..18f0c8f1a8 100644 --- a/packages/s2-core/__tests__/unit/utils/tooltip-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/tooltip-spec.ts @@ -1,45 +1,45 @@ -import { - createFakeSpreadSheet, - createMockCellInfo, - createPivotSheet, - createTableSheet, - getContainer, -} from 'tests/util/helpers'; -import { omit } from 'lodash'; -import * as dataConfig from 'tests/data/mock-dataset.json'; -import { customRowGridSimpleFields } from '../../data/custom-grid-simple-fields'; -import { CustomGridData } from '../../data/data-custom-grid'; -import { CellData } from '@/data-set/cell-data'; import type { CellMeta } from '@/common/interface/interaction'; -import { - getAutoAdjustPosition, - setTooltipContainerStyle, - getTooltipOptions, - getTooltipData, - getCustomFieldsSummaries, -} from '@/utils/tooltip'; +import { CellData } from '@/data-set/cell-data'; +import type { BBox } from '@/engine'; +import type { BaseFacet } from '@/facet/base-facet'; import { CellType, + Node, + PivotSheet, + SpreadSheet, + TOOLTIP_CONTAINER_HIDE_CLS, + TOOLTIP_CONTAINER_SHOW_CLS, + TOOLTIP_POSITION_OFFSET, getCellMeta, getTooltipVisibleOperator, - Node, type S2CellType, - SpreadSheet, + type S2DataConfig, + type S2Options, type Tooltip, type TooltipData, - TOOLTIP_POSITION_OFFSET, + type TooltipOperatorMenuItems, + type TooltipSummaryOptions, type Total, type Totals, - TOOLTIP_CONTAINER_SHOW_CLS, - TOOLTIP_CONTAINER_HIDE_CLS, - type TooltipSummaryOptions, - PivotSheet, - type S2DataConfig, - type S2Options, - type TooltipOperatorMenuItems, } from '@/index'; -import type { BaseFacet } from '@/facet/base-facet'; -import type { BBox } from '@/engine'; +import { + getAutoAdjustPosition, + getCustomFieldsSummaries, + getTooltipData, + getTooltipOptions, + setTooltipContainerStyle, +} from '@/utils/tooltip'; +import { omit } from 'lodash'; +import * as dataConfig from 'tests/data/mock-dataset.json'; +import { + createFakeSpreadSheet, + createMockCellInfo, + createPivotSheet, + createTableSheet, + getContainer, +} from 'tests/util/helpers'; +import { customRowGridSimpleFields } from '../../data/custom-grid-simple-fields'; +import { CustomGridData } from '../../data/data-custom-grid'; jest.mock('@/interaction/event-controller'); diff --git a/packages/s2-core/__tests__/util/helpers.ts b/packages/s2-core/__tests__/util/helpers.ts index b49abfb876..3e0cfbe2ae 100644 --- a/packages/s2-core/__tests__/util/helpers.ts +++ b/packages/s2-core/__tests__/util/helpers.ts @@ -1,53 +1,50 @@ /* eslint-disable max-lines-per-function */ -import fs from 'fs'; -import path from 'path'; -import { dsvFormat } from 'd3-dsv'; +/* eslint-disable import/order */ +/* eslint-disable import/no-extraneous-dependencies */ +// eslint-disable-next-line prettier/prettier +import { DEFAULT_OPTIONS, FrozenGroupType } from '@/common/constant'; +import { PivotSheet, SpreadSheet, TableSheet } from '@/sheet-type'; +import type { BaseTooltip } from '@/ui/tooltip'; +import { customMerge } from '@/utils/merge'; import EE from '@antv/event-emitter'; import { Canvas, FederatedMouseEvent, FederatedPointerEvent, - type CanvasConfig, Group, + type CanvasConfig, } from '@antv/g'; +import { Renderer } from '@antv/g-canvas'; +import { dsvFormat } from 'd3-dsv'; +import fs from 'fs'; import { omit } from 'lodash'; -import * as simpleDataConfig from 'tests/data/simple-data.json'; +import path from 'path'; import * as dataConfig from 'tests/data/mock-dataset.json'; -import { Renderer } from '@antv/g-canvas'; +import * as simpleDataConfig from 'tests/data/simple-data.json'; +import { assembleDataCfg, assembleOptions } from '.'; import { - getTheme, - type BaseDataSet, - type Node, + DEFAULT_FROZEN_COUNTS, + EventController, + FrozenGroupArea, Hierarchy, - type FormatOptions, - asyncGetAllPlainData, + RootInteraction, + Store, TAB_SEPARATOR, - EventController, + asyncGetAllPlainData, getDefaultSeriesNumberText, + getTheme, + type BaseDataSet, + type BaseFacet, + type FormatOptions, + type InternalFullyTheme, + type LayoutResult, + type Node, + type S2CellType, + type S2DataConfig, + type S2Options, + type ViewMeta, } from '../../src'; - -import { assembleOptions, assembleDataCfg } from '.'; -import { RootInteraction } from '@/interaction/root'; -import { Store } from '@/common/store'; -import type { - InternalFullyTheme, - LayoutResult, - S2CellType, - S2DataConfig, - S2Options, - ViewMeta, -} from '@/common/interface'; -import { PivotSheet, SpreadSheet, TableSheet } from '@/sheet-type'; -import type { BaseTooltip } from '@/ui/tooltip'; -import { customMerge } from '@/utils/merge'; -import { - DEFAULT_FROZEN_COUNTS, - DEFAULT_OPTIONS, - FrozenGroupArea, - FrozenGroupType, -} from '@/common/constant'; -import type { BaseFacet } from '@/facet'; -import type { PanelBBox } from '@/facet/bbox/panel-bbox'; +import type { PanelBBox } from '../../src/facet/bbox/panel-bbox'; export const parseCSV = (csv: string, header?: string[]) => { const DELIMITER = ','; diff --git a/packages/s2-core/__tests__/util/index.ts b/packages/s2-core/__tests__/util/index.ts index 590920438e..14ba3affdb 100644 --- a/packages/s2-core/__tests__/util/index.ts +++ b/packages/s2-core/__tests__/util/index.ts @@ -1,4 +1,6 @@ -import { data, meta, totalData } from 'tests/data/mock-dataset.json'; +/* eslint-disable import/order */ +/* eslint-disable import/no-extraneous-dependencies */ +// eslint-disable-next-line prettier/prettier import { DEFAULT_DATA_CONFIG, DEFAULT_OPTIONS, @@ -8,6 +10,7 @@ import { type S2Options, } from '@/index'; import { customMerge } from '@/utils'; +import { data, meta, totalData } from 'tests/data/mock-dataset.json'; export const assembleOptions = (...options: Partial[]) => { const s2Options: S2Options = { diff --git a/packages/s2-core/__tests__/util/interaction.ts b/packages/s2-core/__tests__/util/interaction.ts index 95e7ae24c2..8011859fb1 100644 --- a/packages/s2-core/__tests__/util/interaction.ts +++ b/packages/s2-core/__tests__/util/interaction.ts @@ -1,8 +1,8 @@ import { size, sumBy } from 'lodash'; import { + SpreadSheet, getTooltipData, mergeCellInfo, - SpreadSheet, type S2CellType, type TooltipSummaryOptions, } from '../../src'; diff --git a/packages/s2-core/package.json b/packages/s2-core/package.json index 1d33a5261f..14faab8e3a 100644 --- a/packages/s2-core/package.json +++ b/packages/s2-core/package.json @@ -1,26 +1,38 @@ { - "private": false, "name": "@antv/s2", "version": "2.0.0-next.23", - "main": "lib/index.js", - "unpkg": "dist/index.min.js", - "module": "esm/index.js", - "types": "esm/index.d.ts", - "src": "src/index.ts", + "private": false, "description": "effective spreadsheet render core lib", - "license": "MIT", + "keywords": [ + "antv", + "s2", + "S2", + "s2-core", + "spreadsheet", + "pivot table", + "table" + ], "homepage": "https://s2.antv.antgroup.com", - "author": "https://github.com/orgs/antvis/people", - "directories": { - "lib": "lib", - "test": "tests" + "bugs": { + "url": "https://github.com/antvis/S2/issues" }, "repository": { "type": "git", "url": "https://github.com/antvis/S2.git" }, - "bugs": { - "url": "https://github.com/antvis/S2/issues" + "license": "MIT", + "author": "https://github.com/orgs/antvis/people", + "sideEffects": [ + "*.css", + "dist/*" + ], + "main": "lib/index.js", + "unpkg": "dist/index.min.js", + "module": "esm/index.js", + "types": "esm/index.d.ts", + "directories": { + "lib": "lib", + "test": "tests" }, "files": [ "esm", @@ -28,43 +40,34 @@ "dist", "README.md" ], - "keywords": [ - "antv", - "s2", - "S2", - "s2-core", - "spreadsheet", - "pivot table", - "table" - ], "scripts": { - "start": "pnpm test:live", - "clean": "rimraf lib esm dist temp", "build": "npm-run-all clean --parallel build:umd build:cjs build:esm build:dts", - "build:esm": "cross-env FORMAT=es rollup -c rollup.config.mjs", - "build:cjs": "cross-env FORMAT=cjs rollup -c rollup.config.mjs", - "build:umd": "cross-env FORMAT=umd rollup -c rollup.config.mjs", "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:size-limit": "size-limit", "build:size-limit-json": "pnpm build:size-limit -- --json", + "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", - "watch": "rimraf esm && pnpm build:esm -w", - "test:live": "node ./scripts/test-live.mjs", + "start": "pnpm test:live", "sync-event": "node ./scripts/sync-event.mjs", "test": "jest --passWithNoTests --detectOpenHandles", - "test:coverage": "pnpm test -- --coverage", "test:ci": "pnpm test -- --maxWorkers=3", "test:ci-coverage": "pnpm test:coverage --maxWorkers=3", + "test:coverage": "pnpm test -- --coverage", + "test:live": "node ./scripts/test-live.mjs", "test:watch": "pnpm test -- --watch", - "tsc": "tsc --noEmit" + "tsc": "tsc --noEmit", + "watch": "rimraf esm && pnpm build:esm -w" }, "dependencies": { - "@antv/g-lite": "^2.0.5", "@antv/event-emitter": "^0.1.3", "@antv/g": "^6.0.6", - "@antv/g-canvas": "^2.0.6", + "@antv/g-canvas": "^2.0.7", + "@antv/g-lite": "^2.0.5", "d3-ease": "^3.0.1", "d3-interpolate": "^1.3.2", "d3-timer": "^1.0.9", @@ -72,7 +75,7 @@ "lodash": "^4.17.21" }, "devDependencies": { - "@testing-library/dom": "^9.3.3", + "@testing-library/dom": "^10.1.0", "@types/d3-dsv": "^3.0.7", "@types/d3-ease": "^3.0.2", "@types/d3-interpolate": "^3.0.4", @@ -82,10 +85,9 @@ "d3-dsv": "^1.1.1", "tinycolor2": "^1.6.0" }, - "sideEffects": [ - "*.css", - "dist/*" - ], + "publishConfig": { + "access": "public" + }, "size-limit": [ { "path": "./dist/index.min.js", @@ -97,9 +99,7 @@ "limit": "5 kB" } ], - "publishConfig": { - "access": "public" - }, + "src": "src/index.ts", "tnpm": { "mode": "pnpm" } diff --git a/packages/s2-core/rollup.config.mjs b/packages/s2-core/rollup.config.mjs index 3c197ea994..c92c130032 100644 --- a/packages/s2-core/rollup.config.mjs +++ b/packages/s2-core/rollup.config.mjs @@ -3,11 +3,11 @@ import alias from '@rollup/plugin-alias'; import commonjs from '@rollup/plugin-commonjs'; import resolve from '@rollup/plugin-node-resolve'; import replace from '@rollup/plugin-replace'; -import postcss from 'rollup-plugin-postcss'; import terser from '@rollup/plugin-terser'; +import peerDepsExternal from 'rollup-plugin-peer-deps-external'; +import postcss from 'rollup-plugin-postcss'; import typescript from 'rollup-plugin-typescript2'; import { visualizer } from 'rollup-plugin-visualizer'; -import peerDepsExternal from 'rollup-plugin-peer-deps-external'; const format = process.env.FORMAT; const enableAnalysis = process.env.ANALYSIS; diff --git a/packages/s2-core/src/cell/col-cell.ts b/packages/s2-core/src/cell/col-cell.ts index 69600f125a..c536a189f4 100644 --- a/packages/s2-core/src/cell/col-cell.ts +++ b/packages/s2-core/src/cell/col-cell.ts @@ -1,7 +1,5 @@ import type { Group, PointLike } from '@antv/g'; import { isEmpty } from 'lodash'; -import { adjustTextIconPositionWhileScrolling } from '../utils/cell/text-scrolling'; -import { normalizeTextAlign } from '../utils/normalize'; import { CellType, FrozenGroupArea, @@ -20,21 +18,25 @@ import type { import { CellBorderPosition, CellClipBox } from '../common/interface'; import type { AreaRange } from '../common/interface/scroll'; import { CustomRect, type SimpleBBox } from '../engine'; +import type { FrozenFacet } from '../facet'; import { Frame, type ColHeaderConfig } from '../facet/header'; import { getHorizontalTextIconPosition, getVerticalIconPosition, getVerticalTextPosition, } from '../utils/cell/cell'; +import { adjustTextIconPositionWhileScrolling } from '../utils/cell/text-scrolling'; import { renderIcon, renderLine } from '../utils/g-renders'; -import { isLastColumnAfterHidden } from '../utils/hide-columns'; +import { + isEqualDisplaySiblingNodeId, + isLastColumnAfterHidden, +} from '../utils/hide-columns'; import { getOrCreateResizeAreaGroupById, getResizeAreaAttrs, shouldAddResizeArea, } from '../utils/interaction/resize'; -import type { FrozenFacet } from '../facet'; -import { isEqualDisplaySiblingNodeId } from './../utils/hide-columns'; +import { normalizeTextAlign } from '../utils/normalize'; import { HeaderCell } from './header-cell'; export class ColCell extends HeaderCell { diff --git a/packages/s2-core/src/cell/corner-cell.ts b/packages/s2-core/src/cell/corner-cell.ts index ad34548540..a425562990 100644 --- a/packages/s2-core/src/cell/corner-cell.ts +++ b/packages/s2-core/src/cell/corner-cell.ts @@ -22,8 +22,8 @@ import { renderTreeIcon } from '../utils/g-renders'; import { getOrCreateResizeAreaGroupById, getResizeAreaAttrs, + shouldAddResizeArea, } from '../utils/interaction/resize'; -import { shouldAddResizeArea } from './../utils/interaction/resize'; import { HeaderCell } from './header-cell'; export class CornerCell extends HeaderCell { diff --git a/packages/s2-core/src/cell/data-cell.ts b/packages/s2-core/src/cell/data-cell.ts index 9681be99b8..169f0fd315 100644 --- a/packages/s2-core/src/cell/data-cell.ts +++ b/packages/s2-core/src/cell/data-cell.ts @@ -24,6 +24,9 @@ import type { Condition, ConditionMappingResult, FormatResult, + HeaderActionNameOptions, + IconCondition, + InteractionStateTheme, MiniChartData, MultiData, TextTheme, @@ -31,13 +34,7 @@ import type { ViewMetaData, ViewMetaIndexType, } from '../common/interface'; -import { - CellBorderPosition, - CellClipBox, - type HeaderActionNameOptions, - type IconCondition, - type InteractionStateTheme, -} from '../common/interface'; +import { CellBorderPosition, CellClipBox } from '../common/interface'; import { CellData } from '../data-set/cell-data'; import { getHorizontalTextIconPosition, diff --git a/packages/s2-core/src/cell/index.ts b/packages/s2-core/src/cell/index.ts index 80545190fd..c0ee350ae1 100644 --- a/packages/s2-core/src/cell/index.ts +++ b/packages/s2-core/src/cell/index.ts @@ -4,24 +4,24 @@ import { CornerCell } from './corner-cell'; import { DataCell } from './data-cell'; import { HeaderCell } from './header-cell'; import { MergedCell } from './merged-cell'; +import { RowCell } from './row-cell'; +import { SeriesNumberCell } from './series-number-cell'; import { TableColCell } from './table-col-cell'; import { TableCornerCell } from './table-corner-cell'; import { TableDataCell } from './table-data-cell'; import { TableSeriesNumberCell } from './table-series-number-cell'; -import { RowCell } from './row-cell'; -import { SeriesNumberCell } from './series-number-cell'; export { - TableCornerCell, - TableColCell, - TableSeriesNumberCell, - TableDataCell, - RowCell, + BaseCell, ColCell, - DataCell, - MergedCell, CornerCell, - BaseCell, + DataCell, HeaderCell, + MergedCell, + RowCell, SeriesNumberCell, + TableColCell, + TableCornerCell, + TableDataCell, + TableSeriesNumberCell, }; diff --git a/packages/s2-core/src/cell/row-cell.ts b/packages/s2-core/src/cell/row-cell.ts index fcaae5e57f..c545fc27af 100644 --- a/packages/s2-core/src/cell/row-cell.ts +++ b/packages/s2-core/src/cell/row-cell.ts @@ -15,6 +15,7 @@ import { type ViewMeta, } from '../common/interface'; import { CustomRect } from '../engine'; +import type { FrozenFacet } from '../facet/frozen-facet'; import type { RowHeaderConfig } from '../facet/header'; import { getHorizontalTextIconPosition, @@ -25,12 +26,11 @@ import { getAllChildrenNodeHeight } from '../utils/get-all-children-node-height' import { getOrCreateResizeAreaGroupById, getResizeAreaAttrs, + shouldAddResizeArea, } from '../utils/interaction/resize'; import { isMobile } from '../utils/is-mobile'; -import type { FrozenFacet } from '../facet/frozen-facet'; import type { SimpleBBox } from './../engine/interface'; import { adjustTextIconPositionWhileScrolling } from './../utils/cell/text-scrolling'; -import { shouldAddResizeArea } from './../utils/interaction/resize'; import { normalizeTextAlign } from './../utils/normalize'; import { HeaderCell } from './header-cell'; diff --git a/packages/s2-core/src/cell/table-col-cell.ts b/packages/s2-core/src/cell/table-col-cell.ts index efd04a5d4f..a907be4bec 100644 --- a/packages/s2-core/src/cell/table-col-cell.ts +++ b/packages/s2-core/src/cell/table-col-cell.ts @@ -6,12 +6,12 @@ import { } 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'; -import type { FrozenFacet } from '../facet/frozen-facet'; export class TableColCell extends ColCell { protected handleRestOptions(...[headerConfig]: [BaseHeaderConfig]) { diff --git a/packages/s2-core/src/cell/table-data-cell.ts b/packages/s2-core/src/cell/table-data-cell.ts index ffe228f02d..fc47f8f640 100644 --- a/packages/s2-core/src/cell/table-data-cell.ts +++ b/packages/s2-core/src/cell/table-data-cell.ts @@ -1,4 +1,5 @@ import { DataCell } from '../cell/data-cell'; +import type { CellMeta } from '../common'; import { CellType, FrozenGroupArea, @@ -6,15 +7,14 @@ import { ResizeAreaEffect, ResizeDirectionType, } from '../common/constant'; +import { CustomRect, type SimpleBBox } from '../engine'; +import type { FrozenFacet } from '../facet/frozen-facet'; import { isFrozenRow, isFrozenTrailingRow } from '../facet/utils'; import { getOrCreateResizeAreaGroupById, getResizeAreaAttrs, shouldAddResizeArea, } from '../utils/interaction/resize'; -import { CustomRect, type SimpleBBox } from '../engine'; -import type { FrozenFacet } from '../facet/frozen-facet'; -import type { CellMeta } from '../common'; export class TableDataCell extends DataCell { protected getLinkFieldStyle() { diff --git a/packages/s2-core/src/common/constant/events/index.ts b/packages/s2-core/src/common/constant/events/index.ts index 7ee12bd520..80f91c59c1 100644 --- a/packages/s2-core/src/common/constant/events/index.ts +++ b/packages/s2-core/src/common/constant/events/index.ts @@ -1,3 +1,3 @@ +export * from './basic'; export * from './interaction'; export * from './origin'; -export * from './basic'; diff --git a/packages/s2-core/src/common/constant/index.ts b/packages/s2-core/src/common/constant/index.ts index c9e8259d6d..8635ab733f 100644 --- a/packages/s2-core/src/common/constant/index.ts +++ b/packages/s2-core/src/common/constant/index.ts @@ -1,16 +1,16 @@ -export * from './field'; -export * from './events'; export * from './basic'; export * from './classnames'; export * from './condition'; +export * from './copy'; export * from './dataConfig'; +export * from './events'; +export * from './field'; export * from './frozen'; export * from './interaction'; +export * from './node'; export * from './options'; -export * from './theme'; -export * from './tooltip'; -export * from './resize'; -export * from './copy'; export * from './pagination'; -export * from './node'; export * from './query'; +export * from './resize'; +export * from './theme'; +export * from './tooltip'; diff --git a/packages/s2-core/src/common/constant/options.ts b/packages/s2-core/src/common/constant/options.ts index 2ba11244f5..e4c4f85e31 100644 --- a/packages/s2-core/src/common/constant/options.ts +++ b/packages/s2-core/src/common/constant/options.ts @@ -8,7 +8,7 @@ import { ScrollbarPositionType, } from '../constant/interaction'; import type { CellTextWordWrapStyle, S2Style } from '../interface'; -import type { S2Options, S2BaseFrozenOptions } from '../interface/s2Options'; +import type { S2BaseFrozenOptions, S2Options } from '../interface/s2Options'; import { DeviceType } from '../interface/s2Options'; import { EMPTY_PLACEHOLDER } from './basic'; diff --git a/packages/s2-core/src/common/constant/theme.ts b/packages/s2-core/src/common/constant/theme.ts index cf1a9e301e..14678c7f0d 100644 --- a/packages/s2-core/src/common/constant/theme.ts +++ b/packages/s2-core/src/common/constant/theme.ts @@ -1,7 +1,7 @@ import { paletteColorful } from '../../theme/palette/colorful'; +import { paletteDark } from '../../theme/palette/dark'; import { paletteDefault } from '../../theme/palette/default'; import { paletteGray } from '../../theme/palette/gray'; -import { paletteDark } from '../../theme/palette/dark'; import type { ThemeName } from '../interface'; // Map of the theme diff --git a/packages/s2-core/src/common/i18n/index.ts b/packages/s2-core/src/common/i18n/index.ts index 7fef26d847..7e18f4c2d0 100644 --- a/packages/s2-core/src/common/i18n/index.ts +++ b/packages/s2-core/src/common/i18n/index.ts @@ -1,6 +1,6 @@ import { get, merge } from 'lodash'; -import { ZH_CN as BASE_ZH_CN } from './zh_CN'; import { EN_US as BASE_EN_US } from './en_US'; +import { ZH_CN as BASE_ZH_CN } from './zh_CN'; const DEFAULT_LANG: LangType = 'zh_CN'; diff --git a/packages/s2-core/src/common/icons/svg/index.ts b/packages/s2-core/src/common/icons/svg/index.ts index 86bb41bde7..a5b360b960 100644 --- a/packages/s2-core/src/common/icons/svg/index.ts +++ b/packages/s2-core/src/common/icons/svg/index.ts @@ -3,21 +3,21 @@ export { ArrowUp, CellDown, CellUp, + DrillDownIcon, + Empty, + ExpandColIcon, + EyeOutlined, GlobalAsc, GlobalDesc, GroupAsc, GroupDesc, GroupNone, + InfoCircle, Minus, Plus, SortDown, - SortUp, SortDownSelected, + SortUp, SortUpSelected, - InfoCircle, - ExpandColIcon, Trend, - DrillDownIcon, - EyeOutlined, - Empty, } from './svgs'; diff --git a/packages/s2-core/src/common/interface/export.ts b/packages/s2-core/src/common/interface/export.ts index 2cb14793ab..b3abc8eaec 100644 --- a/packages/s2-core/src/common/interface/export.ts +++ b/packages/s2-core/src/common/interface/export.ts @@ -1,6 +1,6 @@ -import type { SpreadSheet } from '../../sheet-type'; -import type { DataItem, CellMeta } from '..'; +import type { CellMeta, DataItem } from '..'; import { EXTRA_FIELD } from '..'; +import type { SpreadSheet } from '../../sheet-type'; export type MatrixPlainTransformer = ( data: DataItem[][], diff --git a/packages/s2-core/src/common/interface/index.ts b/packages/s2-core/src/common/interface/index.ts index c2352c7846..55e8f31e43 100644 --- a/packages/s2-core/src/common/interface/index.ts +++ b/packages/s2-core/src/common/interface/index.ts @@ -1,7 +1,10 @@ export * from './basic'; +export * from './collapse'; export * from './condition'; export * from './emitter'; export * from './events'; +export * from './export'; +export * from './facet'; export * from './frame'; export * from './hooks'; export * from './interaction'; @@ -11,11 +14,8 @@ export * from './s2DataConfig'; export * from './s2Options'; export * from './scroll'; export * from './store'; -export * from './theme'; -export * from './tooltip'; -export * from './facet'; export * from './style'; -export * from './collapse'; export * from './text'; +export * from './theme'; +export * from './tooltip'; export * from './type-utils'; -export * from './export'; diff --git a/packages/s2-core/src/common/interface/interaction.ts b/packages/s2-core/src/common/interface/interaction.ts index 72270df567..72e922b3ce 100644 --- a/packages/s2-core/src/common/interface/interaction.ts +++ b/packages/s2-core/src/common/interface/interaction.ts @@ -22,8 +22,8 @@ import type { InterceptType, ScrollbarPositionType, } from '../constant'; -import type { Transformer } from './export'; import type { ViewMeta } from './basic'; +import type { Transformer } from './export'; import type { ResizeInteractionOptions } from './resize'; export type S2CellType = diff --git a/packages/s2-core/src/common/interface/s2Options.ts b/packages/s2-core/src/common/interface/s2Options.ts index 4b51622e92..32d1ac6dc7 100644 --- a/packages/s2-core/src/common/interface/s2Options.ts +++ b/packages/s2-core/src/common/interface/s2Options.ts @@ -8,8 +8,10 @@ import type { import type { CellCallback, CornerHeaderCallback, + CustomSVGIcon, DataCellCallback, FrameCallback, + HeaderActionIcon, MergedCellCallback, MergedCellInfo, Pagination, @@ -31,7 +33,6 @@ import type { RowHeaderConfig, } from '../../facet/header/interface'; import type { SpreadSheet } from '../../sheet-type'; -import type { CustomSVGIcon, HeaderActionIcon } from './basic'; import type { Conditions } from './condition'; import type { InteractionOptions } from './interaction'; import type { S2Style } from './style'; diff --git a/packages/s2-core/src/common/interface/store.ts b/packages/s2-core/src/common/interface/store.ts index 8fe4c72c0e..c54b32297c 100644 --- a/packages/s2-core/src/common/interface/store.ts +++ b/packages/s2-core/src/common/interface/store.ts @@ -1,19 +1,19 @@ import type { Group } from '@antv/g'; -import type { BBox } from '../../engine'; +import type { GuiIcon } from '../../common/icons'; import type { InteractionOptions, InteractionStateInfo, + PartDrillDownFieldInLevel, S2CellType, SortMethod, SortParam, ViewMeta, -} from '../interface'; +} from '../../common/interface'; +import type { BBox } from '../../engine'; import type { Node } from '../../facet/layout/node'; -import type { PartDrillDownFieldInLevel } from '../../common/interface'; -import type { GuiIcon } from '../../common/icons'; import type { DataPath } from './../../data-set/interface'; -import type { S2DataConfig } from './s2DataConfig'; import type { ValueRanges } from './condition'; +import type { S2DataConfig } from './s2DataConfig'; export interface HiddenColumnsInfo { /** 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 8afd4d4850..5b1f5cb1cc 100644 --- a/packages/s2-core/src/data-set/base-data-set.ts +++ b/packages/s2-core/src/data-set/base-data-set.ts @@ -1,3 +1,5 @@ +/* eslint-disable import/order */ +// eslint-disable-next-line prettier/prettier import { compact, find, @@ -34,8 +36,8 @@ import { } from '../utils/condition/state-controller'; import { generateExtraFieldMeta } from '../utils/dataset/pivot-data-set'; import type { Indexes } from '../utils/indexes'; -import type { GetCellDataParams, Query } from './interface'; import type { GetCellMultiDataParams } from './index'; +import type { GetCellDataParams, Query } from './interface'; export abstract class BaseDataSet { /** diff --git a/packages/s2-core/src/data-set/cell-data.ts b/packages/s2-core/src/data-set/cell-data.ts index c112ad9738..380fdfd781 100644 --- a/packages/s2-core/src/data-set/cell-data.ts +++ b/packages/s2-core/src/data-set/cell-data.ts @@ -1,7 +1,7 @@ /* eslint-disable no-empty-function */ +import { EXTRA_FIELD, ORIGIN_FIELD, VALUE_FIELD } from '../common/constant'; import type { ViewMetaData } from '../common/interface/basic'; import type { RawData } from '../common/interface/s2DataConfig'; -import { ORIGIN_FIELD, EXTRA_FIELD, VALUE_FIELD } from '../common/constant'; export class CellData { constructor( diff --git a/packages/s2-core/src/data-set/table-data-set.ts b/packages/s2-core/src/data-set/table-data-set.ts index 2795deecad..7a1fac3a70 100644 --- a/packages/s2-core/src/data-set/table-data-set.ts +++ b/packages/s2-core/src/data-set/table-data-set.ts @@ -6,8 +6,8 @@ import type { S2DataConfig, SimpleData, } from '../common/interface'; -import { isAscSort, isDescSort } from '../utils/sort-action'; import { getEmptyPlaceholder } from '../utils'; +import { isAscSort, isDescSort } from '../utils/sort-action'; import { BaseDataSet } from './base-data-set'; import type { GetCellDataParams, GetCellMultiDataParams } from './interface'; diff --git a/packages/s2-core/src/facet/base-facet.ts b/packages/s2-core/src/facet/base-facet.ts index 5cf9efe3e9..7129e711ad 100644 --- a/packages/s2-core/src/facet/base-facet.ts +++ b/packages/s2-core/src/facet/base-facet.ts @@ -102,6 +102,7 @@ import { type BaseHeaderConfig, type RowHeaderConfig, } from './header'; +import type { TableColHeader } from './header/table-col'; import type { Hierarchy } from './layout/hierarchy'; import type { ViewCellHeights } from './layout/interface'; import { Node } from './layout/node'; @@ -112,7 +113,6 @@ import { optimizeScrollXY, translateGroup, } from './utils'; -import type { TableColHeader } from './header/table-col'; export abstract class BaseFacet { // spreadsheet instance diff --git a/packages/s2-core/src/facet/bbox/base-bbox.ts b/packages/s2-core/src/facet/bbox/base-bbox.ts index df90396c5b..d9144599de 100644 --- a/packages/s2-core/src/facet/bbox/base-bbox.ts +++ b/packages/s2-core/src/facet/bbox/base-bbox.ts @@ -1,5 +1,5 @@ -import type { BBox } from '../../engine'; import type { LayoutResult } from '../../common/interface'; +import type { BBox } from '../../engine'; import type { SpreadSheet } from '../../sheet-type'; import type { BaseFacet } from '../base-facet'; diff --git a/packages/s2-core/src/facet/frozen-facet.ts b/packages/s2-core/src/facet/frozen-facet.ts index ae314ab0b3..5a988c5423 100644 --- a/packages/s2-core/src/facet/frozen-facet.ts +++ b/packages/s2-core/src/facet/frozen-facet.ts @@ -1,16 +1,21 @@ import { Group, Rect, type LineStyleProps } from '@antv/g'; import { last } from 'lodash'; import type { DataCell } from '../cell'; +import type { S2BaseFrozenOptions } from '../common'; import { FRONT_GROUND_GROUP_FROZEN_Z_INDEX, - FrozenGroupType, FrozenGroupArea, + FrozenGroupAreaTypeMap, + FrozenGroupType, KEY_GROUP_FROZEN_SPLIT_LINE, PANEL_GROUP_FROZEN_GROUP_Z_INDEX, S2Event, SPLIT_LINE_WIDTH, - FrozenGroupAreaTypeMap, } from '../common/constant'; +import type { + FrozenGroupAreas, + FrozenGroups, +} from '../common/interface/frozen'; import type { SimpleBBox } from '../engine'; import { FrozenGroup } from '../group/frozen-group'; import { getValidFrozenOptions, renderLine } from '../utils'; @@ -21,12 +26,13 @@ import { } from '../utils/grid'; import type { Indexes, PanelIndexes } from '../utils/indexes'; import { floor } from '../utils/math'; -import type { - FrozenGroupAreas, - FrozenGroups, -} from '../common/interface/frozen'; -import type { S2BaseFrozenOptions } from '../common'; import { BaseFacet } from './base-facet'; +import { + getFrozenColOffset, + getFrozenTrailingColOffset, + getFrozenTrailingRowOffset, + getScrollGroupClip, +} from './header/util'; import { Node } from './layout/node'; import { calculateFrozenCornerCells, @@ -35,12 +41,6 @@ import { splitInViewIndexesWithFrozen, translateGroup, } from './utils'; -import { - getFrozenColOffset, - getFrozenTrailingColOffset, - getFrozenTrailingRowOffset, - getScrollGroupClip, -} from './header/util'; /** * Defines the row freeze abstract standard interface diff --git a/packages/s2-core/src/facet/header/col.ts b/packages/s2-core/src/facet/header/col.ts index f90b26ab76..79754c95f5 100644 --- a/packages/s2-core/src/facet/header/col.ts +++ b/packages/s2-core/src/facet/header/col.ts @@ -10,9 +10,9 @@ import { KEY_GROUP_COL_SCROLL, S2Event, } from '../../common/constant'; +import type { FrozenFacet } from '../frozen-facet'; import type { Node } from '../layout/node'; import { translateGroupX } from '../utils'; -import type { FrozenFacet } from '../frozen-facet'; import { BaseHeader } from './base'; import type { ColHeaderConfig } from './interface'; import { diff --git a/packages/s2-core/src/facet/header/corner.ts b/packages/s2-core/src/facet/header/corner.ts index 9f0be4b9a3..21b02d6862 100644 --- a/packages/s2-core/src/facet/header/corner.ts +++ b/packages/s2-core/src/facet/header/corner.ts @@ -1,4 +1,4 @@ -import { Rect, type PointLike, Group } from '@antv/g'; +import { Group, Rect, type PointLike } from '@antv/g'; import { includes } from 'lodash'; import { CornerCell } from '../../cell/corner-cell'; import { S2Event } from '../../common'; diff --git a/packages/s2-core/src/facet/header/frame.ts b/packages/s2-core/src/facet/header/frame.ts index 0c6f2cb680..c0ca9f8915 100644 --- a/packages/s2-core/src/facet/header/frame.ts +++ b/packages/s2-core/src/facet/header/frame.ts @@ -1,10 +1,10 @@ import { Group, Rect } from '@antv/g'; -import { renderLine } from '.././../utils/g-renders'; import type { FrameConfig } from '../../common/interface'; -import { translateGroup } from '../utils'; import type { SpreadSheet } from '../../sheet-type/spread-sheet'; import { floor } from '../../utils/math'; +import { renderLine } from '.././../utils/g-renders'; import type { FrozenFacet } from '../frozen-facet'; +import { translateGroup } from '../utils'; export class Frame extends Group { declare cfg: FrameConfig; diff --git a/packages/s2-core/src/facet/header/row.ts b/packages/s2-core/src/facet/header/row.ts index 61822644e1..b221f7cfdd 100644 --- a/packages/s2-core/src/facet/header/row.ts +++ b/packages/s2-core/src/facet/header/row.ts @@ -1,8 +1,6 @@ import { Group, Rect } from '@antv/g'; import { each } from 'lodash'; import { RowCell, SeriesNumberCell } from '../../cell'; -import type { Node } from '../layout/node'; -import { translateGroup } from '../utils'; import { FRONT_GROUND_GROUP_FROZEN_Z_INDEX, FRONT_GROUND_GROUP_SCROLL_Z_INDEX, @@ -13,6 +11,8 @@ import { S2Event, } from '../../common'; import type { FrozenFacet } from '../frozen-facet'; +import type { Node } from '../layout/node'; +import { translateGroup } from '../utils'; import { BaseHeader } from './base'; import type { RowHeaderConfig } from './interface'; import { getExtraFrozenRowNodes, getFrozenTrailingRowOffset } from './util'; diff --git a/packages/s2-core/src/facet/header/series-number.ts b/packages/s2-core/src/facet/header/series-number.ts index b6b644ff89..7b766944e5 100644 --- a/packages/s2-core/src/facet/header/series-number.ts +++ b/packages/s2-core/src/facet/header/series-number.ts @@ -1,9 +1,5 @@ import { Group } from '@antv/g'; import { SeriesNumberCell } from '../../cell/series-number-cell'; -import type { SpreadSheet } from '../../sheet-type/index'; -import type { PanelBBox } from '../bbox/panel-bbox'; -import type { Hierarchy } from '../layout/hierarchy'; -import type { Node } from '../layout/node'; import { FRONT_GROUND_GROUP_FROZEN_Z_INDEX, FRONT_GROUND_GROUP_SCROLL_Z_INDEX, @@ -12,9 +8,13 @@ import { KEY_GROUP_ROW_INDEX_SCROLL, S2Event, } from '../../common'; +import type { SpreadSheet } from '../../sheet-type/index'; +import type { PanelBBox } from '../bbox/panel-bbox'; import type { FrozenFacet } from '../frozen-facet'; -import { getExtraFrozenSeriesNodes, getSeriesNumberNodes } from './util'; +import type { Hierarchy } from '../layout/hierarchy'; +import type { Node } from '../layout/node'; import { RowHeader } from './row'; +import { getExtraFrozenSeriesNodes, getSeriesNumberNodes } from './util'; export class SeriesNumberHeader extends RowHeader { /** diff --git a/packages/s2-core/src/facet/header/util.ts b/packages/s2-core/src/facet/header/util.ts index dbe8340690..d856b4e4a4 100644 --- a/packages/s2-core/src/facet/header/util.ts +++ b/packages/s2-core/src/facet/header/util.ts @@ -1,11 +1,11 @@ import type { PointLike } from '@antv/g-lite'; import { isNumber } from 'lodash'; import { FrozenGroupArea, ROOT_NODE_ID } from '../../common'; +import type { AreaBBox } from '../../common/interface/frozen'; import type { SpreadSheet } from '../../sheet-type'; import type { FrozenFacet } from '../frozen-facet'; import type { Hierarchy } from '../layout/hierarchy'; import { Node } from '../layout/node'; -import type { AreaBBox } from '../../common/interface/frozen'; import { Frame } from './frame'; export const getSeriesNumberNodes = ( diff --git a/packages/s2-core/src/facet/index.ts b/packages/s2-core/src/facet/index.ts index bf055bfcc2..080b7e7092 100644 --- a/packages/s2-core/src/facet/index.ts +++ b/packages/s2-core/src/facet/index.ts @@ -1,7 +1,7 @@ import { BaseFacet } from './base-facet'; +import { FrozenFacet } from './frozen-facet'; import { PivotFacet } from './pivot-facet'; import { TableFacet } from './table-facet'; -import { FrozenFacet } from './frozen-facet'; export * from './header'; -export { BaseFacet, PivotFacet, TableFacet, FrozenFacet }; +export { BaseFacet, FrozenFacet, PivotFacet, TableFacet }; 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 0b0cfc3283..e33c770bef 100644 --- a/packages/s2-core/src/facet/layout/build-gird-hierarchy.ts +++ b/packages/s2-core/src/facet/layout/build-gird-hierarchy.ts @@ -1,5 +1,6 @@ import { isEmpty } from 'lodash'; import { EMPTY_FIELD_VALUE, EXTRA_FIELD } from '../../common/constant'; +import { filterOutDetail } from '../../utils/data-set-operate'; import { addTotals } from '../../utils/layout/add-totals'; import { generateHeaderNodes } from '../../utils/layout/generate-header-nodes'; import { getDimsCondition } from '../../utils/layout/get-dims-condition-by-node'; @@ -7,7 +8,6 @@ import { whetherLeafByLevel } from '../../utils/layout/whether-leaf-by-level'; import type { FieldValue, GridHeaderParams } from '../layout/interface'; import { layoutArrange } from '../layout/layout-hooks'; import { TotalMeasure } from '../layout/total-measure'; -import { filterOutDetail } from '../../utils/data-set-operate'; import { TotalClass } from './total-class'; const buildTotalGridHierarchy = (params: GridHeaderParams) => { diff --git a/packages/s2-core/src/facet/mobile/wheelEvent.ts b/packages/s2-core/src/facet/mobile/wheelEvent.ts index cc37ef1580..ea7c08c6a8 100644 --- a/packages/s2-core/src/facet/mobile/wheelEvent.ts +++ b/packages/s2-core/src/facet/mobile/wheelEvent.ts @@ -1,10 +1,10 @@ import EE from '@antv/event-emitter'; -import { easeCubicIn as easeFunc } from 'd3-ease'; import type { Canvas, FederatedPointerEvent, FederatedWheelEvent, } from '@antv/g'; +import { easeCubicIn as easeFunc } from 'd3-ease'; import { OriginEventType } from '../../common'; /** 获取执行时间戳 */ diff --git a/packages/s2-core/src/facet/pivot-facet.ts b/packages/s2-core/src/facet/pivot-facet.ts index 6454d96f8c..189e947f60 100644 --- a/packages/s2-core/src/facet/pivot-facet.ts +++ b/packages/s2-core/src/facet/pivot-facet.ts @@ -37,9 +37,9 @@ import { getDataCellId } from '../utils/cell/data-cell'; import { getActionIconConfig } from '../utils/cell/header-cell'; 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 { getAllChildCells } from '../utils/get-all-child-cells'; import { FrozenFacet } from './frozen-facet'; import { Frame } from './header'; import { buildHeaderHierarchy } from './layout/build-header-hierarchy'; diff --git a/packages/s2-core/src/facet/utils.ts b/packages/s2-core/src/facet/utils.ts index 1477cf2369..7b39f4fff7 100644 --- a/packages/s2-core/src/facet/utils.ts +++ b/packages/s2-core/src/facet/utils.ts @@ -10,8 +10,8 @@ import type { S2BaseFrozenOptions, ScrollSpeedRatio, } from '../common/interface'; -import type { Indexes } from '../utils/indexes'; import type { SimpleBBox } from '../engine'; +import type { Indexes } from '../utils/indexes'; import type { ViewCellHeights } from './layout/interface'; import type { Node } from './layout/node'; diff --git a/packages/s2-core/src/group/panel-scroll-group.ts b/packages/s2-core/src/group/panel-scroll-group.ts index 226bcc3505..fb76ef19c6 100644 --- a/packages/s2-core/src/group/panel-scroll-group.ts +++ b/packages/s2-core/src/group/panel-scroll-group.ts @@ -1,8 +1,8 @@ import { Group } from '@antv/g'; +import { S2Event } from '../common'; import type { GridInfo } from '../common/interface'; import type { GridGroupConstructorParameters } from '../common/interface/group'; import { updateMergedCells } from '../utils/interaction/merge-cell'; -import { S2Event } from '../common'; import type { MergedCell } from './../cell/merged-cell'; import { KEY_GROUP_MERGED_CELLS, diff --git a/packages/s2-core/src/index.ts b/packages/s2-core/src/index.ts index 29b1f23fe0..fbb947e838 100644 --- a/packages/s2-core/src/index.ts +++ b/packages/s2-core/src/index.ts @@ -1,14 +1,14 @@ export { FederatedPointerEvent as GEvent } from '@antv/g'; -export { getTheme } from './theme'; -export { Node } from './facet/layout/node'; -export { Hierarchy } from './facet/layout/hierarchy'; 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 * from './common'; -export * from './utils'; export * from './cell'; -export * from './sheet-type'; +export * from './common'; export * from './data-set'; +export * from './facet'; export * from './interaction'; +export * from './sheet-type'; export * from './ui/tooltip'; -export * from './facet'; +export * from './utils'; diff --git a/packages/s2-core/src/interaction/base-event.ts b/packages/s2-core/src/interaction/base-event.ts index 351ae4aa22..6c99b129f3 100644 --- a/packages/s2-core/src/interaction/base-event.ts +++ b/packages/s2-core/src/interaction/base-event.ts @@ -1,6 +1,6 @@ import type { - DisplayObject, FederatedPointerEvent as CanvasEvent, + DisplayObject, } from '@antv/g'; import type { CellAppendInfo } from '../common'; import type { SpreadSheet } from '../sheet-type'; 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 c22d43ed3b..1629732607 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 @@ -2,20 +2,20 @@ import type { FederatedPointerEvent as CanvasEvent } from '@antv/g'; import { isEmpty } from 'lodash'; import { CellType, + CornerNodeType, type CellMeta, type Data, - CornerNodeType, } from '../../../common'; import { InteractionStateName, InterceptType, S2Event, } from '../../../common/constant'; +import type { Node } from '../../../facet/layout/node'; import { BaseEvent, type BaseEventImplement, } from '../../../interaction/base-event'; -import type { Node } from '../../../facet/layout/node'; export class CornerCellClick extends BaseEvent implements BaseEventImplement { public bindEvents() { diff --git a/packages/s2-core/src/interaction/base-interaction/click/index.ts b/packages/s2-core/src/interaction/base-interaction/click/index.ts index 3cec2d051d..0f09dc91a5 100644 --- a/packages/s2-core/src/interaction/base-interaction/click/index.ts +++ b/packages/s2-core/src/interaction/base-interaction/click/index.ts @@ -1,5 +1,5 @@ +export { CornerCellClick } from './corner-cell-click'; export { DataCellClick } from './data-cell-click'; export { MergedCellClick } from './merged-cell-click'; export { RowColumnClick } from './row-column-click'; export { RowTextClick } from './row-text-click'; -export { CornerCellClick } from './corner-cell-click'; 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 9045c75758..2b183a81bc 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 @@ -1,10 +1,11 @@ import type { FederatedPointerEvent as CanvasEvent } from '@antv/g'; import { difference, findLast } from 'lodash'; +import { SeriesNumberCell } from '../../../cell'; import { CellType, - getTooltipOperatorHiddenColumnsMenu, InterceptType, S2Event, + getTooltipOperatorHiddenColumnsMenu, } from '../../../common/constant'; import type { TooltipBaseOperatorMenuItem, @@ -29,7 +30,6 @@ import { getTooltipVisibleOperator, mergeCellInfo, } from '../../../utils/tooltip'; -import { SeriesNumberCell } from '../../../cell'; import type { ViewMeta } from './../../../common/interface/basic'; export class RowColumnClick extends BaseEvent implements BaseEventImplement { diff --git a/packages/s2-core/src/interaction/base-interaction/click/row-text-click.ts b/packages/s2-core/src/interaction/base-interaction/click/row-text-click.ts index 8b080cf2a9..c2a5dace14 100644 --- a/packages/s2-core/src/interaction/base-interaction/click/row-text-click.ts +++ b/packages/s2-core/src/interaction/base-interaction/click/row-text-click.ts @@ -1,10 +1,9 @@ import type { FederatedPointerEvent as CanvasEvent } from '@antv/g'; import { InterceptType, S2Event } from '../../../common/constant'; -import type { RawData } from '../../../common/interface'; +import type { Data, RawData } from '../../../common/interface'; import { CellData } from '../../../data-set/cell-data'; import type { Node } from '../../../facet/layout/node'; import { BaseEvent, type BaseEventImplement } from '../../base-event'; -import type { Data } from '../../../common/interface'; /** * Row header click navigation interaction 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 dea859f7fa..5942661a8c 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 @@ -1,7 +1,7 @@ import { Rect, - type DisplayObject, type FederatedPointerEvent as CanvasEvent, + type DisplayObject, type PointLike, } from '@antv/g'; import { cloneDeep, isEmpty, isNil, map, throttle } from 'lodash'; 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 91df1e8257..8b2d4f9f16 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 @@ -6,11 +6,10 @@ import { InteractionBrushSelectionStage, InteractionStateName, } from '../../common/constant/interaction'; -import type { ViewMeta } from '../../common/interface'; +import type { OnUpdateCells, ViewMeta } from '../../common/interface'; +import type { BBox } from '../../engine'; import type { Node } from '../../facet/layout/node'; import { getCellMeta } from '../../utils/interaction/select-event'; -import type { OnUpdateCells } from '../../common/interface'; -import type { BBox } from '../../engine'; import { BaseBrushSelection } from './base-brush-selection'; export class ColCellBrushSelection extends BaseBrushSelection { 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 a7f03e197c..ca3162ec09 100644 --- a/packages/s2-core/src/interaction/data-cell-multi-selection.ts +++ b/packages/s2-core/src/interaction/data-cell-multi-selection.ts @@ -9,12 +9,12 @@ import { } from '../common/constant'; import type { CellMeta, S2CellType, ViewMeta } from '../common/interface'; import { + afterSelectDataCells, getCellMeta, - isMultiSelectionKey, isMouseEventWithMeta, + isMultiSelectionKey, } from '../utils/interaction/select-event'; import { getCellsTooltipData } from '../utils/tooltip'; -import { afterSelectDataCells } from '../utils/interaction/select-event'; import { BaseEvent, type BaseEventImplement } from './base-interaction'; export class DataCellMultiSelection diff --git a/packages/s2-core/src/interaction/index.ts b/packages/s2-core/src/interaction/index.ts index a499c3797f..fac45cae32 100644 --- a/packages/s2-core/src/interaction/index.ts +++ b/packages/s2-core/src/interaction/index.ts @@ -1,12 +1,12 @@ -export * from './base-interaction'; export * from './base-event'; +export * from './base-interaction'; export * from './brush-selection/base-brush-selection'; +export * from './brush-selection/col-brush-selection'; export * from './brush-selection/data-cell-brush-selection'; export * from './brush-selection/row-brush-selection'; -export * from './brush-selection/col-brush-selection'; export * from './data-cell-multi-selection'; export * from './event-controller'; +export * from './range-selection'; export * from './root'; export * from './row-column-resize'; -export * from './range-selection'; export * from './selected-cell-move'; diff --git a/packages/s2-core/src/interaction/range-selection.ts b/packages/s2-core/src/interaction/range-selection.ts index 4aecb085cb..739c676d9f 100644 --- a/packages/s2-core/src/interaction/range-selection.ts +++ b/packages/s2-core/src/interaction/range-selection.ts @@ -1,5 +1,5 @@ -import { inRange, isEmpty, isNil, range } from 'lodash'; import type { FederatedPointerEvent } from '@antv/g'; +import { inRange, isEmpty, isNil, range } from 'lodash'; import { DataCell } from '../cell'; import { CellType, diff --git a/packages/s2-core/src/interaction/row-column-resize.ts b/packages/s2-core/src/interaction/row-column-resize.ts index b33a396795..a9f2507699 100644 --- a/packages/s2-core/src/interaction/row-column-resize.ts +++ b/packages/s2-core/src/interaction/row-column-resize.ts @@ -31,8 +31,8 @@ import type { ResizePosition, } from '../common/interface/resize'; import { CustomRect } from '../engine'; -import { floor } from '../utils/math'; import { Node } from '../facet/layout/node'; +import { floor } from '../utils/math'; import { BaseEvent, type BaseEventImplement } from './base-interaction'; export class RowColumnResize extends BaseEvent implements BaseEventImplement { diff --git a/packages/s2-core/src/interaction/selected-cell-move.ts b/packages/s2-core/src/interaction/selected-cell-move.ts index d24b4f20cf..2c1acefbc6 100644 --- a/packages/s2-core/src/interaction/selected-cell-move.ts +++ b/packages/s2-core/src/interaction/selected-cell-move.ts @@ -1,15 +1,15 @@ import type { FederatedPointerEvent as Event } from '@antv/g'; import { - type CellMeta, CellType, - type ViewMeta, FrozenGroupArea, + type CellMeta, + type ViewMeta, } from '../common'; 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 type { FrozenFacet } from '../facet'; import { BaseEvent, type BaseEventImplement } from './base-interaction'; const SelectedCellMoveMap = [ diff --git a/packages/s2-core/src/sheet-type/index.ts b/packages/s2-core/src/sheet-type/index.ts index f056884c5f..433440fa8d 100644 --- a/packages/s2-core/src/sheet-type/index.ts +++ b/packages/s2-core/src/sheet-type/index.ts @@ -2,7 +2,7 @@ import type {} from '@antv/g-lite'; import { PivotSheet } from './pivot-sheet'; -import { TableSheet } from './table-sheet'; import { SpreadSheet } from './spread-sheet'; +import { TableSheet } from './table-sheet'; -export { PivotSheet, TableSheet, SpreadSheet }; +export { PivotSheet, SpreadSheet, TableSheet }; diff --git a/packages/s2-core/src/utils/cell/cell.ts b/packages/s2-core/src/utils/cell/cell.ts index 1cdf66680e..308f1f1a57 100644 --- a/packages/s2-core/src/utils/cell/cell.ts +++ b/packages/s2-core/src/utils/cell/cell.ts @@ -1,14 +1,14 @@ import type { LineStyleProps } from '@antv/g'; import { isEmpty } from 'lodash'; -import type { SimpleBBox } from '../../engine'; import { + CellBorderPosition, CellClipBox, type CellTheme, type IconTheme, type TextAlign, type TextBaseline, } from '../../common/interface'; -import { CellBorderPosition } from '../../common/interface'; +import type { SimpleBBox } from '../../engine'; import { getIconTotalWidth, type GroupedIcons } from './header-cell'; /** diff --git a/packages/s2-core/src/utils/cell/data-cell.ts b/packages/s2-core/src/utils/cell/data-cell.ts index e676c457a2..33c1bb7679 100644 --- a/packages/s2-core/src/utils/cell/data-cell.ts +++ b/packages/s2-core/src/utils/cell/data-cell.ts @@ -1,9 +1,9 @@ -import { isEqual, forEach } from 'lodash'; +import { forEach, isEqual } from 'lodash'; import type { DataCell } from '../../cell'; import { - InteractionStateName, CellType, DATA_CELL_ID_SEPARATOR, + InteractionStateName, } from '../../common/constant'; import type { CellMeta, S2CellType } from '../../common/interface'; import type { SpreadSheet } from '../../sheet-type'; diff --git a/packages/s2-core/src/utils/cell/header-cell.ts b/packages/s2-core/src/utils/cell/header-cell.ts index 150dae026a..eb16aee33c 100644 --- a/packages/s2-core/src/utils/cell/header-cell.ts +++ b/packages/s2-core/src/utils/cell/header-cell.ts @@ -1,15 +1,15 @@ import { find, groupBy, isEmpty, isEqual, merge } from 'lodash'; +import { CellType, EXTRA_FIELD } from '../../common/constant'; import type { HeaderActionNameOptions, IconPosition, IconTheme, InternalFullyHeaderActionIcon, } from '../../common/interface'; -import { CellType, EXTRA_FIELD } from '../../common/constant'; import type { - HeaderActionName, FormatResult, HeaderActionIcon, + HeaderActionName, } from '../../common/interface/basic'; import type { Node } from '../../facet/layout/node'; diff --git a/packages/s2-core/src/utils/color.ts b/packages/s2-core/src/utils/color.ts index a4268b584b..5fc22efae8 100644 --- a/packages/s2-core/src/utils/color.ts +++ b/packages/s2-core/src/utils/color.ts @@ -1,10 +1,10 @@ import { toUpper } from 'lodash'; import tinycolor from 'tinycolor2'; -import type { Palette, PaletteMeta } from '../common/interface/theme'; import { DEFAULT_FONT_COLOR, REVERSE_FONT_COLOR, } from '../common/constant/condition'; +import type { Palette, PaletteMeta } from '../common/interface/theme'; const WHITE_COLOR = '#FFFFFF'; const BLACK_COLOR = '#000000'; diff --git a/packages/s2-core/src/utils/data-set-operate.ts b/packages/s2-core/src/utils/data-set-operate.ts index b45f6d088d..4664e361a0 100644 --- a/packages/s2-core/src/utils/data-set-operate.ts +++ b/packages/s2-core/src/utils/data-set-operate.ts @@ -1,4 +1,4 @@ -import { isArray, flattenDeep } from 'lodash'; +import { flattenDeep, isArray } from 'lodash'; import { EMPTY_EXTRA_FIELD_PLACEHOLDER, TOTAL_VALUE, 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 e7e58701b4..1f48882d46 100644 --- a/packages/s2-core/src/utils/dataset/pivot-data-set.ts +++ b/packages/s2-core/src/utils/dataset/pivot-data-set.ts @@ -11,6 +11,7 @@ import { last, set, } from 'lodash'; +import type { RawData } from '../../common'; import { EMPTY_EXTRA_FIELD_PLACEHOLDER, EXTRA_FIELD, @@ -34,7 +35,6 @@ import type { TotalStatus, } from '../../data-set/interface'; import type { Node } from '../../facet/layout/node'; -import type { RawData } from '../../common'; export function filterExtraDimension(dimensions: string[] = []) { return dimensions.filter((d) => d !== EXTRA_FIELD); diff --git a/packages/s2-core/src/utils/export/copy/base-data-cell-copy.ts b/packages/s2-core/src/utils/export/copy/base-data-cell-copy.ts index e108cf9a88..af0752e506 100644 --- a/packages/s2-core/src/utils/export/copy/base-data-cell-copy.ts +++ b/packages/s2-core/src/utils/export/copy/base-data-cell-copy.ts @@ -4,9 +4,9 @@ import { type DataItem, } from '../../../common'; import type { + CopyAndExportUnifyConfig, CopyableHTML, CopyablePlain, - CopyAndExportUnifyConfig, SheetCopyConstructorParams, } from '../../../common/interface/export'; import { CopyMIMEType } from '../../../common/interface/export'; diff --git a/packages/s2-core/src/utils/export/copy/common.ts b/packages/s2-core/src/utils/export/copy/common.ts index 5ac9d81560..9d33fc0169 100644 --- a/packages/s2-core/src/utils/export/copy/common.ts +++ b/packages/s2-core/src/utils/export/copy/common.ts @@ -1,18 +1,18 @@ import { escape, map, max } from 'lodash'; -import type { Node } from '../../../facet/layout/node'; import type { DataItem } from '../../../common'; -import { LINE_SEPARATOR, TAB_SEPARATOR, ROOT_NODE_ID } from '../../../common'; +import { LINE_SEPARATOR, ROOT_NODE_ID, TAB_SEPARATOR } from '../../../common'; import { + CopyMIMEType, + type CopyAndExportUnifyConfig, type CopyableHTML, type CopyablePlain, - type CopyAndExportUnifyConfig, type FormatOptions, + type MatrixHTMLTransformer, + type MatrixPlainTransformer, type SheetCopyConstructorParams, type Transformer, - type MatrixPlainTransformer, - type MatrixHTMLTransformer, - CopyMIMEType, } from '../../../common/interface/export'; +import type { Node } from '../../../facet/layout/node'; import type { BaseDataSet } from './../../../data-set/base-data-set'; // 把 string[][] 矩阵转换成 CopyablePlain diff --git a/packages/s2-core/src/utils/export/copy/index.ts b/packages/s2-core/src/utils/export/copy/index.ts index 123563161b..dd7fcf3393 100644 --- a/packages/s2-core/src/utils/export/copy/index.ts +++ b/packages/s2-core/src/utils/export/copy/index.ts @@ -2,5 +2,5 @@ import type { SheetCopyConstructorParams } from '../../../common/interface/expor import { getSelectedData } from './core'; import { PivotDataCellCopy } from './pivot-data-cell-copy'; -export { getSelectedData, PivotDataCellCopy }; +export { PivotDataCellCopy, getSelectedData }; export type { SheetCopyConstructorParams }; 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 3bf0e4ab01..18d2e06637 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 @@ -12,10 +12,10 @@ import { EXTRA_FIELD, VALUE_FIELD, type CellMeta, + type CustomHeaderField, type DataItem, type MiniChartData, type MultiData, - type CustomHeaderField, } from '../../../common'; import type { CopyAllDataParams, diff --git a/packages/s2-core/src/utils/export/copy/pivot-header-copy.ts b/packages/s2-core/src/utils/export/copy/pivot-header-copy.ts index cd20236093..d9b4bb967c 100644 --- a/packages/s2-core/src/utils/export/copy/pivot-header-copy.ts +++ b/packages/s2-core/src/utils/export/copy/pivot-header-copy.ts @@ -1,12 +1,12 @@ import { filter, isEmpty, map, max, repeat, zip } from 'lodash'; import type { ColCell, RowCell } from '../../../cell'; +import { CellType, NODE_ID_SEPARATOR } from '../../../common'; import type { CopyableList } from '../../../common/interface/export'; import { getAllLevels, getHeaderList, getHeaderMeasureFieldNames, } from '../method'; -import { CellType, NODE_ID_SEPARATOR } from '../../../common'; import { matrixHtmlTransformer, matrixPlainTextTransformer } from './common'; /** diff --git a/packages/s2-core/src/utils/export/index.ts b/packages/s2-core/src/utils/export/index.ts index 57837de931..f5998817fc 100644 --- a/packages/s2-core/src/utils/export/index.ts +++ b/packages/s2-core/src/utils/export/index.ts @@ -5,8 +5,7 @@ import type { import { assembleMatrix, getMaxRowLen, getNodeFormatData } from './copy/common'; import { getHeaderList } from './method'; -export type { CopyableList, FormatOptions }; -export { assembleMatrix, getMaxRowLen, getNodeFormatData }; -export { getHeaderList }; -export * from './utils'; export * from './copy'; +export * from './utils'; +export { assembleMatrix, getHeaderList, getMaxRowLen, getNodeFormatData }; +export type { CopyableList, FormatOptions }; diff --git a/packages/s2-core/src/utils/export/method.ts b/packages/s2-core/src/utils/export/method.ts index 565d441c8e..fb75b27bcb 100644 --- a/packages/s2-core/src/utils/export/method.ts +++ b/packages/s2-core/src/utils/export/method.ts @@ -3,12 +3,12 @@ */ import { forEach, map } from 'lodash'; import type { ColCell, RowCell } from '../../cell'; -import type { DataItem } from '../../common'; import { CellType, NODE_ID_SEPARATOR, SERIES_NUMBER_FIELD, type CellMeta, + type DataItem, } from '../../common'; import type { Node } from '../../facet/layout/node'; import type { SpreadSheet } from '../../sheet-type'; diff --git a/packages/s2-core/src/utils/hide-columns.ts b/packages/s2-core/src/utils/hide-columns.ts index 7c9eb6c36e..2c71b16ea7 100644 --- a/packages/s2-core/src/utils/hide-columns.ts +++ b/packages/s2-core/src/utils/hide-columns.ts @@ -1,8 +1,8 @@ import { compact, get, isEmpty, isEqual, last, uniq } from 'lodash'; import { NODE_ID_SEPARATOR, S2Event } from '../common/constant'; -import { getLeafColumnsWithKey } from '../facet/utils'; import type { HiddenColumnsInfo } from '../common/interface/store'; import type { Node } from '../facet/layout/node'; +import { getLeafColumnsWithKey } from '../facet/utils'; import type { SpreadSheet } from '../sheet-type'; export const getHiddenColumnFieldKey = (field: string) => { diff --git a/packages/s2-core/src/utils/index.ts b/packages/s2-core/src/utils/index.ts index 7669502c49..74db754040 100644 --- a/packages/s2-core/src/utils/index.ts +++ b/packages/s2-core/src/utils/index.ts @@ -1,21 +1,21 @@ export { auto } from './formatter'; -export * from './common'; -export * from './layout'; -export * from './text'; +export * from './canvas'; +export * from './cell/cell'; +export * from './cell/data-cell'; export * from './color'; -export * from './theme'; +export * from './common'; export * from './export'; -export * from './interaction'; -export * from './g-renders'; export * from './g-mini-charts'; -export * from './merge'; -export * from './is-mobile'; -export * from './tooltip'; +export * from './g-renders'; export * from './get-classnames'; -export * from './cell/cell'; -export * from './cell/data-cell'; -export * from './sort-action'; export * from './inject-css-text'; +export * from './interaction'; +export * from './is-mobile'; +export * from './layout'; export * from './math'; -export * from './canvas'; +export * from './merge'; +export * from './sort-action'; +export * from './text'; +export * from './theme'; +export * from './tooltip'; diff --git a/packages/s2-core/src/utils/interaction/index.ts b/packages/s2-core/src/utils/interaction/index.ts index 8121164064..813cf7b201 100644 --- a/packages/s2-core/src/utils/interaction/index.ts +++ b/packages/s2-core/src/utils/interaction/index.ts @@ -2,6 +2,6 @@ export * from './formatter'; export * from './hover-event'; export * from './link-field'; export * from './merge-cell'; +export * from './scroll'; export * from './select-event'; export * from './state-controller'; -export * from './scroll'; diff --git a/packages/s2-core/src/utils/interaction/link-field.ts b/packages/s2-core/src/utils/interaction/link-field.ts index 6f7461ea7a..52281fb6a6 100644 --- a/packages/s2-core/src/utils/interaction/link-field.ts +++ b/packages/s2-core/src/utils/interaction/link-field.ts @@ -1,5 +1,5 @@ -import type { Node } from '../../facet/layout/node'; import type { ViewMeta } from '../../common/interface/basic'; +import type { Node } from '../../facet/layout/node'; export const checkIsLinkField = ( linkFields: string[] | ((meta: Node | ViewMeta) => boolean), diff --git a/packages/s2-core/src/utils/interaction/merge-cell.ts b/packages/s2-core/src/utils/interaction/merge-cell.ts index 6d0b2565bc..4804104755 100644 --- a/packages/s2-core/src/utils/interaction/merge-cell.ts +++ b/packages/s2-core/src/utils/interaction/merge-cell.ts @@ -9,16 +9,16 @@ import { isEqual, map, } from 'lodash'; +import type { DataCell } from '../../cell'; import { MergedCell } from '../../cell/merged-cell'; import { CellType } from '../../common/constant'; import type { + MergedCellCallback, MergedCellInfo, TempMergedCell, ViewMeta, - MergedCellCallback, } from '../../common/interface'; import type { SpreadSheet } from '../../sheet-type'; -import type { DataCell } from '../../cell'; /** * according to the coordinates of the starting point of the rectangle, diff --git a/packages/s2-core/src/utils/interaction/resize.ts b/packages/s2-core/src/utils/interaction/resize.ts index 2cc01543f9..18766a2c6f 100644 --- a/packages/s2-core/src/utils/interaction/resize.ts +++ b/packages/s2-core/src/utils/interaction/resize.ts @@ -1,10 +1,10 @@ import { Group, type RectStyleProps } from '@antv/g'; -import type { SimpleBBox } from '../../engine'; import { FRONT_GROUND_GROUP_RESIZE_AREA_Z_INDEX, ResizeDirectionType, } from '../../common/constant'; import type { ResizeInfo } from '../../common/interface/resize'; +import type { SimpleBBox } from '../../engine'; import type { SpreadSheet } from '../../sheet-type/spread-sheet'; export const getResizeAreaAttrs = ( diff --git a/packages/s2-core/src/utils/interaction/scroll.ts b/packages/s2-core/src/utils/interaction/scroll.ts index b51f5c4344..80f2e1c97e 100644 --- a/packages/s2-core/src/utils/interaction/scroll.ts +++ b/packages/s2-core/src/utils/interaction/scroll.ts @@ -1,8 +1,8 @@ import { isNil } from 'lodash'; +import { FrozenGroupArea } from '../../common'; import { ScrollDirection } from '../../common/constant/interaction'; import type { TableFacet } from '../../facet'; import type { SpreadSheet } from '../../sheet-type'; -import { FrozenGroupArea } from '../../common'; // 获取滚动指定列到视口内的滚动 x 轴 Offset。滚动到视口边缘位置,左侧和右侧视滚动方向而定。 export const getScrollOffsetForCol = ( diff --git a/packages/s2-core/src/utils/layout/frozen.ts b/packages/s2-core/src/utils/layout/frozen.ts index 32163a0e33..788d628dd6 100644 --- a/packages/s2-core/src/utils/layout/frozen.ts +++ b/packages/s2-core/src/utils/layout/frozen.ts @@ -1,5 +1,5 @@ import { DEFAULT_FROZEN_COUNTS } from '../../common'; -import type { S2Options, S2BaseFrozenOptions } from '../../common/interface'; +import type { S2BaseFrozenOptions, S2Options } from '../../common/interface'; export const getValidFrozenOptions = ( defaultFrozenOptions: S2BaseFrozenOptions = {}, diff --git a/packages/s2-core/src/utils/layout/get-dims-condition-by-node.ts b/packages/s2-core/src/utils/layout/get-dims-condition-by-node.ts index f02ce4278b..1845cc5c41 100644 --- a/packages/s2-core/src/utils/layout/get-dims-condition-by-node.ts +++ b/packages/s2-core/src/utils/layout/get-dims-condition-by-node.ts @@ -1,5 +1,5 @@ -import type { Query } from '../../data-set'; import { EMPTY_FIELD_VALUE } from '../../common/constant'; +import type { Query } from '../../data-set'; import type { Node } from '../../facet/layout/node'; export function getDimsCondition(parent: Node, force?: boolean) { diff --git a/packages/s2-core/src/utils/layout/index.ts b/packages/s2-core/src/utils/layout/index.ts index ebb9b46fc5..f45b5d57fb 100644 --- a/packages/s2-core/src/utils/layout/index.ts +++ b/packages/s2-core/src/utils/layout/index.ts @@ -1,2 +1,2 @@ -export { generateId, resolveId } from './generate-id'; export * from './frozen'; +export { generateId, resolveId } from './generate-id'; diff --git a/packages/s2-core/src/utils/layout/whether-leaf-by-level.ts b/packages/s2-core/src/utils/layout/whether-leaf-by-level.ts index 7a10280d4b..e3589c4a98 100644 --- a/packages/s2-core/src/utils/layout/whether-leaf-by-level.ts +++ b/packages/s2-core/src/utils/layout/whether-leaf-by-level.ts @@ -1,6 +1,6 @@ import { includes } from 'lodash'; -import type { WhetherLeafParams } from '../../facet/layout/interface'; import { EXTRA_FIELD } from '../../common'; +import type { WhetherLeafParams } from '../../facet/layout/interface'; export const whetherLeafByLevel = (params: WhetherLeafParams) => { const { spreadsheet, level, fields } = params; diff --git a/packages/s2-core/src/utils/number-calculate.ts b/packages/s2-core/src/utils/number-calculate.ts index 7fbb662273..a9c20f2a4b 100644 --- a/packages/s2-core/src/utils/number-calculate.ts +++ b/packages/s2-core/src/utils/number-calculate.ts @@ -1,6 +1,6 @@ import Decimal from 'decimal.js'; -import { CellData } from '../data-set/cell-data'; import { Aggregation, type ViewMetaData } from '../common/interface'; +import { CellData } from '../data-set/cell-data'; export const isNotNumber = (value: unknown) => { if (typeof value === 'number') { diff --git a/packages/s2-react-components/.releaserc.js b/packages/s2-react-components/.releaserc.js new file mode 100644 index 0000000000..a3320415aa --- /dev/null +++ b/packages/s2-react-components/.releaserc.js @@ -0,0 +1 @@ +module.exports = require('../../.releaserc.base.js'); diff --git a/packages/s2-react-components/README.md b/packages/s2-react-components/README.md new file mode 100644 index 0000000000..141029469f --- /dev/null +++ b/packages/s2-react-components/README.md @@ -0,0 +1,34 @@ +

@antv/s2-react-components

+ +
+ +TODO: + +

+ + npm + + + Version + + + Version + + + ci test status + +

+ +
+ +## 📦 安装 + +```bash +$ pnpm add @antv/s2-react-components +# npm install @antv/s2-react-components --save +# yarn add @antv/s2-react-components +``` + +## 🔨 使用 + +TODO: diff --git a/packages/s2-react-components/__tests__/setup.js b/packages/s2-react-components/__tests__/setup.js new file mode 100644 index 0000000000..e35a19bc39 --- /dev/null +++ b/packages/s2-react-components/__tests__/setup.js @@ -0,0 +1,3 @@ +['time', 'info', 'warn'].forEach((type) => { + jest.spyOn(console, type).mockImplementation(() => {}); +}); diff --git a/packages/s2-react-components/__tests__/util/helpers.ts b/packages/s2-react-components/__tests__/util/helpers.ts new file mode 100644 index 0000000000..7304eeef18 --- /dev/null +++ b/packages/s2-react-components/__tests__/util/helpers.ts @@ -0,0 +1,5 @@ +export const sleep = async (timeout = 0) => { + await new Promise((resolve) => { + setTimeout(resolve, timeout); + }); +}; diff --git a/packages/s2-react-components/jest.config.js b/packages/s2-react-components/jest.config.js new file mode 100644 index 0000000000..f53d37480f --- /dev/null +++ b/packages/s2-react-components/jest.config.js @@ -0,0 +1 @@ +module.exports = require('../../jest.config.base'); diff --git a/packages/s2-react-components/package.json b/packages/s2-react-components/package.json new file mode 100644 index 0000000000..7b3670cc6f --- /dev/null +++ b/packages/s2-react-components/package.json @@ -0,0 +1,115 @@ +{ + "name": "@antv/s2-react-components", + "version": "0.0.1", + "private": false, + "description": "React Components for s2-react", + "keywords": [ + "antv", + "s2", + "s2-react", + "spreadsheet", + "pivot table", + "table", + "react-components", + "react-config-components", + "s2-react-components", + "s2-react-config-components", + "s2-react-analysis-components" + ], + "homepage": "https://s2.antv.antgroup.com", + "bugs": { + "url": "https://github.com/antvis/S2/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/antvis/S2.git" + }, + "license": "MIT", + "author": "https://github.com/orgs/antvis/people", + "main": "lib/index.js", + "unpkg": "dist/index.min.js", + "module": "esm/index.js", + "types": "esm/index.d.ts", + "directories": { + "lib": "lib", + "test": "tests" + }, + "files": [ + "esm", + "lib", + "dist", + "README.md" + ], + "scripts": { + "build": "npm-run-all clean --parallel build:umd build:cjs build:esm build:dts", + "build:analysis": "cross-env FORMAT=es ANALYSIS=true vite build", + "build:cjs": "cross-env FORMAT=cjs vite build", + "build:dts": "run-s dts:*", + "build:esm": "cross-env FORMAT=es vite build", + "build:size-limit": "size-limit", + "build:size-limit-json": "pnpm build:size-limit -- --json", + "build:umd": "cross-env FORMAT=umd vite build", + "clean": "rimraf lib esm dist temp", + "dts:build": "tsc -p tsconfig.declaration.json", + "dts:extract": "cross-env LIB=s2-react-components node ../../scripts/dts.js", + "start": "cross-env PLAYGROUND=true vite", + "test": "jest --passWithNoTests --detectOpenHandles", + "test:ci": "pnpm test -- --maxWorkers=3", + "test:ci-coverage": "pnpm test:coverage --maxWorkers=3", + "test:coverage": "pnpm test -- --coverage", + "test:live": "node ./scripts/test-live.mjs", + "test:watch": "pnpm test -- --watch", + "tsc": "tsc --noEmit", + "watch": "rimraf esm && pnpm build:esm -w" + }, + "release": { + "skip": true + }, + "dependencies": { + "classnames": "^2.5.1", + "lodash": "^4.17.21" + }, + "devDependencies": { + "@ant-design/icons": "^5.3.7", + "@antv/event-emitter": "^0.1.3", + "@antv/g": "^6.0.6", + "@antv/g-plugin-a11y": "^1.0.6", + "@antv/g-plugin-rough-canvas-renderer": "^2.0.8", + "@antv/g2": "^5.1.20", + "@antv/s2": "workspace:*", + "@antv/s2-react": "workspace:*", + "@antv/s2-shared": "workspace:*", + "@testing-library/react": "^15.0.7", + "@testing-library/react-hooks": "^8.0.1", + "@types/d3-dsv": "^3.0.7", + "@types/react": "^18.3.3", + "@types/react-beautiful-dnd": "^13.1.8", + "@types/react-color": "^3.0.12", + "@types/react-dom": "^18.3.0", + "antd": "^5.17.4", + "d3-dsv": "^1.1.1", + "react": "^18.3.1", + "react-color": "^2.19.3", + "react-dom": "^18.3.1", + "vite-plugin-svgr": "^2.2.2" + }, + "peerDependencies": { + "@ant-design/icons": ">=4.7.0", + "antd": "^5.0.0", + "react": ">=16.9.0", + "react-dom": ">=16.9.0" + }, + "publishConfig": { + "access": "public" + }, + "size-limit": [ + { + "path": "./dist/index.min.js", + "import": "{ createComponent }", + "limit": "70 kB" + } + ], + "tnpm": { + "mode": "pnpm" + } +} diff --git a/packages/s2-react-components/playground/README.md b/packages/s2-react-components/playground/README.md new file mode 100644 index 0000000000..79ffd1f684 --- /dev/null +++ b/packages/s2-react-components/playground/README.md @@ -0,0 +1,3 @@ +### 开发与调试 + +根目录运行 `pnpm react-components:playground` 来运行 `S2`, 可用于调试 `@antv/s2-react-components`, 提供了一些常用的图表场景和配置。 diff --git a/packages/s2-react-components/playground/config.tsx b/packages/s2-react-components/playground/config.tsx new file mode 100644 index 0000000000..f5a278e142 --- /dev/null +++ b/packages/s2-react-components/playground/config.tsx @@ -0,0 +1,100 @@ +/* eslint-disable max-classes-per-file */ +/* eslint-disable no-console */ +import { EMPTY_PLACEHOLDER, ResizeType, type S2DataConfig } from '@antv/s2'; +import type { SheetComponentOptions } from '@antv/s2-react'; +import { + data, + fields, + meta, + totalData, +} from '@antv/s2/__tests__/data/mock-dataset.json'; + +export const s2DataConfig: S2DataConfig = { + data, + totalData, + meta, + fields, +}; + +export const s2Options: SheetComponentOptions = { + debug: false, + width: 800, + height: 600, + hierarchyType: 'grid', + placeholder: { + cell: EMPTY_PLACEHOLDER, + empty: { + icon: 'Empty', + description: '暂无数据', + }, + }, + seriesNumber: { + enable: false, + }, + transformCanvasConfig() { + return { + supportsCSSTransform: true, + // devicePixelRatio: 3, + // cursor: 'crosshair', + }; + }, + frozen: { + rowHeader: true, + // rowCount: 1, + // trailingRowCount: 1, + // colCount: 1, + // trailingColCount: 1, + }, + cornerText: '测试测试测试测试测试测试测试测试测试测试', + interaction: { + copy: { + enable: true, + withFormat: true, + withHeader: true, + }, + hoverAfterScroll: true, + hoverHighlight: true, + selectedCellHighlight: true, + selectedCellMove: true, + rangeSelection: true, + // 防止 mac 触控板横向滚动触发浏览器返回, 和移动端下拉刷新 + overscrollBehavior: 'none', + brushSelection: { + dataCell: true, + colCell: true, + rowCell: true, + }, + resize: { + rowResizeType: ResizeType.ALL, + colResizeType: ResizeType.ALL, + }, + }, + // totals: { + // col: { + // showGrandTotals: true, + // showSubTotals: false, + // reverseGrandTotalsLayout: true, + // reverseSubTotalsLayout: true, + // subTotalsDimensions: ['type'], + // }, + // row: { + // showGrandTotals: true, + // showSubTotals: true, + // reverseGrandTotalsLayout: true, + // reverseSubTotalsLayout: true, + // subTotalsDimensions: ['province'], + // }, + // }, + // mergedCellsInfo: [ + // [ + // { colIndex: 1, rowIndex: 1, showText: true }, + // { colIndex: 1, rowIndex: 2 }, + // ], + // [ + // { colIndex: 2, rowIndex: 1 }, + // { colIndex: 2, rowIndex: 2, showText: true }, + // ], + // ], + tooltip: {}, + style: {}, +}; diff --git a/packages/s2-react-components/playground/index.html b/packages/s2-react-components/playground/index.html new file mode 100644 index 0000000000..308ad79b2e --- /dev/null +++ b/packages/s2-react-components/playground/index.html @@ -0,0 +1,12 @@ + + + + + + S2 React Components Playground + + +
+ + + diff --git a/packages/s2-react-components/playground/index.less b/packages/s2-react-components/playground/index.less new file mode 100644 index 0000000000..2c9c71e896 --- /dev/null +++ b/packages/s2-react-components/playground/index.less @@ -0,0 +1,5 @@ +.playground { + padding: 40px; + background-color: var(--antv-s2-background, #fff); + color: var(--antv-s2-font, #fff); +} diff --git a/packages/s2-react-components/playground/index.tsx b/packages/s2-react-components/playground/index.tsx new file mode 100644 index 0000000000..b013a92d8f --- /dev/null +++ b/packages/s2-react-components/playground/index.tsx @@ -0,0 +1,60 @@ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +/* eslint-disable no-console */ +import { getLang } from '@antv/s2'; +import { SheetComponent } from '@antv/s2-react'; +import reactPkg from '@antv/s2-react/package.json'; +import corePkg from '@antv/s2/package.json'; +import { version as AntdVersion, Space, Tag } from 'antd'; +import React from 'react'; +import { createRoot } from 'react-dom/client'; +import pkg from '../package.json'; +import { s2DataConfig, s2Options } from './config'; + +import '@antv/s2-react/dist/style.min.css'; +import './index.less'; + +function MainLayout() { + return ( +
+ + {pkg.name} playground + ), + description: ( + + + {reactPkg.name}: {reactPkg.version} + + + {corePkg.name}: {corePkg.version} + + + antd: {AntdVersion} + + + react: {React.version} + + + lang: {getLang()} + + + ), + switcher: { open: true }, + export: { open: true }, + advancedSort: { + open: true, + }, + }} + /> + +
+ ); +} + +createRoot(document.getElementById('root')!).render(); diff --git a/packages/s2-react-components/playground/utils.ts b/packages/s2-react-components/playground/utils.ts new file mode 100644 index 0000000000..c638769034 --- /dev/null +++ b/packages/s2-react-components/playground/utils.ts @@ -0,0 +1,13 @@ +/* eslint-disable no-restricted-imports */ +/* eslint-disable no-console */ +import type { SpreadSheet } from '@antv/s2'; +import _ from 'lodash'; + +export const onSheetMounted = (s2: SpreadSheet) => { + console.log('onSheetMounted: ', s2); + // @ts-ignore + window.s2 = s2; + // @ts-ignore + window.g_instances = [s2.container]; + window._ = _; +}; diff --git a/packages/s2-react-components/src/components/analysis/index.ts b/packages/s2-react-components/src/components/analysis/index.ts new file mode 100644 index 0000000000..924995d07a --- /dev/null +++ b/packages/s2-react-components/src/components/analysis/index.ts @@ -0,0 +1 @@ +export { Switcher } from './switcher'; diff --git a/packages/s2-react-components/src/components/analysis/switcher/index.tsx b/packages/s2-react-components/src/components/analysis/switcher/index.tsx new file mode 100644 index 0000000000..c69413e784 --- /dev/null +++ b/packages/s2-react-components/src/components/analysis/switcher/index.tsx @@ -0,0 +1,5 @@ +import React from 'react'; + +export const Switcher: React.FC = () => { + return
WIP: Switcher
; +}; diff --git a/packages/s2-react-components/src/components/config/index.ts b/packages/s2-react-components/src/components/config/index.ts new file mode 100644 index 0000000000..647af05322 --- /dev/null +++ b/packages/s2-react-components/src/components/config/index.ts @@ -0,0 +1 @@ +export { ThemePanel } from './theme-panel'; diff --git a/packages/s2-react-components/src/components/config/theme-panel/index.tsx b/packages/s2-react-components/src/components/config/theme-panel/index.tsx new file mode 100644 index 0000000000..2908f8efbc --- /dev/null +++ b/packages/s2-react-components/src/components/config/theme-panel/index.tsx @@ -0,0 +1,5 @@ +import React from 'react'; + +export const ThemePanel: React.FC = () => { + return
WIP: ThemePanel
; +}; diff --git a/packages/s2-react-components/src/components/index.ts b/packages/s2-react-components/src/components/index.ts new file mode 100644 index 0000000000..dc787193e9 --- /dev/null +++ b/packages/s2-react-components/src/components/index.ts @@ -0,0 +1,2 @@ +export * from './analysis'; +export * from './config'; diff --git a/packages/s2-react-components/src/index.ts b/packages/s2-react-components/src/index.ts new file mode 100644 index 0000000000..07635cbbc8 --- /dev/null +++ b/packages/s2-react-components/src/index.ts @@ -0,0 +1 @@ +export * from './components'; diff --git a/packages/s2-react-components/tsconfig.declaration.json b/packages/s2-react-components/tsconfig.declaration.json new file mode 100644 index 0000000000..3af602f3f6 --- /dev/null +++ b/packages/s2-react-components/tsconfig.declaration.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "declarationDir": "temp", + "declaration": true, + "emitDeclarationOnly": true, + "paths": {} + }, + "exclude": ["playground", "__tests__/"] +} diff --git a/packages/s2-react-components/tsconfig.json b/packages/s2-react-components/tsconfig.json new file mode 100644 index 0000000000..aea6cd8b30 --- /dev/null +++ b/packages/s2-react-components/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "target": "ESNext", + "jsx": "react", + "paths": { + "@antv/s2":["s2-core/src/index.ts"], + "@antv/s2-react":["s2-react/src/index.ts"], + "@antv/s2-shared":["s2-shared/src/index.ts"], + "@/*":["s2-react-components/src/*"], + "tests/*":["s2-react-components/__tests__/*"] + } + }, + "exclude": ["node_modules", "coverage", "esm", "lib", "dist", "temp"], + "include": ["src", "./typings.d.ts", "playground", "../../global.d.ts"] +} diff --git a/packages/s2-react-components/typings.d.ts b/packages/s2-react-components/typings.d.ts new file mode 100644 index 0000000000..ede99b25da --- /dev/null +++ b/packages/s2-react-components/typings.d.ts @@ -0,0 +1,9 @@ +/// + +declare module '*.svg' { + import * as React from 'react'; + + export const ReactComponent: React.FunctionComponent< + React.SVGProps & { title?: string } + >; +} diff --git a/packages/s2-react-components/vite.config.ts b/packages/s2-react-components/vite.config.ts new file mode 100644 index 0000000000..fc8bc5f1c0 --- /dev/null +++ b/packages/s2-react-components/vite.config.ts @@ -0,0 +1,113 @@ +/* eslint-disable import/order */ +/* eslint-disable import/no-extraneous-dependencies */ +/* eslint-disable prefer-named-capture-group */ +import { viteCommonjs } from '@originjs/vite-plugin-commonjs'; +import react from '@vitejs/plugin-react'; +import path from 'path'; +import peerDepsExternal from 'rollup-plugin-peer-deps-external'; +import { visualizer } from 'rollup-plugin-visualizer'; +import { + defineConfig, + type Alias, + type LibraryFormats, + type PluginOption, +} from 'vite'; +import svgr from 'vite-plugin-svgr'; + +const OUT_DIR_NAME_MAP: { [key in LibraryFormats]?: string } = { + es: 'esm', + cjs: 'lib', + umd: 'dist', +}; + +const format = process.env['FORMAT'] as LibraryFormats; +const isAnalysisMode = process.env['ANALYSIS']; +const isDevMode = process.env['PLAYGROUND']; +const outDir = OUT_DIR_NAME_MAP[format]; +const isUmdFormat = format === 'umd'; +const root = path.join(__dirname, isDevMode ? 'playground' : ''); + +const alias: Alias[] = [ + { + find: 'lodash', + replacement: 'lodash-es', + }, +]; + +if (isDevMode) { + // 防止开发模式下直接加载s2-core中的主题less + alias.push({ + find: /^(.*)\/theme\/(.*)\.less$/, + replacement: '$1/theme/$2.less?inline', + }); +} + +// eslint-disable-next-line import/no-default-export +export default defineConfig({ + // 开发配置 + root, + server: { + port: 3002, + hmr: true, + }, + + // 打包配置 + resolve: { + mainFields: ['src', 'module', 'main'], + alias, + }, + + define: { + 'process.env.NODE_ENV': JSON.stringify( + isDevMode ? 'development' : 'production', + ), + }, + + plugins: [ + peerDepsExternal(), + !isDevMode && viteCommonjs(), + react({ + jsxRuntime: 'classic', + }), + svgr(), + isAnalysisMode && visualizer({ gzipSize: true }), + ].filter(Boolean) as PluginOption[], + + css: { + preprocessorOptions: { + less: { + javascriptEnabled: true, + }, + }, + modules: { + /* + * 样式小驼峰转化 + * css: goods-list => tsx: goodsList + */ + localsConvention: 'camelCase', + }, + }, + + build: { + target: 'es2015', + minify: isUmdFormat ? 'esbuild' : false, + sourcemap: true, + lib: { + name: 'S2-React-Components', + entry: './src/index.ts', + formats: [format], + }, + outDir, + rollupOptions: { + output: { + entryFileNames: `[name]${isUmdFormat ? '.min' : ''}.js`, + assetFileNames: `[name]${isUmdFormat ? '.min' : ''}.[ext]`, + globals: { + react: 'React', + 'react-dom': 'ReactDOM', + '@antv/s2': 'S2', + }, + }, + }, + }, +}); diff --git a/packages/s2-react/__tests__/bugs/issue-1736-spec.tsx b/packages/s2-react/__tests__/bugs/issue-1736-spec.tsx index 02cfca23cd..57b683e029 100644 --- a/packages/s2-react/__tests__/bugs/issue-1736-spec.tsx +++ b/packages/s2-react/__tests__/bugs/issue-1736-spec.tsx @@ -3,11 +3,11 @@ * https://github.com/antvis/S2/issues/1736 * Export dropdown visible state error */ +import { Export } from '@/components/export'; 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 { Export } from '@/components/export'; describe('header export component render tests', () => { let unmount: Root['unmount']; diff --git a/packages/s2-react/__tests__/bugs/issue-522-spec.tsx b/packages/s2-react/__tests__/bugs/issue-522-spec.tsx index 0e1aef6354..0ffafa93b7 100644 --- a/packages/s2-react/__tests__/bugs/issue-522-spec.tsx +++ b/packages/s2-react/__tests__/bugs/issue-522-spec.tsx @@ -8,14 +8,14 @@ import type { Node, SpreadSheet } from '@antv/s2'; import { waitFor } from '@testing-library/react'; import React from 'react'; +import { SheetComponent, type SheetComponentProps } from '../../src'; import dataCfg from '../data/data-issue-522.json'; import { renderComponent } from '../util/helpers'; -import { type SheetComponentsProps, SheetComponent } from '../../src'; let sheetInstance: SpreadSheet; function MainLayout() { - const options: SheetComponentsProps['options'] = { + const options: SheetComponentProps['options'] = { width: 1180, height: 525, totals: { diff --git a/packages/s2-react/__tests__/bugs/issue-594-spec.tsx b/packages/s2-react/__tests__/bugs/issue-594-spec.tsx index e3dd91aed8..e956d833d2 100644 --- a/packages/s2-react/__tests__/bugs/issue-594-spec.tsx +++ b/packages/s2-react/__tests__/bugs/issue-594-spec.tsx @@ -3,6 +3,8 @@ * https://github.com/antvis/S2/issues/594 * Wrong ref when sheet type changed */ +import { SheetComponent } from '@/components/sheets'; +import type { SheetComponentProps } from '@/components/sheets/interface'; import { S2Event, SpreadSheet, TableSheet } from '@antv/s2'; import type { SheetType } from '@antv/s2-shared'; import { waitFor } from '@testing-library/react'; @@ -10,8 +12,6 @@ import React, { type MutableRefObject } from 'react'; import { act } from 'react-dom/test-utils'; import * as mockDataConfig from 'tests/data/simple-data.json'; import { renderComponent } from 'tests/util/helpers'; -import type { SheetComponentsProps } from '@/components/sheets/interface'; -import { SheetComponent } from '@/components/sheets'; let s2: SpreadSheet | null; @@ -20,7 +20,7 @@ let mockRef = { } as unknown as MutableRefObject; function MainLayout( - props: Partial & { toggleSheetType?: boolean }, + props: Partial & { toggleSheetType?: boolean }, ) { const s2Ref = React.useRef(null); const buttonRef = React.useRef(null); diff --git a/packages/s2-react/__tests__/bugs/issue-652-spec.tsx b/packages/s2-react/__tests__/bugs/issue-652-spec.tsx index c23a9a1d5c..d625f5fa5e 100644 --- a/packages/s2-react/__tests__/bugs/issue-652-spec.tsx +++ b/packages/s2-react/__tests__/bugs/issue-652-spec.tsx @@ -4,20 +4,20 @@ * Wrong table width and height when enable adaptive * */ +import { SheetComponent } from '@/components/sheets'; +import type { SheetComponentProps } from '@/components/sheets/interface'; import type { SheetType } from '@antv/s2-shared'; import { waitFor } from '@testing-library/react'; import React from 'react'; import * as mockDataConfig from 'tests/data/simple-data.json'; import { renderComponent } from '../util/helpers'; -import type { SheetComponentsProps } from '@/components/sheets/interface'; -import { SheetComponent } from '@/components/sheets'; -const s2Options: SheetComponentsProps['options'] = { +const s2Options: SheetComponentProps['options'] = { width: 400, height: 400, }; -function MainLayout({ sheetType, adaptive }: Partial) { +function MainLayout({ sheetType, adaptive }: Partial) { return ( { const s2 = new PivotSheet(dom, dataCfg, options as S2Options); @@ -110,7 +110,7 @@ const getDataCfg = (index: number) => data: getData(index), totalData: getData(index, true), sortParams: [], - }) as SheetComponentsProps['dataCfg']; + }) as SheetComponentProps['dataCfg']; const getOptions = (): SheetComponentOptions => { return { @@ -177,7 +177,7 @@ function MainLayout() { spreadsheet={( dom: S2MountContainer, dataCfg: S2DataConfig, - options: SheetComponentsProps['options'], + options: SheetComponentProps['options'], ) => setSpreadSheet(dom, dataCfg, options, 1)} />, )} @@ -190,7 +190,7 @@ function MainLayout() { spreadsheet={( dom: S2MountContainer, dataCfg: S2DataConfig, - options: SheetComponentsProps['options'], + options: SheetComponentProps['options'], ) => setSpreadSheet(dom, dataCfg, options, 2)} />, )} @@ -203,7 +203,7 @@ function MainLayout() { spreadsheet={( dom: S2MountContainer, dataCfg: S2DataConfig, - options: SheetComponentsProps['options'], + options: SheetComponentProps['options'], ) => setSpreadSheet(dom, dataCfg, options, 3)} />, )} @@ -216,7 +216,7 @@ function MainLayout() { spreadsheet={( dom: S2MountContainer, dataCfg: S2DataConfig, - options: SheetComponentsProps['options'], + options: SheetComponentProps['options'], ) => setSpreadSheet(dom, dataCfg, options, 4)} />, )} @@ -229,7 +229,7 @@ function MainLayout() { spreadsheet={( dom: S2MountContainer, dataCfg: S2DataConfig, - options: SheetComponentsProps['options'], + options: SheetComponentProps['options'], ) => setSpreadSheet(dom, dataCfg, options, 5)} />, )} diff --git a/packages/s2-react/__tests__/spreadsheet/data-accuracy-two-measures-spec.tsx b/packages/s2-react/__tests__/spreadsheet/data-accuracy-two-measures-spec.tsx index fa61a3e7fd..079b0bfff6 100644 --- a/packages/s2-react/__tests__/spreadsheet/data-accuracy-two-measures-spec.tsx +++ b/packages/s2-react/__tests__/spreadsheet/data-accuracy-two-measures-spec.tsx @@ -9,6 +9,7 @@ import { type S2Options, } from '@antv/s2'; import React from 'react'; +import { SheetComponent, type SheetComponentProps } from '../../src'; import { data10, data6, @@ -20,14 +21,13 @@ import { totalData9, } from '../data/data-accuracy'; import { renderComponent } from '../util/helpers'; -import { type SheetComponentsProps, SheetComponent } from '../../src'; let spreadsheet: SpreadSheet; const setSpreadSheet = ( dom: S2MountContainer, dataCfg: S2DataConfig, - options: SheetComponentsProps['options'], + options: SheetComponentProps['options'], index: number, ) => { const s2 = new PivotSheet(dom, dataCfg, options as S2Options); @@ -99,9 +99,9 @@ const getDataCfg = (index: number) => data: getData(index), totalData: getData(index, true), sortParams: [], - }) as SheetComponentsProps['dataCfg']; + }) as SheetComponentProps['dataCfg']; -const getOptions = (): SheetComponentsProps['options'] => { +const getOptions = (): SheetComponentProps['options'] => { return { width: 800, height: 600, @@ -165,7 +165,7 @@ function MainLayout() { spreadsheet={( dom: S2MountContainer, dataCfg: S2DataConfig, - options: SheetComponentsProps['options'], + options: SheetComponentProps['options'], ) => setSpreadSheet(dom, dataCfg, options, 1)} />, )} diff --git a/packages/s2-react/__tests__/spreadsheet/drill-down-spec.tsx b/packages/s2-react/__tests__/spreadsheet/drill-down-spec.tsx index bc3f5ffe52..dc1a28f370 100644 --- a/packages/s2-react/__tests__/spreadsheet/drill-down-spec.tsx +++ b/packages/s2-react/__tests__/spreadsheet/drill-down-spec.tsx @@ -3,11 +3,11 @@ import { waitFor } from '@testing-library/react'; import { get, noop } from 'lodash'; import React from 'react'; import type { Root } from 'react-dom/client'; -import { SheetComponent, type SheetComponentsProps } from '../../src'; +import { SheetComponent, type SheetComponentProps } from '../../src'; import * as mockDataConfig from '../data/simple-data.json'; import { getContainer, renderComponent } from '../util/helpers'; -const s2Options: SheetComponentsProps['options'] = { +const s2Options: SheetComponentProps['options'] = { width: 600, height: 300, hierarchyType: 'tree', @@ -16,7 +16,7 @@ const s2Options: SheetComponentsProps['options'] = { /** 下钻展示数量 */ const EXPECT_DRILL_ITEMS_NUM = 3; -const partDrillDownParams: SheetComponentsProps['partDrillDown'] = { +const partDrillDownParams: SheetComponentProps['partDrillDown'] = { drillConfig: { dataSet: [ { diff --git a/packages/s2-react/__tests__/spreadsheet/filter-sheet-spec.tsx b/packages/s2-react/__tests__/spreadsheet/filter-sheet-spec.tsx index f85fd43578..cc7d9c88f5 100644 --- a/packages/s2-react/__tests__/spreadsheet/filter-sheet-spec.tsx +++ b/packages/s2-react/__tests__/spreadsheet/filter-sheet-spec.tsx @@ -1,8 +1,9 @@ /* eslint-disable no-console */ +import { SheetComponent, type SheetComponentOptions } from '@/components'; import { DeviceType, S2Event, SpreadSheet, type S2DataConfig } from '@antv/s2'; +import { waitFor } from '@testing-library/react'; import { Button, Space } from 'antd'; import React from 'react'; -import { waitFor } from '@testing-library/react'; import type { Root } from 'react-dom/client'; import { getContainer, @@ -10,7 +11,6 @@ import { renderComponent, sleep, } from '../util/helpers'; -import { SheetComponent, type SheetComponentOptions } from '@/components'; const data = getMockData('../data/tableau-supermarket.csv'); diff --git a/packages/s2-react/__tests__/spreadsheet/multiple-values-cell-spec.tsx b/packages/s2-react/__tests__/spreadsheet/multiple-values-cell-spec.tsx index f16653c733..b340e871e6 100644 --- a/packages/s2-react/__tests__/spreadsheet/multiple-values-cell-spec.tsx +++ b/packages/s2-react/__tests__/spreadsheet/multiple-values-cell-spec.tsx @@ -10,19 +10,19 @@ import { Radio, Switch } from 'antd'; import { cloneDeep, merge } from 'lodash'; import React from 'react'; +import { SheetComponent, type SheetComponentProps } from '../../src'; import { multipleDataWithBottom, multipleDataWithCombine, multipleDataWithNormal, } from '../data/multiple-values-cell-mock-data'; import { renderComponent } from '../util/helpers'; -import { type SheetComponentsProps, SheetComponent } from '../../src'; let sheet: SpreadSheet; const onMounted = ( dom: S2MountContainer, dataCfg: S2DataConfig, - options: SheetComponentsProps['options'], + options: SheetComponentProps['options'], ) => { sheet = new PivotSheet(dom, dataCfg, options as S2Options); (window as any).sheet = sheet; @@ -77,7 +77,7 @@ const getDataCfg = (): S2DataConfig => { }; }; -const getOptions = (): SheetComponentsProps['options'] => { +const getOptions = (): SheetComponentProps['options'] => { return { width: 800, height: 600, @@ -145,7 +145,7 @@ const getOptions = (): SheetComponentsProps['options'] => { }; }; -function MainLayout(props: SheetComponentsProps) { +function MainLayout(props: SheetComponentProps) { const [options, setOptions] = React.useState(props.options); const [dataCfg, setDataCfg] = React.useState(props.dataCfg); diff --git a/packages/s2-react/__tests__/spreadsheet/pagination-spec.tsx b/packages/s2-react/__tests__/spreadsheet/pagination-spec.tsx index 3517077d08..38f9844771 100644 --- a/packages/s2-react/__tests__/spreadsheet/pagination-spec.tsx +++ b/packages/s2-react/__tests__/spreadsheet/pagination-spec.tsx @@ -9,11 +9,11 @@ import { waitFor } from '@testing-library/react'; import React from 'react'; import type { Root } from 'react-dom/client'; import { pivotSheetDataCfg } from '../../playground/config'; -import { SheetComponent, type SheetComponentsProps } from '../../src'; +import { SheetComponent, type SheetComponentProps } from '../../src'; import * as mockDataConfig from '../data/simple-data.json'; import { renderComponent } from '../util/helpers'; -const s2Options: SheetComponentsProps['options'] = { +const s2Options: SheetComponentProps['options'] = { width: 600, height: 200, pagination: { diff --git a/packages/s2-react/__tests__/spreadsheet/pressure-test-spec.tsx b/packages/s2-react/__tests__/spreadsheet/pressure-test-spec.tsx index 770fad543b..3282d7fb9b 100644 --- a/packages/s2-react/__tests__/spreadsheet/pressure-test-spec.tsx +++ b/packages/s2-react/__tests__/spreadsheet/pressure-test-spec.tsx @@ -7,8 +7,8 @@ import { type S2Options, } from '@antv/s2'; import React from 'react'; +import { SheetComponent, type SheetComponentProps } from '../../src'; import { renderComponent } from '../util/helpers'; -import { type SheetComponentsProps, SheetComponent } from '../../src'; const data: RawData[] = []; @@ -26,7 +26,7 @@ for (let i = 0; i < 1000; i++) { const onMounted = ( dom: S2MountContainer, dataCfg: S2DataConfig, - options: SheetComponentsProps['options'], + options: SheetComponentProps['options'], ) => new PivotSheet(dom, dataCfg, options as S2Options); const getDataCfg = (): S2DataConfig => { @@ -49,7 +49,7 @@ const getDataCfg = (): S2DataConfig => { }; }; -const getOptions = (): SheetComponentsProps['options'] => { +const getOptions = (): SheetComponentProps['options'] => { return { width: 800, height: 600, @@ -94,7 +94,7 @@ const getOptions = (): SheetComponentsProps['options'] => { }; }; -function MainLayout(props: SheetComponentsProps) { +function MainLayout(props: SheetComponentProps) { return ( { s2 = new TableSheet(dom, dataCfg, options as S2Options); ref.current = s2; diff --git a/packages/s2-react/__tests__/spreadsheet/tooltip-spec.tsx b/packages/s2-react/__tests__/spreadsheet/tooltip-spec.tsx index 7d83e3d3f9..f206e22f33 100644 --- a/packages/s2-react/__tests__/spreadsheet/tooltip-spec.tsx +++ b/packages/s2-react/__tests__/spreadsheet/tooltip-spec.tsx @@ -1,3 +1,6 @@ +import { SheetComponent } from '@/components/sheets'; +import type { SheetComponentOptions } from '@/components/sheets/interface'; +import { CustomTooltip } from '@/components/tooltip/custom-tooltip'; import { StarOutlined } from '@ant-design/icons'; import { BaseTooltip, GEvent, S2Event, SpreadSheet } from '@antv/s2'; import React from 'react'; @@ -6,9 +9,6 @@ import { act } from 'react-dom/test-utils'; import * as mockDataConfig from 'tests/data/simple-data.json'; import { createMockCellInfo, renderComponent, sleep } from 'tests/util/helpers'; import type { TooltipOperatorMenuOptions } from '../../src/components/tooltip/interface'; -import { CustomTooltip } from '@/components/tooltip/custom-tooltip'; -import type { SheetComponentOptions } from '@/components/sheets/interface'; -import { SheetComponent } from '@/components/sheets'; const s2Options: SheetComponentOptions = { width: 200, diff --git a/packages/s2-react/__tests__/unit/components/advanced-sort/__snapshots__/index-spec.tsx.snap b/packages/s2-react/__tests__/unit/components/advanced-sort/__snapshots__/index-spec.tsx.snap index cd957d019d..35080a63b4 100644 --- a/packages/s2-react/__tests__/unit/components/advanced-sort/__snapshots__/index-spec.tsx.snap +++ b/packages/s2-react/__tests__/unit/components/advanced-sort/__snapshots__/index-spec.tsx.snap @@ -6,7 +6,7 @@ exports[`AdvancedSort Component Tests should render component 1`] = ` class="antv-s2-advanced-sort test" >