import { HierarchyGraphDef, HierarchyGraphNodeDef, HierarchyGraphEdgeDef, HierarchyGraphOption, HierarchyGraphNodeInfo, HierarchyBaseNodeInfo, HierarchyBaseEdgeInfo, LayoutConfig } from 'dagre-compound'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { SelectionModel } from '@angular/cdk/collections'; import { Observable, ReplaySubject } from 'rxjs'; import * as i0 from '@angular/core'; import { EventEmitter, OnInit, TemplateRef, AfterViewInit, OnChanges, AfterContentChecked, QueryList, ElementRef, SimpleChanges, NgZone } from '@angular/core'; import { NzNoAnimationDirective } from 'ng-zorro-antd/core/no-animation'; import { Selection } from 'd3-selection'; import { ZoomBehavior, ZoomTransform } from 'd3-zoom'; /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ declare enum NzGraphEdgeType { LINE = "line", CURVE = "curve" } interface NzGraphDataDef extends HierarchyGraphDef { nodes: NzGraphNodeDef[]; edges: NzGraphEdgeDef[]; } interface NzGraphNodeDef extends HierarchyGraphNodeDef { label?: string; } interface NzGraphEdgeDef extends HierarchyGraphEdgeDef { label?: string; } interface NzGraphOption extends HierarchyGraphOption { } declare type NzRankDirection = 'TB' | 'BT' | 'LR' | 'RL'; interface NzGraphGroupNode extends HierarchyGraphNodeInfo { nodes: Array; edges: NzGraphEdge[]; [key: string]: NzSafeAny; } interface NzGraphNode extends HierarchyBaseNodeInfo { id: NzSafeAny; name: NzSafeAny; label?: string; [key: string]: NzSafeAny; } interface NzGraphEdge extends HierarchyBaseEdgeInfo { id: NzSafeAny; v: NzSafeAny; w: NzSafeAny; label?: string; } interface NzLayoutSetting extends LayoutConfig { } interface NzGraphBaseLayout { layout: { nodeSep: number; rankSep: number; edgeSep: number; }; subScene: { paddingTop: number; paddingBottom: number; paddingLeft: number; paddingRight: number; labelHeight: number; }; defaultCompoundNode: { width: number; height: number; maxLabelWidth: number; }; defaultNode: { width: number; height: number; labelOffset: number; maxLabelWidth: number; }; defaultEdge: { type: NzGraphEdgeType | string; }; } declare function nzTypeDefinition(): (item: unknown) => T; type NzDeepPartial = { [P in keyof T]?: T[P] extends Array ? Array> : T[P] extends ReadonlyArray ? ReadonlyArray> : NzDeepPartial; }; type NzGraphLayoutConfig = NzDeepPartial; declare const NZ_GRAPH_LAYOUT_SETTING: NzLayoutSetting; interface NzZoomTransform { x: number; y: number; k: number; } interface RelativePositionInfo { topLeft: { x: number; y: number; }; bottomRight: { x: number; y: number; }; } /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ interface NzGraphBaseSource { /** The saved graph nodes data for `expandAll` action. */ dataSource: T; /** The expansion model */ expansionModel: SelectionModel; /** Whether the data node is expanded or collapsed. Return true if it's expanded. */ isExpanded(dataNode: K): boolean; /** Expand or collapse data node */ toggle(dataNode: K): void; /** Expand one data node */ expand(dataNode: K): void; /** Collapse one data node */ collapse(dataNode: K): void; /** Expand all the dataNodes in the tree */ expandAll(): void; /** Collapse all the dataNodes in the tree */ collapseAll(): void; } /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ declare class NzGraphData implements NzGraphBaseSource { private _data; dataSource: NzGraphDataDef; /** A selection model with multi-selection to track expansion status. */ expansionModel: SelectionModel; /** Toggles one single data node's expanded/collapsed state. */ toggle(nodeName: string): void; /** Expands one single data node. */ expand(nodeName: string): void; /** Collapses one single data node. */ collapse(nodeName: string): void; /** Whether a given data node is expanded or not. Returns true if the data node is expanded. */ isExpanded(nodeName: string): boolean; /** Collapse all dataNodes in the tree. */ collapseAll(): void; expandAll(): void; setData(data: NzGraphDataDef): void; constructor(source?: NzGraphDataDef); connect(): Observable; disconnect(): void; private findParents; private findChildren; } /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ /** * https://angular.io/errors/NG3003 * An intermediate interface for {@link NzGraphComponent} & {@link NzGraphNodeComponent} */ declare abstract class NzGraph { abstract nzNodeClick: EventEmitter; } interface Info { x: number; y: number; width: number; height: number; } declare class NzGraphNodeComponent implements OnInit { private readonly ngZone; private readonly el; private readonly builder; private readonly renderer2; private readonly graphComponent; private readonly destroyRef; node: NzGraphNode | NzGraphGroupNode; noAnimation?: boolean; customTemplate?: TemplateRef<{ $implicit: NzGraphNode | NzGraphGroupNode; }>; animationInfo: Info | null; initialState: boolean; private animationPlayer; ngOnInit(): void; makeAnimation(): Observable; makeNoAnimation(): void; getAnimationInfo(): Info; nodeTransform(): { x: number; y: number; }; computeCXPositionOfNodeShape(): number; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; static ngAcceptInputType_noAnimation: unknown; } /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ declare class NzGraphZoomDirective implements AfterViewInit { private destroyRef; private cdr; private element; nzZoom?: number; nzMinZoom: number; nzMaxZoom: number; readonly nzTransformEvent: EventEmitter; readonly nzZoomChange: EventEmitter; svgSelection: Selection; zoomBehavior: ZoomBehavior; svgElement: SVGSVGElement; gZoomElement: SVGGElement; constructor(); ngAfterViewInit(): void; bind(): void; unbind(): void; fitCenter(duration?: number): void; focus(id: NzSafeAny, duration?: number): void; /** * Handle zoom event * * @param transform */ private zoomed; /** * Scale with zoom and duration * * @param duration * @param scale * @private */ private reScale; private getRelativePositionInfo; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; static ngAcceptInputType_nzZoom: unknown; } /** Checks whether an object is a data source. */ declare function isDataSource(value: NzSafeAny): value is NzGraphData; declare class NzGraphComponent implements OnInit, OnChanges, AfterContentChecked, NzGraph { private cdr; private elementRef; private destroyRef; listOfNodeElement: QueryList; listOfNodeComponent: QueryList; nodeTemplate?: TemplateRef<{ $implicit: NzGraphNode; }>; groupNodeTemplate?: TemplateRef<{ $implicit: NzGraphGroupNode; }>; customGraphEdgeTemplate?: TemplateRef<{ $implicit: NzGraphEdge; }>; /** * Provides a stream containing the latest data array to render. * Data source can be an observable of NzGraphData, or a NzGraphData to render. */ nzGraphData: NzGraphData; nzRankDirection: NzRankDirection; nzGraphLayoutConfig?: NzGraphLayoutConfig; nzAutoSize: boolean; readonly nzGraphInitialized: EventEmitter; readonly nzGraphRendered: EventEmitter; readonly nzNodeClick: EventEmitter; requestId: number; transformStyle: string; graphRenderedSubject$: ReplaySubject; renderInfo: NzGraphGroupNode; mapOfNodeAttr: Record; mapOfEdgeAttr: Record; zoom: number; readonly typedNodes: (item: unknown) => (NzGraphGroupNode | NzGraphNode)[]; private dataSource?; private layoutSetting; /** Data subscription */ private _dataSubscription?; edgeTrackByFun: (edge: NzGraphEdge) => string; subGraphTransform: (node: NzGraphGroupNode) => string; $asNzGraphEdges: (data: unknown) => NzGraphEdge[]; coreTransform: (node: NzGraphGroupNode) => string; noAnimation: NzNoAnimationDirective | null; nzGraphZoom: NzGraphZoomDirective | null; constructor(); ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; ngAfterContentChecked(): void; /** * Move graph to center and scale automatically */ fitCenter(): void; /** * re-Draw graph * * @param data * @param options * @param needResize */ drawGraph(data: NzGraphDataDef, options: NzGraphOption, needResize?: boolean): Promise; /** * Redraw all nodes * * @param animate */ drawNodes(animate?: boolean): Promise; private resizeNodeSize; /** * Switch to the provided data source by resetting the data and unsubscribing from the current * render change subscription if one exists. If the data source is null, interpret this by * clearing the node outlet. Otherwise start listening for new data. */ private _switchDataSource; /** Set up a subscription for the data provided by the data source. */ private observeRenderChanges; /** * Get renderInfo and prepare some data * * @param data * @param options * @private */ private buildGraphInfo; /** * Play with animation * * @private */ private makeNodesAnimation; private parseInfo; /** * Merge config with user inputs * * @param config * @private */ private mergeConfig; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; static ngAcceptInputType_nzAutoSize: unknown; } /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ declare class Minimap { private ngZone; private svg; private zoomG; private mainZoom; private minimap; private maxWidth; private labelPadding; private canvas; private canvasRect; private canvasBuffer; private minimapSvg; private viewpoint; private scaleMinimap; private scaleMain; private translate; private viewpointCoord; private minimapSize; private unlisteners; constructor(ngZone: NgZone, svg: SVGSVGElement, zoomG: SVGGElement, mainZoom: ZoomBehavior, minimap: HTMLElement, maxWidth: number, labelPadding: number); destroy(): void; private minimapOffset; private updateViewpoint; update(): void; /** * Handles changes in zooming/panning. Should be called from the main svg * to notify that a zoom/pan was performed, and this minimap will update its * viewpoint rectangle. * * @param transform */ zoom(transform?: ZoomTransform | NzZoomTransform): void; } /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ declare class NzGraphMinimapComponent { private elementRef; private ngZone; private destroyRef; minimap?: Minimap; constructor(); init(containerEle: ElementRef, zoomBehavior: ZoomBehavior): void; zoom(transform: NzZoomTransform): void; update(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class NzGraphDefsComponent { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class NzGraphNodeDirective { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class NzGraphGroupNodeDirective { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class NzGraphEdgeComponent implements OnInit, OnChanges { private injector; private cdr; edge: NzGraphEdge; edgeType?: NzGraphEdgeType | string; customTemplate?: TemplateRef<{ $implicit: NzGraphEdge; }>; get id(): string; private el; private path; private line; ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; initElementStyle(): void; setLine(): void; setPath(d: string): void; setElementData(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class NzGraphEdgeDirective { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class NzGraphModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } export { NZ_GRAPH_LAYOUT_SETTING, NzGraphComponent, NzGraphData, NzGraphDefsComponent, NzGraphEdgeComponent, NzGraphEdgeDirective, NzGraphEdgeType, NzGraphGroupNodeDirective, NzGraphMinimapComponent, NzGraphModule, NzGraphNodeComponent, NzGraphNodeDirective, NzGraphZoomDirective, isDataSource, nzTypeDefinition }; export type { NzDeepPartial, NzGraphBaseLayout, NzGraphBaseSource, NzGraphDataDef, NzGraphEdge, NzGraphEdgeDef, NzGraphGroupNode, NzGraphLayoutConfig, NzGraphNode, NzGraphNodeDef, NzGraphOption, NzLayoutSetting, NzRankDirection, NzZoomTransform, RelativePositionInfo };