1 | import * as i0 from '@angular/core';
|
---|
2 | import { EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, Output, ViewChild, ContentChildren, NgModule } from '@angular/core';
|
---|
3 | import * as i3 from '@angular/common';
|
---|
4 | import { CommonModule } from '@angular/common';
|
---|
5 | import * as i4 from 'primeng/button';
|
---|
6 | import { ButtonModule } from 'primeng/button';
|
---|
7 | import * as i1 from 'primeng/api';
|
---|
8 | import { PrimeTemplate, SharedModule } from 'primeng/api';
|
---|
9 | import { DomHandler } from 'primeng/dom';
|
---|
10 | import * as i5 from 'primeng/ripple';
|
---|
11 | import { RippleModule } from 'primeng/ripple';
|
---|
12 | import * as i2 from '@angular/cdk/drag-drop';
|
---|
13 | import { transferArrayItem, moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
|
---|
14 | import { UniqueComponentId, ObjectUtils } from 'primeng/utils';
|
---|
15 |
|
---|
16 | class PickList {
|
---|
17 | constructor(el, cd, filterService) {
|
---|
18 | this.el = el;
|
---|
19 | this.cd = cd;
|
---|
20 | this.filterService = filterService;
|
---|
21 | this.trackBy = (index, item) => item;
|
---|
22 | this.showSourceFilter = true;
|
---|
23 | this.showTargetFilter = true;
|
---|
24 | this.metaKeySelection = true;
|
---|
25 | this.dragdrop = false;
|
---|
26 | this.showSourceControls = true;
|
---|
27 | this.showTargetControls = true;
|
---|
28 | this.disabled = false;
|
---|
29 | this.filterMatchMode = "contains";
|
---|
30 | this.breakpoint = "960px";
|
---|
31 | this.onMoveToSource = new EventEmitter();
|
---|
32 | this.onMoveAllToSource = new EventEmitter();
|
---|
33 | this.onMoveAllToTarget = new EventEmitter();
|
---|
34 | this.onMoveToTarget = new EventEmitter();
|
---|
35 | this.onSourceReorder = new EventEmitter();
|
---|
36 | this.onTargetReorder = new EventEmitter();
|
---|
37 | this.onSourceSelect = new EventEmitter();
|
---|
38 | this.onTargetSelect = new EventEmitter();
|
---|
39 | this.onSourceFilter = new EventEmitter();
|
---|
40 | this.onTargetFilter = new EventEmitter();
|
---|
41 | this.selectedItemsSource = [];
|
---|
42 | this.selectedItemsTarget = [];
|
---|
43 | this.id = UniqueComponentId();
|
---|
44 | this.SOURCE_LIST = -1;
|
---|
45 | this.TARGET_LIST = 1;
|
---|
46 | }
|
---|
47 | ngOnInit() {
|
---|
48 | if (this.responsive) {
|
---|
49 | this.createStyle();
|
---|
50 | }
|
---|
51 | }
|
---|
52 | ngAfterContentInit() {
|
---|
53 | this.templates.forEach((item) => {
|
---|
54 | switch (item.getType()) {
|
---|
55 | case 'item':
|
---|
56 | this.itemTemplate = item.template;
|
---|
57 | break;
|
---|
58 | case 'sourceHeader':
|
---|
59 | this.sourceHeaderTemplate = item.template;
|
---|
60 | break;
|
---|
61 | case 'targetHeader':
|
---|
62 | this.targetHeaderTemplate = item.template;
|
---|
63 | break;
|
---|
64 | case 'emptymessagesource':
|
---|
65 | this.emptyMessageSourceTemplate = item.template;
|
---|
66 | break;
|
---|
67 | case 'emptyfiltermessagesource':
|
---|
68 | this.emptyFilterMessageSourceTemplate = item.template;
|
---|
69 | break;
|
---|
70 | case 'emptymessagetarget':
|
---|
71 | this.emptyMessageTargetTemplate = item.template;
|
---|
72 | break;
|
---|
73 | case 'emptyfiltermessagetarget':
|
---|
74 | this.emptyFilterMessageTargetTemplate = item.template;
|
---|
75 | break;
|
---|
76 | default:
|
---|
77 | this.itemTemplate = item.template;
|
---|
78 | break;
|
---|
79 | }
|
---|
80 | });
|
---|
81 | }
|
---|
82 | ngAfterViewChecked() {
|
---|
83 | if (this.movedUp || this.movedDown) {
|
---|
84 | let listItems = DomHandler.find(this.reorderedListElement, 'li.p-highlight');
|
---|
85 | let listItem;
|
---|
86 | if (this.movedUp)
|
---|
87 | listItem = listItems[0];
|
---|
88 | else
|
---|
89 | listItem = listItems[listItems.length - 1];
|
---|
90 | DomHandler.scrollInView(this.reorderedListElement, listItem);
|
---|
91 | this.movedUp = false;
|
---|
92 | this.movedDown = false;
|
---|
93 | this.reorderedListElement = null;
|
---|
94 | }
|
---|
95 | }
|
---|
96 | onItemClick(event, item, selectedItems, callback) {
|
---|
97 | if (this.disabled) {
|
---|
98 | return;
|
---|
99 | }
|
---|
100 | let index = this.findIndexInSelection(item, selectedItems);
|
---|
101 | let selected = (index != -1);
|
---|
102 | let metaSelection = this.itemTouched ? false : this.metaKeySelection;
|
---|
103 | if (metaSelection) {
|
---|
104 | let metaKey = (event.metaKey || event.ctrlKey || event.shiftKey);
|
---|
105 | if (selected && metaKey) {
|
---|
106 | selectedItems.splice(index, 1);
|
---|
107 | }
|
---|
108 | else {
|
---|
109 | if (!metaKey) {
|
---|
110 | selectedItems.length = 0;
|
---|
111 | }
|
---|
112 | selectedItems.push(item);
|
---|
113 | }
|
---|
114 | }
|
---|
115 | else {
|
---|
116 | if (selected)
|
---|
117 | selectedItems.splice(index, 1);
|
---|
118 | else
|
---|
119 | selectedItems.push(item);
|
---|
120 | }
|
---|
121 | callback.emit({ originalEvent: event, items: selectedItems });
|
---|
122 | this.itemTouched = false;
|
---|
123 | }
|
---|
124 | onSourceItemDblClick() {
|
---|
125 | if (this.disabled) {
|
---|
126 | return;
|
---|
127 | }
|
---|
128 | this.moveRight();
|
---|
129 | }
|
---|
130 | onTargetItemDblClick() {
|
---|
131 | if (this.disabled) {
|
---|
132 | return;
|
---|
133 | }
|
---|
134 | this.moveLeft();
|
---|
135 | }
|
---|
136 | onFilter(event, data, listType) {
|
---|
137 | let query = event.target.value.trim().toLocaleLowerCase(this.filterLocale);
|
---|
138 | if (listType === this.SOURCE_LIST)
|
---|
139 | this.filterValueSource = query;
|
---|
140 | else if (listType === this.TARGET_LIST)
|
---|
141 | this.filterValueTarget = query;
|
---|
142 | this.filter(data, listType);
|
---|
143 | }
|
---|
144 | filter(data, listType) {
|
---|
145 | let searchFields = this.filterBy.split(',');
|
---|
146 | if (listType === this.SOURCE_LIST) {
|
---|
147 | this.visibleOptionsSource = this.filterService.filter(data, searchFields, this.filterValueSource, this.filterMatchMode, this.filterLocale);
|
---|
148 | this.onSourceFilter.emit({ query: this.filterValueSource, value: this.visibleOptionsSource });
|
---|
149 | }
|
---|
150 | else if (listType === this.TARGET_LIST) {
|
---|
151 | this.visibleOptionsTarget = this.filterService.filter(data, searchFields, this.filterValueTarget, this.filterMatchMode, this.filterLocale);
|
---|
152 | this.onTargetFilter.emit({ query: this.filterValueTarget, value: this.visibleOptionsTarget });
|
---|
153 | }
|
---|
154 | }
|
---|
155 | isItemVisible(item, listType) {
|
---|
156 | if (listType == this.SOURCE_LIST)
|
---|
157 | return this.isVisibleInList(this.visibleOptionsSource, item, this.filterValueSource);
|
---|
158 | else
|
---|
159 | return this.isVisibleInList(this.visibleOptionsTarget, item, this.filterValueTarget);
|
---|
160 | }
|
---|
161 | isEmpty(listType) {
|
---|
162 | if (listType == this.SOURCE_LIST)
|
---|
163 | return this.filterValueSource ? (!this.visibleOptionsSource || this.visibleOptionsSource.length === 0) : (!this.source || this.source.length === 0);
|
---|
164 | else
|
---|
165 | return this.filterValueTarget ? (!this.visibleOptionsTarget || this.visibleOptionsTarget.length === 0) : (!this.target || this.target.length === 0);
|
---|
166 | }
|
---|
167 | isVisibleInList(data, item, filterValue) {
|
---|
168 | if (filterValue && filterValue.trim().length) {
|
---|
169 | for (let i = 0; i < data.length; i++) {
|
---|
170 | if (item == data[i]) {
|
---|
171 | return true;
|
---|
172 | }
|
---|
173 | }
|
---|
174 | }
|
---|
175 | else {
|
---|
176 | return true;
|
---|
177 | }
|
---|
178 | }
|
---|
179 | onItemTouchEnd() {
|
---|
180 | if (this.disabled) {
|
---|
181 | return;
|
---|
182 | }
|
---|
183 | this.itemTouched = true;
|
---|
184 | }
|
---|
185 | sortByIndexInList(items, list) {
|
---|
186 | return items.sort((item1, item2) => ObjectUtils.findIndexInList(item1, list) - ObjectUtils.findIndexInList(item2, list));
|
---|
187 | }
|
---|
188 | moveUp(listElement, list, selectedItems, callback, listType) {
|
---|
189 | if (selectedItems && selectedItems.length) {
|
---|
190 | selectedItems = this.sortByIndexInList(selectedItems, list);
|
---|
191 | for (let i = 0; i < selectedItems.length; i++) {
|
---|
192 | let selectedItem = selectedItems[i];
|
---|
193 | let selectedItemIndex = ObjectUtils.findIndexInList(selectedItem, list);
|
---|
194 | if (selectedItemIndex != 0) {
|
---|
195 | let movedItem = list[selectedItemIndex];
|
---|
196 | let temp = list[selectedItemIndex - 1];
|
---|
197 | list[selectedItemIndex - 1] = movedItem;
|
---|
198 | list[selectedItemIndex] = temp;
|
---|
199 | }
|
---|
200 | else {
|
---|
201 | break;
|
---|
202 | }
|
---|
203 | }
|
---|
204 | if (this.dragdrop && ((this.filterValueSource && listType === this.SOURCE_LIST) || (this.filterValueTarget && listType === this.TARGET_LIST)))
|
---|
205 | this.filter(list, listType);
|
---|
206 | this.movedUp = true;
|
---|
207 | this.reorderedListElement = listElement;
|
---|
208 | callback.emit({ items: selectedItems });
|
---|
209 | }
|
---|
210 | }
|
---|
211 | moveTop(listElement, list, selectedItems, callback, listType) {
|
---|
212 | if (selectedItems && selectedItems.length) {
|
---|
213 | selectedItems = this.sortByIndexInList(selectedItems, list);
|
---|
214 | for (let i = 0; i < selectedItems.length; i++) {
|
---|
215 | let selectedItem = selectedItems[i];
|
---|
216 | let selectedItemIndex = ObjectUtils.findIndexInList(selectedItem, list);
|
---|
217 | if (selectedItemIndex != 0) {
|
---|
218 | let movedItem = list.splice(selectedItemIndex, 1)[0];
|
---|
219 | list.unshift(movedItem);
|
---|
220 | }
|
---|
221 | else {
|
---|
222 | break;
|
---|
223 | }
|
---|
224 | }
|
---|
225 | if (this.dragdrop && ((this.filterValueSource && listType === this.SOURCE_LIST) || (this.filterValueTarget && listType === this.TARGET_LIST)))
|
---|
226 | this.filter(list, listType);
|
---|
227 | listElement.scrollTop = 0;
|
---|
228 | callback.emit({ items: selectedItems });
|
---|
229 | }
|
---|
230 | }
|
---|
231 | moveDown(listElement, list, selectedItems, callback, listType) {
|
---|
232 | if (selectedItems && selectedItems.length) {
|
---|
233 | selectedItems = this.sortByIndexInList(selectedItems, list);
|
---|
234 | for (let i = selectedItems.length - 1; i >= 0; i--) {
|
---|
235 | let selectedItem = selectedItems[i];
|
---|
236 | let selectedItemIndex = ObjectUtils.findIndexInList(selectedItem, list);
|
---|
237 | if (selectedItemIndex != (list.length - 1)) {
|
---|
238 | let movedItem = list[selectedItemIndex];
|
---|
239 | let temp = list[selectedItemIndex + 1];
|
---|
240 | list[selectedItemIndex + 1] = movedItem;
|
---|
241 | list[selectedItemIndex] = temp;
|
---|
242 | }
|
---|
243 | else {
|
---|
244 | break;
|
---|
245 | }
|
---|
246 | }
|
---|
247 | if (this.dragdrop && ((this.filterValueSource && listType === this.SOURCE_LIST) || (this.filterValueTarget && listType === this.TARGET_LIST)))
|
---|
248 | this.filter(list, listType);
|
---|
249 | this.movedDown = true;
|
---|
250 | this.reorderedListElement = listElement;
|
---|
251 | callback.emit({ items: selectedItems });
|
---|
252 | }
|
---|
253 | }
|
---|
254 | moveBottom(listElement, list, selectedItems, callback, listType) {
|
---|
255 | if (selectedItems && selectedItems.length) {
|
---|
256 | selectedItems = this.sortByIndexInList(selectedItems, list);
|
---|
257 | for (let i = selectedItems.length - 1; i >= 0; i--) {
|
---|
258 | let selectedItem = selectedItems[i];
|
---|
259 | let selectedItemIndex = ObjectUtils.findIndexInList(selectedItem, list);
|
---|
260 | if (selectedItemIndex != (list.length - 1)) {
|
---|
261 | let movedItem = list.splice(selectedItemIndex, 1)[0];
|
---|
262 | list.push(movedItem);
|
---|
263 | }
|
---|
264 | else {
|
---|
265 | break;
|
---|
266 | }
|
---|
267 | }
|
---|
268 | if (this.dragdrop && ((this.filterValueSource && listType === this.SOURCE_LIST) || (this.filterValueTarget && listType === this.TARGET_LIST)))
|
---|
269 | this.filter(list, listType);
|
---|
270 | listElement.scrollTop = listElement.scrollHeight;
|
---|
271 | callback.emit({ items: selectedItems });
|
---|
272 | }
|
---|
273 | }
|
---|
274 | moveRight() {
|
---|
275 | if (this.selectedItemsSource && this.selectedItemsSource.length) {
|
---|
276 | for (let i = 0; i < this.selectedItemsSource.length; i++) {
|
---|
277 | let selectedItem = this.selectedItemsSource[i];
|
---|
278 | if (ObjectUtils.findIndexInList(selectedItem, this.target) == -1) {
|
---|
279 | this.target.push(this.source.splice(ObjectUtils.findIndexInList(selectedItem, this.source), 1)[0]);
|
---|
280 | if (this.visibleOptionsSource)
|
---|
281 | this.visibleOptionsSource.splice(ObjectUtils.findIndexInList(selectedItem, this.visibleOptionsSource), 1);
|
---|
282 | }
|
---|
283 | }
|
---|
284 | this.onMoveToTarget.emit({
|
---|
285 | items: this.selectedItemsSource
|
---|
286 | });
|
---|
287 | this.selectedItemsSource = [];
|
---|
288 | if (this.filterValueTarget) {
|
---|
289 | this.filter(this.target, this.TARGET_LIST);
|
---|
290 | }
|
---|
291 | }
|
---|
292 | }
|
---|
293 | moveAllRight() {
|
---|
294 | if (this.source) {
|
---|
295 | let movedItems = [];
|
---|
296 | for (let i = 0; i < this.source.length; i++) {
|
---|
297 | if (this.isItemVisible(this.source[i], this.SOURCE_LIST)) {
|
---|
298 | let removedItem = this.source.splice(i, 1)[0];
|
---|
299 | this.target.push(removedItem);
|
---|
300 | movedItems.push(removedItem);
|
---|
301 | i--;
|
---|
302 | }
|
---|
303 | }
|
---|
304 | this.onMoveAllToTarget.emit({
|
---|
305 | items: movedItems
|
---|
306 | });
|
---|
307 | this.selectedItemsSource = [];
|
---|
308 | if (this.filterValueTarget) {
|
---|
309 | this.filter(this.target, this.TARGET_LIST);
|
---|
310 | }
|
---|
311 | this.visibleOptionsSource = [];
|
---|
312 | }
|
---|
313 | }
|
---|
314 | moveLeft() {
|
---|
315 | if (this.selectedItemsTarget && this.selectedItemsTarget.length) {
|
---|
316 | for (let i = 0; i < this.selectedItemsTarget.length; i++) {
|
---|
317 | let selectedItem = this.selectedItemsTarget[i];
|
---|
318 | if (ObjectUtils.findIndexInList(selectedItem, this.source) == -1) {
|
---|
319 | this.source.push(this.target.splice(ObjectUtils.findIndexInList(selectedItem, this.target), 1)[0]);
|
---|
320 | if (this.visibleOptionsTarget)
|
---|
321 | this.visibleOptionsTarget.splice(ObjectUtils.findIndexInList(selectedItem, this.visibleOptionsTarget), 1)[0];
|
---|
322 | }
|
---|
323 | }
|
---|
324 | this.onMoveToSource.emit({
|
---|
325 | items: this.selectedItemsTarget
|
---|
326 | });
|
---|
327 | this.selectedItemsTarget = [];
|
---|
328 | if (this.filterValueSource) {
|
---|
329 | this.filter(this.source, this.SOURCE_LIST);
|
---|
330 | }
|
---|
331 | }
|
---|
332 | }
|
---|
333 | moveAllLeft() {
|
---|
334 | if (this.target) {
|
---|
335 | let movedItems = [];
|
---|
336 | for (let i = 0; i < this.target.length; i++) {
|
---|
337 | if (this.isItemVisible(this.target[i], this.TARGET_LIST)) {
|
---|
338 | let removedItem = this.target.splice(i, 1)[0];
|
---|
339 | this.source.push(removedItem);
|
---|
340 | movedItems.push(removedItem);
|
---|
341 | i--;
|
---|
342 | }
|
---|
343 | }
|
---|
344 | this.onMoveAllToSource.emit({
|
---|
345 | items: movedItems
|
---|
346 | });
|
---|
347 | this.selectedItemsTarget = [];
|
---|
348 | if (this.filterValueSource) {
|
---|
349 | this.filter(this.source, this.SOURCE_LIST);
|
---|
350 | }
|
---|
351 | this.visibleOptionsTarget = [];
|
---|
352 | }
|
---|
353 | }
|
---|
354 | isSelected(item, selectedItems) {
|
---|
355 | return this.findIndexInSelection(item, selectedItems) != -1;
|
---|
356 | }
|
---|
357 | findIndexInSelection(item, selectedItems) {
|
---|
358 | return ObjectUtils.findIndexInList(item, selectedItems);
|
---|
359 | }
|
---|
360 | onDrop(event, listType) {
|
---|
361 | let isTransfer = event.previousContainer !== event.container;
|
---|
362 | let dropIndexes = this.getDropIndexes(event.previousIndex, event.currentIndex, listType, isTransfer, event.item.data);
|
---|
363 | if (listType === this.SOURCE_LIST) {
|
---|
364 | if (isTransfer) {
|
---|
365 | transferArrayItem(event.previousContainer.data, event.container.data, dropIndexes.previousIndex, dropIndexes.currentIndex);
|
---|
366 | if (this.visibleOptionsTarget)
|
---|
367 | this.visibleOptionsTarget.splice(event.previousIndex, 1);
|
---|
368 | this.onMoveToSource.emit({ items: [event.item.data] });
|
---|
369 | }
|
---|
370 | else {
|
---|
371 | moveItemInArray(event.container.data, dropIndexes.previousIndex, dropIndexes.currentIndex);
|
---|
372 | this.onSourceReorder.emit({ items: [event.item.data] });
|
---|
373 | }
|
---|
374 | if (this.filterValueSource) {
|
---|
375 | this.filter(this.source, this.SOURCE_LIST);
|
---|
376 | }
|
---|
377 | }
|
---|
378 | else {
|
---|
379 | if (isTransfer) {
|
---|
380 | transferArrayItem(event.previousContainer.data, event.container.data, dropIndexes.previousIndex, dropIndexes.currentIndex);
|
---|
381 | if (this.visibleOptionsSource)
|
---|
382 | this.visibleOptionsSource.splice(event.previousIndex, 1);
|
---|
383 | this.onMoveToTarget.emit({ items: [event.item.data] });
|
---|
384 | }
|
---|
385 | else {
|
---|
386 | moveItemInArray(event.container.data, dropIndexes.previousIndex, dropIndexes.currentIndex);
|
---|
387 | this.onTargetReorder.emit({ items: [event.item.data] });
|
---|
388 | }
|
---|
389 | if (this.filterValueTarget) {
|
---|
390 | this.filter(this.target, this.TARGET_LIST);
|
---|
391 | }
|
---|
392 | }
|
---|
393 | }
|
---|
394 | getDropIndexes(fromIndex, toIndex, droppedList, isTransfer, data) {
|
---|
395 | let previousIndex, currentIndex;
|
---|
396 | if (droppedList === this.SOURCE_LIST) {
|
---|
397 | previousIndex = isTransfer ? this.filterValueTarget ? ObjectUtils.findIndexInList(data, this.target) : fromIndex : this.filterValueSource ? ObjectUtils.findIndexInList(data, this.source) : fromIndex;
|
---|
398 | currentIndex = this.filterValueSource ? this.findFilteredCurrentIndex(this.visibleOptionsSource, toIndex, this.source) : toIndex;
|
---|
399 | }
|
---|
400 | else {
|
---|
401 | previousIndex = isTransfer ? this.filterValueSource ? ObjectUtils.findIndexInList(data, this.source) : fromIndex : this.filterValueTarget ? ObjectUtils.findIndexInList(data, this.target) : fromIndex;
|
---|
402 | currentIndex = this.filterValueTarget ? this.findFilteredCurrentIndex(this.visibleOptionsTarget, toIndex, this.target) : toIndex;
|
---|
403 | }
|
---|
404 | return { previousIndex, currentIndex };
|
---|
405 | }
|
---|
406 | findFilteredCurrentIndex(visibleOptions, index, options) {
|
---|
407 | if (visibleOptions.length === index) {
|
---|
408 | let toIndex = ObjectUtils.findIndexInList(visibleOptions[index - 1], options);
|
---|
409 | return toIndex + 1;
|
---|
410 | }
|
---|
411 | else {
|
---|
412 | return ObjectUtils.findIndexInList(visibleOptions[index], options);
|
---|
413 | }
|
---|
414 | }
|
---|
415 | resetFilter() {
|
---|
416 | this.visibleOptionsSource = null;
|
---|
417 | this.filterValueSource = null;
|
---|
418 | this.visibleOptionsTarget = null;
|
---|
419 | this.filterValueTarget = null;
|
---|
420 | this.sourceFilterViewChild.nativeElement.value = '';
|
---|
421 | this.targetFilterViewChild.nativeElement.value = '';
|
---|
422 | }
|
---|
423 | onItemKeydown(event, item, selectedItems, callback) {
|
---|
424 | let listItem = event.currentTarget;
|
---|
425 | switch (event.which) {
|
---|
426 | //down
|
---|
427 | case 40:
|
---|
428 | var nextItem = this.findNextItem(listItem);
|
---|
429 | if (nextItem) {
|
---|
430 | nextItem.focus();
|
---|
431 | }
|
---|
432 | event.preventDefault();
|
---|
433 | break;
|
---|
434 | //up
|
---|
435 | case 38:
|
---|
436 | var prevItem = this.findPrevItem(listItem);
|
---|
437 | if (prevItem) {
|
---|
438 | prevItem.focus();
|
---|
439 | }
|
---|
440 | event.preventDefault();
|
---|
441 | break;
|
---|
442 | //enter
|
---|
443 | case 13:
|
---|
444 | this.onItemClick(event, item, selectedItems, callback);
|
---|
445 | event.preventDefault();
|
---|
446 | break;
|
---|
447 | }
|
---|
448 | }
|
---|
449 | findNextItem(item) {
|
---|
450 | let nextItem = item.nextElementSibling;
|
---|
451 | if (nextItem)
|
---|
452 | return !DomHandler.hasClass(nextItem, 'p-picklist-item') || DomHandler.isHidden(nextItem) ? this.findNextItem(nextItem) : nextItem;
|
---|
453 | else
|
---|
454 | return null;
|
---|
455 | }
|
---|
456 | findPrevItem(item) {
|
---|
457 | let prevItem = item.previousElementSibling;
|
---|
458 | if (prevItem)
|
---|
459 | return !DomHandler.hasClass(prevItem, 'p-picklist-item') || DomHandler.isHidden(prevItem) ? this.findPrevItem(prevItem) : prevItem;
|
---|
460 | else
|
---|
461 | return null;
|
---|
462 | }
|
---|
463 | createStyle() {
|
---|
464 | if (!this.styleElement) {
|
---|
465 | this.el.nativeElement.children[0].setAttribute(this.id, '');
|
---|
466 | this.styleElement = document.createElement('style');
|
---|
467 | this.styleElement.type = 'text/css';
|
---|
468 | document.head.appendChild(this.styleElement);
|
---|
469 | let innerHTML = `
|
---|
470 | @media screen and (max-width: ${this.breakpoint}) {
|
---|
471 | .p-picklist[${this.id}] {
|
---|
472 | flex-direction: column;
|
---|
473 | }
|
---|
474 |
|
---|
475 | .p-picklist[${this.id}] .p-picklist-buttons {
|
---|
476 | padding: var(--content-padding);
|
---|
477 | flex-direction: row;
|
---|
478 | }
|
---|
479 |
|
---|
480 | .p-picklist[${this.id}] .p-picklist-buttons .p-button {
|
---|
481 | margin-right: var(--inline-spacing);
|
---|
482 | margin-bottom: 0;
|
---|
483 | }
|
---|
484 |
|
---|
485 | .p-picklist[${this.id}] .p-picklist-buttons .p-button:last-child {
|
---|
486 | margin-right: 0;
|
---|
487 | }
|
---|
488 |
|
---|
489 | .p-picklist[${this.id}] .pi-angle-right:before {
|
---|
490 | content: "\\e930"
|
---|
491 | }
|
---|
492 |
|
---|
493 | .p-picklist[${this.id}] .pi-angle-double-right:before {
|
---|
494 | content: "\\e92c"
|
---|
495 | }
|
---|
496 |
|
---|
497 | .p-picklist[${this.id}] .pi-angle-left:before {
|
---|
498 | content: "\\e933"
|
---|
499 | }
|
---|
500 |
|
---|
501 | .p-picklist[${this.id}] .pi-angle-double-left:before {
|
---|
502 | content: "\\e92f"
|
---|
503 | }
|
---|
504 | }
|
---|
505 | `;
|
---|
506 | this.styleElement.innerHTML = innerHTML;
|
---|
507 | }
|
---|
508 | }
|
---|
509 | destroyStyle() {
|
---|
510 | if (this.styleElement) {
|
---|
511 | document.head.removeChild(this.styleElement);
|
---|
512 | this.styleElement = null;
|
---|
513 | ``;
|
---|
514 | }
|
---|
515 | }
|
---|
516 | ngOnDestroy() {
|
---|
517 | this.destroyStyle();
|
---|
518 | }
|
---|
519 | }
|
---|
520 | PickList.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: PickList, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1.FilterService }], target: i0.ɵɵFactoryTarget.Component });
|
---|
521 | PickList.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: PickList, selector: "p-pickList", inputs: { source: "source", target: "target", sourceHeader: "sourceHeader", rightButtonAriaLabel: "rightButtonAriaLabel", leftButtonAriaLabel: "leftButtonAriaLabel", allRightButtonAriaLabel: "allRightButtonAriaLabel", allLeftButtonAriaLabel: "allLeftButtonAriaLabel", upButtonAriaLabel: "upButtonAriaLabel", downButtonAriaLabel: "downButtonAriaLabel", topButtonAriaLabel: "topButtonAriaLabel", bottomButtonAriaLabel: "bottomButtonAriaLabel", targetHeader: "targetHeader", responsive: "responsive", filterBy: "filterBy", filterLocale: "filterLocale", trackBy: "trackBy", sourceTrackBy: "sourceTrackBy", targetTrackBy: "targetTrackBy", showSourceFilter: "showSourceFilter", showTargetFilter: "showTargetFilter", metaKeySelection: "metaKeySelection", dragdrop: "dragdrop", style: "style", styleClass: "styleClass", sourceStyle: "sourceStyle", targetStyle: "targetStyle", showSourceControls: "showSourceControls", showTargetControls: "showTargetControls", sourceFilterPlaceholder: "sourceFilterPlaceholder", targetFilterPlaceholder: "targetFilterPlaceholder", disabled: "disabled", ariaSourceFilterLabel: "ariaSourceFilterLabel", ariaTargetFilterLabel: "ariaTargetFilterLabel", filterMatchMode: "filterMatchMode", breakpoint: "breakpoint" }, outputs: { onMoveToSource: "onMoveToSource", onMoveAllToSource: "onMoveAllToSource", onMoveAllToTarget: "onMoveAllToTarget", onMoveToTarget: "onMoveToTarget", onSourceReorder: "onSourceReorder", onTargetReorder: "onTargetReorder", onSourceSelect: "onSourceSelect", onTargetSelect: "onTargetSelect", onSourceFilter: "onSourceFilter", onTargetFilter: "onTargetFilter" }, host: { classAttribute: "p-element" }, queries: [{ propertyName: "templates", predicate: PrimeTemplate }], viewQueries: [{ propertyName: "listViewSourceChild", first: true, predicate: ["sourcelist"], descendants: true }, { propertyName: "listViewTargetChild", first: true, predicate: ["targetlist"], descendants: true }, { propertyName: "sourceFilterViewChild", first: true, predicate: ["sourceFilter"], descendants: true }, { propertyName: "targetFilterViewChild", first: true, predicate: ["targetFilter"], descendants: true }], ngImport: i0, template: `
|
---|
522 | <div [class]="styleClass" [ngStyle]="style" [ngClass]="'p-picklist p-component'" cdkDropListGroup>
|
---|
523 | <div class="p-picklist-buttons p-picklist-source-controls" *ngIf="showSourceControls">
|
---|
524 | <button type="button" [attr.aria-label]="upButtonAriaLabel" pButton pRipple icon="pi pi-angle-up" [disabled]="disabled" (click)="moveUp(sourcelist,source,selectedItemsSource,onSourceReorder,SOURCE_LIST)"></button>
|
---|
525 | <button type="button" [attr.aria-label]="topButtonAriaLabel" pButton pRipple icon="pi pi-angle-double-up" [disabled]="disabled" (click)="moveTop(sourcelist,source,selectedItemsSource,onSourceReorder,SOURCE_LIST)"></button>
|
---|
526 | <button type="button" [attr.aria-label]="downButtonAriaLabel" pButton pRipple icon="pi pi-angle-down" [disabled]="disabled" (click)="moveDown(sourcelist,source,selectedItemsSource,onSourceReorder,SOURCE_LIST)"></button>
|
---|
527 | <button type="button" [attr.aria-label]="bottomButtonAriaLabel" pButton pRipple icon="pi pi-angle-double-down" [disabled]="disabled" (click)="moveBottom(sourcelist,source,selectedItemsSource,onSourceReorder,SOURCE_LIST)"></button>
|
---|
528 | </div>
|
---|
529 | <div class="p-picklist-list-wrapper p-picklist-source-wrapper">
|
---|
530 | <div class="p-picklist-header" *ngIf="sourceHeader || sourceHeaderTemplate">
|
---|
531 | <div class="p-picklist-title" *ngIf="!sourceHeaderTemplate">{{sourceHeader}}</div>
|
---|
532 | <ng-container *ngTemplateOutlet="sourceHeaderTemplate"></ng-container>
|
---|
533 | </div>
|
---|
534 | <div class="p-picklist-filter-container" *ngIf="filterBy && showSourceFilter !== false">
|
---|
535 | <div class="p-picklist-filter">
|
---|
536 | <input #sourceFilter type="text" role="textbox" (keyup)="onFilter($event,source,SOURCE_LIST)" class="p-picklist-filter-input p-inputtext p-component" [disabled]="disabled" [attr.placeholder]="sourceFilterPlaceholder" [attr.aria-label]="ariaSourceFilterLabel">
|
---|
537 | <span class="p-picklist-filter-icon pi pi-search"></span>
|
---|
538 | </div>
|
---|
539 | </div>
|
---|
540 |
|
---|
541 | <ul #sourcelist class="p-picklist-list p-picklist-source" cdkDropList [cdkDropListData]="source" (cdkDropListDropped)="onDrop($event, SOURCE_LIST)"
|
---|
542 | [ngStyle]="sourceStyle" role="listbox" aria-multiselectable="multiple">
|
---|
543 | <ng-template ngFor let-item [ngForOf]="source" [ngForTrackBy]="sourceTrackBy || trackBy" let-i="index" let-l="last">
|
---|
544 | <li [ngClass]="{'p-picklist-item':true,'p-highlight':isSelected(item,selectedItemsSource),'p-disabled': disabled}" pRipple cdkDrag [cdkDragData]="item" [cdkDragDisabled]="!dragdrop"
|
---|
545 | (click)="onItemClick($event,item,selectedItemsSource,onSourceSelect)" (dblclick)="onSourceItemDblClick()" (touchend)="onItemTouchEnd()" (keydown)="onItemKeydown($event,item,selectedItemsSource,onSourceSelect)"
|
---|
546 | *ngIf="isItemVisible(item, SOURCE_LIST)" tabindex="0" role="option" [attr.aria-selected]="isSelected(item, selectedItemsSource)">
|
---|
547 | <ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item, index: i}"></ng-container>
|
---|
548 | </li>
|
---|
549 | </ng-template>
|
---|
550 | <ng-container *ngIf="isEmpty(SOURCE_LIST) && (emptyMessageSourceTemplate || emptyFilterMessageSourceTemplate)">
|
---|
551 | <li class="p-picklist-empty-message" *ngIf="!filterValueSource || !emptyFilterMessageSourceTemplate">
|
---|
552 | <ng-container *ngTemplateOutlet="emptyMessageSourceTemplate"></ng-container>
|
---|
553 | </li>
|
---|
554 | <li class="p-picklist-empty-message" *ngIf="filterValueSource">
|
---|
555 | <ng-container *ngTemplateOutlet="emptyFilterMessageSourceTemplate"></ng-container>
|
---|
556 | </li>
|
---|
557 | </ng-container>
|
---|
558 | </ul>
|
---|
559 | </div>
|
---|
560 | <div class="p-picklist-buttons p-picklist-transfer-buttons">
|
---|
561 | <button type="button" [attr.aria-label]="rightButtonAriaLabel" pButton pRipple icon="pi pi-angle-right" [disabled]="disabled" (click)="moveRight()"></button>
|
---|
562 | <button type="button" [attr.aria-label]="allRightButtonAriaLabel" pButton pRipple icon="pi pi-angle-double-right" [disabled]="disabled" (click)="moveAllRight()"></button>
|
---|
563 | <button type="button" [attr.aria-label]="leftButtonAriaLabel" pButton pRipple icon="pi pi-angle-left" [disabled]="disabled" (click)="moveLeft()"></button>
|
---|
564 | <button type="button" [attr.aria-label]="allLeftButtonAriaLabel" pButton pRipple icon="pi pi-angle-double-left" [disabled]="disabled" (click)="moveAllLeft()"></button>
|
---|
565 | </div>
|
---|
566 | <div class="p-picklist-list-wrapper p-picklist-target-wrapper">
|
---|
567 | <div class="p-picklist-header" *ngIf="targetHeader || targetHeaderTemplate">
|
---|
568 | <div class="p-picklist-title" *ngIf="!targetHeaderTemplate">{{targetHeader}}</div>
|
---|
569 | <ng-container *ngTemplateOutlet="targetHeaderTemplate"></ng-container>
|
---|
570 | </div>
|
---|
571 | <div class="p-picklist-filter-container" *ngIf="filterBy && showTargetFilter !== false">
|
---|
572 | <div class="p-picklist-filter">
|
---|
573 | <input #targetFilter type="text" role="textbox" (keyup)="onFilter($event,target,TARGET_LIST)" class="p-picklist-filter-input p-inputtext p-component" [disabled]="disabled" [attr.placeholder]="targetFilterPlaceholder" [attr.aria-label]="ariaTargetFilterLabel">
|
---|
574 | <span class="p-picklist-filter-icon pi pi-search"></span>
|
---|
575 | </div>
|
---|
576 | </div>
|
---|
577 | <ul #targetlist class="p-picklist-list p-picklist-target" cdkDropList [cdkDropListData]="target" (cdkDropListDropped)="onDrop($event, TARGET_LIST)"
|
---|
578 | [ngStyle]="targetStyle" role="listbox" aria-multiselectable="multiple">
|
---|
579 | <ng-template ngFor let-item [ngForOf]="target" [ngForTrackBy]="targetTrackBy || trackBy" let-i="index" let-l="last">
|
---|
580 | <li [ngClass]="{'p-picklist-item':true,'p-highlight':isSelected(item,selectedItemsTarget), 'p-disabled': disabled}" pRipple cdkDrag [cdkDragData]="item" [cdkDragDisabled]="!dragdrop"
|
---|
581 | (click)="onItemClick($event,item,selectedItemsTarget,onTargetSelect)" (dblclick)="onTargetItemDblClick()" (touchend)="onItemTouchEnd()" (keydown)="onItemKeydown($event,item,selectedItemsTarget,onTargetSelect)"
|
---|
582 | *ngIf="isItemVisible(item, TARGET_LIST)" tabindex="0" role="option" [attr.aria-selected]="isSelected(item, selectedItemsTarget)">
|
---|
583 | <ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item, index: i}"></ng-container>
|
---|
584 | </li>
|
---|
585 | </ng-template>
|
---|
586 | <ng-container *ngIf="isEmpty(TARGET_LIST) && (emptyMessageTargetTemplate || emptyFilterMessageTargetTemplate)">
|
---|
587 | <li class="p-picklist-empty-message" *ngIf="!filterValueTarget || !emptyFilterMessageTargetTemplate">
|
---|
588 | <ng-container *ngTemplateOutlet="emptyMessageTargetTemplate"></ng-container>
|
---|
589 | </li>
|
---|
590 | <li class="p-picklist-empty-message" *ngIf="filterValueTarget">
|
---|
591 | <ng-container *ngTemplateOutlet="emptyFilterMessageTargetTemplate"></ng-container>
|
---|
592 | </li>
|
---|
593 | </ng-container>
|
---|
594 | </ul>
|
---|
595 | </div>
|
---|
596 | <div class="p-picklist-buttons p-picklist-target-controls" *ngIf="showTargetControls">
|
---|
597 | <button type="button" [attr.aria-label]="upButtonAriaLabel" pButton pRipple icon="pi pi-angle-up" [disabled]="disabled" (click)="moveUp(targetlist,target,selectedItemsTarget,onTargetReorder,TARGET_LIST)"></button>
|
---|
598 | <button type="button" [attr.aria-label]="topButtonAriaLabel" pButton pRipple icon="pi pi-angle-double-up" [disabled]="disabled" (click)="moveTop(targetlist,target,selectedItemsTarget,onTargetReorder,TARGET_LIST)"></button>
|
---|
599 | <button type="button" [attr.aria-label]="downButtonAriaLabel" pButton pRipple icon="pi pi-angle-down" [disabled]="disabled" (click)="moveDown(targetlist,target,selectedItemsTarget,onTargetReorder,TARGET_LIST)"></button>
|
---|
600 | <button type="button" [attr.aria-label]="bottomButtonAriaLabel" pButton pRipple icon="pi pi-angle-double-down" [disabled]="disabled" (click)="moveBottom(targetlist,target,selectedItemsTarget,onTargetReorder,TARGET_LIST)"></button>
|
---|
601 | </div>
|
---|
602 | </div>
|
---|
603 | `, isInline: true, styles: [".p-picklist{display:flex}.p-picklist-buttons{display:flex;flex-direction:column;justify-content:center}.p-picklist-list-wrapper{flex:1 1 50%}.p-picklist-list{list-style-type:none;margin:0;padding:0;overflow:auto;min-height:12rem}.p-picklist-item{display:block;cursor:pointer;overflow:hidden;position:relative}.p-picklist-item:not(.cdk-drag-disabled){cursor:move}.p-picklist-item.cdk-drag-placeholder{opacity:0}.p-picklist-item.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.p-picklist-filter{position:relative}.p-picklist-filter-icon{position:absolute;top:50%;margin-top:-.5rem}.p-picklist-filter-input{width:100%}.p-picklist-list.cdk-drop-list-dragging .p-picklist-item:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}\n"], directives: [{ type: i2.CdkDropListGroup, selector: "[cdkDropListGroup]", inputs: ["cdkDropListGroupDisabled"], exportAs: ["cdkDropListGroup"] }, { type: i3.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i5.Ripple, selector: "[pRipple]" }, { type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
---|
604 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: PickList, decorators: [{
|
---|
605 | type: Component,
|
---|
606 | args: [{ selector: 'p-pickList', template: `
|
---|
607 | <div [class]="styleClass" [ngStyle]="style" [ngClass]="'p-picklist p-component'" cdkDropListGroup>
|
---|
608 | <div class="p-picklist-buttons p-picklist-source-controls" *ngIf="showSourceControls">
|
---|
609 | <button type="button" [attr.aria-label]="upButtonAriaLabel" pButton pRipple icon="pi pi-angle-up" [disabled]="disabled" (click)="moveUp(sourcelist,source,selectedItemsSource,onSourceReorder,SOURCE_LIST)"></button>
|
---|
610 | <button type="button" [attr.aria-label]="topButtonAriaLabel" pButton pRipple icon="pi pi-angle-double-up" [disabled]="disabled" (click)="moveTop(sourcelist,source,selectedItemsSource,onSourceReorder,SOURCE_LIST)"></button>
|
---|
611 | <button type="button" [attr.aria-label]="downButtonAriaLabel" pButton pRipple icon="pi pi-angle-down" [disabled]="disabled" (click)="moveDown(sourcelist,source,selectedItemsSource,onSourceReorder,SOURCE_LIST)"></button>
|
---|
612 | <button type="button" [attr.aria-label]="bottomButtonAriaLabel" pButton pRipple icon="pi pi-angle-double-down" [disabled]="disabled" (click)="moveBottom(sourcelist,source,selectedItemsSource,onSourceReorder,SOURCE_LIST)"></button>
|
---|
613 | </div>
|
---|
614 | <div class="p-picklist-list-wrapper p-picklist-source-wrapper">
|
---|
615 | <div class="p-picklist-header" *ngIf="sourceHeader || sourceHeaderTemplate">
|
---|
616 | <div class="p-picklist-title" *ngIf="!sourceHeaderTemplate">{{sourceHeader}}</div>
|
---|
617 | <ng-container *ngTemplateOutlet="sourceHeaderTemplate"></ng-container>
|
---|
618 | </div>
|
---|
619 | <div class="p-picklist-filter-container" *ngIf="filterBy && showSourceFilter !== false">
|
---|
620 | <div class="p-picklist-filter">
|
---|
621 | <input #sourceFilter type="text" role="textbox" (keyup)="onFilter($event,source,SOURCE_LIST)" class="p-picklist-filter-input p-inputtext p-component" [disabled]="disabled" [attr.placeholder]="sourceFilterPlaceholder" [attr.aria-label]="ariaSourceFilterLabel">
|
---|
622 | <span class="p-picklist-filter-icon pi pi-search"></span>
|
---|
623 | </div>
|
---|
624 | </div>
|
---|
625 |
|
---|
626 | <ul #sourcelist class="p-picklist-list p-picklist-source" cdkDropList [cdkDropListData]="source" (cdkDropListDropped)="onDrop($event, SOURCE_LIST)"
|
---|
627 | [ngStyle]="sourceStyle" role="listbox" aria-multiselectable="multiple">
|
---|
628 | <ng-template ngFor let-item [ngForOf]="source" [ngForTrackBy]="sourceTrackBy || trackBy" let-i="index" let-l="last">
|
---|
629 | <li [ngClass]="{'p-picklist-item':true,'p-highlight':isSelected(item,selectedItemsSource),'p-disabled': disabled}" pRipple cdkDrag [cdkDragData]="item" [cdkDragDisabled]="!dragdrop"
|
---|
630 | (click)="onItemClick($event,item,selectedItemsSource,onSourceSelect)" (dblclick)="onSourceItemDblClick()" (touchend)="onItemTouchEnd()" (keydown)="onItemKeydown($event,item,selectedItemsSource,onSourceSelect)"
|
---|
631 | *ngIf="isItemVisible(item, SOURCE_LIST)" tabindex="0" role="option" [attr.aria-selected]="isSelected(item, selectedItemsSource)">
|
---|
632 | <ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item, index: i}"></ng-container>
|
---|
633 | </li>
|
---|
634 | </ng-template>
|
---|
635 | <ng-container *ngIf="isEmpty(SOURCE_LIST) && (emptyMessageSourceTemplate || emptyFilterMessageSourceTemplate)">
|
---|
636 | <li class="p-picklist-empty-message" *ngIf="!filterValueSource || !emptyFilterMessageSourceTemplate">
|
---|
637 | <ng-container *ngTemplateOutlet="emptyMessageSourceTemplate"></ng-container>
|
---|
638 | </li>
|
---|
639 | <li class="p-picklist-empty-message" *ngIf="filterValueSource">
|
---|
640 | <ng-container *ngTemplateOutlet="emptyFilterMessageSourceTemplate"></ng-container>
|
---|
641 | </li>
|
---|
642 | </ng-container>
|
---|
643 | </ul>
|
---|
644 | </div>
|
---|
645 | <div class="p-picklist-buttons p-picklist-transfer-buttons">
|
---|
646 | <button type="button" [attr.aria-label]="rightButtonAriaLabel" pButton pRipple icon="pi pi-angle-right" [disabled]="disabled" (click)="moveRight()"></button>
|
---|
647 | <button type="button" [attr.aria-label]="allRightButtonAriaLabel" pButton pRipple icon="pi pi-angle-double-right" [disabled]="disabled" (click)="moveAllRight()"></button>
|
---|
648 | <button type="button" [attr.aria-label]="leftButtonAriaLabel" pButton pRipple icon="pi pi-angle-left" [disabled]="disabled" (click)="moveLeft()"></button>
|
---|
649 | <button type="button" [attr.aria-label]="allLeftButtonAriaLabel" pButton pRipple icon="pi pi-angle-double-left" [disabled]="disabled" (click)="moveAllLeft()"></button>
|
---|
650 | </div>
|
---|
651 | <div class="p-picklist-list-wrapper p-picklist-target-wrapper">
|
---|
652 | <div class="p-picklist-header" *ngIf="targetHeader || targetHeaderTemplate">
|
---|
653 | <div class="p-picklist-title" *ngIf="!targetHeaderTemplate">{{targetHeader}}</div>
|
---|
654 | <ng-container *ngTemplateOutlet="targetHeaderTemplate"></ng-container>
|
---|
655 | </div>
|
---|
656 | <div class="p-picklist-filter-container" *ngIf="filterBy && showTargetFilter !== false">
|
---|
657 | <div class="p-picklist-filter">
|
---|
658 | <input #targetFilter type="text" role="textbox" (keyup)="onFilter($event,target,TARGET_LIST)" class="p-picklist-filter-input p-inputtext p-component" [disabled]="disabled" [attr.placeholder]="targetFilterPlaceholder" [attr.aria-label]="ariaTargetFilterLabel">
|
---|
659 | <span class="p-picklist-filter-icon pi pi-search"></span>
|
---|
660 | </div>
|
---|
661 | </div>
|
---|
662 | <ul #targetlist class="p-picklist-list p-picklist-target" cdkDropList [cdkDropListData]="target" (cdkDropListDropped)="onDrop($event, TARGET_LIST)"
|
---|
663 | [ngStyle]="targetStyle" role="listbox" aria-multiselectable="multiple">
|
---|
664 | <ng-template ngFor let-item [ngForOf]="target" [ngForTrackBy]="targetTrackBy || trackBy" let-i="index" let-l="last">
|
---|
665 | <li [ngClass]="{'p-picklist-item':true,'p-highlight':isSelected(item,selectedItemsTarget), 'p-disabled': disabled}" pRipple cdkDrag [cdkDragData]="item" [cdkDragDisabled]="!dragdrop"
|
---|
666 | (click)="onItemClick($event,item,selectedItemsTarget,onTargetSelect)" (dblclick)="onTargetItemDblClick()" (touchend)="onItemTouchEnd()" (keydown)="onItemKeydown($event,item,selectedItemsTarget,onTargetSelect)"
|
---|
667 | *ngIf="isItemVisible(item, TARGET_LIST)" tabindex="0" role="option" [attr.aria-selected]="isSelected(item, selectedItemsTarget)">
|
---|
668 | <ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item, index: i}"></ng-container>
|
---|
669 | </li>
|
---|
670 | </ng-template>
|
---|
671 | <ng-container *ngIf="isEmpty(TARGET_LIST) && (emptyMessageTargetTemplate || emptyFilterMessageTargetTemplate)">
|
---|
672 | <li class="p-picklist-empty-message" *ngIf="!filterValueTarget || !emptyFilterMessageTargetTemplate">
|
---|
673 | <ng-container *ngTemplateOutlet="emptyMessageTargetTemplate"></ng-container>
|
---|
674 | </li>
|
---|
675 | <li class="p-picklist-empty-message" *ngIf="filterValueTarget">
|
---|
676 | <ng-container *ngTemplateOutlet="emptyFilterMessageTargetTemplate"></ng-container>
|
---|
677 | </li>
|
---|
678 | </ng-container>
|
---|
679 | </ul>
|
---|
680 | </div>
|
---|
681 | <div class="p-picklist-buttons p-picklist-target-controls" *ngIf="showTargetControls">
|
---|
682 | <button type="button" [attr.aria-label]="upButtonAriaLabel" pButton pRipple icon="pi pi-angle-up" [disabled]="disabled" (click)="moveUp(targetlist,target,selectedItemsTarget,onTargetReorder,TARGET_LIST)"></button>
|
---|
683 | <button type="button" [attr.aria-label]="topButtonAriaLabel" pButton pRipple icon="pi pi-angle-double-up" [disabled]="disabled" (click)="moveTop(targetlist,target,selectedItemsTarget,onTargetReorder,TARGET_LIST)"></button>
|
---|
684 | <button type="button" [attr.aria-label]="downButtonAriaLabel" pButton pRipple icon="pi pi-angle-down" [disabled]="disabled" (click)="moveDown(targetlist,target,selectedItemsTarget,onTargetReorder,TARGET_LIST)"></button>
|
---|
685 | <button type="button" [attr.aria-label]="bottomButtonAriaLabel" pButton pRipple icon="pi pi-angle-double-down" [disabled]="disabled" (click)="moveBottom(targetlist,target,selectedItemsTarget,onTargetReorder,TARGET_LIST)"></button>
|
---|
686 | </div>
|
---|
687 | </div>
|
---|
688 | `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
---|
689 | 'class': 'p-element'
|
---|
690 | }, styles: [".p-picklist{display:flex}.p-picklist-buttons{display:flex;flex-direction:column;justify-content:center}.p-picklist-list-wrapper{flex:1 1 50%}.p-picklist-list{list-style-type:none;margin:0;padding:0;overflow:auto;min-height:12rem}.p-picklist-item{display:block;cursor:pointer;overflow:hidden;position:relative}.p-picklist-item:not(.cdk-drag-disabled){cursor:move}.p-picklist-item.cdk-drag-placeholder{opacity:0}.p-picklist-item.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.p-picklist-filter{position:relative}.p-picklist-filter-icon{position:absolute;top:50%;margin-top:-.5rem}.p-picklist-filter-input{width:100%}.p-picklist-list.cdk-drop-list-dragging .p-picklist-item:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}\n"] }]
|
---|
691 | }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1.FilterService }]; }, propDecorators: { source: [{
|
---|
692 | type: Input
|
---|
693 | }], target: [{
|
---|
694 | type: Input
|
---|
695 | }], sourceHeader: [{
|
---|
696 | type: Input
|
---|
697 | }], rightButtonAriaLabel: [{
|
---|
698 | type: Input
|
---|
699 | }], leftButtonAriaLabel: [{
|
---|
700 | type: Input
|
---|
701 | }], allRightButtonAriaLabel: [{
|
---|
702 | type: Input
|
---|
703 | }], allLeftButtonAriaLabel: [{
|
---|
704 | type: Input
|
---|
705 | }], upButtonAriaLabel: [{
|
---|
706 | type: Input
|
---|
707 | }], downButtonAriaLabel: [{
|
---|
708 | type: Input
|
---|
709 | }], topButtonAriaLabel: [{
|
---|
710 | type: Input
|
---|
711 | }], bottomButtonAriaLabel: [{
|
---|
712 | type: Input
|
---|
713 | }], targetHeader: [{
|
---|
714 | type: Input
|
---|
715 | }], responsive: [{
|
---|
716 | type: Input
|
---|
717 | }], filterBy: [{
|
---|
718 | type: Input
|
---|
719 | }], filterLocale: [{
|
---|
720 | type: Input
|
---|
721 | }], trackBy: [{
|
---|
722 | type: Input
|
---|
723 | }], sourceTrackBy: [{
|
---|
724 | type: Input
|
---|
725 | }], targetTrackBy: [{
|
---|
726 | type: Input
|
---|
727 | }], showSourceFilter: [{
|
---|
728 | type: Input
|
---|
729 | }], showTargetFilter: [{
|
---|
730 | type: Input
|
---|
731 | }], metaKeySelection: [{
|
---|
732 | type: Input
|
---|
733 | }], dragdrop: [{
|
---|
734 | type: Input
|
---|
735 | }], style: [{
|
---|
736 | type: Input
|
---|
737 | }], styleClass: [{
|
---|
738 | type: Input
|
---|
739 | }], sourceStyle: [{
|
---|
740 | type: Input
|
---|
741 | }], targetStyle: [{
|
---|
742 | type: Input
|
---|
743 | }], showSourceControls: [{
|
---|
744 | type: Input
|
---|
745 | }], showTargetControls: [{
|
---|
746 | type: Input
|
---|
747 | }], sourceFilterPlaceholder: [{
|
---|
748 | type: Input
|
---|
749 | }], targetFilterPlaceholder: [{
|
---|
750 | type: Input
|
---|
751 | }], disabled: [{
|
---|
752 | type: Input
|
---|
753 | }], ariaSourceFilterLabel: [{
|
---|
754 | type: Input
|
---|
755 | }], ariaTargetFilterLabel: [{
|
---|
756 | type: Input
|
---|
757 | }], filterMatchMode: [{
|
---|
758 | type: Input
|
---|
759 | }], breakpoint: [{
|
---|
760 | type: Input
|
---|
761 | }], onMoveToSource: [{
|
---|
762 | type: Output
|
---|
763 | }], onMoveAllToSource: [{
|
---|
764 | type: Output
|
---|
765 | }], onMoveAllToTarget: [{
|
---|
766 | type: Output
|
---|
767 | }], onMoveToTarget: [{
|
---|
768 | type: Output
|
---|
769 | }], onSourceReorder: [{
|
---|
770 | type: Output
|
---|
771 | }], onTargetReorder: [{
|
---|
772 | type: Output
|
---|
773 | }], onSourceSelect: [{
|
---|
774 | type: Output
|
---|
775 | }], onTargetSelect: [{
|
---|
776 | type: Output
|
---|
777 | }], onSourceFilter: [{
|
---|
778 | type: Output
|
---|
779 | }], onTargetFilter: [{
|
---|
780 | type: Output
|
---|
781 | }], listViewSourceChild: [{
|
---|
782 | type: ViewChild,
|
---|
783 | args: ['sourcelist']
|
---|
784 | }], listViewTargetChild: [{
|
---|
785 | type: ViewChild,
|
---|
786 | args: ['targetlist']
|
---|
787 | }], sourceFilterViewChild: [{
|
---|
788 | type: ViewChild,
|
---|
789 | args: ['sourceFilter']
|
---|
790 | }], targetFilterViewChild: [{
|
---|
791 | type: ViewChild,
|
---|
792 | args: ['targetFilter']
|
---|
793 | }], templates: [{
|
---|
794 | type: ContentChildren,
|
---|
795 | args: [PrimeTemplate]
|
---|
796 | }] } });
|
---|
797 | class PickListModule {
|
---|
798 | }
|
---|
799 | PickListModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: PickListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
---|
800 | PickListModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: PickListModule, declarations: [PickList], imports: [CommonModule, ButtonModule, SharedModule, RippleModule, DragDropModule], exports: [PickList, SharedModule, DragDropModule] });
|
---|
801 | PickListModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: PickListModule, imports: [[CommonModule, ButtonModule, SharedModule, RippleModule, DragDropModule], SharedModule, DragDropModule] });
|
---|
802 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: PickListModule, decorators: [{
|
---|
803 | type: NgModule,
|
---|
804 | args: [{
|
---|
805 | imports: [CommonModule, ButtonModule, SharedModule, RippleModule, DragDropModule],
|
---|
806 | exports: [PickList, SharedModule, DragDropModule],
|
---|
807 | declarations: [PickList]
|
---|
808 | }]
|
---|
809 | }] });
|
---|
810 |
|
---|
811 | /**
|
---|
812 | * Generated bundle index. Do not edit.
|
---|
813 | */
|
---|
814 |
|
---|
815 | export { PickList, PickListModule };
|
---|