import type { BaseStyleProps, DisplayObject, DisplayObjectConfig, Group, IAnimation } from '@antv/g'; import { CustomElement } from '@antv/g'; import type { Keyframe } from '../../types'; export interface BaseShapeStyleProps extends BaseStyleProps { } /** * 图形基类 * * Base class for shapes */ export declare abstract class BaseShape extends CustomElement { constructor(options: DisplayObjectConfig); /** * 解析后的属性 * * parsed attributes * @returns 解析后的属性 | parsed attributes * @internal */ protected get parsedAttributes(): Required; /** * 图形实例映射表 * * shape instance map * @internal */ protected shapeMap: Record; /** * 动画实例映射表 * * animation instance map * @internal */ protected animateMap: Record; /** * 创建、更新或删除图形 * * create, update or remove shape * @param className - 图形名称 | shape name * @param Ctor - 图形类型 | shape type * @param style - 图形样式。若要删除图形,传入 false | shape style. Pass false to remove the shape * @param container - 容器 | container * @param hooks - 钩子函数 | hooks * @returns 图形实例 | shape instance */ protected upsert(className: string, Ctor: string | { new (...args: any[]): T; }, style: T['attributes'] | false, container: DisplayObject, hooks?: UpsertHooks): T | undefined; update(attr?: Partial): void; /** * 在初始化时会被自动调用 * * will be called automatically when initializing * @param attributes * @param container */ abstract render(attributes: Required, container: Group): void; bindEvents(): void; /** * 从给定的属性对象中提取图形样式属性。删除特定的属性,如位置、变换和类名 * * Extracts the shape styles from a given attribute object. * Removes specific styles like position, transformation, and class name. * @param style - 属性对象 | attribute object * @returns 仅包含样式属性的对象 | An object containing only the style properties. */ getGraphicStyle>(style: T): Omit; /** * Get the prefix pairs for composite shapes used to handle animation * @returns tuples array where each tuple contains a key corresponding to a method `get${key}Style` and its shape prefix * @internal */ protected get compositeShapes(): [string, string][]; animate(keyframes: Keyframe[], options?: number | KeyframeAnimationOptions): IAnimation | null; getShape(name: string): T; private setVisibility; destroy(): void; } /** * 图形 upsert 方法生命周期钩子 * * Shape upsert method lifecycle hooks */ export interface UpsertHooks { /** * 图形创建前 * * Before creating the shape */ beforeCreate?: () => void; /** * 图形创建后 * * After creating the shape * @param instance - 图形实例 | shape instance */ afterCreate?: (instance: DisplayObject) => void; /** * 图形更新前 * * Before updating the shape * @param instance - 图形实例 | shape instance */ beforeUpdate?: (instance: DisplayObject) => void; /** * 图形更新后 * * After updating the shape * @param instance - 图形实例 | shape instance */ afterUpdate?: (instance: DisplayObject) => void; /** * 图形销毁前 * * Before destroying the shape * @param instance - 图形实例 | shape instance */ beforeDestroy?: (instance: DisplayObject) => void; /** * 图形销毁后 * * After destroying the shape * @param instance - 图形实例 | shape instance */ afterDestroy?: (instance: DisplayObject) => void; }