ng-zorro-antd-tree-select.mjs 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972
  1. import { __esDecorate, __runInitializers } from 'tslib';
  2. import { TAB, ESCAPE, BACKSPACE } from '@angular/cdk/keycodes';
  3. import { CdkConnectedOverlay, CdkOverlayOrigin } from '@angular/cdk/overlay';
  4. import { _getEventTarget } from '@angular/cdk/platform';
  5. import { SlicePipe } from '@angular/common';
  6. import * as i0 from '@angular/core';
  7. import { Injectable, EventEmitter, computed, signal, inject, forwardRef, numberAttribute, booleanAttribute, ContentChild, Input, ViewChild, Output, Component, NgModule } from '@angular/core';
  8. import { NG_VALUE_ACCESSOR } from '@angular/forms';
  9. import { Subject, of, combineLatest, merge } from 'rxjs';
  10. import { takeUntil, distinctUntilChanged, withLatestFrom, map, startWith, tap, filter } from 'rxjs/operators';
  11. import { slideMotion } from 'ng-zorro-antd/core/animation';
  12. import * as i2 from 'ng-zorro-antd/core/config';
  13. import { WithConfig } from 'ng-zorro-antd/core/config';
  14. import { NzFormStatusService, NzFormNoStatusService, NzFormItemFeedbackIconComponent } from 'ng-zorro-antd/core/form';
  15. import { NzNoAnimationDirective } from 'ng-zorro-antd/core/no-animation';
  16. import * as i6 from 'ng-zorro-antd/core/overlay';
  17. import { POSITION_MAP, NzOverlayModule } from 'ng-zorro-antd/core/overlay';
  18. import { reqAnimFrame } from 'ng-zorro-antd/core/polyfill';
  19. import { NzDestroyService } from 'ng-zorro-antd/core/services';
  20. import { NzTreeBaseService, NzTreeBase, NzTreeHigherOrderServiceToken } from 'ng-zorro-antd/core/tree';
  21. import { getStatusClassNames, isNotNil } from 'ng-zorro-antd/core/util';
  22. import * as i8 from 'ng-zorro-antd/empty';
  23. import { NzEmptyModule } from 'ng-zorro-antd/empty';
  24. import * as i9 from 'ng-zorro-antd/select';
  25. import { NzSelectModule, NzSelectSearchComponent } from 'ng-zorro-antd/select';
  26. import * as i5 from 'ng-zorro-antd/space';
  27. import { NZ_SPACE_COMPACT_SIZE, NZ_SPACE_COMPACT_ITEM_TYPE, NzSpaceCompactItemDirective } from 'ng-zorro-antd/space';
  28. import * as i7 from 'ng-zorro-antd/tree';
  29. import { NzTreeModule } from 'ng-zorro-antd/tree';
  30. import * as i3 from '@angular/cdk/bidi';
  31. import * as i4 from '@angular/cdk/a11y';
  32. /**
  33. * Use of this source code is governed by an MIT-style license that can be
  34. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  35. */
  36. class NzTreeSelectService extends NzTreeBaseService {
  37. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeSelectService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
  38. static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeSelectService });
  39. }
  40. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeSelectService, decorators: [{
  41. type: Injectable
  42. }] });
  43. const NZ_CONFIG_MODULE_NAME = 'treeSelect';
  44. const TREE_SELECT_DEFAULT_CLASS = 'ant-select-dropdown ant-select-tree-dropdown';
  45. const listOfPositions = [
  46. POSITION_MAP.bottomLeft,
  47. POSITION_MAP.bottomRight,
  48. POSITION_MAP.topRight,
  49. POSITION_MAP.topLeft
  50. ];
  51. let NzTreeSelectComponent = (() => {
  52. let _classSuper = NzTreeBase;
  53. let _nzDropdownMatchSelectWidth_decorators;
  54. let _nzDropdownMatchSelectWidth_initializers = [];
  55. let _nzDropdownMatchSelectWidth_extraInitializers = [];
  56. let _nzHideUnMatched_decorators;
  57. let _nzHideUnMatched_initializers = [];
  58. let _nzHideUnMatched_extraInitializers = [];
  59. let _nzShowIcon_decorators;
  60. let _nzShowIcon_initializers = [];
  61. let _nzShowIcon_extraInitializers = [];
  62. let _nzSize_decorators;
  63. let _nzSize_initializers = [];
  64. let _nzSize_extraInitializers = [];
  65. let _nzBackdrop_decorators;
  66. let _nzBackdrop_initializers = [];
  67. let _nzBackdrop_extraInitializers = [];
  68. return class NzTreeSelectComponent extends _classSuper {
  69. static {
  70. const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
  71. _nzDropdownMatchSelectWidth_decorators = [WithConfig()];
  72. _nzHideUnMatched_decorators = [WithConfig()];
  73. _nzShowIcon_decorators = [WithConfig()];
  74. _nzSize_decorators = [WithConfig()];
  75. _nzBackdrop_decorators = [WithConfig()];
  76. __esDecorate(null, null, _nzDropdownMatchSelectWidth_decorators, { kind: "field", name: "nzDropdownMatchSelectWidth", static: false, private: false, access: { has: obj => "nzDropdownMatchSelectWidth" in obj, get: obj => obj.nzDropdownMatchSelectWidth, set: (obj, value) => { obj.nzDropdownMatchSelectWidth = value; } }, metadata: _metadata }, _nzDropdownMatchSelectWidth_initializers, _nzDropdownMatchSelectWidth_extraInitializers);
  77. __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);
  78. __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);
  79. __esDecorate(null, null, _nzSize_decorators, { kind: "field", name: "nzSize", static: false, private: false, access: { has: obj => "nzSize" in obj, get: obj => obj.nzSize, set: (obj, value) => { obj.nzSize = value; } }, metadata: _metadata }, _nzSize_initializers, _nzSize_extraInitializers);
  80. __esDecorate(null, null, _nzBackdrop_decorators, { kind: "field", name: "nzBackdrop", static: false, private: false, access: { has: obj => "nzBackdrop" in obj, get: obj => obj.nzBackdrop, set: (obj, value) => { obj.nzBackdrop = value; } }, metadata: _metadata }, _nzBackdrop_initializers, _nzBackdrop_extraInitializers);
  81. if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
  82. }
  83. nzConfigService;
  84. renderer;
  85. cdr;
  86. elementRef;
  87. directionality;
  88. focusMonitor;
  89. _nzModuleName = NZ_CONFIG_MODULE_NAME;
  90. nzId = null;
  91. nzAllowClear = true;
  92. nzShowExpand = true;
  93. nzShowLine = false;
  94. nzDropdownMatchSelectWidth = __runInitializers(this, _nzDropdownMatchSelectWidth_initializers, true);
  95. nzCheckable = (__runInitializers(this, _nzDropdownMatchSelectWidth_extraInitializers), false);
  96. nzHideUnMatched = __runInitializers(this, _nzHideUnMatched_initializers, false);
  97. nzShowIcon = (__runInitializers(this, _nzHideUnMatched_extraInitializers), __runInitializers(this, _nzShowIcon_initializers, false));
  98. nzShowSearch = (__runInitializers(this, _nzShowIcon_extraInitializers), false);
  99. nzDisabled = false;
  100. nzAsyncData = false;
  101. nzMultiple = false;
  102. nzDefaultExpandAll = false;
  103. nzCheckStrictly = false;
  104. nzVirtualItemSize = 28;
  105. nzVirtualMaxBufferPx = 500;
  106. nzVirtualMinBufferPx = 28;
  107. nzVirtualHeight = null;
  108. nzExpandedIcon;
  109. nzNotFoundContent;
  110. nzNodes = [];
  111. nzOpen = false;
  112. nzSize = __runInitializers(this, _nzSize_initializers, 'default');
  113. nzPlaceHolder = (__runInitializers(this, _nzSize_extraInitializers), '');
  114. nzDropdownStyle = null;
  115. nzDropdownClassName;
  116. nzBackdrop = __runInitializers(this, _nzBackdrop_initializers, false);
  117. nzStatus = (__runInitializers(this, _nzBackdrop_extraInitializers), '');
  118. nzPlacement = '';
  119. set nzExpandedKeys(value) {
  120. this.expandedKeys = value;
  121. }
  122. get nzExpandedKeys() {
  123. return this.expandedKeys;
  124. }
  125. nzDisplayWith = (node) => node.title;
  126. nzMaxTagCount;
  127. nzMaxTagPlaceholder = null;
  128. nzOpenChange = new EventEmitter();
  129. nzCleared = new EventEmitter();
  130. nzRemoved = new EventEmitter();
  131. nzExpandChange = new EventEmitter();
  132. nzTreeClick = new EventEmitter();
  133. nzTreeCheckboxChange = new EventEmitter();
  134. nzSelectSearchComponent;
  135. treeRef;
  136. cdkOverlayOrigin;
  137. cdkConnectedOverlay;
  138. nzTreeTemplate;
  139. nzTreeTemplateChild;
  140. get treeTemplate() {
  141. return this.nzTreeTemplate || this.nzTreeTemplateChild;
  142. }
  143. prefixCls = 'ant-select';
  144. statusCls = {};
  145. status = '';
  146. hasFeedback = false;
  147. dropdownClassName = TREE_SELECT_DEFAULT_CLASS;
  148. triggerWidth;
  149. isComposing = false;
  150. isDestroy = true;
  151. isNotFound = false;
  152. focused = false;
  153. inputValue = '';
  154. dropdownPosition = 'bottom';
  155. selectedNodes = [];
  156. expandedKeys = [];
  157. value = [];
  158. dir = 'ltr';
  159. positions = [];
  160. finalSize = computed(() => {
  161. if (this.compactSize) {
  162. return this.compactSize();
  163. }
  164. return this.size();
  165. });
  166. size = signal(this.nzSize);
  167. compactSize = inject(NZ_SPACE_COMPACT_SIZE, { optional: true });
  168. destroy$ = inject(NzDestroyService);
  169. isNzDisableFirstChange = true;
  170. isComposingChange$ = new Subject();
  171. searchValueChange$ = new Subject();
  172. onChange = _value => { };
  173. onTouched = () => { };
  174. get placeHolderDisplay() {
  175. return this.inputValue || this.isComposing || this.selectedNodes.length ? 'none' : 'block';
  176. }
  177. get isMultiple() {
  178. return this.nzMultiple || this.nzCheckable;
  179. }
  180. noAnimation = inject(NzNoAnimationDirective, { host: true, optional: true });
  181. nzFormStatusService = inject(NzFormStatusService, { optional: true });
  182. nzFormNoStatusService = inject(NzFormNoStatusService, { optional: true });
  183. constructor(nzTreeService, nzConfigService, renderer, cdr, elementRef, directionality, focusMonitor) {
  184. super(nzTreeService);
  185. this.nzConfigService = nzConfigService;
  186. this.renderer = renderer;
  187. this.cdr = cdr;
  188. this.elementRef = elementRef;
  189. this.directionality = directionality;
  190. this.focusMonitor = focusMonitor;
  191. }
  192. ngOnInit() {
  193. this.size.set(this.nzSize);
  194. this.nzConfigService
  195. .getConfigChangeEventForComponent(NZ_CONFIG_MODULE_NAME)
  196. .pipe(takeUntil(this.destroy$))
  197. .subscribe(() => {
  198. this.size.set(this.nzSize);
  199. this.cdr.markForCheck();
  200. });
  201. this.nzFormStatusService?.formStatusChanges
  202. .pipe(distinctUntilChanged((pre, cur) => {
  203. return pre.status === cur.status && pre.hasFeedback === cur.hasFeedback;
  204. }), withLatestFrom(this.nzFormNoStatusService ? this.nzFormNoStatusService.noFormStatus : of(false)), map(([{ status, hasFeedback }, noStatus]) => ({ status: noStatus ? '' : status, hasFeedback })), takeUntil(this.destroy$))
  205. .subscribe(({ status, hasFeedback }) => {
  206. this.setStatusStyles(status, hasFeedback);
  207. });
  208. this.isDestroy = false;
  209. this.subscribeSelectionChange();
  210. this.directionality.change?.pipe(takeUntil(this.destroy$)).subscribe((direction) => {
  211. this.dir = direction;
  212. this.cdr.detectChanges();
  213. });
  214. this.dir = this.directionality.value;
  215. this.focusMonitor
  216. .monitor(this.elementRef, true)
  217. .pipe(takeUntil(this.destroy$))
  218. .subscribe(focusOrigin => {
  219. if (!focusOrigin) {
  220. this.focused = false;
  221. this.cdr.markForCheck();
  222. Promise.resolve().then(() => {
  223. this.onTouched();
  224. });
  225. }
  226. else {
  227. this.focused = true;
  228. this.cdr.markForCheck();
  229. }
  230. });
  231. // setInputValue method executed earlier than isComposingChange
  232. combineLatest([this.searchValueChange$, this.isComposingChange$.pipe(startWith(false))])
  233. .pipe(takeUntil(this.destroy$))
  234. .subscribe(([searchValue, isComposing]) => {
  235. this.isComposing = isComposing;
  236. if (!isComposing) {
  237. this.inputValue = searchValue;
  238. this.updatePosition();
  239. }
  240. });
  241. }
  242. ngOnDestroy() {
  243. this.isDestroy = true;
  244. this.closeDropDown();
  245. this.destroy$.next();
  246. this.destroy$.complete();
  247. }
  248. isComposingChange(isComposing) {
  249. this.isComposingChange$.next(isComposing);
  250. }
  251. setDisabledState(isDisabled) {
  252. this.nzDisabled = (this.isNzDisableFirstChange && this.nzDisabled) || isDisabled;
  253. this.closeDropDown();
  254. this.isNzDisableFirstChange = false;
  255. }
  256. setStatusStyles(status, hasFeedback) {
  257. // set inner status
  258. this.status = status;
  259. this.hasFeedback = hasFeedback;
  260. this.cdr.markForCheck();
  261. // render status if nzStatus is set
  262. this.statusCls = getStatusClassNames(this.prefixCls, status, hasFeedback);
  263. Object.keys(this.statusCls).forEach(status => {
  264. if (this.statusCls[status]) {
  265. this.renderer.addClass(this.elementRef.nativeElement, status);
  266. }
  267. else {
  268. this.renderer.removeClass(this.elementRef.nativeElement, status);
  269. }
  270. });
  271. }
  272. ngOnChanges({ nzNodes, nzDropdownClassName, nzStatus, nzPlacement, nzSize }) {
  273. if (nzNodes) {
  274. this.updateSelectedNodes(true);
  275. }
  276. if (nzDropdownClassName) {
  277. const className = this.nzDropdownClassName && this.nzDropdownClassName.trim();
  278. this.dropdownClassName = className ? `${TREE_SELECT_DEFAULT_CLASS} ${className}` : TREE_SELECT_DEFAULT_CLASS;
  279. }
  280. if (nzStatus) {
  281. this.setStatusStyles(this.nzStatus, this.hasFeedback);
  282. }
  283. if (nzPlacement && this.nzPlacement) {
  284. if (POSITION_MAP[this.nzPlacement]) {
  285. this.positions = [POSITION_MAP[this.nzPlacement]];
  286. }
  287. }
  288. if (nzSize) {
  289. this.size.set(nzSize.currentValue);
  290. }
  291. }
  292. writeValue(value) {
  293. if (isNotNil(value)) {
  294. if (this.isMultiple && Array.isArray(value)) {
  295. this.value = value;
  296. }
  297. else {
  298. this.value = [value];
  299. }
  300. // need clear selected nodes when user set value before updating
  301. this.clearSelectedNodes();
  302. this.updateSelectedNodes(true);
  303. }
  304. else {
  305. this.value = [];
  306. this.clearSelectedNodes();
  307. this.selectedNodes = [];
  308. }
  309. this.cdr.markForCheck();
  310. }
  311. registerOnChange(fn) {
  312. this.onChange = fn;
  313. }
  314. registerOnTouched(fn) {
  315. this.onTouched = fn;
  316. }
  317. onKeydown(event) {
  318. if (this.nzDisabled) {
  319. return;
  320. }
  321. switch (event.keyCode) {
  322. case ESCAPE:
  323. /**
  324. * Skip the ESCAPE processing, it will be handled in {@link onOverlayKeyDown}.
  325. */
  326. break;
  327. case TAB:
  328. this.closeDropDown();
  329. break;
  330. default:
  331. if (!this.nzOpen) {
  332. this.openDropdown();
  333. }
  334. }
  335. }
  336. trigger() {
  337. if (this.nzDisabled || (!this.nzDisabled && this.nzOpen)) {
  338. this.closeDropDown();
  339. }
  340. else {
  341. this.openDropdown();
  342. }
  343. }
  344. openDropdown() {
  345. if (!this.nzDisabled) {
  346. this.nzOpen = true;
  347. this.nzOpenChange.emit(this.nzOpen);
  348. this.updateCdkConnectedOverlayStatus();
  349. if (this.nzShowSearch || this.isMultiple) {
  350. this.focusOnInput();
  351. }
  352. }
  353. }
  354. closeDropDown() {
  355. Promise.resolve().then(() => {
  356. this.onTouched();
  357. });
  358. this.nzOpen = false;
  359. this.inputValue = '';
  360. this.isNotFound = false;
  361. this.nzOpenChange.emit(this.nzOpen);
  362. this.cdr.markForCheck();
  363. }
  364. onKeyDownInput(e) {
  365. const keyCode = e.keyCode;
  366. const eventTarget = e.target;
  367. if (this.isMultiple && !eventTarget.value && keyCode === BACKSPACE) {
  368. e.preventDefault();
  369. if (this.selectedNodes.length) {
  370. const removeNode = this.selectedNodes[this.selectedNodes.length - 1];
  371. if (removeNode && !removeNode.isDisabled) {
  372. this.removeSelected(removeNode);
  373. }
  374. }
  375. }
  376. }
  377. onExpandedKeysChange(value) {
  378. this.nzExpandChange.emit(value);
  379. this.expandedKeys = [...value.keys];
  380. }
  381. setInputValue(value) {
  382. this.searchValueChange$.next(value);
  383. }
  384. removeSelected(node, emit = true) {
  385. node.isSelected = false;
  386. node.isChecked = false;
  387. if (this.nzCheckable) {
  388. this.nzTreeService.conduct(node, this.nzCheckStrictly);
  389. }
  390. else {
  391. this.nzTreeService.setSelectedNodeList(node, this.nzMultiple);
  392. }
  393. if (emit) {
  394. this.nzRemoved.emit(node);
  395. }
  396. }
  397. focusOnInput() {
  398. if (this.nzSelectSearchComponent) {
  399. this.nzSelectSearchComponent.focus();
  400. }
  401. }
  402. subscribeSelectionChange() {
  403. merge(this.nzTreeClick.pipe(tap((event) => {
  404. const node = event.node;
  405. if (this.nzCheckable && !node.isDisabled && !node.isDisableCheckbox) {
  406. node.isChecked = !node.isChecked;
  407. node.isHalfChecked = false;
  408. if (!this.nzCheckStrictly) {
  409. this.nzTreeService.conduct(node);
  410. }
  411. }
  412. if (this.nzCheckable) {
  413. node.isSelected = false;
  414. }
  415. }), filter((event) => {
  416. const node = event.node;
  417. return this.nzCheckable ? !node.isDisabled && !node.isDisableCheckbox : !node.isDisabled && node.isSelectable;
  418. })), this.nzCheckable ? this.nzTreeCheckboxChange.asObservable() : of(), this.nzCleared, this.nzRemoved)
  419. .pipe(takeUntil(this.destroy$))
  420. .subscribe(() => {
  421. this.updateSelectedNodes();
  422. const value = this.selectedNodes.map(node => node.key);
  423. this.value = [...value];
  424. if (this.nzShowSearch || this.isMultiple) {
  425. this.inputValue = '';
  426. this.isNotFound = false;
  427. }
  428. if (this.isMultiple) {
  429. this.onChange(value);
  430. this.focusOnInput();
  431. this.updatePosition();
  432. }
  433. else {
  434. this.closeDropDown();
  435. this.onChange(value.length ? value[0] : null);
  436. }
  437. });
  438. }
  439. updateSelectedNodes(init = false) {
  440. if (init) {
  441. const nodes = this.coerceTreeNodes(this.nzNodes);
  442. this.nzTreeService.isMultiple = this.isMultiple;
  443. this.nzTreeService.isCheckStrictly = this.nzCheckStrictly;
  444. this.nzTreeService.initTree(nodes);
  445. if (this.nzCheckable) {
  446. this.nzTreeService.conductCheck(this.value, this.nzCheckStrictly);
  447. }
  448. else {
  449. this.nzTreeService.conductSelectedKeys(this.value, this.isMultiple);
  450. }
  451. }
  452. this.selectedNodes = [...(this.nzCheckable ? this.getCheckedNodeList() : this.getSelectedNodeList())].sort((a, b) => {
  453. const indexA = this.value.indexOf(a.key);
  454. const indexB = this.value.indexOf(b.key);
  455. if (indexA !== -1 && indexB !== -1) {
  456. return indexA - indexB;
  457. }
  458. if (indexA !== -1) {
  459. return -1;
  460. }
  461. if (indexB !== -1) {
  462. return 1;
  463. }
  464. return 0;
  465. });
  466. }
  467. updatePosition() {
  468. reqAnimFrame(() => {
  469. this.cdkConnectedOverlay?.overlayRef?.updatePosition();
  470. });
  471. }
  472. onPositionChange(position) {
  473. this.dropdownPosition = position.connectionPair.originY;
  474. }
  475. onClearSelection() {
  476. this.selectedNodes.forEach(node => {
  477. this.removeSelected(node, false);
  478. });
  479. this.nzCleared.emit();
  480. }
  481. onClickOutside(event) {
  482. const target = _getEventTarget(event);
  483. if (!this.elementRef.nativeElement.contains(target)) {
  484. this.closeDropDown();
  485. }
  486. }
  487. setSearchValues($event) {
  488. Promise.resolve().then(() => {
  489. this.isNotFound = (this.nzShowSearch || this.isMultiple) && !!this.inputValue && $event.matchedKeys.length === 0;
  490. });
  491. }
  492. updateCdkConnectedOverlayStatus() {
  493. if (!this.nzPlacement || !listOfPositions.includes(POSITION_MAP[this.nzPlacement])) {
  494. this.triggerWidth = this.cdkOverlayOrigin.elementRef.nativeElement.getBoundingClientRect().width;
  495. }
  496. }
  497. clearSelectedNodes() {
  498. this.selectedNodes.forEach(node => {
  499. this.removeSelected(node, false);
  500. });
  501. }
  502. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeSelectComponent, deps: [{ token: NzTreeSelectService }, { token: i2.NzConfigService }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i3.Directionality }, { token: i4.FocusMonitor }], target: i0.ɵɵFactoryTarget.Component });
  503. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzTreeSelectComponent, isStandalone: true, selector: "nz-tree-select", inputs: { nzId: "nzId", nzAllowClear: ["nzAllowClear", "nzAllowClear", booleanAttribute], nzShowExpand: ["nzShowExpand", "nzShowExpand", booleanAttribute], nzShowLine: ["nzShowLine", "nzShowLine", booleanAttribute], nzDropdownMatchSelectWidth: ["nzDropdownMatchSelectWidth", "nzDropdownMatchSelectWidth", booleanAttribute], nzCheckable: ["nzCheckable", "nzCheckable", booleanAttribute], nzHideUnMatched: ["nzHideUnMatched", "nzHideUnMatched", booleanAttribute], nzShowIcon: ["nzShowIcon", "nzShowIcon", booleanAttribute], nzShowSearch: ["nzShowSearch", "nzShowSearch", booleanAttribute], nzDisabled: ["nzDisabled", "nzDisabled", booleanAttribute], nzAsyncData: ["nzAsyncData", "nzAsyncData", booleanAttribute], nzMultiple: ["nzMultiple", "nzMultiple", booleanAttribute], nzDefaultExpandAll: ["nzDefaultExpandAll", "nzDefaultExpandAll", booleanAttribute], nzCheckStrictly: ["nzCheckStrictly", "nzCheckStrictly", booleanAttribute], nzVirtualItemSize: "nzVirtualItemSize", nzVirtualMaxBufferPx: "nzVirtualMaxBufferPx", nzVirtualMinBufferPx: "nzVirtualMinBufferPx", nzVirtualHeight: "nzVirtualHeight", nzExpandedIcon: "nzExpandedIcon", nzNotFoundContent: "nzNotFoundContent", nzNodes: "nzNodes", nzOpen: "nzOpen", nzSize: "nzSize", nzPlaceHolder: "nzPlaceHolder", nzDropdownStyle: "nzDropdownStyle", nzDropdownClassName: "nzDropdownClassName", nzBackdrop: "nzBackdrop", nzStatus: "nzStatus", nzPlacement: "nzPlacement", nzExpandedKeys: "nzExpandedKeys", nzDisplayWith: "nzDisplayWith", nzMaxTagCount: ["nzMaxTagCount", "nzMaxTagCount", numberAttribute], nzMaxTagPlaceholder: "nzMaxTagPlaceholder", nzTreeTemplate: "nzTreeTemplate" }, outputs: { nzOpenChange: "nzOpenChange", nzCleared: "nzCleared", nzRemoved: "nzRemoved", nzExpandChange: "nzExpandChange", nzTreeClick: "nzTreeClick", nzTreeCheckboxChange: "nzTreeCheckboxChange" }, host: { listeners: { "click": "trigger()", "keydown": "onKeydown($event)" }, properties: { "class.ant-select-in-form-item": "!!nzFormStatusService", "class.ant-select-rtl": "dir===\"rtl\"", "class.ant-select-lg": "finalSize() === \"large\"", "class.ant-select-sm": "finalSize() === \"small\"", "class.ant-select-disabled": "nzDisabled", "class.ant-select-single": "!isMultiple", "class.ant-select-show-arrow": "!isMultiple", "class.ant-select-show-search": "!isMultiple", "class.ant-select-multiple": "isMultiple", "class.ant-select-allow-clear": "nzAllowClear", "class.ant-select-open": "nzOpen", "class.ant-select-focused": "nzOpen || focused" }, classAttribute: "ant-select ant-tree-select" }, providers: [
  504. NzDestroyService,
  505. NzTreeSelectService,
  506. { provide: NZ_SPACE_COMPACT_ITEM_TYPE, useValue: 'select' },
  507. {
  508. provide: NzTreeHigherOrderServiceToken,
  509. useExisting: NzTreeSelectService
  510. },
  511. {
  512. provide: NG_VALUE_ACCESSOR,
  513. useExisting: forwardRef(() => NzTreeSelectComponent),
  514. multi: true
  515. }
  516. ], queries: [{ propertyName: "nzTreeTemplateChild", first: true, predicate: ["nzTreeTemplate"], descendants: true, static: true }], viewQueries: [{ propertyName: "nzSelectSearchComponent", first: true, predicate: NzSelectSearchComponent, descendants: true }, { propertyName: "treeRef", first: true, predicate: ["treeRef"], descendants: true }, { propertyName: "cdkOverlayOrigin", first: true, predicate: CdkOverlayOrigin, descendants: true, static: true }, { propertyName: "cdkConnectedOverlay", first: true, predicate: CdkConnectedOverlay, descendants: true }], exportAs: ["nzTreeSelect"], usesInheritance: true, usesOnChanges: true, hostDirectives: [{ directive: i5.NzSpaceCompactItemDirective }], ngImport: i0, template: `
  517. <ng-template
  518. cdkConnectedOverlay
  519. nzConnectedOverlay
  520. [cdkConnectedOverlayHasBackdrop]="nzBackdrop"
  521. [cdkConnectedOverlayOrigin]="cdkOverlayOrigin"
  522. [cdkConnectedOverlayPositions]="nzPlacement ? positions : []"
  523. [cdkConnectedOverlayOpen]="nzOpen"
  524. [cdkConnectedOverlayTransformOriginOn]="'.ant-select-tree-dropdown'"
  525. [cdkConnectedOverlayMinWidth]="$any(nzDropdownMatchSelectWidth ? null : triggerWidth)"
  526. [cdkConnectedOverlayWidth]="$any(nzDropdownMatchSelectWidth ? triggerWidth : null)"
  527. (overlayOutsideClick)="onClickOutside($event)"
  528. (detach)="closeDropDown()"
  529. (positionChange)="onPositionChange($event)"
  530. >
  531. <div
  532. [@slideMotion]="'enter'"
  533. [class]="dropdownClassName"
  534. [@.disabled]="!!noAnimation?.nzNoAnimation"
  535. [nzNoAnimation]="noAnimation?.nzNoAnimation"
  536. [class.ant-select-dropdown-placement-bottomLeft]="dropdownPosition === 'bottom'"
  537. [class.ant-select-dropdown-placement-topLeft]="dropdownPosition === 'top'"
  538. [class.ant-tree-select-dropdown-rtl]="dir === 'rtl'"
  539. [dir]="dir"
  540. [style]="nzDropdownStyle"
  541. >
  542. <nz-tree
  543. #treeRef
  544. [hidden]="isNotFound"
  545. nzNoAnimation
  546. nzSelectMode
  547. nzBlockNode
  548. [nzData]="nzNodes"
  549. [nzMultiple]="nzMultiple"
  550. [nzSearchValue]="inputValue"
  551. [nzHideUnMatched]="nzHideUnMatched"
  552. [nzShowIcon]="nzShowIcon"
  553. [nzCheckable]="nzCheckable"
  554. [nzAsyncData]="nzAsyncData"
  555. [nzShowExpand]="nzShowExpand"
  556. [nzShowLine]="nzShowLine"
  557. [nzExpandedIcon]="nzExpandedIcon"
  558. [nzExpandAll]="nzDefaultExpandAll"
  559. [nzExpandedKeys]="expandedKeys"
  560. [nzCheckedKeys]="nzCheckable ? value : []"
  561. [nzSelectedKeys]="!nzCheckable ? value : []"
  562. [nzTreeTemplate]="treeTemplate"
  563. [nzCheckStrictly]="nzCheckStrictly"
  564. [nzVirtualItemSize]="nzVirtualItemSize"
  565. [nzVirtualMaxBufferPx]="nzVirtualMaxBufferPx"
  566. [nzVirtualMinBufferPx]="nzVirtualMinBufferPx"
  567. [nzVirtualHeight]="nzVirtualHeight"
  568. (nzExpandChange)="onExpandedKeysChange($event)"
  569. (nzClick)="nzTreeClick.emit($event)"
  570. (nzCheckedKeysChange)="updateSelectedNodes()"
  571. (nzSelectedKeysChange)="updateSelectedNodes()"
  572. (nzCheckboxChange)="nzTreeCheckboxChange.emit($event)"
  573. (nzSearchValueChange)="setSearchValues($event)"
  574. ></nz-tree>
  575. @if (nzNodes.length === 0 || isNotFound) {
  576. <span class="ant-select-not-found">
  577. <nz-embed-empty [nzComponentName]="'tree-select'" [specificContent]="nzNotFoundContent"></nz-embed-empty>
  578. </span>
  579. }
  580. </div>
  581. </ng-template>
  582. <div cdkOverlayOrigin class="ant-select-selector">
  583. @if (isMultiple) {
  584. @for (node of selectedNodes | slice: 0 : nzMaxTagCount; track node.key) {
  585. <nz-select-item
  586. [deletable]="true"
  587. [disabled]="node.isDisabled || nzDisabled"
  588. [label]="nzDisplayWith(node)"
  589. (delete)="removeSelected(node, true)"
  590. ></nz-select-item>
  591. }
  592. @if (selectedNodes.length > nzMaxTagCount) {
  593. <nz-select-item
  594. [contentTemplateOutlet]="nzMaxTagPlaceholder"
  595. [contentTemplateOutletContext]="selectedNodes | slice: nzMaxTagCount"
  596. [deletable]="false"
  597. [disabled]="false"
  598. [label]="'+ ' + (selectedNodes.length - nzMaxTagCount) + ' ...'"
  599. ></nz-select-item>
  600. }
  601. }
  602. <nz-select-search
  603. [nzId]="nzId"
  604. [showInput]="nzShowSearch"
  605. (keydown)="onKeyDownInput($event)"
  606. (isComposingChange)="isComposingChange($event)"
  607. (valueChange)="setInputValue($event)"
  608. [value]="inputValue"
  609. [mirrorSync]="isMultiple"
  610. [disabled]="nzDisabled"
  611. [focusTrigger]="nzOpen"
  612. ></nz-select-search>
  613. @if (nzPlaceHolder && selectedNodes.length === 0) {
  614. <nz-select-placeholder
  615. [placeholder]="nzPlaceHolder"
  616. [style.display]="placeHolderDisplay"
  617. ></nz-select-placeholder>
  618. }
  619. @if (!isMultiple && selectedNodes.length === 1 && !isComposing && inputValue === '') {
  620. <nz-select-item
  621. [deletable]="false"
  622. [disabled]="false"
  623. [label]="nzDisplayWith(selectedNodes[0])"
  624. ></nz-select-item>
  625. }
  626. @if (!isMultiple) {
  627. <nz-select-arrow></nz-select-arrow>
  628. }
  629. @if (!isMultiple || (hasFeedback && !!status)) {
  630. <nz-select-arrow [showArrow]="!isMultiple" [feedbackIcon]="feedbackIconTpl">
  631. <ng-template #feedbackIconTpl>
  632. @if (hasFeedback && !!status) {
  633. <nz-form-item-feedback-icon [status]="status"></nz-form-item-feedback-icon>
  634. }
  635. </ng-template>
  636. </nz-select-arrow>
  637. }
  638. @if (nzAllowClear && !nzDisabled && selectedNodes.length) {
  639. <nz-select-clear (clear)="onClearSelection()"></nz-select-clear>
  640. }
  641. </div>
  642. `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzOverlayModule }, { kind: "directive", type: i6.NzConnectedOverlayDirective, selector: "[cdkConnectedOverlay][nzConnectedOverlay]", inputs: ["nzArrowPointAtCenter"], exportAs: ["nzConnectedOverlay"] }, { kind: "directive", type: CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: NzNoAnimationDirective, selector: "[nzNoAnimation]", inputs: ["nzNoAnimation"], exportAs: ["nzNoAnimation"] }, { kind: "ngmodule", type: NzTreeModule }, { kind: "component", type: i7.NzTreeComponent, selector: "nz-tree", inputs: ["nzShowIcon", "nzHideUnMatched", "nzBlockNode", "nzExpandAll", "nzSelectMode", "nzCheckStrictly", "nzShowExpand", "nzShowLine", "nzCheckable", "nzAsyncData", "nzDraggable", "nzMultiple", "nzExpandedIcon", "nzVirtualItemSize", "nzVirtualMaxBufferPx", "nzVirtualMinBufferPx", "nzVirtualHeight", "nzTreeTemplate", "nzBeforeDrop", "nzData", "nzExpandedKeys", "nzSelectedKeys", "nzCheckedKeys", "nzSearchValue", "nzSearchFunc"], outputs: ["nzExpandedKeysChange", "nzSelectedKeysChange", "nzCheckedKeysChange", "nzSearchValueChange", "nzClick", "nzDblClick", "nzContextMenu", "nzCheckboxChange", "nzExpandChange", "nzOnDragStart", "nzOnDragEnter", "nzOnDragOver", "nzOnDragLeave", "nzOnDrop", "nzOnDragEnd"], exportAs: ["nzTree"] }, { kind: "ngmodule", type: NzEmptyModule }, { kind: "component", type: i8.NzEmbedEmptyComponent, selector: "nz-embed-empty", inputs: ["nzComponentName", "specificContent"], exportAs: ["nzEmbedEmpty"] }, { kind: "directive", type: CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "pipe", type: SlicePipe, name: "slice" }, { kind: "ngmodule", type: NzSelectModule }, { kind: "component", type: i9.NzSelectArrowComponent, selector: "nz-select-arrow", inputs: ["listOfValue", "loading", "search", "showArrow", "isMaxMultipleCountSet", "suffixIcon", "feedbackIcon", "nzMaxMultipleCount"] }, { kind: "component", type: i9.NzSelectClearComponent, selector: "nz-select-clear", inputs: ["clearIcon"], outputs: ["clear"] }, { kind: "component", type: i9.NzSelectItemComponent, selector: "nz-select-item", inputs: ["disabled", "label", "deletable", "removeIcon", "contentTemplateOutletContext", "contentTemplateOutlet"], outputs: ["delete"] }, { kind: "component", type: i9.NzSelectPlaceholderComponent, selector: "nz-select-placeholder", inputs: ["placeholder"] }, { kind: "component", type: i9.NzSelectSearchComponent, selector: "nz-select-search", inputs: ["nzId", "disabled", "mirrorSync", "showInput", "focusTrigger", "value", "autofocus"], outputs: ["valueChange", "isComposingChange"] }, { kind: "component", type: NzFormItemFeedbackIconComponent, selector: "nz-form-item-feedback-icon", inputs: ["status"], exportAs: ["nzFormFeedbackIcon"] }], animations: [slideMotion] });
  643. };
  644. })();
  645. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeSelectComponent, decorators: [{
  646. type: Component,
  647. args: [{
  648. selector: 'nz-tree-select',
  649. exportAs: 'nzTreeSelect',
  650. imports: [
  651. NzOverlayModule,
  652. CdkConnectedOverlay,
  653. NzNoAnimationDirective,
  654. NzTreeModule,
  655. NzEmptyModule,
  656. CdkOverlayOrigin,
  657. SlicePipe,
  658. NzSelectModule,
  659. NzFormItemFeedbackIconComponent
  660. ],
  661. animations: [slideMotion],
  662. template: `
  663. <ng-template
  664. cdkConnectedOverlay
  665. nzConnectedOverlay
  666. [cdkConnectedOverlayHasBackdrop]="nzBackdrop"
  667. [cdkConnectedOverlayOrigin]="cdkOverlayOrigin"
  668. [cdkConnectedOverlayPositions]="nzPlacement ? positions : []"
  669. [cdkConnectedOverlayOpen]="nzOpen"
  670. [cdkConnectedOverlayTransformOriginOn]="'.ant-select-tree-dropdown'"
  671. [cdkConnectedOverlayMinWidth]="$any(nzDropdownMatchSelectWidth ? null : triggerWidth)"
  672. [cdkConnectedOverlayWidth]="$any(nzDropdownMatchSelectWidth ? triggerWidth : null)"
  673. (overlayOutsideClick)="onClickOutside($event)"
  674. (detach)="closeDropDown()"
  675. (positionChange)="onPositionChange($event)"
  676. >
  677. <div
  678. [@slideMotion]="'enter'"
  679. [class]="dropdownClassName"
  680. [@.disabled]="!!noAnimation?.nzNoAnimation"
  681. [nzNoAnimation]="noAnimation?.nzNoAnimation"
  682. [class.ant-select-dropdown-placement-bottomLeft]="dropdownPosition === 'bottom'"
  683. [class.ant-select-dropdown-placement-topLeft]="dropdownPosition === 'top'"
  684. [class.ant-tree-select-dropdown-rtl]="dir === 'rtl'"
  685. [dir]="dir"
  686. [style]="nzDropdownStyle"
  687. >
  688. <nz-tree
  689. #treeRef
  690. [hidden]="isNotFound"
  691. nzNoAnimation
  692. nzSelectMode
  693. nzBlockNode
  694. [nzData]="nzNodes"
  695. [nzMultiple]="nzMultiple"
  696. [nzSearchValue]="inputValue"
  697. [nzHideUnMatched]="nzHideUnMatched"
  698. [nzShowIcon]="nzShowIcon"
  699. [nzCheckable]="nzCheckable"
  700. [nzAsyncData]="nzAsyncData"
  701. [nzShowExpand]="nzShowExpand"
  702. [nzShowLine]="nzShowLine"
  703. [nzExpandedIcon]="nzExpandedIcon"
  704. [nzExpandAll]="nzDefaultExpandAll"
  705. [nzExpandedKeys]="expandedKeys"
  706. [nzCheckedKeys]="nzCheckable ? value : []"
  707. [nzSelectedKeys]="!nzCheckable ? value : []"
  708. [nzTreeTemplate]="treeTemplate"
  709. [nzCheckStrictly]="nzCheckStrictly"
  710. [nzVirtualItemSize]="nzVirtualItemSize"
  711. [nzVirtualMaxBufferPx]="nzVirtualMaxBufferPx"
  712. [nzVirtualMinBufferPx]="nzVirtualMinBufferPx"
  713. [nzVirtualHeight]="nzVirtualHeight"
  714. (nzExpandChange)="onExpandedKeysChange($event)"
  715. (nzClick)="nzTreeClick.emit($event)"
  716. (nzCheckedKeysChange)="updateSelectedNodes()"
  717. (nzSelectedKeysChange)="updateSelectedNodes()"
  718. (nzCheckboxChange)="nzTreeCheckboxChange.emit($event)"
  719. (nzSearchValueChange)="setSearchValues($event)"
  720. ></nz-tree>
  721. @if (nzNodes.length === 0 || isNotFound) {
  722. <span class="ant-select-not-found">
  723. <nz-embed-empty [nzComponentName]="'tree-select'" [specificContent]="nzNotFoundContent"></nz-embed-empty>
  724. </span>
  725. }
  726. </div>
  727. </ng-template>
  728. <div cdkOverlayOrigin class="ant-select-selector">
  729. @if (isMultiple) {
  730. @for (node of selectedNodes | slice: 0 : nzMaxTagCount; track node.key) {
  731. <nz-select-item
  732. [deletable]="true"
  733. [disabled]="node.isDisabled || nzDisabled"
  734. [label]="nzDisplayWith(node)"
  735. (delete)="removeSelected(node, true)"
  736. ></nz-select-item>
  737. }
  738. @if (selectedNodes.length > nzMaxTagCount) {
  739. <nz-select-item
  740. [contentTemplateOutlet]="nzMaxTagPlaceholder"
  741. [contentTemplateOutletContext]="selectedNodes | slice: nzMaxTagCount"
  742. [deletable]="false"
  743. [disabled]="false"
  744. [label]="'+ ' + (selectedNodes.length - nzMaxTagCount) + ' ...'"
  745. ></nz-select-item>
  746. }
  747. }
  748. <nz-select-search
  749. [nzId]="nzId"
  750. [showInput]="nzShowSearch"
  751. (keydown)="onKeyDownInput($event)"
  752. (isComposingChange)="isComposingChange($event)"
  753. (valueChange)="setInputValue($event)"
  754. [value]="inputValue"
  755. [mirrorSync]="isMultiple"
  756. [disabled]="nzDisabled"
  757. [focusTrigger]="nzOpen"
  758. ></nz-select-search>
  759. @if (nzPlaceHolder && selectedNodes.length === 0) {
  760. <nz-select-placeholder
  761. [placeholder]="nzPlaceHolder"
  762. [style.display]="placeHolderDisplay"
  763. ></nz-select-placeholder>
  764. }
  765. @if (!isMultiple && selectedNodes.length === 1 && !isComposing && inputValue === '') {
  766. <nz-select-item
  767. [deletable]="false"
  768. [disabled]="false"
  769. [label]="nzDisplayWith(selectedNodes[0])"
  770. ></nz-select-item>
  771. }
  772. @if (!isMultiple) {
  773. <nz-select-arrow></nz-select-arrow>
  774. }
  775. @if (!isMultiple || (hasFeedback && !!status)) {
  776. <nz-select-arrow [showArrow]="!isMultiple" [feedbackIcon]="feedbackIconTpl">
  777. <ng-template #feedbackIconTpl>
  778. @if (hasFeedback && !!status) {
  779. <nz-form-item-feedback-icon [status]="status"></nz-form-item-feedback-icon>
  780. }
  781. </ng-template>
  782. </nz-select-arrow>
  783. }
  784. @if (nzAllowClear && !nzDisabled && selectedNodes.length) {
  785. <nz-select-clear (clear)="onClearSelection()"></nz-select-clear>
  786. }
  787. </div>
  788. `,
  789. providers: [
  790. NzDestroyService,
  791. NzTreeSelectService,
  792. { provide: NZ_SPACE_COMPACT_ITEM_TYPE, useValue: 'select' },
  793. {
  794. provide: NzTreeHigherOrderServiceToken,
  795. useExisting: NzTreeSelectService
  796. },
  797. {
  798. provide: NG_VALUE_ACCESSOR,
  799. useExisting: forwardRef(() => NzTreeSelectComponent),
  800. multi: true
  801. }
  802. ],
  803. host: {
  804. class: 'ant-select ant-tree-select',
  805. '[class.ant-select-in-form-item]': '!!nzFormStatusService',
  806. '[class.ant-select-rtl]': 'dir==="rtl"',
  807. '[class.ant-select-lg]': 'finalSize() === "large"',
  808. '[class.ant-select-sm]': 'finalSize() === "small"',
  809. '[class.ant-select-disabled]': 'nzDisabled',
  810. '[class.ant-select-single]': '!isMultiple',
  811. '[class.ant-select-show-arrow]': '!isMultiple',
  812. '[class.ant-select-show-search]': '!isMultiple',
  813. '[class.ant-select-multiple]': 'isMultiple',
  814. '[class.ant-select-allow-clear]': 'nzAllowClear',
  815. '[class.ant-select-open]': 'nzOpen',
  816. '[class.ant-select-focused]': 'nzOpen || focused',
  817. '(click)': 'trigger()',
  818. '(keydown)': 'onKeydown($event)'
  819. },
  820. hostDirectives: [NzSpaceCompactItemDirective]
  821. }]
  822. }], ctorParameters: () => [{ type: NzTreeSelectService }, { type: i2.NzConfigService }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i3.Directionality }, { type: i4.FocusMonitor }], propDecorators: { nzId: [{
  823. type: Input
  824. }], nzAllowClear: [{
  825. type: Input,
  826. args: [{ transform: booleanAttribute }]
  827. }], nzShowExpand: [{
  828. type: Input,
  829. args: [{ transform: booleanAttribute }]
  830. }], nzShowLine: [{
  831. type: Input,
  832. args: [{ transform: booleanAttribute }]
  833. }], nzDropdownMatchSelectWidth: [{
  834. type: Input,
  835. args: [{ transform: booleanAttribute }]
  836. }], nzCheckable: [{
  837. type: Input,
  838. args: [{ transform: booleanAttribute }]
  839. }], nzHideUnMatched: [{
  840. type: Input,
  841. args: [{ transform: booleanAttribute }]
  842. }], nzShowIcon: [{
  843. type: Input,
  844. args: [{ transform: booleanAttribute }]
  845. }], nzShowSearch: [{
  846. type: Input,
  847. args: [{ transform: booleanAttribute }]
  848. }], nzDisabled: [{
  849. type: Input,
  850. args: [{ transform: booleanAttribute }]
  851. }], nzAsyncData: [{
  852. type: Input,
  853. args: [{ transform: booleanAttribute }]
  854. }], nzMultiple: [{
  855. type: Input,
  856. args: [{ transform: booleanAttribute }]
  857. }], nzDefaultExpandAll: [{
  858. type: Input,
  859. args: [{ transform: booleanAttribute }]
  860. }], nzCheckStrictly: [{
  861. type: Input,
  862. args: [{ transform: booleanAttribute }]
  863. }], nzVirtualItemSize: [{
  864. type: Input
  865. }], nzVirtualMaxBufferPx: [{
  866. type: Input
  867. }], nzVirtualMinBufferPx: [{
  868. type: Input
  869. }], nzVirtualHeight: [{
  870. type: Input
  871. }], nzExpandedIcon: [{
  872. type: Input
  873. }], nzNotFoundContent: [{
  874. type: Input
  875. }], nzNodes: [{
  876. type: Input
  877. }], nzOpen: [{
  878. type: Input
  879. }], nzSize: [{
  880. type: Input
  881. }], nzPlaceHolder: [{
  882. type: Input
  883. }], nzDropdownStyle: [{
  884. type: Input
  885. }], nzDropdownClassName: [{
  886. type: Input
  887. }], nzBackdrop: [{
  888. type: Input
  889. }], nzStatus: [{
  890. type: Input
  891. }], nzPlacement: [{
  892. type: Input
  893. }], nzExpandedKeys: [{
  894. type: Input
  895. }], nzDisplayWith: [{
  896. type: Input
  897. }], nzMaxTagCount: [{
  898. type: Input,
  899. args: [{ transform: numberAttribute }]
  900. }], nzMaxTagPlaceholder: [{
  901. type: Input
  902. }], nzOpenChange: [{
  903. type: Output
  904. }], nzCleared: [{
  905. type: Output
  906. }], nzRemoved: [{
  907. type: Output
  908. }], nzExpandChange: [{
  909. type: Output
  910. }], nzTreeClick: [{
  911. type: Output
  912. }], nzTreeCheckboxChange: [{
  913. type: Output
  914. }], nzSelectSearchComponent: [{
  915. type: ViewChild,
  916. args: [NzSelectSearchComponent, { static: false }]
  917. }], treeRef: [{
  918. type: ViewChild,
  919. args: ['treeRef', { static: false }]
  920. }], cdkOverlayOrigin: [{
  921. type: ViewChild,
  922. args: [CdkOverlayOrigin, { static: true }]
  923. }], cdkConnectedOverlay: [{
  924. type: ViewChild,
  925. args: [CdkConnectedOverlay, { static: false }]
  926. }], nzTreeTemplate: [{
  927. type: Input
  928. }], nzTreeTemplateChild: [{
  929. type: ContentChild,
  930. args: ['nzTreeTemplate', { static: true }]
  931. }] } });
  932. /**
  933. * Use of this source code is governed by an MIT-style license that can be
  934. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  935. */
  936. class NzTreeSelectModule {
  937. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
  938. static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.2", ngImport: i0, type: NzTreeSelectModule, imports: [NzTreeSelectComponent], exports: [NzTreeSelectComponent] });
  939. static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeSelectModule, imports: [NzTreeSelectComponent] });
  940. }
  941. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTreeSelectModule, decorators: [{
  942. type: NgModule,
  943. args: [{
  944. imports: [NzTreeSelectComponent],
  945. exports: [NzTreeSelectComponent]
  946. }]
  947. }] });
  948. /**
  949. * Use of this source code is governed by an MIT-style license that can be
  950. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  951. */
  952. /**
  953. * Generated bundle index. Do not edit.
  954. */
  955. export { NzTreeSelectComponent, NzTreeSelectModule, NzTreeSelectService };
  956. //# sourceMappingURL=ng-zorro-antd-tree-select.mjs.map