1 | import type { BaseStyleProps, DisplayObject, DisplayObjectConfig, Group, IAnimation } from '@antv/g';
|
2 | import { CustomElement } from '@antv/g';
|
3 | import type { Keyframe } from '../../types';
|
4 | export interface BaseShapeStyleProps extends BaseStyleProps {
|
5 | }
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | export declare abstract class BaseShape<StyleProps extends BaseShapeStyleProps> extends CustomElement<StyleProps> {
|
12 | constructor(options: DisplayObjectConfig<StyleProps>);
|
13 | /**
|
14 | * <zh/> 解析后的属性
|
15 | *
|
16 | * <en/> parsed attributes
|
17 | * @returns <zh/> 解析后的属性 | <en/> parsed attributes
|
18 | * @internal
|
19 | */
|
20 | protected get parsedAttributes(): Required<StyleProps>;
|
21 | /**
|
22 | * <zh/> 图形实例映射表
|
23 | *
|
24 | * <en/> shape instance map
|
25 | * @internal
|
26 | */
|
27 | protected shapeMap: Record<string, DisplayObject>;
|
28 | /**
|
29 | * <zh/> 动画实例映射表
|
30 | *
|
31 | * <en/> animation instance map
|
32 | * @internal
|
33 | */
|
34 | protected animateMap: Record<string, IAnimation>;
|
35 | /**
|
36 | * <zh/> 创建、更新或删除图形
|
37 | *
|
38 | * <en/> create, update or remove shape
|
39 | * @param className - <zh/> 图形名称 | <en/> shape name
|
40 | * @param Ctor - <zh/> 图形类型 | <en/> shape type
|
41 | * @param style - <zh/> 图形样式。若要删除图形,传入 false | <en/> shape style. Pass false to remove the shape
|
42 | * @param container - <zh/> 容器 | <en/> container
|
43 | * @param hooks - <zh/> 钩子函数 | <en/> hooks
|
44 | * @returns <zh/> 图形实例 | <en/> shape instance
|
45 | */
|
46 | protected upsert<T extends DisplayObject>(className: string, Ctor: string | {
|
47 | new (...args: any[]): T;
|
48 | }, style: T['attributes'] | false, container: DisplayObject, hooks?: UpsertHooks): T | undefined;
|
49 | update(attr?: Partial<StyleProps>): void;
|
50 | /**
|
51 | * <zh/> 在初始化时会被自动调用
|
52 | *
|
53 | * <en/> will be called automatically when initializing
|
54 | * @param attributes
|
55 | * @param container
|
56 | */
|
57 | abstract render(attributes: Required<StyleProps>, container: Group): void;
|
58 | bindEvents(): void;
|
59 | /**
|
60 | * <zh/> 从给定的属性对象中提取图形样式属性。删除特定的属性,如位置、变换和类名
|
61 | *
|
62 | * <en/> Extracts the shape styles from a given attribute object.
|
63 | * Removes specific styles like position, transformation, and class name.
|
64 | * @param style - <zh/> 属性对象 | <en/> attribute object
|
65 | * @returns <zh/> 仅包含样式属性的对象 | <en/> An object containing only the style properties.
|
66 | */
|
67 | getGraphicStyle<T extends Record<string, any>>(style: T): Omit<T, 'x' | 'y' | 'z' | 'transform' | 'transformOrigin' | 'className' | 'class' | 'zIndex' | 'visibility'>;
|
68 | /**
|
69 | * Get the prefix pairs for composite shapes used to handle animation
|
70 | * @returns tuples array where each tuple contains a key corresponding to a method `get${key}Style` and its shape prefix
|
71 | * @internal
|
72 | */
|
73 | protected get compositeShapes(): [string, string][];
|
74 | animate(keyframes: Keyframe[], options?: number | KeyframeAnimationOptions): IAnimation | null;
|
75 | getShape<T extends DisplayObject>(name: string): T;
|
76 | private setVisibility;
|
77 | destroy(): void;
|
78 | }
|
79 | /**
|
80 | * <zh/> 图形 upsert 方法生命周期钩子
|
81 | *
|
82 | * <en/> Shape upsert method lifecycle hooks
|
83 | */
|
84 | export interface UpsertHooks {
|
85 | /**
|
86 | * <zh/> 图形创建前
|
87 | *
|
88 | * <en/> Before creating the shape
|
89 | */
|
90 | beforeCreate?: () => void;
|
91 | /**
|
92 | * <zh/> 图形创建后
|
93 | *
|
94 | * <en/> After creating the shape
|
95 | * @param instance - <zh/> 图形实例 | <en/> shape instance
|
96 | */
|
97 | afterCreate?: (instance: DisplayObject) => void;
|
98 | /**
|
99 | * <zh/> 图形更新前
|
100 | *
|
101 | * <en/> Before updating the shape
|
102 | * @param instance - <zh/> 图形实例 | <en/> shape instance
|
103 | */
|
104 | beforeUpdate?: (instance: DisplayObject) => void;
|
105 | /**
|
106 | * <zh/> 图形更新后
|
107 | *
|
108 | * <en/> After updating the shape
|
109 | * @param instance - <zh/> 图形实例 | <en/> shape instance
|
110 | */
|
111 | afterUpdate?: (instance: DisplayObject) => void;
|
112 | /**
|
113 | * <zh/> 图形销毁前
|
114 | *
|
115 | * <en/> Before destroying the shape
|
116 | * @param instance - <zh/> 图形实例 | <en/> shape instance
|
117 | */
|
118 | beforeDestroy?: (instance: DisplayObject) => void;
|
119 | /**
|
120 | * <zh/> 图形销毁后
|
121 | *
|
122 | * <en/> After destroying the shape
|
123 | * @param instance - <zh/> 图形实例 | <en/> shape instance
|
124 | */
|
125 | afterDestroy?: (instance: DisplayObject) => void;
|
126 | }
|
127 |
|
\ | No newline at end of file |