@antv/x6
Version:
JavaScript diagramming library that uses SVG and HTML for rendering
118 lines (117 loc) • 7.02 kB
TypeScript
import { Dom, type Nilable } from '../../common';
import { Rectangle } from '../../geometry';
import type { Graph } from '../../graph';
import type { Cell, CellBaseEventArgs, CellMutateOptions } from '../../model/cell';
import type { Edge, TerminalCellData, TerminalData, TerminalType } from '../../model/edge';
import type { Model } from '../../model/model';
import type { CellAttrs, SimpleAttrs } from '../../registry/attr';
import { Registry } from '../../registry/registry';
import { AttrManager, type AttrManagerUpdateOptions } from '../attr';
import { Cache } from '../cache';
import type { EdgeView } from '../edge';
import { FlagManager, type FlagManagerAction, type FlagManagerActions } from '../flag';
import { type MarkupJSONMarkup, type MarkupSelectors } from '../markup';
import type { NodeView } from '../node';
import { ToolsView, type ToolsViewOptions } from '../tool';
import type { ToolsViewUpdateOptions } from '../tool/tool-view';
import { View } from '../view';
import type { CellViewDefinition, CellViewEventArgs, CellViewHighlightOptions, CellViewInteractionNames, CellViewMouseEventArgs, CellViewMousePositionEventArgs, CellViewOptions } from './type';
export * from './type';
export declare class CellView<Entity extends Cell = Cell, Options extends CellViewOptions = CellViewOptions> extends View<CellViewEventArgs> {
protected static defaults: Partial<CellViewOptions>;
static registry: Registry<CellViewDefinition, import("../../common").KeyValue<CellViewDefinition>, never>;
static getDefaults(): Partial<CellViewOptions>;
static isCellView(instance: any): instance is CellView;
static config<T extends CellViewOptions = CellViewOptions>(options: Partial<T>): void;
static getOptions<T extends CellViewOptions = CellViewOptions>(options: Partial<T>): T;
graph: Graph;
cell: Entity;
protected selectors: MarkupSelectors;
protected readonly options: Options;
protected readonly flag: FlagManager;
protected readonly attr: AttrManager;
protected readonly cache: Cache;
protected get [Symbol.toStringTag](): string;
constructor(cell: Entity, options?: Partial<Options>);
protected init(): void;
protected onRemove(): void;
get priority(): number;
protected get rootSelector(): string;
protected getConstructor<T extends CellViewDefinition>(): T;
protected ensureOptions(options: Partial<Options>): Options;
protected getContainerTagName(): string;
protected getContainerStyle(): Nilable<Record<string, string | number>> | undefined;
protected getContainerAttrs(): Nilable<SimpleAttrs>;
protected getContainerClassName(): Nilable<string | string[]>;
protected ensureContainer(): HTMLElement | SVGElement;
protected setContainer(container: Element): this;
isNodeView(): this is NodeView;
isEdgeView(): this is EdgeView;
render(): this;
confirmUpdate(flag: number, options?: object): number;
getBootstrapFlag(): number;
getFlag(actions: FlagManagerActions): number;
hasAction(flag: number, actions: FlagManagerActions): number;
removeAction(flag: number, actions: FlagManagerActions): number;
handleAction(flag: number, action: FlagManagerAction, handle: () => void, additionalRemovedActions?: FlagManagerActions | null): number;
protected setup(): void;
protected onCellChanged({ options }: CellBaseEventArgs['changed']): void;
protected onAttrsChange(options: CellMutateOptions): void;
parseJSONMarkup(markup: MarkupJSONMarkup | MarkupJSONMarkup[], rootElem?: Element): import("../markup").MarkupParseResult;
can(feature: CellViewInteractionNames): boolean;
cleanCache(): this;
getCache(elem: Element): import("../cache").CacheItem;
getDataOfElement(elem: Element): import("../../common").JSONObject;
getMatrixOfElement(elem: Element): DOMMatrix;
getShapeOfElement(elem: SVGElement): import("../../geometry").Ellipse | Rectangle | import("../../geometry").Line | import("../../geometry").Polyline | import("../../geometry").Path;
getBoundingRectOfElement(elem: Element): Rectangle;
getBBoxOfElement(elem: Element): Rectangle;
getUnrotatedBBoxOfElement(elem: SVGElement): Rectangle;
getBBox(options?: {
useCellGeometry?: boolean;
}): Rectangle;
getRootTranslatedMatrix(): DOMMatrix;
getRootRotatedMatrix(): DOMMatrix;
findMagnet(elem?: Element): Element;
updateAttrs(rootNode: Element, attrs: CellAttrs, options?: Partial<AttrManagerUpdateOptions>): void;
isEdgeElement(magnet?: Element | null): boolean;
protected prepareHighlight(elem?: Element | null, options?: CellViewHighlightOptions): Element;
highlight(elem?: Element | null, options?: CellViewHighlightOptions): this;
unhighlight(elem?: Element | null, options?: CellViewHighlightOptions): this;
notifyUnhighlight(magnet: Element, options: CellViewHighlightOptions): void;
getEdgeTerminal(magnet: Element, x: number, y: number, edge: Edge, type: TerminalType): TerminalCellData;
getMagnetFromEdgeTerminal(terminal: TerminalData): any;
protected tools: ToolsView | null;
hasTools(name?: string): boolean;
addTools(options: ToolsViewOptions | null): this;
addTools(tools: ToolsView | null): this;
updateTools(options?: ToolsViewUpdateOptions): this;
removeTools(): this;
hideTools(): this;
showTools(): this;
protected renderTools(): this;
notify<Key extends keyof CellViewEventArgs>(name: Key, args: CellViewEventArgs[Key]): this;
notify(name: Exclude<string, keyof CellViewEventArgs>, args: any): this;
protected getEventArgs<E>(e: E): CellViewMouseEventArgs<E>;
protected getEventArgs<E>(e: E, x: number, y: number): CellViewMousePositionEventArgs<E>;
onClick(e: Dom.ClickEvent, x: number, y: number): void;
onDblClick(e: Dom.DoubleClickEvent, x: number, y: number): void;
onContextMenu(e: Dom.ContextMenuEvent, x: number, y: number): void;
protected cachedModelForMouseEvent: Model | null;
onMouseDown(e: Dom.MouseDownEvent, x: number, y: number): void;
onMouseUp(e: Dom.MouseUpEvent, x: number, y: number): void;
onMouseMove(e: Dom.MouseMoveEvent, x: number, y: number): void;
onMouseOver(e: Dom.MouseOverEvent): void;
onMouseOut(e: Dom.MouseOutEvent): void;
onMouseEnter(e: Dom.MouseEnterEvent): void;
onMouseLeave(e: Dom.MouseLeaveEvent): void;
onMouseWheel(e: Dom.EventObject, x: number, y: number, delta: number): void;
onCustomEvent(e: Dom.MouseDownEvent, name: string, x: number, y: number): void;
onMagnetMouseDown(e: Dom.MouseDownEvent, magnet: Element, x: number, y: number): void;
onMagnetDblClick(e: Dom.DoubleClickEvent, magnet: Element, x: number, y: number): void;
onMagnetContextMenu(e: Dom.ContextMenuEvent, magnet: Element, x: number, y: number): void;
onLabelMouseDown(e: Dom.MouseDownEvent, x: number, y: number): void;
checkMouseleave(e: Dom.EventObject): void;
dispose(): void;
}
export declare const CellViewToStringTag: string;