ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
304 lines (278 loc) • 17 kB
TypeScript
import * as i0 from '@angular/core';
import { OnInit, OnDestroy, DestroyRef, ChangeDetectorRef, IterableDiffer, ViewContainerRef, AfterViewInit, OnChanges, SimpleChanges, EventEmitter, TrackByFunction } from '@angular/core';
import { Directionality, Direction } from '@angular/cdk/bidi';
import { DataSource, CollectionViewer } from '@angular/cdk/collections';
import { CdkTree, TreeControl, CdkTreeNodeOutlet, CdkTreeNode, CdkTreeNodeDef, CdkTreeNodeOutletContext, CdkTreeNodeToggle, CdkTreeNodePadding, FlatTreeControl } from '@angular/cdk/tree';
import { Subject, Observable, BehaviorSubject } from 'rxjs';
import { NzNoAnimationDirective } from 'ng-zorro-antd/core/no-animation';
import { NzSafeAny } from 'ng-zorro-antd/core/types';
import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
/**
* 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 NzTreeView<T> extends CdkTree<T> implements OnInit, OnDestroy {
noAnimation: NzNoAnimationDirective | null;
protected destroyRef: DestroyRef;
protected directionality: Directionality;
protected cdr: ChangeDetectorRef;
dir: Direction;
_dataSourceChanged: Subject<void>;
treeControl?: TreeControl<T, NzSafeAny>;
get dataSource(): DataSource<T> | Observable<T[]> | T[];
set dataSource(dataSource: DataSource<T> | Observable<T[]> | T[]);
nzDirectoryTree: boolean;
nzBlockNode: boolean;
ngOnInit(): void;
renderNodeChanges(data: T[] | readonly T[], dataDiffer?: IterableDiffer<T>, viewContainer?: ViewContainerRef, parentData?: T): void;
static ɵfac: i0.ɵɵFactoryDeclaration<NzTreeView<any>, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<NzTreeView<any>, "ng-component", never, { "treeControl": { "alias": "nzTreeControl"; "required": false; }; "dataSource": { "alias": "nzDataSource"; "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> implements AfterViewInit {
nodeOutlet: NzTreeNodeOutletDirective;
_afterViewInit: boolean;
ngAfterViewInit(): void;
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 setIndents(indents: boolean[]): void;
abstract isLeaf: boolean;
}
/**
* 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 NzTreeVirtualNodeData<T> {
data: T;
context: CdkTreeNodeOutletContext<T>;
nodeDef: CdkTreeNodeDef<T>;
}
declare class NzTreeNodeComponent<T> extends NzNodeBase<T> implements OnInit {
indents: boolean[];
disabled: boolean;
selected: boolean;
isLeaf: boolean;
private cdr;
ngOnInit(): void;
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"], {}, {}, never, ["nz-tree-node-toggle, [nz-tree-node-toggle]", "nz-tree-node-checkbox", "nz-tree-node-option", "*"], true, never>;
}
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> implements OnChanges {
private _viewRef;
private _viewContainerRef;
data: NzTreeVirtualNodeData<T>;
compareBy?: ((value: T) => T | string | number) | null;
ngOnChanges(changes: SimpleChanges): void;
private shouldRecreateView;
private hasContextShapeChanged;
get innerCompareBy(): (value: T | null) => T | string | number | null;
private updateExistingContext;
static ɵfac: i0.ɵɵFactoryDeclaration<NzTreeVirtualScrollNodeOutletDirective<any>, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<NzTreeVirtualScrollNodeOutletDirective<any>, "[nzTreeVirtualScrollNodeOutlet]", never, { "data": { "alias": "data"; "required": false; }; "compareBy": { "alias": "compareBy"; "required": false; }; }, {}, 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;
}
/**
* 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 NzTreeNodeOptionComponent<T> implements OnChanges, OnInit {
private ngZone;
private el;
private destroyRef;
private treeNode;
nzSelected: boolean;
nzDisabled: boolean;
readonly nzClick: EventEmitter<MouseEvent>;
get isExpanded(): boolean;
ngOnChanges(changes: SimpleChanges): void;
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; }; "nzDisabled": { "alias": "nzDisabled"; "required": false; }; }, { "nzClick": "nzClick"; }, never, ["*"], true, never>;
static ngAcceptInputType_nzSelected: unknown;
static ngAcceptInputType_nzDisabled: 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 NzTreeNodeCheckboxComponent implements OnInit {
private ngZone;
private ref;
private el;
private destroyRef;
nzChecked?: boolean;
nzIndeterminate?: boolean;
nzDisabled?: boolean;
readonly nzClick: EventEmitter<MouseEvent>;
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; }; "nzIndeterminate": { "alias": "nzIndeterminate"; "required": false; }; "nzDisabled": { "alias": "nzDisabled"; "required": false; }; }, { "nzClick": "nzClick"; }, never, never, true, never>;
static ngAcceptInputType_nzChecked: unknown;
static ngAcceptInputType_nzIndeterminate: unknown;
static ngAcceptInputType_nzDisabled: unknown;
}
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 treeNode;
private tree;
private cdr;
private destroyRef;
isLast: boolean | 'unset';
isLeaf: boolean;
private preNodeRef;
private nextNodeRef;
private currentIndents;
constructor();
private getIndents;
private buildIndents;
/**
* We need to add an class name for the last child node,
* this result can also be affected when the adjacent nodes are changed.
*/
private checkAdjacent;
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;
trackBy: TrackByFunction<T>;
nodes: Array<NzTreeVirtualNodeData<T>>;
innerTrackBy: TrackByFunction<NzTreeVirtualNodeData<T>>;
ngOnChanges({ trackBy }: SimpleChanges): void;
get compareBy(): ((value: T) => NzSafeAny) | null;
renderNodeChanges(data: T[] | readonly T[]): void;
/**
* @note
* angular/cdk v18.2.0 breaking changes: https://github.com/angular/components/pull/29062
* Temporary workaround: revert to old method of getting level
* TODO: refactor tree-view, remove #treeControl and adopt #levelAccessor and #childrenAccessor
* */
_getLevel(nodeData: T): number | undefined;
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; }; "trackBy": { "alias": "trackBy"; "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 getNextSibling: <T>(nodes: T[], node: T, getLevel: (dataNode: T) => number, _index?: number) => T | null;
/**
* 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, K = 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[];
/**
* Expand flattened node with current expansion status.
* The returned list may have different length.
*/
expandFlattenedNodes(nodes: F[], treeControl: TreeControl<F, K>): F[];
}
declare class NzTreeFlatDataSource<T, F, K = F> extends DataSource<F> {
private _treeControl;
private _treeFlattener;
_flattenedData: BehaviorSubject<F[]>;
_expandedData: BehaviorSubject<F[]>;
_data: BehaviorSubject<T[]>;
constructor(_treeControl: FlatTreeControl<F, K>, _treeFlattener: NzTreeFlattener<T, F, K>, initialData?: T[]);
setData(value: T[]): void;
getData(): T[];
connect(collectionViewer: CollectionViewer): Observable<F[]>;
disconnect(): void;
private flatNodes;
}
export { NzTreeFlatDataSource, NzTreeFlattener, NzTreeNodeCheckboxComponent, NzTreeNodeComponent, NzTreeNodeDefDirective, NzTreeNodeIndentLineDirective, NzTreeNodeIndentsComponent, NzTreeNodeNoopToggleDirective, NzTreeNodeOptionComponent, NzTreeNodeOutletDirective, NzTreeNodePaddingDirective, NzTreeNodeToggleActiveIconDirective, NzTreeNodeToggleDirective, NzTreeNodeToggleRotateIconDirective, NzTreeView, NzTreeViewComponent, NzTreeViewModule, NzTreeVirtualScrollNodeOutletDirective, NzTreeVirtualScrollViewComponent, getNextSibling, getParent };
export type { NzTreeVirtualNodeData };