| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670 |
- "use strict";
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
- };
- var __metadata = (this && this.__metadata) || function (k, v) {
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
- };
- Object.defineProperty(exports, "__esModule", { value: true });
- var core_1 = require("@angular/core");
- var common_1 = require("@angular/common");
- var button_1 = require("../button/button");
- var shared_1 = require("../common/shared");
- var domhandler_1 = require("../dom/domhandler");
- var objectutils_1 = require("../utils/objectutils");
- var filterutils_1 = require("../utils/filterutils");
- var PickList = /** @class */ (function () {
- function PickList(el) {
- this.el = el;
- this.trackBy = function (index, item) { return item; };
- this.showSourceFilter = true;
- this.showTargetFilter = true;
- this.metaKeySelection = true;
- this.showSourceControls = true;
- this.showTargetControls = true;
- this.disabled = false;
- this.filterMatchMode = "contains";
- this.onMoveToSource = new core_1.EventEmitter();
- this.onMoveAllToSource = new core_1.EventEmitter();
- this.onMoveAllToTarget = new core_1.EventEmitter();
- this.onMoveToTarget = new core_1.EventEmitter();
- this.onSourceReorder = new core_1.EventEmitter();
- this.onTargetReorder = new core_1.EventEmitter();
- this.onSourceSelect = new core_1.EventEmitter();
- this.onTargetSelect = new core_1.EventEmitter();
- this.onSourceFilter = new core_1.EventEmitter();
- this.onTargetFilter = new core_1.EventEmitter();
- this.selectedItemsSource = [];
- this.selectedItemsTarget = [];
- this.SOURCE_LIST = -1;
- this.TARGET_LIST = 1;
- }
- PickList.prototype.ngAfterContentInit = function () {
- var _this = this;
- this.templates.forEach(function (item) {
- switch (item.getType()) {
- case 'item':
- _this.itemTemplate = item.template;
- break;
- case 'emptymessagesource':
- _this.emptyMessageSourceTemplate = item.template;
- break;
- case 'emptymessagetarget':
- _this.emptyMessageTargetTemplate = item.template;
- break;
- default:
- _this.itemTemplate = item.template;
- break;
- }
- });
- };
- PickList.prototype.ngAfterViewChecked = function () {
- if (this.movedUp || this.movedDown) {
- var listItems = domhandler_1.DomHandler.find(this.reorderedListElement, 'li.ui-state-highlight');
- var listItem = void 0;
- if (this.movedUp)
- listItem = listItems[0];
- else
- listItem = listItems[listItems.length - 1];
- domhandler_1.DomHandler.scrollInView(this.reorderedListElement, listItem);
- this.movedUp = false;
- this.movedDown = false;
- this.reorderedListElement = null;
- }
- };
- PickList.prototype.onItemClick = function (event, item, selectedItems, callback) {
- if (this.disabled) {
- return;
- }
- var index = this.findIndexInSelection(item, selectedItems);
- var selected = (index != -1);
- var metaSelection = this.itemTouched ? false : this.metaKeySelection;
- if (metaSelection) {
- var metaKey = (event.metaKey || event.ctrlKey || event.shiftKey);
- if (selected && metaKey) {
- selectedItems.splice(index, 1);
- }
- else {
- if (!metaKey) {
- selectedItems.length = 0;
- }
- selectedItems.push(item);
- }
- }
- else {
- if (selected)
- selectedItems.splice(index, 1);
- else
- selectedItems.push(item);
- }
- callback.emit({ originalEvent: event, items: selectedItems });
- this.itemTouched = false;
- };
- PickList.prototype.onSourceItemDblClick = function () {
- if (this.disabled) {
- return;
- }
- this.moveRight();
- };
- PickList.prototype.onTargetItemDblClick = function () {
- if (this.disabled) {
- return;
- }
- this.moveLeft();
- };
- PickList.prototype.onFilter = function (event, data, listType) {
- var query = event.target.value.trim().toLowerCase();
- var searchFields = this.filterBy.split(',');
- if (listType === this.SOURCE_LIST) {
- this.filterValueSource = query;
- this.visibleOptionsSource = filterutils_1.FilterUtils.filter(data, searchFields, this.filterValueSource, this.filterMatchMode);
- this.onSourceFilter.emit({ query: this.filterValueSource, value: this.visibleOptionsSource });
- }
- else if (listType === this.TARGET_LIST) {
- this.filterValueTarget = query;
- this.visibleOptionsTarget = filterutils_1.FilterUtils.filter(data, searchFields, this.filterValueTarget, this.filterMatchMode);
- this.onTargetFilter.emit({ query: this.filterValueTarget, value: this.visibleOptionsTarget });
- }
- };
- PickList.prototype.isItemVisible = function (item, listType) {
- if (listType == this.SOURCE_LIST)
- return this.isVisibleInList(this.visibleOptionsSource, item, this.filterValueSource);
- else
- return this.isVisibleInList(this.visibleOptionsTarget, item, this.filterValueTarget);
- };
- PickList.prototype.isVisibleInList = function (data, item, filterValue) {
- if (filterValue && filterValue.trim().length) {
- for (var i = 0; i < data.length; i++) {
- if (item == data[i]) {
- return true;
- }
- }
- }
- else {
- return true;
- }
- };
- PickList.prototype.onItemTouchEnd = function (event) {
- if (this.disabled) {
- return;
- }
- this.itemTouched = true;
- };
- PickList.prototype.sortByIndexInList = function (items, list) {
- var _this = this;
- return items.sort(function (item1, item2) {
- return _this.findIndexInList(item1, list) - _this.findIndexInList(item2, list);
- });
- };
- PickList.prototype.moveUp = function (listElement, list, selectedItems, callback) {
- if (selectedItems && selectedItems.length) {
- selectedItems = this.sortByIndexInList(selectedItems, list);
- for (var i = 0; i < selectedItems.length; i++) {
- var selectedItem = selectedItems[i];
- var selectedItemIndex = this.findIndexInList(selectedItem, list);
- if (selectedItemIndex != 0) {
- var movedItem = list[selectedItemIndex];
- var temp = list[selectedItemIndex - 1];
- list[selectedItemIndex - 1] = movedItem;
- list[selectedItemIndex] = temp;
- }
- else {
- break;
- }
- }
- this.movedUp = true;
- this.reorderedListElement = listElement;
- callback.emit({ items: selectedItems });
- }
- };
- PickList.prototype.moveTop = function (listElement, list, selectedItems, callback) {
- if (selectedItems && selectedItems.length) {
- selectedItems = this.sortByIndexInList(selectedItems, list);
- for (var i = 0; i < selectedItems.length; i++) {
- var selectedItem = selectedItems[i];
- var selectedItemIndex = this.findIndexInList(selectedItem, list);
- if (selectedItemIndex != 0) {
- var movedItem = list.splice(selectedItemIndex, 1)[0];
- list.unshift(movedItem);
- }
- else {
- break;
- }
- }
- listElement.scrollTop = 0;
- callback.emit({ items: selectedItems });
- }
- };
- PickList.prototype.moveDown = function (listElement, list, selectedItems, callback) {
- if (selectedItems && selectedItems.length) {
- selectedItems = this.sortByIndexInList(selectedItems, list);
- for (var i = selectedItems.length - 1; i >= 0; i--) {
- var selectedItem = selectedItems[i];
- var selectedItemIndex = this.findIndexInList(selectedItem, list);
- if (selectedItemIndex != (list.length - 1)) {
- var movedItem = list[selectedItemIndex];
- var temp = list[selectedItemIndex + 1];
- list[selectedItemIndex + 1] = movedItem;
- list[selectedItemIndex] = temp;
- }
- else {
- break;
- }
- }
- this.movedDown = true;
- this.reorderedListElement = listElement;
- callback.emit({ items: selectedItems });
- }
- };
- PickList.prototype.moveBottom = function (listElement, list, selectedItems, callback) {
- if (selectedItems && selectedItems.length) {
- selectedItems = this.sortByIndexInList(selectedItems, list);
- for (var i = selectedItems.length - 1; i >= 0; i--) {
- var selectedItem = selectedItems[i];
- var selectedItemIndex = this.findIndexInList(selectedItem, list);
- if (selectedItemIndex != (list.length - 1)) {
- var movedItem = list.splice(selectedItemIndex, 1)[0];
- list.push(movedItem);
- }
- else {
- break;
- }
- }
- listElement.scrollTop = listElement.scrollHeight;
- callback.emit({ items: selectedItems });
- }
- };
- PickList.prototype.moveRight = function () {
- if (this.selectedItemsSource && this.selectedItemsSource.length) {
- for (var i = 0; i < this.selectedItemsSource.length; i++) {
- var selectedItem = this.selectedItemsSource[i];
- if (this.findIndexInList(selectedItem, this.target) == -1) {
- this.target.push(this.source.splice(this.findIndexInList(selectedItem, this.source), 1)[0]);
- }
- }
- this.onMoveToTarget.emit({
- items: this.selectedItemsSource
- });
- this.selectedItemsSource = [];
- }
- };
- PickList.prototype.moveAllRight = function () {
- if (this.source) {
- var movedItems = [];
- for (var i = 0; i < this.source.length; i++) {
- if (this.isItemVisible(this.source[i], this.SOURCE_LIST)) {
- var removedItem = this.source.splice(i, 1)[0];
- this.target.push(removedItem);
- movedItems.push(removedItem);
- i--;
- }
- }
- this.onMoveToTarget.emit({
- items: movedItems
- });
- this.onMoveAllToTarget.emit({
- items: movedItems
- });
- this.selectedItemsSource = [];
- }
- };
- PickList.prototype.moveLeft = function () {
- if (this.selectedItemsTarget && this.selectedItemsTarget.length) {
- for (var i = 0; i < this.selectedItemsTarget.length; i++) {
- var selectedItem = this.selectedItemsTarget[i];
- if (this.findIndexInList(selectedItem, this.source) == -1) {
- this.source.push(this.target.splice(this.findIndexInList(selectedItem, this.target), 1)[0]);
- }
- }
- this.onMoveToSource.emit({
- items: this.selectedItemsTarget
- });
- this.selectedItemsTarget = [];
- }
- };
- PickList.prototype.moveAllLeft = function () {
- if (this.target) {
- var movedItems = [];
- for (var i = 0; i < this.target.length; i++) {
- if (this.isItemVisible(this.target[i], this.TARGET_LIST)) {
- var removedItem = this.target.splice(i, 1)[0];
- this.source.push(removedItem);
- movedItems.push(removedItem);
- i--;
- }
- }
- this.onMoveToSource.emit({
- items: movedItems
- });
- this.onMoveAllToSource.emit({
- items: movedItems
- });
- this.selectedItemsTarget = [];
- }
- };
- PickList.prototype.isSelected = function (item, selectedItems) {
- return this.findIndexInSelection(item, selectedItems) != -1;
- };
- PickList.prototype.findIndexInSelection = function (item, selectedItems) {
- return this.findIndexInList(item, selectedItems);
- };
- PickList.prototype.findIndexInList = function (item, list) {
- var index = -1;
- if (list) {
- for (var i = 0; i < list.length; i++) {
- if (list[i] == item) {
- index = i;
- break;
- }
- }
- }
- return index;
- };
- PickList.prototype.onDragStart = function (event, index, listType) {
- event.target.blur();
- this.dragging = true;
- this.fromListType = listType;
- if (listType === this.SOURCE_LIST)
- this.draggedItemIndexSource = index;
- else
- this.draggedItemIndexTarget = index;
- };
- PickList.prototype.onDragOver = function (event, index, listType) {
- if (this.dragging) {
- if (listType == this.SOURCE_LIST) {
- if (this.draggedItemIndexSource !== index && this.draggedItemIndexSource + 1 !== index || (this.fromListType === this.TARGET_LIST)) {
- this.dragOverItemIndexSource = index;
- event.preventDefault();
- }
- }
- else {
- if (this.draggedItemIndexTarget !== index && this.draggedItemIndexTarget + 1 !== index || (this.fromListType === this.SOURCE_LIST)) {
- this.dragOverItemIndexTarget = index;
- event.preventDefault();
- }
- }
- this.onListItemDroppoint = true;
- }
- };
- PickList.prototype.onDragLeave = function (event, listType) {
- this.dragOverItemIndexSource = null;
- this.dragOverItemIndexTarget = null;
- this.onListItemDroppoint = false;
- };
- PickList.prototype.onDrop = function (event, index, listType) {
- if (this.onListItemDroppoint) {
- if (listType === this.SOURCE_LIST) {
- if (this.fromListType === this.TARGET_LIST) {
- this.insert(this.draggedItemIndexTarget, this.target, index, this.source, this.onMoveToSource);
- }
- else {
- objectutils_1.ObjectUtils.reorderArray(this.source, this.draggedItemIndexSource, (this.draggedItemIndexSource > index) ? index : (index === 0) ? 0 : index - 1);
- this.onSourceReorder.emit({ items: this.source[this.draggedItemIndexSource] });
- }
- this.dragOverItemIndexSource = null;
- }
- else {
- if (this.fromListType === this.SOURCE_LIST) {
- this.insert(this.draggedItemIndexSource, this.source, index, this.target, this.onMoveToTarget);
- }
- else {
- objectutils_1.ObjectUtils.reorderArray(this.target, this.draggedItemIndexTarget, (this.draggedItemIndexTarget > index) ? index : (index === 0) ? 0 : index - 1);
- this.onTargetReorder.emit({ items: this.target[this.draggedItemIndexTarget] });
- }
- this.dragOverItemIndexTarget = null;
- }
- this.listHighlightTarget = false;
- this.listHighlightSource = false;
- event.preventDefault();
- }
- };
- PickList.prototype.onDragEnd = function (event) {
- this.dragging = false;
- };
- PickList.prototype.onListDrop = function (event, listType) {
- if (!this.onListItemDroppoint) {
- if (listType === this.SOURCE_LIST) {
- if (this.fromListType === this.TARGET_LIST) {
- this.insert(this.draggedItemIndexTarget, this.target, null, this.source, this.onMoveToSource);
- }
- }
- else {
- if (this.fromListType === this.SOURCE_LIST) {
- this.insert(this.draggedItemIndexSource, this.source, null, this.target, this.onMoveToTarget);
- }
- }
- this.listHighlightTarget = false;
- this.listHighlightSource = false;
- event.preventDefault();
- }
- };
- PickList.prototype.insert = function (fromIndex, fromList, toIndex, toList, callback) {
- var elementtomove = fromList[fromIndex];
- if (toIndex === null)
- toList.push(fromList.splice(fromIndex, 1)[0]);
- else
- toList.splice(toIndex, 0, fromList.splice(fromIndex, 1)[0]);
- callback.emit({
- items: [elementtomove]
- });
- };
- PickList.prototype.onListMouseMove = function (event, listType) {
- if (this.dragging) {
- var moveListType = (listType == 0 ? this.listViewSourceChild : this.listViewTargetChild);
- var offsetY = moveListType.nativeElement.getBoundingClientRect().top + document.body.scrollTop;
- var bottomDiff = (offsetY + moveListType.nativeElement.clientHeight) - event.pageY;
- var topDiff = (event.pageY - offsetY);
- if (bottomDiff < 25 && bottomDiff > 0)
- moveListType.nativeElement.scrollTop += 15;
- else if (topDiff < 25 && topDiff > 0)
- moveListType.nativeElement.scrollTop -= 15;
- if (listType === this.SOURCE_LIST) {
- if (this.fromListType === this.TARGET_LIST)
- this.listHighlightSource = true;
- }
- else {
- if (this.fromListType === this.SOURCE_LIST)
- this.listHighlightTarget = true;
- }
- event.preventDefault();
- }
- };
- PickList.prototype.onListDragLeave = function () {
- this.listHighlightTarget = false;
- this.listHighlightSource = false;
- };
- PickList.prototype.resetFilter = function () {
- this.visibleOptionsSource = null;
- this.filterValueSource = null;
- this.visibleOptionsTarget = null;
- this.filterValueTarget = null;
- this.sourceFilterViewChild.nativeElement.value = '';
- this.targetFilterViewChild.nativeElement.value = '';
- };
- PickList.prototype.onItemKeydown = function (event, item, selectedItems, callback) {
- var listItem = event.currentTarget;
- switch (event.which) {
- //down
- case 40:
- var nextItem = this.findNextItem(listItem);
- if (nextItem) {
- nextItem.focus();
- }
- event.preventDefault();
- break;
- //up
- case 38:
- var prevItem = this.findPrevItem(listItem);
- if (prevItem) {
- prevItem.focus();
- }
- event.preventDefault();
- break;
- //enter
- case 13:
- this.onItemClick(event, item, selectedItems, callback);
- event.preventDefault();
- break;
- }
- };
- PickList.prototype.findNextItem = function (item) {
- var nextItem = item.nextElementSibling;
- if (nextItem)
- return !domhandler_1.DomHandler.hasClass(nextItem, 'ui-picklist-item') || domhandler_1.DomHandler.isHidden(nextItem) ? this.findNextItem(nextItem) : nextItem;
- else
- return null;
- };
- PickList.prototype.findPrevItem = function (item) {
- var prevItem = item.previousElementSibling;
- if (prevItem)
- return !domhandler_1.DomHandler.hasClass(prevItem, 'ui-picklist-item') || domhandler_1.DomHandler.isHidden(prevItem) ? this.findPrevItem(prevItem) : prevItem;
- else
- return null;
- };
- __decorate([
- core_1.Input(),
- __metadata("design:type", Array)
- ], PickList.prototype, "source", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Array)
- ], PickList.prototype, "target", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], PickList.prototype, "sourceHeader", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], PickList.prototype, "targetHeader", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], PickList.prototype, "responsive", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], PickList.prototype, "filterBy", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Function)
- ], PickList.prototype, "trackBy", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Function)
- ], PickList.prototype, "sourceTrackBy", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Function)
- ], PickList.prototype, "targetTrackBy", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], PickList.prototype, "showSourceFilter", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], PickList.prototype, "showTargetFilter", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], PickList.prototype, "metaKeySelection", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], PickList.prototype, "dragdrop", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Object)
- ], PickList.prototype, "style", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], PickList.prototype, "styleClass", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Object)
- ], PickList.prototype, "sourceStyle", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Object)
- ], PickList.prototype, "targetStyle", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], PickList.prototype, "showSourceControls", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], PickList.prototype, "showTargetControls", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], PickList.prototype, "sourceFilterPlaceholder", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], PickList.prototype, "targetFilterPlaceholder", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], PickList.prototype, "disabled", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], PickList.prototype, "ariaSourceFilterLabel", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], PickList.prototype, "ariaTargetFilterLabel", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], PickList.prototype, "filterMatchMode", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], PickList.prototype, "onMoveToSource", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], PickList.prototype, "onMoveAllToSource", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], PickList.prototype, "onMoveAllToTarget", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], PickList.prototype, "onMoveToTarget", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], PickList.prototype, "onSourceReorder", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], PickList.prototype, "onTargetReorder", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], PickList.prototype, "onSourceSelect", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], PickList.prototype, "onTargetSelect", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], PickList.prototype, "onSourceFilter", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], PickList.prototype, "onTargetFilter", void 0);
- __decorate([
- core_1.ViewChild('sourcelist', { static: false }),
- __metadata("design:type", core_1.ElementRef)
- ], PickList.prototype, "listViewSourceChild", void 0);
- __decorate([
- core_1.ViewChild('targetlist', { static: false }),
- __metadata("design:type", core_1.ElementRef)
- ], PickList.prototype, "listViewTargetChild", void 0);
- __decorate([
- core_1.ViewChild('sourceFilter', { static: false }),
- __metadata("design:type", core_1.ElementRef)
- ], PickList.prototype, "sourceFilterViewChild", void 0);
- __decorate([
- core_1.ViewChild('targetFilter', { static: false }),
- __metadata("design:type", core_1.ElementRef)
- ], PickList.prototype, "targetFilterViewChild", void 0);
- __decorate([
- core_1.ContentChildren(shared_1.PrimeTemplate),
- __metadata("design:type", core_1.QueryList)
- ], PickList.prototype, "templates", void 0);
- PickList = __decorate([
- core_1.Component({
- selector: 'p-pickList',
- template: "\n <div [class]=\"styleClass\" [ngStyle]=\"style\" [ngClass]=\"{'ui-picklist ui-widget ui-helper-clearfix': true,'ui-picklist-responsive': responsive}\">\n <div class=\"ui-picklist-source-controls ui-picklist-buttons\" *ngIf=\"showSourceControls\">\n <div class=\"ui-picklist-buttons-cell\">\n <button type=\"button\" pButton icon=\"pi pi-angle-up\" [disabled]=\"disabled\" (click)=\"moveUp(sourcelist,source,selectedItemsSource,onSourceReorder)\"></button>\n <button type=\"button\" pButton icon=\"pi pi-angle-double-up\" [disabled]=\"disabled\" (click)=\"moveTop(sourcelist,source,selectedItemsSource,onSourceReorder)\"></button>\n <button type=\"button\" pButton icon=\"pi pi-angle-down\" [disabled]=\"disabled\" (click)=\"moveDown(sourcelist,source,selectedItemsSource,onSourceReorder)\"></button>\n <button type=\"button\" pButton icon=\"pi pi-angle-double-down\" [disabled]=\"disabled\" (click)=\"moveBottom(sourcelist,source,selectedItemsSource,onSourceReorder)\"></button>\n </div>\n </div>\n <div class=\"ui-picklist-listwrapper ui-picklist-source-wrapper\" [ngClass]=\"{'ui-picklist-listwrapper-nocontrols':!showSourceControls}\">\n <div class=\"ui-picklist-caption ui-widget-header ui-corner-tl ui-corner-tr\" *ngIf=\"sourceHeader\">{{sourceHeader}}</div>\n <div class=\"ui-picklist-filter-container ui-widget-content\" *ngIf=\"filterBy && showSourceFilter !== false\">\n <input #sourceFilter type=\"text\" role=\"textbox\" (keyup)=\"onFilter($event,source,SOURCE_LIST)\" class=\"ui-picklist-filter ui-inputtext ui-widget ui-state-default ui-corner-all\" [disabled]=\"disabled\" [attr.placeholder]=\"sourceFilterPlaceholder\" [attr.aria-label]=\"ariaSourceFilterLabel\">\n <span class=\"ui-picklist-filter-icon pi pi-search\"></span>\n </div>\n <ul #sourcelist class=\"ui-widget-content ui-picklist-list ui-picklist-source ui-corner-bottom\" [ngClass]=\"{'ui-picklist-highlight': listHighlightSource}\" [ngStyle]=\"sourceStyle\" (dragover)=\"onListMouseMove($event,SOURCE_LIST)\" (dragleave)=\"onListDragLeave()\" (drop)=\"onListDrop($event, SOURCE_LIST)\">\n <ng-template ngFor let-item [ngForOf]=\"source\" [ngForTrackBy]=\"sourceTrackBy || trackBy\" let-i=\"index\" let-l=\"last\">\n <li class=\"ui-picklist-droppoint\" *ngIf=\"dragdrop\" (dragover)=\"onDragOver($event, i, SOURCE_LIST)\" (drop)=\"onDrop($event, i, SOURCE_LIST)\" (dragleave)=\"onDragLeave($event, SOURCE_LIST)\"\n [ngClass]=\"{'ui-picklist-droppoint-highlight': (i === dragOverItemIndexSource)}\" [style.display]=\"isItemVisible(item, SOURCE_LIST) ? 'block' : 'none'\"></li>\n <li [ngClass]=\"{'ui-picklist-item':true,'ui-state-highlight':isSelected(item,selectedItemsSource), 'ui-state-disabled': disabled}\"\n (click)=\"onItemClick($event,item,selectedItemsSource,onSourceSelect)\" (dblclick)=\"onSourceItemDblClick()\" (touchend)=\"onItemTouchEnd($event)\" (keydown)=\"onItemKeydown($event,item,selectedItemsSource,onSourceSelect)\"\n [style.display]=\"isItemVisible(item, SOURCE_LIST) ? 'block' : 'none'\" tabindex=\"0\"\n [draggable]=\"dragdrop\" (dragstart)=\"onDragStart($event, i, SOURCE_LIST)\" (dragend)=\"onDragEnd($event)\">\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: {$implicit: item, index: i}\"></ng-container>\n </li>\n <li class=\"ui-picklist-droppoint\" *ngIf=\"dragdrop&&l\" (dragover)=\"onDragOver($event, i + 1, SOURCE_LIST)\" (drop)=\"onDrop($event, i + 1, SOURCE_LIST)\" (dragleave)=\"onDragLeave($event, SOURCE_LIST)\"\n [ngClass]=\"{'ui-picklist-droppoint-highlight': (i + 1 === dragOverItemIndexSource)}\"></li>\n </ng-template>\n <ng-container *ngIf=\"(source == null || source.length === 0) && emptyMessageSourceTemplate\">\n <li class=\"ui-picklist-empty-message\">\n <ng-container *ngTemplateOutlet=\"emptyMessageSourceTemplate\"></ng-container>\n </li>\n </ng-container>\n </ul>\n </div>\n <div class=\"ui-picklist-buttons\">\n <div class=\"ui-picklist-buttons-cell\">\n <button type=\"button\" pButton icon=\"pi pi-angle-right\" [disabled]=\"disabled\" (click)=\"moveRight()\"></button>\n <button type=\"button\" pButton icon=\"pi pi-angle-double-right\" [disabled]=\"disabled\" (click)=\"moveAllRight()\"></button>\n <button type=\"button\" pButton icon=\"pi pi-angle-left\" [disabled]=\"disabled\" (click)=\"moveLeft()\"></button>\n <button type=\"button\" pButton icon=\"pi pi-angle-double-left\" [disabled]=\"disabled\" (click)=\"moveAllLeft()\"></button>\n </div>\n </div>\n <div class=\"ui-picklist-listwrapper ui-picklist-target-wrapper\" [ngClass]=\"{'ui-picklist-listwrapper-nocontrols':!showTargetControls}\">\n <div class=\"ui-picklist-caption ui-widget-header ui-corner-tl ui-corner-tr\" *ngIf=\"targetHeader\">{{targetHeader}}</div>\n <div class=\"ui-picklist-filter-container ui-widget-content\" *ngIf=\"filterBy && showTargetFilter !== false\">\n <input #targetFilter type=\"text\" role=\"textbox\" (keyup)=\"onFilter($event,target,TARGET_LIST)\" class=\"ui-picklist-filter ui-inputtext ui-widget ui-state-default ui-corner-all\" [disabled]=\"disabled\" [attr.placeholder]=\"targetFilterPlaceholder\" [attr.aria-label]=\"ariaTargetFilterLabel\">\n <span class=\"ui-picklist-filter-icon pi pi-search\"></span>\n </div>\n <ul #targetlist class=\"ui-widget-content ui-picklist-list ui-picklist-target ui-corner-bottom\" [ngClass]=\"{'ui-picklist-highlight': listHighlightTarget}\" [ngStyle]=\"targetStyle\" (dragover)=\"onListMouseMove($event,TARGET_LIST)\" (dragleave)=\"onListDragLeave()\" (drop)=\"onListDrop($event,TARGET_LIST)\">\n <ng-template ngFor let-item [ngForOf]=\"target\" [ngForTrackBy]=\"targetTrackBy || trackBy\" let-i=\"index\" let-l=\"last\">\n <li class=\"ui-picklist-droppoint\" *ngIf=\"dragdrop\" (dragover)=\"onDragOver($event, i, TARGET_LIST)\" (drop)=\"onDrop($event, i, TARGET_LIST)\" (dragleave)=\"onDragLeave($event, TARGET_LIST)\"\n [ngClass]=\"{'ui-picklist-droppoint-highlight': (i === dragOverItemIndexTarget)}\" [style.display]=\"isItemVisible(item, TARGET_LIST) ? 'block' : 'none'\"></li>\n <li [ngClass]=\"{'ui-picklist-item':true,'ui-state-highlight':isSelected(item,selectedItemsTarget), 'ui-state-disabled': disabled}\"\n (click)=\"onItemClick($event,item,selectedItemsTarget,onTargetSelect)\" (dblclick)=\"onTargetItemDblClick()\" (touchend)=\"onItemTouchEnd($event)\" (keydown)=\"onItemKeydown($event,item,selectedItemsTarget,onTargetSelect)\"\n [style.display]=\"isItemVisible(item, TARGET_LIST) ? 'block' : 'none'\" tabindex=\"0\"\n [draggable]=\"dragdrop\" (dragstart)=\"onDragStart($event, i, TARGET_LIST)\" (dragend)=\"onDragEnd($event)\">\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: {$implicit: item, index: i}\"></ng-container>\n </li>\n <li class=\"ui-picklist-droppoint\" *ngIf=\"dragdrop&&l\" (dragover)=\"onDragOver($event, i + 1, TARGET_LIST)\" (drop)=\"onDrop($event, i + 1, TARGET_LIST)\" (dragleave)=\"onDragLeave($event, TARGET_LIST)\"\n [ngClass]=\"{'ui-picklist-droppoint-highlight': (i + 1 === dragOverItemIndexTarget)}\"></li>\n </ng-template>\n <ng-container *ngIf=\"(target == null || target.length === 0) && emptyMessageTargetTemplate\">\n <li class=\"ui-picklist-empty-message\">\n <ng-container *ngTemplateOutlet=\"emptyMessageTargetTemplate\"></ng-container>\n </li>\n </ng-container>\n </ul>\n </div>\n <div class=\"ui-picklist-target-controls ui-picklist-buttons\" *ngIf=\"showTargetControls\">\n <div class=\"ui-picklist-buttons-cell\">\n <button type=\"button\" pButton icon=\"pi pi-angle-up\" [disabled]=\"disabled\" (click)=\"moveUp(targetlist,target,selectedItemsTarget,onTargetReorder)\"></button>\n <button type=\"button\" pButton icon=\"pi pi-angle-double-up\" [disabled]=\"disabled\" (click)=\"moveTop(targetlist,target,selectedItemsTarget,onTargetReorder)\"></button>\n <button type=\"button\" pButton icon=\"pi pi-angle-down\" [disabled]=\"disabled\" (click)=\"moveDown(targetlist,target,selectedItemsTarget,onTargetReorder)\"></button>\n <button type=\"button\" pButton icon=\"pi pi-angle-double-down\" [disabled]=\"disabled\" (click)=\"moveBottom(targetlist,target,selectedItemsTarget,onTargetReorder)\"></button>\n </div>\n </div>\n </div>\n "
- }),
- __metadata("design:paramtypes", [core_1.ElementRef])
- ], PickList);
- return PickList;
- }());
- exports.PickList = PickList;
- var PickListModule = /** @class */ (function () {
- function PickListModule() {
- }
- PickListModule = __decorate([
- core_1.NgModule({
- imports: [common_1.CommonModule, button_1.ButtonModule, shared_1.SharedModule],
- exports: [PickList, shared_1.SharedModule],
- declarations: [PickList]
- })
- ], PickListModule);
- return PickListModule;
- }());
- exports.PickListModule = PickListModule;
- //# sourceMappingURL=picklist.js.map
|