@angular-generic-table/core
Version:
A generic table component for Angular
1 lines • 56.9 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/platform-browser"),require("rxjs/ReplaySubject"),require("rxjs/Subject"),require("tether"),require("rxjs/Observable"),require("@angular/common"),require("@angular/forms")):"function"==typeof define&&define.amd?define("@angular-generic-table/core",["exports","@angular/core","@angular/platform-browser","rxjs/ReplaySubject","rxjs/Subject","tether","rxjs/Observable","@angular/common","@angular/forms"],e):e((t["angular-generic-table"]=t["angular-generic-table"]||{},t["angular-generic-table"].core={}),t.ng.core,t.ng.platformBrowser,t.rxjs.ReplaySubject,t.rxjs.Subject,t.Tether,t.rxjs.Observable,t.ng.common,t.ng.forms)}(this,function(t,o,e,n,r,i,s,a,l){"use strict";var g=function(){function t(){this.redrawEvent=new o.EventEmitter,this.toggleRowEvent=new o.EventEmitter}return t.prototype.$hide=function(){this.toggleRowEvent.emit(this.row)},t.prototype.$redraw=function(t){this.redrawEvent.emit(this.row)},t.prototype.$rowClick=function(t,e){this.gtEvent.emit({name:"gt-row-clicked",value:{row:t,event:e}})},t}(),c=function(){function t(){this.redrawEvent=new o.EventEmitter,this.toggleRowEvent=new o.EventEmitter}return t.prototype.newInstance=function(t){t.row=this.row,t.columnWidth=this.columnWidth,t.gtSettings=this.gtSettings,t.gtFields=this.gtFields,t.gtOptions=this.gtOptions,t.gtInfo=this.gtInfo,t.data="function"==typeof this.data?this.data(this.row):this.data,t.redrawEvent.subscribe(this.redrawEvent),t.toggleRowEvent.subscribe(this.toggleRowEvent),t.gtEvent=this.gtEvent},t.decorators=[{type:o.Component,args:[{selector:"gt-expanding-row",template:'\n <div gtComponentAnchor\n [ctor]="type" (instance)="newInstance($event)"></div>'}]}],t.propDecorators={type:[{type:o.Input}],row:[{type:o.Input}],columnWidth:[{type:o.Input}],gtSettings:[{type:o.Input}],gtFields:[{type:o.Input}],gtOptions:[{type:o.Input}],gtInfo:[{type:o.Input}],data:[{type:o.Input}],redrawEvent:[{type:o.Output}],toggleRowEvent:[{type:o.Output}],gtEvent:[{type:o.Input}]},t}(),p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};var d=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t};function u(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,i=n.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(o=i.next()).done;)s.push(o.value)}catch(a){r={error:a}}finally{try{o&&!o.done&&(n=i["return"])&&n.call(i)}finally{if(r)throw r.error}}return s}function h(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(u(arguments[e]));return t}var f=function(){function t(){}return t.prototype.transform=function(t,e,n,o){for(var r=0;r<t.length;r++)t[r].$$gtRowId||(t[r].$$gtRowId=e?t[r][e]:n?n*o+r+"_"+Math.random().toString(36).substr(2,16):r+"_"+Math.random().toString(36).substr(2,16)),t[r].$$gtInitialRowIndex||(t[r].$$gtInitialRowIndex=r);return t},t.decorators=[{type:o.Pipe,args:[{name:"gtMeta"}]}],t}(),m=function(){function t(t,e){var n=this;this.renderer=t,this.gtMetaPipe=e,this.columnWidth={},this.sortOrder=[],this.metaInfo={},this.selectedRows=[],this.openRows=[],this._gtSettings=[],this._gtFields=[],this.gtDefaultTexts={loading:"Loading...",noData:"No data",noMatchingData:"No data matching results found",noVisibleColumnsHeading:"No visible columns",noVisibleColumns:"Please select at least one column to be visible.",tableInfo:"Showing #recordFrom to #recordTo of #recordsAfterSearch entries.",tableInfoAfterSearch:"Showing #recordFrom to #recordTo of #recordsAfterSearch entries (filtered from a total of #recordsAll entries).",csvDownload:"download",sortLabel:"Sort:",paginateNext:"Next page",paginatePrevious:"Previous page",inlineEditEdited:"Press enter to save"},this.gtTexts=this.gtDefaultTexts,this.gtEvent=new o.EventEmitter,this.gtDefaultOptions={csvDelimiter:";",stack:!1,lazyLoad:!1,cache:!1,debounceTime:200,highlightSearch:!1,rowSelection:!1,rowSelectionAllowMultiple:!0,rowExpandAllowMultiple:!0,numberOfRows:10,reportColumnWidth:!1,allowUnsorted:!0,mutateData:!0},this._gtOptions=this.gtDefaultOptions,this.store=[],this.loading=!0,this.debounceTimer=null,this.lazyAllSelected=!1,this.gtInfo={pageCurrent:1,pageTotal:0,recordFrom:0,recordTo:0,recordLength:this.gtOptions.numberOfRows,recordsAll:0,recordsAfterFilter:0,recordsAfterSearch:0},this.refreshPipe=!1,this.refreshTotals=!1,this.refreshSorting=!1,this.refreshFilter=!1,this.refreshPageArray=!1,this.editedRows={},this.data={exportData:[]},this.gtSort=function(t,e){this.inlineEditCancel();for(var n=0;n<this._gtSettings.length;n++)if(this._gtSettings[n].objectKey===t){if(this._gtSettings[n].sort&&-1!==this._gtSettings[n].sort.indexOf("disable"))return;"undefined"==typeof this._gtSettings[n].sort&&(this._gtSettings[n].sort="enable")}var o=e.metaKey||e.ctrlKey,r=this.sortOrder.slice(0),i=-1,s=-1,a=-1;for(n=0;n<r.length;n++){-1!==r[n].indexOf(t)&&(s=-1===(i=this.sortOrder.indexOf(t))?this.sortOrder.indexOf("-"+t):i,a=Math.max(i,s))}if(o)switch("$$gtInitialRowIndex"===this.sortOrder[this.sortOrder.length-1]&&this.sortOrder.pop(),a){case-1:this.sortOrder.push(t);break;default:-1!==i?this.sortOrder[a]="-"+t:1<this.sortOrder.length?o?this.sortOrder[a]=t:this.sortOrder.splice(a,1):1===this.sortOrder.length&&(this.sortOrder[a]=t)}else switch(a){case-1:this.sortOrder=[t];break;default:this.sortOrder=-1!==i?["-"+t]:o||!this.gtOptions.allowUnsorted?[t]:[]}for(n=0;n<this._gtSettings.length;n++)if(this._gtSettings[n].objectKey===t){switch(this._gtSettings[n].sort){case"asc":this._gtSettings[n].sort="desc";break;case"desc":this._gtSettings[n].sort=1===this.sortOrder.length&&r.length<2||o||!this.gtOptions.allowUnsorted?"asc":"enable";break;case"enable":this._gtSettings[n].sort="asc"}this._gtSettings[n].sortOrder="enable"===this._gtSettings[n].sort?this._gtSettings.length-1:-1===this.sortOrder.indexOf(t)?this.sortOrder.indexOf("-"+t):this.sortOrder.indexOf(t)}else this._gtSettings[n].sort&&-1===this._gtSettings[n].sort.indexOf("disable")&&-1===this.sortOrder.indexOf(this._gtSettings[n].objectKey)&&-1===this.sortOrder.indexOf("-"+this._gtSettings[n].objectKey)&&(this._gtSettings[n].sort="enable",this._gtSettings[n].sortOrder=this._gtSettings.length-1);this.refreshSorting=!this.refreshSorting,this.refreshPageArray=!this.refreshPageArray,this.sortOrder.push("$$gtInitialRowIndex"),this.gtEvent.emit({name:"gt-sorting-applied",value:this.sortOrder})},this.changeRowLength=function(t,e){var n=isNaN(parseInt(t,10))?0:parseInt(t,10),o=1;if(!n&&this.gtData&&(n=this.gtData.length),!0!==e&&!0!==this._gtOptions.lazyLoad){var r=this.gtInfo.recordLength*(this.gtInfo.pageCurrent-1),i=this._gtData.indexOf(this._gtData[r])+1;o=Math.ceil(i/n)}this.gtInfo.recordLength=n,this.gtInfo.pageCurrent=o,this._gtOptions.lazyLoad&&(this._gtData[0]=this.loadingContent(n),this.store=[]),this.gtEvent.emit({name:"gt-row-length-changed",value:n})},this.redraw=function(t){this.refreshSorting=!this.refreshSorting,this.refreshPageArray=!this.refreshPageArray,this.refreshPipe=!this.refreshPipe},this.nextPage=function(){var t=this.gtInfo.pageCurrent===this.gtInfo.pageTotal?this.gtInfo.pageTotal:this.gtInfo.pageCurrent+1;this.goToPage(t)},this.previousPage=function(){var t=1===this.gtInfo.pageCurrent?1:this.gtInfo.pageCurrent-1;this.goToPage(t)},this.getData=function(){this.gtEvent.emit({name:"gt-page-changed-lazy",value:{pageCurrent:this.gtInfo.pageCurrent,recordLength:this.gtInfo.recordLength}})},this.goToPage=function(t){var e=this,n=this.gtInfo.pageCurrent;this.gtInfo.pageCurrent=t,this.inlineEditCancel(),this._gtOptions.lazyLoad&&(!1!==this._gtOptions.cache&&0!==this._gtData[this.gtInfo.pageCurrent-1].length||(this._gtData[this.gtInfo.pageCurrent-1]=this.loadingContent(this.gtInfo.recordLength),this.loading=!0),this._gtData[this.gtInfo.pageCurrent-1][0][this.loadingProperty]===this.gtTexts.loading&&(clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(function(){e.getData()},this._gtOptions.debounceTime))),n!==t&&this.gtEvent.emit({name:"gt-page-changed",value:{pageCurrent:this.gtInfo.pageCurrent,pagePrevious:n,recordLength:this.gtInfo.recordLength}})},this.getSortOrder=function(t,e){return t.sortOrder<e.sortOrder?-1:t.sortOrder>e.sortOrder||"undefined"==typeof t.sortOrder?1:0},this.getColumnOrder=function(t,e){return t.columnOrder===undefined?-1:t.columnOrder<e.columnOrder?-1:t.columnOrder>e.columnOrder?1:0},this.cloneDeep=function(t){return JSON.parse(JSON.stringify(t))},this.getProperty=function(t,e){for(var n=0;n<t.length;n++)if(t[n].objectKey===e)return t[n]},this.restructureSorting=function(){var t=[];if(this._gtSettings){this._gtSettings.sort(this.getSortOrder);for(var e=0;e<this._gtSettings.length;e++){var n=this._gtSettings[e];"asc"===n.sort?t.push(n.objectKey):"desc"===n.sort&&t.push("-"+n.objectKey)}0===t.length&&t.push("$$gtRowId")}0===this.sortOrder.length&&(this.sortOrder=t)},this.extend=function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t},this.gtEvent.subscribe(function(t){"gt-info"===t.name&&n.updateRecordRange(),"gt-row-updated"===t.name&&n.updateTotals()})}return Object.defineProperty(t.prototype,"gtRowComponent",{get:function(){return this._gtRowComponent},set:function(t){console.warn("GtRowComponent has been deprecated and support will be removed in a future release, see https://github.com/hjalmers/angular-generic-table/issues/34"),this._gtRowComponent=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasEdits",{get:function(){return 0<Object.keys(this.editedRows).length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"gtOptions",{get:function(){return this._gtOptions},set:function(t){this._gtOptions=t,this.gtOptions.numberOfRows&&this.gtInfo.recordLength!==this.gtOptions.numberOfRows&&(this.gtInfo.recordLength=this.gtOptions.numberOfRows,this.redraw()),this._gtOptions=this.extend(this.gtDefaultOptions,this._gtOptions)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"gtTotals",{get:function(){return this._gtTotals},set:function(t){this._gtTotals=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"gtFields",{get:function(){return this._gtFields},set:function(t){this._gtFields=t;var e=this._gtFields.map(function(t){return t}).filter(function(t){return t.classNames});0<e.length&&console.warn('Field setting "classNames" have been deprecated in favor for "columnClass" and will be removed in the future, please update field settings for column with object key: '+e[0].objectKey)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"gtSettings",{get:function(){return this._gtSettings},set:function(t){this._gtSettings=t;for(var e=0;e<this._gtSettings.length;e++)this._gtSettings[e].sortEnabled=!1!==this._gtSettings[e].sortEnabled&&(this._gtSettings[e].sortEnabled=!(this._gtSettings[e].sort&&-1!==this._gtSettings[e].sort.indexOf("disable"))),"undefined"==typeof this._gtSettings[e].sort&&(this._gtSettings[e].sort="enable"),"undefined"==typeof this._gtSettings[e].columnOrder&&!1!==this._gtSettings[e].enabled&&(this._gtSettings[e].columnOrder=this._gtSettings[e-1]?this._gtSettings[e-1].columnOrder+1:0),"undefined"==typeof this._gtSettings[e].lockSettings&&(this._gtSettings[e].lockSettings=!1===this._gtSettings[e].enabled||!1);this.restructureSorting()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"gtData",{get:function(){return this._gtData},set:function(t){var n=this,e=this._gtOptions.mutateData?h(t):this.cloneDeep(t);if(this.gtOptions.lazyLoad&&this.gtInfo){if(this.gtMetaPipe.transform(e,this.gtOptions.rowIndex,this.gtInfo.pageCurrent-1,this.gtInfo.recordLength),this.lazyAllSelected){var o=this.selectedRows.map(function(t){return t.$$gtRowId});e.map(function(t){-1===o.indexOf(t.$$gtRowId)&&n.selectedRows.push(t)}),this._updateMetaInfo(this.selectedRows,"isSelected",!0)}}else this.gtMetaPipe.transform(e,this.gtOptions.rowIndex);this.gtOptions.rowSelectionInitialState&&e.map(function(t){("function"==typeof n.gtOptions.rowSelectionInitialState?n.gtOptions.rowSelectionInitialState(t):n.gtOptions.rowSelectionInitialState)&&("undefined"==typeof n.metaInfo[t.$$gtRowId]?n.metaInfo[t.$$gtRowId]={isSelected:!0}:n.metaInfo[t.$$gtRowId].isSelected=!0,n.selectedRows.push(t))}),this.gtOptions.rowExpandInitialState&&this.gtOptions.rowExpandInitialComponent&&e.map(function(t){var e="function"==typeof n.gtOptions.rowExpandInitialState?n.gtOptions.rowExpandInitialState(t):n.gtOptions.rowExpandInitialState;n.expandedRow=n.gtOptions.rowExpandInitialComponent,e&&("undefined"==typeof n.metaInfo[t.$$gtRowId]?n.metaInfo[t.$$gtRowId]={isOpen:!0}:n.metaInfo[t.$$gtRowId].isOpen=!0)}),this._gtData=e},enumerable:!0,configurable:!0}),t.prototype.updateRecordRange=function(){this.gtInfo.recordFrom=0===this.gtInfo.recordsAfterSearch?0:(this.gtInfo.pageCurrent-1)*this.gtInfo.recordLength+1,this.gtInfo.recordTo=this.gtInfo.recordsAfterSearch<this.gtInfo.pageCurrent*this.gtInfo.recordLength?this.gtInfo.recordsAfterSearch:this.gtInfo.pageCurrent*this.gtInfo.recordLength},t.prototype.updateTotals=function(){this.refreshTotals=!this.refreshTotals},t.prototype.getRowState=function(t){return"undefined"==typeof this.metaInfo[t.$$gtRowId]?null:this.metaInfo[t.$$gtRowId]},t.prototype.expandAllRows=function(t){this.expandedRow=t,this._toggleAllRowProperty("isOpen",!0)},t.prototype.collapseAllRows=function(){this._toggleAllRowProperty("isOpen",!1)},t.prototype.selectAllRows=function(){this._toggleAllRowProperty("isSelected",!0)},t.prototype.deselectAllRows=function(){this._toggleAllRowProperty("isSelected",!1)},t.prototype.toggleAllRows=function(){this._gtOptions.lazyLoad?this.lazyAllSelected&&0!==this.selectedRows.length?(this.deselectAllRows(),this.lazyAllSelected=!1):(this.selectAllRows(),this.lazyAllSelected=!0):this.selectedRows.length!==this.gtData.length?this.selectAllRows():this.deselectAllRows()},t.prototype.toggleCollapse=function(t,e){e&&(this.expandedRow=e),this._toggleRowProperty(t,"isOpen")},t.prototype.toggleSelect=function(t){this._toggleRowProperty(t,"isSelected")},t.prototype.rowClick=function(t,e){this.gtEvent.emit({name:"gt-row-clicked",value:{row:t,event:e}})},t.prototype.updateRow=function(t,e){this._toggleRowProperty(t,"isUpdated",e)},t.prototype.removeRow=function(t){this.isRowSelected(t)&&this.toggleSelect(t);var e=this._gtData.indexOf(t);this._gtData.splice(e,1)},t.prototype.isRowSelected=function(t){return this.metaInfo[t.$$gtRowId]&&this.metaInfo[t.$$gtRowId].isSelected},t.prototype._updateMetaInfo=function(t,e,n,o){for(var r=0;r<t.length;r++)this.metaInfo[t[r].$$gtRowId]||(this.metaInfo[t[r].$$gtRowId]={}),o&&t[r].$$gtRowId===o.$$gtRowId||(this.metaInfo[t[r].$$gtRowId][e]=n)},t.prototype._pushLazyRows=function(t,e){for(var n=t.map(function(t){return t.$$gtRowId}),o=0;o<e.length;o++)-1===n.indexOf(e[o].$$gtRowId)&&t.push(e[o]);return t},t.prototype._toggleAllRowProperty=function(t,e){var n,o;switch(t){case"isOpen":if(!1===this._gtOptions.rowExpandAllowMultiple)return void console.log('feature disabled: enable by setting "rowExpandAllowMultiple = true"');e?(n="expand-all",this.openRows=this._gtOptions.lazyLoad?this._pushLazyRows(this.openRows,this._gtData[this.gtInfo.pageCurrent-1].slice()):this._gtData.slice(),this._updateMetaInfo(this.openRows,t,e)):(n="collapse-all",this._updateMetaInfo(this.openRows,t,e),this.openRows=[]),o={expandedRows:this.openRows,changedRow:"all"};break;case"isSelected":if(!1===this._gtOptions.rowSelectionAllowMultiple)return void console.log('feature disabled: enable by setting "rowSelectionAllowMultiple = true"');e?(n="select-all",this.selectedRows=this._gtOptions.lazyLoad?this._pushLazyRows(this.selectedRows,this._gtData[this.gtInfo.pageCurrent-1].slice()):this._gtData.slice(),this._updateMetaInfo(this.selectedRows,t,e)):(n="deselect-all",this._updateMetaInfo(this.selectedRows,t,e),this.selectedRows=[]),o={selectedRows:this.selectedRows,changedRow:"all"}}this.gtEvent.emit({name:"gt-row-"+n,value:o})},t.prototype._toggleRowProperty=function(t,e,n){var o,r;if("undefined"!=typeof t.$$gtRowId){switch(this.metaInfo[t.$$gtRowId]||(this.metaInfo[t.$$gtRowId]={}),e){case"isOpen":var i=this.metaInfo[t.$$gtRowId][e];if(!1===this._gtOptions.rowExpandAllowMultiple&&(this._updateMetaInfo(this.openRows,e,!1,t),this.openRows=[]),i){o="collapse";for(var s=0;s<this.openRows.length;s++)if(this.openRows[s].$$gtRowId===t.$$gtRowId){this.openRows.splice(s,1);break}}else o="expand",this.openRows.push(t);r={expandedRows:this.openRows,changedRow:t};break;case"isSelected":var a=this.metaInfo[t.$$gtRowId][e];if(!1===this._gtOptions.rowSelectionAllowMultiple&&(this._updateMetaInfo(this.selectedRows,e,!1,t),this.selectedRows=[]),a){this.gtOptions.lazyLoad&&this.lazyAllSelected&&(this.lazyAllSelected=!1),o="deselect";for(s=0;s<this.selectedRows.length;s++)if(this.selectedRows[s].$$gtRowId===t.$$gtRowId){this.selectedRows.splice(s,1);break}}else o="select",this.selectedRows.push(t);r={selectedRows:this.selectedRows,changedRow:t};break;case"isUpdated":o="updated";var l=n;"undefined"==typeof this.metaInfo[t.$$gtRowId][e]?this.metaInfo[t.$$gtRowId][e]={originalValue:l,oldValue:l,newValue:t}:(this.metaInfo[t.$$gtRowId][e].oldValue=l,this.metaInfo[t.$$gtRowId][e].newValue=t),r=this.metaInfo[t.$$gtRowId][e],this.redraw(),this.inlineEditCancel(t)}this.gtEvent.emit({name:"gt-row-"+o,value:r}),"isUpdated"!==e&&(this.metaInfo[t.$$gtRowId][e]=!this.metaInfo[t.$$gtRowId][e])}},t.prototype.gtUpdateColumn=function(t,e,n){this._editRow(e,n)},t.prototype.gtDropdownSelect=function(t,e){var n=d({},t);t[e.objectKey]=e.renderValue,this.updateRow(t,n)},t.prototype._editRow=function(t,e){var n=e.objectKey;(e.edited=t[e.objectKey]!==e.renderValue,this.editedRows[t.$$gtRowId]||(this.editedRows[t.$$gtRowId]={changes:{},row:t}),e.edited)?this.editedRows[t.$$gtRowId].changes[n]=e:(delete this.editedRows[t.$$gtRowId].changes[n],0===Object.keys(this.editedRows[t.$$gtRowId].changes).length&&delete this.editedRows[t.$$gtRowId]);this.globalInlineEditListener||this._listenForKeydownEvent()},t.prototype._listenForKeydownEvent=function(){var e=this;this.globalInlineEditListener=this.renderer.listen("document","keydown",function(t){switch(t.key){case"Enter":e.inlineEditUpdate();break;case"Escape":e.inlineEditCancel()}})},t.prototype.inlineEditUpdate=function(){var r=this;Object.keys(this.editedRows).map(function(t){var n=r.editedRows[t].row,o=r.editedRows[t].changes;Object.keys(o).map(function(t){var e=d({},n);n[t]=o[t].renderValue,r.updateRow(n,e),o[t].edited=!1})}),this.editedRows={},this._stopListeningForKeydownEvent()},t.prototype.inlineEditCancel=function(t){var o=this;if(t)return delete this.editedRows[t.$$gtRowId],void this._stopListeningForKeydownEvent();Object.keys(this.editedRows).map(function(t){var e=o.editedRows[t].row,n=o.editedRows[t].changes;Object.keys(n).map(function(t){n[t].renderValue=e[t],n[t].edited=!1})}),this.editedRows={},this._stopListeningForKeydownEvent()},t.prototype._stopListeningForKeydownEvent=function(){this.globalInlineEditListener&&(this.globalInlineEditListener(),this.globalInlineEditListener=null)},t.prototype.gtApplyFilter=function(t){this.gtInfo.filter=t,this.goToPage(1),this.updateTotals()},t.prototype.gtClearFilter=function(){this.gtInfo.filter=!1,this.updateTotals()},t.prototype.gtSearch=function(t){this.gtInfo.searchTerms=t,this.goToPage(1),this.updateTotals()},t.prototype.gtAdd=function(t){return this.gtData=h(this.gtData,t),h(this.gtData)},t.prototype.gtDelete=function(t,e,n){if(void 0===n&&(n="first"),"first"===n)for(var o=0;o<this.gtData.length&&(this.gtData[o][t]!==e||(this.isRowSelected(this.gtData[o])&&this.toggleSelect(this.gtData[o]),this.gtData.splice(o,1),this.gtData=h(this.gtData),"first"!==n));o++);else for(o=this.gtData.length;0<o;o--)this.gtData[o-1][t]===e&&(this.isRowSelected(this.gtData[o-1])&&this.toggleSelect(this.gtData[o-1]),this.gtData.splice(o-1,1),this.gtData=h(this.gtData));return h(this.gtData)},t.prototype.createStore=function(t,e){for(var n=Math.ceil(t/e),o=[],r=0;r<n;r++)o[r]=[];return o},t.prototype.loadingContent=function(t){var e={$$loading:!0},n=0;this._gtSettings.sort(this.getColumnOrder);for(var o=0;o<this._gtSettings.length;o++){var r=this._gtSettings[o];!1!==r.visible&&!1!==r.enabled?(0===n?(e[r.objectKey]=this.gtTexts.loading,this.loadingProperty=r.objectKey):e[r.objectKey]="",n++):e[r.objectKey]=""}var i=[];for(o=0;o<t;o++)i.push(e);return i},t.prototype.exportCSV=function(t,e){var r=this;void 0===e&&(e=!1);for(var n=this.data.exportData,i="",o="\ufeff",s=0;s<this._gtSettings.length;s++)if(!1!==this._gtSettings[s]["export"]){var a=this.getProperty(this._gtFields,this._gtSettings[s].objectKey),l=a.exportHeader?a.exportHeader:a.name;i+=this.escapeCSVDelimiter(l),i+=this.getProperty(this._gtFields,this._gtSettings[s].objectKey).name,s<this._gtSettings.length-1&&(i+=this._gtOptions.csvDelimiter)}n.forEach(function(t){i+="\n";for(var e=0;e<r._gtSettings.length;e++)if(!1!==r._gtSettings[e]["export"]){var n=r.getProperty(r._gtFields,r._gtSettings[e].objectKey),o=n["export"]&&"function"==typeof n["export"]?n["export"](t):n.value&&"function"==typeof n.value?n.value(t):t[r._gtSettings[e].objectKey];i+=r.escapeCSVDelimiter(o),e<r._gtSettings.length-1&&(i+=r._gtOptions.csvDelimiter)}});var g=new Blob([(e?o:"")+i],{type:"text/csv;charset=utf-8"});if(window.navigator.msSaveOrOpenBlob)navigator.msSaveOrOpenBlob(g,t?t+".csv":this.gtTexts.csvDownload+".csv");else{var c=document.createElement("a");c.style.display="none",document.body.appendChild(c),c.download!==undefined?(c.setAttribute("href","data:text/csv;charset=utf-8,"+encodeURIComponent((e?o:"")+i)),c.setAttribute("download",t?t+".csv":this.gtTexts.csvDownload+".csv"),document.body.appendChild(c),c.click()):(i="data:text/csv;charset=utf-8,"+(e?o:"")+i,window.open(encodeURIComponent(i))),document.body.removeChild(c)}this.gtEvent.emit({name:"gt-exported-csv",value:t||this.gtTexts.csvDownload+".csv"})},t.prototype.escapeCSVDelimiter=function(t){return"string"==typeof t&&-1!==t.indexOf(this._gtOptions.csvDelimiter)?'"'+t+'"':t},t.prototype.ngOnInit=function(){this.gtOptions.numberOfRows||this.changeRowLength(this.gtOptions.numberOfRows),this.restructureSorting()},t.prototype.ngOnChanges=function(t){if(t.gtTexts&&(this.gtTexts=this.extend(this.gtDefaultTexts,this.gtTexts)),this.gtOptions.lazyLoad&&this.gtInfo){this.gtInfo.pageTotal=Math.ceil(this.gtInfo.recordsAfterSearch/this.gtInfo.recordLength);var e=this.gtInfo.pageCurrent-1;0!==this.store.length&&this.store[0].length===this.gtInfo.recordLength||(this.store=this.createStore(this.gtInfo.recordsAfterSearch,this.gtInfo.recordLength)),this.store[e]=this.gtData,this.gtInfo.visibleRecords=h(this.gtData),this._gtData=this.store,this.loading=!1,this.updateRecordRange(),this.gtEvent.emit({name:"gt-info",value:this.gtInfo})}else this._gtData&&0<=this._gtData.length&&t.gtData&&t.gtData.previousValue?this.loading=!1:t.gtData&&t.gtData.firstChange&&this._gtData&&0<this._gtData.length&&(this.loading=!1)},t.prototype.trackByFn=function(t,e){return e.$$gtRowId},t.prototype.trackByColumnFn=function(t,e){return e.objectKey},t.prototype.ngOnDestroy=function(){this._stopListeningForKeydownEvent()},t.decorators=[{type:o.Component,args:[{selector:"generic-table",template:'<table class="table" ngClass="{{gtClasses}} {{gtOptions.stack ? \'table-stacked\':\'\'}}"\n *ngIf="gtFields && gtSettings && (gtFields | gtVisible:gtSettings:refreshPipe).length > 0">\n <thead>\n <tr>\n <th class="gt-sort-label" *ngIf="gtOptions.stack">{{gtTexts.sortLabel}}</th>\n <th *ngFor="let column of gtSettings | gtVisible:gtSettings:refreshPipe"\n ngClass="{{column.objectKey +\'-column\' | dashCase}} {{gtFields | gtProperty:column.objectKey:\'classNames\'}} {{column.sortEnabled ? \'sort-\'+column.sort:\'\'}} {{column.sortEnabled && column.sortOrder >= 0 ? \'sort-order-\'+column.sortOrder:\'\'}} {{ gtFields | gtColumnClass:column }}"\n (click)="column.sortEnabled ? gtSort(column.objectKey,$event):\'\';">\n <span *ngIf="!(gtFields | gtProperty:column.objectKey:\'header\')">{{gtFields | gtProperty:column.objectKey:\'name\'}}</span>\n <gt-custom-component-factory *ngIf="(gtFields | gtProperty:column.objectKey:\'header\')"\n [type]="(gtFields | gtProperty:column.objectKey:\'header\')?.type"\n [injector]="(gtFields | gtProperty:column.objectKey:\'header\')?.injector"\n [column]="gtFields | gtProperty:column.objectKey:\'name\'"></gt-custom-component-factory>\n <gt-checkbox *ngIf="(gtFields | gtProperty:column.objectKey:\'columnComponent\')?.type === \'checkbox\'" [checked]="(gtOptions.lazyLoad ? lazyAllSelected:selectedRows.length === gtData.length)" (changed)="toggleAllRows()"></gt-checkbox>\n </th>\n </tr>\n </thead>\n <ng-template\n [ngIf]="gtTotals && (gtOptions.lazyLoad === false ? (gtData | gtFilter:gtInfo.filter:gtInfo:refreshFilter:gtData.length | gtSearch:gtInfo.searchTerms:gtInfo:gtSettings:gtFields:gtData.length).length > 0 : gtData.length > 0)">\n <thead class="gt-totals">\n <tr *ngFor="let total of gtTotals | gtTotalsPosition">\n <td *ngFor="let column of gtSettings | gtVisible:gtSettings:refreshPipe;let i = index;"\n ngClass="{{column.objectKey +\'-totals-column\' | dashCase}} {{gtFields | gtProperty:column.objectKey:\'classNames\'}} {{ gtFields | gtColumnClass:column }}">\n <span *ngIf="i === 0" class="float-left">{{total.name}}</span><span\n [innerHTML]="total.fields[column.objectKey] | gtTotals:(total.update === false || gtOptions.lazyLoad === true) ? gtData:(gtData | gtFilter:gtInfo.filter:gtInfo:refreshFilter:gtData.length | gtSearch:gtInfo.searchTerms:gtInfo:gtSettings:gtFields:gtData.length):column.objectKey:refreshTotals"></span>\n </td>\n </tr>\n </thead>\n <tfoot class="gt-totals">\n <tr *ngFor="let total of gtTotals | gtTotalsPosition:\'footer\'">\n <td *ngFor="let column of gtSettings | gtVisible:gtSettings:refreshPipe;let i = index;"\n ngClass="{{column.objectKey +\'-totals-column\' | dashCase}} {{gtFields | gtProperty:column.objectKey:\'classNames\'}} {{ gtFields | gtColumnClass:column }}">\n <span *ngIf="i === 0" class="float-left">{{total.name}}</span><span\n [innerHTML]="total.fields[column.objectKey] | gtTotals:(total.update === false || gtOptions.lazyLoad === true) ? gtData:(gtData | gtFilter:gtInfo.filter:gtInfo:refreshFilter:gtData.length | gtSearch:gtInfo.searchTerms:gtInfo:gtSettings:gtFields:gtData.length):column.objectKey:refreshTotals"></span>\n </td>\n </tr>\n </tfoot>\n </ng-template>\n <tbody *ngIf="gtData && gtInfo">\n <ng-template class="table-rows" ngFor let-row let-last="last" [ngForTrackBy]="trackByFn"\n [ngForOf]="gtOptions.lazyLoad && gtInfo ? (gtData[gtInfo.pageCurrent-1]) : (gtData | gtFilter:gtInfo.filter:gtInfo:refreshFilter:gtData.length | gtSearch:gtInfo.searchTerms:gtInfo:gtSettings:gtFields:gtData.length | gtOrderBy:sortOrder:gtFields:refreshSorting:gtData.length | gtChunk:gtInfo:gtInfo.recordLength:gtInfo.pageCurrent:refreshPageArray:gtData.length:gtEvent:data | gtRowClass:gtFields)">\n <tr [ngClass]="{\'row-selected\':metaInfo[row.$$gtRowId]?.isSelected, \'row-open\':metaInfo[row.$$gtRowId]?.isOpen, \'row-loading\':loading, \'row-expandable\':gtRowComponent}"\n class="{{row.$$gtRowClass}}"\n (click)="gtOptions.rowSelection ? toggleSelect(row):rowClick(row, $event)">\n <td *ngFor="let column of row | gtRender:gtSettings:gtFields:refreshPipe:loading:gtOptions.highlightSearch:gtInfo.searchTerms;trackBy:trackByColumnFn"\n ngClass="{{column.objectKey +\'-column\' | dashCase}} {{gtFields | gtProperty:column.objectKey:\'classNames\'}} {{(gtFields | gtProperty:column.objectKey:\'inlineEdit\') ? \'gt-inline-edit\':\'\'}} {{column.edited ? \'gt-edited\':\'\'}} {{ gtFields | gtColumnClass:column:row }}">\n <span class="gt-row-label"\n *ngIf="gtOptions.stack">{{(gtFields | gtProperty:column.objectKey:\'stackedHeading\') ? (gtFields | gtProperty:column.objectKey:\'stackedHeading\') : (gtFields | gtProperty:column.objectKey:\'name\')}}</span>\n <gt-custom-component-factory *ngIf="column.columnComponent && column.columnComponent.type !== \'checkbox\'" class="gt-row-content"\n [type]="column.columnComponent.type"\n [injector]="column.columnComponent.injector" [row]="row"\n [column]="column" (redrawEvent)="redraw($event)"\n [searchTerms]="gtInfo.searchTerms" (searchEvent)="redraw($event)"\n (click)="column.click ? column.click(row,column,$event):\'\';column.expand ? toggleCollapse(row, column.expand):\'\'"></gt-custom-component-factory>\n <span *ngIf="!column.columnComponent && (!(gtFields | gtProperty:column.objectKey:\'inlineEdit\') || ((gtFields | gtProperty:column.objectKey:\'inlineEdit\')?.active | gtIsObservable) && !((gtFields | gtProperty:column.objectKey:\'inlineEdit\')?.active | async) || (!((gtFields | gtProperty:column.objectKey:\'inlineEdit\')?.active | gtIsObservable) && !((gtFields | gtProperty:column.objectKey:\'inlineEdit\')?.active | gtIsEditable:row:refreshPipe)))"\n class="gt-row-content" [innerHTML]="column.renderValue"\n (click)="column.click ? column.click(row,column,$event):\'\';column.expand ? toggleCollapse(row, column.expand):\'\'"></span>\n <ng-template\n [ngIf]="!column.columnComponent && (((gtFields | gtProperty:column.objectKey:\'inlineEdit\')?.active | gtIsObservable) && ((gtFields | gtProperty:column.objectKey:\'inlineEdit\')?.active | async) || ((gtFields | gtProperty:column.objectKey:\'inlineEdit\')?.active | gtIsEditable:row:refreshPipe))">\n <ng-template [ngIf]="([true,\'email\',\'number\',\'password\', \'text\'].indexOf((gtFields | gtProperty:column.objectKey:\'inlineEdit\').type) !== -1) || !(gtFields | gtProperty:column.objectKey:\'inlineEdit\').type">\n <input class="inline-edit" [attr.type]="!(gtFields | gtProperty:column.objectKey:\'inlineEdit\').type ? \'text\' : !((gtFields | gtProperty:column.objectKey:\'inlineEdit\').type | gtIsObservable) ? (gtFields | gtProperty:column.objectKey:\'inlineEdit\').type:(gtFields | gtProperty:column.objectKey:\'inlineEdit\').type | async" [(ngModel)]="column.renderValue"\n (input)="gtUpdateColumn($event,row, column)">\n <span class="gt-inline-edit-notice">{{gtTexts.inlineEditEdited}}</span>\n </ng-template>\n <gt-dropdown\n *ngIf="(((gtFields | gtProperty:column.objectKey:\'inlineEdit\').type) && ((gtFields | gtProperty:column.objectKey:\'inlineEdit\').type).length > 0) || ((gtFields | gtProperty:column.objectKey:\'inlineEdit\').type | gtIsObservable)"\n [options]="!((gtFields | gtProperty:column.objectKey:\'inlineEdit\').type | gtIsObservable) ? (gtFields | gtProperty:column.objectKey:\'inlineEdit\').type : (gtFields | gtProperty:column.objectKey:\'inlineEdit\').type | async"\n [id]="\'_\' + row.$$gtRowId + \'_\' + column.objectKey"\n [(selected)]="column.renderValue" (selectedChange)="gtDropdownSelect(row, column)">Add\n inline editing module\n </gt-dropdown>\n </ng-template>\n <ng-template [ngIf]="!column.columnComponent && !((gtFields | gtProperty:column.objectKey:\'inlineEdit\')?.active) ">\n <ng-template\n [ngIf]="[true,\'email\',\'number\',\'password\'].indexOf(gtFields | gtProperty:column.objectKey:\'inlineEdit\') !== -1">\n <input class="inline-edit" [attr.type]="(gtFields | gtProperty:column.objectKey:\'inlineEdit\') === true ? \'text\':(gtFields | gtProperty:column.objectKey:\'inlineEdit\')" [(ngModel)]="column.renderValue"\n (input)="gtUpdateColumn($event,row, column)">\n <span class="gt-inline-edit-notice">{{gtTexts.inlineEditEdited}}</span>\n </ng-template>\n <gt-dropdown\n *ngIf="(gtFields | gtProperty:column.objectKey:\'inlineEdit\') && [true,\'email\',\'number\',\'password\'].indexOf(gtFields | gtProperty:column.objectKey:\'inlineEdit\') === -1"\n [options]="gtFields | gtProperty:column.objectKey:\'inlineEdit\'"\n [id]="\'_\' + row.$$gtRowId + \'_\' + column.objectKey"\n [(selected)]="column.renderValue" (selectedChange)="gtDropdownSelect(row, column)">Add\n inline editing module\n </gt-dropdown>\n </ng-template>\n <gt-checkbox *ngIf="column.columnComponent && column.columnComponent.type === \'checkbox\'" [checked]="metaInfo[row.$$gtRowId]?.isSelected" (changed)="toggleSelect(row)"></gt-checkbox>\n </td>\n </tr>\n <tr class="row-expanded" *ngIf="metaInfo[row.$$gtRowId]?.isOpen">\n <td [attr.colspan]="(gtFields | gtVisible:gtSettings:refreshPipe).length">\n <gt-expanding-row [row]="row"\n [type]="expandedRow.component ? expandedRow.component:gtRowComponent"\n [columnWidth]="columnWidth"\n [gtFields]="gtFields"\n [gtOptions]="gtOptions"\n [gtEvent]="gtEvent"\n [gtInfo]="gtInfo"\n [gtSettings]="gtSettings"\n [data]="expandedRow.data ? expandedRow.data:row"\n (redrawEvent)="redraw($event)"\n (toggleRowEvent)="toggleCollapse($event)"></gt-expanding-row>\n </td>\n </tr>\n <tr *ngIf="gtOptions.reportColumnWidth && last">\n <td style="padding: 0; border:none;"\n *ngFor="let column of gtSettings | gtVisible:gtSettings:refreshPipe" gtColumnWidth\n [objectKey]="column.objectKey" [widths]="columnWidth"></td>\n </tr>\n </ng-template>\n <tr *ngIf="gtInfo.pageTotal === 0 && (gtInfo.searchTerms || gtInfo.filter) && !loading">\n <td class="gt-no-matching-results" [attr.colspan]="(gtFields | gtVisible:gtSettings).length">\n {{gtTexts.noMatchingData}}\n </td>\n </tr>\n <tr *ngIf="gtInfo.pageTotal === 0 && !(gtInfo.searchTerms || gtInfo.filter) && !loading">\n <td class="gt-no-results" [attr.colspan]="(gtFields | gtVisible:gtSettings).length">{{gtTexts.noData}}\n </td>\n </tr>\n <tr *ngIf="gtInfo.pageTotal === 0 && loading">\n <td class="gt-loading-data" [attr.colspan]="(gtFields | gtVisible:gtSettings).length">{{gtTexts.loading}}</td>\n </tr>\n </tbody>\n</table>\n<table class="table" ngClass="{{gtClasses}} {{gtOptions.stack ? \'table-stacked\':\'\'}}"\n *ngIf="gtFields && gtSettings && (gtFields | gtVisible:gtSettings:refreshPipe).length === 0">\n <thead>\n <tr>\n <th class="gt-no-visible-columns">{{gtTexts.noVisibleColumnsHeading}}</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td class="gt-no-visible-columns">{{gtTexts.noVisibleColumns}}</td>\n </tr>\n </tbody>\n</table>\n<table class="table" ngClass="{{gtClasses}} {{gtOptions.stack ? \'table-stacked\':\'\'}}"\n *ngIf="!gtFields || !gtSettings">\n <thead>\n <tr>\n <th class="gt-loading-config"> </th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td class="gt-loading-config"> </td>\n </tr>\n </tbody>\n</table>\n'}]}],t.ctorParameters=function(){return[{type:o.Renderer2},{type:f}]},t.propDecorators={gtOptions:[{type:o.Input}],gtTotals:[{type:o.Input}],gtFields:[{type:o.Input}],gtSettings:[{type:o.Input}],gtData:[{type:o.Input}],gtRowComponent:[{type:o.Input}],gtTexts:[{type:o.Input}],gtClasses:[{type:o.Input}],gtEvent:[{type:o.Output}],gtInfo:[{type:o.Input}]},t}(),y=function(){function t(t){this._changeDetectionRef=t}return t.prototype.ngAfterViewChecked=function(){this._changeDetectionRef.detectChanges()},t.decorators=[{type:o.Component,args:[{selector:"gt-table-info",template:'<span *ngIf="genericTable.gtInfo">{{(customText? customText:genericTable.gtTexts) | gtTableInfo:\n\t\tgenericTable.gtInfo:\n\t\tgenericTable.gtInfo.recordsAfterSearch:\n\t\tgenericTable.gtInfo.recordFrom:\n\t\tgenericTable.gtInfo.recordTo:\n\t\tgenericTable.gtInfo.recordsAll:\n\t\tgenericTable.gtTexts.loading:\n\t\tgenericTable.gtTexts.tableInfoAfterSearch}}</span>'}]}],t.ctorParameters=function(){return[{type:o.ChangeDetectorRef}]},t.propDecorators={genericTable:[{type:o.Input}],customText:[{type:o.Input}]},t}(),w=function(){function t(){}return t.prototype.transform=function(t,e,n,o,r,i,s,a){var l="object"==typeof t?t.tableInfo:"";for(var g in e.recordsAfterSearch!==e.recordsAll&&(l="object"==typeof t?t.tableInfoAfterSearch:""),e)if(e.hasOwnProperty(g)){var c=new RegExp("#"+g,"g");l=l.replace(c,e[g])}return l},t.decorators=[{type:o.Pipe,args:[{name:"gtTableInfo"}]}],t}(),b=function(){function t(){this.ready=!1}return Object.defineProperty(t.prototype,"genericTable",{get:function(){return this._genericTable},set:function(t){var e=this;t&&t.gtEvent.subscribe(function(t){"gt-info"===t.name&&0<t.value.pageTotal&&(e.ready=!0)}),this._genericTable=t},enumerable:!0,configurable:!0}),t.decorators=[{type:o.Component,args:[{selector:"gt-pagination",template:'<nav class="gt-pagination" aria-label="Table navigation" *ngIf="genericTable && genericTable.gtInfo && ready && genericTable.gtData?.length > 0" [ngClass]="{\'no-data\':genericTable.gtInfo.pageTotal === 0}">\n <ul class="pagination" [ngClass]="gtClasses">\n <li class="page-item" [ngClass]="{\'disabled\' : genericTable.gtInfo.pageCurrent === 1 || genericTable.loading }"><a class="page-link" href="javascript:void(0);" (click)="genericTable.gtInfo.pageCurrent > 1 && genericTable.previousPage()" [attr.aria-label]="genericTable.gtTexts.paginatePrevious"><span aria-hidden="true">«</span><span class="sr-only">{{genericTable.gtTexts.paginatePrevious}}</span></a></li>\n <li class="page-item" [ngClass]="{\'disabled\' : genericTable.loading && genericTable.gtInfo.pageCurrent !== page, \'active\' : genericTable.gtInfo.pageCurrent === page }" *ngFor="let page of genericTable.gtInfo.pageTotal | gtPaginationPipe:genericTable.gtInfo.pageCurrent"><a class="page-link" [tabindex]="page === true ? -1:0" href="javascript:void(0);" (click)="page === true ? \'\':genericTable.goToPage(page)">{{page === true ? \'…\':page}}</a></li>\n <li class="page-item" [ngClass]="{\'disabled\' : genericTable.gtInfo.pageCurrent === genericTable.gtInfo.pageTotal || genericTable.loading }"><a class="page-link gt-link" href="javascript:void(0);" (click)="genericTable.gtInfo.pageCurrent !== genericTable.gtInfo.pageTotal && genericTable.nextPage()" [attr.aria-label]="genericTable.gtTexts.paginateNext"><span aria-hidden="true">»</span><span class="sr-only">{{genericTable.gtTexts.paginateNext}}</span></a></li>\n </ul>\n </nav>\n ',styles:[".gt-link {cursor: pointer;}"]}]}],t.propDecorators={genericTable:[{type:o.Input}],gtClasses:[{type:o.Input}]},t}(),v=function(){function t(){}return t.prototype.transform=function(t,e){if(0===t)return[1];for(var n=[],o=t<5?t:5,r=e<=2?1:e-2,i=t-(e+2)<=0?t-(e+2):0,s=r+i<=0?1:r+i,a=0;a<o;a++)n.push(s+a);return-1===n.indexOf(1)?(-1===n.indexOf(2)&&(7===t?n.unshift(2):n[0]=!0),n.unshift(1)):o<t&&n.splice(o,0,o+1),-1===n.indexOf(t)&&(n[n.length-1]=n[n.length-1]!==t-1||t-1,n.push(t)),n},t.decorators=[{type:o.Pipe,args:[{name:"gtPaginationPipe"}]}],t}(),I=function(t){function e(){return t.call(this)||this}return function(t,e){function n(){this.constructor=t}p(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.ngOnInit=function(){},e.decorators=[{type:o.Component,args:[{selector:"gt-drilldown",template:'\n <table class="table">\n <tr *ngFor="let row of data" (click)="$rowClick(row, $event)">\n \x3c!--<td *ngFor="let column of gtSettings" [style.width]="columnWidth[column.objectKey]">{{column.objectKey}}</td>--\x3e\n <td *ngFor="let column of row | gtRender:gtSettings:gtFields:null:null:gtOptions.highlightSearch:gtInfo.searchTerms;"\n ngClass="{{column.objectKey +\'-column\' | dashCase}} {{gtFields | gtProperty:column.objectKey:\'classNames\'}} {{(gtFields | gtProperty:column.objectKey:\'inlineEdit\') ? \'gt-inline-edit\':\'\'}} {{column.edited ? \'gt-edited\':\'\'}} {{ gtFields | gtColumnClass:row:column }}" [style.width]="columnWidth[column.objectKey]" [style.max-width]="columnWidth[column.objectKey]">\n <span class="gt-row-label"\n *ngIf="gtOptions.stack">{{(gtFields | gtProperty:column.objectKey:\'stackedHeading\') ? (gtFields | gtProperty:column.objectKey:\'stackedHeading\') : (gtFields | gtProperty:column.objectKey:\'name\')}}</span>\n <gt-custom-component-factory *ngIf="column.columnComponent" class="gt-row-content"\n [type]="column.columnComponent.type"\n [injector]="column.columnComponent.injector" [row]="row"\n [column]="column" (redrawEvent)="$redraw($event)"\n (click)="column.click ? column.click(row,column,$event):\'\';"></gt-custom-component-factory>\n <span *ngIf="!column.columnComponent"\n class="gt-row-content" [innerHTML]="column.renderValue"\n (click)="column.click ? column.click(row,column,$event):\'\'"></span>\n </td>\n\n </tr>\n </table>\n ',styles:[]}]}],e.ctorParameters=function(){return[]},e}(g),O=function(){function t(t){this.sanitizer=t}return t.prototype.transform=function(t,e){var n,o=t+"",r=o;try{n=new RegExp("("+e.toLowerCase().match(/".*?"|[^ ]+/g).map(function(t){return t.replace(/"(.*?)"/,"$1")}).join("|")+")","ig")}catch(s){return this.sanitizer.bypassSecurityTrustHtml(r)}var i=/(<.*?>)(.*)(<\/.*?>)/gi.exec(o);return r=i?i[1]+i[2].replace(n,'<span class="gt-highlight-search">$1</span>')+i[3]:o.replace(n,'<span class="gt-highlight-search">$1</span>'),this.sanitizer.bypassSecurityTrustHtml(r)},t.decorators=[{type:o.Pipe,args:[{name:"gtHighlight"}]}],t.ctorParameters=function(){return[{type:e.DomSanitizer}]},t}(),R=function(){function t(t,e){this.sanitizer=t,this.gtHighlightPipe=e,this.getColumnOrder=function(t,e){return t.columnOrder<e.columnOrder?-1:t.columnOrder>e.columnOrder||"undefined"==typeof t.columnOrder?1:0},this.getOrderByLength=function(t,e){return e.length-t.length},this.getProperty=function(t,e){for(var n=0;n<t.length;n++)if(t[n].objectKey===e)return t[n]}}return t.prototype.transform=function(t,e,n,o,r,i,s){void 0===i&&(i=!1);for(var a=[],l=0;l<e.length;l++)!1!==e[l].visible&&!1!==e[l].enabled&&a.push(e[l].objectKey);for(l=0;l<n.length;l++)n[l].value&&"function"==typeof n[l].value&&!t.hasOwnProperty(n[l].objectKey)&&(t[n[l].objectKey]=r?"":n[l].value(t));var g=[];for(var c in t)if(-1!==a.indexOf(c)){var p=void 0;for(l=0;l<n.length;l++)n[l].objectKey===c&&(p=n[l]);var d={objectKey:c,sortValue:t[c]};p.columnComponent&&(d.columnComponent=p.columnComponent),r?d.renderValue=null!==t[c]?t[c]:"":i&&s&&!1!==this.getProperty(e,c).search?d.renderValue=p.render&&"function"==typeof p.render?this.gtHighlightPipe.transform(p.render(t),s):this.gtHighlightPipe.transform(null!==t[c]?t[c]:"",s):d.renderValue=p.render&&"function"==typeof p.render?this.sanitizer.bypassSecurityTrustHtml(p.render(t)):null!==t[c]?t[c]:"",p.click&&"function"==typeof p.click&&(d.click=p.click),p.expand&&(d.expand=p.expand),g.push(d)}return g.sort(function(t,e){return a.indexOf(t.objectKey)<a.indexOf(e.objectKey)?-1:1}),g},t.decorators=[{type:o.Pipe,args:[{name:"gtRender"}]}],t.ctorParameters=function(){return[{type:e.DomSanitizer},{type:O}]},t}(),C=function(){function t(){this.getColumnOrder=function(t,e){return t.columnOrder<e.columnOrder?-1:t.columnOrder>e.columnOrder||"undefined"==typeof t.columnOrder?1:0}}return t.prototype.transform=function(t,e,n){var o=e.sort(this.getColumnOrder).map(function(t){if(!1!==t.visible&&!1!==t.enabled)return t.objectKey});return t.filter(function(t){return-1!==o.indexOf(t.objectKey)}).sort(function(t,e){return o.indexOf(t.objectKey)<o.indexOf(e.objectKey)?-1:1})},t.decorators=[{type:o.Pipe,args:[{name:"gtVisible"}]}],t}(),S=function(){function t(){}return t.prototype.transform=function(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()},t.decorators=[{type:o.Pipe,args:[{name:"dashCase"}]}],t}(),$=function(){function t(){}return t.prototype.transform=function(t,e,n,o){var r=null;try{for(var i=0;i<t.length;i++)t[i].objectKey===e&&(r=t[i][n])}catch(s){console.log('cannot read property: "'+n+'" on missing key: "'+e+'" in config.',s)}return r},t.decorators=[{type:o.Pipe,args:[{name:"gtProperty"}]}],t}(),_=function(){function t(){}return t.prototype.transform=function(t,e,n,o,r,i,s,a){if(!Array.isArray(t))return t;for(var l=[],g=(a.exportData=t).length,c=0;c<g;c+=n)l.push(t.slice(c,c+n));return e.visibleRecords=l[o-1]?h(l[o-1]):[],e.pageTotal=l.length,setTimeout(function(){return s.emit({name:"gt-info",value:e})},0),l[o-1]},t.decorators=[{type:o.Pipe,args:[{name:"gtChunk"}]}],t}(),j=function(){function t(){}return t.prototype.transform=function(t,e,n,o,r){if(n.recordsAll=t.length,!Array.isArray(t)||!e){var i=null===t?0:t.length;return n.recordsAfterFilter=i,t}for(var s=[],a=0;a<t.length;a++){var l=t[a],g=!0;for(var c in e)e.hasOwnProperty(c)&&-1===e[c].indexOf(l[c])&&(g=!1);g&&s.push(l)}return n.recordsAfterFilter=s.length,s},t.decorators=[{type:o.Pipe,args:[{name:"gtFilter"}]}],t}(),x=function(){function d(){this.getProperty=function(t,e){for(var n=0;n<t.length;n++)if(t[n].objectKey===e)return t[n]}}return d._orderByComparator=function(t,e){if("boolean"==typeof t&&(t=t.toString()),"boolean"==typeof e&&(e=e.toString()),isNaN(parseFloat(t))||!isFinite(t)||isNaN(parseFloat(e))||!isFinite(e)){if(null===e||void 0===e&&null!=t)return 1;if(null===t||void 0===t&&null!=e)return-1;try{if(t.toLowerCase()<e.toLowerCase())return-1;if(t.toLowerCase()>e.toLowerCase())return 1}catch(n){return 0}}else{if(parseFloat(t)<parseFloat(e))return-1;if(parseFloat(t)>parseFloat(e))return 1}return 0},d.prototype.getSortFunction=function(t){return!!t&&("function"==typeof t.sort?t.sort:"function"==typeof t.value&&t.value)},d.prototype.transform=function(t,g,c,e,n){var p=this;if(!Array.isArray(t)||null===t)return t;if(!Array.isArray(g)||Array.isArray(g)&&1===g.length){var o=g[0],r="-"===o.substr(0,1);if(o&&"-"!==o&&"+"!==o){var i="+"===o.substr(0,1)||"-"===o.substr(0,1)?o.substr(1):o,s=this.getSortFunction(this.getProperty(c,i));return t.sort(function(t,e){var n=!1===s?"$$gtRowId"===i?+t.$$gtRowId.split("_")[0]:t[i]:s(t),o=!1===s?"$$gtRowId"===i?+e.$$gtRowId.split("_")[0]:e[i]:s(e);if(void 0!==n||void 0!==o)return r?-d._orderByComparator(n,o):d._orderByComparator(n,o)})}return r?t.sort().reverse():t.sort()}return t.sort(function(t,e){for(var n=0;n<g.length;n++){var o="-"===g[n].substr(0,1),r="+"===g[n].substr(0,1)||"-"===g[n].substr(0,1)?g[n].substr(1):g[n],i=p.getSortFunction(p.getProperty(c,r)),s=!1===i?"$$gtRowId"===r?+t.$$gtRowId.split("_")[0]:t[r]:i(t),a=!1===i?"$$gtRowId"===r?+e.$$gtRowId.split("_")[0]:e[r]:i(e),l=o?-d._orderByComparator(s,a):d._orderByComparator(s,a);if(0!==l)return l}return 0})},d.decorators=[{type:o.Pipe,args:[{name:"gtOrderBy"}]}],d}(),P=function(){function t(){this.getProperty=function(t,e){for(var n=0;n<t.length;n++)if(t[n].objectKey===e)return t[n]}}return t.prototype.transform=function(t,e,n,o,r,i){if(!e||0===e.replace(/"/g,"").length){var s=null===t?0:t.length;return n.recordsAfterSearch=s,t}for(var a={},l=[],g=0;g<r.length;g++){var c=r[g];!1!==this.getProperty(o,c.objectKey).search&&("function"==typeof c.search?a[c.objectKey]=c.search:"function"==typeof c.value&&(a[c.objectKey]=c.value),l.push(c))}for(var p=[],d=(e=void 0===e?"":e).toLowerCase().match(/(".*"|[^\s]+)/g),u=0;u<t.length;u++){for(var h=t[u],f="",m=0;m<l.length;m++){var y=0===m?"":" & ";f+=a[l[m].objectKey]?y+a[l[m].objectKey](h,m):y+h[l[m].objectKey]}f=f.toLowerCase();var w=!0;for(g=0;g<d.length;g++){var b=d[g].replace(/"/g,"");if(!(w=-1!==f.indexOf(b)))break}w&&p.push(h)}return n.recordsAfterSearch=p.length,p},t.decorators=[{type:o.Pipe,args:[{name:"gtSearch"}]}],t}(),T=function(){function t(t,e){this.componentFactoryResolver=t,this.viewContainer=e,this.instance=new o.EventEmitter}return t.prototype.ngOnInit=function(){var t=this.componentFactoryResolver.resolveComponentFactory(this.ctor),e=this.viewContainer.createComponent(t,0,this.injector);this.instance.emit(e.instance)},t.decorators=[{type:o.Directive,args:[{selector:"[gtComponentAnchor]"}]}],t.ctorParameters=function(){return[{type:o.ComponentFactoryResolver},{type:o.ViewContainerRef}]},t.propDecorators={ctor:[{type:o.Input}],injector:[{type:o.Input}],instance:[{type:o.Output}]},t}(),E=function(){function t(){this.redrawEvent=new o.EventEmitter,this.$searchTerms=new n.ReplaySubject(1)}return t.prototype.$redraw=function(t){this.redrawEvent.emit({row:this.row,column:this.column})},t.prototype.ngOnInit=function(){var e=this;this.$searchTerms.subscribe(function(t){return e.searchTerms=t})},t}(),F=function(){function t(){this.$searchTerms=new n.ReplaySubject(1),this.redrawEvent=new o.EventEmitter}return Object.defineProperty(t.prototype,"searchTerms",{set:function(t){this.$searchTerms.next(t)},enumerable:!0,configurable:!0}),t.prototype.instance=function(t){t.row=this.row,t.column=this.column,t.$searchTerms=this.$searchTerms,t.redrawEvent.subscribe(this.redrawEvent)},t.decorators=[{ty