primeng
Version:
[](https://badge.fury.io/js/primeng) [](https://www.npmjs.com/package/primeng) [ • 50.8 kB
JavaScript
import * as i5 from '@angular/cdk/drag-drop';
import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
import * as i2 from '@angular/common';
import { isPlatformBrowser, DOCUMENT, CommonModule } from '@angular/common';
import * as i0 from '@angular/core';
import { EventEmitter, PLATFORM_ID, numberAttribute, booleanAttribute, Component, ChangeDetectionStrategy, ViewEncapsulation, Inject, Input, Output, ViewChild, ContentChildren, NgModule } from '@angular/core';
import * as i1 from 'primeng/api';
import { PrimeTemplate, SharedModule } from 'primeng/api';
import * as i3 from 'primeng/button';
import { ButtonModule } from 'primeng/button';
import { DomHandler } from 'primeng/dom';
import { AngleDoubleDownIcon } from 'primeng/icons/angledoubledown';
import { AngleDoubleUpIcon } from 'primeng/icons/angledoubleup';
import { AngleDownIcon } from 'primeng/icons/angledown';
import { AngleUpIcon } from 'primeng/icons/angleup';
import { SearchIcon } from 'primeng/icons/search';
import * as i4 from 'primeng/ripple';
import { RippleModule } from 'primeng/ripple';
import { UniqueComponentId, ObjectUtils } from 'primeng/utils';
/**
* OrderList is used to managed the order of a collection.
* @group Components
*/
class OrderList {
document;
platformId;
renderer;
el;
cd;
filterService;
config;
/**
* Text for the caption.
* @group Props
*/
header;
/**
* Inline style of the component.
* @group Props
*/
style;
/**
* Style class of the component.
* @group Props
*/
styleClass;
/**
* Index of the element in tabbing order.
* @group Props
*/
tabindex;
/**
* Defines a string that labels the input for accessibility.
* @group Props
*/
ariaLabel;
/**
* Specifies one or more IDs in the DOM that labels the input field.
* @group Props
*/
ariaLabelledBy;
/**
* Inline style of the list element.
* @group Props
*/
listStyle;
/**
* A boolean value that indicates whether the component should be responsive.
* @group Props
*/
responsive;
/**
* When specified displays an input field to filter the items on keyup and decides which fields to search against.
* @group Props
*/
filterBy;
/**
* Placeholder of the filter input.
* @group Props
*/
filterPlaceholder;
/**
* Locale to use in filtering. The default locale is the host environment's current locale.
* @group Props
*/
filterLocale;
/**
* When true metaKey needs to be pressed to select or unselect an item and when set to false selection of each item can be toggled individually. On touch enabled devices, metaKeySelection is turned off automatically.
* @group Props
*/
metaKeySelection = false;
/**
* Whether to enable dragdrop based reordering.
* @group Props
*/
dragdrop = false;
/**
* Defines the location of the buttons with respect to the list.
* @group Props
*/
controlsPosition = 'left';
/**
* Defines a string that labels the filter input.
* @group Props
*/
ariaFilterLabel;
/**
* Defines how the items are filtered.
* @group Props
*/
filterMatchMode = 'contains';
/**
* Indicates the width of the screen at which the component should change its behavior.
* @group Props
*/
breakpoint = '960px';
/**
* Whether to displays rows with alternating colors.
* @group Props
*/
stripedRows;
/**
* When present, it specifies that the component should be disabled.
* @group Props
*/
disabled = false;
/**
* Function to optimize the dom operations by delegating to ngForTrackBy, default algorithm checks for object identity.
* @group Props
*/
trackBy = (index, item) => item;
/**
* A list of values that are currently selected.
* @group Props
*/
set selection(val) {
this.d_selection = val;
}
get selection() {
return this.d_selection;
}
/**
* Array of values to be displayed in the component.
* It represents the data source for the list of items.
* @group Props
*/
set value(val) {
this._value = val;
if (this.filterValue) {
this.filter();
}
}
get value() {
return this._value;
}
/**
* Callback to invoke on selection change.
* @param {*} any - selection instance.
* @group Emits
*/
selectionChange = new EventEmitter();
/**
* Callback to invoke when list is reordered.
* @param {*} any - list instance.
* @group Emits
*/
onReorder = new EventEmitter();
/**
* Callback to invoke when selection changes.
* @param {OrderListSelectionChangeEvent} event - Custom change event.
* @group Emits
*/
onSelectionChange = new EventEmitter();
/**
* Callback to invoke when filtering occurs.
* @param {OrderListFilterEvent} event - Custom filter event.
* @group Emits
*/
onFilterEvent = new EventEmitter();
/**
* Callback to invoke when the list is focused
* @param {Event} event - Browser event.
* @group Emits
*/
onFocus = new EventEmitter();
/**
* Callback to invoke when the list is blurred
* @param {Event} event - Browser event.
* @group Emits
*/
onBlur = new EventEmitter();
listViewChild;
filterViewChild;
templates;
itemTemplate;
headerTemplate;
emptyMessageTemplate;
emptyFilterMessageTemplate;
filterTemplate;
get moveUpAriaLabel() {
return this.config.translation.aria ? this.config.translation.aria.moveUp : undefined;
}
get moveTopAriaLabel() {
return this.config.translation.aria ? this.config.translation.aria.moveTop : undefined;
}
get moveDownAriaLabel() {
return this.config.translation.aria ? this.config.translation.aria.moveDown : undefined;
}
get moveBottomAriaLabel() {
return this.config.translation.aria ? this.config.translation.aria.moveBottom : undefined;
}
moveUpIconTemplate;
moveTopIconTemplate;
moveDownIconTemplate;
moveBottomIconTemplate;
filterIconTemplate;
filterOptions;
d_selection = [];
movedUp;
movedDown;
itemTouched;
styleElement;
id = UniqueComponentId();
focused = false;
focusedOptionIndex = -1;
focusedOption;
filterValue;
visibleOptions;
_value;
constructor(document, platformId, renderer, el, cd, filterService, config) {
this.document = document;
this.platformId = platformId;
this.renderer = renderer;
this.el = el;
this.cd = cd;
this.filterService = filterService;
this.config = config;
}
ngOnInit() {
if (this.responsive) {
this.createStyle();
}
if (this.filterBy) {
this.filterOptions = {
filter: (value) => this.onFilterKeyup(value),
reset: () => this.resetFilter()
};
}
}
ngAfterContentInit() {
this.templates.forEach((item) => {
switch (item.getType()) {
case 'item':
this.itemTemplate = item.template;
break;
case 'empty':
this.emptyMessageTemplate = item.template;
break;
case 'emptyfilter':
this.emptyFilterMessageTemplate = item.template;
break;
case 'filter':
this.filterTemplate = item.template;
break;
case 'header':
this.headerTemplate = item.template;
break;
case 'moveupicon':
this.moveUpIconTemplate = item.template;
break;
case 'movetopicon':
this.moveTopIconTemplate = item.template;
break;
case 'movedownicon':
this.moveDownIconTemplate = item.template;
break;
case 'movebottomicon':
this.moveBottomIconTemplate = item.template;
break;
case 'filtericon':
this.filterIconTemplate = item.template;
break;
default:
this.itemTemplate = item.template;
break;
}
});
}
ngAfterViewChecked() {
if (this.movedUp || this.movedDown) {
let listItems = DomHandler.find(this.listViewChild?.nativeElement, 'li.p-highlight');
let listItem;
if (listItems.length > 0) {
if (this.movedUp)
listItem = listItems[0];
else
listItem = listItems[listItems.length - 1];
DomHandler.scrollInView(this.listViewChild?.nativeElement, listItem);
}
this.movedUp = false;
this.movedDown = false;
}
}
onItemClick(event, item, index, selectedId) {
this.itemTouched = false;
let focusedIndex = index ? index : ObjectUtils.findIndexInList(this.focusedOption, this.value);
let selectedIndex = ObjectUtils.findIndexInList(item, this.d_selection);
let selected = selectedIndex !== -1;
let metaSelection = this.itemTouched ? false : this.metaKeySelection;
if (selectedId) {
this.focusedOptionIndex = selectedId;
}
if (metaSelection) {
let metaKey = event.metaKey || event.ctrlKey;
if (selected && metaKey) {
this.d_selection = this.d_selection.filter((val, focusedIndex) => focusedIndex !== selectedIndex);
}
else {
this.d_selection = metaKey ? (this.d_selection ? [...this.d_selection] : []) : [];
ObjectUtils.insertIntoOrderedArray(item, focusedIndex, this.d_selection, this.value);
}
}
else {
if (selected) {
this.d_selection = this.d_selection.filter((val, focusedIndex) => focusedIndex !== selectedIndex);
}
else {
this.d_selection = this.d_selection ? [...this.d_selection] : [];
ObjectUtils.insertIntoOrderedArray(item, focusedIndex, this.d_selection, this.value);
}
}
//binding
this.selectionChange.emit(this.d_selection);
//event
this.onSelectionChange.emit({ originalEvent: event, value: this.d_selection });
}
onFilterKeyup(event) {
this.filterValue = event.target.value.trim().toLocaleLowerCase(this.filterLocale);
this.filter();
this.onFilterEvent.emit({
originalEvent: event,
value: this.visibleOptions
});
}
filter() {
let searchFields = this.filterBy.split(',');
this.visibleOptions = this.filterService.filter(this.value, searchFields, this.filterValue, this.filterMatchMode, this.filterLocale);
}
/**
* Callback to invoke on filter reset.
* @group Method
*/
resetFilter() {
this.filterValue = null;
this.filterViewChild && (this.filterViewChild.nativeElement.value = '');
}
isItemVisible(item) {
if (this.filterValue && this.filterValue.trim().length) {
for (let i = 0; i < this.visibleOptions.length; i++) {
if (item == this.visibleOptions[i]) {
return true;
}
}
}
else {
return true;
}
}
onItemTouchEnd() {
this.itemTouched = true;
}
isSelected(item) {
return ObjectUtils.findIndexInList(item, this.d_selection) !== -1;
}
isEmpty() {
return this.filterValue ? !this.visibleOptions || this.visibleOptions.length === 0 : !this.value || this.value.length === 0;
}
moveUp() {
if (this.selection) {
for (let i = 0; i < this.selection.length; i++) {
let selectedItem = this.selection[i];
let selectedItemIndex = ObjectUtils.findIndexInList(selectedItem, this.value);
if (selectedItemIndex != 0 && this.value instanceof Array) {
let movedItem = this.value[selectedItemIndex];
let temp = this.value[selectedItemIndex - 1];
this.value[selectedItemIndex - 1] = movedItem;
this.value[selectedItemIndex] = temp;
}
else {
break;
}
}
if (this.dragdrop && this.filterValue)
this.filter();
this.movedUp = true;
this.onReorder.emit(this.selection);
}
}
moveTop() {
if (this.selection) {
for (let i = this.selection.length - 1; i >= 0; i--) {
let selectedItem = this.selection[i];
let selectedItemIndex = ObjectUtils.findIndexInList(selectedItem, this.value);
if (selectedItemIndex != 0 && this.value instanceof Array) {
let movedItem = this.value.splice(selectedItemIndex, 1)[0];
this.value.unshift(movedItem);
}
else {
break;
}
}
if (this.dragdrop && this.filterValue)
this.filter();
this.onReorder.emit(this.selection);
this.listViewChild.nativeElement.scrollTop = 0;
}
}
moveDown() {
if (this.selection) {
for (let i = this.selection.length - 1; i >= 0; i--) {
let selectedItem = this.selection[i];
let selectedItemIndex = ObjectUtils.findIndexInList(selectedItem, this.value);
if (this.value instanceof Array && selectedItemIndex != this.value.length - 1) {
let movedItem = this.value[selectedItemIndex];
let temp = this.value[selectedItemIndex + 1];
this.value[selectedItemIndex + 1] = movedItem;
this.value[selectedItemIndex] = temp;
}
else {
break;
}
}
if (this.dragdrop && this.filterValue)
this.filter();
this.movedDown = true;
this.onReorder.emit(this.selection);
}
}
moveBottom() {
if (this.selection) {
for (let i = 0; i < this.selection.length; i++) {
let selectedItem = this.selection[i];
let selectedItemIndex = ObjectUtils.findIndexInList(selectedItem, this.value);
if (this.value instanceof Array && selectedItemIndex != this.value.length - 1) {
let movedItem = this.value.splice(selectedItemIndex, 1)[0];
this.value.push(movedItem);
}
else {
break;
}
}
if (this.dragdrop && this.filterValue)
this.filter();
this.onReorder.emit(this.selection);
this.listViewChild.nativeElement.scrollTop = this.listViewChild?.nativeElement.scrollHeight;
}
}
onDrop(event) {
let previousIndex = event.previousIndex;
let currentIndex = event.currentIndex;
if (previousIndex !== currentIndex) {
if (this.visibleOptions) {
if (this.filterValue) {
previousIndex = ObjectUtils.findIndexInList(event.item.data, this.value);
currentIndex = ObjectUtils.findIndexInList(this.visibleOptions[currentIndex], this.value);
}
moveItemInArray(this.visibleOptions, event.previousIndex, event.currentIndex);
}
moveItemInArray(this.value, previousIndex, currentIndex);
this.changeFocusedOptionIndex(currentIndex);
this.onReorder.emit([event.item.data]);
}
}
onListFocus(event) {
const focusableEl = DomHandler.findSingle(this.listViewChild.nativeElement, '[data-p-highlight="true"]') || DomHandler.findSingle(this.listViewChild.nativeElement, '[data-pc-section="item"]');
if (focusableEl) {
const findIndex = ObjectUtils.findIndexInList(focusableEl, this.listViewChild.nativeElement.children);
this.focused = true;
const index = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : focusableEl ? findIndex : -1;
this.changeFocusedOptionIndex(index);
}
this.onFocus.emit(event);
}
onListBlur(event) {
this.focused = false;
this.focusedOption = null;
this.focusedOptionIndex = -1;
this.onBlur.emit(event);
}
onItemKeydown(event) {
switch (event.code) {
case 'ArrowDown':
this.onArrowDownKey(event);
break;
case 'ArrowUp':
this.onArrowUpKey(event);
break;
case 'Home':
this.onHomeKey(event);
break;
case 'End':
this.onEndKey(event);
break;
case 'Enter':
this.onEnterKey(event);
break;
case 'Space':
this.onSpaceKey(event);
break;
case 'KeyA':
if (event.ctrlKey) {
this.d_selection = [...this.value];
this.selectionChange.emit(this.d_selection);
}
default:
break;
}
}
onOptionMouseDown(index) {
this.focused = true;
this.focusedOptionIndex = index;
}
onArrowDownKey(event) {
const optionIndex = this.findNextOptionIndex(this.focusedOptionIndex);
this.changeFocusedOptionIndex(optionIndex);
if (event.shiftKey) {
this.onEnterKey(event);
}
event.preventDefault();
}
onArrowUpKey(event) {
const optionIndex = this.findPrevOptionIndex(this.focusedOptionIndex);
this.changeFocusedOptionIndex(optionIndex);
if (event.shiftKey) {
this.onEnterKey(event);
}
event.preventDefault();
}
onHomeKey(event) {
if (event.ctrlKey && event.shiftKey) {
let visibleOptions = this.getVisibleOptions();
let focusedIndex = ObjectUtils.findIndexInList(this.focusedOption, visibleOptions);
this.d_selection = [...this.value].slice(0, focusedIndex + 1);
this.selectionChange.emit(this.d_selection);
}
else {
this.changeFocusedOptionIndex(0);
}
event.preventDefault();
}
onEndKey(event) {
if (event.ctrlKey && event.shiftKey) {
let visibleOptions = this.getVisibleOptions();
let focusedIndex = ObjectUtils.findIndexInList(this.focusedOption, visibleOptions);
this.d_selection = [...this.value].slice(focusedIndex, visibleOptions.length - 1);
this.selectionChange.emit(this.d_selection);
}
else {
this.changeFocusedOptionIndex(DomHandler.find(this.listViewChild.nativeElement, '[data-pc-section="item"]').length - 1);
}
event.preventDefault();
}
onEnterKey(event) {
this.onItemClick(event, this.focusedOption);
event.preventDefault();
}
onSpaceKey(event) {
event.preventDefault();
if (event.shiftKey && this.selection && this.selection.length > 0) {
let visibleOptions = this.getVisibleOptions();
let lastSelectedIndex = this.getLatestSelectedVisibleOptionIndex(visibleOptions);
if (lastSelectedIndex !== -1) {
let focusedIndex = ObjectUtils.findIndexInList(this.focusedOption, visibleOptions);
this.d_selection = [...visibleOptions.slice(Math.min(lastSelectedIndex, focusedIndex), Math.max(lastSelectedIndex, focusedIndex) + 1)];
this.selectionChange.emit(this.d_selection);
this.onSelectionChange.emit({ originalEvent: event, value: this.d_selection });
return;
}
}
this.onEnterKey(event);
}
findNextOptionIndex(index) {
const items = DomHandler.find(this.listViewChild.nativeElement, '[data-pc-section="item"]');
const matchedOptionIndex = [...items].findIndex((link) => link.id === index);
return matchedOptionIndex > -1 ? matchedOptionIndex + 1 : 0;
}
findPrevOptionIndex(index) {
const items = DomHandler.find(this.listViewChild.nativeElement, '[data-pc-section="item"]');
const matchedOptionIndex = [...items].findIndex((link) => link.id === index);
return matchedOptionIndex > -1 ? matchedOptionIndex - 1 : 0;
}
getLatestSelectedVisibleOptionIndex(visibleOptions) {
const latestSelectedItem = [...this.d_selection].reverse().find((item) => visibleOptions.includes(item));
return latestSelectedItem !== undefined ? visibleOptions.indexOf(latestSelectedItem) : -1;
}
getVisibleOptions() {
return this.visibleOptions && this.visibleOptions.length > 0 ? this.visibleOptions : this.value && this.value.length > 0 ? this.value : null;
}
getFocusedOption(index) {
if (index === -1)
return null;
return this.visibleOptions && this.visibleOptions.length ? this.visibleOptions[index] : this.value && this.value.length ? this.value[index] : null;
}
changeFocusedOptionIndex(index) {
const items = DomHandler.find(this.listViewChild.nativeElement, '[data-pc-section="item"]');
let order = index >= items.length ? items.length - 1 : index < 0 ? 0 : index;
this.focusedOptionIndex = items[order] ? items[order].getAttribute('id') : -1;
this.focusedOption = this.getFocusedOption(order);
this.scrollInView(this.focusedOptionIndex);
}
scrollInView(id) {
const element = DomHandler.findSingle(this.listViewChild.nativeElement, `[data-pc-section="item"][id="${id}"]`);
if (element) {
element.scrollIntoView && element.scrollIntoView({ block: 'nearest', inline: 'nearest' });
}
}
findNextItem(item) {
let nextItem = item.nextElementSibling;
if (nextItem)
return !DomHandler.hasClass(nextItem, 'p-orderlist-item') || DomHandler.isHidden(nextItem) ? this.findNextItem(nextItem) : nextItem;
else
return null;
}
findPrevItem(item) {
let prevItem = item.previousElementSibling;
if (prevItem)
return !DomHandler.hasClass(prevItem, 'p-orderlist-item') || DomHandler.isHidden(prevItem) ? this.findPrevItem(prevItem) : prevItem;
else
return null;
}
moveDisabled() {
if (this.disabled || !this.selection.length) {
return true;
}
}
focusedOptionId() {
return this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : null;
}
createStyle() {
if (isPlatformBrowser(this.platformId)) {
if (!this.styleElement) {
this.renderer.setAttribute(this.el.nativeElement.children[0], this.id, '');
this.styleElement = this.renderer.createElement('style');
this.renderer.setAttribute(this.styleElement, 'type', 'text/css');
this.renderer.appendChild(this.document.head, this.styleElement);
let innerHTML = `
@media screen and (max-width: ${this.breakpoint}) {
.p-orderlist[${this.id}] {
flex-direction: column;
}
.p-orderlist[${this.id}] .p-orderlist-controls {
padding: var(--content-padding);
flex-direction: row;
}
.p-orderlist[${this.id}] .p-orderlist-controls .p-button {
margin-right: var(--inline-spacing);
margin-bottom: 0;
}
.p-orderlist[${this.id}] .p-orderlist-controls .p-button:last-child {
margin-right: 0;
}
}
`;
this.renderer.setProperty(this.styleElement, 'innerHTML', innerHTML);
DomHandler.setAttribute(this.styleElement, 'nonce', this.config?.csp()?.nonce);
}
}
}
destroyStyle() {
if (isPlatformBrowser(this.platformId)) {
if (this.styleElement) {
this.renderer.removeChild(this.document, this.styleElement);
this.styleElement = null;
``;
}
}
}
ngOnDestroy() {
this.destroyStyle();
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: OrderList, deps: [{ token: DOCUMENT }, { token: PLATFORM_ID }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1.FilterService }, { token: i1.PrimeNGConfig }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "18.0.1", type: OrderList, selector: "p-orderList", inputs: { header: "header", style: "style", styleClass: "styleClass", tabindex: ["tabindex", "tabindex", numberAttribute], ariaLabel: "ariaLabel", ariaLabelledBy: "ariaLabelledBy", listStyle: "listStyle", responsive: ["responsive", "responsive", booleanAttribute], filterBy: "filterBy", filterPlaceholder: "filterPlaceholder", filterLocale: "filterLocale", metaKeySelection: ["metaKeySelection", "metaKeySelection", booleanAttribute], dragdrop: ["dragdrop", "dragdrop", booleanAttribute], controlsPosition: "controlsPosition", ariaFilterLabel: "ariaFilterLabel", filterMatchMode: "filterMatchMode", breakpoint: "breakpoint", stripedRows: ["stripedRows", "stripedRows", booleanAttribute], disabled: ["disabled", "disabled", booleanAttribute], trackBy: "trackBy", selection: "selection", value: "value" }, outputs: { selectionChange: "selectionChange", onReorder: "onReorder", onSelectionChange: "onSelectionChange", onFilterEvent: "onFilterEvent", onFocus: "onFocus", onBlur: "onBlur" }, host: { classAttribute: "p-element" }, queries: [{ propertyName: "templates", predicate: PrimeTemplate }], viewQueries: [{ propertyName: "listViewChild", first: true, predicate: ["listelement"], descendants: true }, { propertyName: "filterViewChild", first: true, predicate: ["filter"], descendants: true }], ngImport: i0, template: `
<div
[ngClass]="{ 'p-orderlist p-component': true, 'p-orderlist-striped': stripedRows, 'p-orderlist-controls-left': controlsPosition === 'left', 'p-orderlist-controls-right': controlsPosition === 'right' }"
[ngStyle]="style"
[class]="styleClass"
[attr.data-pc-section]="'root'"
>
<div class="p-orderlist-controls" [attr.data-pc-section]="'controls'">
<button type="button" [disabled]="moveDisabled()" pButton pRipple class="p-button-icon-only" (click)="moveUp()" [attr.aria-label]="moveUpAriaLabel" [attr.data-pc-section]="'moveUpButton'">
<AngleUpIcon *ngIf="!moveUpIconTemplate" [attr.data-pc-section]="'moveupicon'" />
<ng-template *ngTemplateOutlet="moveUpIconTemplate"></ng-template>
</button>
<button type="button" [disabled]="moveDisabled()" pButton pRipple class="p-button-icon-only" (click)="moveTop()" [attr.aria-label]="moveTopAriaLabel" [attr.data-pc-section]="'moveTopButton'">
<AngleDoubleUpIcon *ngIf="!moveTopIconTemplate" [attr.data-pc-section]="'movetopicon'" />
<ng-template *ngTemplateOutlet="moveTopIconTemplate"></ng-template>
</button>
<button type="button" [disabled]="moveDisabled()" pButton pRipple class="p-button-icon-only" (click)="moveDown()" [attr.aria-label]="moveDownAriaLabel" [attr.data-pc-section]="'moveDownButton'">
<AngleDownIcon *ngIf="!moveDownIconTemplate" [attr.data-pc-section]="'movedownicon'" />
<ng-template *ngTemplateOutlet="moveDownIconTemplate"></ng-template>
</button>
<button type="button" [disabled]="moveDisabled()" pButton pRipple class="p-button-icon-only" (click)="moveBottom()" [attr.aria-label]="moveBottomAriaLabel" [attr.data-pc-section]="'moveBottomButton'">
<AngleDoubleDownIcon *ngIf="!moveBottomIconTemplate" [attr.data-pc-section]="'movebottomicon'" />
<ng-template *ngTemplateOutlet="moveBottomIconTemplate"></ng-template>
</button>
</div>
<div class="p-orderlist-list-container" [attr.data-pc-section]="'container'">
<div class="p-orderlist-header" *ngIf="header || headerTemplate" [attr.data-pc-section]="'header'">
<div class="p-orderlist-title" *ngIf="!headerTemplate">{{ header }}</div>
<ng-container *ngTemplateOutlet="headerTemplate"></ng-container>
</div>
<div class="p-orderlist-filter-container" *ngIf="filterBy" [attr.data-pc-section]="'filterContainer'">
<ng-container *ngIf="filterTemplate; else builtInFilterElement">
<ng-container *ngTemplateOutlet="filterTemplate; context: { options: filterOptions }"></ng-container>
</ng-container>
<ng-template #builtInFilterElement>
<div class="p-orderlist-filter" [attr.data-pc-section]="'filter'">
<input
#filter
type="text"
role="textbox"
(keyup)="onFilterKeyup($event)"
[disabled]="disabled"
class="p-orderlist-filter-input p-inputtext p-component"
[attr.placeholder]="filterPlaceholder"
[attr.aria-label]="ariaFilterLabel"
/>
<SearchIcon *ngIf="!filterIconTemplate" [styleClass]="'p-orderlist-filter-icon'" [attr.data-pc-section]="'filterIcon'" />
<span class="p-orderlist-filter-icon" *ngIf="filterIconTemplate" [attr.data-pc-section]="'filterIcon'">
<ng-template *ngTemplateOutlet="filterIconTemplate"></ng-template>
</span>
</div>
</ng-template>
</div>
<ul
#listelement
[id]="id + '_list'"
cdkDropList
(cdkDropListDropped)="onDrop($event)"
class="p-orderlist-list"
[ngStyle]="listStyle"
[attr.data-pc-section]="'list'"
role="listbox"
[tabindex]="tabindex"
aria-multiselectable="true"
[attr.aria-activedescendant]="focused ? focusedOptionId() : undefined"
[attr.aria-label]="ariaLabel"
[attr.aria-labelledby]="ariaLabelledBy"
(focus)="onListFocus($event)"
(blur)="onListBlur($event)"
(keydown)="onItemKeydown($event)"
>
<ng-template ngFor [ngForTrackBy]="trackBy" let-item [ngForOf]="value" let-i="index" let-l="last">
<li
[id]="id + '_' + i"
pRipple
cdkDrag
role="option"
class="p-orderlist-item"
[ngClass]="{ 'p-highlight': isSelected(item), 'p-disabled': disabled, 'p-focus': id + '_' + i === focusedOptionId() }"
[cdkDragData]="item"
[cdkDragDisabled]="!dragdrop"
(click)="onItemClick($event, item, i, id + '_' + i)"
(touchend)="onItemTouchEnd()"
(mousedown)="onOptionMouseDown(i)"
*ngIf="isItemVisible(item)"
[attr.aria-selected]="isSelected(item)"
[attr.data-pc-section]="'item'"
[attr.data-p-highlight]="isSelected(item)"
[attr.data-p-focused]="id + '_' + i === focusedOptionId()"
>
<ng-container *ngTemplateOutlet="itemTemplate; context: { $implicit: item, index: i }"></ng-container>
</li>
</ng-template>
<ng-container *ngIf="isEmpty() && (emptyMessageTemplate || emptyFilterMessageTemplate)">
<li *ngIf="!filterValue || !emptyFilterMessageTemplate" class="p-orderlist-empty-message" [attr.data-pc-section]="'emptyMessage'">
<ng-container *ngTemplateOutlet="emptyMessageTemplate"></ng-container>
</li>
<li *ngIf="filterValue" class="p-orderlist-empty-message" [attr.data-pc-section]="'emptyMessage'">
<ng-container *ngTemplateOutlet="emptyFilterMessageTemplate"></ng-container>
</li>
</ng-container>
</ul>
</div>
</div>
`, isInline: true, styles: ["@layer primeng{.p-orderlist{display:flex}.p-orderlist-controls{display:flex;flex-direction:column;justify-content:center}.p-orderlist-list-container{flex:1 1 auto}.p-orderlist-list{list-style-type:none;margin:0;padding:0;overflow:auto;min-height:12rem}.p-orderlist-item{display:block;cursor:pointer;overflow:hidden;position:relative}.p-orderlist-item:not(.cdk-drag-disabled){cursor:move}.p-orderlist-item.cdk-drag-placeholder{opacity:0}.p-orderlist-item.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.p-orderlist.p-state-disabled .p-orderlist-item,.p-orderlist.p-state-disabled .p-button{cursor:default}.p-orderlist.p-state-disabled .p-orderlist-list{overflow:hidden}.p-orderlist-filter{position:relative}.p-orderlist-filter-icon{position:absolute;top:50%;margin-top:-.5rem;cursor:pointer}.p-orderlist-filter-input{width:100%}.p-orderlist-controls-right .p-orderlist-controls{order:2}.p-orderlist-controls-right .p-orderlist-list-container{order:1}.p-orderlist-list.cdk-drop-list-dragging .p-orderlist-item:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}}\n"], dependencies: [{ kind: "directive", type: i0.forwardRef(() => i2.NgClass), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(() => i2.NgForOf), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i0.forwardRef(() => i2.NgIf), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i0.forwardRef(() => i2.NgTemplateOutlet), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i0.forwardRef(() => i2.NgStyle), selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i0.forwardRef(() => i3.ButtonDirective), selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain"] }, { kind: "directive", type: i0.forwardRef(() => i4.Ripple), selector: "[pRipple]" }, { kind: "directive", type: i0.forwardRef(() => i5.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"] }, { kind: "directive", type: i0.forwardRef(() => i5.CdkDrag), selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "component", type: i0.forwardRef(() => AngleDoubleDownIcon), selector: "AngleDoubleDownIcon" }, { kind: "component", type: i0.forwardRef(() => AngleDoubleUpIcon), selector: "AngleDoubleUpIcon" }, { kind: "component", type: i0.forwardRef(() => AngleUpIcon), selector: "AngleUpIcon" }, { kind: "component", type: i0.forwardRef(() => AngleDownIcon), selector: "AngleDownIcon" }, { kind: "component", type: i0.forwardRef(() => SearchIcon), selector: "SearchIcon" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: OrderList, decorators: [{
type: Component,
args: [{ selector: 'p-orderList', template: `
<div
[ngClass]="{ 'p-orderlist p-component': true, 'p-orderlist-striped': stripedRows, 'p-orderlist-controls-left': controlsPosition === 'left', 'p-orderlist-controls-right': controlsPosition === 'right' }"
[ngStyle]="style"
[class]="styleClass"
[attr.data-pc-section]="'root'"
>
<div class="p-orderlist-controls" [attr.data-pc-section]="'controls'">
<button type="button" [disabled]="moveDisabled()" pButton pRipple class="p-button-icon-only" (click)="moveUp()" [attr.aria-label]="moveUpAriaLabel" [attr.data-pc-section]="'moveUpButton'">
<AngleUpIcon *ngIf="!moveUpIconTemplate" [attr.data-pc-section]="'moveupicon'" />
<ng-template *ngTemplateOutlet="moveUpIconTemplate"></ng-template>
</button>
<button type="button" [disabled]="moveDisabled()" pButton pRipple class="p-button-icon-only" (click)="moveTop()" [attr.aria-label]="moveTopAriaLabel" [attr.data-pc-section]="'moveTopButton'">
<AngleDoubleUpIcon *ngIf="!moveTopIconTemplate" [attr.data-pc-section]="'movetopicon'" />
<ng-template *ngTemplateOutlet="moveTopIconTemplate"></ng-template>
</button>
<button type="button" [disabled]="moveDisabled()" pButton pRipple class="p-button-icon-only" (click)="moveDown()" [attr.aria-label]="moveDownAriaLabel" [attr.data-pc-section]="'moveDownButton'">
<AngleDownIcon *ngIf="!moveDownIconTemplate" [attr.data-pc-section]="'movedownicon'" />
<ng-template *ngTemplateOutlet="moveDownIconTemplate"></ng-template>
</button>
<button type="button" [disabled]="moveDisabled()" pButton pRipple class="p-button-icon-only" (click)="moveBottom()" [attr.aria-label]="moveBottomAriaLabel" [attr.data-pc-section]="'moveBottomButton'">
<AngleDoubleDownIcon *ngIf="!moveBottomIconTemplate" [attr.data-pc-section]="'movebottomicon'" />
<ng-template *ngTemplateOutlet="moveBottomIconTemplate"></ng-template>
</button>
</div>
<div class="p-orderlist-list-container" [attr.data-pc-section]="'container'">
<div class="p-orderlist-header" *ngIf="header || headerTemplate" [attr.data-pc-section]="'header'">
<div class="p-orderlist-title" *ngIf="!headerTemplate">{{ header }}</div>
<ng-container *ngTemplateOutlet="headerTemplate"></ng-container>
</div>
<div class="p-orderlist-filter-container" *ngIf="filterBy" [attr.data-pc-section]="'filterContainer'">
<ng-container *ngIf="filterTemplate; else builtInFilterElement">
<ng-container *ngTemplateOutlet="filterTemplate; context: { options: filterOptions }"></ng-container>
</ng-container>
<ng-template #builtInFilterElement>
<div class="p-orderlist-filter" [attr.data-pc-section]="'filter'">
<input
#filter
type="text"
role="textbox"
(keyup)="onFilterKeyup($event)"
[disabled]="disabled"
class="p-orderlist-filter-input p-inputtext p-component"
[attr.placeholder]="filterPlaceholder"
[attr.aria-label]="ariaFilterLabel"
/>
<SearchIcon *ngIf="!filterIconTemplate" [styleClass]="'p-orderlist-filter-icon'" [attr.data-pc-section]="'filterIcon'" />
<span class="p-orderlist-filter-icon" *ngIf="filterIconTemplate" [attr.data-pc-section]="'filterIcon'">
<ng-template *ngTemplateOutlet="filterIconTemplate"></ng-template>
</span>
</div>
</ng-template>
</div>
<ul
#listelement
[id]="id + '_list'"
cdkDropList
(cdkDropListDropped)="onDrop($event)"
class="p-orderlist-list"
[ngStyle]="listStyle"
[attr.data-pc-section]="'list'"
role="listbox"
[tabindex]="tabindex"
aria-multiselectable="true"
[attr.aria-activedescendant]="focused ? focusedOptionId() : undefined"
[attr.aria-label]="ariaLabel"
[attr.aria-labelledby]="ariaLabelledBy"
(focus)="onListFocus($event)"
(blur)="onListBlur($event)"
(keydown)="onItemKeydown($event)"
>
<ng-template ngFor [ngForTrackBy]="trackBy" let-item [ngForOf]="value" let-i="index" let-l="last">
<li
[id]="id + '_' + i"
pRipple
cdkDrag
role="option"
class="p-orderlist-item"
[ngClass]="{ 'p-highlight': isSelected(item), 'p-disabled': disabled, 'p-focus': id + '_' + i === focusedOptionId() }"
[cdkDragData]="item"
[cdkDragDisabled]="!dragdrop"
(click)="onItemClick($event, item, i, id + '_' + i)"
(touchend)="onItemTouchEnd()"
(mousedown)="onOptionMouseDown(i)"
*ngIf="isItemVisible(item)"
[attr.aria-selected]="isSelected(item)"
[attr.data-pc-section]="'item'"
[attr.data-p-highlight]="isSelected(item)"
[attr.data-p-focused]="id + '_' + i === focusedOptionId()"
>
<ng-container *ngTemplateOutlet="itemTemplate; context: { $implicit: item, index: i }"></ng-container>
</li>
</ng-template>
<ng-container *ngIf="isEmpty() && (emptyMessageTemplate || emptyFilterMessageTemplate)">
<li *ngIf="!filterValue || !emptyFilterMessageTemplate" class="p-orderlist-empty-message" [attr.data-pc-section]="'emptyMessage'">
<ng-container *ngTemplateOutlet="emptyMessageTemplate"></ng-container>
</li>
<li *ngIf="filterValue" class="p-orderlist-empty-message" [attr.data-pc-section]="'emptyMessage'">
<ng-container *ngTemplateOutlet="emptyFilterMessageTemplate"></ng-container>
</li>
</ng-container>
</ul>
</div>
</div>
`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
class: 'p-element'
}, styles: ["@layer primeng{.p-orderlist{display:flex}.p-orderlist-controls{display:flex;flex-direction:column;justify-content:center}.p-orderlist-list-container{flex:1 1 auto}.p-orderlist-list{list-style-type:none;margin:0;padding:0;overflow:auto;min-height:12rem}.p-orderlist-item{display:block;cursor:pointer;overflow:hidden;position:relative}.p-orderlist-item:not(.cdk-drag-disabled){cursor:move}.p-orderlist-item.cdk-drag-placeholder{opacity:0}.p-orderlist-item.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.p-orderlist.p-state-disabled .p-orderlist-item,.p-orderlist.p-state-disabled .p-button{cursor:default}.p-orderlist.p-state-disabled .p-orderlist-list{overflow:hidden}.p-orderlist-filter{position:relative}.p-orderlist-filter-icon{position:absolute;top:50%;margin-top:-.5rem;cursor:pointer}.p-orderlist-filter-input{width:100%}.p-orderlist-controls-right .p-orderlist-controls{order:2}.p-orderlist-controls-right .p-orderlist-list-container{order:1}.p-orderlist-list.cdk-drop-list-dragging .p-orderlist-item:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}}\n"] }]
}], ctorParameters: () => [{ type: Document, decorators: [{
type: Inject,
args: [DOCUMENT]
}] }, { type: undefined, decorators: [{
type: Inject,
args: [PLATFORM_ID]
}] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1.FilterService }, { type: i1.PrimeNGConfig }], propDecorators: { header: [{
type: Input
}], style: [{
type: Input
}], styleClass: [{
type: Input
}], tabindex: [{
type: Input,
args: [{ transform: numberAttribute }]
}], ariaLabel: [{
type: Input
}], ariaLabelledBy: [{
type: Input
}], listStyle: [{
type: Input
}], responsive: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], filterBy: [{
type: Input
}], filterPlaceholder: [{
type: Input
}], filterLocale: [{
type: Input
}], metaKeySelection: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], dragdrop: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], controlsPosition: [{
type: Input
}], ariaFilterLabel: [{
type: Input
}], filterMatchMode: [{
type: Input
}], breakpoint: [{
type: Input
}], stripedRows: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], disabled: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], trackBy: [{
type: Input
}], selection: [{
type: Input
}], value: [{
type: Input
}], selectionChange: [{
type: Output
}], onReorder: [{
type: Output
}], onSelectionChange: [{
type: Output
}], onFilterEvent: [{
type: Output
}], onFocus: [{
type: Output
}], onBlur: [{
type: Output
}], listViewChild: [{
type: ViewChild,
args: ['listelement']
}], filterViewChild: [{
type: ViewChild,
args: ['filter']
}], templates: [{
type: ContentChildren,
args: [PrimeTemplate]
}] } });
class OrderListModule {
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: OrderListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.1", ngImport: i0, type: OrderListModule, declarations: [OrderList], imports: [CommonModule, ButtonModule, SharedModule, RippleModule, DragDropModule, AngleDoubleDownIcon, AngleDoubleUpIcon, AngleUpIcon, AngleDownIcon, SearchIcon], exports: [OrderList, SharedModule, DragDropModule] });
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: OrderListModule, imports: [CommonModule, ButtonModule, SharedModu