@antv/x6
Version:
JavaScript diagramming library that uses SVG and HTML for rendering
130 lines (129 loc) • 5.94 kB
TypeScript
import { Dom } from '../../common';
import { type EventArgs, Graph, type Options as GraphOptions, type GraphPlugin } from '../../graph';
import { type Cell, Model, Node, type NodeMetadata } from '../../model';
import { View } from '../../view';
import { Dnd } from '../dnd';
import type { Scroller } from '../scroller';
import type { StencilFilter, StencilFilters, StencilGroup, StencilOptions } from './type';
export declare const ClassNames: {
base: string;
title: string;
search: string;
searchText: string;
content: string;
group: string;
groupTitle: string;
groupContent: string;
};
export declare const DefaultGroupName = "__default__";
export declare const DefaultOptions: Partial<StencilOptions>;
export declare class Stencil extends View implements GraphPlugin {
name: string;
options: StencilOptions;
dnd: Dnd;
protected graphs: {
[]: Graph;
};
protected groups: {
[]: HTMLElement;
};
protected content: HTMLDivElement;
protected get targetScroller(): Scroller;
protected get targetGraph(): Graph;
protected get targetModel(): Model;
constructor(options?: Partial<StencilOptions>);
init(): void;
load(groups: {
[]: (Node | NodeMetadata)[];
}): this;
load(nodes: (Node | NodeMetadata)[], groupName?: string): this;
unload(groups: {
[]: (Node | NodeMetadata)[];
}): this;
unload(nodes: (Node | NodeMetadata)[], groupName?: string): this;
toggleGroup(groupName: string): this;
collapseGroup(groupName: string): this;
expandGroup(groupName: string): this;
isGroupCollapsable(groupName: string): boolean;
isGroupCollapsed(groupName: string): boolean;
collapseGroups(): this;
expandGroups(): this;
resizeGroup(groupName: string, size: {
width: number;
height: number;
}): this;
addGroup(group: StencilGroup | StencilGroup[]): void;
removeGroup(groupName: string | string[]): void;
protected initContainer(): void;
protected initContent(): void;
protected buildGraphConfig(group?: StencilGroup): {
mergedGraphOptions: {
grid?: boolean | number | (Partial<import("../../graph/grid").GridCommonOptions> & import("../../graph/grid").GridDrawOptions);
connecting?: Partial<import("../../graph").Connecting>;
translating?: Partial<import("../../graph").Translating>;
highlighting?: Partial<import("../../graph").Highlighting>;
container?: HTMLElement;
model?: Model;
x?: number;
y?: number;
width?: number;
height?: number;
autoResize?: boolean | Element | Document;
background?: false | import("../../graph").BackgroundManagerOptions;
scaling?: {
min?: number;
max?: number;
};
moveThreshold?: number;
clickThreshold?: number;
magnetThreshold?: number | "onleave";
preventDefaultDblClick?: boolean;
preventDefaultContextMenu?: boolean | ((this: Graph, { view }: {
view: import("../../view").CellView | null;
}) => boolean);
preventDefaultMouseDown?: boolean;
preventDefaultBlankAction?: boolean;
interacting?: import("../../view").CellViewInteracting;
async?: boolean;
virtual?: boolean | import("../../graph").VirtualOptions;
guard?: (e: Dom.EventObject, view?: import("../../view").CellView | null) => boolean;
onPortRendered?: (args: import("../../graph").OnPortRenderedArgs) => void;
onEdgeLabelRendered?: (args: import("../../graph").OnEdgeLabelRenderedArgs) => void | ((args: import("../../graph").OnEdgeLabelRenderedArgs) => void);
createCellView?: (this: Graph, cell: Cell) => typeof import("../../view").CellView | (new (...args: any[]) => import("../../view").CellView) | null | undefined;
panning?: boolean | Partial<import("../../graph/panning").PanningOptions>;
mousewheel?: boolean | Partial<import("../../graph/mousewheel").MouseWheelOptions>;
embedding?: boolean | Partial<import("../../graph").Embedding>;
};
width: number;
height: number;
model: Model;
};
protected createStencilGraph(mergedGraphOptions: Partial<GraphOptions>, width: number, height: number, model: Model): Graph;
protected initSearch(): void;
protected initGroup(group: StencilGroup): void;
protected initGroups(): void;
protected setCollapsableState(): void;
protected setTitle(): void;
protected renderSearch(): HTMLDivElement;
protected startListening(): void;
protected stopListening(): void;
protected registerGraphEvents(graph: Graph): void;
protected unregisterGraphEvents(graph: Graph): void;
protected getGraphHeight(groupName?: string): number;
protected loadGroup(cells: (Node | NodeMetadata)[], groupName?: string, reverse?: boolean): this;
protected onDragStart(args: EventArgs['node:mousedown']): void;
protected filter(keyword: string, filter?: StencilFilter): void;
protected isCellMatched(cell: Cell, keyword: string, filters: StencilFilters | undefined, ignoreCase: boolean): boolean;
protected onSearch(evt: Dom.EventObject): void;
protected onSearchFocusIn(): void;
protected onSearchFocusOut(): void;
protected onTitleClick(): void;
protected onGroupTitleClick(evt: Dom.EventObject): void;
protected getModel(groupName?: string): Model;
protected getGraph(groupName?: string): Graph;
protected getGroup(groupName?: string): StencilGroup;
protected getGroupByNode(node: Node): StencilGroup;
protected clearGroups(): void;
protected onRemove(): void;
dispose(): void;
}