[59329aa] | 1 | import * as i0 from '@angular/core';
|
---|
| 2 | import { EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, Output, ViewChild, ContentChildren, NgModule } from '@angular/core';
|
---|
| 3 | import * as i2 from '@angular/common';
|
---|
| 4 | import { CommonModule } from '@angular/common';
|
---|
| 5 | import * as i3 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 { UniqueComponentId, ObjectUtils } from 'primeng/utils';
|
---|
| 11 | import * as i4 from 'primeng/ripple';
|
---|
| 12 | import { RippleModule } from 'primeng/ripple';
|
---|
| 13 | import * as i5 from '@angular/cdk/drag-drop';
|
---|
| 14 | import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
|
---|
| 15 |
|
---|
| 16 | class OrderList {
|
---|
| 17 | constructor(el, cd, filterService) {
|
---|
| 18 | this.el = el;
|
---|
| 19 | this.cd = cd;
|
---|
| 20 | this.filterService = filterService;
|
---|
| 21 | this.metaKeySelection = true;
|
---|
| 22 | this.dragdrop = false;
|
---|
| 23 | this.controlsPosition = 'left';
|
---|
| 24 | this.filterMatchMode = "contains";
|
---|
| 25 | this.breakpoint = "960px";
|
---|
| 26 | this.selectionChange = new EventEmitter();
|
---|
| 27 | this.trackBy = (index, item) => item;
|
---|
| 28 | this.onReorder = new EventEmitter();
|
---|
| 29 | this.onSelectionChange = new EventEmitter();
|
---|
| 30 | this.onFilterEvent = new EventEmitter();
|
---|
| 31 | this.id = UniqueComponentId();
|
---|
| 32 | }
|
---|
| 33 | get selection() {
|
---|
| 34 | return this._selection;
|
---|
| 35 | }
|
---|
| 36 | set selection(val) {
|
---|
| 37 | this._selection = val;
|
---|
| 38 | }
|
---|
| 39 | ngOnInit() {
|
---|
| 40 | if (this.responsive) {
|
---|
| 41 | this.createStyle();
|
---|
| 42 | }
|
---|
| 43 | }
|
---|
| 44 | ngAfterContentInit() {
|
---|
| 45 | this.templates.forEach((item) => {
|
---|
| 46 | switch (item.getType()) {
|
---|
| 47 | case 'item':
|
---|
| 48 | this.itemTemplate = item.template;
|
---|
| 49 | break;
|
---|
| 50 | case 'empty':
|
---|
| 51 | this.emptyMessageTemplate = item.template;
|
---|
| 52 | break;
|
---|
| 53 | case 'emptyfilter':
|
---|
| 54 | this.emptyFilterMessageTemplate = item.template;
|
---|
| 55 | break;
|
---|
| 56 | case 'header':
|
---|
| 57 | this.headerTemplate = item.template;
|
---|
| 58 | break;
|
---|
| 59 | default:
|
---|
| 60 | this.itemTemplate = item.template;
|
---|
| 61 | break;
|
---|
| 62 | }
|
---|
| 63 | });
|
---|
| 64 | }
|
---|
| 65 | ngAfterViewChecked() {
|
---|
| 66 | if (this.movedUp || this.movedDown) {
|
---|
| 67 | let listItems = DomHandler.find(this.listViewChild.nativeElement, 'li.p-highlight');
|
---|
| 68 | let listItem;
|
---|
| 69 | if (listItems.length > 0) {
|
---|
| 70 | if (this.movedUp)
|
---|
| 71 | listItem = listItems[0];
|
---|
| 72 | else
|
---|
| 73 | listItem = listItems[listItems.length - 1];
|
---|
| 74 | DomHandler.scrollInView(this.listViewChild.nativeElement, listItem);
|
---|
| 75 | }
|
---|
| 76 | this.movedUp = false;
|
---|
| 77 | this.movedDown = false;
|
---|
| 78 | }
|
---|
| 79 | }
|
---|
| 80 | get value() {
|
---|
| 81 | return this._value;
|
---|
| 82 | }
|
---|
| 83 | set value(val) {
|
---|
| 84 | this._value = val;
|
---|
| 85 | if (this.filterValue) {
|
---|
| 86 | this.filter();
|
---|
| 87 | }
|
---|
| 88 | }
|
---|
| 89 | onItemClick(event, item, index) {
|
---|
| 90 | this.itemTouched = false;
|
---|
| 91 | let selectedIndex = ObjectUtils.findIndexInList(item, this.selection);
|
---|
| 92 | let selected = (selectedIndex != -1);
|
---|
| 93 | let metaSelection = this.itemTouched ? false : this.metaKeySelection;
|
---|
| 94 | if (metaSelection) {
|
---|
| 95 | let metaKey = (event.metaKey || event.ctrlKey || event.shiftKey);
|
---|
| 96 | if (selected && metaKey) {
|
---|
| 97 | this._selection = this._selection.filter((val, index) => index !== selectedIndex);
|
---|
| 98 | }
|
---|
| 99 | else {
|
---|
| 100 | this._selection = (metaKey) ? this._selection ? [...this._selection] : [] : [];
|
---|
| 101 | ObjectUtils.insertIntoOrderedArray(item, index, this._selection, this.value);
|
---|
| 102 | }
|
---|
| 103 | }
|
---|
| 104 | else {
|
---|
| 105 | if (selected) {
|
---|
| 106 | this._selection = this._selection.filter((val, index) => index !== selectedIndex);
|
---|
| 107 | }
|
---|
| 108 | else {
|
---|
| 109 | this._selection = this._selection ? [...this._selection] : [];
|
---|
| 110 | ObjectUtils.insertIntoOrderedArray(item, index, this._selection, this.value);
|
---|
| 111 | }
|
---|
| 112 | }
|
---|
| 113 | //binding
|
---|
| 114 | this.selectionChange.emit(this._selection);
|
---|
| 115 | //event
|
---|
| 116 | this.onSelectionChange.emit({ originalEvent: event, value: this._selection });
|
---|
| 117 | }
|
---|
| 118 | onFilterKeyup(event) {
|
---|
| 119 | this.filterValue = event.target.value.trim().toLocaleLowerCase(this.filterLocale);
|
---|
| 120 | this.filter();
|
---|
| 121 | this.onFilterEvent.emit({
|
---|
| 122 | originalEvent: event,
|
---|
| 123 | value: this.visibleOptions
|
---|
| 124 | });
|
---|
| 125 | }
|
---|
| 126 | filter() {
|
---|
| 127 | let searchFields = this.filterBy.split(',');
|
---|
| 128 | this.visibleOptions = this.filterService.filter(this.value, searchFields, this.filterValue, this.filterMatchMode, this.filterLocale);
|
---|
| 129 | }
|
---|
| 130 | isItemVisible(item) {
|
---|
| 131 | if (this.filterValue && this.filterValue.trim().length) {
|
---|
| 132 | for (let i = 0; i < this.visibleOptions.length; i++) {
|
---|
| 133 | if (item == this.visibleOptions[i]) {
|
---|
| 134 | return true;
|
---|
| 135 | }
|
---|
| 136 | }
|
---|
| 137 | }
|
---|
| 138 | else {
|
---|
| 139 | return true;
|
---|
| 140 | }
|
---|
| 141 | }
|
---|
| 142 | onItemTouchEnd() {
|
---|
| 143 | this.itemTouched = true;
|
---|
| 144 | }
|
---|
| 145 | isSelected(item) {
|
---|
| 146 | return ObjectUtils.findIndexInList(item, this.selection) != -1;
|
---|
| 147 | }
|
---|
| 148 | isEmpty() {
|
---|
| 149 | return this.filterValue ? (!this.visibleOptions || this.visibleOptions.length === 0) : (!this.value || this.value.length === 0);
|
---|
| 150 | }
|
---|
| 151 | moveUp() {
|
---|
| 152 | if (this.selection) {
|
---|
| 153 | for (let i = 0; i < this.selection.length; i++) {
|
---|
| 154 | let selectedItem = this.selection[i];
|
---|
| 155 | let selectedItemIndex = ObjectUtils.findIndexInList(selectedItem, this.value);
|
---|
| 156 | if (selectedItemIndex != 0) {
|
---|
| 157 | let movedItem = this.value[selectedItemIndex];
|
---|
| 158 | let temp = this.value[selectedItemIndex - 1];
|
---|
| 159 | this.value[selectedItemIndex - 1] = movedItem;
|
---|
| 160 | this.value[selectedItemIndex] = temp;
|
---|
| 161 | }
|
---|
| 162 | else {
|
---|
| 163 | break;
|
---|
| 164 | }
|
---|
| 165 | }
|
---|
| 166 | if (this.dragdrop && this.filterValue)
|
---|
| 167 | this.filter();
|
---|
| 168 | this.movedUp = true;
|
---|
| 169 | this.onReorder.emit(this.selection);
|
---|
| 170 | }
|
---|
| 171 | }
|
---|
| 172 | moveTop() {
|
---|
| 173 | if (this.selection) {
|
---|
| 174 | for (let i = this.selection.length - 1; i >= 0; i--) {
|
---|
| 175 | let selectedItem = this.selection[i];
|
---|
| 176 | let selectedItemIndex = ObjectUtils.findIndexInList(selectedItem, this.value);
|
---|
| 177 | if (selectedItemIndex != 0) {
|
---|
| 178 | let movedItem = this.value.splice(selectedItemIndex, 1)[0];
|
---|
| 179 | this.value.unshift(movedItem);
|
---|
| 180 | }
|
---|
| 181 | else {
|
---|
| 182 | break;
|
---|
| 183 | }
|
---|
| 184 | }
|
---|
| 185 | if (this.dragdrop && this.filterValue)
|
---|
| 186 | this.filter();
|
---|
| 187 | this.onReorder.emit(this.selection);
|
---|
| 188 | this.listViewChild.nativeElement.scrollTop = 0;
|
---|
| 189 | }
|
---|
| 190 | }
|
---|
| 191 | moveDown() {
|
---|
| 192 | if (this.selection) {
|
---|
| 193 | for (let i = this.selection.length - 1; i >= 0; i--) {
|
---|
| 194 | let selectedItem = this.selection[i];
|
---|
| 195 | let selectedItemIndex = ObjectUtils.findIndexInList(selectedItem, this.value);
|
---|
| 196 | if (selectedItemIndex != (this.value.length - 1)) {
|
---|
| 197 | let movedItem = this.value[selectedItemIndex];
|
---|
| 198 | let temp = this.value[selectedItemIndex + 1];
|
---|
| 199 | this.value[selectedItemIndex + 1] = movedItem;
|
---|
| 200 | this.value[selectedItemIndex] = temp;
|
---|
| 201 | }
|
---|
| 202 | else {
|
---|
| 203 | break;
|
---|
| 204 | }
|
---|
| 205 | }
|
---|
| 206 | if (this.dragdrop && this.filterValue)
|
---|
| 207 | this.filter();
|
---|
| 208 | this.movedDown = true;
|
---|
| 209 | this.onReorder.emit(this.selection);
|
---|
| 210 | }
|
---|
| 211 | }
|
---|
| 212 | moveBottom() {
|
---|
| 213 | if (this.selection) {
|
---|
| 214 | for (let i = 0; i < this.selection.length; i++) {
|
---|
| 215 | let selectedItem = this.selection[i];
|
---|
| 216 | let selectedItemIndex = ObjectUtils.findIndexInList(selectedItem, this.value);
|
---|
| 217 | if (selectedItemIndex != (this.value.length - 1)) {
|
---|
| 218 | let movedItem = this.value.splice(selectedItemIndex, 1)[0];
|
---|
| 219 | this.value.push(movedItem);
|
---|
| 220 | }
|
---|
| 221 | else {
|
---|
| 222 | break;
|
---|
| 223 | }
|
---|
| 224 | }
|
---|
| 225 | if (this.dragdrop && this.filterValue)
|
---|
| 226 | this.filter();
|
---|
| 227 | this.onReorder.emit(this.selection);
|
---|
| 228 | this.listViewChild.nativeElement.scrollTop = this.listViewChild.nativeElement.scrollHeight;
|
---|
| 229 | }
|
---|
| 230 | }
|
---|
| 231 | onDrop(event) {
|
---|
| 232 | let previousIndex = event.previousIndex;
|
---|
| 233 | let currentIndex = event.currentIndex;
|
---|
| 234 | if (previousIndex !== currentIndex) {
|
---|
| 235 | if (this.visibleOptions) {
|
---|
| 236 | if (this.filterValue) {
|
---|
| 237 | previousIndex = ObjectUtils.findIndexInList(event.item.data, this.value);
|
---|
| 238 | currentIndex = ObjectUtils.findIndexInList(this.visibleOptions[currentIndex], this.value);
|
---|
| 239 | }
|
---|
| 240 | moveItemInArray(this.visibleOptions, event.previousIndex, event.currentIndex);
|
---|
| 241 | }
|
---|
| 242 | moveItemInArray(this.value, previousIndex, currentIndex);
|
---|
| 243 | this.onReorder.emit([event.item.data]);
|
---|
| 244 | }
|
---|
| 245 | }
|
---|
| 246 | onItemKeydown(event, item, index) {
|
---|
| 247 | let listItem = event.currentTarget;
|
---|
| 248 | switch (event.which) {
|
---|
| 249 | //down
|
---|
| 250 | case 40:
|
---|
| 251 | var nextItem = this.findNextItem(listItem);
|
---|
| 252 | if (nextItem) {
|
---|
| 253 | nextItem.focus();
|
---|
| 254 | }
|
---|
| 255 | event.preventDefault();
|
---|
| 256 | break;
|
---|
| 257 | //up
|
---|
| 258 | case 38:
|
---|
| 259 | var prevItem = this.findPrevItem(listItem);
|
---|
| 260 | if (prevItem) {
|
---|
| 261 | prevItem.focus();
|
---|
| 262 | }
|
---|
| 263 | event.preventDefault();
|
---|
| 264 | break;
|
---|
| 265 | //enter
|
---|
| 266 | case 13:
|
---|
| 267 | this.onItemClick(event, item, index);
|
---|
| 268 | event.preventDefault();
|
---|
| 269 | break;
|
---|
| 270 | }
|
---|
| 271 | }
|
---|
| 272 | findNextItem(item) {
|
---|
| 273 | let nextItem = item.nextElementSibling;
|
---|
| 274 | if (nextItem)
|
---|
| 275 | return !DomHandler.hasClass(nextItem, 'p-orderlist-item') || DomHandler.isHidden(nextItem) ? this.findNextItem(nextItem) : nextItem;
|
---|
| 276 | else
|
---|
| 277 | return null;
|
---|
| 278 | }
|
---|
| 279 | findPrevItem(item) {
|
---|
| 280 | let prevItem = item.previousElementSibling;
|
---|
| 281 | if (prevItem)
|
---|
| 282 | return !DomHandler.hasClass(prevItem, 'p-orderlist-item') || DomHandler.isHidden(prevItem) ? this.findPrevItem(prevItem) : prevItem;
|
---|
| 283 | else
|
---|
| 284 | return null;
|
---|
| 285 | }
|
---|
| 286 | createStyle() {
|
---|
| 287 | if (!this.styleElement) {
|
---|
| 288 | this.el.nativeElement.children[0].setAttribute(this.id, '');
|
---|
| 289 | this.styleElement = document.createElement('style');
|
---|
| 290 | this.styleElement.type = 'text/css';
|
---|
| 291 | document.head.appendChild(this.styleElement);
|
---|
| 292 | let innerHTML = `
|
---|
| 293 | @media screen and (max-width: ${this.breakpoint}) {
|
---|
| 294 | .p-orderlist[${this.id}] {
|
---|
| 295 | flex-direction: column;
|
---|
| 296 | }
|
---|
| 297 |
|
---|
| 298 | .p-orderlist[${this.id}] .p-orderlist-controls {
|
---|
| 299 | padding: var(--content-padding);
|
---|
| 300 | flex-direction: row;
|
---|
| 301 | }
|
---|
| 302 |
|
---|
| 303 | .p-orderlist[${this.id}] .p-orderlist-controls .p-button {
|
---|
| 304 | margin-right: var(--inline-spacing);
|
---|
| 305 | margin-bottom: 0;
|
---|
| 306 | }
|
---|
| 307 |
|
---|
| 308 | .p-orderlist[${this.id}] .p-orderlist-controls .p-button:last-child {
|
---|
| 309 | margin-right: 0;
|
---|
| 310 | }
|
---|
| 311 | }
|
---|
| 312 | `;
|
---|
| 313 | this.styleElement.innerHTML = innerHTML;
|
---|
| 314 | }
|
---|
| 315 | }
|
---|
| 316 | destroyStyle() {
|
---|
| 317 | if (this.styleElement) {
|
---|
| 318 | document.head.removeChild(this.styleElement);
|
---|
| 319 | this.styleElement = null;
|
---|
| 320 | ``;
|
---|
| 321 | }
|
---|
| 322 | }
|
---|
| 323 | ngOnDestroy() {
|
---|
| 324 | this.destroyStyle();
|
---|
| 325 | }
|
---|
| 326 | }
|
---|
| 327 | OrderList.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: OrderList, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1.FilterService }], target: i0.ɵɵFactoryTarget.Component });
|
---|
| 328 | OrderList.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: OrderList, selector: "p-orderList", inputs: { header: "header", style: "style", styleClass: "styleClass", listStyle: "listStyle", responsive: "responsive", filterBy: "filterBy", filterPlaceholder: "filterPlaceholder", filterLocale: "filterLocale", metaKeySelection: "metaKeySelection", dragdrop: "dragdrop", controlsPosition: "controlsPosition", ariaFilterLabel: "ariaFilterLabel", filterMatchMode: "filterMatchMode", breakpoint: "breakpoint", trackBy: "trackBy", selection: "selection", value: "value" }, outputs: { selectionChange: "selectionChange", onReorder: "onReorder", onSelectionChange: "onSelectionChange", onFilterEvent: "onFilterEvent" }, host: { classAttribute: "p-element" }, queries: [{ propertyName: "templates", predicate: PrimeTemplate }], viewQueries: [{ propertyName: "listViewChild", first: true, predicate: ["listelement"], descendants: true }], ngImport: i0, template: `
|
---|
| 329 | <div [ngClass]="{'p-orderlist p-component': true, 'p-orderlist-controls-left': controlsPosition === 'left',
|
---|
| 330 | 'p-orderlist-controls-right': controlsPosition === 'right'}" [ngStyle]="style" [class]="styleClass">
|
---|
| 331 | <div class="p-orderlist-controls">
|
---|
| 332 | <button type="button" pButton pRipple icon="pi pi-angle-up" (click)="moveUp()"></button>
|
---|
| 333 | <button type="button" pButton pRipple icon="pi pi-angle-double-up" (click)="moveTop()"></button>
|
---|
| 334 | <button type="button" pButton pRipple icon="pi pi-angle-down" (click)="moveDown()"></button>
|
---|
| 335 | <button type="button" pButton pRipple icon="pi pi-angle-double-down" (click)="moveBottom()"></button>
|
---|
| 336 | </div>
|
---|
| 337 | <div class="p-orderlist-list-container">
|
---|
| 338 | <div class="p-orderlist-header" *ngIf="header || headerTemplate">
|
---|
| 339 | <div class="p-orderlist-title" *ngIf="!headerTemplate">{{header}}</div>
|
---|
| 340 | <ng-container *ngTemplateOutlet="headerTemplate"></ng-container>
|
---|
| 341 | </div>
|
---|
| 342 | <div class="p-orderlist-filter-container" *ngIf="filterBy">
|
---|
| 343 | <div class="p-orderlist-filter">
|
---|
| 344 | <input type="text" role="textbox" (keyup)="onFilterKeyup($event)" class="p-orderlist-filter-input p-inputtext p-component" [attr.placeholder]="filterPlaceholder" [attr.aria-label]="ariaFilterLabel">
|
---|
| 345 | <span class="p-orderlist-filter-icon pi pi-search"></span>
|
---|
| 346 | </div>
|
---|
| 347 | </div>
|
---|
| 348 | <ul #listelement cdkDropList (cdkDropListDropped)="onDrop($event)" class="p-orderlist-list" [ngStyle]="listStyle">
|
---|
| 349 | <ng-template ngFor [ngForTrackBy]="trackBy" let-item [ngForOf]="value" let-i="index" let-l="last">
|
---|
| 350 | <li class="p-orderlist-item" tabindex="0" [ngClass]="{'p-highlight':isSelected(item)}" cdkDrag pRipple [cdkDragData]="item" [cdkDragDisabled]="!dragdrop"
|
---|
| 351 | (click)="onItemClick($event,item,i)" (touchend)="onItemTouchEnd()" (keydown)="onItemKeydown($event,item,i)"
|
---|
| 352 | *ngIf="isItemVisible(item)" role="option" [attr.aria-selected]="isSelected(item)">
|
---|
| 353 | <ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item, index: i}"></ng-container>
|
---|
| 354 | </li>
|
---|
| 355 | </ng-template>
|
---|
| 356 | <ng-container *ngIf="isEmpty() && (emptyMessageTemplate || emptyFilterMessageTemplate)">
|
---|
| 357 | <li *ngIf="!filterValue || !emptyFilterMessageTemplate" class="p-orderlist-empty-message">
|
---|
| 358 | <ng-container *ngTemplateOutlet="emptyMessageTemplate"></ng-container>
|
---|
| 359 | </li>
|
---|
| 360 | <li *ngIf="filterValue" class="p-orderlist-empty-message">
|
---|
| 361 | <ng-container *ngTemplateOutlet="emptyFilterMessageTemplate"></ng-container>
|
---|
| 362 | </li>
|
---|
| 363 | </ng-container>
|
---|
| 364 | </ul>
|
---|
| 365 | </div>
|
---|
| 366 | </div>
|
---|
| 367 | `, isInline: true, styles: [".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}.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"], directives: [{ type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i3.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i4.Ripple, selector: "[pRipple]" }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: 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"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
---|
| 368 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: OrderList, decorators: [{
|
---|
| 369 | type: Component,
|
---|
| 370 | args: [{ selector: 'p-orderList', template: `
|
---|
| 371 | <div [ngClass]="{'p-orderlist p-component': true, 'p-orderlist-controls-left': controlsPosition === 'left',
|
---|
| 372 | 'p-orderlist-controls-right': controlsPosition === 'right'}" [ngStyle]="style" [class]="styleClass">
|
---|
| 373 | <div class="p-orderlist-controls">
|
---|
| 374 | <button type="button" pButton pRipple icon="pi pi-angle-up" (click)="moveUp()"></button>
|
---|
| 375 | <button type="button" pButton pRipple icon="pi pi-angle-double-up" (click)="moveTop()"></button>
|
---|
| 376 | <button type="button" pButton pRipple icon="pi pi-angle-down" (click)="moveDown()"></button>
|
---|
| 377 | <button type="button" pButton pRipple icon="pi pi-angle-double-down" (click)="moveBottom()"></button>
|
---|
| 378 | </div>
|
---|
| 379 | <div class="p-orderlist-list-container">
|
---|
| 380 | <div class="p-orderlist-header" *ngIf="header || headerTemplate">
|
---|
| 381 | <div class="p-orderlist-title" *ngIf="!headerTemplate">{{header}}</div>
|
---|
| 382 | <ng-container *ngTemplateOutlet="headerTemplate"></ng-container>
|
---|
| 383 | </div>
|
---|
| 384 | <div class="p-orderlist-filter-container" *ngIf="filterBy">
|
---|
| 385 | <div class="p-orderlist-filter">
|
---|
| 386 | <input type="text" role="textbox" (keyup)="onFilterKeyup($event)" class="p-orderlist-filter-input p-inputtext p-component" [attr.placeholder]="filterPlaceholder" [attr.aria-label]="ariaFilterLabel">
|
---|
| 387 | <span class="p-orderlist-filter-icon pi pi-search"></span>
|
---|
| 388 | </div>
|
---|
| 389 | </div>
|
---|
| 390 | <ul #listelement cdkDropList (cdkDropListDropped)="onDrop($event)" class="p-orderlist-list" [ngStyle]="listStyle">
|
---|
| 391 | <ng-template ngFor [ngForTrackBy]="trackBy" let-item [ngForOf]="value" let-i="index" let-l="last">
|
---|
| 392 | <li class="p-orderlist-item" tabindex="0" [ngClass]="{'p-highlight':isSelected(item)}" cdkDrag pRipple [cdkDragData]="item" [cdkDragDisabled]="!dragdrop"
|
---|
| 393 | (click)="onItemClick($event,item,i)" (touchend)="onItemTouchEnd()" (keydown)="onItemKeydown($event,item,i)"
|
---|
| 394 | *ngIf="isItemVisible(item)" role="option" [attr.aria-selected]="isSelected(item)">
|
---|
| 395 | <ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item, index: i}"></ng-container>
|
---|
| 396 | </li>
|
---|
| 397 | </ng-template>
|
---|
| 398 | <ng-container *ngIf="isEmpty() && (emptyMessageTemplate || emptyFilterMessageTemplate)">
|
---|
| 399 | <li *ngIf="!filterValue || !emptyFilterMessageTemplate" class="p-orderlist-empty-message">
|
---|
| 400 | <ng-container *ngTemplateOutlet="emptyMessageTemplate"></ng-container>
|
---|
| 401 | </li>
|
---|
| 402 | <li *ngIf="filterValue" class="p-orderlist-empty-message">
|
---|
| 403 | <ng-container *ngTemplateOutlet="emptyFilterMessageTemplate"></ng-container>
|
---|
| 404 | </li>
|
---|
| 405 | </ng-container>
|
---|
| 406 | </ul>
|
---|
| 407 | </div>
|
---|
| 408 | </div>
|
---|
| 409 | `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
---|
| 410 | 'class': 'p-element'
|
---|
| 411 | }, styles: [".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}.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"] }]
|
---|
| 412 | }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1.FilterService }]; }, propDecorators: { header: [{
|
---|
| 413 | type: Input
|
---|
| 414 | }], style: [{
|
---|
| 415 | type: Input
|
---|
| 416 | }], styleClass: [{
|
---|
| 417 | type: Input
|
---|
| 418 | }], listStyle: [{
|
---|
| 419 | type: Input
|
---|
| 420 | }], responsive: [{
|
---|
| 421 | type: Input
|
---|
| 422 | }], filterBy: [{
|
---|
| 423 | type: Input
|
---|
| 424 | }], filterPlaceholder: [{
|
---|
| 425 | type: Input
|
---|
| 426 | }], filterLocale: [{
|
---|
| 427 | type: Input
|
---|
| 428 | }], metaKeySelection: [{
|
---|
| 429 | type: Input
|
---|
| 430 | }], dragdrop: [{
|
---|
| 431 | type: Input
|
---|
| 432 | }], controlsPosition: [{
|
---|
| 433 | type: Input
|
---|
| 434 | }], ariaFilterLabel: [{
|
---|
| 435 | type: Input
|
---|
| 436 | }], filterMatchMode: [{
|
---|
| 437 | type: Input
|
---|
| 438 | }], breakpoint: [{
|
---|
| 439 | type: Input
|
---|
| 440 | }], selectionChange: [{
|
---|
| 441 | type: Output
|
---|
| 442 | }], trackBy: [{
|
---|
| 443 | type: Input
|
---|
| 444 | }], onReorder: [{
|
---|
| 445 | type: Output
|
---|
| 446 | }], onSelectionChange: [{
|
---|
| 447 | type: Output
|
---|
| 448 | }], onFilterEvent: [{
|
---|
| 449 | type: Output
|
---|
| 450 | }], listViewChild: [{
|
---|
| 451 | type: ViewChild,
|
---|
| 452 | args: ['listelement']
|
---|
| 453 | }], templates: [{
|
---|
| 454 | type: ContentChildren,
|
---|
| 455 | args: [PrimeTemplate]
|
---|
| 456 | }], selection: [{
|
---|
| 457 | type: Input
|
---|
| 458 | }], value: [{
|
---|
| 459 | type: Input
|
---|
| 460 | }] } });
|
---|
| 461 | class OrderListModule {
|
---|
| 462 | }
|
---|
| 463 | OrderListModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: OrderListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
---|
| 464 | OrderListModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: OrderListModule, declarations: [OrderList], imports: [CommonModule, ButtonModule, SharedModule, RippleModule, DragDropModule], exports: [OrderList, SharedModule, DragDropModule] });
|
---|
| 465 | OrderListModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: OrderListModule, imports: [[CommonModule, ButtonModule, SharedModule, RippleModule, DragDropModule], SharedModule, DragDropModule] });
|
---|
| 466 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: OrderListModule, decorators: [{
|
---|
| 467 | type: NgModule,
|
---|
| 468 | args: [{
|
---|
| 469 | imports: [CommonModule, ButtonModule, SharedModule, RippleModule, DragDropModule],
|
---|
| 470 | exports: [OrderList, SharedModule, DragDropModule],
|
---|
| 471 | declarations: [OrderList]
|
---|
| 472 | }]
|
---|
| 473 | }] });
|
---|
| 474 |
|
---|
| 475 | /**
|
---|
| 476 | * Generated bundle index. Do not edit.
|
---|
| 477 | */
|
---|
| 478 |
|
---|
| 479 | export { OrderList, OrderListModule };
|
---|