Skip to content

Commit

Permalink
fix(type): 修复 g renderer 的错误类型定义 (#2939)
Browse files Browse the repository at this point in the history
  • Loading branch information
lijinke666 authored Oct 25, 2024
1 parent c40bbf9 commit 523b2cc
Show file tree
Hide file tree
Showing 11 changed files with 16,722 additions and 12,442 deletions.
6 changes: 3 additions & 3 deletions packages/s2-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@
},
"dependencies": {
"@antv/event-emitter": "^0.1.3",
"@antv/g": "^6.0.14",
"@antv/g-canvas": "^2.0.15",
"@antv/g-lite": "^2.0.11",
"@antv/g": "^6.1.2",
"@antv/g-canvas": "^2.0.18",
"@antv/g-lite": "^2.1.2",
"d3-ease": "^3.0.1",
"d3-interpolate": "^1.3.2",
"d3-timer": "^1.0.9",
Expand Down
3 changes: 2 additions & 1 deletion packages/s2-core/src/common/interface/s2Options.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { CanvasConfig } from '@antv/g';
import type { Renderer } from '@antv/g-canvas';
import type {
ColCell,
CornerCell,
Expand Down Expand Up @@ -188,7 +189,7 @@ export interface S2BasicOptions<
},
*/
transformCanvasConfig?: (
renderer: CanvasConfig['renderer'],
renderer: Renderer,
spreadsheet: SpreadSheet,
) => (Partial<CanvasConfig> | null | undefined) | void;

Expand Down
2 changes: 1 addition & 1 deletion packages/s2-core/src/sheet-type/spread-sheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ export abstract class SpreadSheet extends EE {
protected initContainer(dom: S2MountContainer) {
const { width, height, device, transformCanvasConfig } = this.options;

const renderer = new Renderer() as unknown as CanvasConfig['renderer'];
const renderer = new Renderer();
const canvasConfig = transformCanvasConfig?.(renderer, this);
/**
* https://github.com/antvis/S2/issues/2857
Expand Down
6 changes: 3 additions & 3 deletions packages/s2-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@
"devDependencies": {
"@ant-design/icons": "^5.3.7",
"@antv/event-emitter": "^0.1.3",
"@antv/g": "^6.0.14",
"@antv/g-plugin-a11y": "^1.0.11",
"@antv/g-plugin-rough-canvas-renderer": "^2.0.15",
"@antv/g": "^6.1.2",
"@antv/g-plugin-a11y": "^1.1.2",
"@antv/g-plugin-rough-canvas-renderer": "^2.0.18",
"@antv/g2": "^5.1.20",
"@antv/s2": "workspace:*",
"@antv/s2-shared": "workspace:*",
Expand Down
11 changes: 8 additions & 3 deletions packages/s2-react/playground/components/BigDataSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ import {
import { usePlaygroundContext } from '../context/playground.context';

const s2Options: SheetComponentOptions = {
width: 1600,
height: 480,
interaction: {
scrollSpeedRatio: {
vertical: 10,
horizontal: 10,
vertical: 1,
horizontal: 1,
},
},
transformCanvasConfig(renderer) {
renderer.setConfig({
enableCulling: true,
});
},
};

export function generateRawData(
Expand Down Expand Up @@ -71,6 +75,7 @@ export const BigDataSheet = React.forwardRef<SpreadSheet, CustomGridProps>(
dataCfg={s2DataConfig}
options={s2Options}
ref={ref}
adaptive
/>
);
},
Expand Down
Loading

0 comments on commit 523b2cc

Please sign in to comment.