UNPKG

23.5 kBSource Map (JSON)View Raw
1{"version":3,"sources":["ng://primeng/orderlist/orderlist.ts"],"names":["OrderList","el","this","metaKeySelection","controlsPosition","filterMatchMode","selectionChange","EventEmitter","trackBy","index","item","onReorder","onSelectionChange","onFilterEvent","Object","defineProperty","prototype","_selection","val","ngAfterContentInit","_this","templates","forEach","getType","itemTemplate","template","ngAfterViewChecked","movedUp","movedDown","listItems","DomHandler","find","listViewChild","nativeElement","listItem","length","scrollInView","_value","filterValue","filter","onItemClick","event","itemTouched","selectedIndex","ObjectUtils","findIndexInList","selection","selected","metaKey","ctrlKey","shiftKey","__spread","insertIntoOrderedArray","value","emit","originalEvent","onFilterKeyup","target","trim","toLocaleLowerCase","filterLocale","visibleOptions","searchFields","filterBy","split","FilterUtils","isItemVisible","i","onItemTouchEnd","isSelected","moveUp","selectedItem","selectedItemIndex","movedItem","temp","moveTop","splice","unshift","scrollTop","moveDown","moveBottom","push","scrollHeight","onDragStart","dataTransfer","setData","blur","dragging","draggedItemIndex","onDragOver","dragOverItemIndex","preventDefault","onDragLeave","onDrop","dropIndex","reorderArray","onDragEnd","onListMouseMove","offsetY","getBoundingClientRect","top","document","body","bottomDiff","clientHeight","pageY","topDiff","onItemKeydown","currentTarget","which","nextItem","findNextItem","focus","prevItem","findPrevItem","nextElementSibling","hasClass","isHidden","previousElementSibling","ElementRef","__decorate","Input","Output","ViewChild","ContentChildren","PrimeTemplate","Component","selector","changeDetection","ChangeDetectionStrategy","Default","OrderListModule","NgModule","imports","CommonModule","ButtonModule","SharedModule","exports","declarations"],"mappings":"80CAAAA,EAAA,WA6GI,SAAAA,EAAmBC,GAAAC,KAAAD,GAAAA,EA9CVC,KAAAC,kBAA4B,EAI5BD,KAAAE,iBAA2B,OAI3BF,KAAAG,gBAA0B,WAEzBH,KAAAI,gBAAqC,IAAIC,EAAAA,aAE1CL,KAAAM,QAAoB,SAACC,EAAeC,GAAc,OAAAA,GAEjDR,KAAAS,UAA+B,IAAIJ,EAAAA,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,GAAY/G,KAAKgH,aAAaD,GAAYA,EAErH,+CAxSQM,EAAAA,cA9DdC,EAAA,CAARC,EAAAA,sCAEQD,EAAA,CAARC,EAAAA,qCAEQD,EAAA,CAARC,EAAAA,0CAEQD,EAAA,CAARC,EAAAA,yCAEQD,EAAA,CAARC,EAAAA,0CAEQD,EAAA,CAARC,EAAAA,wCAEQD,EAAA,CAARC,EAAAA,iDAEQD,EAAA,CAARC,EAAAA,4CAEQD,EAAA,CAARC,EAAAA,gDAEQD,EAAA,CAARC,EAAAA,wCAEQD,EAAA,CAARC,EAAAA,gDAEQD,EAAA,CAARC,EAAAA,+CAEQD,EAAA,CAARC,EAAAA,+CAESD,EAAA,CAATE,EAAAA,gDAEQF,EAAA,CAARC,EAAAA,uCAESD,EAAA,CAATE,EAAAA,0CAESF,EAAA,CAATE,EAAAA,kDAESF,EAAA,CAATE,EAAAA,8CAEyBF,EAAA,CAAzBG,EAAAA,UAAU,oDAEqBH,EAAA,CAA/BI,EAAAA,gBAAgBC,EAAAA,gDA8BRL,EAAA,CAARC,EAAAA,uCAwCQD,EAAA,CAARC,EAAAA,mCA9GQzH,EAASwH,EAAA,CArCrBM,EAAAA,UAAU,CACPC,SAAU,cACVtG,SAAU,y/FAiCVuG,gBAAiBC,EAAAA,wBAAwBC,WAEhClI,GA7Cb,gBA8ZA,SAAAmI,KAA+B,OAAlBA,EAAeX,EAAA,CAL3BY,EAAAA,SAAS,CACNC,QAAS,CAACC,EAAAA,aAAaC,EAAAA,aAAaC,EAAAA,cACpCC,QAAS,CAACzI,EAAUwI,EAAAA,cACpBE,aAAc,CAAC1I,MAENmI","sourcesContent":["import {NgModule,Component,ElementRef,AfterViewChecked,AfterContentInit,Input,Output,ContentChildren,QueryList,TemplateRef,EventEmitter,ViewChild,ChangeDetectionStrategy} from '@angular/core';\nimport {CommonModule} from '@angular/common';\nimport {ButtonModule} from 'primeng/button';\nimport {SharedModule,PrimeTemplate} from 'primeng/api';\nimport {DomHandler} from 'primeng/dom';\nimport {ObjectUtils} from 'primeng/utils';\nimport { FilterUtils } from 'primeng/utils';\n\n@Component({\n selector: 'p-orderList',\n template: `\n <div [ngClass]=\"{'ui-orderlist ui-widget': true, 'ui-orderlist-controls-left': controlsPosition === 'left',\n 'ui-orderlist-controls-right': controlsPosition === 'right'}\" [ngStyle]=\"style\" [class]=\"styleClass\">\n <div class=\"ui-orderlist-controls\">\n <button type=\"button\" pButton icon=\"pi pi-angle-up\" (click)=\"moveUp($event)\"></button>\n <button type=\"button\" pButton icon=\"pi pi-angle-double-up\" (click)=\"moveTop($event)\"></button>\n <button type=\"button\" pButton icon=\"pi pi-angle-down\" (click)=\"moveDown($event)\"></button>\n <button type=\"button\" pButton icon=\"pi pi-angle-double-down\" (click)=\"moveBottom($event)\"></button>\n </div>\n <div class=\"ui-orderlist-list-container\">\n <div class=\"ui-orderlist-caption ui-widget-header ui-corner-top\" *ngIf=\"header\">{{header}}</div>\n <div class=\"ui-orderlist-filter-container ui-widget-content\" *ngIf=\"filterBy\">\n <input type=\"text\" role=\"textbox\" (keyup)=\"onFilterKeyup($event)\" class=\"ui-inputtext ui-widget ui-state-default ui-corner-all\" [attr.placeholder]=\"filterPlaceholder\" [attr.aria-label]=\"ariaFilterLabel\">\n <span class=\"ui-orderlist-filter-icon pi pi-search\"></span>\n </div>\n <ul #listelement class=\"ui-widget-content ui-orderlist-list ui-corner-bottom\" [ngStyle]=\"listStyle\" (dragover)=\"onListMouseMove($event)\">\n <ng-template ngFor [ngForTrackBy]=\"trackBy\" let-item [ngForOf]=\"value\" let-i=\"index\" let-l=\"last\">\n <li class=\"ui-orderlist-droppoint\" *ngIf=\"dragdrop && isItemVisible(item)\" (dragover)=\"onDragOver($event, i)\" (drop)=\"onDrop($event, i)\" (dragleave)=\"onDragLeave($event)\"\n [ngClass]=\"{'ui-orderlist-droppoint-highlight': (i === dragOverItemIndex)}\"></li>\n <li class=\"ui-orderlist-item\" tabindex=\"0\"\n [ngClass]=\"{'ui-state-highlight':isSelected(item)}\"\n (click)=\"onItemClick($event,item,i)\" (touchend)=\"onItemTouchEnd($event)\" (keydown)=\"onItemKeydown($event,item,i)\"\n [style.display]=\"isItemVisible(item) ? 'block' : 'none'\" role=\"option\" [attr.aria-selected]=\"isSelected(item)\"\n [draggable]=\"dragdrop\" (dragstart)=\"onDragStart($event, i)\" (dragend)=\"onDragEnd($event)\">\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: {$implicit: item, index: i}\"></ng-container>\n </li>\n <li class=\"ui-orderlist-droppoint\" *ngIf=\"dragdrop && l\" (dragover)=\"onDragOver($event, i + 1)\" (drop)=\"onDrop($event, i + 1)\" (dragleave)=\"onDragLeave($event)\"\n [ngClass]=\"{'ui-orderlist-droppoint-highlight': (i + 1 === dragOverItemIndex)}\"></li>\n </ng-template>\n </ul>\n </div>\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.Default\n})\nexport class OrderList implements AfterViewChecked,AfterContentInit {\n\n @Input() header: string;\n\n @Input() style: any;\n\n @Input() styleClass: string;\n\n @Input() listStyle: any;\n\n @Input() responsive: boolean;\n\n @Input() filterBy: string;\n\n @Input() filterPlaceholder: string;\n\n @Input() filterLocale: string;\n\n @Input() metaKeySelection: boolean = true;\n\n @Input() dragdrop: boolean;\n\n @Input() controlsPosition: string = 'left';\n\n @Input() ariaFilterLabel: string;\n\n @Input() filterMatchMode: string = \"contains\";\n\n @Output() selectionChange: EventEmitter<any> = new EventEmitter();\n\n @Input() trackBy: Function = (index: number, item: any) => item;\n\n @Output() onReorder: EventEmitter<any> = new EventEmitter();\n\n @Output() onSelectionChange: EventEmitter<any> = new EventEmitter();\n\n @Output() onFilterEvent: EventEmitter<any> = new EventEmitter();\n\n @ViewChild('listelement') listViewChild: ElementRef;\n\n @ContentChildren(PrimeTemplate) templates: QueryList<any>;\n\n public itemTemplate: TemplateRef<any>;\n\n _selection: any[];\n\n movedUp: boolean;\n\n movedDown: boolean;\n\n itemTouched: boolean;\n\n draggedItemIndex: number;\n\n dragOverItemIndex: number;\n\n dragging: boolean;\n\n public filterValue: string;\n\n public visibleOptions: any[];\n\n public _value: any[];\n\n constructor(public el: ElementRef) {}\n\n get selection(): any[] {\n return this._selection;\n }\n\n @Input() set selection(val:any[]) {\n this._selection = val;\n }\n\n ngAfterContentInit() {\n this.templates.forEach((item) => {\n switch(item.getType()) {\n case 'item':\n this.itemTemplate = item.template;\n break;\n\n default:\n this.itemTemplate = item.template;\n break;\n }\n });\n }\n\n ngAfterViewChecked() {\n if (this.movedUp||this.movedDown) {\n let listItems = DomHandler.find(this.listViewChild.nativeElement, 'li.ui-state-highlight');\n let listItem;\n\n if (listItems.length > 0) {\n if (this.movedUp)\n listItem = listItems[0];\n else\n listItem = listItems[listItems.length - 1];\n\n DomHandler.scrollInView(this.listViewChild.nativeElement, listItem);\n }\n this.movedUp = false;\n this.movedDown = false;\n }\n }\n\n get value(): any[] {\n return this._value;\n }\n\n @Input() set value(val:any[]) {\n this._value = val;\n if (this.filterValue) {\n this.filter();\n }\n }\n\n onItemClick(event, item, index) {\n this.itemTouched = false;\n let selectedIndex = ObjectUtils.findIndexInList(item, this.selection);\n let selected = (selectedIndex != -1);\n let metaSelection = this.itemTouched ? false : this.metaKeySelection;\n\n if (metaSelection) {\n let metaKey = (event.metaKey||event.ctrlKey||event.shiftKey);\n\n if (selected && metaKey) {\n this._selection = this._selection.filter((val, index) => index !== selectedIndex);\n }\n else {\n this._selection = (metaKey) ? this._selection ? [...this._selection] : [] : [];\n ObjectUtils.insertIntoOrderedArray(item, index, this._selection, this.value);\n }\n }\n else {\n if (selected) {\n this._selection = this._selection.filter((val, index) => index !== selectedIndex);\n }\n else {\n this._selection = this._selection ? [...this._selection] : [];\n ObjectUtils.insertIntoOrderedArray(item, index, this._selection, this.value);\n }\n }\n\n //binding\n this.selectionChange.emit(this._selection);\n\n //event\n this.onSelectionChange.emit({originalEvent:event, value: this._selection});\n }\n\n onFilterKeyup(event) {\n this.filterValue = event.target.value.trim().toLocaleLowerCase(this.filterLocale);\n this.filter();\n\n this.onFilterEvent.emit({\n originalEvent: event,\n value: this.visibleOptions\n });\n }\n\n filter() {\n let searchFields: string[] = this.filterBy.split(',');\n this.visibleOptions = FilterUtils.filter(this.value, searchFields, this.filterValue, this.filterMatchMode, this.filterLocale);\n }\n\n isItemVisible(item: any): boolean {\n if (this.filterValue && this.filterValue.trim().length) {\n for (let i = 0; i < this.visibleOptions.length; i++) {\n if (item == this.visibleOptions[i]) {\n return true;\n }\n }\n }\n else {\n return true;\n }\n }\n\n onItemTouchEnd(event) {\n this.itemTouched = true;\n }\n\n isSelected(item: any) {\n return ObjectUtils.findIndexInList(item, this.selection) != -1;\n }\n\n moveUp(event) {\n if (this.selection) {\n for (let i = 0; i < this.selection.length; i++) {\n let selectedItem = this.selection[i];\n let selectedItemIndex: number = ObjectUtils.findIndexInList(selectedItem, this.value);\n\n if (selectedItemIndex != 0) {\n let movedItem = this.value[selectedItemIndex];\n let temp = this.value[selectedItemIndex-1];\n this.value[selectedItemIndex-1] = movedItem;\n this.value[selectedItemIndex] = temp;\n }\n else {\n break;\n }\n }\n\n this.movedUp = true;\n this.onReorder.emit(event);\n }\n }\n\n moveTop(event) {\n if (this.selection) {\n for (let i = this.selection.length - 1; i >= 0; i--) {\n let selectedItem = this.selection[i];\n let selectedItemIndex: number = ObjectUtils.findIndexInList(selectedItem, this.value);\n\n if (selectedItemIndex != 0) {\n let movedItem = this.value.splice(selectedItemIndex,1)[0];\n this.value.unshift(movedItem);\n }\n else {\n break;\n }\n }\n\n this.onReorder.emit(event);\n this.listViewChild.nativeElement.scrollTop = 0;\n }\n }\n\n moveDown(event) {\n if (this.selection) {\n for (let i = this.selection.length - 1; i >= 0; i--) {\n let selectedItem = this.selection[i];\n let selectedItemIndex: number = ObjectUtils.findIndexInList(selectedItem, this.value);\n\n if (selectedItemIndex != (this.value.length - 1)) {\n let movedItem = this.value[selectedItemIndex];\n let temp = this.value[selectedItemIndex+1];\n this.value[selectedItemIndex+1] = movedItem;\n this.value[selectedItemIndex] = temp;\n }\n else {\n break;\n }\n }\n\n this.movedDown = true;\n this.onReorder.emit(event);\n }\n }\n\n moveBottom(event) {\n if (this.selection) {\n for (let i = 0; i < this.selection.length; i++) {\n let selectedItem = this.selection[i];\n let selectedItemIndex: number = ObjectUtils.findIndexInList(selectedItem, this.value);\n\n if (selectedItemIndex != (this.value.length - 1)) {\n let movedItem = this.value.splice(selectedItemIndex,1)[0];\n this.value.push(movedItem);\n }\n else {\n break;\n }\n }\n\n this.onReorder.emit(event);\n this.listViewChild.nativeElement.scrollTop = this.listViewChild.nativeElement.scrollHeight;\n }\n }\n\n onDragStart(event: DragEvent, index: number) {\n event.dataTransfer.setData('text', 'b'); // For firefox\n (<HTMLLIElement> event.target).blur();\n this.dragging = true;\n this.draggedItemIndex = index;\n }\n\n onDragOver(event: DragEvent, index: number) {\n if (this.dragging && this.draggedItemIndex !== index && this.draggedItemIndex + 1 !== index) {\n this.dragOverItemIndex = index;\n event.preventDefault();\n }\n }\n\n onDragLeave(event: DragEvent) {\n this.dragOverItemIndex = null;\n }\n\n onDrop(event: DragEvent, index: number) {\n let dropIndex = (this.draggedItemIndex > index) ? index : (index === 0) ? 0 : index - 1;\n ObjectUtils.reorderArray(this.value, this.draggedItemIndex, dropIndex);\n this.dragOverItemIndex = null;\n this.onReorder.emit(event);\n event.preventDefault();\n }\n\n onDragEnd(event: DragEvent) {\n this.dragging = false;\n }\n\n onListMouseMove(event: MouseEvent) {\n if (this.dragging) {\n let offsetY = this.listViewChild.nativeElement.getBoundingClientRect().top + document.body.scrollTop;\n let bottomDiff = (offsetY + this.listViewChild.nativeElement.clientHeight) - event.pageY;\n let topDiff = (event.pageY - offsetY);\n if (bottomDiff < 25 && bottomDiff > 0)\n this.listViewChild.nativeElement.scrollTop += 15;\n else if (topDiff < 25 && topDiff > 0)\n this.listViewChild.nativeElement.scrollTop -= 15;\n }\n }\n\n onItemKeydown(event: KeyboardEvent, item, index: Number) {\n let listItem = <HTMLLIElement> event.currentTarget;\n\n switch(event.which) {\n //down\n case 40:\n var nextItem = this.findNextItem(listItem);\n if (nextItem) {\n nextItem.focus();\n }\n\n event.preventDefault();\n break;\n\n //up\n case 38:\n var prevItem = this.findPrevItem(listItem);\n if (prevItem) {\n prevItem.focus();\n }\n\n event.preventDefault();\n break;\n\n //enter\n case 13:\n this.onItemClick(event, item, index);\n event.preventDefault();\n break;\n }\n }\n\n findNextItem(item) {\n let nextItem = item.nextElementSibling;\n\n if (nextItem)\n return !DomHandler.hasClass(nextItem, 'ui-orderlist-item') || DomHandler.isHidden(nextItem) ? this.findNextItem(nextItem) : nextItem;\n else\n return null;\n }\n\n findPrevItem(item) {\n let prevItem = item.previousElementSibling;\n\n if (prevItem)\n return !DomHandler.hasClass(prevItem, 'ui-orderlist-item') || DomHandler.isHidden(prevItem) ? this.findPrevItem(prevItem) : prevItem;\n else\n return null;\n }\n}\n\n@NgModule({\n imports: [CommonModule,ButtonModule,SharedModule],\n exports: [OrderList,SharedModule],\n declarations: [OrderList]\n})\nexport class OrderListModule { }\n"]}
\No newline at end of file