ng-zorro-antd-tree.mjs 84 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756
  1. import * as i0 from '@angular/core';
  2. import { numberAttribute, Input, ChangeDetectionStrategy, Component, booleanAttribute, EventEmitter, inject, Output, Injectable, forwardRef, ViewChild, ContentChild, NgModule } from '@angular/core';
  3. import * as i2 from 'ng-zorro-antd/core/outlet';
  4. import { NzOutletModule } from 'ng-zorro-antd/core/outlet';
  5. import * as i1 from 'ng-zorro-antd/icon';
  6. import { NzIconModule } from 'ng-zorro-antd/icon';
  7. import { NgTemplateOutlet } from '@angular/common';
  8. import * as i2$1 from 'ng-zorro-antd/core/highlight';
  9. import { NzHighlightModule } from 'ng-zorro-antd/core/highlight';
  10. import { Subject } from 'rxjs';
  11. import { takeUntil } from 'rxjs/operators';
  12. import { NzNoAnimationDirective } from 'ng-zorro-antd/core/no-animation';
  13. import { fromEventOutsideAngular } from 'ng-zorro-antd/core/util';
  14. import * as i1$1 from 'ng-zorro-antd/core/tree';
  15. import { NzTreeBaseService, NzTreeHigherOrderServiceToken, NzTreeBase, flattenTreeData } from 'ng-zorro-antd/core/tree';
  16. export { NzTreeNode } from 'ng-zorro-antd/core/tree';
  17. import { __esDecorate, __runInitializers } from 'tslib';
  18. import { CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf } from '@angular/cdk/scrolling';
  19. import { NG_VALUE_ACCESSOR } from '@angular/forms';
  20. import { treeCollapseMotion } from 'ng-zorro-antd/core/animation';
  21. import * as i2$2 from 'ng-zorro-antd/core/config';
  22. import { WithConfig } from 'ng-zorro-antd/core/config';
  23. import * as i3 from '@angular/cdk/bidi';
  24. /**
  25. * Use of this source code is governed by an MIT-style license that can be
  26. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  27. */
  28. class NzTreeDropIndicatorComponent {
  29. cdr;
  30. dropPosition;
  31. level = 1;
  32. direction = 'ltr';
  33. style = {};
  34. constructor(cdr) {
  35. this.cdr = cdr;
  36. }
  37. ngOnChanges(_changes) {
  38. this.renderIndicator(this.dropPosition, this.direction);
  39. }
  40. renderIndicator(dropPosition, direction = 'ltr') {
  41. const offset = 4;
  42. const startPosition = direction === 'ltr' ? 'left' : 'right';
  43. const endPosition = direction === 'ltr' ? 'right' : 'left';
  44. const style = {
  45. [startPosition]: `${offset}px`,
  46. [endPosition]: '0px'
  47. };
  48. switch (dropPosition) {
  49. case -1:
  50. style.top = `${-3}px`;
  51. break;
  52. case 1:
  53. style.bottom = `${-3}px`;
  54. break;
  55. case 0:
  56. // dropPosition === 0
  57. style.bottom = `${-3}px`;
  58. style[startPosition] = `${offset + 24}px`;
  59. break;
  60. default:
  61. style.display = 'none';
  62. break;
  63. }
  64. this.style = style;
  65. this.cdr.markForCheck();
  66. }
  67. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeDropIndicatorComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
  68. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.2.2", type: NzTreeDropIndicatorComponent, isStandalone: true, selector: "nz-tree-drop-indicator", inputs: { dropPosition: "dropPosition", level: ["level", "level", numberAttribute], direction: "direction" }, host: { properties: { "class.ant-tree-drop-indicator": "true", "style": "style" } }, exportAs: ["NzTreeDropIndicator"], usesOnChanges: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
  69. }
  70. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeDropIndicatorComponent, decorators: [{
  71. type: Component,
  72. args: [{
  73. selector: 'nz-tree-drop-indicator',
  74. exportAs: 'NzTreeDropIndicator',
  75. template: ``,
  76. changeDetection: ChangeDetectionStrategy.OnPush,
  77. preserveWhitespaces: false,
  78. host: {
  79. '[class.ant-tree-drop-indicator]': 'true',
  80. '[style]': 'style'
  81. }
  82. }]
  83. }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { dropPosition: [{
  84. type: Input
  85. }], level: [{
  86. type: Input,
  87. args: [{ transform: numberAttribute }]
  88. }], direction: [{
  89. type: Input
  90. }] } });
  91. /**
  92. * Use of this source code is governed by an MIT-style license that can be
  93. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  94. */
  95. class NzTreeIndentComponent {
  96. nzTreeLevel = 0;
  97. nzIsStart = [];
  98. nzIsEnd = [];
  99. nzSelectMode = false;
  100. listOfUnit = [];
  101. ngOnChanges(changes) {
  102. const { nzTreeLevel } = changes;
  103. if (nzTreeLevel) {
  104. this.listOfUnit = [...new Array(nzTreeLevel.currentValue || 0)];
  105. }
  106. }
  107. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeIndentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
  108. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzTreeIndentComponent, isStandalone: true, selector: "nz-tree-indent", inputs: { nzTreeLevel: "nzTreeLevel", nzIsStart: "nzIsStart", nzIsEnd: "nzIsEnd", nzSelectMode: "nzSelectMode" }, host: { properties: { "attr.aria-hidden": "true", "class.ant-tree-indent": "!nzSelectMode", "class.ant-select-tree-indent": "nzSelectMode" } }, exportAs: ["nzTreeIndent"], usesOnChanges: true, ngImport: i0, template: `
  109. @for (_ of listOfUnit; track i; let i = $index) {
  110. <span
  111. [class.ant-tree-indent-unit]="!nzSelectMode"
  112. [class.ant-select-tree-indent-unit]="nzSelectMode"
  113. [class.ant-select-tree-indent-unit-start]="nzSelectMode && nzIsStart[i]"
  114. [class.ant-tree-indent-unit-start]="!nzSelectMode && nzIsStart[i]"
  115. [class.ant-select-tree-indent-unit-end]="nzSelectMode && nzIsEnd[i]"
  116. [class.ant-tree-indent-unit-end]="!nzSelectMode && nzIsEnd[i]"
  117. ></span>
  118. }
  119. `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
  120. }
  121. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeIndentComponent, decorators: [{
  122. type: Component,
  123. args: [{
  124. selector: 'nz-tree-indent',
  125. exportAs: 'nzTreeIndent',
  126. template: `
  127. @for (_ of listOfUnit; track i; let i = $index) {
  128. <span
  129. [class.ant-tree-indent-unit]="!nzSelectMode"
  130. [class.ant-select-tree-indent-unit]="nzSelectMode"
  131. [class.ant-select-tree-indent-unit-start]="nzSelectMode && nzIsStart[i]"
  132. [class.ant-tree-indent-unit-start]="!nzSelectMode && nzIsStart[i]"
  133. [class.ant-select-tree-indent-unit-end]="nzSelectMode && nzIsEnd[i]"
  134. [class.ant-tree-indent-unit-end]="!nzSelectMode && nzIsEnd[i]"
  135. ></span>
  136. }
  137. `,
  138. changeDetection: ChangeDetectionStrategy.OnPush,
  139. preserveWhitespaces: false,
  140. host: {
  141. '[attr.aria-hidden]': 'true',
  142. '[class.ant-tree-indent]': '!nzSelectMode',
  143. '[class.ant-select-tree-indent]': 'nzSelectMode'
  144. }
  145. }]
  146. }], propDecorators: { nzTreeLevel: [{
  147. type: Input
  148. }], nzIsStart: [{
  149. type: Input
  150. }], nzIsEnd: [{
  151. type: Input
  152. }], nzSelectMode: [{
  153. type: Input
  154. }] } });
  155. /**
  156. * Use of this source code is governed by an MIT-style license that can be
  157. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  158. */
  159. class NzTreeNodeBuiltinCheckboxComponent {
  160. nzSelectMode = false;
  161. isChecked;
  162. isHalfChecked;
  163. isDisabled;
  164. isDisableCheckbox;
  165. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeNodeBuiltinCheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
  166. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.2.2", type: NzTreeNodeBuiltinCheckboxComponent, isStandalone: true, selector: "nz-tree-node-checkbox[builtin]", inputs: { nzSelectMode: "nzSelectMode", isChecked: ["isChecked", "isChecked", booleanAttribute], isHalfChecked: ["isHalfChecked", "isHalfChecked", booleanAttribute], isDisabled: ["isDisabled", "isDisabled", booleanAttribute], isDisableCheckbox: ["isDisableCheckbox", "isDisableCheckbox", booleanAttribute] }, host: { properties: { "class.ant-select-tree-checkbox": "nzSelectMode", "class.ant-select-tree-checkbox-checked": "nzSelectMode && isChecked", "class.ant-select-tree-checkbox-indeterminate": "nzSelectMode && isHalfChecked", "class.ant-select-tree-checkbox-disabled": "nzSelectMode && (isDisabled || isDisableCheckbox)", "class.ant-tree-checkbox": "!nzSelectMode", "class.ant-tree-checkbox-checked": "!nzSelectMode && isChecked", "class.ant-tree-checkbox-indeterminate": "!nzSelectMode && isHalfChecked", "class.ant-tree-checkbox-disabled": "!nzSelectMode && (isDisabled || isDisableCheckbox)" } }, ngImport: i0, template: `
  167. <span [class.ant-tree-checkbox-inner]="!nzSelectMode" [class.ant-select-tree-checkbox-inner]="nzSelectMode"></span>
  168. `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
  169. }
  170. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeNodeBuiltinCheckboxComponent, decorators: [{
  171. type: Component,
  172. args: [{
  173. selector: 'nz-tree-node-checkbox[builtin]',
  174. template: `
  175. <span [class.ant-tree-checkbox-inner]="!nzSelectMode" [class.ant-select-tree-checkbox-inner]="nzSelectMode"></span>
  176. `,
  177. changeDetection: ChangeDetectionStrategy.OnPush,
  178. preserveWhitespaces: false,
  179. host: {
  180. '[class.ant-select-tree-checkbox]': `nzSelectMode`,
  181. '[class.ant-select-tree-checkbox-checked]': `nzSelectMode && isChecked`,
  182. '[class.ant-select-tree-checkbox-indeterminate]': `nzSelectMode && isHalfChecked`,
  183. '[class.ant-select-tree-checkbox-disabled]': `nzSelectMode && (isDisabled || isDisableCheckbox)`,
  184. '[class.ant-tree-checkbox]': `!nzSelectMode`,
  185. '[class.ant-tree-checkbox-checked]': `!nzSelectMode && isChecked`,
  186. '[class.ant-tree-checkbox-indeterminate]': `!nzSelectMode && isHalfChecked`,
  187. '[class.ant-tree-checkbox-disabled]': `!nzSelectMode && (isDisabled || isDisableCheckbox)`
  188. }
  189. }]
  190. }], propDecorators: { nzSelectMode: [{
  191. type: Input
  192. }], isChecked: [{
  193. type: Input,
  194. args: [{ transform: booleanAttribute }]
  195. }], isHalfChecked: [{
  196. type: Input,
  197. args: [{ transform: booleanAttribute }]
  198. }], isDisabled: [{
  199. type: Input,
  200. args: [{ transform: booleanAttribute }]
  201. }], isDisableCheckbox: [{
  202. type: Input,
  203. args: [{ transform: booleanAttribute }]
  204. }] } });
  205. /**
  206. * Use of this source code is governed by an MIT-style license that can be
  207. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  208. */
  209. class NzTreeNodeSwitcherComponent {
  210. nzShowExpand;
  211. nzShowLine;
  212. nzExpandedIcon;
  213. nzSelectMode = false;
  214. context;
  215. isLeaf;
  216. isLoading;
  217. isExpanded;
  218. get isShowLineIcon() {
  219. return !this.isLeaf && !!this.nzShowLine;
  220. }
  221. get isShowSwitchIcon() {
  222. return !this.isLeaf && !this.nzShowLine;
  223. }
  224. get isSwitcherOpen() {
  225. return !!this.isExpanded && !this.isLeaf;
  226. }
  227. get isSwitcherClose() {
  228. return !this.isExpanded && !this.isLeaf;
  229. }
  230. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeNodeSwitcherComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
  231. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzTreeNodeSwitcherComponent, isStandalone: true, selector: "nz-tree-node-switcher", inputs: { nzShowExpand: ["nzShowExpand", "nzShowExpand", booleanAttribute], nzShowLine: ["nzShowLine", "nzShowLine", booleanAttribute], nzExpandedIcon: "nzExpandedIcon", nzSelectMode: "nzSelectMode", context: "context", isLeaf: ["isLeaf", "isLeaf", booleanAttribute], isLoading: ["isLoading", "isLoading", booleanAttribute], isExpanded: ["isExpanded", "isExpanded", booleanAttribute] }, host: { properties: { "class.ant-select-tree-switcher": "nzSelectMode", "class.ant-select-tree-switcher-noop": "nzSelectMode && isLeaf", "class.ant-select-tree-switcher_open": "nzSelectMode && isSwitcherOpen", "class.ant-select-tree-switcher_close": "nzSelectMode && isSwitcherClose", "class.ant-tree-switcher": "!nzSelectMode", "class.ant-tree-switcher-noop": "!nzSelectMode && isLeaf", "class.ant-tree-switcher_open": "!nzSelectMode && isSwitcherOpen", "class.ant-tree-switcher_close": "!nzSelectMode && isSwitcherClose" } }, ngImport: i0, template: `
  232. @if (isShowSwitchIcon) {
  233. @if (!isLoading) {
  234. <ng-container *nzStringTemplateOutlet="nzExpandedIcon; context: { $implicit: context, origin: context.origin }">
  235. <nz-icon
  236. nzType="caret-down"
  237. [class.ant-select-tree-switcher-icon]="nzSelectMode"
  238. [class.ant-tree-switcher-icon]="!nzSelectMode"
  239. />
  240. </ng-container>
  241. } @else {
  242. <nz-icon nzType="loading" [nzSpin]="true" class="ant-tree-switcher-loading-icon" />
  243. }
  244. }
  245. @if (nzShowLine) {
  246. @if (!isLoading) {
  247. <ng-container *nzStringTemplateOutlet="nzExpandedIcon; context: { $implicit: context, origin: context.origin }">
  248. @if (isShowLineIcon) {
  249. <nz-icon [nzType]="isSwitcherOpen ? 'minus-square' : 'plus-square'" class="ant-tree-switcher-line-icon" />
  250. } @else {
  251. <nz-icon nzType="file" class="ant-tree-switcher-line-icon" />
  252. }
  253. </ng-container>
  254. } @else {
  255. <nz-icon nzType="loading" [nzSpin]="true" class="ant-tree-switcher-loading-icon" />
  256. }
  257. }
  258. `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i1.NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "ngmodule", type: NzOutletModule }, { kind: "directive", type: i2.NzStringTemplateOutletDirective, selector: "[nzStringTemplateOutlet]", inputs: ["nzStringTemplateOutletContext", "nzStringTemplateOutlet"], exportAs: ["nzStringTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
  259. }
  260. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeNodeSwitcherComponent, decorators: [{
  261. type: Component,
  262. args: [{
  263. selector: 'nz-tree-node-switcher',
  264. template: `
  265. @if (isShowSwitchIcon) {
  266. @if (!isLoading) {
  267. <ng-container *nzStringTemplateOutlet="nzExpandedIcon; context: { $implicit: context, origin: context.origin }">
  268. <nz-icon
  269. nzType="caret-down"
  270. [class.ant-select-tree-switcher-icon]="nzSelectMode"
  271. [class.ant-tree-switcher-icon]="!nzSelectMode"
  272. />
  273. </ng-container>
  274. } @else {
  275. <nz-icon nzType="loading" [nzSpin]="true" class="ant-tree-switcher-loading-icon" />
  276. }
  277. }
  278. @if (nzShowLine) {
  279. @if (!isLoading) {
  280. <ng-container *nzStringTemplateOutlet="nzExpandedIcon; context: { $implicit: context, origin: context.origin }">
  281. @if (isShowLineIcon) {
  282. <nz-icon [nzType]="isSwitcherOpen ? 'minus-square' : 'plus-square'" class="ant-tree-switcher-line-icon" />
  283. } @else {
  284. <nz-icon nzType="file" class="ant-tree-switcher-line-icon" />
  285. }
  286. </ng-container>
  287. } @else {
  288. <nz-icon nzType="loading" [nzSpin]="true" class="ant-tree-switcher-loading-icon" />
  289. }
  290. }
  291. `,
  292. changeDetection: ChangeDetectionStrategy.OnPush,
  293. preserveWhitespaces: false,
  294. host: {
  295. '[class.ant-select-tree-switcher]': 'nzSelectMode',
  296. '[class.ant-select-tree-switcher-noop]': 'nzSelectMode && isLeaf',
  297. '[class.ant-select-tree-switcher_open]': 'nzSelectMode && isSwitcherOpen',
  298. '[class.ant-select-tree-switcher_close]': 'nzSelectMode && isSwitcherClose',
  299. '[class.ant-tree-switcher]': '!nzSelectMode',
  300. '[class.ant-tree-switcher-noop]': '!nzSelectMode && isLeaf',
  301. '[class.ant-tree-switcher_open]': '!nzSelectMode && isSwitcherOpen',
  302. '[class.ant-tree-switcher_close]': '!nzSelectMode && isSwitcherClose'
  303. },
  304. imports: [NzIconModule, NzOutletModule]
  305. }]
  306. }], propDecorators: { nzShowExpand: [{
  307. type: Input,
  308. args: [{ transform: booleanAttribute }]
  309. }], nzShowLine: [{
  310. type: Input,
  311. args: [{ transform: booleanAttribute }]
  312. }], nzExpandedIcon: [{
  313. type: Input
  314. }], nzSelectMode: [{
  315. type: Input
  316. }], context: [{
  317. type: Input
  318. }], isLeaf: [{
  319. type: Input,
  320. args: [{ transform: booleanAttribute }]
  321. }], isLoading: [{
  322. type: Input,
  323. args: [{ transform: booleanAttribute }]
  324. }], isExpanded: [{
  325. type: Input,
  326. args: [{ transform: booleanAttribute }]
  327. }] } });
  328. /**
  329. * Use of this source code is governed by an MIT-style license that can be
  330. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  331. */
  332. class NzTreeNodeTitleComponent {
  333. cdr;
  334. searchValue;
  335. treeTemplate = null;
  336. draggable;
  337. showIcon;
  338. selectMode = false;
  339. context;
  340. icon;
  341. title;
  342. isLoading;
  343. isSelected;
  344. isDisabled;
  345. isMatched;
  346. isExpanded;
  347. isLeaf;
  348. // Drag indicator
  349. showIndicator = true;
  350. dragPosition;
  351. get canDraggable() {
  352. return this.draggable && !this.isDisabled ? true : null;
  353. }
  354. get matchedValue() {
  355. return this.isMatched ? this.searchValue : '';
  356. }
  357. get isSwitcherOpen() {
  358. return this.isExpanded && !this.isLeaf;
  359. }
  360. get isSwitcherClose() {
  361. return !this.isExpanded && !this.isLeaf;
  362. }
  363. constructor(cdr) {
  364. this.cdr = cdr;
  365. }
  366. ngOnChanges(changes) {
  367. const { showIndicator, dragPosition } = changes;
  368. if (showIndicator || dragPosition) {
  369. this.cdr.markForCheck();
  370. }
  371. }
  372. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeNodeTitleComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
  373. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzTreeNodeTitleComponent, isStandalone: true, selector: "nz-tree-node-title", inputs: { searchValue: "searchValue", treeTemplate: "treeTemplate", draggable: ["draggable", "draggable", booleanAttribute], showIcon: ["showIcon", "showIcon", booleanAttribute], selectMode: "selectMode", context: "context", icon: "icon", title: "title", isLoading: ["isLoading", "isLoading", booleanAttribute], isSelected: ["isSelected", "isSelected", booleanAttribute], isDisabled: ["isDisabled", "isDisabled", booleanAttribute], isMatched: ["isMatched", "isMatched", booleanAttribute], isExpanded: ["isExpanded", "isExpanded", booleanAttribute], isLeaf: ["isLeaf", "isLeaf", booleanAttribute], showIndicator: "showIndicator", dragPosition: "dragPosition" }, host: { properties: { "attr.title": "title", "attr.draggable": "canDraggable", "attr.aria-grabbed": "canDraggable", "class.draggable": "canDraggable", "class.ant-select-tree-node-content-wrapper": "selectMode", "class.ant-select-tree-node-content-wrapper-open": "selectMode && isSwitcherOpen", "class.ant-select-tree-node-content-wrapper-close": "selectMode && isSwitcherClose", "class.ant-select-tree-node-selected": "selectMode && isSelected", "class.ant-tree-node-content-wrapper": "!selectMode", "class.ant-tree-node-content-wrapper-open": "!selectMode && isSwitcherOpen", "class.ant-tree-node-content-wrapper-close": "!selectMode && isSwitcherClose", "class.ant-tree-node-selected": "!selectMode && isSelected" } }, usesOnChanges: true, ngImport: i0, template: `
  374. <ng-template
  375. [ngTemplateOutlet]="treeTemplate"
  376. [ngTemplateOutletContext]="{ $implicit: context, origin: context.origin }"
  377. ></ng-template>
  378. @if (!treeTemplate) {
  379. @if (icon && showIcon) {
  380. <span
  381. [class.ant-tree-icon__open]="isSwitcherOpen"
  382. [class.ant-tree-icon__close]="isSwitcherClose"
  383. [class.ant-tree-icon_loading]="isLoading"
  384. [class.ant-select-tree-iconEle]="selectMode"
  385. [class.ant-tree-iconEle]="!selectMode"
  386. >
  387. <span
  388. [class.ant-select-tree-iconEle]="selectMode"
  389. [class.ant-select-tree-icon__customize]="selectMode"
  390. [class.ant-tree-iconEle]="!selectMode"
  391. [class.ant-tree-icon__customize]="!selectMode"
  392. >
  393. <nz-icon [nzType]="icon" />
  394. </span>
  395. </span>
  396. }
  397. <span class="ant-tree-title" [innerHTML]="title | nzHighlight: matchedValue : 'i' : 'font-highlight'"></span>
  398. }
  399. @if (showIndicator) {
  400. <nz-tree-drop-indicator [dropPosition]="dragPosition" [level]="context.level"></nz-tree-drop-indicator>
  401. }
  402. `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i1.NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "ngmodule", type: NzHighlightModule }, { kind: "pipe", type: i2$1.NzHighlightPipe, name: "nzHighlight" }, { kind: "component", type: NzTreeDropIndicatorComponent, selector: "nz-tree-drop-indicator", inputs: ["dropPosition", "level", "direction"], exportAs: ["NzTreeDropIndicator"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
  403. }
  404. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeNodeTitleComponent, decorators: [{
  405. type: Component,
  406. args: [{
  407. selector: 'nz-tree-node-title',
  408. template: `
  409. <ng-template
  410. [ngTemplateOutlet]="treeTemplate"
  411. [ngTemplateOutletContext]="{ $implicit: context, origin: context.origin }"
  412. ></ng-template>
  413. @if (!treeTemplate) {
  414. @if (icon && showIcon) {
  415. <span
  416. [class.ant-tree-icon__open]="isSwitcherOpen"
  417. [class.ant-tree-icon__close]="isSwitcherClose"
  418. [class.ant-tree-icon_loading]="isLoading"
  419. [class.ant-select-tree-iconEle]="selectMode"
  420. [class.ant-tree-iconEle]="!selectMode"
  421. >
  422. <span
  423. [class.ant-select-tree-iconEle]="selectMode"
  424. [class.ant-select-tree-icon__customize]="selectMode"
  425. [class.ant-tree-iconEle]="!selectMode"
  426. [class.ant-tree-icon__customize]="!selectMode"
  427. >
  428. <nz-icon [nzType]="icon" />
  429. </span>
  430. </span>
  431. }
  432. <span class="ant-tree-title" [innerHTML]="title | nzHighlight: matchedValue : 'i' : 'font-highlight'"></span>
  433. }
  434. @if (showIndicator) {
  435. <nz-tree-drop-indicator [dropPosition]="dragPosition" [level]="context.level"></nz-tree-drop-indicator>
  436. }
  437. `,
  438. changeDetection: ChangeDetectionStrategy.OnPush,
  439. preserveWhitespaces: false,
  440. host: {
  441. '[attr.title]': 'title',
  442. '[attr.draggable]': 'canDraggable',
  443. '[attr.aria-grabbed]': 'canDraggable',
  444. '[class.draggable]': 'canDraggable',
  445. '[class.ant-select-tree-node-content-wrapper]': `selectMode`,
  446. '[class.ant-select-tree-node-content-wrapper-open]': `selectMode && isSwitcherOpen`,
  447. '[class.ant-select-tree-node-content-wrapper-close]': `selectMode && isSwitcherClose`,
  448. '[class.ant-select-tree-node-selected]': `selectMode && isSelected`,
  449. '[class.ant-tree-node-content-wrapper]': `!selectMode`,
  450. '[class.ant-tree-node-content-wrapper-open]': `!selectMode && isSwitcherOpen`,
  451. '[class.ant-tree-node-content-wrapper-close]': `!selectMode && isSwitcherClose`,
  452. '[class.ant-tree-node-selected]': `!selectMode && isSelected`
  453. },
  454. imports: [NgTemplateOutlet, NzIconModule, NzHighlightModule, NzTreeDropIndicatorComponent]
  455. }]
  456. }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { searchValue: [{
  457. type: Input
  458. }], treeTemplate: [{
  459. type: Input
  460. }], draggable: [{
  461. type: Input,
  462. args: [{ transform: booleanAttribute }]
  463. }], showIcon: [{
  464. type: Input,
  465. args: [{ transform: booleanAttribute }]
  466. }], selectMode: [{
  467. type: Input
  468. }], context: [{
  469. type: Input
  470. }], icon: [{
  471. type: Input
  472. }], title: [{
  473. type: Input
  474. }], isLoading: [{
  475. type: Input,
  476. args: [{ transform: booleanAttribute }]
  477. }], isSelected: [{
  478. type: Input,
  479. args: [{ transform: booleanAttribute }]
  480. }], isDisabled: [{
  481. type: Input,
  482. args: [{ transform: booleanAttribute }]
  483. }], isMatched: [{
  484. type: Input,
  485. args: [{ transform: booleanAttribute }]
  486. }], isExpanded: [{
  487. type: Input,
  488. args: [{ transform: booleanAttribute }]
  489. }], isLeaf: [{
  490. type: Input,
  491. args: [{ transform: booleanAttribute }]
  492. }], showIndicator: [{
  493. type: Input
  494. }], dragPosition: [{
  495. type: Input
  496. }] } });
  497. /**
  498. * Use of this source code is governed by an MIT-style license that can be
  499. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  500. */
  501. class NzTreeNodeBuiltinComponent {
  502. nzTreeService;
  503. ngZone;
  504. renderer;
  505. elementRef;
  506. cdr;
  507. /**
  508. * for global property
  509. */
  510. icon = '';
  511. title = '';
  512. isLoading = false;
  513. isSelected = false;
  514. isDisabled = false;
  515. isMatched = false;
  516. isExpanded;
  517. isLeaf;
  518. isChecked;
  519. isHalfChecked;
  520. isDisableCheckbox;
  521. isSelectable;
  522. canHide;
  523. isStart = [];
  524. isEnd = [];
  525. nzTreeNode;
  526. nzShowLine;
  527. nzShowExpand;
  528. nzCheckable;
  529. nzAsyncData;
  530. nzHideUnMatched = false;
  531. nzNoAnimation = false;
  532. nzSelectMode = false;
  533. nzShowIcon = false;
  534. nzExpandedIcon;
  535. nzTreeTemplate = null;
  536. nzBeforeDrop;
  537. nzSearchValue = '';
  538. nzDraggable = false;
  539. nzClick = new EventEmitter();
  540. nzDblClick = new EventEmitter();
  541. nzContextMenu = new EventEmitter();
  542. nzCheckboxChange = new EventEmitter();
  543. nzExpandChange = new EventEmitter();
  544. nzOnDragStart = new EventEmitter();
  545. nzOnDragEnter = new EventEmitter();
  546. nzOnDragOver = new EventEmitter();
  547. nzOnDragLeave = new EventEmitter();
  548. nzOnDrop = new EventEmitter();
  549. nzOnDragEnd = new EventEmitter();
  550. /**
  551. * drag var
  552. */
  553. destroy$ = new Subject();
  554. dragPos = 2;
  555. dragPosClass = {
  556. 0: 'drag-over',
  557. 1: 'drag-over-gap-bottom',
  558. '-1': 'drag-over-gap-top'
  559. };
  560. draggingKey = null;
  561. showIndicator = false;
  562. /**
  563. * default set
  564. */
  565. get displayStyle() {
  566. // to hide unmatched nodes
  567. return this.nzSearchValue && this.nzHideUnMatched && !this.isMatched && !this.isExpanded && this.canHide
  568. ? 'none'
  569. : '';
  570. }
  571. get isSwitcherOpen() {
  572. return this.isExpanded && !this.isLeaf;
  573. }
  574. get isSwitcherClose() {
  575. return !this.isExpanded && !this.isLeaf;
  576. }
  577. /**
  578. * collapse node
  579. *
  580. * @param event
  581. */
  582. clickExpand(event) {
  583. event.preventDefault();
  584. if (!this.isLoading && !this.isLeaf) {
  585. // set async state
  586. if (this.nzAsyncData && this.nzTreeNode.children.length === 0 && !this.isExpanded) {
  587. this.nzTreeNode.isLoading = true;
  588. }
  589. this.nzTreeNode.setExpanded(!this.isExpanded);
  590. }
  591. this.nzTreeService.setExpandedNodeList(this.nzTreeNode);
  592. const eventNext = this.nzTreeService.formatEvent('expand', this.nzTreeNode, event);
  593. this.nzExpandChange.emit(eventNext);
  594. }
  595. clickSelect(event) {
  596. event.preventDefault();
  597. if (this.isSelectable && !this.isDisabled) {
  598. this.nzTreeNode.isSelected = !this.nzTreeNode.isSelected;
  599. }
  600. this.nzTreeService.setSelectedNodeList(this.nzTreeNode);
  601. const eventNext = this.nzTreeService.formatEvent('click', this.nzTreeNode, event);
  602. this.nzClick.emit(eventNext);
  603. }
  604. dblClick(event) {
  605. event.preventDefault();
  606. const eventNext = this.nzTreeService.formatEvent('dblclick', this.nzTreeNode, event);
  607. this.nzDblClick.emit(eventNext);
  608. }
  609. contextMenu(event) {
  610. event.preventDefault();
  611. const eventNext = this.nzTreeService.formatEvent('contextmenu', this.nzTreeNode, event);
  612. this.nzContextMenu.emit(eventNext);
  613. }
  614. /**
  615. * check node
  616. *
  617. * @param event
  618. */
  619. clickCheckbox(event) {
  620. event.preventDefault();
  621. // return if node is disabled
  622. if (this.isDisabled || this.isDisableCheckbox) {
  623. return;
  624. }
  625. this.nzTreeNode.isChecked = !this.nzTreeNode.isChecked;
  626. this.nzTreeNode.isHalfChecked = false;
  627. this.nzTreeService.setCheckedNodeList(this.nzTreeNode);
  628. const eventNext = this.nzTreeService.formatEvent('check', this.nzTreeNode, event);
  629. this.nzCheckboxChange.emit(eventNext);
  630. }
  631. clearDragClass() {
  632. const dragClass = ['drag-over-gap-top', 'drag-over-gap-bottom', 'drag-over', 'drop-target'];
  633. dragClass.forEach(e => {
  634. this.renderer.removeClass(this.elementRef.nativeElement, e);
  635. });
  636. }
  637. /**
  638. * drag event
  639. *
  640. * @param e
  641. */
  642. handleDragStart(e) {
  643. try {
  644. // ie throw error
  645. // firefox-need-it
  646. e.dataTransfer.setData('text/plain', this.nzTreeNode.key);
  647. }
  648. catch {
  649. // noop
  650. }
  651. this.nzTreeService.setSelectedNode(this.nzTreeNode);
  652. this.draggingKey = this.nzTreeNode.key;
  653. const eventNext = this.nzTreeService.formatEvent('dragstart', this.nzTreeNode, e);
  654. this.nzOnDragStart.emit(eventNext);
  655. }
  656. handleDragEnter(e) {
  657. e.preventDefault();
  658. // reset position
  659. this.showIndicator = this.nzTreeNode.key !== this.nzTreeService.getSelectedNode()?.key;
  660. this.renderIndicator(2);
  661. this.ngZone.run(() => {
  662. const eventNext = this.nzTreeService.formatEvent('dragenter', this.nzTreeNode, e);
  663. this.nzOnDragEnter.emit(eventNext);
  664. });
  665. }
  666. handleDragOver(e) {
  667. e.preventDefault();
  668. const dropPosition = this.nzTreeService.calcDropPosition(e);
  669. if (this.dragPos !== dropPosition) {
  670. this.clearDragClass();
  671. this.renderIndicator(dropPosition);
  672. // leaf node will pass
  673. if (!(this.dragPos === 0 && this.isLeaf)) {
  674. this.renderer.addClass(this.elementRef.nativeElement, this.dragPosClass[this.dragPos]);
  675. this.renderer.addClass(this.elementRef.nativeElement, 'drop-target');
  676. }
  677. }
  678. const eventNext = this.nzTreeService.formatEvent('dragover', this.nzTreeNode, e);
  679. this.nzOnDragOver.emit(eventNext);
  680. }
  681. handleDragLeave(e) {
  682. e.preventDefault();
  683. this.renderIndicator(2);
  684. this.clearDragClass();
  685. const eventNext = this.nzTreeService.formatEvent('dragleave', this.nzTreeNode, e);
  686. this.nzOnDragLeave.emit(eventNext);
  687. }
  688. handleDragDrop(e) {
  689. e.preventDefault();
  690. e.stopPropagation();
  691. this.ngZone.run(() => {
  692. this.showIndicator = false;
  693. this.clearDragClass();
  694. const node = this.nzTreeService.getSelectedNode();
  695. if (!node || (node && node.key === this.nzTreeNode.key) || (this.dragPos === 0 && this.isLeaf)) {
  696. return;
  697. }
  698. // pass if node is leafNo
  699. const dropEvent = this.nzTreeService.formatEvent('drop', this.nzTreeNode, e);
  700. const dragEndEvent = this.nzTreeService.formatEvent('dragend', this.nzTreeNode, e);
  701. if (this.nzBeforeDrop) {
  702. this.nzBeforeDrop({
  703. dragNode: this.nzTreeService.getSelectedNode(),
  704. node: this.nzTreeNode,
  705. pos: this.dragPos
  706. }).subscribe((canDrop) => {
  707. if (canDrop) {
  708. this.nzTreeService.dropAndApply(this.nzTreeNode, this.dragPos);
  709. }
  710. this.nzOnDrop.emit(dropEvent);
  711. this.nzOnDragEnd.emit(dragEndEvent);
  712. });
  713. }
  714. else if (this.nzTreeNode) {
  715. this.nzTreeService.dropAndApply(this.nzTreeNode, this.dragPos);
  716. this.nzOnDrop.emit(dropEvent);
  717. }
  718. });
  719. }
  720. handleDragEnd(e) {
  721. e.preventDefault();
  722. this.ngZone.run(() => {
  723. // if user do not custom beforeDrop
  724. if (!this.nzBeforeDrop) {
  725. // clear dragging state
  726. this.draggingKey = null;
  727. const eventNext = this.nzTreeService.formatEvent('dragend', this.nzTreeNode, e);
  728. this.nzOnDragEnd.emit(eventNext);
  729. }
  730. else {
  731. // clear dragging state
  732. this.draggingKey = null;
  733. this.markForCheck();
  734. }
  735. });
  736. }
  737. /**
  738. * Listening to dragging events.
  739. */
  740. handDragEvent() {
  741. if (this.nzDraggable) {
  742. const nativeElement = this.elementRef.nativeElement;
  743. this.destroy$ = new Subject();
  744. fromEventOutsideAngular(nativeElement, 'dragstart')
  745. .pipe(takeUntil(this.destroy$))
  746. .subscribe((e) => this.handleDragStart(e));
  747. fromEventOutsideAngular(nativeElement, 'dragenter')
  748. .pipe(takeUntil(this.destroy$))
  749. .subscribe((e) => this.handleDragEnter(e));
  750. fromEventOutsideAngular(nativeElement, 'dragover')
  751. .pipe(takeUntil(this.destroy$))
  752. .subscribe((e) => this.handleDragOver(e));
  753. fromEventOutsideAngular(nativeElement, 'dragleave')
  754. .pipe(takeUntil(this.destroy$))
  755. .subscribe((e) => this.handleDragLeave(e));
  756. fromEventOutsideAngular(nativeElement, 'drop')
  757. .pipe(takeUntil(this.destroy$))
  758. .subscribe((e) => this.handleDragDrop(e));
  759. fromEventOutsideAngular(nativeElement, 'dragend')
  760. .pipe(takeUntil(this.destroy$))
  761. .subscribe((e) => this.handleDragEnd(e));
  762. }
  763. else {
  764. this.destroy$.next(true);
  765. this.destroy$.complete();
  766. }
  767. }
  768. markForCheck() {
  769. this.cdr.markForCheck();
  770. }
  771. noAnimation = inject(NzNoAnimationDirective, { host: true, optional: true });
  772. constructor(nzTreeService, ngZone, renderer, elementRef, cdr) {
  773. this.nzTreeService = nzTreeService;
  774. this.ngZone = ngZone;
  775. this.renderer = renderer;
  776. this.elementRef = elementRef;
  777. this.cdr = cdr;
  778. }
  779. ngOnInit() {
  780. this.nzTreeNode.component = this;
  781. fromEventOutsideAngular(this.elementRef.nativeElement, 'mousedown')
  782. .pipe(takeUntil(this.destroy$))
  783. .subscribe(event => {
  784. if (this.nzSelectMode) {
  785. event.preventDefault();
  786. }
  787. });
  788. }
  789. ngOnChanges(changes) {
  790. const { nzDraggable } = changes;
  791. if (nzDraggable) {
  792. this.handDragEvent();
  793. }
  794. }
  795. ngOnDestroy() {
  796. this.destroy$.next(true);
  797. this.destroy$.complete();
  798. }
  799. renderIndicator(dropPosition) {
  800. this.ngZone.run(() => {
  801. this.showIndicator = dropPosition !== 2;
  802. if (this.nzTreeNode.key === this.nzTreeService.getSelectedNode()?.key || (dropPosition === 0 && this.isLeaf)) {
  803. return;
  804. }
  805. this.dragPos = dropPosition;
  806. this.cdr.markForCheck();
  807. });
  808. }
  809. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeNodeBuiltinComponent, deps: [{ token: i1$1.NzTreeBaseService }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
  810. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzTreeNodeBuiltinComponent, isStandalone: true, selector: "nz-tree-node[builtin]", inputs: { icon: "icon", title: "title", isLoading: ["isLoading", "isLoading", booleanAttribute], isSelected: ["isSelected", "isSelected", booleanAttribute], isDisabled: ["isDisabled", "isDisabled", booleanAttribute], isMatched: ["isMatched", "isMatched", booleanAttribute], isExpanded: ["isExpanded", "isExpanded", booleanAttribute], isLeaf: ["isLeaf", "isLeaf", booleanAttribute], isChecked: ["isChecked", "isChecked", booleanAttribute], isHalfChecked: ["isHalfChecked", "isHalfChecked", booleanAttribute], isDisableCheckbox: ["isDisableCheckbox", "isDisableCheckbox", booleanAttribute], isSelectable: ["isSelectable", "isSelectable", booleanAttribute], canHide: ["canHide", "canHide", booleanAttribute], isStart: "isStart", isEnd: "isEnd", nzTreeNode: "nzTreeNode", nzShowLine: ["nzShowLine", "nzShowLine", booleanAttribute], nzShowExpand: ["nzShowExpand", "nzShowExpand", booleanAttribute], nzCheckable: ["nzCheckable", "nzCheckable", booleanAttribute], nzAsyncData: ["nzAsyncData", "nzAsyncData", booleanAttribute], nzHideUnMatched: ["nzHideUnMatched", "nzHideUnMatched", booleanAttribute], nzNoAnimation: ["nzNoAnimation", "nzNoAnimation", booleanAttribute], nzSelectMode: ["nzSelectMode", "nzSelectMode", booleanAttribute], nzShowIcon: ["nzShowIcon", "nzShowIcon", booleanAttribute], nzExpandedIcon: "nzExpandedIcon", nzTreeTemplate: "nzTreeTemplate", nzBeforeDrop: "nzBeforeDrop", nzSearchValue: "nzSearchValue", nzDraggable: ["nzDraggable", "nzDraggable", booleanAttribute] }, outputs: { nzClick: "nzClick", nzDblClick: "nzDblClick", nzContextMenu: "nzContextMenu", nzCheckboxChange: "nzCheckboxChange", nzExpandChange: "nzExpandChange", nzOnDragStart: "nzOnDragStart", nzOnDragEnter: "nzOnDragEnter", nzOnDragOver: "nzOnDragOver", nzOnDragLeave: "nzOnDragLeave", nzOnDrop: "nzOnDrop", nzOnDragEnd: "nzOnDragEnd" }, host: { properties: { "class.ant-select-tree-treenode": "nzSelectMode", "class.ant-select-tree-treenode-disabled": "nzSelectMode && isDisabled", "class.ant-select-tree-treenode-switcher-open": "nzSelectMode && isSwitcherOpen", "class.ant-select-tree-treenode-switcher-close": "nzSelectMode && isSwitcherClose", "class.ant-select-tree-treenode-checkbox-checked": "nzSelectMode && isChecked", "class.ant-select-tree-treenode-checkbox-indeterminate": "nzSelectMode && isHalfChecked", "class.ant-select-tree-treenode-selected": "nzSelectMode && isSelected", "class.ant-select-tree-treenode-loading": "nzSelectMode && isLoading", "class.ant-tree-treenode": "!nzSelectMode", "class.ant-tree-treenode-disabled": "!nzSelectMode && isDisabled", "class.ant-tree-treenode-switcher-open": "!nzSelectMode && isSwitcherOpen", "class.ant-tree-treenode-switcher-close": "!nzSelectMode && isSwitcherClose", "class.ant-tree-treenode-checkbox-checked": "!nzSelectMode && isChecked", "class.ant-tree-treenode-checkbox-indeterminate": "!nzSelectMode && isHalfChecked", "class.ant-tree-treenode-selected": "!nzSelectMode && isSelected", "class.ant-tree-treenode-loading": "!nzSelectMode && isLoading", "class.dragging": "draggingKey === nzTreeNode.key", "style.display": "displayStyle" } }, exportAs: ["nzTreeBuiltinNode"], usesOnChanges: true, ngImport: i0, template: `
  811. <nz-tree-indent
  812. [nzTreeLevel]="nzTreeNode.level"
  813. [nzSelectMode]="nzSelectMode"
  814. [nzIsStart]="isStart"
  815. [nzIsEnd]="isEnd"
  816. ></nz-tree-indent>
  817. @if (nzShowExpand) {
  818. <nz-tree-node-switcher
  819. [nzShowExpand]="nzShowExpand"
  820. [nzShowLine]="nzShowLine"
  821. [nzExpandedIcon]="nzExpandedIcon"
  822. [nzSelectMode]="nzSelectMode"
  823. [context]="nzTreeNode"
  824. [isLeaf]="isLeaf"
  825. [isExpanded]="isExpanded"
  826. [isLoading]="isLoading"
  827. (click)="clickExpand($event)"
  828. ></nz-tree-node-switcher>
  829. }
  830. @if (nzCheckable) {
  831. <nz-tree-node-checkbox
  832. builtin
  833. (click)="clickCheckbox($event)"
  834. [nzSelectMode]="nzSelectMode"
  835. [isChecked]="isChecked"
  836. [isHalfChecked]="isHalfChecked"
  837. [isDisabled]="isDisabled"
  838. [isDisableCheckbox]="isDisableCheckbox"
  839. ></nz-tree-node-checkbox>
  840. }
  841. <nz-tree-node-title
  842. [icon]="icon"
  843. [title]="title"
  844. [isLoading]="isLoading"
  845. [isSelected]="isSelected"
  846. [isDisabled]="isDisabled"
  847. [isMatched]="isMatched"
  848. [isExpanded]="isExpanded"
  849. [isLeaf]="isLeaf"
  850. [searchValue]="nzSearchValue"
  851. [treeTemplate]="nzTreeTemplate"
  852. [draggable]="nzDraggable"
  853. [showIcon]="nzShowIcon"
  854. [selectMode]="nzSelectMode"
  855. [context]="nzTreeNode"
  856. [showIndicator]="showIndicator"
  857. [dragPosition]="dragPos"
  858. (dblclick)="dblClick($event)"
  859. (click)="clickSelect($event)"
  860. (contextmenu)="contextMenu($event)"
  861. ></nz-tree-node-title>
  862. `, isInline: true, dependencies: [{ kind: "component", type: NzTreeIndentComponent, selector: "nz-tree-indent", inputs: ["nzTreeLevel", "nzIsStart", "nzIsEnd", "nzSelectMode"], exportAs: ["nzTreeIndent"] }, { kind: "component", type: NzTreeNodeSwitcherComponent, selector: "nz-tree-node-switcher", inputs: ["nzShowExpand", "nzShowLine", "nzExpandedIcon", "nzSelectMode", "context", "isLeaf", "isLoading", "isExpanded"] }, { kind: "component", type: NzTreeNodeBuiltinCheckboxComponent, selector: "nz-tree-node-checkbox[builtin]", inputs: ["nzSelectMode", "isChecked", "isHalfChecked", "isDisabled", "isDisableCheckbox"] }, { kind: "component", type: NzTreeNodeTitleComponent, selector: "nz-tree-node-title", inputs: ["searchValue", "treeTemplate", "draggable", "showIcon", "selectMode", "context", "icon", "title", "isLoading", "isSelected", "isDisabled", "isMatched", "isExpanded", "isLeaf", "showIndicator", "dragPosition"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
  863. }
  864. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeNodeBuiltinComponent, decorators: [{
  865. type: Component,
  866. args: [{
  867. selector: 'nz-tree-node[builtin]',
  868. exportAs: 'nzTreeBuiltinNode',
  869. template: `
  870. <nz-tree-indent
  871. [nzTreeLevel]="nzTreeNode.level"
  872. [nzSelectMode]="nzSelectMode"
  873. [nzIsStart]="isStart"
  874. [nzIsEnd]="isEnd"
  875. ></nz-tree-indent>
  876. @if (nzShowExpand) {
  877. <nz-tree-node-switcher
  878. [nzShowExpand]="nzShowExpand"
  879. [nzShowLine]="nzShowLine"
  880. [nzExpandedIcon]="nzExpandedIcon"
  881. [nzSelectMode]="nzSelectMode"
  882. [context]="nzTreeNode"
  883. [isLeaf]="isLeaf"
  884. [isExpanded]="isExpanded"
  885. [isLoading]="isLoading"
  886. (click)="clickExpand($event)"
  887. ></nz-tree-node-switcher>
  888. }
  889. @if (nzCheckable) {
  890. <nz-tree-node-checkbox
  891. builtin
  892. (click)="clickCheckbox($event)"
  893. [nzSelectMode]="nzSelectMode"
  894. [isChecked]="isChecked"
  895. [isHalfChecked]="isHalfChecked"
  896. [isDisabled]="isDisabled"
  897. [isDisableCheckbox]="isDisableCheckbox"
  898. ></nz-tree-node-checkbox>
  899. }
  900. <nz-tree-node-title
  901. [icon]="icon"
  902. [title]="title"
  903. [isLoading]="isLoading"
  904. [isSelected]="isSelected"
  905. [isDisabled]="isDisabled"
  906. [isMatched]="isMatched"
  907. [isExpanded]="isExpanded"
  908. [isLeaf]="isLeaf"
  909. [searchValue]="nzSearchValue"
  910. [treeTemplate]="nzTreeTemplate"
  911. [draggable]="nzDraggable"
  912. [showIcon]="nzShowIcon"
  913. [selectMode]="nzSelectMode"
  914. [context]="nzTreeNode"
  915. [showIndicator]="showIndicator"
  916. [dragPosition]="dragPos"
  917. (dblclick)="dblClick($event)"
  918. (click)="clickSelect($event)"
  919. (contextmenu)="contextMenu($event)"
  920. ></nz-tree-node-title>
  921. `,
  922. changeDetection: ChangeDetectionStrategy.OnPush,
  923. preserveWhitespaces: false,
  924. host: {
  925. '[class.ant-select-tree-treenode]': `nzSelectMode`,
  926. '[class.ant-select-tree-treenode-disabled]': `nzSelectMode && isDisabled`,
  927. '[class.ant-select-tree-treenode-switcher-open]': `nzSelectMode && isSwitcherOpen`,
  928. '[class.ant-select-tree-treenode-switcher-close]': `nzSelectMode && isSwitcherClose`,
  929. '[class.ant-select-tree-treenode-checkbox-checked]': `nzSelectMode && isChecked`,
  930. '[class.ant-select-tree-treenode-checkbox-indeterminate]': `nzSelectMode && isHalfChecked`,
  931. '[class.ant-select-tree-treenode-selected]': `nzSelectMode && isSelected`,
  932. '[class.ant-select-tree-treenode-loading]': `nzSelectMode && isLoading`,
  933. '[class.ant-tree-treenode]': `!nzSelectMode`,
  934. '[class.ant-tree-treenode-disabled]': `!nzSelectMode && isDisabled`,
  935. '[class.ant-tree-treenode-switcher-open]': `!nzSelectMode && isSwitcherOpen`,
  936. '[class.ant-tree-treenode-switcher-close]': `!nzSelectMode && isSwitcherClose`,
  937. '[class.ant-tree-treenode-checkbox-checked]': `!nzSelectMode && isChecked`,
  938. '[class.ant-tree-treenode-checkbox-indeterminate]': `!nzSelectMode && isHalfChecked`,
  939. '[class.ant-tree-treenode-selected]': `!nzSelectMode && isSelected`,
  940. '[class.ant-tree-treenode-loading]': `!nzSelectMode && isLoading`,
  941. '[class.dragging]': `draggingKey === nzTreeNode.key`,
  942. '[style.display]': 'displayStyle'
  943. },
  944. imports: [
  945. NzTreeIndentComponent,
  946. NzTreeNodeSwitcherComponent,
  947. NzTreeNodeBuiltinCheckboxComponent,
  948. NzTreeNodeTitleComponent
  949. ]
  950. }]
  951. }], ctorParameters: () => [{ type: i1$1.NzTreeBaseService }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }], propDecorators: { icon: [{
  952. type: Input
  953. }], title: [{
  954. type: Input
  955. }], isLoading: [{
  956. type: Input,
  957. args: [{ transform: booleanAttribute }]
  958. }], isSelected: [{
  959. type: Input,
  960. args: [{ transform: booleanAttribute }]
  961. }], isDisabled: [{
  962. type: Input,
  963. args: [{ transform: booleanAttribute }]
  964. }], isMatched: [{
  965. type: Input,
  966. args: [{ transform: booleanAttribute }]
  967. }], isExpanded: [{
  968. type: Input,
  969. args: [{ transform: booleanAttribute }]
  970. }], isLeaf: [{
  971. type: Input,
  972. args: [{ transform: booleanAttribute }]
  973. }], isChecked: [{
  974. type: Input,
  975. args: [{ transform: booleanAttribute }]
  976. }], isHalfChecked: [{
  977. type: Input,
  978. args: [{ transform: booleanAttribute }]
  979. }], isDisableCheckbox: [{
  980. type: Input,
  981. args: [{ transform: booleanAttribute }]
  982. }], isSelectable: [{
  983. type: Input,
  984. args: [{ transform: booleanAttribute }]
  985. }], canHide: [{
  986. type: Input,
  987. args: [{ transform: booleanAttribute }]
  988. }], isStart: [{
  989. type: Input
  990. }], isEnd: [{
  991. type: Input
  992. }], nzTreeNode: [{
  993. type: Input
  994. }], nzShowLine: [{
  995. type: Input,
  996. args: [{ transform: booleanAttribute }]
  997. }], nzShowExpand: [{
  998. type: Input,
  999. args: [{ transform: booleanAttribute }]
  1000. }], nzCheckable: [{
  1001. type: Input,
  1002. args: [{ transform: booleanAttribute }]
  1003. }], nzAsyncData: [{
  1004. type: Input,
  1005. args: [{ transform: booleanAttribute }]
  1006. }], nzHideUnMatched: [{
  1007. type: Input,
  1008. args: [{ transform: booleanAttribute }]
  1009. }], nzNoAnimation: [{
  1010. type: Input,
  1011. args: [{ transform: booleanAttribute }]
  1012. }], nzSelectMode: [{
  1013. type: Input,
  1014. args: [{ transform: booleanAttribute }]
  1015. }], nzShowIcon: [{
  1016. type: Input,
  1017. args: [{ transform: booleanAttribute }]
  1018. }], nzExpandedIcon: [{
  1019. type: Input
  1020. }], nzTreeTemplate: [{
  1021. type: Input
  1022. }], nzBeforeDrop: [{
  1023. type: Input
  1024. }], nzSearchValue: [{
  1025. type: Input
  1026. }], nzDraggable: [{
  1027. type: Input,
  1028. args: [{ transform: booleanAttribute }]
  1029. }], nzClick: [{
  1030. type: Output
  1031. }], nzDblClick: [{
  1032. type: Output
  1033. }], nzContextMenu: [{
  1034. type: Output
  1035. }], nzCheckboxChange: [{
  1036. type: Output
  1037. }], nzExpandChange: [{
  1038. type: Output
  1039. }], nzOnDragStart: [{
  1040. type: Output
  1041. }], nzOnDragEnter: [{
  1042. type: Output
  1043. }], nzOnDragOver: [{
  1044. type: Output
  1045. }], nzOnDragLeave: [{
  1046. type: Output
  1047. }], nzOnDrop: [{
  1048. type: Output
  1049. }], nzOnDragEnd: [{
  1050. type: Output
  1051. }] } });
  1052. /**
  1053. * Use of this source code is governed by an MIT-style license that can be
  1054. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  1055. */
  1056. class NzTreeService extends NzTreeBaseService {
  1057. constructor() {
  1058. super();
  1059. }
  1060. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
  1061. static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeService });
  1062. }
  1063. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeService, decorators: [{
  1064. type: Injectable
  1065. }], ctorParameters: () => [] });
  1066. function NzTreeServiceFactory() {
  1067. const higherOrderService = inject(NzTreeHigherOrderServiceToken, { skipSelf: true, optional: true });
  1068. const treeService = inject(NzTreeService);
  1069. return higherOrderService ?? treeService;
  1070. }
  1071. const NZ_CONFIG_MODULE_NAME = 'tree';
  1072. let NzTreeComponent = (() => {
  1073. let _classSuper = NzTreeBase;
  1074. let _nzShowIcon_decorators;
  1075. let _nzShowIcon_initializers = [];
  1076. let _nzShowIcon_extraInitializers = [];
  1077. let _nzHideUnMatched_decorators;
  1078. let _nzHideUnMatched_initializers = [];
  1079. let _nzHideUnMatched_extraInitializers = [];
  1080. let _nzBlockNode_decorators;
  1081. let _nzBlockNode_initializers = [];
  1082. let _nzBlockNode_extraInitializers = [];
  1083. return class NzTreeComponent extends _classSuper {
  1084. static {
  1085. const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
  1086. _nzShowIcon_decorators = [WithConfig()];
  1087. _nzHideUnMatched_decorators = [WithConfig()];
  1088. _nzBlockNode_decorators = [WithConfig()];
  1089. __esDecorate(null, null, _nzShowIcon_decorators, { kind: "field", name: "nzShowIcon", static: false, private: false, access: { has: obj => "nzShowIcon" in obj, get: obj => obj.nzShowIcon, set: (obj, value) => { obj.nzShowIcon = value; } }, metadata: _metadata }, _nzShowIcon_initializers, _nzShowIcon_extraInitializers);
  1090. __esDecorate(null, null, _nzHideUnMatched_decorators, { kind: "field", name: "nzHideUnMatched", static: false, private: false, access: { has: obj => "nzHideUnMatched" in obj, get: obj => obj.nzHideUnMatched, set: (obj, value) => { obj.nzHideUnMatched = value; } }, metadata: _metadata }, _nzHideUnMatched_initializers, _nzHideUnMatched_extraInitializers);
  1091. __esDecorate(null, null, _nzBlockNode_decorators, { kind: "field", name: "nzBlockNode", static: false, private: false, access: { has: obj => "nzBlockNode" in obj, get: obj => obj.nzBlockNode, set: (obj, value) => { obj.nzBlockNode = value; } }, metadata: _metadata }, _nzBlockNode_initializers, _nzBlockNode_extraInitializers);
  1092. if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
  1093. }
  1094. nzConfigService;
  1095. cdr;
  1096. directionality;
  1097. _nzModuleName = NZ_CONFIG_MODULE_NAME;
  1098. nzShowIcon = __runInitializers(this, _nzShowIcon_initializers, false);
  1099. nzHideUnMatched = (__runInitializers(this, _nzShowIcon_extraInitializers), __runInitializers(this, _nzHideUnMatched_initializers, false));
  1100. nzBlockNode = (__runInitializers(this, _nzHideUnMatched_extraInitializers), __runInitializers(this, _nzBlockNode_initializers, false));
  1101. nzExpandAll = (__runInitializers(this, _nzBlockNode_extraInitializers), false);
  1102. nzSelectMode = false;
  1103. nzCheckStrictly = false;
  1104. nzShowExpand = true;
  1105. nzShowLine = false;
  1106. nzCheckable = false;
  1107. nzAsyncData = false;
  1108. nzDraggable = false;
  1109. nzMultiple = false;
  1110. nzExpandedIcon;
  1111. nzVirtualItemSize = 28;
  1112. nzVirtualMaxBufferPx = 500;
  1113. nzVirtualMinBufferPx = 28;
  1114. nzVirtualHeight = null;
  1115. nzTreeTemplate;
  1116. nzBeforeDrop;
  1117. nzData = [];
  1118. nzExpandedKeys = [];
  1119. nzSelectedKeys = [];
  1120. nzCheckedKeys = [];
  1121. nzSearchValue = '';
  1122. nzSearchFunc;
  1123. nzTreeTemplateChild;
  1124. cdkVirtualScrollViewport;
  1125. nzFlattenNodes = [];
  1126. beforeInit = true;
  1127. dir = 'ltr';
  1128. nzExpandedKeysChange = new EventEmitter();
  1129. nzSelectedKeysChange = new EventEmitter();
  1130. nzCheckedKeysChange = new EventEmitter();
  1131. nzSearchValueChange = new EventEmitter();
  1132. nzClick = new EventEmitter();
  1133. nzDblClick = new EventEmitter();
  1134. nzContextMenu = new EventEmitter();
  1135. nzCheckboxChange = new EventEmitter();
  1136. nzExpandChange = new EventEmitter();
  1137. nzOnDragStart = new EventEmitter();
  1138. nzOnDragEnter = new EventEmitter();
  1139. nzOnDragOver = new EventEmitter();
  1140. nzOnDragLeave = new EventEmitter();
  1141. nzOnDrop = new EventEmitter();
  1142. nzOnDragEnd = new EventEmitter();
  1143. HIDDEN_STYLE = {
  1144. width: 0,
  1145. height: 0,
  1146. display: 'flex',
  1147. overflow: 'hidden',
  1148. opacity: 0,
  1149. border: 0,
  1150. padding: 0,
  1151. margin: 0
  1152. };
  1153. HIDDEN_NODE_STYLE = {
  1154. position: 'absolute',
  1155. pointerEvents: 'none',
  1156. visibility: 'hidden',
  1157. height: 0,
  1158. overflow: 'hidden'
  1159. };
  1160. destroy$ = new Subject();
  1161. onChange = () => null;
  1162. onTouched = () => null;
  1163. writeValue(value) {
  1164. this.handleNzData(value);
  1165. }
  1166. registerOnChange(fn) {
  1167. this.onChange = fn;
  1168. }
  1169. registerOnTouched(fn) {
  1170. this.onTouched = fn;
  1171. }
  1172. /**
  1173. * Render all properties of nzTree
  1174. *
  1175. * @param changes all changes from @Input
  1176. */
  1177. renderTreeProperties(changes) {
  1178. let useDefaultExpandedKeys = false;
  1179. let expandAll = false;
  1180. const { nzData, nzExpandedKeys, nzSelectedKeys, nzCheckedKeys, nzCheckStrictly, nzExpandAll, nzMultiple, nzSearchValue } = changes;
  1181. if (nzExpandAll) {
  1182. useDefaultExpandedKeys = true;
  1183. expandAll = this.nzExpandAll;
  1184. }
  1185. if (nzMultiple) {
  1186. this.nzTreeService.isMultiple = this.nzMultiple;
  1187. }
  1188. if (nzCheckStrictly) {
  1189. this.nzTreeService.isCheckStrictly = this.nzCheckStrictly;
  1190. }
  1191. if (nzData) {
  1192. this.handleNzData(this.nzData);
  1193. }
  1194. if (nzCheckedKeys) {
  1195. this.handleCheckedKeys(this.nzCheckedKeys);
  1196. }
  1197. if (nzCheckStrictly) {
  1198. this.handleCheckedKeys(null);
  1199. }
  1200. if (nzExpandedKeys || nzExpandAll) {
  1201. useDefaultExpandedKeys = true;
  1202. this.handleExpandedKeys(expandAll || this.nzExpandedKeys);
  1203. }
  1204. if (nzSelectedKeys) {
  1205. this.handleSelectedKeys(this.nzSelectedKeys, this.nzMultiple);
  1206. }
  1207. if (nzSearchValue) {
  1208. if (!(nzSearchValue.firstChange && !this.nzSearchValue)) {
  1209. useDefaultExpandedKeys = false;
  1210. this.handleSearchValue(nzSearchValue.currentValue, this.nzSearchFunc);
  1211. this.nzSearchValueChange.emit(this.nzTreeService.formatEvent('search', null, null));
  1212. }
  1213. }
  1214. // flatten data
  1215. const currentExpandedKeys = this.getExpandedNodeList().map(v => v.key);
  1216. const newExpandedKeys = useDefaultExpandedKeys ? expandAll || this.nzExpandedKeys : currentExpandedKeys;
  1217. this.handleFlattenNodes(this.nzTreeService.rootNodes, newExpandedKeys);
  1218. }
  1219. trackByFlattenNode(_, node) {
  1220. return node.key;
  1221. }
  1222. // Deal with properties
  1223. /**
  1224. * nzData
  1225. *
  1226. * @param value
  1227. */
  1228. handleNzData(value) {
  1229. if (Array.isArray(value)) {
  1230. const data = this.coerceTreeNodes(value);
  1231. this.nzTreeService.initTree(data);
  1232. }
  1233. }
  1234. handleFlattenNodes(data, expandKeys = []) {
  1235. this.nzTreeService.flattenTreeData(data, expandKeys);
  1236. }
  1237. handleCheckedKeys(keys) {
  1238. this.nzTreeService.conductCheck(keys, this.nzCheckStrictly);
  1239. }
  1240. handleExpandedKeys(keys = []) {
  1241. this.nzTreeService.conductExpandedKeys(keys);
  1242. }
  1243. handleSelectedKeys(keys, isMulti) {
  1244. this.nzTreeService.conductSelectedKeys(keys, isMulti);
  1245. }
  1246. handleSearchValue(value, searchFunc) {
  1247. const dataList = flattenTreeData(this.nzTreeService.rootNodes, true).map(v => v.data);
  1248. const checkIfMatched = (node) => {
  1249. if (searchFunc) {
  1250. return searchFunc(node.origin);
  1251. }
  1252. return !!value && node.title.toLowerCase().includes(value.toLowerCase());
  1253. };
  1254. dataList.forEach(v => {
  1255. v.isMatched = checkIfMatched(v);
  1256. v.canHide = !v.isMatched;
  1257. if (!v.isMatched) {
  1258. v.setExpanded(false);
  1259. this.nzTreeService.setExpandedNodeList(v);
  1260. }
  1261. else {
  1262. // expand
  1263. this.nzTreeService.expandNodeAllParentBySearch(v);
  1264. }
  1265. this.nzTreeService.setMatchedNodeList(v);
  1266. });
  1267. }
  1268. /**
  1269. * Handle emit event
  1270. *
  1271. * @param event
  1272. * handle each event
  1273. */
  1274. eventTriggerChanged(event) {
  1275. const node = event.node;
  1276. switch (event.eventName) {
  1277. case 'expand':
  1278. this.renderTree();
  1279. this.nzExpandChange.emit(event);
  1280. break;
  1281. case 'click':
  1282. this.nzClick.emit(event);
  1283. break;
  1284. case 'dblclick':
  1285. this.nzDblClick.emit(event);
  1286. break;
  1287. case 'contextmenu':
  1288. this.nzContextMenu.emit(event);
  1289. break;
  1290. case 'check': {
  1291. // Render checked state with nodes' property `isChecked`
  1292. this.nzTreeService.setCheckedNodeList(node);
  1293. if (!this.nzCheckStrictly) {
  1294. this.nzTreeService.conduct(node);
  1295. }
  1296. // Cause check method will rerender list, so we need recover it and next the new event to user
  1297. const eventNext = this.nzTreeService.formatEvent('check', node, event.event);
  1298. this.nzCheckboxChange.emit(eventNext);
  1299. const checkedKeys = this.nzTreeService.getCheckedNodeKeys();
  1300. this.nzCheckedKeysChange.emit(checkedKeys);
  1301. break;
  1302. }
  1303. case 'dragstart':
  1304. // if node is expanded
  1305. if (node.isExpanded) {
  1306. node.setExpanded(!node.isExpanded);
  1307. this.renderTree();
  1308. }
  1309. this.nzOnDragStart.emit(event);
  1310. break;
  1311. case 'dragenter': {
  1312. const selectedNode = this.nzTreeService.getSelectedNode();
  1313. if (selectedNode && selectedNode.key !== node.key && !node.isExpanded && !node.isLeaf) {
  1314. node.setExpanded(true);
  1315. this.renderTree();
  1316. }
  1317. this.nzOnDragEnter.emit(event);
  1318. break;
  1319. }
  1320. case 'dragover':
  1321. this.nzOnDragOver.emit(event);
  1322. break;
  1323. case 'dragleave':
  1324. this.nzOnDragLeave.emit(event);
  1325. break;
  1326. case 'dragend':
  1327. this.nzOnDragEnd.emit(event);
  1328. break;
  1329. case 'drop':
  1330. this.renderTree();
  1331. this.nzOnDrop.emit(event);
  1332. break;
  1333. }
  1334. }
  1335. /**
  1336. * Click expand icon
  1337. */
  1338. renderTree() {
  1339. this.handleFlattenNodes(this.nzTreeService.rootNodes, this.getExpandedNodeList().map(v => v.key));
  1340. this.cdr.markForCheck();
  1341. }
  1342. // Handle emit event end
  1343. noAnimation = inject(NzNoAnimationDirective, { host: true, optional: true });
  1344. constructor(nzTreeService, nzConfigService, cdr, directionality) {
  1345. super(nzTreeService);
  1346. this.nzConfigService = nzConfigService;
  1347. this.cdr = cdr;
  1348. this.directionality = directionality;
  1349. }
  1350. ngOnInit() {
  1351. this.nzTreeService.flattenNodes$.pipe(takeUntil(this.destroy$)).subscribe(data => {
  1352. this.nzFlattenNodes =
  1353. !!this.nzVirtualHeight && this.nzHideUnMatched && this.nzSearchValue?.length > 0
  1354. ? data.filter(d => !d.canHide)
  1355. : data;
  1356. this.cdr.markForCheck();
  1357. });
  1358. this.dir = this.directionality.value;
  1359. this.directionality.change?.pipe(takeUntil(this.destroy$)).subscribe((direction) => {
  1360. this.dir = direction;
  1361. this.cdr.detectChanges();
  1362. });
  1363. }
  1364. ngOnChanges(changes) {
  1365. this.renderTreeProperties(changes);
  1366. }
  1367. ngAfterViewInit() {
  1368. this.beforeInit = false;
  1369. }
  1370. ngOnDestroy() {
  1371. this.destroy$.next(true);
  1372. this.destroy$.complete();
  1373. }
  1374. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeComponent, deps: [{ token: i1$1.NzTreeBaseService }, { token: i2$2.NzConfigService }, { token: i0.ChangeDetectorRef }, { token: i3.Directionality }], target: i0.ɵɵFactoryTarget.Component });
  1375. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzTreeComponent, isStandalone: true, selector: "nz-tree", inputs: { nzShowIcon: ["nzShowIcon", "nzShowIcon", booleanAttribute], nzHideUnMatched: ["nzHideUnMatched", "nzHideUnMatched", booleanAttribute], nzBlockNode: ["nzBlockNode", "nzBlockNode", booleanAttribute], nzExpandAll: ["nzExpandAll", "nzExpandAll", booleanAttribute], nzSelectMode: ["nzSelectMode", "nzSelectMode", booleanAttribute], nzCheckStrictly: ["nzCheckStrictly", "nzCheckStrictly", booleanAttribute], nzShowExpand: ["nzShowExpand", "nzShowExpand", booleanAttribute], nzShowLine: ["nzShowLine", "nzShowLine", booleanAttribute], nzCheckable: ["nzCheckable", "nzCheckable", booleanAttribute], nzAsyncData: ["nzAsyncData", "nzAsyncData", booleanAttribute], nzDraggable: ["nzDraggable", "nzDraggable", booleanAttribute], nzMultiple: ["nzMultiple", "nzMultiple", booleanAttribute], nzExpandedIcon: "nzExpandedIcon", nzVirtualItemSize: "nzVirtualItemSize", nzVirtualMaxBufferPx: "nzVirtualMaxBufferPx", nzVirtualMinBufferPx: "nzVirtualMinBufferPx", nzVirtualHeight: "nzVirtualHeight", nzTreeTemplate: "nzTreeTemplate", nzBeforeDrop: "nzBeforeDrop", nzData: "nzData", nzExpandedKeys: "nzExpandedKeys", nzSelectedKeys: "nzSelectedKeys", nzCheckedKeys: "nzCheckedKeys", nzSearchValue: "nzSearchValue", nzSearchFunc: "nzSearchFunc" }, outputs: { nzExpandedKeysChange: "nzExpandedKeysChange", nzSelectedKeysChange: "nzSelectedKeysChange", nzCheckedKeysChange: "nzCheckedKeysChange", nzSearchValueChange: "nzSearchValueChange", nzClick: "nzClick", nzDblClick: "nzDblClick", nzContextMenu: "nzContextMenu", nzCheckboxChange: "nzCheckboxChange", nzExpandChange: "nzExpandChange", nzOnDragStart: "nzOnDragStart", nzOnDragEnter: "nzOnDragEnter", nzOnDragOver: "nzOnDragOver", nzOnDragLeave: "nzOnDragLeave", nzOnDrop: "nzOnDrop", nzOnDragEnd: "nzOnDragEnd" }, host: { properties: { "class.ant-select-tree": "nzSelectMode", "class.ant-select-tree-show-line": "nzSelectMode && nzShowLine", "class.ant-select-tree-icon-hide": "nzSelectMode && !nzShowIcon", "class.ant-select-tree-block-node": "nzSelectMode && nzBlockNode", "class.ant-tree": "!nzSelectMode", "class.ant-tree-rtl": "dir === 'rtl'", "class.ant-tree-show-line": "!nzSelectMode && nzShowLine", "class.ant-tree-icon-hide": "!nzSelectMode && !nzShowIcon", "class.ant-tree-block-node": "!nzSelectMode && nzBlockNode", "class.draggable-tree": "nzDraggable" } }, providers: [
  1376. NzTreeService,
  1377. {
  1378. provide: NzTreeBaseService,
  1379. useFactory: NzTreeServiceFactory
  1380. },
  1381. {
  1382. provide: NG_VALUE_ACCESSOR,
  1383. useExisting: forwardRef(() => NzTreeComponent),
  1384. multi: true
  1385. }
  1386. ], queries: [{ propertyName: "nzTreeTemplateChild", first: true, predicate: ["nzTreeTemplate"], descendants: true, static: true }], viewQueries: [{ propertyName: "cdkVirtualScrollViewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true, read: CdkVirtualScrollViewport }], exportAs: ["nzTree"], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
  1387. <div>
  1388. <input [style]="HIDDEN_STYLE" />
  1389. </div>
  1390. <div class="ant-tree-treenode" [style]="HIDDEN_NODE_STYLE">
  1391. <div class="ant-tree-indent">
  1392. <div class="ant-tree-indent-unit"></div>
  1393. </div>
  1394. </div>
  1395. <div class="ant-tree-list" [class.ant-select-tree-list]="nzSelectMode" style="position: relative">
  1396. @if (nzVirtualHeight) {
  1397. <cdk-virtual-scroll-viewport
  1398. [class.ant-select-tree-list-holder-inner]="nzSelectMode"
  1399. [class.ant-tree-list-holder-inner]="!nzSelectMode"
  1400. [itemSize]="nzVirtualItemSize"
  1401. [minBufferPx]="nzVirtualMinBufferPx"
  1402. [maxBufferPx]="nzVirtualMaxBufferPx"
  1403. [style.height]="nzVirtualHeight"
  1404. >
  1405. <ng-container *cdkVirtualFor="let node of nzFlattenNodes; trackBy: trackByFlattenNode">
  1406. <ng-template
  1407. [ngTemplateOutlet]="nodeTemplate"
  1408. [ngTemplateOutletContext]="{ $implicit: node }"
  1409. ></ng-template>
  1410. </ng-container>
  1411. </cdk-virtual-scroll-viewport>
  1412. } @else {
  1413. <div
  1414. [class.ant-select-tree-list-holder-inner]="nzSelectMode"
  1415. [class.ant-tree-list-holder-inner]="!nzSelectMode"
  1416. [@.disabled]="beforeInit || !!noAnimation?.nzNoAnimation"
  1417. [nzNoAnimation]="noAnimation?.nzNoAnimation"
  1418. [@treeCollapseMotion]="nzFlattenNodes.length"
  1419. >
  1420. @for (node of nzFlattenNodes; track trackByFlattenNode($index, node)) {
  1421. <ng-template
  1422. [ngTemplateOutlet]="nodeTemplate"
  1423. [ngTemplateOutletContext]="{ $implicit: node }"
  1424. ></ng-template>
  1425. }
  1426. </div>
  1427. }
  1428. </div>
  1429. <ng-template #nodeTemplate let-treeNode>
  1430. <nz-tree-node
  1431. builtin
  1432. [icon]="treeNode.icon"
  1433. [title]="treeNode.title"
  1434. [isLoading]="treeNode.isLoading"
  1435. [isSelected]="treeNode.isSelected"
  1436. [isDisabled]="treeNode.isDisabled"
  1437. [isMatched]="treeNode.isMatched"
  1438. [isExpanded]="treeNode.isExpanded"
  1439. [isLeaf]="treeNode.isLeaf"
  1440. [isStart]="treeNode.isStart"
  1441. [isEnd]="treeNode.isEnd"
  1442. [isChecked]="treeNode.isChecked"
  1443. [isHalfChecked]="treeNode.isHalfChecked"
  1444. [isDisableCheckbox]="treeNode.isDisableCheckbox"
  1445. [isSelectable]="treeNode.isSelectable"
  1446. [canHide]="treeNode.canHide"
  1447. [nzTreeNode]="treeNode"
  1448. [nzSelectMode]="nzSelectMode"
  1449. [nzShowLine]="nzShowLine"
  1450. [nzExpandedIcon]="nzExpandedIcon"
  1451. [nzDraggable]="nzDraggable"
  1452. [nzCheckable]="nzCheckable"
  1453. [nzShowExpand]="nzShowExpand"
  1454. [nzAsyncData]="nzAsyncData"
  1455. [nzSearchValue]="nzSearchValue"
  1456. [nzHideUnMatched]="nzHideUnMatched"
  1457. [nzBeforeDrop]="nzBeforeDrop"
  1458. [nzShowIcon]="nzShowIcon"
  1459. [nzTreeTemplate]="nzTreeTemplate || nzTreeTemplateChild"
  1460. (nzExpandChange)="eventTriggerChanged($event)"
  1461. (nzClick)="eventTriggerChanged($event)"
  1462. (nzDblClick)="eventTriggerChanged($event)"
  1463. (nzContextMenu)="eventTriggerChanged($event)"
  1464. (nzCheckboxChange)="eventTriggerChanged($event)"
  1465. (nzOnDragStart)="eventTriggerChanged($event)"
  1466. (nzOnDragEnter)="eventTriggerChanged($event)"
  1467. (nzOnDragOver)="eventTriggerChanged($event)"
  1468. (nzOnDragLeave)="eventTriggerChanged($event)"
  1469. (nzOnDragEnd)="eventTriggerChanged($event)"
  1470. (nzOnDrop)="eventTriggerChanged($event)"
  1471. ></nz-tree-node>
  1472. </ng-template>
  1473. `, isInline: true, dependencies: [{ kind: "component", type: CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "directive", type: CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NzNoAnimationDirective, selector: "[nzNoAnimation]", inputs: ["nzNoAnimation"], exportAs: ["nzNoAnimation"] }, { kind: "component", type: NzTreeNodeBuiltinComponent, selector: "nz-tree-node[builtin]", inputs: ["icon", "title", "isLoading", "isSelected", "isDisabled", "isMatched", "isExpanded", "isLeaf", "isChecked", "isHalfChecked", "isDisableCheckbox", "isSelectable", "canHide", "isStart", "isEnd", "nzTreeNode", "nzShowLine", "nzShowExpand", "nzCheckable", "nzAsyncData", "nzHideUnMatched", "nzNoAnimation", "nzSelectMode", "nzShowIcon", "nzExpandedIcon", "nzTreeTemplate", "nzBeforeDrop", "nzSearchValue", "nzDraggable"], outputs: ["nzClick", "nzDblClick", "nzContextMenu", "nzCheckboxChange", "nzExpandChange", "nzOnDragStart", "nzOnDragEnter", "nzOnDragOver", "nzOnDragLeave", "nzOnDrop", "nzOnDragEnd"], exportAs: ["nzTreeBuiltinNode"] }], animations: [treeCollapseMotion], changeDetection: i0.ChangeDetectionStrategy.OnPush });
  1474. };
  1475. })();
  1476. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeComponent, decorators: [{
  1477. type: Component,
  1478. args: [{
  1479. selector: 'nz-tree',
  1480. exportAs: 'nzTree',
  1481. animations: [treeCollapseMotion],
  1482. template: `
  1483. <div>
  1484. <input [style]="HIDDEN_STYLE" />
  1485. </div>
  1486. <div class="ant-tree-treenode" [style]="HIDDEN_NODE_STYLE">
  1487. <div class="ant-tree-indent">
  1488. <div class="ant-tree-indent-unit"></div>
  1489. </div>
  1490. </div>
  1491. <div class="ant-tree-list" [class.ant-select-tree-list]="nzSelectMode" style="position: relative">
  1492. @if (nzVirtualHeight) {
  1493. <cdk-virtual-scroll-viewport
  1494. [class.ant-select-tree-list-holder-inner]="nzSelectMode"
  1495. [class.ant-tree-list-holder-inner]="!nzSelectMode"
  1496. [itemSize]="nzVirtualItemSize"
  1497. [minBufferPx]="nzVirtualMinBufferPx"
  1498. [maxBufferPx]="nzVirtualMaxBufferPx"
  1499. [style.height]="nzVirtualHeight"
  1500. >
  1501. <ng-container *cdkVirtualFor="let node of nzFlattenNodes; trackBy: trackByFlattenNode">
  1502. <ng-template
  1503. [ngTemplateOutlet]="nodeTemplate"
  1504. [ngTemplateOutletContext]="{ $implicit: node }"
  1505. ></ng-template>
  1506. </ng-container>
  1507. </cdk-virtual-scroll-viewport>
  1508. } @else {
  1509. <div
  1510. [class.ant-select-tree-list-holder-inner]="nzSelectMode"
  1511. [class.ant-tree-list-holder-inner]="!nzSelectMode"
  1512. [@.disabled]="beforeInit || !!noAnimation?.nzNoAnimation"
  1513. [nzNoAnimation]="noAnimation?.nzNoAnimation"
  1514. [@treeCollapseMotion]="nzFlattenNodes.length"
  1515. >
  1516. @for (node of nzFlattenNodes; track trackByFlattenNode($index, node)) {
  1517. <ng-template
  1518. [ngTemplateOutlet]="nodeTemplate"
  1519. [ngTemplateOutletContext]="{ $implicit: node }"
  1520. ></ng-template>
  1521. }
  1522. </div>
  1523. }
  1524. </div>
  1525. <ng-template #nodeTemplate let-treeNode>
  1526. <nz-tree-node
  1527. builtin
  1528. [icon]="treeNode.icon"
  1529. [title]="treeNode.title"
  1530. [isLoading]="treeNode.isLoading"
  1531. [isSelected]="treeNode.isSelected"
  1532. [isDisabled]="treeNode.isDisabled"
  1533. [isMatched]="treeNode.isMatched"
  1534. [isExpanded]="treeNode.isExpanded"
  1535. [isLeaf]="treeNode.isLeaf"
  1536. [isStart]="treeNode.isStart"
  1537. [isEnd]="treeNode.isEnd"
  1538. [isChecked]="treeNode.isChecked"
  1539. [isHalfChecked]="treeNode.isHalfChecked"
  1540. [isDisableCheckbox]="treeNode.isDisableCheckbox"
  1541. [isSelectable]="treeNode.isSelectable"
  1542. [canHide]="treeNode.canHide"
  1543. [nzTreeNode]="treeNode"
  1544. [nzSelectMode]="nzSelectMode"
  1545. [nzShowLine]="nzShowLine"
  1546. [nzExpandedIcon]="nzExpandedIcon"
  1547. [nzDraggable]="nzDraggable"
  1548. [nzCheckable]="nzCheckable"
  1549. [nzShowExpand]="nzShowExpand"
  1550. [nzAsyncData]="nzAsyncData"
  1551. [nzSearchValue]="nzSearchValue"
  1552. [nzHideUnMatched]="nzHideUnMatched"
  1553. [nzBeforeDrop]="nzBeforeDrop"
  1554. [nzShowIcon]="nzShowIcon"
  1555. [nzTreeTemplate]="nzTreeTemplate || nzTreeTemplateChild"
  1556. (nzExpandChange)="eventTriggerChanged($event)"
  1557. (nzClick)="eventTriggerChanged($event)"
  1558. (nzDblClick)="eventTriggerChanged($event)"
  1559. (nzContextMenu)="eventTriggerChanged($event)"
  1560. (nzCheckboxChange)="eventTriggerChanged($event)"
  1561. (nzOnDragStart)="eventTriggerChanged($event)"
  1562. (nzOnDragEnter)="eventTriggerChanged($event)"
  1563. (nzOnDragOver)="eventTriggerChanged($event)"
  1564. (nzOnDragLeave)="eventTriggerChanged($event)"
  1565. (nzOnDragEnd)="eventTriggerChanged($event)"
  1566. (nzOnDrop)="eventTriggerChanged($event)"
  1567. ></nz-tree-node>
  1568. </ng-template>
  1569. `,
  1570. changeDetection: ChangeDetectionStrategy.OnPush,
  1571. providers: [
  1572. NzTreeService,
  1573. {
  1574. provide: NzTreeBaseService,
  1575. useFactory: NzTreeServiceFactory
  1576. },
  1577. {
  1578. provide: NG_VALUE_ACCESSOR,
  1579. useExisting: forwardRef(() => NzTreeComponent),
  1580. multi: true
  1581. }
  1582. ],
  1583. host: {
  1584. '[class.ant-select-tree]': `nzSelectMode`,
  1585. '[class.ant-select-tree-show-line]': `nzSelectMode && nzShowLine`,
  1586. '[class.ant-select-tree-icon-hide]': `nzSelectMode && !nzShowIcon`,
  1587. '[class.ant-select-tree-block-node]': `nzSelectMode && nzBlockNode`,
  1588. '[class.ant-tree]': `!nzSelectMode`,
  1589. '[class.ant-tree-rtl]': `dir === 'rtl'`,
  1590. '[class.ant-tree-show-line]': `!nzSelectMode && nzShowLine`,
  1591. '[class.ant-tree-icon-hide]': `!nzSelectMode && !nzShowIcon`,
  1592. '[class.ant-tree-block-node]': `!nzSelectMode && nzBlockNode`,
  1593. '[class.draggable-tree]': `nzDraggable`
  1594. },
  1595. imports: [
  1596. CdkVirtualScrollViewport,
  1597. CdkFixedSizeVirtualScroll,
  1598. CdkVirtualForOf,
  1599. NgTemplateOutlet,
  1600. NzNoAnimationDirective,
  1601. NzTreeNodeBuiltinComponent
  1602. ]
  1603. }]
  1604. }], ctorParameters: () => [{ type: i1$1.NzTreeBaseService }, { type: i2$2.NzConfigService }, { type: i0.ChangeDetectorRef }, { type: i3.Directionality }], propDecorators: { nzShowIcon: [{
  1605. type: Input,
  1606. args: [{ transform: booleanAttribute }]
  1607. }], nzHideUnMatched: [{
  1608. type: Input,
  1609. args: [{ transform: booleanAttribute }]
  1610. }], nzBlockNode: [{
  1611. type: Input,
  1612. args: [{ transform: booleanAttribute }]
  1613. }], nzExpandAll: [{
  1614. type: Input,
  1615. args: [{ transform: booleanAttribute }]
  1616. }], nzSelectMode: [{
  1617. type: Input,
  1618. args: [{ transform: booleanAttribute }]
  1619. }], nzCheckStrictly: [{
  1620. type: Input,
  1621. args: [{ transform: booleanAttribute }]
  1622. }], nzShowExpand: [{
  1623. type: Input,
  1624. args: [{ transform: booleanAttribute }]
  1625. }], nzShowLine: [{
  1626. type: Input,
  1627. args: [{ transform: booleanAttribute }]
  1628. }], nzCheckable: [{
  1629. type: Input,
  1630. args: [{ transform: booleanAttribute }]
  1631. }], nzAsyncData: [{
  1632. type: Input,
  1633. args: [{ transform: booleanAttribute }]
  1634. }], nzDraggable: [{
  1635. type: Input,
  1636. args: [{ transform: booleanAttribute }]
  1637. }], nzMultiple: [{
  1638. type: Input,
  1639. args: [{ transform: booleanAttribute }]
  1640. }], nzExpandedIcon: [{
  1641. type: Input
  1642. }], nzVirtualItemSize: [{
  1643. type: Input
  1644. }], nzVirtualMaxBufferPx: [{
  1645. type: Input
  1646. }], nzVirtualMinBufferPx: [{
  1647. type: Input
  1648. }], nzVirtualHeight: [{
  1649. type: Input
  1650. }], nzTreeTemplate: [{
  1651. type: Input
  1652. }], nzBeforeDrop: [{
  1653. type: Input
  1654. }], nzData: [{
  1655. type: Input
  1656. }], nzExpandedKeys: [{
  1657. type: Input
  1658. }], nzSelectedKeys: [{
  1659. type: Input
  1660. }], nzCheckedKeys: [{
  1661. type: Input
  1662. }], nzSearchValue: [{
  1663. type: Input
  1664. }], nzSearchFunc: [{
  1665. type: Input
  1666. }], nzTreeTemplateChild: [{
  1667. type: ContentChild,
  1668. args: ['nzTreeTemplate', { static: true }]
  1669. }], cdkVirtualScrollViewport: [{
  1670. type: ViewChild,
  1671. args: [CdkVirtualScrollViewport, { read: CdkVirtualScrollViewport }]
  1672. }], nzExpandedKeysChange: [{
  1673. type: Output
  1674. }], nzSelectedKeysChange: [{
  1675. type: Output
  1676. }], nzCheckedKeysChange: [{
  1677. type: Output
  1678. }], nzSearchValueChange: [{
  1679. type: Output
  1680. }], nzClick: [{
  1681. type: Output
  1682. }], nzDblClick: [{
  1683. type: Output
  1684. }], nzContextMenu: [{
  1685. type: Output
  1686. }], nzCheckboxChange: [{
  1687. type: Output
  1688. }], nzExpandChange: [{
  1689. type: Output
  1690. }], nzOnDragStart: [{
  1691. type: Output
  1692. }], nzOnDragEnter: [{
  1693. type: Output
  1694. }], nzOnDragOver: [{
  1695. type: Output
  1696. }], nzOnDragLeave: [{
  1697. type: Output
  1698. }], nzOnDrop: [{
  1699. type: Output
  1700. }], nzOnDragEnd: [{
  1701. type: Output
  1702. }] } });
  1703. /**
  1704. * Use of this source code is governed by an MIT-style license that can be
  1705. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  1706. */
  1707. class NzTreeModule {
  1708. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
  1709. static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.2", ngImport: i0, type: NzTreeModule, imports: [NzTreeComponent,
  1710. NzTreeNodeBuiltinComponent,
  1711. NzTreeIndentComponent,
  1712. NzTreeNodeSwitcherComponent,
  1713. NzTreeNodeBuiltinCheckboxComponent,
  1714. NzTreeNodeTitleComponent,
  1715. NzTreeDropIndicatorComponent], exports: [NzTreeComponent, NzTreeNodeBuiltinComponent, NzTreeIndentComponent] });
  1716. static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeModule, imports: [NzTreeComponent,
  1717. NzTreeNodeBuiltinComponent,
  1718. NzTreeNodeSwitcherComponent,
  1719. NzTreeNodeTitleComponent] });
  1720. }
  1721. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeModule, decorators: [{
  1722. type: NgModule,
  1723. args: [{
  1724. imports: [
  1725. NzTreeComponent,
  1726. NzTreeNodeBuiltinComponent,
  1727. NzTreeIndentComponent,
  1728. NzTreeNodeSwitcherComponent,
  1729. NzTreeNodeBuiltinCheckboxComponent,
  1730. NzTreeNodeTitleComponent,
  1731. NzTreeDropIndicatorComponent
  1732. ],
  1733. exports: [NzTreeComponent, NzTreeNodeBuiltinComponent, NzTreeIndentComponent]
  1734. }]
  1735. }] });
  1736. /**
  1737. * Use of this source code is governed by an MIT-style license that can be
  1738. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  1739. */
  1740. /**
  1741. * Generated bundle index. Do not edit.
  1742. */
  1743. export { NzTreeComponent, NzTreeIndentComponent, NzTreeModule, NzTreeNodeBuiltinCheckboxComponent, NzTreeNodeBuiltinComponent, NzTreeNodeSwitcherComponent, NzTreeNodeTitleComponent, NzTreeService, NzTreeServiceFactory };
  1744. //# sourceMappingURL=ng-zorro-antd-tree.mjs.map