Skip to content

Commit

Permalink
fix: 更新 G 到最新版, 修复换行符报错的问题 close #3040
Browse files Browse the repository at this point in the history
  • Loading branch information
lijinke666 committed Dec 20, 2024
1 parent 572ed93 commit b86dddf
Show file tree
Hide file tree
Showing 14 changed files with 561 additions and 564 deletions.
6 changes: 3 additions & 3 deletions packages/s2-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@
},
"dependencies": {
"@antv/event-emitter": "^0.1.3",
"@antv/g": "^6.1.8",
"@antv/g-canvas": "^2.0.26",
"@antv/g-lite": "^2.2.3",
"@antv/g": "^6.1.15",
"@antv/g-canvas": "^2.0.33",
"@antv/g-lite": "^2.2.10",
"d3-ease": "^3.0.1",
"d3-interpolate": "^1.3.2",
"d3-timer": "^1.0.9",
Expand Down
10 changes: 8 additions & 2 deletions packages/s2-core/src/common/interface/s2Options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,20 @@ export interface S2BasicOptions<
renderer.registerPlugin(new PluginA11y({ enableExtractingText: true }));
return {
supportsCSSTransform: true,
dblClickSpeed: 200,
};
},
*/
transformCanvasConfig?: (
renderer: Renderer,
spreadsheet: SpreadSheet,
) => (Partial<CanvasConfig> | null | undefined) | void;
) =>
| (
| Partial<CanvasConfig & { supportsCSSTransform?: boolean }>
| null
| undefined
)
| void;

/** *********** 自定义单元格 hooks **************** */
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/s2-core/src/interaction/event-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export class EventController {
}

// 开启 CSS transform 时, 降级处理, 不做 canvas 内的空白检测: https://github.com/antvis/S2/issues/2879
if (this.spreadsheet.container.getConfig().supportsCSSTransform) {
if (this.spreadsheet.getCanvasConfig().supportsCSSTransform) {
return this.isMatchElement(event);
}

Expand Down
4 changes: 3 additions & 1 deletion packages/s2-core/src/sheet-type/spread-sheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,9 @@ export abstract class SpreadSheet extends EE {
* 获取 G Canvas 配置
* @see https://g.antv.antgroup.com/api/canvas/options
*/
public getCanvasConfig(): Partial<CanvasConfig> {
public getCanvasConfig(): Partial<
CanvasConfig & { supportsCSSTransform?: boolean }
> {
return this.getCanvas().getConfig();
}

Expand Down
5 changes: 2 additions & 3 deletions packages/s2-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@
"devDependencies": {
"@ant-design/icons": "^5.3.7",
"@antv/event-emitter": "^0.1.3",
"@antv/g": "^6.1.8",
"@antv/g-plugin-a11y": "^1.1.8",
"@antv/g-plugin-rough-canvas-renderer": "^2.0.26",
"@antv/g-plugin-a11y": "^1.1.15",
"@antv/g-plugin-rough-canvas-renderer": "^2.0.33",
"@antv/g2": "^5.1.20",
"@antv/s2": "workspace:*",
"@antv/s2-react-components": "workspace:*",
Expand Down
5 changes: 0 additions & 5 deletions packages/s2-react/playground/components/CustomTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ export const CustomTreeOptions: SheetComponentOptions = {
width: 600,
height: 480,
hierarchyType: 'tree',
transformCanvasConfig() {
return {
supportsCSSTransform: true,
};
},
showDefaultHeaderActionIcon: false,
interaction: {
copy: {
Expand Down
1 change: 0 additions & 1 deletion packages/s2-react/playground/components/Plugins.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export const options: SheetComponentOptions = {
console.log('当前已注册插件:', renderer.getPlugins(), renderer.getConfig());

return {
supportsCSSTransform: true,
devicePixelRatio: 2,
cursor: 'crosshair',
};
Expand Down
1 change: 0 additions & 1 deletion packages/s2-react/playground/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ export const s2Options: SheetComponentOptions = {
},
transformCanvasConfig() {
return {
supportsCSSTransform: false,
supportsPointerEvents: false,
// dblClickSpeed: 500,
// devicePixelRatio: 3,
Expand Down
1,071 changes: 536 additions & 535 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion s2-site/docs/manual/faq.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ const s2Options = {

// 透传 G 的初始化参数:https://g.antv.antgroup.com/api/canvas/options
return {
supportsCSSTransform: true,
devicePixelRatio: 2,
dblClickSpeed: 500,
cursor: 'crosshair',
Expand Down
1 change: 0 additions & 1 deletion s2-site/docs/manual/migration-v2.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ const s2Options = {
renderer.registerPlugin(new PluginA11y({ enableExtractingText: true }));

return {
supportsCSSTransform: true,
devicePixelRatio: 2
};
},
Expand Down
3 changes: 1 addition & 2 deletions s2-site/examples/custom/custom-plugins/demo/a11y.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PivotSheet, S2DataConfig, S2Options } from '@antv/s2';
import { Plugin as PluginA11y } from '@antv/g-plugin-a11y';
import { PivotSheet, S2DataConfig, S2Options } from '@antv/s2';

// 请确保 AntV/G 版本大于 5.0

Expand Down Expand Up @@ -65,7 +65,6 @@ fetch(
);

return {
supportsCSSTransform: true,
devicePixelRatio: 2,
cursor: 'crosshair',
};
Expand Down
3 changes: 1 addition & 2 deletions s2-site/examples/custom/custom-plugins/demo/rough.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PivotSheet, S2DataConfig, S2Options } from '@antv/s2';
import { Plugin as PluginRoughCanvasRenderer } from '@antv/g-plugin-rough-canvas-renderer';
import { PivotSheet, S2DataConfig, S2Options } from '@antv/s2';

/**
* 需要注意的是一旦使用该插件,“脏矩形渲染” 便无法使用,这意味着任何图形的任何样式属性改变,都会导致画布的全量重绘, 性能会严重下降。
Expand Down Expand Up @@ -62,7 +62,6 @@ fetch(
);

return {
supportsCSSTransform: true,
devicePixelRatio: 2,
cursor: 'crosshair',
};
Expand Down
12 changes: 6 additions & 6 deletions s2-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@
},
"dependencies": {
"@ant-design/icons": "^5.3.7",
"@antv/dumi-theme-antv": "^0.5.2",
"@antv/g": "^6.1.8",
"@antv/g-canvas": "^2.0.26",
"@antv/g-plugin-a11y": "^1.1.8",
"@antv/g-plugin-rough-canvas-renderer": "^2.0.26",
"@antv/dumi-theme-antv": "^0.5.5",
"@antv/g": "^6.1.15",
"@antv/g-canvas": "^2.0.33",
"@antv/g-plugin-a11y": "^1.1.15",
"@antv/g-plugin-rough-canvas-renderer": "^2.0.33",
"@antv/g2": "^5.1.21",
"@antv/s2": "workspace:*",
"@antv/s2-react": "workspace:*",
"@antv/s2-react-components": "workspace:*",
"antd": "^5.17.0",
"copy-to-clipboard": "^3.3.3",
"dumi": "^2.4.7",
"dumi": "^2.4.17",
"gh-pages": "^6.1.1",
"lodash": "^4.17.21",
"react": "^18.2.0",
Expand Down

0 comments on commit b86dddf

Please sign in to comment.