From 66075e196d472dcf8f08d84ef5940e39968ad5b8 Mon Sep 17 00:00:00 2001 From: muhammedaltug Date: Thu, 8 Dec 2022 17:09:20 +0300 Subject: [PATCH] export TreeNode Class add nzExpandChange output --- .../components/tree/src/lib/components/tree.component.ts | 2 ++ .../packages/components/tree/src/lib/utils/nz-tree-adapter.ts | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/npm/ng-packs/packages/components/tree/src/lib/components/tree.component.ts b/npm/ng-packs/packages/components/tree/src/lib/components/tree.component.ts index c61b9c3f228..f18c8e29f26 100644 --- a/npm/ng-packs/packages/components/tree/src/lib/components/tree.component.ts +++ b/npm/ng-packs/packages/components/tree/src/lib/components/tree.component.ts @@ -36,6 +36,7 @@ export class TreeComponent { @Output() readonly expandedKeysChange = new EventEmitter(); @Output() readonly selectedNodeChange = new EventEmitter(); @Output() readonly dropOver = new EventEmitter(); + @Output() readonly nzExpandChange = new EventEmitter(); @Input() noAnimation = true; @Input() draggable: boolean; @Input() checkable: boolean; @@ -71,6 +72,7 @@ export class TreeComponent { onExpandedKeysChange(event) { this.expandedKeys = [...event.keys]; this.expandedKeysChange.emit(event.keys); + this.nzExpandChange.emit(event); } onDrop(event: DropEvent) { diff --git a/npm/ng-packs/packages/components/tree/src/lib/utils/nz-tree-adapter.ts b/npm/ng-packs/packages/components/tree/src/lib/utils/nz-tree-adapter.ts index d5d32f01466..0130b2f2c0b 100644 --- a/npm/ng-packs/packages/components/tree/src/lib/utils/nz-tree-adapter.ts +++ b/npm/ng-packs/packages/components/tree/src/lib/utils/nz-tree-adapter.ts @@ -5,7 +5,7 @@ export abstract class BaseNode { constructor(public id: string, public parentId: string | null) {} } -class TreeNode extends BaseNode { +export class TreeNode extends BaseNode { title: string | undefined; key: string; icon: string | null = null; @@ -89,7 +89,6 @@ function createTreeFromList(list: T[]): TreeNode[] { tree.push(node); } }); - return tree; }