diff --git a/.eslintrc.js b/.eslintrc.js index d0205f56a7..a0d0701bbe 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -43,7 +43,12 @@ module.exports = { tabWidth: 2, trailingComma: 'all', printWidth: 80, + arrowParens: 'always', proseWrap: 'never', + htmlWhitespaceSensitivity: 'css', + embeddedLanguageFormatting: 'auto', + singleAttributePerLine: false, + bracketSpacing: true, overrides: [ { files: '.eslintrc', options: { parser: 'json' } }, { files: '.prettierrc', options: { parser: 'json' } }, @@ -57,7 +62,7 @@ module.exports = { ], 'import/no-duplicates': [2, { considerQueryString: true }], 'import/no-deprecated': 1, - 'import/no-cycle': 1, + 'import/no-cycle': 2, 'import/order': [ 2, { diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index 000f900171..93cca60d9f 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -54,6 +54,9 @@ jobs: - name: Install dependencies run: pnpm bootstrap:ci + - name: Build doctor + run: pnpm build:doctor + - name: Build run: pnpm build diff --git a/.github/workflows/compressed-size.yml b/.github/workflows/compressed-size.yml index fe79eec36a..ff05016645 100644 --- a/.github/workflows/compressed-size.yml +++ b/.github/workflows/compressed-size.yml @@ -30,6 +30,6 @@ jobs: - uses: preactjs/compressed-size-action@v2 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" - pattern: "./packages/{s2-core,s2-react,s2-vue}/dist/**/*.{js,css}" - build-script: "build:umd" + pattern: "./packages/{s2-core,s2-react,s2-react-components,s2-vue}/dist/**/*.{js,css}" + build-script: "build" clean-script: "clean" diff --git a/.gitignore b/.gitignore index 9936a09d18..2c7368fef0 100644 --- a/.gitignore +++ b/.gitignore @@ -24,5 +24,6 @@ packages/s2-*/dist/ packages/s2-*/temp/ packages/s2-*/coverage/ packages/s2-*/stats.html +packages/**/*.css .swc diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d65dbc444b..891e15c6c4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,7 +7,11 @@ "我代码水平不行", "会不会受到鄙视?", "会不会不太好?", 放心,不存在的! -我们欢迎任何形式的贡献,不管是一个**错别字的修改**,还是**一次友好的建议**,不管是通过提交 [Issue](https://github.com/antvis/S2/issues/new/choose), 还是一个帅气 [pull request](https://github.com/antvis/S2/pulls), 亦或是一次钉钉群的讨论,参与 [discussions](https://github.com/antvis/S2/discussions) 的讨论,期待在 [贡献者列表](https://github.com/antvis/S2/graphs/contributors) 里看见你的头像。 +我们欢迎任何形式的贡献,不管是一个**错别字的修改**,还是**一次友好的建议**,不管是通过提交 [Issue](https://github.com/antvis/S2/issues/new/choose), 还是一个帅气 [pull request](https://github.com/antvis/S2/pulls), 亦或是参与 [discussions](https://github.com/antvis/S2/discussions) 的讨论。 + +这是一个开源项目,我们也有繁忙的业务要做,是用自己的业余时间在维护,为爱发电,精力有限,所以有时候 issue 响应速度不是那么及时。 + +如果你遇到了问题,或者对 Issues 和 Discussions 列表的问题感兴趣,可以直接认领并尝试修复,帮助 S2 变得更好,期待在 [贡献者列表](https://github.com/antvis/S2/graphs/contributors) 里看见你的头像。 ## 分支管理 diff --git a/README.en-US.md b/README.en-US.md index 95392e2148..9623c6c970 100644 --- a/README.en-US.md +++ b/README.en-US.md @@ -30,7 +30,7 @@ A practical visualization library for tabular analysis.
-
+
@@ -77,9 +77,9 @@ demo components and expansion capabilities, it allows developers to use it quick
## 📦 Installation
```bash
-$ npm install @antv/s2@next --save
-# yarn add @antv/s2@next
-# pnpm add @antv/s2@next
+$ npm install @antv/s2 --save
+# yarn add @antv/s2
+# pnpm add @antv/s2
```
## 🔨 Getting Started
@@ -208,11 +208,13 @@ bootstrap()
### 📦 Packages
-| Package | Latest | Beta | Alpha | Next | Size | Download |
-| - | - | - | - | - | - | - |
-| [@antv/s2](https://github.com/antvis/S2/tree/next/packages/s2-core) | ![latest](https://img.shields.io/npm/v/@antv/s2/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2.svg) |
-| [@antv/s2-react](https://github.com/antvis/S2/tree/next/packages/s2-react) | ![latest](https://img.shields.io/npm/v/@antv/s2-react/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-react/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-react/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-react/next.svg)| ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react.svg) |
-| [@antv/s2-vue](https://github.com/antvis/S2/tree/next/packages/s2-vue) | ![latest](https://img.shields.io/npm/v/@antv/s2-vue/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-vue/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-vue/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-vue/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-vue@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg) |
+| Package | Latest | Next | Size | Download |
+| - | - | - | - | - |
+| -------- | ------ | --------- | ---------- | ------ |
+| [@antv/s2](https://github.com/antvis/S2/tree/next/packages/s2-core) | ![latest](https://img.shields.io/npm/v/@antv/s2/latest.svg?logo=npm) | ![next](https://img.shields.io/npm/v/@antv/s2/next.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2.svg?logo=npm) |
+| [@antv/s2-react](https://github.com/antvis/S2/tree/next/packages/s2-react) | ![latest](https://img.shields.io/npm/v/@antv/s2-react/latest.svg?logo=npm) | ![next](https://img.shields.io/npm/v/@antv/s2-react/next.svg?logo=npm)| ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react.svg?logo=npm) |
+| [@antv/s2-react-components](https://github.com/antvis/S2/tree/next/packages/s2-react-components) | ![latest](https://img.shields.io/npm/v/@antv/s2-react-components/latest.svg?logo=npm) | ![next](https://img.shields.io/npm/v/@antv/s2-react-components/next.svg?logo=npm)| ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react-components@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react-components.svg?logo=npm) |
+| [@antv/s2-vue](https://github.com/antvis/S2/tree/next/packages/s2-vue) | ![latest](https://img.shields.io/npm/v/@antv/s2-vue/latest.svg?logo=npm) | ![next](https://img.shields.io/npm/v/@antv/s2-vue/next.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-vue@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg?logo=npm) |
### 🖥️ Browser Compatibility
diff --git a/README.md b/README.md
index ebb7941e60..677a3404f0 100644
--- a/README.md
+++ b/README.md
@@ -29,7 +29,7 @@
-
+
@@ -73,9 +73,9 @@ S2 是 AntV 在多维交叉分析表格领域的解决方案,完全基于数
## 📦 安装
```bash
-$ npm install @antv/s2@next --save
-# yarn add @antv/s2@next
-# pnpm add @antv/s2@next
+$ npm install @antv/s2 --save
+# yarn add @antv/s2
+# pnpm add @antv/s2
```
## 🔨 使用
@@ -204,11 +204,13 @@ bootstrap()
### 📦 版本
-| Package | Latest | Beta | Alpha | Next | Size | Download |
-| - | - | - | - | - | - | - |
-| [@antv/s2](https://github.com/antvis/S2/tree/next/packages/s2-core) | ![latest](https://img.shields.io/npm/v/@antv/s2/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2.svg) |
-| [@antv/s2-react](https://github.com/antvis/S2/tree/next/packages/s2-react) | ![latest](https://img.shields.io/npm/v/@antv/s2-react/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-react/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-react/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-react/next.svg)| ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react.svg) |
-| [@antv/s2-vue](https://github.com/antvis/S2/tree/next/packages/s2-vue) | ![latest](https://img.shields.io/npm/v/@antv/s2-vue/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-vue/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-vue/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-vue/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-vue@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg) |
+| Package | Latest | Next | Size | Download |
+| - | - | - | - | - |
+| -------- | ------ | --------- | ---------- | ------ |
+| [@antv/s2](https://github.com/antvis/S2/tree/next/packages/s2-core) | ![latest](https://img.shields.io/npm/v/@antv/s2/latest.svg?logo=npm) | ![next](https://img.shields.io/npm/v/@antv/s2/next.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2.svg?logo=npm) |
+| [@antv/s2-react](https://github.com/antvis/S2/tree/next/packages/s2-react) | ![latest](https://img.shields.io/npm/v/@antv/s2-react/latest.svg?logo=npm) | ![next](https://img.shields.io/npm/v/@antv/s2-react/next.svg?logo=npm)| ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react.svg?logo=npm) |
+| [@antv/s2-react-components](https://github.com/antvis/S2/tree/next/packages/s2-react-components) | ![latest](https://img.shields.io/npm/v/@antv/s2-react-components/latest.svg?logo=npm) | ![next](https://img.shields.io/npm/v/@antv/s2-react-components/next.svg?logo=npm)| ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react-components@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react-components.svg?logo=npm) |
+| [@antv/s2-vue](https://github.com/antvis/S2/tree/next/packages/s2-vue) | ![latest](https://img.shields.io/npm/v/@antv/s2-vue/latest.svg?logo=npm) | ![next](https://img.shields.io/npm/v/@antv/s2-vue/next.svg?logo=npm) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-vue@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg?logo=npm) |
### 🖥️ 兼容环境
diff --git a/build.config.base.mjs b/build.config.base.mjs
new file mode 100644
index 0000000000..a2a703a47b
--- /dev/null
+++ b/build.config.base.mjs
@@ -0,0 +1,145 @@
+/* eslint-disable max-lines-per-function */
+/* eslint-disable import/order */
+import { viteCommonjs } from '@originjs/vite-plugin-commonjs';
+import { toLower } from 'lodash';
+import path from 'path';
+import peerDepsExternal from 'rollup-plugin-peer-deps-external';
+import { visualizer } from 'rollup-plugin-visualizer';
+
+export const getBaseConfig = () => {
+ const entry = './src/index.ts';
+
+ const OUT_DIR_NAME_MAP = {
+ es: 'esm',
+ cjs: 'lib',
+ umd: 'dist',
+ };
+
+ const format = process.env.FORMAT;
+ const isAnalysisMode = process.env.ANALYSIS;
+ const isDevMode = process.env.PLAYGROUND;
+ const outDir = OUT_DIR_NAME_MAP[format];
+ const isUMD = format === 'umd';
+ const isESM = format === 'es';
+
+ const define = {
+ 'process.env.NODE_ENV': JSON.stringify(
+ isDevMode ? 'development' : 'production',
+ ),
+ };
+
+ const resolve = {
+ mainFields: ['src', 'module', 'main'],
+ alias: [],
+ };
+
+ if (isDevMode) {
+ // 防止开发模式下直接加载 s2-core 中的主题 less
+ resolve.alias.push(
+ ...[
+ {
+ find: /^(.*)\/theme\/(.*)\.less$/,
+ replacement: '$1/theme/$2.less?inline',
+ },
+ {
+ find: /^@antv\/s2$/,
+ replacement: path.join(__dirname, './packages/s2-core/src'),
+ },
+ ],
+ );
+ }
+
+ const getViteConfig = (
+ { port, name, libName, plugins } = {
+ port: 3001,
+ plugins: [],
+ },
+ ) => {
+ const filename = isUMD ? `${toLower(name || libName)}.min` : '[name]';
+
+ return {
+ server: {
+ port,
+ hmr: true,
+ },
+
+ resolve,
+
+ define: {
+ 'process.env.NODE_ENV': JSON.stringify(
+ isDevMode ? 'development' : 'production',
+ ),
+ },
+
+ plugins: [
+ peerDepsExternal(),
+ !isDevMode && viteCommonjs(),
+ isAnalysisMode &&
+ visualizer({
+ open: true,
+ gzipSize: true,
+ brotliSize: true,
+ }),
+ ...plugins,
+ ].filter(Boolean),
+
+ css: {
+ preprocessorOptions: {
+ less: {
+ javascriptEnabled: true,
+ },
+ },
+ modules: {
+ /**
+ * 样式小驼峰转化
+ * css: goods-list => tsx: goodsList
+ */
+ localsConvention: 'camelCase',
+ },
+ },
+
+ build: {
+ target: 'es2015',
+ minify: isUMD ? 'esbuild' : false,
+ sourcemap: true,
+ lib: {
+ name: libName,
+ entry,
+ formats: [format],
+ },
+ outDir,
+ rollupOptions: {
+ output: {
+ dir: outDir,
+ entryFileNames: `${filename}.js`,
+ assetFileNames: `${filename}.[ext]`,
+ globals: {
+ vue: 'Vue',
+ react: 'React',
+ 'react-dom': 'ReactDOM',
+ '@antv/s2': 'S2',
+ '@antv/s2-react': 'S2React',
+ lodash: '_',
+ antd: 'antd',
+ 'ant-design-vue': 'antd',
+ },
+ },
+ },
+ },
+ };
+ };
+
+ return {
+ entry,
+ getViteConfig,
+ define,
+ format,
+ resolve,
+ isAnalysisMode,
+ outDir,
+ OUT_DIR_NAME_MAP,
+ isDevMode,
+ isUMD,
+ isESM,
+ };
+};
diff --git a/jest.config.base.js b/jest.config.base.js
index 7a9905c693..38232a0aa7 100644
--- a/jest.config.base.js
+++ b/jest.config.base.js
@@ -43,16 +43,16 @@ module.exports = {
'\\.svg$': 'jest-raw-loader',
},
moduleNameMapper: {
+ '\\.svg$': '
-
+
@@ -207,8 +207,8 @@ bootstrap()
| Package | Latest | Beta | Alpha | Next | Size | Download |
| - | - | - | - | - | - | - |
| [@antv/s2](https://github.com/antvis/S2/tree/next/packages/s2-core) | ![latest](https://img.shields.io/npm/v/@antv/s2/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2.svg) |
-| [@antv/s2-react](https://github.com/antvis/S2/tree/next/packages/s2-react) | ![latest](https://img.shields.io/npm/v/@antv/s2-react/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-react/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-react/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-react/next.svg)| ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react.svg) |
-| [@antv/s2-vue](https://github.com/antvis/S2/tree/next/packages/s2-vue) | ![latest](https://img.shields.io/npm/v/@antv/s2-vue/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-vue/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-vue/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-vue/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-vue@latest/dist/index.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg) |
+| [@antv/s2-react](https://github.com/antvis/S2/tree/next/packages/s2-react) | ![latest](https://img.shields.io/npm/v/@antv/s2-react/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-react/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-react/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-react/next.svg)| ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-react@latest/dist/s2-react.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-react.svg) |
+| [@antv/s2-vue](https://github.com/antvis/S2/tree/next/packages/s2-vue) | ![latest](https://img.shields.io/npm/v/@antv/s2-vue/latest.svg) | ![beta](https://img.shields.io/npm/v/@antv/s2-vue/beta.svg) | ![alpha](https://img.shields.io/npm/v/@antv/s2-vue/alpha.svg) | ![next](https://img.shields.io/npm/v/@antv/s2-vue/next.svg) | ![size](https://img.badgesize.io/https:/unpkg.com/@antv/s2-vue@latest/dist/s2-vue.min.js?label=gzip%20size&compression=gzip) | ![download](https://img.shields.io/npm/dm/@antv/s2-vue.svg) |
## 问题反馈
diff --git a/packages/s2-core/__tests__/setup.js b/packages/s2-core/__tests__/setup.js
index 95ba1ba1bb..1f37195929 100644
--- a/packages/s2-core/__tests__/setup.js
+++ b/packages/s2-core/__tests__/setup.js
@@ -14,3 +14,5 @@ jest.mock('@/ui/hd-adapter', () => {
}),
};
});
+
+jest.setTimeout(60 * 1000);
diff --git a/packages/s2-core/__tests__/unit/interaction/row-column-resize-spec.ts b/packages/s2-core/__tests__/unit/interaction/row-column-resize-spec.ts
index a1e069dd0e..d07288ceea 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
@@ -134,6 +134,22 @@ describe('Interaction Row Column Resize Tests', () => {
return resizeInfo;
};
+ const createCells = () => {
+ const children = [
+ createMockCellInfo('test-cell-a', { isLeaf: true }).getNode(),
+ createMockCellInfo('test-cell-b', { isLeaf: true }).getNode(),
+ ];
+
+ return [
+ createMockCellInfo('test-row-cell-1', {
+ children,
+ }).mockCell,
+ createMockCellInfo('test-row-cell-2', {
+ children,
+ }).mockCell,
+ ];
+ };
+
beforeEach(() => {
MockRootInteraction.mockClear();
@@ -167,14 +183,6 @@ describe('Interaction Row Column Resize Tests', () => {
createMockCellInfo('test-col-cell-a').mockCell,
createMockCellInfo('test-col-cell-b').mockCell,
];
-
- // 模拟多选
- jest
- .spyOn(Node, 'getAllLeaveNodes')
- .mockImplementationOnce(() => [
- createMockCellInfo('test-cell-a').getNode(),
- createMockCellInfo('test-cell-b').getNode(),
- ]);
});
test('should register events', () => {
@@ -825,6 +833,9 @@ describe('Interaction Row Column Resize Tests', () => {
},
});
+ jest
+ .spyOn(s2.interaction, 'getActiveColCells')
+ .mockImplementationOnce(() => createCells());
jest
.spyOn(s2.interaction, 'isSelectedState')
.mockImplementationOnce(() => true);
@@ -845,6 +856,9 @@ describe('Interaction Row Column Resize Tests', () => {
},
});
+ jest
+ .spyOn(s2.interaction, 'getActiveRowCells')
+ .mockImplementationOnce(() => createCells());
jest
.spyOn(s2.interaction, 'isSelectedState')
.mockImplementationOnce(() => true);
@@ -858,10 +872,7 @@ describe('Interaction Row Column Resize Tests', () => {
// 模拟多选
jest
.spyOn(s2.interaction, 'getActiveRowCells')
- .mockImplementationOnce(() => [
- createMockCellInfo('test-row-cell-1').mockCell,
- createMockCellInfo('test-row-cell-2').mockCell,
- ]);
+ .mockImplementationOnce(() => createCells());
jest
.spyOn(s2.interaction, 'isSelectedState')
.mockImplementationOnce(() => true);
@@ -884,10 +895,7 @@ describe('Interaction Row Column Resize Tests', () => {
// 模拟多选
jest
.spyOn(s2.interaction, 'getActiveColCells')
- .mockImplementationOnce(() => [
- createMockCellInfo('test-col-cell-1').mockCell,
- createMockCellInfo('test-col-cell-2').mockCell,
- ]);
+ .mockImplementationOnce(() => createCells());
jest
.spyOn(s2.interaction, 'isSelectedState')
.mockImplementationOnce(() => true);
diff --git a/packages/s2-shared/__tests__/unit/utils/__snapshots__/drill-down-spec.ts.snap b/packages/s2-core/__tests__/unit/shared/utils/__snapshots__/drill-down-spec.ts.snap
similarity index 100%
rename from packages/s2-shared/__tests__/unit/utils/__snapshots__/drill-down-spec.ts.snap
rename to packages/s2-core/__tests__/unit/shared/utils/__snapshots__/drill-down-spec.ts.snap
diff --git a/packages/s2-shared/__tests__/unit/utils/__snapshots__/options-spec.ts.snap b/packages/s2-core/__tests__/unit/shared/utils/__snapshots__/options-spec.ts.snap
similarity index 100%
rename from packages/s2-shared/__tests__/unit/utils/__snapshots__/options-spec.ts.snap
rename to packages/s2-core/__tests__/unit/shared/utils/__snapshots__/options-spec.ts.snap
diff --git a/packages/s2-shared/__tests__/unit/utils/classnames-spec.ts b/packages/s2-core/__tests__/unit/shared/utils/classnames-spec.ts
similarity index 79%
rename from packages/s2-shared/__tests__/unit/utils/classnames-spec.ts
rename to packages/s2-core/__tests__/unit/shared/utils/classnames-spec.ts
index 8aaf270005..449817e2f7 100644
--- a/packages/s2-shared/__tests__/unit/utils/classnames-spec.ts
+++ b/packages/s2-core/__tests__/unit/shared/utils/classnames-spec.ts
@@ -1,4 +1,4 @@
-import { getStrategySheetTooltipClsName } from '../../../src/utils/classnames';
+import { getStrategySheetTooltipClsName } from '../../../../src/shared';
describe('classnames test', () => {
test('#getStrategySheetTooltipClsName()', () => {
diff --git a/packages/s2-shared/__tests__/unit/utils/drill-down-spec.ts b/packages/s2-core/__tests__/unit/shared/utils/drill-down-spec.ts
similarity index 93%
rename from packages/s2-shared/__tests__/unit/utils/drill-down-spec.ts
rename to packages/s2-core/__tests__/unit/shared/utils/drill-down-spec.ts
index e9bb7ae3a4..2c9c4fb2a0 100644
--- a/packages/s2-shared/__tests__/unit/utils/drill-down-spec.ts
+++ b/packages/s2-core/__tests__/unit/shared/utils/drill-down-spec.ts
@@ -1,20 +1,20 @@
import {
- GEvent,
- PivotDataSet,
S2Event,
Store,
+ type GEvent,
type Node,
+ type PivotDataSet,
type SpreadSheet,
-} from '@antv/s2';
-import type { PartDrillDown } from '../../../src/interface';
+} from '../../../../src';
+import type { PartDrillDown } from '../../../../src/shared';
import {
buildDrillDownOptions,
defaultPartDrillDownDisplayCondition,
getDrillDownCache,
handleActionIconClick,
handleDrillDown,
-} from '../../../src/utils/drill-down';
-import { sleep } from '../../util/helpers';
+} from '../../../../src/shared';
+import { sleep } from '../../../util/helpers';
describe('drill-down test', () => {
let s2: SpreadSheet;
diff --git a/packages/s2-shared/__tests__/unit/utils/options-spec.ts b/packages/s2-core/__tests__/unit/shared/utils/options-spec.ts
similarity index 84%
rename from packages/s2-shared/__tests__/unit/utils/options-spec.ts
rename to packages/s2-core/__tests__/unit/shared/utils/options-spec.ts
index 909e1fe25b..22b1a80674 100644
--- a/packages/s2-shared/__tests__/unit/utils/options-spec.ts
+++ b/packages/s2-core/__tests__/unit/shared/utils/options-spec.ts
@@ -1,5 +1,5 @@
-import { type S2Options } from '@antv/s2';
-import { getBaseSheetComponentOptions } from '../../../src/utils/options';
+import type { S2Options } from '../../../../src';
+import { getBaseSheetComponentOptions } from '../../../../src/shared';
describe('Options Tests', () => {
test('should get safety options', () => {
diff --git a/packages/s2-shared/__tests__/unit/utils/resize-spec.ts b/packages/s2-core/__tests__/unit/shared/utils/resize-spec.ts
similarity index 90%
rename from packages/s2-shared/__tests__/unit/utils/resize-spec.ts
rename to packages/s2-core/__tests__/unit/shared/utils/resize-spec.ts
index 7097678881..5bb8e561bd 100644
--- a/packages/s2-shared/__tests__/unit/utils/resize-spec.ts
+++ b/packages/s2-core/__tests__/unit/shared/utils/resize-spec.ts
@@ -1,8 +1,5 @@
-import { PivotSheet } from '@antv/s2';
-import {
- analyzeAdaptive,
- createResizeObserver,
-} from '../../../src/utils/resize';
+import { PivotSheet } from '../../../../src';
+import { analyzeAdaptive, createResizeObserver } from '../../../../src/shared';
describe('resize test', () => {
test('#analyzeAdaptive()', () => {
diff --git a/packages/s2-core/__tests__/unit/utils/interaction/__snapshots__/formatter-spec.ts.snap b/packages/s2-core/__tests__/unit/utils/interaction/__snapshots__/formatter-spec.ts.snap
index a93b98952b..cfabafa96b 100644
--- a/packages/s2-core/__tests__/unit/utils/interaction/__snapshots__/formatter-spec.ts.snap
+++ b/packages/s2-core/__tests__/unit/utils/interaction/__snapshots__/formatter-spec.ts.snap
@@ -4,6 +4,7 @@ exports[`#getBaseCellData() should get correctly cell data 1`] = `
Object {
"target": Object {
"cellType": undefined,
+ "children": Array [],
"colId": "0",
"colIndex": 0,
"cornerType": "",
@@ -15,6 +16,7 @@ Object {
"getStyle": [MockFunction],
"hideInteractionShape": [MockFunction],
"id": "test-a",
+ "isLeaf": false,
"isTextOverflowing": [MockFunction],
"level": 0,
"parentNode": [Circular],
@@ -42,11 +44,13 @@ Object {
"y": 0,
},
"viewMeta": Object {
+ "children": Array [],
"colId": "0",
"colIndex": 0,
"cornerType": "",
"field": "test-a",
"id": "test-a",
+ "isLeaf": false,
"level": 0,
"rowIndex": 0,
"spreadsheet": Object {
diff --git a/packages/s2-core/__tests__/util/helpers.ts b/packages/s2-core/__tests__/util/helpers.ts
index da05d2ce6f..bca47a2757 100644
--- a/packages/s2-core/__tests__/util/helpers.ts
+++ b/packages/s2-core/__tests__/util/helpers.ts
@@ -257,6 +257,8 @@ export const createMockCellInfo = (
level = 0,
cornerType = '',
cellType = undefined,
+ children = [],
+ isLeaf = false,
}: Partial