{"version":3,"file":"app-6a308ea8.9729664bca28a8e6916d.bundle.js","mappings":";;;;;;;;;;;;;;;;;;AAAA;AAEA;AACA;AAAA;AACA;AAAA;AAFA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaA;AACA;AAGA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAjIA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;;;;;;;;ACbA;AACA;AAEA;AAEA;AAAA;AAOA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAlFA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;;;;;;;;ACRA;AACA;AAEA;AAYA;AAAA;AAAA;AAAA;AAAA;AAAA;AALA;AACA;AAKA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAnFA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;ACRA;AACA;AACA;AAEA;AAOA;AAAA;AAIA;AAAA;AAEA;AAAA;AAEA;AAAA;AAoBA;AAAA;AAjCA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AAKA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAEA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AAGA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AA1YA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;ACxBA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACPA;AACA;AACA;AACA","sources":["webpack://www.zeusteam.com/./src/resources/data-grid/data-grid-pagination.js","webpack://www.zeusteam.com/./src/resources/data-grid/data-grid-select.js","webpack://www.zeusteam.com/./src/resources/data-grid/data-grid-sort.js","webpack://www.zeusteam.com/./src/resources/data-grid/data-grid.js","webpack://www.zeusteam.com/./src/resources/data-grid/index.js","webpack://www.zeusteam.com/./src/resources/data-grid/data-grid.scss","webpack://www.zeusteam.com/./src/resources/data-grid/data-grid-pagination.html"],"sourcesContent":["import { bindable, bindingMode } from 'aurelia-framework';\r\n\r\nexport class DataGridPaginationCustomElement {\r\n @bindable({ defaultBindingMode: bindingMode.twoWay }) currentPage;\r\n @bindable({ defaultBindingMode: bindingMode.twoWay }) pageSize;\r\n @bindable totalItems;\r\n @bindable hideSinglePage = false;\r\n @bindable paginationSize = 5;\r\n @bindable boundaryLinks = true;\r\n @bindable firstText = 'First';\r\n @bindable lastText = 'Last';\r\n @bindable directionLinks = true;\r\n @bindable previousText = '<';\r\n @bindable nextText = '>';\r\n\r\n totalPages = 1;\r\n displayPages = [];\r\n\r\n\r\n bind() {\r\n if (this.currentPage === undefined || this.currentPage === null || this.currentPage < 1) {\r\n this.currentPage = 1;\r\n }\r\n\r\n if (this.pageSize === undefined || this.pageSize === null || this.pageSize < 1) {\r\n this.pageSize = 5;\r\n }\r\n }\r\n\r\n totalItemsChanged() {\r\n this.currentPage = 1;\r\n this.calculatePages();\r\n }\r\n\r\n pageSizeChanged() {\r\n this.currentPage = 1;\r\n this.calculatePages();\r\n }\r\n\r\n currentPageChanged() {\r\n this.calculatePages();\r\n }\r\n\r\n calculatePages() {\r\n if (this.pageSize === 0 || !this.totalItems) {\r\n this.totalPages = 1;\r\n } else {\r\n this.totalPages = this.totalItems <= this.pageSize ? 1 : Math.ceil(this.totalItems / this.pageSize);\r\n }\r\n\r\n if (isNaN(this.paginationSize) || this.paginationSize <= 0) {\r\n this.displayAllPages();\r\n } else {\r\n this.limitVisiblePages();\r\n }\r\n }\r\n\r\n displayAllPages() {\r\n let displayPages = [];\r\n\r\n for (let i = 1; i <= this.totalPages; i++) {\r\n displayPages.push({\r\n title: i.toString(),\r\n value: i,\r\n });\r\n }\r\n this.displayPages = displayPages;\r\n }\r\n\r\n limitVisiblePages() {\r\n let displayPages = [];\r\n\r\n let totalTiers = Math.ceil(this.totalPages / this.paginationSize);\r\n\r\n let activeTier = Math.ceil(this.currentPage / this.paginationSize);\r\n\r\n let start = ((activeTier - 1) * this.paginationSize) + 1;\r\n let end = start + this.paginationSize;\r\n\r\n if (activeTier > 1) {\r\n displayPages.push({\r\n title: '...',\r\n value: start - 1,\r\n });\r\n }\r\n\r\n for (let i = start; i < end; i++) {\r\n if (i > this.totalPages) {\r\n break;\r\n }\r\n\r\n displayPages.push({\r\n title: i.toString(),\r\n value: i,\r\n });\r\n }\r\n\r\n if (activeTier < totalTiers) {\r\n displayPages.push({\r\n title: '...',\r\n value: end,\r\n });\r\n }\r\n\r\n this.displayPages = displayPages;\r\n }\r\n\r\n selectPage(page) {\r\n if (page < 1 || page > this.totalPages || page === this.currentPage) {\r\n return;\r\n }\r\n\r\n this.currentPage = page;\r\n }\r\n\r\n nextPage() {\r\n if (this.currentPage < this.totalPages) {\r\n this.currentPage++;\r\n }\r\n }\r\n\r\n previousPage() {\r\n if (this.currentPage > 1) {\r\n this.currentPage--;\r\n }\r\n }\r\n\r\n firstPage() {\r\n this.currentPage = 1;\r\n }\r\n\r\n lastPage() {\r\n this.currentPage = this.totalPages;\r\n }\r\n}\r\n","import { inject, bindable, bindingMode, BindingEngine } from 'aurelia-framework';\r\nimport { DataGridCustomAttribute } from './data-grid';\r\n\r\n@inject(DataGridCustomAttribute, Element, BindingEngine)\r\nexport class DataGridSelectCustomAttribute {\r\n @bindable({ defaultBindingMode: bindingMode.twoWay }) row;\r\n @bindable mode = 'single';\r\n @bindable selectedClass = 'dg-row-selected';\r\n @bindable custom = false;\r\n\r\n selectedSubscription;\r\n\r\n constructor(dataGrid, element, bindingEngine) {\r\n this.dataGrid = dataGrid;\r\n this.element = element;\r\n this.bindingEngine = bindingEngine;\r\n\r\n this.rowSelectedListener = event => {\r\n this.handleRowSelected(event);\r\n };\r\n }\r\n\r\n attached() {\r\n if (!this.custom) {\r\n this.element.style.cursor = 'pointer';\r\n this.element.addEventListener('click', this.rowSelectedListener);\r\n }\r\n\r\n this.selectedSubscription = this.bindingEngine.propertyObserver(this.row, '$isSelected').subscribe(() => this.isSelectedChanged());\r\n\r\n this.setClass();\r\n }\r\n\r\n detached() {\r\n if (!this.custom) {\r\n this.element.removeEventListener('click', this.rowSelectedListener);\r\n }\r\n\r\n this.selectedSubscription.dispose();\r\n }\r\n\r\n setClass() {\r\n if (this.row.$isSelected) {\r\n this.element.classList.add(this.selectedClass);\r\n } else {\r\n this.element.classList.remove(this.selectedClass);\r\n }\r\n }\r\n\r\n handleRowSelected(event) {\r\n this.row.$isSelected = this.row.$isSelected ? false : true;\r\n }\r\n\r\n dispatchSelectedEvent() {\r\n let selectedEvent;\r\n if (window.CustomEvent) {\r\n selectedEvent = new CustomEvent('select', {\r\n detail: { row: this.row },\r\n bubbles: true,\r\n });\r\n } else {\r\n selectedEvent = document.createEvent('CustomEvent');\r\n selectedEvent.initCustomEvent('select', true, true, {\r\n detail: { row: this.row },\r\n });\r\n }\r\n this.element.dispatchEvent(selectedEvent);\r\n }\r\n\r\n isSelectedChanged() {\r\n this.setClass();\r\n\r\n if (this.row.$isSelected) {\r\n if (this.mode === 'single') {\r\n this.deselectAll();\r\n }\r\n\r\n this.dispatchSelectedEvent();\r\n }\r\n }\r\n\r\n deselectAll() {\r\n this.dataGrid.data.forEach(item => {\r\n if (item !== this.row) {\r\n item.$isSelected = false;\r\n }\r\n });\r\n }\r\n}\r\n","import { inject, bindable } from 'aurelia-framework';\r\nimport { DataGridCustomAttribute } from './data-grid';\r\n\r\n@inject(DataGridCustomAttribute, Element)\r\nexport class DataGridSortCustomAttribute {\r\n @bindable key;\r\n @bindable custom;\r\n @bindable default;\r\n @bindable reverse = false;\r\n\r\n order = 0;\r\n orderClasses = ['dg-desc', 'dg-sortable', 'dg-asc'];\r\n\r\n ignoreEvent = false;\r\n\r\n constructor(dataGrid, element) {\r\n this.dataGrid = dataGrid;\r\n this.element = element;\r\n\r\n this.rowSelectedListener = () => {\r\n this.handleHeaderClicked();\r\n };\r\n\r\n this.sortChangedListener = () => {\r\n this.handleSortChanged();\r\n };\r\n }\r\n\r\n handleSortChanged() {\r\n if (!this.ignoreEvent) {\r\n this.order = 0;\r\n this.setClass();\r\n } else {\r\n this.ignoreEvent = false;\r\n }\r\n }\r\n\r\n attached() {\r\n if (this.key === null && this.custom === null) {\r\n throw new Error('Must provide a key or a custom sort function.');\r\n }\r\n\r\n this.element.style.cursor = 'pointer';\r\n this.element.classList.add('dg-sort');\r\n this.element.classList.add('sortable');\r\n\r\n this.element.addEventListener('click', this.rowSelectedListener);\r\n this.dataGrid.addSortChangedListener(this.sortChangedListener);\r\n\r\n this.handleDefaultSort();\r\n this.setClass();\r\n }\r\n\r\n detached() {\r\n this.element.removeEventListener('click', this.rowSelectedListener);\r\n this.dataGrid.removeSortChangedListener(this.sortChangedListener);\r\n }\r\n\r\n handleDefaultSort() {\r\n if (this.dataGrid.sortKey && this.dataGrid.sortKey === this.key) {\r\n // data grid sort overrides the default\r\n this.order = this.dataGrid.sortOrder;\r\n this.doSort();\r\n return;\r\n }\r\n\r\n if (this.default) {\r\n this.order = this.default === 'desc' ? -1 : 1;\r\n this.doSort();\r\n }\r\n }\r\n\r\n doSort() {\r\n this.ignoreEvent = true;\r\n const sortOrder = this.reverse ? this.order * -1 : this.order\r\n this.dataGrid.sortChanged(this.key, this.custom, sortOrder);\r\n }\r\n\r\n setClass() {\r\n this.orderClasses.forEach(next => this.element.classList.remove(next));\r\n this.element.classList.add(this.orderClasses[this.order + 1]);\r\n }\r\n\r\n handleHeaderClicked() {\r\n this.order = this.order === 0 || this.order === -1 ? this.order + 1 : -1;\r\n this.setClass();\r\n this.doSort();\r\n }\r\n}\r\n","import { inject, bindable, bindingMode, BindingEngine } from 'aurelia-framework';\r\nimport { EventAggregator } from 'aurelia-event-aggregator';\r\nimport moment from 'moment';\r\n\r\n@inject(BindingEngine, Element, EventAggregator)\r\nexport class DataGridCustomAttribute {\r\n element;\r\n _ea;\r\n\r\n @bindable id;\r\n @bindable data;\r\n @bindable({ defaultBindingMode: bindingMode.twoWay }) displayData;\r\n\r\n @bindable filters;\r\n\r\n @bindable({ defaultBindingMode: bindingMode.twoWay }) currentPage;\r\n @bindable pageSize;\r\n @bindable({ defaultBindingMode: bindingMode.twoWay }) totalItems;\r\n\r\n @bindable({ defaultBindingMode: bindingMode.twoWay }) api;\r\n\r\n @bindable filterEventKey;\r\n @bindable orderedIdsEventKey;\r\n\r\n @bindable reapply;\r\n\r\n isAttached = false;\r\n\r\n _optionsStorageKey;\r\n sortKey;\r\n sortOrder;\r\n sortChangedListeners = [];\r\n beforePagination = [];\r\n\r\n dataObserver;\r\n filterObservers = [];\r\n\r\n _localStorage;\r\n\r\n constructor(bindingEngine, element, ea) {\r\n this.element = element;\r\n this.bindingEngine = bindingEngine;\r\n this._localStorage = window.localStorage;\r\n this._ea = ea;\r\n }\r\n\r\n bind() {\r\n if (Array.isArray(this.data)) {\r\n this.dataObserver = this.bindingEngine.collectionObserver(this.data).subscribe(() => this.applyPlugins());\r\n }\r\n this._setFilterObservers();\r\n\r\n this.api = {\r\n revealItem: (item) => this.revealItem(item),\r\n };\r\n\r\n this._loadOptions();\r\n }\r\n\r\n _setFilterObservers() {\r\n if (Array.isArray(this.filters)) {\r\n for (let filter of this.filters) {\r\n let observer = this.bindingEngine.propertyObserver(filter, 'value').subscribe(() => this.filterChanged());\r\n this.filterObservers.push(observer);\r\n }\r\n }\r\n }\r\n\r\n filtersChanged() {\r\n if (!this.filters) return;\r\n this._clearFilterBindings();\r\n this._setFilterObservers();\r\n }\r\n\r\n attached() {\r\n this.isAttached = true;\r\n this.applyPlugins();\r\n }\r\n\r\n detached() {\r\n if (this.dataObserver) {\r\n this.dataObserver.dispose();\r\n }\r\n this._clearFilterBindings();\r\n }\r\n\r\n _clearFilterBindings() {\r\n for (let observer of this.filterObservers) {\r\n observer.dispose();\r\n }\r\n }\r\n\r\n filterChanged() {\r\n if (this.hasPagination()) {\r\n this.currentPage = 1;\r\n }\r\n this.applyPlugins();\r\n }\r\n\r\n currentPageChanged() {\r\n this.applyPlugins();\r\n }\r\n\r\n pageSizeChanged() {\r\n this.applyPlugins();\r\n }\r\n\r\n reapplyChanged() {\r\n if (!this.reapply) return;\r\n this.applyPlugins();\r\n }\r\n\r\n /**\r\n * Copies the data into the display data\r\n */\r\n getDataCopy() {\r\n return [].concat(this.data);\r\n }\r\n\r\n /**\r\n * Applies all the plugins to the display data\r\n */\r\n applyPlugins() {\r\n if (!this.isAttached || !this.data) {\r\n return;\r\n }\r\n\r\n let localData = this.getDataCopy();\r\n\r\n let filtered = false;\r\n if (this.hasFilter()) {\r\n localData = this.doFilter(localData);\r\n filtered = true;\r\n }\r\n\r\n if ((this.sortKey || this.customSort) && this.sortOrder !== 0) {\r\n this.doSort(localData);\r\n this.element.dispatchEvent(new CustomEvent('sorted', { bubbles: true, detail: { sortKey: this.sortKey, sortOrder: this.sortOrder } }));\r\n } else {\r\n this._saveOptions();\r\n }\r\n\r\n this.totalItems = localData.length;\r\n\r\n this.element.dispatchEvent(new CustomEvent('changed', { bubbles: true, detail: { filteredData: localData } }));\r\n\r\n // Fire the event before setting pagination, copy the ids\r\n if (this.orderedIdsEventKey && localData) {\r\n this._ea.publish(this.orderedIdsEventKey, localData.map(x => x.id));\r\n }\r\n\r\n if (this.hasPagination()) {\r\n this.beforePagination = [].concat(localData);\r\n localData = this.doPaginate(localData);\r\n }\r\n\r\n this.displayData = localData;\r\n if (filtered && this.filterEventKey) this._ea.publish(this.filterEventKey);\r\n }\r\n\r\n doFilter(toFilter) {\r\n let filteredData = [];\r\n\r\n for (let item of toFilter) {\r\n let passed = true;\r\n\r\n for (let filter of this.filters) {\r\n if (!this.passFilter(item, filter)) {\r\n passed = false;\r\n break;\r\n }\r\n }\r\n\r\n if (passed) {\r\n filteredData.push(item);\r\n }\r\n }\r\n\r\n return filteredData;\r\n }\r\n\r\n passFilter(item, filter) {\r\n if (typeof filter.custom === 'function' && !filter.custom(filter.value, item)) {\r\n return false;\r\n }\r\n\r\n if (filter.value === null || filter.value === undefined || !Array.isArray(filter.keys)) {\r\n return true;\r\n }\r\n\r\n for (let key of filter.keys) {\r\n let value = this.getPropertyValue(item, key);\r\n if (value !== null && value !== undefined) {\r\n value = value.toString().toLowerCase();\r\n\r\n if (this.matchesFilterValue(key, value, filter.value)) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n matchesFilterValue(key, value, filterValue) {\r\n // If the filter value is an array, the values are or'ed. There's a match if any of the filterValues are found in the value\r\n let convertedValue = value;\r\n let filterValues = [];\r\n if (Array.isArray(filterValue)) {\r\n for (let filter of filterValue) {\r\n filterValues.push(filter);\r\n }\r\n } else if (key.indexOf('Date') >= 0) {\r\n filterValues.push(filterValue);\r\n convertedValue = moment(value.toUpperCase(), 'YYYY-MM-DDThh:mm:ss').format('l');\r\n } else {\r\n filterValues.push(filterValue);\r\n }\r\n\r\n for (let filter of filterValues) {\r\n if (convertedValue.indexOf(filter.toString().toLowerCase()) > -1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n doSort(toSort) {\r\n this._saveOptions();\r\n\r\n toSort.sort((a, b) => {\r\n if (typeof this.customSort === 'function') {\r\n return this.customSort(a, b, this.sortOrder);\r\n }\r\n\r\n let val1;\r\n let val2;\r\n\r\n if (typeof this.sortKey === 'function') {\r\n val1 = this.sortKey(a, this.sortOrder);\r\n val2 = this.sortKey(b, this.sortOrder);\r\n } else if (this.sortKey === 'fl-name') {\r\n val1 = `${this.getPropertyValue(a, 'firstName')} ${this.getPropertyValue(a, 'lastName')}`;\r\n val2 = `${this.getPropertyValue(b, 'lastName')} ${this.getPropertyValue(b, 'lastName')}`;\r\n } else {\r\n val1 = this.getPropertyValue(a, this.sortKey);\r\n val2 = this.getPropertyValue(b, this.sortKey);\r\n }\r\n\r\n if (val1 === null) val1 = '';\r\n if (val2 === null) val2 = '';\r\n\r\n if (this.isNumeric(val1) && this.isNumeric(val2)) {\r\n return (val1 - val2) * this.sortOrder;\r\n }\r\n\r\n if ((moment(val1).isValid() && moment(val2).isValid())\r\n || (!val1 && moment(val2).isValid())\r\n || (!val2 && moment(val1).isValid())) {\r\n if (this.sortOrder > 0) {\r\n if (!val1) return -1;\r\n if (!val2) return 1;\r\n return moment(val1).isBefore(moment(val2)) ? -1 : 1;\r\n }\r\n if (!val1) return 1;\r\n if (!val2) return -1;\r\n return moment(val2).isBefore(moment(val1)) ? -1 : 1;\r\n }\r\n\r\n let str1 = val1 ? val1.toString() : '';\r\n let str2 = val2 ? val2.toString() : '';\r\n\r\n return str1.localeCompare(str2) * this.sortOrder;\r\n });\r\n }\r\n\r\n /**\r\n * Retrieves the value in the object specified by the key path\r\n * @param object the object\r\n * @param keyPath the path\r\n * @returns {*} the value\r\n */\r\n getPropertyValue(object, keyPath) {\r\n keyPath = keyPath.replace(/\\[(\\w+)\\]/g, '.$1'); // convert indexes to properties\r\n keyPath = keyPath.replace(/^\\./, ''); // strip a leading dot\r\n let a = keyPath.split('.');\r\n for (let i = 0, n = a.length; i < n; ++i) {\r\n let k = a[i];\r\n if (object && k in object) {\r\n object = object[k];\r\n } else {\r\n return;\r\n }\r\n }\r\n return object;\r\n }\r\n\r\n isNumeric(toCheck) {\r\n return !isNaN(parseFloat(toCheck)) && isFinite(toCheck);\r\n }\r\n\r\n doPaginate(toPaginate) {\r\n if (toPaginate.length <= this.pageSize) {\r\n return toPaginate;\r\n }\r\n\r\n let start = (this.currentPage - 1) * this.pageSize;\r\n\r\n let end = start + this.pageSize;\r\n\r\n return toPaginate.slice(start, end);\r\n }\r\n\r\n hasFilter() {\r\n return Array.isArray(this.filters) && this.filters.length > 0;\r\n }\r\n\r\n hasPagination() {\r\n return this.currentPage > 0 && this.pageSize > 0;\r\n }\r\n\r\n dataChanged() {\r\n if (this.dataObserver) {\r\n this.dataObserver.dispose();\r\n }\r\n if (!this.data) return;\r\n\r\n this.dataObserver = this.bindingEngine.collectionObserver(this.data)\r\n .subscribe(() => this.applyPlugins());\r\n\r\n this.applyPlugins();\r\n }\r\n\r\n sortChanged(key, custom, order) {\r\n this.sortKey = key;\r\n this.customSort = custom;\r\n this.sortOrder = order;\r\n this.applyPlugins();\r\n this.emitSortChanged();\r\n }\r\n\r\n addSortChangedListener(callback) {\r\n this.sortChangedListeners.push(callback);\r\n }\r\n\r\n removeSortChangedListener(callback) {\r\n this.removeListener(callback, this.sortChangedListeners);\r\n }\r\n\r\n emitSortChanged() {\r\n for (let listener of this.sortChangedListeners) {\r\n listener();\r\n }\r\n }\r\n\r\n removeListener(callback, listeners) {\r\n let index = listeners.indexOf(callback);\r\n\r\n if (index > -1) {\r\n listeners.splice(index, 1);\r\n }\r\n }\r\n\r\n revealItem(item) {\r\n if (!this.hasPagination()) {\r\n return true;\r\n }\r\n\r\n let index = this.beforePagination.indexOf(item);\r\n\r\n if (index === -1) {\r\n return false;\r\n }\r\n\r\n this.currentPage = Math.ceil((index + 1) / this.pageSize);\r\n\r\n return true;\r\n }\r\n\r\n _loadOptions() {\r\n try {\r\n if (!this.id) return;\r\n this._optionsStorageKey = `fqa-data-grid-${this.id}`;\r\n const options = JSON.parse(this._localStorage.getItem(this._optionsStorageKey) || '{}');\r\n if (!this.sortKey) this.sortKey = options.sortKey || undefined;\r\n if (!this.sortOrder) this.sortOrder = options.sortOrder || undefined;\r\n } catch (err) {\r\n // do no harm, just won't load\r\n }\r\n }\r\n\r\n _saveOptions() {\r\n try {\r\n if (!this._optionsStorageKey) return;\r\n // Do not save if sort order is 0 (falsey) - means no sort. Only a sort if 1 or -1\r\n const options = {\r\n sortKey: this.sortOrder ? this.sortKey || '' : '',\r\n sortOrder: this.sortOrder ? this.sortOrder || '' : '',\r\n };\r\n this._localStorage.setItem(this._optionsStorageKey, JSON.stringify(options));\r\n } catch (err) {\r\n // do no harm, just won't save\r\n }\r\n }\r\n}\r\n","import { PLATFORM } from 'aurelia-pal';\r\nimport { DataGridCustomAttribute } from './data-grid';\r\nimport { DataGridPaginationCustomElement } from './data-grid-pagination';\r\nimport { DataGridSelectCustomAttribute } from './data-grid-select';\r\nimport { DataGridSortCustomAttribute } from './data-grid-sort';\r\n\r\n/*\r\nhttps://tochoromero.github.io/aurelia-table/\r\n*/\r\n\r\nexport function configure(config) {\r\n config.globalResources(PLATFORM.moduleName('./data-grid'));\r\n config.globalResources(PLATFORM.moduleName('./data-grid-pagination'));\r\n config.globalResources(PLATFORM.moduleName('./data-grid-select'));\r\n config.globalResources(PLATFORM.moduleName('./data-grid-sort'));\r\n}\r\n\r\nexport {\r\n DataGridCustomAttribute,\r\n DataGridPaginationCustomElement,\r\n DataGridSelectCustomAttribute,\r\n DataGridSortCustomAttribute,\r\n};\r\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../node_modules/css-loader/dist/runtime/sourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \".zeus-sorter {\\n display: flex;\\n justify-content: center;\\n align-items: center;\\n position: relative;\\n margin-bottom: var(--zeus-space);\\n}\\n.zeus-sorter > * {\\n position: relative;\\n padding: var(--zeus-space-xs);\\n padding-right: var(--zeus-space-lg);\\n margin-left: var(--zeus-space-sm);\\n margin-right: var(--zeus-space-sm);\\n border-radius: var(--zeus-space-xs);\\n}\\n\\n.dg-sort::after {\\n font-family: \\\"FontAwesome\\\";\\n font-weight: 900;\\n padding-left: var(--zeus-margin-xs);\\n display: inline-flex;\\n position: absolute;\\n top: 0;\\n height: 100%;\\n align-items: center;\\n}\\n\\n.dg-sortable::after {\\n content: \\\"\\\\f0dc\\\";\\n color: rgba(0, 0, 0, 0.3);\\n}\\n\\n.dg-asc::after {\\n content: \\\"\\\\f0de\\\";\\n color: black;\\n}\\n\\n.dg-desc::after {\\n content: \\\"\\\\f0dd\\\";\\n color: black;\\n}\\n\\n.data-grid-pagination a:hover {\\n cursor: pointer;\\n}\\n\\nul.custom-pagination {\\n display: inline-block;\\n padding: 0;\\n margin: 0 !important;\\n align-items: center;\\n}\\n\\nul.custom-pagination li {\\n display: inline-flex;\\n align-items: center;\\n}\\n\\nul.custom-pagination li a {\\n color: black;\\n float: left;\\n padding: 8px 16px;\\n text-decoration: none;\\n transition: background-color 0.3s;\\n}\\n\\nul.custom-pagination li.active a {\\n background-color: var(--kt-primary);\\n color: var(--kt-primary-inverse);\\n border-radius: var(--zeus-space-xs);\\n}\\n\\nul.custom-pagination li a:hover:not(.active):not(.disabled) {\\n background-color: #ddd;\\n}\\n\\nul.custom-pagination li a.disabled {\\n color: darkgrey;\\n}\\n\\n.zeus-pagination {\\n padding-top: var(--zeus-margin);\\n display: flex;\\n justify-content: space-between;\\n align-items: center;\\n flex-direction: column;\\n}\\n@media (min-width: 768px) {\\n .zeus-pagination {\\n flex-direction: row;\\n }\\n}\\n.zeus-pagination a,\\n.zeus-pagination label,\\n.zeus-pagination select {\\n font-size: 0.8em;\\n font-weight: normal;\\n}\\n.zeus-pagination .form-group label {\\n margin-bottom: 0;\\n}\\n\\n.zeus-tabled-list .zeus-pagination > * {\\n margin-right: var(--zeus-space);\\n}\\n.zeus-tabled-list .zeus-pagination .custom-pagination {\\n display: flex;\\n}\\n.zeus-tabled-list .zeus-pagination .custom-pagination li a {\\n color: inherit;\\n float: left;\\n padding: 8px 12px;\\n text-decoration: none;\\n transition: background-color 0.3s;\\n border-radius: var(--zeus-space-xs);\\n}\\n.zeus-tabled-list .zeus-pagination .custom-pagination li.active a {\\n color: white;\\n}\\n.zeus-tabled-list .zeus-pagination select {\\n border-radius: 12px;\\n background-color: rgb(240, 240, 240);\\n border-color: rgb(220, 220, 220);\\n}\\n\\n[data-theme=dark] .dg-sortable::after {\\n content: \\\"\\\\f0dc\\\";\\n color: rgba(255, 255, 255, 0.3);\\n}\\n[data-theme=dark] .dg-asc::after {\\n content: \\\"\\\\f0de\\\";\\n color: white;\\n}\\n[data-theme=dark] .dg-desc::after {\\n content: \\\"\\\\f0dd\\\";\\n color: white;\\n}\", \"\",{\"version\":3,\"sources\":[\"webpack://./src/resources/data-grid/data-grid.scss\"],\"names\":[],\"mappings\":\"AAGA;EACI,aAAA;EACA,uBAAA;EACA,mBAAA;EACA,kBAAA;EACA,gCAAA;AAFJ;AAII;EACI,kBAAA;EACA,6BAAA;EACA,mCAAA;EACA,iCAAA;EACA,kCAAA;EACA,mCAAA;AAFR;;AAKA;EACI,0BAAA;EACA,gBAAA;EACA,mCAAA;EACA,oBAAA;EACA,kBAAA;EACA,MAAA;EACA,YAAA;EACA,mBAAA;AAFJ;;AAKA;EACI,gBAAA;EACA,yBAAA;AAFJ;;AAKA;EACI,gBAAA;EACA,YAAA;AAFJ;;AAKA;EACI,gBAAA;EACA,YAAA;AAFJ;;AAMI;EACI,eAAA;AAHR;;AAQA;EACI,qBAAA;EACA,UAAA;EACA,oBAAA;EACA,mBAAA;AALJ;;AAQA;EACI,oBAAA;EACA,mBAAA;AALJ;;AAQA;EACI,YAAA;EACA,WAAA;EACA,iBAAA;EACA,qBAAA;EACA,iCAAA;AALJ;;AAQA;EACI,mCAAA;EACA,gCAAA;EACA,mCAAA;AALJ;;AAQA;EAA6D,sBAAA;AAJ7D;;AAMA;EACI,eAAA;AAHJ;;AAMA;EACI,+BAAA;EACA,aAAA;EACA,8BAAA;EACA,mBAAA;EACA,sBAAA;AAHJ;AAKI;EAPJ;IAQQ,mBAAA;EAFN;AACF;AAII;;;EAGI,gBAAA;EACA,mBAAA;AAFR;AAMQ;EACI,gBAAA;AAJZ;;AAYQ;EACI,+BAAA;AATZ;AAYQ;EACI,aAAA;AAVZ;AAYY;EACI,cAAA;EACA,WAAA;EACA,iBAAA;EACA,qBAAA;EACA,iCAAA;EACA,mCAAA;AAVhB;AAaY;EACI,YAAA;AAXhB;AAeQ;EACI,mBAAA;EACA,oCAAA;EACA,gCAAA;AAbZ;;AAmBI;EACI,gBAAA;EACA,+BAAA;AAhBR;AAkBI;EACI,gBAAA;EACA,YAAA;AAhBR;AAmBI;EACI,gBAAA;EACA,YAAA;AAjBR\",\"sourcesContent\":[\"@import \\\"./../../styles/responsive.scss\\\";\\r\\n@import \\\"./../../styles/components/mixins/_theme-mode.scss\\\";\\r\\n\\r\\n.zeus-sorter {\\r\\n display: flex;\\r\\n justify-content: center;\\r\\n align-items: center;\\r\\n position: relative;\\r\\n margin-bottom: var(--zeus-space);\\r\\n\\r\\n > * {\\r\\n position: relative;\\r\\n padding: var(--zeus-space-xs);\\r\\n padding-right: var(--zeus-space-lg);\\r\\n margin-left: var(--zeus-space-sm);\\r\\n margin-right: var(--zeus-space-sm);\\r\\n border-radius: var(--zeus-space-xs);\\r\\n }\\r\\n}\\r\\n.dg-sort::after {\\r\\n font-family: 'FontAwesome';\\r\\n font-weight: 900;\\r\\n padding-left: var(--zeus-margin-xs);\\r\\n display: inline-flex;\\r\\n position: absolute;\\r\\n top: 0;\\r\\n height: 100%;\\r\\n align-items: center;\\r\\n}\\r\\n\\r\\n.dg-sortable::after {\\r\\n content: \\\"\\\\f0dc\\\";\\r\\n color: rgba(0, 0, 0, 0.3);\\r\\n}\\r\\n\\r\\n.dg-asc::after {\\r\\n content: \\\"\\\\f0de\\\";\\r\\n color: black;\\r\\n}\\r\\n\\r\\n.dg-desc::after {\\r\\n content: \\\"\\\\f0dd\\\";\\r\\n color: black;\\r\\n}\\r\\n\\r\\n.data-grid-pagination {\\r\\n a:hover {\\r\\n cursor: pointer;\\r\\n }\\r\\n}\\r\\n\\r\\n\\r\\nul.custom-pagination {\\r\\n display: inline-block;\\r\\n padding: 0;\\r\\n margin: 0 !important;\\r\\n align-items: center;\\r\\n}\\r\\n \\r\\nul.custom-pagination li {\\r\\n display: inline-flex;\\r\\n align-items: center;\\r\\n}\\r\\n\\r\\nul.custom-pagination li a {\\r\\n color: black;\\r\\n float: left;\\r\\n padding: 8px 16px;\\r\\n text-decoration: none;\\r\\n transition: background-color .3s;\\r\\n}\\r\\n\\r\\nul.custom-pagination li.active a {\\r\\n background-color: var(--kt-primary);\\r\\n color: var(--kt-primary-inverse);\\r\\n border-radius: var(--zeus-space-xs);\\r\\n}\\r\\n\\r\\nul.custom-pagination li a:hover:not(.active):not(.disabled) {background-color: #ddd;}\\r\\n\\r\\nul.custom-pagination li a.disabled {\\r\\n color: darkgrey;\\r\\n}\\r\\n\\r\\n.zeus-pagination {\\r\\n padding-top: var(--zeus-margin);\\r\\n display: flex;\\r\\n justify-content: space-between;\\r\\n align-items: center;\\r\\n flex-direction: column;\\r\\n\\r\\n @media (min-width: $zeus-screen-sm-min) {\\r\\n flex-direction: row;\\r\\n }\\r\\n\\r\\n a,\\r\\n label,\\r\\n select {\\r\\n font-size: .8em;\\r\\n font-weight: normal;\\r\\n }\\r\\n\\r\\n .form-group {\\r\\n label {\\r\\n margin-bottom: 0;\\r\\n }\\r\\n }\\r\\n}\\r\\n\\r\\n.zeus-tabled-list {\\r\\n .zeus-pagination {\\r\\n\\r\\n > * {\\r\\n margin-right: var(--zeus-space);\\r\\n }\\r\\n\\r\\n .custom-pagination {\\r\\n display: flex;\\r\\n\\r\\n li a {\\r\\n color: inherit;\\r\\n float: left;\\r\\n padding: 8px 12px;\\r\\n text-decoration: none;\\r\\n transition: background-color .3s;\\r\\n border-radius: var(--zeus-space-xs);\\r\\n }\\r\\n\\r\\n li.active a {\\r\\n color: white;\\r\\n }\\r\\n }\\r\\n\\r\\n select {\\r\\n border-radius: 12px;\\r\\n background-color: rgb(240, 240, 240);\\r\\n border-color: rgb(220, 220, 220);\\r\\n }\\r\\n }\\r\\n}\\r\\n\\r\\n@include theme-dark() {\\r\\n .dg-sortable::after {\\r\\n content: \\\"\\\\f0dc\\\";\\r\\n color: rgba(255, 255, 255, 0.3);\\r\\n }\\r\\n .dg-asc::after {\\r\\n content: \\\"\\\\f0de\\\";\\r\\n color: white;\\r\\n }\\r\\n \\r\\n .dg-desc::after {\\r\\n content: \\\"\\\\f0dd\\\";\\r\\n color: white;\\r\\n } \\r\\n}\\r\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Module\nvar code = \"\\r\\n\";\n// Exports\nexport default code;"],"names":[],"sourceRoot":""}