import * as _angular_core from '@angular/core'; import { Signal, OnDestroy, TemplateRef, InputSignal, ElementRef, PipeTransform } from '@angular/core'; import * as i1 from '@angular/cdk/drag-drop'; import { CdkDrag, CdkDragStart, CdkDragMove, CdkDragEnd, CdkDragDrop } from '@angular/cdk/drag-drop'; import * as i2 from '@angular/common'; import * as i3 from 'ngx-tethys/input'; import * as i4 from 'ngx-tethys/button'; import * as i5 from 'ngx-tethys/shared'; import * as i6 from '@angular/forms'; import { ControlValueAccessor } from '@angular/forms'; import * as i7 from 'ngx-tethys/list'; import * as i8 from 'ngx-tethys/loading'; import * as i9 from 'ngx-tethys/icon'; import * as i10 from 'ngx-tethys/checkbox'; import * as i11 from '@angular/cdk/scrolling'; import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling'; import { SelectionModel } from '@angular/cdk/collections'; import { Subject } from 'rxjs'; declare enum ThyTreeNodeCheckState { unchecked = 0, checked = 1, indeterminate = 2 } declare enum ThyTreeDropPosition { in = "in", before = "before", after = "after" } interface ThyTreeNodeData { key?: number | string; title?: string; icon?: string; iconStyle?: { [key: string]: any; }; children?: ThyTreeNodeData[]; origin?: any; expanded?: boolean; disabled?: boolean; checked?: boolean; data?: T; itemClass?: string | string[]; [key: string]: any; } interface ThyTreeEmitEvent { eventName: string; node?: ThyTreeNode; event?: Event | any; dragNode?: ThyTreeNode; targetNode?: ThyTreeNode; } interface ThyTreeBeforeDragStartContext { item: ThyTreeNode; } interface ThyTreeBeforeDragDropContext { item?: ThyTreeNode; containerItems?: ThyTreeNode[]; previousItem?: ThyTreeNode; previousContainerItems?: ThyTreeNode[]; position?: ThyTreeDropPosition; } interface ThyTreeDragDropEvent { dragNode?: ThyTreeNode; targetNode?: ThyTreeNode; afterNode?: ThyTreeNode; } declare class ThyTreeIcons { expand?: string; collapse?: string; } type ThyClickBehavior = 'default' | 'selectCheckbox'; interface ThyTreeFormatEmitEvent { eventName: string; node: ThyTreeNode; event?: MouseEvent | DragEvent; } interface IThyTreeService { selectedNode: ThyTreeNode; flattenTreeNodes: Signal; treeNodes: ThyTreeNode[]; statusChange$: Subject | null; initializeTreeNodes: (rootNodes: ThyTreeNodeData[]) => void; syncFlattenTreeNodes: () => void; setCheckStateResolve: (resolve: (node: ThyTreeNode) => ThyTreeNodeCheckState) => void; resetSortedTreeNodes: (treeNodes: ThyTreeNode[], parent?: ThyTreeNode) => void; getTreeNode: (key: string | number) => ThyTreeNode | undefined; getExpandedNodes: () => ThyTreeNode[]; getCheckedNodes: () => ThyTreeNode[]; deleteTreeNode: (node: ThyTreeNode) => void; addTreeNode: (node: ThyTreeNode, parent?: ThyTreeNode, index?: number) => void; expandTreeNodes: (keyOrKeys: string | number | (string | number)[] | true) => void; setNodeChecked: (node: ThyTreeNode, checked: boolean, propagateUp?: boolean, propagateDown?: boolean) => void; syncNodeCheckState: (node: ThyTreeNode) => void; checkStateResolve: (node: ThyTreeNode) => ThyTreeNodeCheckState; } declare class ThyTreeNode { key?: number | string; title?: string; children: ThyTreeNode[]; parentNode?: ThyTreeNode | null; level: number; origin: ThyTreeNodeData; isExpanded: boolean; isChecked: ThyTreeNodeCheckState; isLoading: boolean; isDisabled: boolean; itemClass?: string[]; private readonly service; get treeService(): IThyTreeService | undefined; constructor(node: ThyTreeNodeData, parent?: ThyTreeNode | null, service?: IThyTreeService); setKey(key: string): void; setTitle(title: string): void; setLevel(level: number): void; private _setExpanded; setExpanded(expanded: boolean, propagate?: boolean): void; setLoading(loading: boolean): void; setChecked(checked: boolean, propagateUp?: boolean, propagateDown?: boolean): void; syncNodeCheckState(): void; getParentNode(): ThyTreeNode | null | undefined; getChildren(): ThyTreeNode[]; addChildren(children: ThyTreeNodeData | ThyTreeNodeData[], index?: number): void; } /** * @internal */ declare class ThyTreeService implements IThyTreeService, OnDestroy { selectedNode: ThyTreeNode; flattenTreeNodes: _angular_core.WritableSignal[]>; private originTreeNodes; treeNodes: ThyTreeNode[]; checkStateResolve: (node: ThyTreeNode) => ThyTreeNodeCheckState; statusChange$: Subject | null; constructor(); initializeTreeNodes(rootNodes: ThyTreeNodeData[]): void; syncFlattenTreeNodes(): void; private getParallelTreeNodes; setCheckStateResolve(resolve?: (node: ThyTreeNode) => ThyTreeNodeCheckState): void; resetSortedTreeNodes(treeNodes: ThyTreeNode[], parent?: ThyTreeNode): void; getTreeNode(key: string | number): ThyTreeNode | undefined; getExpandedNodes(): ThyTreeNode[]; getCheckedNodes(): ThyTreeNode[]; deleteTreeNode(node: ThyTreeNode): void; addTreeNode(node: ThyTreeNode, parent?: ThyTreeNode, index?: number): void; expandTreeNodes(keyOrKeys: string | number | (string | number)[] | true): void; setNodeChecked(node: ThyTreeNode, checked: boolean, propagateUp?: boolean, propagateDown?: boolean): void; private _setNodeChecked; syncNodeCheckState(node: ThyTreeNode): void; private _syncNodeCheckState; ngOnDestroy(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } type ThyTreeSize = 'sm' | 'default'; type ThyTreeType = 'default' | 'especial'; /** * 树形控件组件 * @name thy-tree */ declare class ThyTree implements ControlValueAccessor { thyTreeService: ThyTreeService; private document; private destroyRef; private expandedKeys; private selectedKeys; private hostRenderer; private _onTouched; private _onChange; private nodeDragsMap; private nodeDragMoved; private startDragNodeClone; private nodeDropTarget; private dropEnterPredicate?; selectionModel: SelectionModel; get treeNodes(): ThyTreeNode[]; readonly flattenTreeNodes: _angular_core.Signal[]>; /** * 虚拟化滚动的视口 */ readonly viewport: _angular_core.Signal; /** * TreeNode 展现所需的数据 * @type ThyTreeNodeData[] */ readonly thyNodes: _angular_core.ModelSignal[] | undefined>; /** * 设置 TreeNode 是否支持展开 * @type boolean | Function */ readonly thyShowExpand: _angular_core.InputSignal boolean)>; /** * 设置是否支持多选节点 */ readonly thyMultiple: _angular_core.InputSignalWithTransform; /** * 设置 TreeNode 是否支持拖拽排序 * @default false */ readonly thyDraggable: _angular_core.InputSignalWithTransform; /** * 设置 TreeNode 是否支持 Checkbox 选择 * @default false */ readonly thyCheckable: _angular_core.InputSignalWithTransform; /** * 点击节点的行为,`default` 为选中当前节点,`selectCheckbox` 为选中节点的 Checkbox, `thyCheckable` 为 true 时生效。 */ readonly thyClickBehavior: _angular_core.InputSignal; /** * 设置 check 状态的计算策略 */ readonly thyCheckStateResolve: _angular_core.InputSignal<((node: ThyTreeNode) => ThyTreeNodeCheckState) | undefined>; /** * 设置 TreeNode 是否支持异步加载 */ readonly thyAsync: _angular_core.InputSignalWithTransform; /** * 设置不同展示类型的 Tree,`default` 为小箭头展示, `especial` 为 加减号图标展示 * @type ThyTreeType * @default default */ readonly thyType: _angular_core.InputSignal; /** * 设置不同 Tree 展开折叠的图标,`expand` 为展开状态的图标,`collapse` 为折叠状态的图标 * @type { expand: string, collapse: string } */ readonly thyIcons: _angular_core.InputSignal; /** * 支持 `sm` | `default` 两种大小,默认值为 `default` * @type ThyTreeSize * @default default */ readonly thySize: _angular_core.InputSignal; /** * 设置是否开启虚拟滚动 */ readonly thyVirtualScroll: _angular_core.InputSignalWithTransform; /** * 开启虚拟滚动时,单行节点的高度,当`thySize`为`default`时,该参数才生效 * @default 44 */ readonly thyItemSize: _angular_core.InputSignalWithTransform; protected readonly icons: _angular_core.Signal; readonly itemSize: _angular_core.Signal; /** * 设置节点名称是否支持超出截取 * @type boolean */ readonly thyTitleTruncate: _angular_core.InputSignalWithTransform; /** * 已选中的 node 节点集合 * @default [] */ readonly thySelectedKeys: _angular_core.InputSignal; /** * 展开指定的树节点 */ readonly thyExpandedKeys: _angular_core.InputSignal<(string | number)[] | undefined>; /** * 是否展开所有树节点 */ readonly thyExpandAll: _angular_core.InputSignalWithTransform; /** * 设置缩进距离,缩进距离 = thyIndent * node.level * @type number */ readonly thyIndent: _angular_core.InputSignalWithTransform; /** * 拖拽之前的回调,函数返回 false 则阻止拖拽 */ readonly thyBeforeDragStart: _angular_core.InputSignal<((context: ThyTreeBeforeDragStartContext) => boolean) | undefined>; /** * 拖放到元素时回调,函数返回 false 则阻止拖放到当前元素 */ readonly thyBeforeDragDrop: _angular_core.InputSignal<((context: ThyTreeBeforeDragDropContext) => boolean) | undefined>; /** * 设置子 TreeNode 点击事件 */ readonly thyOnClick: _angular_core.OutputEmitterRef>; /** * 设置 check 选择事件 */ readonly thyOnCheckboxChange: _angular_core.OutputEmitterRef>; /** * 设置点击展开触发事件 */ readonly thyOnExpandChange: _angular_core.OutputEmitterRef>; /** * 设置 TreeNode 拖拽事件 */ readonly thyOnDragDrop: _angular_core.OutputEmitterRef>; /** * 双击 TreeNode 事件 */ readonly thyDblClick: _angular_core.OutputEmitterRef>; /** * 设置 TreeNode 的渲染模板 */ readonly templateRef: _angular_core.Signal | undefined>; /** * 设置子的空数据渲染模板 */ readonly emptyChildrenTemplate: _angular_core.Signal | undefined>; dragging: _angular_core.WritableSignal; readonly cdkDrags: _angular_core.Signal[]>; constructor(); eventTriggerChanged(event: ThyTreeEmitEvent): void; private initThyNodes; private handleExpandedKeys; private setTreeType; private setTreeSize; private instanceSelectionModel; private selectTreeNodes; isSelected(node: ThyTreeNode): boolean; toggleTreeNode(node: ThyTreeNode): void; trackByFn(index: number, item: any): any; isShowExpand(node: ThyTreeNode): any; writeValue(value: ThyTreeNodeData[]): void; registerOnChange(fn: any): void; registerOnTouched(fn: any): void; onDragStarted(event: CdkDragStart): void; emitDragMoved(event: CdkDragMove): void; onDragMoved(event: CdkDragMove): void; onDragEnded(event: CdkDragEnd): void; onListDropped(event: CdkDragDrop): void; private getTargetPosition; private showDropPositionPlaceholder; private cleanupDropPositionPlaceholder; private cleanupDragArtifacts; selectTreeNode(node: ThyTreeNode): void; getTreeNode(key: string): ThyTreeNode | undefined; getSelectedNode(): ThyTreeNode | null; getSelectedNodes(): ThyTreeNode[]; getExpandedNodes(): ThyTreeNode[]; getCheckedNodes(): ThyTreeNode[]; addTreeNode(node: ThyTreeNodeData, parent?: ThyTreeNode, index?: number): void; deleteTreeNode(node: ThyTreeNode): void; expandAllNodes(): void; collapsedAllNodes(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } interface ThyTreeAbstractComponent { thyMultiple: InputSignal; thyDraggable: InputSignal; thyShowExpand: InputSignal; treeNodes: ThyTreeNode[]; icons: Signal; thyBeforeDragStart(e: ThyTreeBeforeDragStartContext): boolean; thyBeforeDragDrop(e: ThyTreeBeforeDragDropContext): boolean; onDragDrop(event: ThyTreeDragDropEvent): void; selectTreeNode(node: ThyTreeNode): void; toggleTreeNode(node: ThyTreeNode): void; isShowExpand(node: ThyTreeNode): boolean; trackByFn(number: string, node: ThyTreeNode): string | number; isSelected(node: ThyTreeNode): boolean; } /** * 树形控件的节点组件 * @private * @name thy-tree-node */ declare class ThyTreeNodeComponent { root: ThyTreeAbstractComponent; thyTreeService: ThyTreeService; /** * node 节点展现所需的数据 */ readonly node: _angular_core.InputSignal>; /** * 设置 TreeNode 是否支持异步加载 */ readonly thyAsync: _angular_core.InputSignalWithTransform; /** * 设置 TreeNode 是否支持多选节点 */ readonly thyMultiple: _angular_core.InputSignalWithTransform; /** * 设置 TreeNode 是否支持拖拽排序 */ readonly thyDraggable: _angular_core.InputSignalWithTransform; /** * 设置 TreeNode 是否支持 Checkbox 选择 */ readonly thyCheckable: _angular_core.InputSignalWithTransform; /** * 点击节点的行为,`default` 为选中当前节点,`selectCheckbox` 为选中节点的 Checkbox, `thyCheckable` 为 true 时生效。 * @default default */ readonly thyClickBehavior: _angular_core.InputSignal; /** * 设置节点名称是否支持超出截取 * @default false */ readonly thyTitleTruncate: _angular_core.InputSignalWithTransform; /** * 设置 TreeNode 的渲染模板 */ readonly templateRef: _angular_core.InputSignal | undefined>; /** * 设置子的空数据渲染模板 */ readonly emptyChildrenTemplateRef: _angular_core.InputSignal | undefined>; /** * 设置 node 点击事件 */ readonly thyOnClick: _angular_core.OutputEmitterRef>; /** * 双击 node 事件 */ readonly thyDblClick: _angular_core.OutputEmitterRef>; /** * 点击展开触发事件 */ readonly thyOnExpandChange: _angular_core.OutputEmitterRef>; /** * 设置 check 选择事件 */ readonly thyOnCheckboxChange: _angular_core.OutputEmitterRef>; /** * 设置 childrenTree 的渲染模板 */ readonly childrenTreeTemplateRef: _angular_core.Signal | undefined>; /** The native `
` element. */ readonly treeNodeWrapper: _angular_core.Signal | undefined>; /** * 开启虚拟滚动时,单行节点的高度,当`thySize`为`default`时,该参数才生效 */ readonly thyItemSize: _angular_core.InputSignalWithTransform; /** * 设置节点缩进距离,缩进距离 = thyIndent * node.level */ readonly thyIndent: _angular_core.InputSignalWithTransform; readonly nodeIcon: _angular_core.Signal; readonly nodeIconStyle: _angular_core.Signal<{ [key: string]: any; } | undefined>; protected readonly itemClass: _angular_core.Signal; checkState: typeof ThyTreeNodeCheckState; clickNode(event: Event): void; dbClickNode(event: Event): void; clickNodeCheck(event: Event): void; expandNode(event: Event): void; isShowExpand(node: ThyTreeNode): boolean; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * @private */ declare class ThyTreeNodeDraggablePipe implements PipeTransform { transform(node: ThyTreeNode, beforeDragStart: (e: ThyTreeBeforeDragStartContext) => boolean): boolean; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵpipe: _angular_core.ɵɵPipeDeclaration; } declare class ThyTreeModule { static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵmod: _angular_core.ɵɵNgModuleDeclaration; static ɵinj: _angular_core.ɵɵInjectorDeclaration; } export { ThyTree, ThyTreeDropPosition, ThyTreeIcons, ThyTreeModule, ThyTreeNode, ThyTreeNodeCheckState, ThyTreeNodeComponent, ThyTreeService }; export type { IThyTreeService, ThyClickBehavior, ThyTreeBeforeDragDropContext, ThyTreeBeforeDragStartContext, ThyTreeDragDropEvent, ThyTreeEmitEvent, ThyTreeFormatEmitEvent, ThyTreeNodeData };