ng-zorro-antd-transfer.mjs 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114
  1. import { NgTemplateOutlet } from '@angular/common';
  2. import * as i0 from '@angular/core';
  3. import { EventEmitter, booleanAttribute, Output, Input, ChangeDetectionStrategy, ViewEncapsulation, Component, ElementRef, ViewChildren, ViewChild, inject, HostListener, NgModule } from '@angular/core';
  4. import { merge, Subject, of } from 'rxjs';
  5. import { startWith, switchMap, distinctUntilChanged, withLatestFrom, map, takeUntil } from 'rxjs/operators';
  6. import * as i4$1 from 'ng-zorro-antd/button';
  7. import { NzButtonModule } from 'ng-zorro-antd/button';
  8. import * as i1$1 from 'ng-zorro-antd/checkbox';
  9. import { NzCheckboxModule, NzCheckboxComponent } from 'ng-zorro-antd/checkbox';
  10. import { fromEventOutsideAngular, toArray, getStatusClassNames } from 'ng-zorro-antd/core/util';
  11. import * as i2 from 'ng-zorro-antd/empty';
  12. import { NzEmptyModule } from 'ng-zorro-antd/empty';
  13. import * as i3 from 'ng-zorro-antd/icon';
  14. import { NzIconModule } from 'ng-zorro-antd/icon';
  15. import * as i1 from '@angular/forms';
  16. import { FormsModule } from '@angular/forms';
  17. import * as i4 from 'ng-zorro-antd/core/transition-patch';
  18. import { NzFormStatusService, NzFormNoStatusService } from 'ng-zorro-antd/core/form';
  19. import * as i1$2 from 'ng-zorro-antd/i18n';
  20. import * as i2$1 from '@angular/cdk/bidi';
  21. import * as i6 from 'ng-zorro-antd/core/wave';
  22. /**
  23. * Use of this source code is governed by an MIT-style license that can be
  24. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  25. */
  26. /**
  27. * Use of this source code is governed by an MIT-style license that can be
  28. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  29. */
  30. class NzTransferSearchComponent {
  31. cdr;
  32. // region: fields
  33. placeholder;
  34. value;
  35. disabled = false;
  36. valueChanged = new EventEmitter();
  37. valueClear = new EventEmitter();
  38. // endregion
  39. constructor(cdr) {
  40. this.cdr = cdr;
  41. }
  42. _handle() {
  43. this.valueChanged.emit(this.value);
  44. }
  45. _clear() {
  46. if (this.disabled) {
  47. return;
  48. }
  49. this.value = '';
  50. this.valueClear.emit();
  51. }
  52. ngOnChanges() {
  53. this.cdr.detectChanges();
  54. }
  55. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTransferSearchComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
  56. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzTransferSearchComponent, isStandalone: true, selector: "[nz-transfer-search]", inputs: { placeholder: "placeholder", value: "value", disabled: ["disabled", "disabled", booleanAttribute] }, outputs: { valueChanged: "valueChanged", valueClear: "valueClear" }, exportAs: ["nzTransferSearch"], usesOnChanges: true, ngImport: i0, template: `
  57. <span class="ant-input-prefix">
  58. <nz-icon nzType="search" />
  59. </span>
  60. <input
  61. [(ngModel)]="value"
  62. (ngModelChange)="_handle()"
  63. [disabled]="disabled"
  64. [placeholder]="placeholder"
  65. class="ant-input"
  66. [class]="{ 'ant-input-disabled': disabled }"
  67. />
  68. @if (value && value.length > 0) {
  69. <span class="ant-input-suffix" (click)="_clear()">
  70. <nz-icon nzType="close-circle" nzTheme="fill" class="ant-input-clear-icon" />
  71. </span>
  72. }
  73. `, isInline: true, dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i3.NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  74. }
  75. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTransferSearchComponent, decorators: [{
  76. type: Component,
  77. args: [{
  78. selector: '[nz-transfer-search]',
  79. exportAs: 'nzTransferSearch',
  80. preserveWhitespaces: false,
  81. template: `
  82. <span class="ant-input-prefix">
  83. <nz-icon nzType="search" />
  84. </span>
  85. <input
  86. [(ngModel)]="value"
  87. (ngModelChange)="_handle()"
  88. [disabled]="disabled"
  89. [placeholder]="placeholder"
  90. class="ant-input"
  91. [class]="{ 'ant-input-disabled': disabled }"
  92. />
  93. @if (value && value.length > 0) {
  94. <span class="ant-input-suffix" (click)="_clear()">
  95. <nz-icon nzType="close-circle" nzTheme="fill" class="ant-input-clear-icon" />
  96. </span>
  97. }
  98. `,
  99. encapsulation: ViewEncapsulation.None,
  100. changeDetection: ChangeDetectionStrategy.OnPush,
  101. imports: [FormsModule, NzIconModule]
  102. }]
  103. }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { placeholder: [{
  104. type: Input
  105. }], value: [{
  106. type: Input
  107. }], disabled: [{
  108. type: Input,
  109. args: [{ transform: booleanAttribute }]
  110. }], valueChanged: [{
  111. type: Output
  112. }], valueClear: [{
  113. type: Output
  114. }] } });
  115. /**
  116. * Use of this source code is governed by an MIT-style license that can be
  117. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  118. */
  119. class NzTransferListComponent {
  120. cdr;
  121. // #region fields
  122. direction = 'left';
  123. titleText = '';
  124. showSelectAll = true;
  125. dataSource = [];
  126. itemUnit = '';
  127. itemsUnit = '';
  128. filter = '';
  129. oneWay = false;
  130. disabled = false;
  131. showSearch;
  132. searchPlaceholder;
  133. notFoundContent;
  134. filterOption;
  135. renderList = null;
  136. render = null;
  137. footer = null;
  138. // events
  139. handleSelectAll = new EventEmitter();
  140. handleSelect = new EventEmitter();
  141. filterChange = new EventEmitter();
  142. moveToLeft = new EventEmitter();
  143. headerCheckbox;
  144. checkboxes;
  145. stat = {
  146. checkAll: false,
  147. checkHalf: false,
  148. checkCount: 0,
  149. shownCount: 0,
  150. availableCount: 0
  151. };
  152. get validData() {
  153. return this.dataSource.filter(w => !w.hide);
  154. }
  155. get availableData() {
  156. // filter disabled data
  157. return this.validData.filter(w => !w.disabled);
  158. }
  159. onItemSelect = (item) => {
  160. if (this.disabled || item.disabled) {
  161. return;
  162. }
  163. item.checked = !item.checked;
  164. this.updateCheckStatus();
  165. this.handleSelect.emit(item);
  166. };
  167. onItemSelectAll = (status) => {
  168. this.dataSource.forEach(item => {
  169. if (!item.disabled && !item.hide) {
  170. item.checked = status;
  171. }
  172. });
  173. this.updateCheckStatus();
  174. this.handleSelectAll.emit(status);
  175. };
  176. updateCheckStatus() {
  177. const validCount = this.dataSource.filter(w => !w.disabled).length;
  178. this.stat.checkCount = this.dataSource.filter(w => w.checked && !w.disabled).length;
  179. this.stat.shownCount = this.validData.length;
  180. this.stat.availableCount = this.availableData.length;
  181. this.stat.checkAll = validCount > 0 && validCount === this.stat.checkCount;
  182. this.stat.checkHalf = this.stat.checkCount > 0 && !this.stat.checkAll;
  183. // Note: this is done explicitly since the internal `nzChecked` value may not be updated in edge cases.
  184. // Consider the following flow:
  185. // 1) the initial value of `stat.checkAll` is `false`
  186. // 2) the user filters items
  187. // 3) the user clicks "Select All" checkbox
  188. // 4) the `NzCheckboxComponent` sets `nzChecked` to `true` internally
  189. // 5) the user clicks "Move to right"
  190. // 6) items are moved and the `updateCheckStatus` is invoked
  191. // 7) the `stat.checkAll` value has never been updated in this flow, it's always been `false`
  192. // 8) the `nzChecked` is still `true` and the checkbox is not unchecked
  193. // This is because Angular checks bindings and it checked that `[nzChecked]="stat.checkAll"` has
  194. // never been updated, so Angular did not set new `nzChecked` value on the checkbox.
  195. this.headerCheckbox && (this.headerCheckbox.nzChecked = this.stat.checkAll);
  196. }
  197. // #endregion
  198. // #region search
  199. handleFilter(value) {
  200. this.filter = value;
  201. this.dataSource.forEach(item => {
  202. item.hide = value.length > 0 && !this.matchFilter(value, item);
  203. });
  204. this.stat.shownCount = this.validData.length;
  205. this.stat.availableCount = this.availableData.length;
  206. this.filterChange.emit({ direction: this.direction, value });
  207. }
  208. handleClear() {
  209. this.handleFilter('');
  210. }
  211. deleteItem(item) {
  212. item.checked = true;
  213. this.handleSelect.emit(item);
  214. this.moveToLeft.emit();
  215. }
  216. matchFilter(text, item) {
  217. if (this.filterOption) {
  218. return this.filterOption(text, item);
  219. }
  220. return item.title.includes(text);
  221. }
  222. // #endregion
  223. constructor(cdr) {
  224. this.cdr = cdr;
  225. }
  226. markForCheck() {
  227. this.updateCheckStatus();
  228. this.cdr.markForCheck();
  229. }
  230. ngAfterViewInit() {
  231. this.checkboxes.changes
  232. .pipe(startWith(this.checkboxes), switchMap(() => {
  233. const checkboxes = this.checkboxes.toArray();
  234. return merge(...checkboxes.map(checkbox => fromEventOutsideAngular(checkbox.nativeElement, 'click')));
  235. }))
  236. .subscribe(event => {
  237. event.stopPropagation();
  238. });
  239. }
  240. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTransferListComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
  241. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzTransferListComponent, isStandalone: true, selector: "nz-transfer-list", inputs: { direction: "direction", titleText: "titleText", showSelectAll: "showSelectAll", dataSource: "dataSource", itemUnit: "itemUnit", itemsUnit: "itemsUnit", filter: "filter", oneWay: "oneWay", disabled: ["disabled", "disabled", booleanAttribute], showSearch: ["showSearch", "showSearch", booleanAttribute], searchPlaceholder: "searchPlaceholder", notFoundContent: "notFoundContent", filterOption: "filterOption", renderList: "renderList", render: "render", footer: "footer" }, outputs: { handleSelectAll: "handleSelectAll", handleSelect: "handleSelect", filterChange: "filterChange", moveToLeft: "moveToLeft" }, host: { properties: { "class.ant-transfer-list-with-footer": "!!footer" }, classAttribute: "ant-transfer-list" }, viewQueries: [{ propertyName: "headerCheckbox", first: true, predicate: ["headerCheckbox"], descendants: true, read: NzCheckboxComponent }, { propertyName: "checkboxes", predicate: ["checkboxes"], descendants: true, read: ElementRef }], exportAs: ["nzTransferList"], ngImport: i0, template: `
  242. <div class="ant-transfer-list-header">
  243. @if (showSelectAll && !oneWay) {
  244. <label
  245. class="ant-transfer-list-checkbox"
  246. nz-checkbox
  247. #headerCheckbox
  248. [nzChecked]="stat.checkAll"
  249. (nzCheckedChange)="onItemSelectAll($event)"
  250. [nzIndeterminate]="stat.checkHalf"
  251. [nzDisabled]="stat.availableCount === 0 || disabled"
  252. ></label>
  253. }
  254. <span class="ant-transfer-list-header-selected">
  255. <span>
  256. @if (!oneWay) {
  257. {{ (stat.checkCount > 0 ? stat.checkCount + '/' : '') + stat.shownCount }}
  258. } @else {
  259. {{ stat.shownCount }}
  260. }
  261. {{ validData.length > 1 ? itemsUnit : itemUnit }}
  262. </span>
  263. </span>
  264. @if (titleText) {
  265. <span class="ant-transfer-list-header-title">{{ titleText }}</span>
  266. }
  267. </div>
  268. <div class="ant-transfer-list-body" [class.ant-transfer-list-body-with-search]="showSearch">
  269. @if (showSearch) {
  270. <div class="ant-transfer-list-body-search-wrapper">
  271. <span
  272. nz-transfer-search
  273. class="ant-input-affix-wrapper ant-transfer-list-search"
  274. (valueChanged)="handleFilter($event)"
  275. (valueClear)="handleClear()"
  276. [placeholder]="searchPlaceholder"
  277. [disabled]="disabled"
  278. [value]="filter"
  279. ></span>
  280. </div>
  281. }
  282. @if (renderList) {
  283. <div class="ant-transfer-list-body-customize-wrapper">
  284. <ng-container
  285. *ngTemplateOutlet="
  286. renderList;
  287. context: {
  288. $implicit: validData,
  289. direction: direction,
  290. disabled: disabled,
  291. onItemSelectAll: onItemSelectAll,
  292. onItemSelect: onItemSelect,
  293. stat: stat
  294. }
  295. "
  296. ></ng-container>
  297. </div>
  298. } @else {
  299. @if (stat.shownCount > 0) {
  300. <ul class="ant-transfer-list-content">
  301. @for (item of validData; track item.key) {
  302. <li
  303. (click)="!oneWay ? onItemSelect(item) : null"
  304. class="ant-transfer-list-content-item"
  305. [class]="{ 'ant-transfer-list-content-item-disabled': disabled || item.disabled }"
  306. >
  307. @if (!oneWay) {
  308. <label
  309. #checkboxes
  310. nz-checkbox
  311. [nzChecked]="item.checked"
  312. (nzCheckedChange)="onItemSelect(item)"
  313. [nzDisabled]="disabled || item.disabled"
  314. >
  315. @if (!render) {
  316. {{ item.title }}
  317. } @else {
  318. <ng-template
  319. [ngTemplateOutlet]="render"
  320. [ngTemplateOutletContext]="{ $implicit: item }"
  321. ></ng-template>
  322. }
  323. </label>
  324. } @else {
  325. @if (!render) {
  326. <span class="ant-transfer-list-content-item-text">
  327. {{ item.title }}
  328. </span>
  329. <div
  330. class="ant-transfer-list-content-item-remove"
  331. [class]="{ 'ant-transfer-list-content-item-disabled': disabled || item.disabled }"
  332. (click)="!(disabled || item.disabled) ? deleteItem(item) : null"
  333. >
  334. <nz-icon nzType="delete" nzTheme="outline" />
  335. </div>
  336. } @else {
  337. <ng-template
  338. [ngTemplateOutlet]="render"
  339. [ngTemplateOutletContext]="{ $implicit: item }"
  340. ></ng-template>
  341. }
  342. }
  343. </li>
  344. }
  345. </ul>
  346. } @else {
  347. <div class="ant-transfer-list-body-not-found">
  348. <nz-embed-empty [nzComponentName]="'transfer'" [specificContent]="notFoundContent"></nz-embed-empty>
  349. </div>
  350. }
  351. }
  352. </div>
  353. @if (footer) {
  354. <div class="ant-transfer-list-footer">
  355. <ng-template [ngTemplateOutlet]="footer" [ngTemplateOutletContext]="{ $implicit: direction }"></ng-template>
  356. </div>
  357. }
  358. `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzCheckboxModule }, { kind: "component", type: i1$1.NzCheckboxComponent, selector: "[nz-checkbox]", inputs: ["nzValue", "nzAutoFocus", "nzDisabled", "nzIndeterminate", "nzChecked", "nzId", "nzName"], outputs: ["nzCheckedChange"], exportAs: ["nzCheckbox"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: NzEmptyModule }, { kind: "component", type: i2.NzEmbedEmptyComponent, selector: "nz-embed-empty", inputs: ["nzComponentName", "specificContent"], exportAs: ["nzEmbedEmpty"] }, { kind: "component", type: NzTransferSearchComponent, selector: "[nz-transfer-search]", inputs: ["placeholder", "value", "disabled"], outputs: ["valueChanged", "valueClear"], exportAs: ["nzTransferSearch"] }, { kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i3.NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "ngmodule", type: NzButtonModule }, { kind: "directive", type: i4.ɵNzTransitionPatchDirective, selector: "[nz-button], nz-button-group, [nz-icon], nz-icon, [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  359. }
  360. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTransferListComponent, decorators: [{
  361. type: Component,
  362. args: [{
  363. selector: 'nz-transfer-list',
  364. exportAs: 'nzTransferList',
  365. preserveWhitespaces: false,
  366. template: `
  367. <div class="ant-transfer-list-header">
  368. @if (showSelectAll && !oneWay) {
  369. <label
  370. class="ant-transfer-list-checkbox"
  371. nz-checkbox
  372. #headerCheckbox
  373. [nzChecked]="stat.checkAll"
  374. (nzCheckedChange)="onItemSelectAll($event)"
  375. [nzIndeterminate]="stat.checkHalf"
  376. [nzDisabled]="stat.availableCount === 0 || disabled"
  377. ></label>
  378. }
  379. <span class="ant-transfer-list-header-selected">
  380. <span>
  381. @if (!oneWay) {
  382. {{ (stat.checkCount > 0 ? stat.checkCount + '/' : '') + stat.shownCount }}
  383. } @else {
  384. {{ stat.shownCount }}
  385. }
  386. {{ validData.length > 1 ? itemsUnit : itemUnit }}
  387. </span>
  388. </span>
  389. @if (titleText) {
  390. <span class="ant-transfer-list-header-title">{{ titleText }}</span>
  391. }
  392. </div>
  393. <div class="ant-transfer-list-body" [class.ant-transfer-list-body-with-search]="showSearch">
  394. @if (showSearch) {
  395. <div class="ant-transfer-list-body-search-wrapper">
  396. <span
  397. nz-transfer-search
  398. class="ant-input-affix-wrapper ant-transfer-list-search"
  399. (valueChanged)="handleFilter($event)"
  400. (valueClear)="handleClear()"
  401. [placeholder]="searchPlaceholder"
  402. [disabled]="disabled"
  403. [value]="filter"
  404. ></span>
  405. </div>
  406. }
  407. @if (renderList) {
  408. <div class="ant-transfer-list-body-customize-wrapper">
  409. <ng-container
  410. *ngTemplateOutlet="
  411. renderList;
  412. context: {
  413. $implicit: validData,
  414. direction: direction,
  415. disabled: disabled,
  416. onItemSelectAll: onItemSelectAll,
  417. onItemSelect: onItemSelect,
  418. stat: stat
  419. }
  420. "
  421. ></ng-container>
  422. </div>
  423. } @else {
  424. @if (stat.shownCount > 0) {
  425. <ul class="ant-transfer-list-content">
  426. @for (item of validData; track item.key) {
  427. <li
  428. (click)="!oneWay ? onItemSelect(item) : null"
  429. class="ant-transfer-list-content-item"
  430. [class]="{ 'ant-transfer-list-content-item-disabled': disabled || item.disabled }"
  431. >
  432. @if (!oneWay) {
  433. <label
  434. #checkboxes
  435. nz-checkbox
  436. [nzChecked]="item.checked"
  437. (nzCheckedChange)="onItemSelect(item)"
  438. [nzDisabled]="disabled || item.disabled"
  439. >
  440. @if (!render) {
  441. {{ item.title }}
  442. } @else {
  443. <ng-template
  444. [ngTemplateOutlet]="render"
  445. [ngTemplateOutletContext]="{ $implicit: item }"
  446. ></ng-template>
  447. }
  448. </label>
  449. } @else {
  450. @if (!render) {
  451. <span class="ant-transfer-list-content-item-text">
  452. {{ item.title }}
  453. </span>
  454. <div
  455. class="ant-transfer-list-content-item-remove"
  456. [class]="{ 'ant-transfer-list-content-item-disabled': disabled || item.disabled }"
  457. (click)="!(disabled || item.disabled) ? deleteItem(item) : null"
  458. >
  459. <nz-icon nzType="delete" nzTheme="outline" />
  460. </div>
  461. } @else {
  462. <ng-template
  463. [ngTemplateOutlet]="render"
  464. [ngTemplateOutletContext]="{ $implicit: item }"
  465. ></ng-template>
  466. }
  467. }
  468. </li>
  469. }
  470. </ul>
  471. } @else {
  472. <div class="ant-transfer-list-body-not-found">
  473. <nz-embed-empty [nzComponentName]="'transfer'" [specificContent]="notFoundContent"></nz-embed-empty>
  474. </div>
  475. }
  476. }
  477. </div>
  478. @if (footer) {
  479. <div class="ant-transfer-list-footer">
  480. <ng-template [ngTemplateOutlet]="footer" [ngTemplateOutletContext]="{ $implicit: direction }"></ng-template>
  481. </div>
  482. }
  483. `,
  484. encapsulation: ViewEncapsulation.None,
  485. changeDetection: ChangeDetectionStrategy.OnPush,
  486. host: {
  487. class: 'ant-transfer-list',
  488. '[class.ant-transfer-list-with-footer]': '!!footer'
  489. },
  490. imports: [NzCheckboxModule, NgTemplateOutlet, NzEmptyModule, NzTransferSearchComponent, NzIconModule, NzButtonModule]
  491. }]
  492. }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { direction: [{
  493. type: Input
  494. }], titleText: [{
  495. type: Input
  496. }], showSelectAll: [{
  497. type: Input
  498. }], dataSource: [{
  499. type: Input
  500. }], itemUnit: [{
  501. type: Input
  502. }], itemsUnit: [{
  503. type: Input
  504. }], filter: [{
  505. type: Input
  506. }], oneWay: [{
  507. type: Input
  508. }], disabled: [{
  509. type: Input,
  510. args: [{ transform: booleanAttribute }]
  511. }], showSearch: [{
  512. type: Input,
  513. args: [{ transform: booleanAttribute }]
  514. }], searchPlaceholder: [{
  515. type: Input
  516. }], notFoundContent: [{
  517. type: Input
  518. }], filterOption: [{
  519. type: Input
  520. }], renderList: [{
  521. type: Input
  522. }], render: [{
  523. type: Input
  524. }], footer: [{
  525. type: Input
  526. }], handleSelectAll: [{
  527. type: Output
  528. }], handleSelect: [{
  529. type: Output
  530. }], filterChange: [{
  531. type: Output
  532. }], moveToLeft: [{
  533. type: Output
  534. }], headerCheckbox: [{
  535. type: ViewChild,
  536. args: ['headerCheckbox', { read: NzCheckboxComponent }]
  537. }], checkboxes: [{
  538. type: ViewChildren,
  539. args: ['checkboxes', { read: ElementRef }]
  540. }] } });
  541. class NzTransferComponent {
  542. cdr;
  543. i18n;
  544. elementRef;
  545. renderer;
  546. directionality;
  547. unsubscribe$ = new Subject();
  548. lists;
  549. locale;
  550. leftFilter = '';
  551. rightFilter = '';
  552. dir = 'ltr';
  553. // status
  554. prefixCls = 'ant-transfer';
  555. statusCls = {};
  556. hasFeedback = false;
  557. // #region fields
  558. nzDisabled = false;
  559. nzDataSource = [];
  560. nzTitles = ['', ''];
  561. nzOperations = [];
  562. nzListStyle = {};
  563. nzShowSelectAll = true;
  564. nzItemUnit;
  565. nzItemsUnit;
  566. nzCanMove = (arg) => of(arg.list);
  567. nzRenderList = null;
  568. nzRender = null;
  569. nzFooter = null;
  570. nzShowSearch = false;
  571. nzFilterOption;
  572. nzSearchPlaceholder;
  573. nzNotFoundContent;
  574. nzTargetKeys = [];
  575. nzSelectedKeys = [];
  576. nzStatus = '';
  577. nzOneWay = false;
  578. // events
  579. nzChange = new EventEmitter();
  580. nzSearchChange = new EventEmitter();
  581. nzSelectChange = new EventEmitter();
  582. // #endregion
  583. // #region process data
  584. // left
  585. leftDataSource = [];
  586. lastLeftCheckedIndex;
  587. // right
  588. rightDataSource = [];
  589. lastRightCheckedIndex;
  590. isShiftPressed = false;
  591. onTriggerShiftDown() {
  592. this.isShiftPressed = true;
  593. }
  594. onTriggerShiftUp() {
  595. this.isShiftPressed = false;
  596. }
  597. onTriggerMouseDown(event) {
  598. const isInsideTransfer = event.target.closest('.ant-transfer-list');
  599. if (event.shiftKey && isInsideTransfer) {
  600. event.preventDefault();
  601. }
  602. }
  603. splitDataSource() {
  604. this.leftDataSource = [];
  605. this.rightDataSource = [];
  606. this.nzDataSource.forEach(record => {
  607. if (record.direction === 'right') {
  608. record.direction = 'right';
  609. this.rightDataSource.push(record);
  610. }
  611. else {
  612. record.direction = 'left';
  613. this.leftDataSource.push(record);
  614. }
  615. });
  616. }
  617. getCheckedData(direction) {
  618. return this[direction === 'left' ? 'leftDataSource' : 'rightDataSource'].filter(w => w.checked);
  619. }
  620. handleLeftSelectAll = (checked) => this.handleSelect('left', checked);
  621. handleRightSelectAll = (checked) => this.handleSelect('right', checked);
  622. handleLeftSelect = (item) => this.handleSelect('left', !!item.checked, item);
  623. handleRightSelect = (item) => this.handleSelect('right', !!item.checked, item);
  624. handleSelect(direction, checked, item) {
  625. if (item) {
  626. const datasource = direction === 'left' ? this.leftDataSource : this.rightDataSource;
  627. const currentIndex = datasource.findIndex(i => i.key === item.key);
  628. const lastCheckedIndex = this[direction === 'left' ? 'lastLeftCheckedIndex' : 'lastRightCheckedIndex'] ?? -1;
  629. if (this.isShiftPressed && lastCheckedIndex > -1) {
  630. const start = Math.min(lastCheckedIndex, currentIndex);
  631. const end = Math.max(lastCheckedIndex, currentIndex);
  632. for (let i = start; i <= end; i++) {
  633. const item = datasource[i];
  634. if (!item.disabled) {
  635. item.checked = checked;
  636. }
  637. }
  638. this.markForCheckAllList();
  639. }
  640. this[direction === 'left' ? 'lastLeftCheckedIndex' : 'lastRightCheckedIndex'] = currentIndex;
  641. }
  642. const list = this.getCheckedData(direction);
  643. const count = list.filter(i => !i.disabled).length;
  644. this.updateOperationStatus(direction, count);
  645. this.nzSelectChange.emit({ direction, checked, list, item });
  646. }
  647. handleFilterChange(ret) {
  648. this.nzSearchChange.emit(ret);
  649. }
  650. // #endregion
  651. // #region operation
  652. leftActive = false;
  653. rightActive = false;
  654. updateOperationStatus(direction, count) {
  655. this[direction === 'right' ? 'leftActive' : 'rightActive'] =
  656. (typeof count === 'undefined' ? this.getCheckedData(direction).filter(w => !w.disabled).length : count) > 0;
  657. }
  658. moveToLeft = () => this.moveTo('left');
  659. moveToRight = () => this.moveTo('right');
  660. moveTo(direction) {
  661. const oppositeDirection = direction === 'left' ? 'right' : 'left';
  662. this.updateOperationStatus(oppositeDirection, 0);
  663. const datasource = direction === 'left' ? this.rightDataSource : this.leftDataSource;
  664. const moveList = datasource.filter(item => item.checked === true && !item.disabled);
  665. this.nzCanMove({ direction, list: moveList }).subscribe(newMoveList => this.truthMoveTo(direction, newMoveList.filter(i => !!i)), () => moveList.forEach(i => (i.checked = false)));
  666. }
  667. truthMoveTo(direction, list) {
  668. const oppositeDirection = direction === 'left' ? 'right' : 'left';
  669. const datasource = direction === 'left' ? this.rightDataSource : this.leftDataSource;
  670. const targetDatasource = direction === 'left' ? this.leftDataSource : this.rightDataSource;
  671. for (const item of list) {
  672. item.checked = false;
  673. item.hide = false;
  674. item.direction = direction;
  675. datasource.splice(datasource.indexOf(item), 1);
  676. }
  677. targetDatasource.splice(0, 0, ...list);
  678. this.updateOperationStatus(oppositeDirection);
  679. this.nzChange.emit({ from: oppositeDirection, to: direction, list });
  680. this.markForCheckAllList();
  681. }
  682. nzFormStatusService = inject(NzFormStatusService, { optional: true });
  683. nzFormNoStatusService = inject(NzFormNoStatusService, { optional: true });
  684. // #endregion
  685. constructor(cdr, i18n, elementRef, renderer, directionality) {
  686. this.cdr = cdr;
  687. this.i18n = i18n;
  688. this.elementRef = elementRef;
  689. this.renderer = renderer;
  690. this.directionality = directionality;
  691. }
  692. markForCheckAllList() {
  693. if (!this.lists) {
  694. return;
  695. }
  696. this.lists.forEach(i => i.markForCheck());
  697. }
  698. handleNzTargetKeys() {
  699. const keys = toArray(this.nzTargetKeys);
  700. const hasOwnKey = (e) => e.hasOwnProperty('key');
  701. this.leftDataSource.forEach(e => {
  702. if (hasOwnKey(e) && keys.indexOf(e.key) !== -1 && !e.disabled) {
  703. e.checked = true;
  704. }
  705. });
  706. this.moveToRight();
  707. }
  708. handleNzSelectedKeys() {
  709. const keys = toArray(this.nzSelectedKeys);
  710. this.nzDataSource.forEach(e => {
  711. if (keys.indexOf(e.key) !== -1) {
  712. e.checked = true;
  713. }
  714. });
  715. const term = (ld) => ld.disabled === false && ld.checked === true;
  716. this.rightActive = this.leftDataSource.some(term);
  717. this.leftActive = this.rightDataSource.some(term);
  718. }
  719. ngOnInit() {
  720. this.nzFormStatusService?.formStatusChanges
  721. .pipe(distinctUntilChanged((pre, cur) => {
  722. return pre.status === cur.status && pre.hasFeedback === cur.hasFeedback;
  723. }), withLatestFrom(this.nzFormNoStatusService ? this.nzFormNoStatusService.noFormStatus : of(false)), map(([{ status, hasFeedback }, noStatus]) => ({ status: noStatus ? '' : status, hasFeedback })), takeUntil(this.unsubscribe$))
  724. .subscribe(({ status, hasFeedback }) => {
  725. this.setStatusStyles(status, hasFeedback);
  726. });
  727. this.i18n.localeChange.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
  728. this.locale = this.i18n.getLocaleData('Transfer');
  729. this.markForCheckAllList();
  730. });
  731. this.dir = this.directionality.value;
  732. this.directionality.change?.pipe(takeUntil(this.unsubscribe$)).subscribe((direction) => {
  733. this.dir = direction;
  734. this.cdr.detectChanges();
  735. });
  736. }
  737. ngOnChanges(changes) {
  738. const { nzStatus, nzDataSource, nzTargetKeys, nzSelectedKeys } = changes;
  739. if (nzDataSource) {
  740. this.splitDataSource();
  741. this.updateOperationStatus('left');
  742. this.updateOperationStatus('right');
  743. this.cdr.detectChanges();
  744. this.markForCheckAllList();
  745. }
  746. if (nzTargetKeys) {
  747. this.handleNzTargetKeys();
  748. }
  749. if (nzSelectedKeys) {
  750. this.handleNzSelectedKeys();
  751. }
  752. if (nzStatus) {
  753. this.setStatusStyles(this.nzStatus, this.hasFeedback);
  754. }
  755. }
  756. ngOnDestroy() {
  757. this.unsubscribe$.next();
  758. this.unsubscribe$.complete();
  759. }
  760. setStatusStyles(status, hasFeedback) {
  761. // set inner status
  762. this.hasFeedback = hasFeedback;
  763. this.cdr.markForCheck();
  764. // render status if nzStatus is set
  765. this.statusCls = getStatusClassNames(this.prefixCls, status, hasFeedback);
  766. Object.keys(this.statusCls).forEach(status => {
  767. if (this.statusCls[status]) {
  768. this.renderer.addClass(this.elementRef.nativeElement, status);
  769. }
  770. else {
  771. this.renderer.removeClass(this.elementRef.nativeElement, status);
  772. }
  773. });
  774. }
  775. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTransferComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1$2.NzI18nService }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i2$1.Directionality }], target: i0.ɵɵFactoryTarget.Component });
  776. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzTransferComponent, isStandalone: true, selector: "nz-transfer", inputs: { nzDisabled: ["nzDisabled", "nzDisabled", booleanAttribute], nzDataSource: "nzDataSource", nzTitles: "nzTitles", nzOperations: "nzOperations", nzListStyle: "nzListStyle", nzShowSelectAll: ["nzShowSelectAll", "nzShowSelectAll", booleanAttribute], nzItemUnit: "nzItemUnit", nzItemsUnit: "nzItemsUnit", nzCanMove: "nzCanMove", nzRenderList: "nzRenderList", nzRender: "nzRender", nzFooter: "nzFooter", nzShowSearch: ["nzShowSearch", "nzShowSearch", booleanAttribute], nzFilterOption: "nzFilterOption", nzSearchPlaceholder: "nzSearchPlaceholder", nzNotFoundContent: "nzNotFoundContent", nzTargetKeys: "nzTargetKeys", nzSelectedKeys: "nzSelectedKeys", nzStatus: "nzStatus", nzOneWay: ["nzOneWay", "nzOneWay", booleanAttribute] }, outputs: { nzChange: "nzChange", nzSearchChange: "nzSearchChange", nzSelectChange: "nzSelectChange" }, host: { listeners: { "window:keydown.shift": "onTriggerShiftDown()", "window:keyup.shift": "onTriggerShiftUp()", "mousedown": "onTriggerMouseDown($event)" }, properties: { "class.ant-transfer-rtl": "dir === 'rtl'", "class.ant-transfer-disabled": "nzDisabled", "class.ant-transfer-customize-list": "nzRenderList" }, classAttribute: "ant-transfer" }, viewQueries: [{ propertyName: "lists", predicate: NzTransferListComponent, descendants: true }], exportAs: ["nzTransfer"], usesOnChanges: true, ngImport: i0, template: `
  777. <nz-transfer-list
  778. class="ant-transfer-list"
  779. [style]="nzListStyle"
  780. data-direction="left"
  781. direction="left"
  782. [titleText]="nzTitles[0]"
  783. [showSelectAll]="nzShowSelectAll"
  784. [dataSource]="leftDataSource"
  785. [filter]="leftFilter"
  786. [filterOption]="nzFilterOption"
  787. (filterChange)="handleFilterChange($event)"
  788. [renderList]="nzRenderList && nzRenderList[0]"
  789. [render]="nzRender"
  790. [disabled]="nzDisabled"
  791. [showSearch]="nzShowSearch"
  792. [searchPlaceholder]="nzSearchPlaceholder || locale?.searchPlaceholder"
  793. [notFoundContent]="nzNotFoundContent"
  794. [itemUnit]="nzItemUnit || locale?.itemUnit"
  795. [itemsUnit]="nzItemsUnit || locale?.itemsUnit"
  796. [footer]="nzFooter"
  797. (handleSelect)="handleLeftSelect($event)"
  798. (handleSelectAll)="handleLeftSelectAll($event)"
  799. ></nz-transfer-list>
  800. @if (dir !== 'rtl') {
  801. <div class="ant-transfer-operation">
  802. @if (!nzOneWay) {
  803. <button
  804. nz-button
  805. type="button"
  806. (click)="moveToLeft()"
  807. [disabled]="nzDisabled || !leftActive"
  808. [nzType]="'primary'"
  809. [nzSize]="'small'"
  810. >
  811. <nz-icon nzType="left" />
  812. @if (nzOperations[1]) {
  813. <span>{{ nzOperations[1] }}</span>
  814. }
  815. </button>
  816. }
  817. <button
  818. nz-button
  819. type="button"
  820. (click)="moveToRight()"
  821. [disabled]="nzDisabled || !rightActive"
  822. [nzType]="'primary'"
  823. [nzSize]="'small'"
  824. >
  825. <nz-icon nzType="right" />
  826. @if (nzOperations[0]) {
  827. <span>{{ nzOperations[0] }}</span>
  828. }
  829. </button>
  830. </div>
  831. } @else {
  832. <div class="ant-transfer-operation">
  833. <button
  834. nz-button
  835. type="button"
  836. (click)="moveToRight()"
  837. [disabled]="nzDisabled || !rightActive"
  838. [nzType]="'primary'"
  839. [nzSize]="'small'"
  840. >
  841. <nz-icon nzType="left" />
  842. @if (nzOperations[0]) {
  843. <span>{{ nzOperations[0] }}</span>
  844. }
  845. </button>
  846. @if (!nzOneWay) {
  847. <button
  848. nz-button
  849. type="button"
  850. (click)="moveToLeft()"
  851. [disabled]="nzDisabled || !leftActive"
  852. [nzType]="'primary'"
  853. [nzSize]="'small'"
  854. >
  855. <nz-icon nzType="right" />
  856. @if (nzOperations[1]) {
  857. <span>{{ nzOperations[1] }}</span>
  858. }
  859. </button>
  860. }
  861. </div>
  862. }
  863. <nz-transfer-list
  864. class="ant-transfer-list"
  865. [style]="nzListStyle"
  866. data-direction="right"
  867. direction="right"
  868. [titleText]="nzTitles[1]"
  869. [showSelectAll]="nzShowSelectAll"
  870. [dataSource]="rightDataSource"
  871. [filter]="rightFilter"
  872. [filterOption]="nzFilterOption"
  873. (filterChange)="handleFilterChange($event)"
  874. [renderList]="nzRenderList && nzRenderList[1]"
  875. [render]="nzRender"
  876. [disabled]="nzDisabled"
  877. [showSearch]="nzShowSearch"
  878. [searchPlaceholder]="nzSearchPlaceholder || locale?.searchPlaceholder"
  879. [notFoundContent]="nzNotFoundContent"
  880. [itemUnit]="nzItemUnit || locale?.itemUnit"
  881. [itemsUnit]="nzItemsUnit || locale?.itemsUnit"
  882. [footer]="nzFooter"
  883. [oneWay]="nzOneWay"
  884. (moveToLeft)="moveToLeft()"
  885. (handleSelect)="handleRightSelect($event)"
  886. (handleSelectAll)="handleRightSelectAll($event)"
  887. ></nz-transfer-list>
  888. `, isInline: true, dependencies: [{ kind: "component", type: NzTransferListComponent, selector: "nz-transfer-list", inputs: ["direction", "titleText", "showSelectAll", "dataSource", "itemUnit", "itemsUnit", "filter", "oneWay", "disabled", "showSearch", "searchPlaceholder", "notFoundContent", "filterOption", "renderList", "render", "footer"], outputs: ["handleSelectAll", "handleSelect", "filterChange", "moveToLeft"], exportAs: ["nzTransferList"] }, { kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i3.NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "ngmodule", type: NzButtonModule }, { kind: "component", type: i4$1.NzButtonComponent, selector: "button[nz-button], a[nz-button]", inputs: ["nzBlock", "nzGhost", "nzSearch", "nzLoading", "nzDanger", "disabled", "tabIndex", "nzType", "nzShape", "nzSize"], exportAs: ["nzButton"] }, { kind: "directive", type: i4.ɵNzTransitionPatchDirective, selector: "[nz-button], nz-button-group, [nz-icon], nz-icon, [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { kind: "directive", type: i6.NzWaveDirective, selector: "[nz-wave],button[nz-button]:not([nzType=\"link\"]):not([nzType=\"text\"])", inputs: ["nzWaveExtraNode"], exportAs: ["nzWave"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  889. }
  890. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTransferComponent, decorators: [{
  891. type: Component,
  892. args: [{
  893. selector: 'nz-transfer',
  894. exportAs: 'nzTransfer',
  895. preserveWhitespaces: false,
  896. template: `
  897. <nz-transfer-list
  898. class="ant-transfer-list"
  899. [style]="nzListStyle"
  900. data-direction="left"
  901. direction="left"
  902. [titleText]="nzTitles[0]"
  903. [showSelectAll]="nzShowSelectAll"
  904. [dataSource]="leftDataSource"
  905. [filter]="leftFilter"
  906. [filterOption]="nzFilterOption"
  907. (filterChange)="handleFilterChange($event)"
  908. [renderList]="nzRenderList && nzRenderList[0]"
  909. [render]="nzRender"
  910. [disabled]="nzDisabled"
  911. [showSearch]="nzShowSearch"
  912. [searchPlaceholder]="nzSearchPlaceholder || locale?.searchPlaceholder"
  913. [notFoundContent]="nzNotFoundContent"
  914. [itemUnit]="nzItemUnit || locale?.itemUnit"
  915. [itemsUnit]="nzItemsUnit || locale?.itemsUnit"
  916. [footer]="nzFooter"
  917. (handleSelect)="handleLeftSelect($event)"
  918. (handleSelectAll)="handleLeftSelectAll($event)"
  919. ></nz-transfer-list>
  920. @if (dir !== 'rtl') {
  921. <div class="ant-transfer-operation">
  922. @if (!nzOneWay) {
  923. <button
  924. nz-button
  925. type="button"
  926. (click)="moveToLeft()"
  927. [disabled]="nzDisabled || !leftActive"
  928. [nzType]="'primary'"
  929. [nzSize]="'small'"
  930. >
  931. <nz-icon nzType="left" />
  932. @if (nzOperations[1]) {
  933. <span>{{ nzOperations[1] }}</span>
  934. }
  935. </button>
  936. }
  937. <button
  938. nz-button
  939. type="button"
  940. (click)="moveToRight()"
  941. [disabled]="nzDisabled || !rightActive"
  942. [nzType]="'primary'"
  943. [nzSize]="'small'"
  944. >
  945. <nz-icon nzType="right" />
  946. @if (nzOperations[0]) {
  947. <span>{{ nzOperations[0] }}</span>
  948. }
  949. </button>
  950. </div>
  951. } @else {
  952. <div class="ant-transfer-operation">
  953. <button
  954. nz-button
  955. type="button"
  956. (click)="moveToRight()"
  957. [disabled]="nzDisabled || !rightActive"
  958. [nzType]="'primary'"
  959. [nzSize]="'small'"
  960. >
  961. <nz-icon nzType="left" />
  962. @if (nzOperations[0]) {
  963. <span>{{ nzOperations[0] }}</span>
  964. }
  965. </button>
  966. @if (!nzOneWay) {
  967. <button
  968. nz-button
  969. type="button"
  970. (click)="moveToLeft()"
  971. [disabled]="nzDisabled || !leftActive"
  972. [nzType]="'primary'"
  973. [nzSize]="'small'"
  974. >
  975. <nz-icon nzType="right" />
  976. @if (nzOperations[1]) {
  977. <span>{{ nzOperations[1] }}</span>
  978. }
  979. </button>
  980. }
  981. </div>
  982. }
  983. <nz-transfer-list
  984. class="ant-transfer-list"
  985. [style]="nzListStyle"
  986. data-direction="right"
  987. direction="right"
  988. [titleText]="nzTitles[1]"
  989. [showSelectAll]="nzShowSelectAll"
  990. [dataSource]="rightDataSource"
  991. [filter]="rightFilter"
  992. [filterOption]="nzFilterOption"
  993. (filterChange)="handleFilterChange($event)"
  994. [renderList]="nzRenderList && nzRenderList[1]"
  995. [render]="nzRender"
  996. [disabled]="nzDisabled"
  997. [showSearch]="nzShowSearch"
  998. [searchPlaceholder]="nzSearchPlaceholder || locale?.searchPlaceholder"
  999. [notFoundContent]="nzNotFoundContent"
  1000. [itemUnit]="nzItemUnit || locale?.itemUnit"
  1001. [itemsUnit]="nzItemsUnit || locale?.itemsUnit"
  1002. [footer]="nzFooter"
  1003. [oneWay]="nzOneWay"
  1004. (moveToLeft)="moveToLeft()"
  1005. (handleSelect)="handleRightSelect($event)"
  1006. (handleSelectAll)="handleRightSelectAll($event)"
  1007. ></nz-transfer-list>
  1008. `,
  1009. host: {
  1010. class: 'ant-transfer',
  1011. '[class.ant-transfer-rtl]': `dir === 'rtl'`,
  1012. '[class.ant-transfer-disabled]': `nzDisabled`,
  1013. '[class.ant-transfer-customize-list]': `nzRenderList`
  1014. },
  1015. encapsulation: ViewEncapsulation.None,
  1016. changeDetection: ChangeDetectionStrategy.OnPush,
  1017. imports: [NzTransferListComponent, NzIconModule, NzButtonModule]
  1018. }]
  1019. }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i1$2.NzI18nService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i2$1.Directionality }], propDecorators: { lists: [{
  1020. type: ViewChildren,
  1021. args: [NzTransferListComponent]
  1022. }], nzDisabled: [{
  1023. type: Input,
  1024. args: [{ transform: booleanAttribute }]
  1025. }], nzDataSource: [{
  1026. type: Input
  1027. }], nzTitles: [{
  1028. type: Input
  1029. }], nzOperations: [{
  1030. type: Input
  1031. }], nzListStyle: [{
  1032. type: Input
  1033. }], nzShowSelectAll: [{
  1034. type: Input,
  1035. args: [{ transform: booleanAttribute }]
  1036. }], nzItemUnit: [{
  1037. type: Input
  1038. }], nzItemsUnit: [{
  1039. type: Input
  1040. }], nzCanMove: [{
  1041. type: Input
  1042. }], nzRenderList: [{
  1043. type: Input
  1044. }], nzRender: [{
  1045. type: Input
  1046. }], nzFooter: [{
  1047. type: Input
  1048. }], nzShowSearch: [{
  1049. type: Input,
  1050. args: [{ transform: booleanAttribute }]
  1051. }], nzFilterOption: [{
  1052. type: Input
  1053. }], nzSearchPlaceholder: [{
  1054. type: Input
  1055. }], nzNotFoundContent: [{
  1056. type: Input
  1057. }], nzTargetKeys: [{
  1058. type: Input
  1059. }], nzSelectedKeys: [{
  1060. type: Input
  1061. }], nzStatus: [{
  1062. type: Input
  1063. }], nzOneWay: [{
  1064. type: Input,
  1065. args: [{ transform: booleanAttribute }]
  1066. }], nzChange: [{
  1067. type: Output
  1068. }], nzSearchChange: [{
  1069. type: Output
  1070. }], nzSelectChange: [{
  1071. type: Output
  1072. }], onTriggerShiftDown: [{
  1073. type: HostListener,
  1074. args: ['window:keydown.shift']
  1075. }], onTriggerShiftUp: [{
  1076. type: HostListener,
  1077. args: ['window:keyup.shift']
  1078. }], onTriggerMouseDown: [{
  1079. type: HostListener,
  1080. args: ['mousedown', ['$event']]
  1081. }] } });
  1082. /**
  1083. * Use of this source code is governed by an MIT-style license that can be
  1084. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  1085. */
  1086. class NzTransferModule {
  1087. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTransferModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
  1088. static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.2", ngImport: i0, type: NzTransferModule, imports: [NzTransferComponent, NzTransferListComponent, NzTransferSearchComponent], exports: [NzTransferComponent] });
  1089. static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTransferModule, imports: [NzTransferComponent, NzTransferListComponent, NzTransferSearchComponent] });
  1090. }
  1091. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzTransferModule, decorators: [{
  1092. type: NgModule,
  1093. args: [{
  1094. imports: [NzTransferComponent, NzTransferListComponent, NzTransferSearchComponent],
  1095. exports: [NzTransferComponent]
  1096. }]
  1097. }] });
  1098. /**
  1099. * Use of this source code is governed by an MIT-style license that can be
  1100. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  1101. */
  1102. /**
  1103. * Generated bundle index. Do not edit.
  1104. */
  1105. export { NzTransferComponent, NzTransferListComponent, NzTransferModule, NzTransferSearchComponent };
  1106. //# sourceMappingURL=ng-zorro-antd-transfer.mjs.map