picklist.js 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  1. "use strict";
  2. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  4. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  5. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  6. return c > 3 && r && Object.defineProperty(target, key, r), r;
  7. };
  8. var __metadata = (this && this.__metadata) || function (k, v) {
  9. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  10. };
  11. Object.defineProperty(exports, "__esModule", { value: true });
  12. var core_1 = require("@angular/core");
  13. var common_1 = require("@angular/common");
  14. var button_1 = require("../button/button");
  15. var shared_1 = require("../common/shared");
  16. var domhandler_1 = require("../dom/domhandler");
  17. var objectutils_1 = require("../utils/objectutils");
  18. var filterutils_1 = require("../utils/filterutils");
  19. var PickList = /** @class */ (function () {
  20. function PickList(el) {
  21. this.el = el;
  22. this.trackBy = function (index, item) { return item; };
  23. this.showSourceFilter = true;
  24. this.showTargetFilter = true;
  25. this.metaKeySelection = true;
  26. this.showSourceControls = true;
  27. this.showTargetControls = true;
  28. this.disabled = false;
  29. this.filterMatchMode = "contains";
  30. this.onMoveToSource = new core_1.EventEmitter();
  31. this.onMoveAllToSource = new core_1.EventEmitter();
  32. this.onMoveAllToTarget = new core_1.EventEmitter();
  33. this.onMoveToTarget = new core_1.EventEmitter();
  34. this.onSourceReorder = new core_1.EventEmitter();
  35. this.onTargetReorder = new core_1.EventEmitter();
  36. this.onSourceSelect = new core_1.EventEmitter();
  37. this.onTargetSelect = new core_1.EventEmitter();
  38. this.onSourceFilter = new core_1.EventEmitter();
  39. this.onTargetFilter = new core_1.EventEmitter();
  40. this.selectedItemsSource = [];
  41. this.selectedItemsTarget = [];
  42. this.SOURCE_LIST = -1;
  43. this.TARGET_LIST = 1;
  44. }
  45. PickList.prototype.ngAfterContentInit = function () {
  46. var _this = this;
  47. this.templates.forEach(function (item) {
  48. switch (item.getType()) {
  49. case 'item':
  50. _this.itemTemplate = item.template;
  51. break;
  52. case 'emptymessagesource':
  53. _this.emptyMessageSourceTemplate = item.template;
  54. break;
  55. case 'emptymessagetarget':
  56. _this.emptyMessageTargetTemplate = item.template;
  57. break;
  58. default:
  59. _this.itemTemplate = item.template;
  60. break;
  61. }
  62. });
  63. };
  64. PickList.prototype.ngAfterViewChecked = function () {
  65. if (this.movedUp || this.movedDown) {
  66. var listItems = domhandler_1.DomHandler.find(this.reorderedListElement, 'li.ui-state-highlight');
  67. var listItem = void 0;
  68. if (this.movedUp)
  69. listItem = listItems[0];
  70. else
  71. listItem = listItems[listItems.length - 1];
  72. domhandler_1.DomHandler.scrollInView(this.reorderedListElement, listItem);
  73. this.movedUp = false;
  74. this.movedDown = false;
  75. this.reorderedListElement = null;
  76. }
  77. };
  78. PickList.prototype.onItemClick = function (event, item, selectedItems, callback) {
  79. if (this.disabled) {
  80. return;
  81. }
  82. var index = this.findIndexInSelection(item, selectedItems);
  83. var selected = (index != -1);
  84. var metaSelection = this.itemTouched ? false : this.metaKeySelection;
  85. if (metaSelection) {
  86. var metaKey = (event.metaKey || event.ctrlKey || event.shiftKey);
  87. if (selected && metaKey) {
  88. selectedItems.splice(index, 1);
  89. }
  90. else {
  91. if (!metaKey) {
  92. selectedItems.length = 0;
  93. }
  94. selectedItems.push(item);
  95. }
  96. }
  97. else {
  98. if (selected)
  99. selectedItems.splice(index, 1);
  100. else
  101. selectedItems.push(item);
  102. }
  103. callback.emit({ originalEvent: event, items: selectedItems });
  104. this.itemTouched = false;
  105. };
  106. PickList.prototype.onSourceItemDblClick = function () {
  107. if (this.disabled) {
  108. return;
  109. }
  110. this.moveRight();
  111. };
  112. PickList.prototype.onTargetItemDblClick = function () {
  113. if (this.disabled) {
  114. return;
  115. }
  116. this.moveLeft();
  117. };
  118. PickList.prototype.onFilter = function (event, data, listType) {
  119. var query = event.target.value.trim().toLowerCase();
  120. var searchFields = this.filterBy.split(',');
  121. if (listType === this.SOURCE_LIST) {
  122. this.filterValueSource = query;
  123. this.visibleOptionsSource = filterutils_1.FilterUtils.filter(data, searchFields, this.filterValueSource, this.filterMatchMode);
  124. this.onSourceFilter.emit({ query: this.filterValueSource, value: this.visibleOptionsSource });
  125. }
  126. else if (listType === this.TARGET_LIST) {
  127. this.filterValueTarget = query;
  128. this.visibleOptionsTarget = filterutils_1.FilterUtils.filter(data, searchFields, this.filterValueTarget, this.filterMatchMode);
  129. this.onTargetFilter.emit({ query: this.filterValueTarget, value: this.visibleOptionsTarget });
  130. }
  131. };
  132. PickList.prototype.isItemVisible = function (item, listType) {
  133. if (listType == this.SOURCE_LIST)
  134. return this.isVisibleInList(this.visibleOptionsSource, item, this.filterValueSource);
  135. else
  136. return this.isVisibleInList(this.visibleOptionsTarget, item, this.filterValueTarget);
  137. };
  138. PickList.prototype.isVisibleInList = function (data, item, filterValue) {
  139. if (filterValue && filterValue.trim().length) {
  140. for (var i = 0; i < data.length; i++) {
  141. if (item == data[i]) {
  142. return true;
  143. }
  144. }
  145. }
  146. else {
  147. return true;
  148. }
  149. };
  150. PickList.prototype.onItemTouchEnd = function (event) {
  151. if (this.disabled) {
  152. return;
  153. }
  154. this.itemTouched = true;
  155. };
  156. PickList.prototype.sortByIndexInList = function (items, list) {
  157. var _this = this;
  158. return items.sort(function (item1, item2) {
  159. return _this.findIndexInList(item1, list) - _this.findIndexInList(item2, list);
  160. });
  161. };
  162. PickList.prototype.moveUp = function (listElement, list, selectedItems, callback) {
  163. if (selectedItems && selectedItems.length) {
  164. selectedItems = this.sortByIndexInList(selectedItems, list);
  165. for (var i = 0; i < selectedItems.length; i++) {
  166. var selectedItem = selectedItems[i];
  167. var selectedItemIndex = this.findIndexInList(selectedItem, list);
  168. if (selectedItemIndex != 0) {
  169. var movedItem = list[selectedItemIndex];
  170. var temp = list[selectedItemIndex - 1];
  171. list[selectedItemIndex - 1] = movedItem;
  172. list[selectedItemIndex] = temp;
  173. }
  174. else {
  175. break;
  176. }
  177. }
  178. this.movedUp = true;
  179. this.reorderedListElement = listElement;
  180. callback.emit({ items: selectedItems });
  181. }
  182. };
  183. PickList.prototype.moveTop = function (listElement, list, selectedItems, callback) {
  184. if (selectedItems && selectedItems.length) {
  185. selectedItems = this.sortByIndexInList(selectedItems, list);
  186. for (var i = 0; i < selectedItems.length; i++) {
  187. var selectedItem = selectedItems[i];
  188. var selectedItemIndex = this.findIndexInList(selectedItem, list);
  189. if (selectedItemIndex != 0) {
  190. var movedItem = list.splice(selectedItemIndex, 1)[0];
  191. list.unshift(movedItem);
  192. }
  193. else {
  194. break;
  195. }
  196. }
  197. listElement.scrollTop = 0;
  198. callback.emit({ items: selectedItems });
  199. }
  200. };
  201. PickList.prototype.moveDown = function (listElement, list, selectedItems, callback) {
  202. if (selectedItems && selectedItems.length) {
  203. selectedItems = this.sortByIndexInList(selectedItems, list);
  204. for (var i = selectedItems.length - 1; i >= 0; i--) {
  205. var selectedItem = selectedItems[i];
  206. var selectedItemIndex = this.findIndexInList(selectedItem, list);
  207. if (selectedItemIndex != (list.length - 1)) {
  208. var movedItem = list[selectedItemIndex];
  209. var temp = list[selectedItemIndex + 1];
  210. list[selectedItemIndex + 1] = movedItem;
  211. list[selectedItemIndex] = temp;
  212. }
  213. else {
  214. break;
  215. }
  216. }
  217. this.movedDown = true;
  218. this.reorderedListElement = listElement;
  219. callback.emit({ items: selectedItems });
  220. }
  221. };
  222. PickList.prototype.moveBottom = function (listElement, list, selectedItems, callback) {
  223. if (selectedItems && selectedItems.length) {
  224. selectedItems = this.sortByIndexInList(selectedItems, list);
  225. for (var i = selectedItems.length - 1; i >= 0; i--) {
  226. var selectedItem = selectedItems[i];
  227. var selectedItemIndex = this.findIndexInList(selectedItem, list);
  228. if (selectedItemIndex != (list.length - 1)) {
  229. var movedItem = list.splice(selectedItemIndex, 1)[0];
  230. list.push(movedItem);
  231. }
  232. else {
  233. break;
  234. }
  235. }
  236. listElement.scrollTop = listElement.scrollHeight;
  237. callback.emit({ items: selectedItems });
  238. }
  239. };
  240. PickList.prototype.moveRight = function () {
  241. if (this.selectedItemsSource && this.selectedItemsSource.length) {
  242. for (var i = 0; i < this.selectedItemsSource.length; i++) {
  243. var selectedItem = this.selectedItemsSource[i];
  244. if (this.findIndexInList(selectedItem, this.target) == -1) {
  245. this.target.push(this.source.splice(this.findIndexInList(selectedItem, this.source), 1)[0]);
  246. }
  247. }
  248. this.onMoveToTarget.emit({
  249. items: this.selectedItemsSource
  250. });
  251. this.selectedItemsSource = [];
  252. }
  253. };
  254. PickList.prototype.moveAllRight = function () {
  255. if (this.source) {
  256. var movedItems = [];
  257. for (var i = 0; i < this.source.length; i++) {
  258. if (this.isItemVisible(this.source[i], this.SOURCE_LIST)) {
  259. var removedItem = this.source.splice(i, 1)[0];
  260. this.target.push(removedItem);
  261. movedItems.push(removedItem);
  262. i--;
  263. }
  264. }
  265. this.onMoveToTarget.emit({
  266. items: movedItems
  267. });
  268. this.onMoveAllToTarget.emit({
  269. items: movedItems
  270. });
  271. this.selectedItemsSource = [];
  272. }
  273. };
  274. PickList.prototype.moveLeft = function () {
  275. if (this.selectedItemsTarget && this.selectedItemsTarget.length) {
  276. for (var i = 0; i < this.selectedItemsTarget.length; i++) {
  277. var selectedItem = this.selectedItemsTarget[i];
  278. if (this.findIndexInList(selectedItem, this.source) == -1) {
  279. this.source.push(this.target.splice(this.findIndexInList(selectedItem, this.target), 1)[0]);
  280. }
  281. }
  282. this.onMoveToSource.emit({
  283. items: this.selectedItemsTarget
  284. });
  285. this.selectedItemsTarget = [];
  286. }
  287. };
  288. PickList.prototype.moveAllLeft = function () {
  289. if (this.target) {
  290. var movedItems = [];
  291. for (var i = 0; i < this.target.length; i++) {
  292. if (this.isItemVisible(this.target[i], this.TARGET_LIST)) {
  293. var removedItem = this.target.splice(i, 1)[0];
  294. this.source.push(removedItem);
  295. movedItems.push(removedItem);
  296. i--;
  297. }
  298. }
  299. this.onMoveToSource.emit({
  300. items: movedItems
  301. });
  302. this.onMoveAllToSource.emit({
  303. items: movedItems
  304. });
  305. this.selectedItemsTarget = [];
  306. }
  307. };
  308. PickList.prototype.isSelected = function (item, selectedItems) {
  309. return this.findIndexInSelection(item, selectedItems) != -1;
  310. };
  311. PickList.prototype.findIndexInSelection = function (item, selectedItems) {
  312. return this.findIndexInList(item, selectedItems);
  313. };
  314. PickList.prototype.findIndexInList = function (item, list) {
  315. var index = -1;
  316. if (list) {
  317. for (var i = 0; i < list.length; i++) {
  318. if (list[i] == item) {
  319. index = i;
  320. break;
  321. }
  322. }
  323. }
  324. return index;
  325. };
  326. PickList.prototype.onDragStart = function (event, index, listType) {
  327. event.target.blur();
  328. this.dragging = true;
  329. this.fromListType = listType;
  330. if (listType === this.SOURCE_LIST)
  331. this.draggedItemIndexSource = index;
  332. else
  333. this.draggedItemIndexTarget = index;
  334. };
  335. PickList.prototype.onDragOver = function (event, index, listType) {
  336. if (this.dragging) {
  337. if (listType == this.SOURCE_LIST) {
  338. if (this.draggedItemIndexSource !== index && this.draggedItemIndexSource + 1 !== index || (this.fromListType === this.TARGET_LIST)) {
  339. this.dragOverItemIndexSource = index;
  340. event.preventDefault();
  341. }
  342. }
  343. else {
  344. if (this.draggedItemIndexTarget !== index && this.draggedItemIndexTarget + 1 !== index || (this.fromListType === this.SOURCE_LIST)) {
  345. this.dragOverItemIndexTarget = index;
  346. event.preventDefault();
  347. }
  348. }
  349. this.onListItemDroppoint = true;
  350. }
  351. };
  352. PickList.prototype.onDragLeave = function (event, listType) {
  353. this.dragOverItemIndexSource = null;
  354. this.dragOverItemIndexTarget = null;
  355. this.onListItemDroppoint = false;
  356. };
  357. PickList.prototype.onDrop = function (event, index, listType) {
  358. if (this.onListItemDroppoint) {
  359. if (listType === this.SOURCE_LIST) {
  360. if (this.fromListType === this.TARGET_LIST) {
  361. this.insert(this.draggedItemIndexTarget, this.target, index, this.source, this.onMoveToSource);
  362. }
  363. else {
  364. objectutils_1.ObjectUtils.reorderArray(this.source, this.draggedItemIndexSource, (this.draggedItemIndexSource > index) ? index : (index === 0) ? 0 : index - 1);
  365. this.onSourceReorder.emit({ items: this.source[this.draggedItemIndexSource] });
  366. }
  367. this.dragOverItemIndexSource = null;
  368. }
  369. else {
  370. if (this.fromListType === this.SOURCE_LIST) {
  371. this.insert(this.draggedItemIndexSource, this.source, index, this.target, this.onMoveToTarget);
  372. }
  373. else {
  374. objectutils_1.ObjectUtils.reorderArray(this.target, this.draggedItemIndexTarget, (this.draggedItemIndexTarget > index) ? index : (index === 0) ? 0 : index - 1);
  375. this.onTargetReorder.emit({ items: this.target[this.draggedItemIndexTarget] });
  376. }
  377. this.dragOverItemIndexTarget = null;
  378. }
  379. this.listHighlightTarget = false;
  380. this.listHighlightSource = false;
  381. event.preventDefault();
  382. }
  383. };
  384. PickList.prototype.onDragEnd = function (event) {
  385. this.dragging = false;
  386. };
  387. PickList.prototype.onListDrop = function (event, listType) {
  388. if (!this.onListItemDroppoint) {
  389. if (listType === this.SOURCE_LIST) {
  390. if (this.fromListType === this.TARGET_LIST) {
  391. this.insert(this.draggedItemIndexTarget, this.target, null, this.source, this.onMoveToSource);
  392. }
  393. }
  394. else {
  395. if (this.fromListType === this.SOURCE_LIST) {
  396. this.insert(this.draggedItemIndexSource, this.source, null, this.target, this.onMoveToTarget);
  397. }
  398. }
  399. this.listHighlightTarget = false;
  400. this.listHighlightSource = false;
  401. event.preventDefault();
  402. }
  403. };
  404. PickList.prototype.insert = function (fromIndex, fromList, toIndex, toList, callback) {
  405. var elementtomove = fromList[fromIndex];
  406. if (toIndex === null)
  407. toList.push(fromList.splice(fromIndex, 1)[0]);
  408. else
  409. toList.splice(toIndex, 0, fromList.splice(fromIndex, 1)[0]);
  410. callback.emit({
  411. items: [elementtomove]
  412. });
  413. };
  414. PickList.prototype.onListMouseMove = function (event, listType) {
  415. if (this.dragging) {
  416. var moveListType = (listType == 0 ? this.listViewSourceChild : this.listViewTargetChild);
  417. var offsetY = moveListType.nativeElement.getBoundingClientRect().top + document.body.scrollTop;
  418. var bottomDiff = (offsetY + moveListType.nativeElement.clientHeight) - event.pageY;
  419. var topDiff = (event.pageY - offsetY);
  420. if (bottomDiff < 25 && bottomDiff > 0)
  421. moveListType.nativeElement.scrollTop += 15;
  422. else if (topDiff < 25 && topDiff > 0)
  423. moveListType.nativeElement.scrollTop -= 15;
  424. if (listType === this.SOURCE_LIST) {
  425. if (this.fromListType === this.TARGET_LIST)
  426. this.listHighlightSource = true;
  427. }
  428. else {
  429. if (this.fromListType === this.SOURCE_LIST)
  430. this.listHighlightTarget = true;
  431. }
  432. event.preventDefault();
  433. }
  434. };
  435. PickList.prototype.onListDragLeave = function () {
  436. this.listHighlightTarget = false;
  437. this.listHighlightSource = false;
  438. };
  439. PickList.prototype.resetFilter = function () {
  440. this.visibleOptionsSource = null;
  441. this.filterValueSource = null;
  442. this.visibleOptionsTarget = null;
  443. this.filterValueTarget = null;
  444. this.sourceFilterViewChild.nativeElement.value = '';
  445. this.targetFilterViewChild.nativeElement.value = '';
  446. };
  447. PickList.prototype.onItemKeydown = function (event, item, selectedItems, callback) {
  448. var listItem = event.currentTarget;
  449. switch (event.which) {
  450. //down
  451. case 40:
  452. var nextItem = this.findNextItem(listItem);
  453. if (nextItem) {
  454. nextItem.focus();
  455. }
  456. event.preventDefault();
  457. break;
  458. //up
  459. case 38:
  460. var prevItem = this.findPrevItem(listItem);
  461. if (prevItem) {
  462. prevItem.focus();
  463. }
  464. event.preventDefault();
  465. break;
  466. //enter
  467. case 13:
  468. this.onItemClick(event, item, selectedItems, callback);
  469. event.preventDefault();
  470. break;
  471. }
  472. };
  473. PickList.prototype.findNextItem = function (item) {
  474. var nextItem = item.nextElementSibling;
  475. if (nextItem)
  476. return !domhandler_1.DomHandler.hasClass(nextItem, 'ui-picklist-item') || domhandler_1.DomHandler.isHidden(nextItem) ? this.findNextItem(nextItem) : nextItem;
  477. else
  478. return null;
  479. };
  480. PickList.prototype.findPrevItem = function (item) {
  481. var prevItem = item.previousElementSibling;
  482. if (prevItem)
  483. return !domhandler_1.DomHandler.hasClass(prevItem, 'ui-picklist-item') || domhandler_1.DomHandler.isHidden(prevItem) ? this.findPrevItem(prevItem) : prevItem;
  484. else
  485. return null;
  486. };
  487. __decorate([
  488. core_1.Input(),
  489. __metadata("design:type", Array)
  490. ], PickList.prototype, "source", void 0);
  491. __decorate([
  492. core_1.Input(),
  493. __metadata("design:type", Array)
  494. ], PickList.prototype, "target", void 0);
  495. __decorate([
  496. core_1.Input(),
  497. __metadata("design:type", String)
  498. ], PickList.prototype, "sourceHeader", void 0);
  499. __decorate([
  500. core_1.Input(),
  501. __metadata("design:type", String)
  502. ], PickList.prototype, "targetHeader", void 0);
  503. __decorate([
  504. core_1.Input(),
  505. __metadata("design:type", Boolean)
  506. ], PickList.prototype, "responsive", void 0);
  507. __decorate([
  508. core_1.Input(),
  509. __metadata("design:type", String)
  510. ], PickList.prototype, "filterBy", void 0);
  511. __decorate([
  512. core_1.Input(),
  513. __metadata("design:type", Function)
  514. ], PickList.prototype, "trackBy", void 0);
  515. __decorate([
  516. core_1.Input(),
  517. __metadata("design:type", Function)
  518. ], PickList.prototype, "sourceTrackBy", void 0);
  519. __decorate([
  520. core_1.Input(),
  521. __metadata("design:type", Function)
  522. ], PickList.prototype, "targetTrackBy", void 0);
  523. __decorate([
  524. core_1.Input(),
  525. __metadata("design:type", Boolean)
  526. ], PickList.prototype, "showSourceFilter", void 0);
  527. __decorate([
  528. core_1.Input(),
  529. __metadata("design:type", Boolean)
  530. ], PickList.prototype, "showTargetFilter", void 0);
  531. __decorate([
  532. core_1.Input(),
  533. __metadata("design:type", Boolean)
  534. ], PickList.prototype, "metaKeySelection", void 0);
  535. __decorate([
  536. core_1.Input(),
  537. __metadata("design:type", Boolean)
  538. ], PickList.prototype, "dragdrop", void 0);
  539. __decorate([
  540. core_1.Input(),
  541. __metadata("design:type", Object)
  542. ], PickList.prototype, "style", void 0);
  543. __decorate([
  544. core_1.Input(),
  545. __metadata("design:type", String)
  546. ], PickList.prototype, "styleClass", void 0);
  547. __decorate([
  548. core_1.Input(),
  549. __metadata("design:type", Object)
  550. ], PickList.prototype, "sourceStyle", void 0);
  551. __decorate([
  552. core_1.Input(),
  553. __metadata("design:type", Object)
  554. ], PickList.prototype, "targetStyle", void 0);
  555. __decorate([
  556. core_1.Input(),
  557. __metadata("design:type", Boolean)
  558. ], PickList.prototype, "showSourceControls", void 0);
  559. __decorate([
  560. core_1.Input(),
  561. __metadata("design:type", Boolean)
  562. ], PickList.prototype, "showTargetControls", void 0);
  563. __decorate([
  564. core_1.Input(),
  565. __metadata("design:type", String)
  566. ], PickList.prototype, "sourceFilterPlaceholder", void 0);
  567. __decorate([
  568. core_1.Input(),
  569. __metadata("design:type", String)
  570. ], PickList.prototype, "targetFilterPlaceholder", void 0);
  571. __decorate([
  572. core_1.Input(),
  573. __metadata("design:type", Boolean)
  574. ], PickList.prototype, "disabled", void 0);
  575. __decorate([
  576. core_1.Input(),
  577. __metadata("design:type", String)
  578. ], PickList.prototype, "ariaSourceFilterLabel", void 0);
  579. __decorate([
  580. core_1.Input(),
  581. __metadata("design:type", String)
  582. ], PickList.prototype, "ariaTargetFilterLabel", void 0);
  583. __decorate([
  584. core_1.Input(),
  585. __metadata("design:type", String)
  586. ], PickList.prototype, "filterMatchMode", void 0);
  587. __decorate([
  588. core_1.Output(),
  589. __metadata("design:type", core_1.EventEmitter)
  590. ], PickList.prototype, "onMoveToSource", void 0);
  591. __decorate([
  592. core_1.Output(),
  593. __metadata("design:type", core_1.EventEmitter)
  594. ], PickList.prototype, "onMoveAllToSource", void 0);
  595. __decorate([
  596. core_1.Output(),
  597. __metadata("design:type", core_1.EventEmitter)
  598. ], PickList.prototype, "onMoveAllToTarget", void 0);
  599. __decorate([
  600. core_1.Output(),
  601. __metadata("design:type", core_1.EventEmitter)
  602. ], PickList.prototype, "onMoveToTarget", void 0);
  603. __decorate([
  604. core_1.Output(),
  605. __metadata("design:type", core_1.EventEmitter)
  606. ], PickList.prototype, "onSourceReorder", void 0);
  607. __decorate([
  608. core_1.Output(),
  609. __metadata("design:type", core_1.EventEmitter)
  610. ], PickList.prototype, "onTargetReorder", void 0);
  611. __decorate([
  612. core_1.Output(),
  613. __metadata("design:type", core_1.EventEmitter)
  614. ], PickList.prototype, "onSourceSelect", void 0);
  615. __decorate([
  616. core_1.Output(),
  617. __metadata("design:type", core_1.EventEmitter)
  618. ], PickList.prototype, "onTargetSelect", void 0);
  619. __decorate([
  620. core_1.Output(),
  621. __metadata("design:type", core_1.EventEmitter)
  622. ], PickList.prototype, "onSourceFilter", void 0);
  623. __decorate([
  624. core_1.Output(),
  625. __metadata("design:type", core_1.EventEmitter)
  626. ], PickList.prototype, "onTargetFilter", void 0);
  627. __decorate([
  628. core_1.ViewChild('sourcelist', { static: false }),
  629. __metadata("design:type", core_1.ElementRef)
  630. ], PickList.prototype, "listViewSourceChild", void 0);
  631. __decorate([
  632. core_1.ViewChild('targetlist', { static: false }),
  633. __metadata("design:type", core_1.ElementRef)
  634. ], PickList.prototype, "listViewTargetChild", void 0);
  635. __decorate([
  636. core_1.ViewChild('sourceFilter', { static: false }),
  637. __metadata("design:type", core_1.ElementRef)
  638. ], PickList.prototype, "sourceFilterViewChild", void 0);
  639. __decorate([
  640. core_1.ViewChild('targetFilter', { static: false }),
  641. __metadata("design:type", core_1.ElementRef)
  642. ], PickList.prototype, "targetFilterViewChild", void 0);
  643. __decorate([
  644. core_1.ContentChildren(shared_1.PrimeTemplate),
  645. __metadata("design:type", core_1.QueryList)
  646. ], PickList.prototype, "templates", void 0);
  647. PickList = __decorate([
  648. core_1.Component({
  649. selector: 'p-pickList',
  650. template: "\n <div [class]=\"styleClass\" [ngStyle]=\"style\" [ngClass]=\"{'ui-picklist ui-widget ui-helper-clearfix': true,'ui-picklist-responsive': responsive}\">\n <div class=\"ui-picklist-source-controls ui-picklist-buttons\" *ngIf=\"showSourceControls\">\n <div class=\"ui-picklist-buttons-cell\">\n <button type=\"button\" pButton icon=\"pi pi-angle-up\" [disabled]=\"disabled\" (click)=\"moveUp(sourcelist,source,selectedItemsSource,onSourceReorder)\"></button>\n <button type=\"button\" pButton icon=\"pi pi-angle-double-up\" [disabled]=\"disabled\" (click)=\"moveTop(sourcelist,source,selectedItemsSource,onSourceReorder)\"></button>\n <button type=\"button\" pButton icon=\"pi pi-angle-down\" [disabled]=\"disabled\" (click)=\"moveDown(sourcelist,source,selectedItemsSource,onSourceReorder)\"></button>\n <button type=\"button\" pButton icon=\"pi pi-angle-double-down\" [disabled]=\"disabled\" (click)=\"moveBottom(sourcelist,source,selectedItemsSource,onSourceReorder)\"></button>\n </div>\n </div>\n <div class=\"ui-picklist-listwrapper ui-picklist-source-wrapper\" [ngClass]=\"{'ui-picklist-listwrapper-nocontrols':!showSourceControls}\">\n <div class=\"ui-picklist-caption ui-widget-header ui-corner-tl ui-corner-tr\" *ngIf=\"sourceHeader\">{{sourceHeader}}</div>\n <div class=\"ui-picklist-filter-container ui-widget-content\" *ngIf=\"filterBy && showSourceFilter !== false\">\n <input #sourceFilter type=\"text\" role=\"textbox\" (keyup)=\"onFilter($event,source,SOURCE_LIST)\" class=\"ui-picklist-filter ui-inputtext ui-widget ui-state-default ui-corner-all\" [disabled]=\"disabled\" [attr.placeholder]=\"sourceFilterPlaceholder\" [attr.aria-label]=\"ariaSourceFilterLabel\">\n <span class=\"ui-picklist-filter-icon pi pi-search\"></span>\n </div>\n <ul #sourcelist class=\"ui-widget-content ui-picklist-list ui-picklist-source ui-corner-bottom\" [ngClass]=\"{'ui-picklist-highlight': listHighlightSource}\" [ngStyle]=\"sourceStyle\" (dragover)=\"onListMouseMove($event,SOURCE_LIST)\" (dragleave)=\"onListDragLeave()\" (drop)=\"onListDrop($event, SOURCE_LIST)\">\n <ng-template ngFor let-item [ngForOf]=\"source\" [ngForTrackBy]=\"sourceTrackBy || trackBy\" let-i=\"index\" let-l=\"last\">\n <li class=\"ui-picklist-droppoint\" *ngIf=\"dragdrop\" (dragover)=\"onDragOver($event, i, SOURCE_LIST)\" (drop)=\"onDrop($event, i, SOURCE_LIST)\" (dragleave)=\"onDragLeave($event, SOURCE_LIST)\"\n [ngClass]=\"{'ui-picklist-droppoint-highlight': (i === dragOverItemIndexSource)}\" [style.display]=\"isItemVisible(item, SOURCE_LIST) ? 'block' : 'none'\"></li>\n <li [ngClass]=\"{'ui-picklist-item':true,'ui-state-highlight':isSelected(item,selectedItemsSource), 'ui-state-disabled': disabled}\"\n (click)=\"onItemClick($event,item,selectedItemsSource,onSourceSelect)\" (dblclick)=\"onSourceItemDblClick()\" (touchend)=\"onItemTouchEnd($event)\" (keydown)=\"onItemKeydown($event,item,selectedItemsSource,onSourceSelect)\"\n [style.display]=\"isItemVisible(item, SOURCE_LIST) ? 'block' : 'none'\" tabindex=\"0\"\n [draggable]=\"dragdrop\" (dragstart)=\"onDragStart($event, i, SOURCE_LIST)\" (dragend)=\"onDragEnd($event)\">\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: {$implicit: item, index: i}\"></ng-container>\n </li>\n <li class=\"ui-picklist-droppoint\" *ngIf=\"dragdrop&&l\" (dragover)=\"onDragOver($event, i + 1, SOURCE_LIST)\" (drop)=\"onDrop($event, i + 1, SOURCE_LIST)\" (dragleave)=\"onDragLeave($event, SOURCE_LIST)\"\n [ngClass]=\"{'ui-picklist-droppoint-highlight': (i + 1 === dragOverItemIndexSource)}\"></li>\n </ng-template>\n <ng-container *ngIf=\"(source == null || source.length === 0) && emptyMessageSourceTemplate\">\n <li class=\"ui-picklist-empty-message\">\n <ng-container *ngTemplateOutlet=\"emptyMessageSourceTemplate\"></ng-container>\n </li>\n </ng-container>\n </ul>\n </div>\n <div class=\"ui-picklist-buttons\">\n <div class=\"ui-picklist-buttons-cell\">\n <button type=\"button\" pButton icon=\"pi pi-angle-right\" [disabled]=\"disabled\" (click)=\"moveRight()\"></button>\n <button type=\"button\" pButton icon=\"pi pi-angle-double-right\" [disabled]=\"disabled\" (click)=\"moveAllRight()\"></button>\n <button type=\"button\" pButton icon=\"pi pi-angle-left\" [disabled]=\"disabled\" (click)=\"moveLeft()\"></button>\n <button type=\"button\" pButton icon=\"pi pi-angle-double-left\" [disabled]=\"disabled\" (click)=\"moveAllLeft()\"></button>\n </div>\n </div>\n <div class=\"ui-picklist-listwrapper ui-picklist-target-wrapper\" [ngClass]=\"{'ui-picklist-listwrapper-nocontrols':!showTargetControls}\">\n <div class=\"ui-picklist-caption ui-widget-header ui-corner-tl ui-corner-tr\" *ngIf=\"targetHeader\">{{targetHeader}}</div>\n <div class=\"ui-picklist-filter-container ui-widget-content\" *ngIf=\"filterBy && showTargetFilter !== false\">\n <input #targetFilter type=\"text\" role=\"textbox\" (keyup)=\"onFilter($event,target,TARGET_LIST)\" class=\"ui-picklist-filter ui-inputtext ui-widget ui-state-default ui-corner-all\" [disabled]=\"disabled\" [attr.placeholder]=\"targetFilterPlaceholder\" [attr.aria-label]=\"ariaTargetFilterLabel\">\n <span class=\"ui-picklist-filter-icon pi pi-search\"></span>\n </div>\n <ul #targetlist class=\"ui-widget-content ui-picklist-list ui-picklist-target ui-corner-bottom\" [ngClass]=\"{'ui-picklist-highlight': listHighlightTarget}\" [ngStyle]=\"targetStyle\" (dragover)=\"onListMouseMove($event,TARGET_LIST)\" (dragleave)=\"onListDragLeave()\" (drop)=\"onListDrop($event,TARGET_LIST)\">\n <ng-template ngFor let-item [ngForOf]=\"target\" [ngForTrackBy]=\"targetTrackBy || trackBy\" let-i=\"index\" let-l=\"last\">\n <li class=\"ui-picklist-droppoint\" *ngIf=\"dragdrop\" (dragover)=\"onDragOver($event, i, TARGET_LIST)\" (drop)=\"onDrop($event, i, TARGET_LIST)\" (dragleave)=\"onDragLeave($event, TARGET_LIST)\"\n [ngClass]=\"{'ui-picklist-droppoint-highlight': (i === dragOverItemIndexTarget)}\" [style.display]=\"isItemVisible(item, TARGET_LIST) ? 'block' : 'none'\"></li>\n <li [ngClass]=\"{'ui-picklist-item':true,'ui-state-highlight':isSelected(item,selectedItemsTarget), 'ui-state-disabled': disabled}\"\n (click)=\"onItemClick($event,item,selectedItemsTarget,onTargetSelect)\" (dblclick)=\"onTargetItemDblClick()\" (touchend)=\"onItemTouchEnd($event)\" (keydown)=\"onItemKeydown($event,item,selectedItemsTarget,onTargetSelect)\"\n [style.display]=\"isItemVisible(item, TARGET_LIST) ? 'block' : 'none'\" tabindex=\"0\"\n [draggable]=\"dragdrop\" (dragstart)=\"onDragStart($event, i, TARGET_LIST)\" (dragend)=\"onDragEnd($event)\">\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: {$implicit: item, index: i}\"></ng-container>\n </li>\n <li class=\"ui-picklist-droppoint\" *ngIf=\"dragdrop&&l\" (dragover)=\"onDragOver($event, i + 1, TARGET_LIST)\" (drop)=\"onDrop($event, i + 1, TARGET_LIST)\" (dragleave)=\"onDragLeave($event, TARGET_LIST)\"\n [ngClass]=\"{'ui-picklist-droppoint-highlight': (i + 1 === dragOverItemIndexTarget)}\"></li>\n </ng-template>\n <ng-container *ngIf=\"(target == null || target.length === 0) && emptyMessageTargetTemplate\">\n <li class=\"ui-picklist-empty-message\">\n <ng-container *ngTemplateOutlet=\"emptyMessageTargetTemplate\"></ng-container>\n </li>\n </ng-container>\n </ul>\n </div>\n <div class=\"ui-picklist-target-controls ui-picklist-buttons\" *ngIf=\"showTargetControls\">\n <div class=\"ui-picklist-buttons-cell\">\n <button type=\"button\" pButton icon=\"pi pi-angle-up\" [disabled]=\"disabled\" (click)=\"moveUp(targetlist,target,selectedItemsTarget,onTargetReorder)\"></button>\n <button type=\"button\" pButton icon=\"pi pi-angle-double-up\" [disabled]=\"disabled\" (click)=\"moveTop(targetlist,target,selectedItemsTarget,onTargetReorder)\"></button>\n <button type=\"button\" pButton icon=\"pi pi-angle-down\" [disabled]=\"disabled\" (click)=\"moveDown(targetlist,target,selectedItemsTarget,onTargetReorder)\"></button>\n <button type=\"button\" pButton icon=\"pi pi-angle-double-down\" [disabled]=\"disabled\" (click)=\"moveBottom(targetlist,target,selectedItemsTarget,onTargetReorder)\"></button>\n </div>\n </div>\n </div>\n "
  651. }),
  652. __metadata("design:paramtypes", [core_1.ElementRef])
  653. ], PickList);
  654. return PickList;
  655. }());
  656. exports.PickList = PickList;
  657. var PickListModule = /** @class */ (function () {
  658. function PickListModule() {
  659. }
  660. PickListModule = __decorate([
  661. core_1.NgModule({
  662. imports: [common_1.CommonModule, button_1.ButtonModule, shared_1.SharedModule],
  663. exports: [PickList, shared_1.SharedModule],
  664. declarations: [PickList]
  665. })
  666. ], PickListModule);
  667. return PickListModule;
  668. }());
  669. exports.PickListModule = PickListModule;
  670. //# sourceMappingURL=picklist.js.map