UNPKG

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