UNPKG

ng-zorro-antd

Version:

An enterprise-class UI components based on Ant Design and Angular

314 lines (288 loc) 18.3 kB
import * as i0 from '@angular/core'; import { TrackByFunction, DestroyRef, ChangeDetectorRef, IterableDiffer, ViewContainerRef, OnDestroy, OnInit, ElementRef, NgZone, OnChanges, SimpleChanges } from '@angular/core'; import * as _angular_cdk_bidi from '@angular/cdk/bidi'; import { Directionality } from '@angular/cdk/bidi'; import { DataSource, CollectionViewer } from '@angular/cdk/collections'; import { CdkTree, CdkTreeNodeOutlet, CdkTreeNode, CdkTreeNodeDef, CdkTreeNodeOutletContext, CdkTreeNodeToggle, CdkTreeNodePadding } from '@angular/cdk/tree'; import { Observable, Subject } from 'rxjs'; import * as i1 from 'ng-zorro-antd/core/animation'; import { NzNoAnimationDirective } from 'ng-zorro-antd/core/animation'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling'; declare class NzTreeView<T> extends CdkTree<T> { levelAccessor?: (dataNode: T) => number; childrenAccessor?: (dataNode: T) => T[]; get dataSource(): DataSource<T> | Observable<T[]> | T[]; set dataSource(dataSource: DataSource<T> | Observable<T[]> | T[]); trackBy: TrackByFunction<T>; nzDirectoryTree: boolean; nzBlockNode: boolean; protected readonly noAnimation: NzNoAnimationDirective | null; protected readonly destroyRef: DestroyRef; protected readonly directionality: Directionality; protected readonly cdr: ChangeDetectorRef; protected readonly dir: i0.WritableSignal<_angular_cdk_bidi.Direction>; readonly dataSourceChanged$: Subject<void>; dataNodes: T[]; renderNodeChanges(data: T[], dataDiffer?: IterableDiffer<T>, viewContainer?: ViewContainerRef, parentData?: T): void; /** * get render nodes (length <= flattenData.length)> * @param nodes all flatten nodes */ protected getRenderNodes(nodes: T[]): T[]; static ɵfac: i0.ɵɵFactoryDeclaration<NzTreeView<any>, never>; static ɵcmp: i0.ɵɵComponentDeclaration<NzTreeView<any>, "ng-component", never, { "levelAccessor": { "alias": "nzLevelAccessor"; "required": false; }; "childrenAccessor": { "alias": "nzChildrenAccessor"; "required": false; }; "dataSource": { "alias": "nzDataSource"; "required": false; }; "trackBy": { "alias": "nzTrackBy"; "required": false; }; "nzDirectoryTree": { "alias": "nzDirectoryTree"; "required": false; }; "nzBlockNode": { "alias": "nzBlockNode"; "required": false; }; }, {}, never, never, true, never>; static ngAcceptInputType_nzDirectoryTree: unknown; static ngAcceptInputType_nzBlockNode: 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 NzTreeNodeOutletDirective extends CdkTreeNodeOutlet { static ɵfac: i0.ɵɵFactoryDeclaration<NzTreeNodeOutletDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<NzTreeNodeOutletDirective, "[nzTreeNodeOutlet]", never, {}, {}, never, never, true, never>; } declare class NzTreeViewComponent<T> extends NzTreeView<T> { nodeOutlet: NzTreeNodeOutletDirective; static ɵfac: i0.ɵɵFactoryDeclaration<NzTreeViewComponent<any>, never>; static ɵcmp: i0.ɵɵComponentDeclaration<NzTreeViewComponent<any>, "nz-tree-view", ["nzTreeView"], {}, {}, never, never, true, never>; } /** * 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 abstract class NzNodeBase<T> extends CdkTreeNode<T> { abstract get isLeaf(): boolean; abstract setIndents(indents: boolean[]): void; } interface NzTreeVirtualNodeData<T> { data: T; context: CdkTreeNodeOutletContext<T>; nodeDef: CdkTreeNodeDef<T>; } declare class NzTreeNodeComponent<T> extends NzNodeBase<T> implements OnDestroy, OnInit { get isExpandable(): boolean; set isExpandable(value: boolean); indents: i0.WritableSignal<boolean[]>; disabled: i0.WritableSignal<boolean>; selected: i0.WritableSignal<boolean>; get isLeaf(): boolean; disable(): void; enable(): void; select(): void; deselect(): void; setIndents(indents: boolean[]): void; static ɵfac: i0.ɵɵFactoryDeclaration<NzTreeNodeComponent<any>, never>; static ɵcmp: i0.ɵɵComponentDeclaration<NzTreeNodeComponent<any>, "nz-tree-node:not([builtin])", ["nzTreeNode"], { "isExpandable": { "alias": "nzExpandable"; "required": false; }; }, {}, never, ["nz-tree-node-toggle, [nz-tree-node-toggle]", "nz-tree-node-checkbox", "nz-tree-node-option", "*"], true, [{ directive: typeof i1.NzAnimationTreeCollapseDirective; inputs: {}; outputs: {}; }]>; static ngAcceptInputType_isExpandable: unknown; } declare class NzTreeNodeDefDirective<T> extends CdkTreeNodeDef<T> { when: (index: number, nodeData: T) => boolean; static ɵfac: i0.ɵɵFactoryDeclaration<NzTreeNodeDefDirective<any>, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<NzTreeNodeDefDirective<any>, "[nzTreeNodeDef]", never, { "when": { "alias": "nzTreeNodeDefWhen"; "required": false; }; }, {}, never, never, true, never>; } declare class NzTreeVirtualScrollNodeOutletDirective<T> { readonly data: i0.InputSignal<NzTreeVirtualNodeData<T>>; readonly compareBy: i0.InputSignal<(value: T) => NzSafeAny>; private readonly _viewContainerRef; private _viewRef; private _previousData; constructor(); private shouldRecreateView; private updateExistingContext; static ɵfac: i0.ɵɵFactoryDeclaration<NzTreeVirtualScrollNodeOutletDirective<any>, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<NzTreeVirtualScrollNodeOutletDirective<any>, "[nzTreeVirtualScrollNodeOutlet]", never, { "data": { "alias": "data"; "required": true; "isSignal": true; }; "compareBy": { "alias": "compareBy"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>; } /** * 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 NzTreeNodeNoopToggleDirective { static ɵfac: i0.ɵɵFactoryDeclaration<NzTreeNodeNoopToggleDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<NzTreeNodeNoopToggleDirective, "nz-tree-node-toggle[nzTreeNodeNoopToggle], [nzTreeNodeNoopToggle]", never, {}, {}, never, never, true, never>; } declare class NzTreeNodeToggleDirective<T> extends CdkTreeNodeToggle<T> { recursive: boolean; get isExpanded(): boolean; static ɵfac: i0.ɵɵFactoryDeclaration<NzTreeNodeToggleDirective<any>, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<NzTreeNodeToggleDirective<any>, "nz-tree-node-toggle:not([nzTreeNodeNoopToggle]), [nzTreeNodeToggle]", never, { "recursive": { "alias": "nzTreeNodeToggleRecursive"; "required": false; }; }, {}, never, never, true, never>; static ngAcceptInputType_recursive: unknown; } declare class NzTreeNodeToggleRotateIconDirective { static ɵfac: i0.ɵɵFactoryDeclaration<NzTreeNodeToggleRotateIconDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<NzTreeNodeToggleRotateIconDirective, "[nzTreeNodeToggleRotateIcon]", never, {}, {}, never, never, true, never>; } declare class NzTreeNodeToggleActiveIconDirective { static ɵfac: i0.ɵɵFactoryDeclaration<NzTreeNodeToggleActiveIconDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<NzTreeNodeToggleActiveIconDirective, "[nzTreeNodeToggleActiveIcon]", never, {}, {}, never, never, true, never>; } /** * 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 NzTreeNodePaddingDirective<T> extends CdkTreeNodePadding<T> { _indent: number; get level(): number; set level(value: number); get indent(): number | string; set indent(indent: number | string); static ɵfac: i0.ɵɵFactoryDeclaration<NzTreeNodePaddingDirective<any>, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<NzTreeNodePaddingDirective<any>, "[nzTreeNodePadding]", never, { "level": { "alias": "nzTreeNodePadding"; "required": false; }; "indent": { "alias": "nzTreeNodePaddingIndent"; "required": false; }; }, {}, never, never, true, never>; static ngAcceptInputType_level: unknown; } declare class NzTreeNodeOptionComponent<T> implements OnInit { readonly nzSelected: i0.InputSignalWithTransform<boolean, unknown>; readonly nzDisabled: i0.InputSignalWithTransform<boolean, unknown>; readonly nzClick: i0.OutputEmitterRef<MouseEvent>; private readonly ngZone; private readonly element; private readonly destroyRef; private readonly treeNode; get isExpanded(): boolean; constructor(); ngOnInit(): void; static ɵfac: i0.ɵɵFactoryDeclaration<NzTreeNodeOptionComponent<any>, never>; static ɵcmp: i0.ɵɵComponentDeclaration<NzTreeNodeOptionComponent<any>, "nz-tree-node-option", never, { "nzSelected": { "alias": "nzSelected"; "required": false; "isSignal": true; }; "nzDisabled": { "alias": "nzDisabled"; "required": false; "isSignal": true; }; }, { "nzClick": "nzClick"; }, never, ["*"], true, never>; } declare class NzTreeNodeCheckboxComponent implements OnInit { readonly nzChecked: i0.InputSignalWithTransform<boolean, unknown>; readonly nzIndeterminate: i0.InputSignalWithTransform<boolean, unknown>; readonly nzDisabled: i0.InputSignalWithTransform<boolean, unknown>; readonly nzClick: i0.OutputEmitterRef<MouseEvent>; protected readonly cdr: ChangeDetectorRef; protected readonly destroyRef: DestroyRef; protected readonly elementRef: ElementRef<any>; protected readonly ngZone: NgZone; ngOnInit(): void; static ɵfac: i0.ɵɵFactoryDeclaration<NzTreeNodeCheckboxComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<NzTreeNodeCheckboxComponent, "nz-tree-node-checkbox:not([builtin])", never, { "nzChecked": { "alias": "nzChecked"; "required": false; "isSignal": true; }; "nzIndeterminate": { "alias": "nzIndeterminate"; "required": false; "isSignal": true; }; "nzDisabled": { "alias": "nzDisabled"; "required": false; "isSignal": true; }; }, { "nzClick": "nzClick"; }, never, never, true, never>; } declare class NzTreeNodeIndentsComponent { indents: boolean[]; static ɵfac: i0.ɵɵFactoryDeclaration<NzTreeNodeIndentsComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<NzTreeNodeIndentsComponent, "nz-tree-node-indents", never, { "indents": { "alias": "indents"; "required": false; }; }, {}, never, never, true, never>; } declare class NzTreeNodeIndentLineDirective<T> { private readonly treeNode; private readonly tree; private readonly cdr; private readonly destroyRef; private preNodeRef; private nextNodeRef; private currentIndents; isLast: boolean | 'unset'; get isLeaf(): boolean; get dataNodes(): T[]; get currentDataNode(): T; constructor(); /** * The true and false in indents indicate whether there should be a vertical line to the left of the current node. * if there is no nextSibling, there is no vertical line. */ private getIndents; private getIndentsForFlatData; private getIndentsForNestedData; private buildIndents; /** * We need to add a class name for the last child node, * this result can also be affected when the adjacent nodes are changed. */ private checkAdjacent; private checkAdjacentNodeChanged; private checkLast; static ɵfac: i0.ɵɵFactoryDeclaration<NzTreeNodeIndentLineDirective<any>, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<NzTreeNodeIndentLineDirective<any>, "nz-tree-node[nzTreeNodeIndentLine]", never, {}, {}, never, never, true, never>; } /** * 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 NzTreeVirtualScrollViewComponent<T> extends NzTreeView<T> implements OnChanges { readonly _nodeOutlet: NzTreeNodeOutletDirective; readonly virtualScrollViewport: CdkVirtualScrollViewport; nzItemSize: number; nzMinBufferPx: number; nzMaxBufferPx: number; nodes: Array<NzTreeVirtualNodeData<T>>; innerTrackBy: TrackByFunction<NzTreeVirtualNodeData<T>>; constructor(); ngOnChanges({ trackBy }: SimpleChanges): void; compareBy(index: number): (value: T) => NzSafeAny; renderNodeChanges(data: T[]): void; private createNode; static ɵfac: i0.ɵɵFactoryDeclaration<NzTreeVirtualScrollViewComponent<any>, never>; static ɵcmp: i0.ɵɵComponentDeclaration<NzTreeVirtualScrollViewComponent<any>, "nz-tree-virtual-scroll-view", ["nzTreeVirtualScrollView"], { "nzItemSize": { "alias": "nzItemSize"; "required": false; }; "nzMinBufferPx": { "alias": "nzMinBufferPx"; "required": false; }; "nzMaxBufferPx": { "alias": "nzMaxBufferPx"; "required": false; }; }, {}, never, never, true, never>; } declare class NzTreeViewModule { static ɵfac: i0.ɵɵFactoryDeclaration<NzTreeViewModule, never>; static ɵmod: i0.ɵɵNgModuleDeclaration<NzTreeViewModule, never, [typeof NzTreeView, typeof NzTreeNodeOutletDirective, typeof NzTreeViewComponent, typeof NzTreeNodeDefDirective, typeof NzTreeNodeComponent, typeof NzTreeNodeToggleDirective, typeof NzTreeNodePaddingDirective, typeof NzTreeNodeToggleRotateIconDirective, typeof NzTreeNodeToggleActiveIconDirective, typeof NzTreeNodeOptionComponent, typeof NzTreeNodeNoopToggleDirective, typeof NzTreeNodeCheckboxComponent, typeof NzTreeNodeIndentsComponent, typeof NzTreeVirtualScrollViewComponent, typeof NzTreeVirtualScrollNodeOutletDirective, typeof NzTreeNodeIndentLineDirective], [typeof NzTreeView, typeof NzTreeNodeOutletDirective, typeof NzTreeViewComponent, typeof NzTreeNodeDefDirective, typeof NzTreeNodeComponent, typeof NzTreeNodeToggleDirective, typeof NzTreeNodePaddingDirective, typeof NzTreeNodeToggleRotateIconDirective, typeof NzTreeNodeToggleActiveIconDirective, typeof NzTreeNodeOptionComponent, typeof NzTreeNodeNoopToggleDirective, typeof NzTreeNodeCheckboxComponent, typeof NzTreeNodeIndentsComponent, typeof NzTreeVirtualScrollViewComponent, typeof NzTreeVirtualScrollNodeOutletDirective, typeof NzTreeNodeIndentLineDirective]>; static ɵinj: i0.ɵɵInjectorDeclaration<NzTreeViewModule>; } /** * 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 const getParent: <T>(nodes: T[], node: T, getLevel: (dataNode: T) => number) => T | null; declare const getDescendants: <T>(nodes: T[], node: T, getLevel: (dataNode: T) => number) => T[]; declare const getNextSibling: <T>(nodes: T[], node: T, getLevel: (dataNode: T) => number, _index?: number) => T | null; declare const getParentForNestedData: <T>(nodes: T[], node: T, getChildren: (dataNode: T) => T[]) => T | null; declare const getNextSiblingForNestedData: <T>(nodes: T[], node: T, getChildren: (dataNode: T) => T[]) => T | null; declare const getDescendantsForNestedData: <T>(node: T, getChildren: (dataNode: T) => T[]) => T[]; declare const flattenNestedNodes: <T>(nodes: T[], getChildren: (dataNode: T) => T[]) => T[]; /** * 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 NzTreeFlattener<T, F> { transformFunction: (node: T, level: number) => F; getLevel: (node: F) => number; isExpandable: (node: F) => boolean; getChildren: (node: T) => Observable<T[]> | T[] | undefined | null; constructor(transformFunction: (node: T, level: number) => F, getLevel: (node: F) => number, isExpandable: (node: F) => boolean, getChildren: (node: T) => Observable<T[]> | T[] | undefined | null); private flattenNode; private flattenChildren; /** * Flatten a list of node type T to flattened version of node F. * Please note that type T may be nested, and the length of `structuredData` may be different * from that of returned list `F[]`. */ flattenNodes(structuredData: T[]): F[]; } /** * 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 NzTreeViewFlatDataSource<T, F> extends DataSource<F> { private readonly _tree; private readonly _treeFlattener; readonly initialData: T[]; private _flattenedData; private _data; constructor(_tree: NzTreeView<F>, _treeFlattener: NzTreeFlattener<T, F>, initialData?: T[]); setData(data: T[]): void; getData(): T[]; getFlattenData(): F[]; setFlattenedData(nodes: F[]): void; connect(collectionViewer: CollectionViewer): Observable<F[]>; disconnect(): void; private setDataNodes; private flatten; } /** * 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 NzTreeViewNestedDataSource<T> extends DataSource<T> { private _tree; readonly initialData: T[]; private _data; constructor(_tree: NzTreeView<T>, initialData?: T[]); setData(value: T[]): void; getData(): T[]; connect(collectionViewer: CollectionViewer): Observable<T[]>; disconnect(): void; private setTreeDataNodes; } export { NzTreeFlattener, NzTreeNodeCheckboxComponent, NzTreeNodeComponent, NzTreeNodeDefDirective, NzTreeNodeIndentLineDirective, NzTreeNodeIndentsComponent, NzTreeNodeNoopToggleDirective, NzTreeNodeOptionComponent, NzTreeNodeOutletDirective, NzTreeNodePaddingDirective, NzTreeNodeToggleActiveIconDirective, NzTreeNodeToggleDirective, NzTreeNodeToggleRotateIconDirective, NzTreeView, NzTreeViewComponent, NzTreeViewFlatDataSource, NzTreeViewModule, NzTreeViewNestedDataSource, NzTreeVirtualScrollNodeOutletDirective, NzTreeVirtualScrollViewComponent, flattenNestedNodes, getDescendants, getDescendantsForNestedData, getNextSibling, getNextSiblingForNestedData, getParent, getParentForNestedData }; export type { NzTreeVirtualNodeData };