import type { BaseStyleProps } from '@antv/g'; import type { AnimationStage } from '../spec/element/animation'; import type { Combo, Edge, Element, ElementDatum, ElementType, ID, Node, State } from '../types'; import type { RuntimeContext } from './types'; export declare class ElementController { private context; private container; private elementMap; private shapeTypeMap; constructor(context: RuntimeContext); init(): void; private initContainer; private emit; private forEachElementData; getElementType(elementType: ElementType, datum: ElementDatum): string; private getTheme; getThemeStyle(elementType: ElementType): import("../spec/element/node").NodeStyle | import("../spec/element/edge").EdgeStyle | import("../spec/element/combo").ComboStyle; getThemeStateStyle(elementType: ElementType, states: State[]): any; private paletteStyle; private computePaletteStyle; getPaletteStyle(elementType: ElementType, id: ID): BaseStyleProps; private defaultStyle; /** * 计算单个元素的默认样式 * * compute default style of single element */ private computeElementDefaultStyle; private computeElementsDefaultStyle; getDefaultStyle(id: ID): Record; private getElementState; private stateStyle; /** * 获取单个元素的单个状态的样式 * * get single state style of single element */ private getElementStateStyle; /** * 计算单个元素的合并状态样式 * * compute merged state style of single element */ private computeElementStatesStyle; /** * 计算全部元素的状态样式 * * compute state style of all elements * @param ids - 计算指定元素的状态样式 | compute state style of specified elements */ private computeElementsStatesStyle; getStateStyle(id: ID): Record; private computeStyle; getElement(id: ID): T | undefined; getNodes(): Node[]; getEdges(): Edge[]; getCombos(): Combo[]; getElementComputedStyle(elementType: ElementType, datum: ElementDatum): any; private getDrawData; /** * 开始绘制流程 * * start render process */ draw(context?: DrawContext): import("@antv/g").IAnimation | null | undefined; preLayoutDraw(context?: DrawContext): Promise; private setAnimationTask; private computeChangesAndDrawData; private transformData; private createElement; private createElements; private getUpdateStageStyle; private updateElement; private updateElements; private visibilityCache; /** * 标记销毁元素 * * mark destroy element * @param data - 绘制数据 | draw data */ private markDestroyElement; private destroyElement; private destroyElements; private clearElement; /** * 将布局结果对齐到元素,避免视图偏移。会修改布局结果 * * Align the layout result to the element to avoid view offset. Will modify the layout result * @param layoutResult - 布局结果 | layout result * @param id - 元素 ID | element ID */ private alignLayoutResultToElement; /** * 收起节点 * * collapse node * @param id - 元素 ID | element ID * @param options - 选项 | options */ collapseNode(id: ID, options: CollapseExpandNodeOptions): Promise; /** * 展开节点 * * expand node * @param id - 元素 ID | element ID * @param animation - 是否使用动画,默认为 true | Whether to use animation, default is true */ expandNode(id: ID, options: CollapseExpandNodeOptions): Promise; collapseCombo(id: ID, animation: boolean): Promise; expandCombo(id: ID, animation: boolean): Promise; /** * 清空所有元素 * * clear all elements */ clear(): void; destroy(): void; } export interface DrawContext { /** 是否使用动画,默认为 true | Whether to use animation, default is true */ animation?: boolean; /** 当前绘制阶段 | Current draw stage */ stage?: AnimationStage; /** 是否不抛出事件 | Whether not to dispatch events */ silence?: boolean; /** 收起/展开的对象 ID | ID of the object to collapse/expand */ collapseExpandTarget?: ID; /** 绘制类型 | Draw type */ type?: 'render' | 'draw'; /** 展开阶段的目标元素 id | ID of the target element in the expand stage */ target?: ID; } /** * 展开/收起节点选项 * * Expand / collapse node options */ export interface CollapseExpandNodeOptions { /** * 是否使用动画 * * Whether to use animation */ animation?: boolean; /** * 保证展开/收起的节点位置不变 * * Ensure that the position of the expanded/collapsed node remains unchanged */ align?: boolean; }