UNPKG

@bi8/am-data-table

Version:

ng update @angular/cli --migrate-only --from=1.7.4 ng update @angular/core yarn add ng-packagr yarn add @angular/material yarn add core-js yarn add @angular/flex-layout yarn add lodash yarn add material-design-icons yarn add roboto-fontface yarn

2 lines 30.4 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("rxjs/Subject"),require("@angular/cdk/collections"),require("rxjs/BehaviorSubject"),require("lodash"),require("rxjs/operator/takeUntil"),require("@angular/material"),require("@angular/platform-browser/animations"),require("rxjs/Rx")):"function"==typeof define&&define.amd?define("@bi8/am-data-table",["exports","@angular/core","@angular/common","rxjs/Subject","@angular/cdk/collections","rxjs/BehaviorSubject","lodash","rxjs/operator/takeUntil","@angular/material","@angular/platform-browser/animations","rxjs/Rx"],t):t(((e=e||self).bi8=e.bi8||{},e.bi8["am-data-table"]={}),e.ng.core,e.ng.common,e.rxjs.Subject,e.ng.cdk.collections,e.rxjs.BehaviorSubject,e._,e.rxjs["operator/takeUntil"],e.ng.material,e.ng.platformBrowser.animations)}(this,function(e,t,n,o,i,r,a,s,l,c){"use strict";var d=function(e,t){return(d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function u(e,t){function n(){this.constructor=e}d(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function p(e,t,n,o){var i,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(r<3?i(a):r>3?i(t,n,a):i(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a}function h(e,t){return function(n,o){t(n,o,e)}}function m(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function f(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}var y=new t.InjectionToken("am.grid.date.format"),g={format:"fullDate"};function w(e){return e?e.split(".").map(function(e){return a.kebabCase(e)}).join("-"):e}var C,v,R=function(){function e(e){this.viewContainer=e}return e.ctorParameters=function(){return[{type:t.ViewContainerRef}]},e=p([t.Directive({selector:"[headerRowOutlet]"}),m("design:paramtypes",[t.ViewContainerRef])],e)}(),x=function(){function e(e){this.viewContainer=e}return e.ctorParameters=function(){return[{type:t.ViewContainerRef}]},e=p([t.Directive({selector:"[dataRowOutlet]"}),m("design:paramtypes",[t.ViewContainerRef])],e)}(),D=function(){function e(e){this.viewContainer=e}return e.ctorParameters=function(){return[{type:t.ViewContainerRef}]},e=p([t.Directive({selector:"[rowOutlet]"}),m("design:paramtypes",[t.ViewContainerRef])],e)}(),E=function(){function e(e){this.viewContainer=e}return e.ctorParameters=function(){return[{type:t.ViewContainerRef}]},e=p([t.Directive({selector:"[expanderOutlet]"}),m("design:paramtypes",[t.ViewContainerRef])],e)}(),S=function(){function e(e){this.viewContainer=e}return e.ctorParameters=function(){return[{type:t.ViewContainerRef}]},e=p([t.Directive({selector:"[cellOutlet]"}),m("design:paramtypes",[t.ViewContainerRef])],e)}(),b=function(){function e(e,t){this.templateRef=e,this.viewContainer=t}return e.ctorParameters=function(){return[{type:t.TemplateRef},{type:t.ViewContainerRef}]},e=p([t.Directive({selector:"[headerRowDef]",inputs:["model: headerRowDef"]}),m("design:paramtypes",[t.TemplateRef,t.ViewContainerRef])],e)}(),O=function(){function e(e,t){this.templateRef=e,this.viewContainer=t}return e.ctorParameters=function(){return[{type:t.TemplateRef},{type:t.ViewContainerRef}]},e=p([t.Directive({selector:"[headerCellDef]",inputs:["column: column"]}),m("design:paramtypes",[t.TemplateRef,t.ViewContainerRef])],e)}(),_=function(){function e(e,t,n){this.componentFactoryResolver=e,this.elementRef=t,this.renderer=n}return e.prototype.ngOnInit=function(){var e=this;this.renderer.addClass(this.elementRef.nativeElement,"am-header-cell-"+w(this.column.config.key)),this.renderer.setStyle(this.elementRef.nativeElement,"flex",this.column.styles.flex||1),this.column&&this.column.styles.minWidth?this.renderer.setStyle(this.elementRef.nativeElement,"min-width",this.column.styles.minWidth):this.column&&this.column.model&&this.column.model.styles.minColumnWidth&&this.renderer.setStyle(this.elementRef.nativeElement,"min-width",this.column.model.styles.minColumnWidth),this.column.styles.headerCellStyleClasses&&this.column.styles.headerCellStyleClasses.forEach(function(t,n){e.renderer.addClass(e.elementRef.nativeElement,t)})},e.prototype.ngOnChanges=function(e){},e.prototype.ngOnDestroy=function(){},e.prototype.ngAfterContentInit=function(){this.renderCell()},e.prototype.renderCell=function(){if(this._cellOutlet.viewContainer.clear(),this.column.config.headingTemplate)this._cellOutlet.viewContainer.createEmbeddedView(this.column.config.headingTemplate,{column:this.column});else{var e=this.column.config.headingFormatter;if(e){var t=this.componentFactoryResolver.resolveComponentFactory(e),n=this._cellOutlet.viewContainer;n.clear(),n.createComponent(t).instance.column=this.column}else console.warn("Could not find header formatter for column with key '"+this.column.config.key+"'.")}},e.ctorParameters=function(){return[{type:t.ComponentFactoryResolver},{type:t.ElementRef},{type:t.Renderer2}]},p([t.ViewChild(S,{static:!0}),m("design:type",S)],e.prototype,"_cellOutlet",void 0),e=p([t.Component({selector:"header-cell",inputs:["column: column"],template:"\n <ng-container cellOutlet></ng-container>\n ",host:{class:"am-header-cell",role:"row"},encapsulation:t.ViewEncapsulation.None}),m("design:paramtypes",[t.ComponentFactoryResolver,t.ElementRef,t.Renderer2])],e)}(),k=function(){function n(e){this._changeDetectorRef=e,this.events$=new t.EventEmitter}return n.prototype.ngAfterContentInit=function(){var e=this;this._rowOutlet.viewContainer.clear(),this.model.columns.forEach(function(t,n){e.renderHeaderCell(t)})},n.prototype.renderHeaderCell=function(e,t){this._rowOutlet.viewContainer.createEmbeddedView(this._headerCellDef.templateRef,{$implicit:e},t)},n.prototype.clearCells=function(){this._rowOutlet.viewContainer.clear()},n.prototype.applyColumnChanges=function(t){var n=this;t&&(t.forEachRemovedItem(function(t){n._rowOutlet.viewContainer.remove(t.previousIndex),n.events$.emit({type:e.GridEventType.ColumnRemoved,data:t})}),t.forEachAddedItem(function(t){n.renderHeaderCell(t.item,t.currentIndex),n.events$.emit({type:e.GridEventType.ColumnAdded,data:t})}),this._changeDetectorRef.markForCheck())},n.ctorParameters=function(){return[{type:t.ChangeDetectorRef}]},p([t.Output("events"),m("design:type",Object)],n.prototype,"events$",void 0),p([t.ViewChild(D,{static:!0}),m("design:type",D)],n.prototype,"_rowOutlet",void 0),p([t.ViewChild(O,{static:!0}),m("design:type",O)],n.prototype,"_headerCellDef",void 0),p([t.ViewChildren(_),m("design:type",t.QueryList)],n.prototype,"headerCells",void 0),n=p([t.Component({selector:"header-row",inputs:["model: model"],template:'\n <div *ngIf="model.config.showExpander" class="am-header-expander-column"></div>\n <ng-container rowOutlet></ng-container>\n <ng-container>\n <header-cell *headerCellDef="let column;" [column]="column"></header-cell>\n \x3c!--<header-cell *headerCellDef="let column as column;" [column]="column"></header-cell>--\x3e\n </ng-container>\n ',host:{class:"am-header-row",role:"row"},encapsulation:t.ViewEncapsulation.None}),m("design:paramtypes",[t.ChangeDetectorRef])],n)}(),I=function(){function e(e,t){this.templateRef=e,this.viewContainer=t}return e.ctorParameters=function(){return[{type:t.TemplateRef},{type:t.ViewContainerRef}]},e=p([t.Directive({selector:"[dataRowDef]"}),m("design:paramtypes",[t.TemplateRef,t.ViewContainerRef])],e)}(),T=function(){function e(e,t){this.templateRef=e,this.viewContainer=t}return e.ctorParameters=function(){return[{type:t.TemplateRef},{type:t.ViewContainerRef}]},e=p([t.Directive({selector:"[dataCellDef]"}),m("design:paramtypes",[t.TemplateRef,t.ViewContainerRef])],e)}(),V=function(){function e(e,t,n){this.componentFactoryResolver=e,this.elementRef=t,this.renderer=n}return e.prototype.ngOnInit=function(){var e=this;this.renderer.addClass(this.elementRef.nativeElement,"am-data-cell-"+w(this.column.config.key)),this.renderer.setStyle(this.elementRef.nativeElement,"flex",this.column.styles.flex||1),this.column&&this.column.styles.minWidth?this.renderer.setStyle(this.elementRef.nativeElement,"min-width",this.column.styles.minWidth):this.column&&this.column.model&&this.column.model.styles.minColumnWidth&&this.renderer.setStyle(this.elementRef.nativeElement,"min-width",this.column.model.styles.minColumnWidth),this.column.styles.dataCellStyleClasses&&this.column.styles.dataCellStyleClasses.forEach(function(t,n){e.renderer.addClass(e.elementRef.nativeElement,t)})},e.prototype.ngAfterContentInit=function(){this.renderCell()},e.prototype.renderCell=function(){if(this._cellOutlet.viewContainer.clear(),this.column.config.dataTemplate)this._cellOutlet.viewContainer.createEmbeddedView(this.column.config.dataTemplate,{column:this.column,row:this.row});else{var e=this.column.config.formatter;if(e){var t=this.componentFactoryResolver.resolveComponentFactory(e),n=this._cellOutlet.viewContainer;n.clear();var o=n.createComponent(t);o.instance.column=this.column,o.instance.row=this.row}else console.warn("Could not find data formatter for column with key '"+this.column.config.key+"'.")}},e.ctorParameters=function(){return[{type:t.ComponentFactoryResolver},{type:t.ElementRef},{type:t.Renderer2}]},p([t.ViewChild(S,{static:!0}),m("design:type",S)],e.prototype,"_cellOutlet",void 0),e=p([t.Component({selector:"data-cell",inputs:["column: column","row: row"],template:"\n <ng-container cellOutlet></ng-container>\n ",host:{class:"am-data-cell",role:"row"},encapsulation:t.ViewEncapsulation.None}),m("design:paramtypes",[t.ComponentFactoryResolver,t.ElementRef,t.Renderer2])],e)}(),A="keyboard_arrow_right",j=function(){function n(e){this._changeDetectorRef=e,this.events$=new t.EventEmitter,this.selected=!1,this.expanderIcon=A}return n.prototype.rowClicked=function(t){this.events$.emit({type:e.GridEventType.RowClicked,data:this})},n.prototype.selectRow=function(){this.row.selected=!0},n.prototype.deselectRow=function(){this.row.selected=!1},n.prototype.isSelected=function(){return this.row.selected},n.prototype.rowClass=function(){return this.row.model.styles.dataRowStyleResolver?this.row.model.styles.dataRowStyleResolver(this.row):this.row.selected?["default-selected-row"]:null},n.prototype.cellClass=function(e){return e.styles.dataCellStyleResolver?e.styles.dataCellStyleResolver(this.row,e):null},n.prototype.ngAfterContentInit=function(){var e=this;this._rowOutlet.viewContainer.clear(),this.row.model.columns.forEach(function(t,n){e.renderDataCell(t)})},n.prototype.renderDataCell=function(e,t){this._rowOutlet.viewContainer.createEmbeddedView(this._dataCellDef.templateRef,{$implicit:e,row:this.row},t)},n.prototype.applyColumnChanges=function(e){var t=this;e&&(e.forEachAddedItem(function(e){t.renderDataCell(e.item,e.currentIndex)}),e.forEachRemovedItem(function(e){t._rowOutlet.viewContainer.remove(e.previousIndex)}),this._changeDetectorRef.markForCheck())},n.prototype.toggleExpander=function(){this._expanderOutlet.viewContainer.clear(),this.row.expanded?(this.row.expanded=!1,this.expanderIcon=A):(this.row.expanded=!0,this.expanderIcon="keyboard_arrow_down",this.row.model.config.expanderTemplate&&this._expanderOutlet.viewContainer.createEmbeddedView(this.row.model.config.expanderTemplate,{row:this.row})),this.events$.emit({type:this.row.expanded?e.GridEventType.RowExpanded:e.GridEventType.RowContracted,data:this.row})},n.ctorParameters=function(){return[{type:t.ChangeDetectorRef}]},p([t.Output("events"),m("design:type",Object)],n.prototype,"events$",void 0),p([t.ViewChild(D,{static:!0}),m("design:type",D)],n.prototype,"_rowOutlet",void 0),p([t.ViewChild(T,{static:!0}),m("design:type",T)],n.prototype,"_dataCellDef",void 0),p([t.ViewChildren(V),m("design:type",t.QueryList)],n.prototype,"dataCells",void 0),p([t.ViewChild(E,{static:!0}),m("design:type",E)],n.prototype,"_expanderOutlet",void 0),n=p([t.Component({selector:"data-row",inputs:["row: row"],template:'\n \x3c!-- \n \n Expander Status - show/hide/disable (also with a tooltip)\n Expander Type - Chevron (expand/contract), Slider (slide-in/slide-out) \n \n rowDataFormatter {\n span: [\n [\'firstName\',\'lastName\'] \n ]\n \n colSpan: [\'firstName\',\'lastName\']\n }\n \n GridColumn\n StackedGridColumn\n \n \n \n emit({\n type: RowExpanded / RowContracted,\n data: record\n })\n \n emit({\n type: RowAdded, RowRemoved\n data: record\n })\n \n \n I would also like the ability \n \n [ wildcard search ] - across all columns \n --------------------------------------------------------------------- \n | | First Name | Mobile | Birth Date |\n | | Surname | Email | Age |\n ---------------------------------------------------------------------\n ===================================================================== \n [F]: | [ First Name ] | [ Mobile ] | [DATE-FORM] [DATE-TO] |\n [ Last Name ] | [ Email ] | |\n =====================================================================\n | Manie | Coetzee | 77/05/05 |\n > | Coetzee | mc@bla.com | 40 |\n ---------------------------------------------------------------------\n | | 13 Pioneer Road |\n | [ADDRESS] | Durbanville |\n | | 7550 |\n ---------------------------------------------------------------------\n EXPANDER\n =====================================================================\n =====================================================================\n --\x3e\n\n <div style="flex: 1 1 auto; cursor: pointer;" [ngClass]="rowClass()" (click)="rowClicked($event)">\n <div style="display: flex; flex: 1 1 auto;" [ngClass]="{\'am-expanded-row\': row.expanded && !rowClass()}">\n <div *ngIf="row.model.config.showExpander" class="am-header-expander-column">\n <mat-icon (click)="toggleExpander()">{{expanderIcon}}</mat-icon>\n </div>\n <ng-container rowOutlet></ng-container>\n </div>\n <div style="flex: 1 1 auto;" [ngClass]="{\'am-expander-row\': row.expanded}">\n <ng-container expanderOutlet></ng-container>\n </div>\n </div>\n <ng-container>\n <data-cell *dataCellDef="let column; " [column]="column" [row]="row" [ngClass]="cellClass(column)"></data-cell>\n </ng-container>\n ',host:{class:"am-data-row",role:"row"},encapsulation:t.ViewEncapsulation.None}),m("design:paramtypes",[t.ChangeDetectorRef])],n)}(),F=function(){function n(e,n){this._differs=e,this._changeDetectorRef=n,this.events$=new t.EventEmitter,this.data=[],this.onDestroy=new o.Subject,this.viewChange=new r.BehaviorSubject({start:0,end:Number.MAX_VALUE}),this.gridDefaults=new W}return Object.defineProperty(n.prototype,"dataSource",{get:function(){return this._dataSource},set:function(e){this._dataSource!==e&&this.switchDataSource(e)},enumerable:!0,configurable:!0}),n.prototype.toggleRowExpander=function(e){try{this.dataRows.toArray()[e].toggleExpander()}catch(e){console.log(e)}},n.prototype.emit=function(t){var n=this;if(t.type==e.GridEventType.RowClicked){this.events$.emit(t);var o=t.data,i=!1;this.dataRows.forEach(function(t){t.isSelected()&&(t==o&&(i=!0),t.deselectRow(),n.events$.emit({type:e.GridEventType.RowDeselected,data:t}))}),i||(o.selectRow(),this.events$.emit({type:e.GridEventType.RowSelected,data:o}))}this.events$.emit(t)},n.prototype.ngOnInit=function(){this.columnsDiffer=this._differs.find(this.model.columns).create(),this.dataDiffer=this._differs.find([]).create(),this.model.grid=this},n.prototype.ngAfterContentInit=function(){this.gridDefaults.applyDefaults(this.model.columns),this.columnsDiffer.diff(this.model.columns),this.setupHeader(),this.observeModel(),this.observeDataSource()},n.prototype.ngAfterContentChecked=function(){},n.prototype.ngAfterViewInit=function(){this.emit({type:e.GridEventType.Initialized,data:this.model})},n.prototype.ngAfterViewChecked=function(){this._changeDetectorRef.detectChanges()},n.prototype.ngOnChanges=function(e){},n.prototype.ngOnDestroy=function(){this.onDestroy.next(),this.onDestroy.complete(),this.dataSource&&this.dataSource.disconnect(this),this.modelSubscription&&(this.modelSubscription.unsubscribe(),this.modelSubscription=null)},n.prototype.setupHeader=function(){this._headerRowOutlet.viewContainer.clear(),this._headerRowOutlet.viewContainer.createEmbeddedView(this._headerRowDef.templateRef,{$implicit:this.model})},n.prototype.gridModelChanged=function(e){this.gridDefaults.applyDefaults(this.model.columns);var t=this.columnsDiffer.diff(this.model.columns);this.headerRow.applyColumnChanges(t),this.dataRows.forEach(function(e,n){e.applyColumnChanges(t)}),this._changeDetectorRef.markForCheck()},n.prototype.dataSourceDataChanged=function(){var t=this,n=this.dataDiffer.diff(this.data);n&&(n.forEachRemovedItem(function(n){t._dataRowOutlet.viewContainer.remove(n.previousIndex),t.emit({type:e.GridEventType.RowRemoved,data:n})}),n.forEachAddedItem(function(n){var o={data:n.item,model:t.model,expanded:!1};t._dataRowOutlet.viewContainer.createEmbeddedView(t._dataRowDef.templateRef,{$implicit:o},n.currentIndex),t.emit({type:e.GridEventType.RowAdded,data:n})}),this.emit({type:e.GridEventType.Reloaded,data:this.data}),setTimeout(function(){t.model.config.expandRowIndex>-1&&(t.toggleRowExpander(t.model.config.expandRowIndex),t.model.config.expandRowIndex=-1)},0),this._changeDetectorRef.markForCheck())},n.prototype.switchDataSource=function(e){this.data=[],this._dataSource&&this._dataSource.disconnect(this),this.dataSubscription&&(this.dataSubscription.unsubscribe(),this.dataSubscription=null),this._dataSource=e},n.prototype.observeModel=function(){var e=this;this.modelSubscription=this.model._changes.subscribe(function(t){e.gridModelChanged(t)})},n.prototype.observeDataSource=function(){var e=this;this.dataSource&&!this.dataSubscription&&(this.dataSubscription=s.takeUntil.call(this.dataSource.connect(this),this.onDestroy).subscribe(function(t){e.data=t,e.dataSourceDataChanged()}))},n.ctorParameters=function(){return[{type:t.IterableDiffers},{type:t.ChangeDetectorRef}]},p([t.Output("events"),m("design:type",Object)],n.prototype,"events$",void 0),p([t.Input(),m("design:type",N)],n.prototype,"model",void 0),p([t.Input(),m("design:type",i.DataSource),m("design:paramtypes",[i.DataSource])],n.prototype,"dataSource",null),p([t.ViewChild(R,{static:!0}),m("design:type",R)],n.prototype,"_headerRowOutlet",void 0),p([t.ViewChild(b,{static:!0}),m("design:type",b)],n.prototype,"_headerRowDef",void 0),p([t.ViewChild("headerRow",{static:!0}),m("design:type",t.TemplateRef)],n.prototype,"headerRowTemplate",void 0),p([t.ViewChild(k,{static:!1}),m("design:type",k)],n.prototype,"headerRow",void 0),p([t.ViewChild(x,{static:!0}),m("design:type",x)],n.prototype,"_dataRowOutlet",void 0),p([t.ViewChild(I,{static:!0}),m("design:type",I)],n.prototype,"_dataRowDef",void 0),p([t.ViewChildren(j),m("design:type",t.QueryList)],n.prototype,"dataRows",void 0),n=p([t.Component({selector:"am-data-grid",template:'\n <div class="am-grid">\n <ng-container headerRowOutlet></ng-container>\n <ng-container dataRowOutlet></ng-container>\n <ng-container>\n <header-row *headerRowDef="let model" [model]="model" (events)="emit($event)"></header-row>\n <data-row *dataRowDef="let row" [row]="row" (events)="emit($event)"></data-row>\n </ng-container>\n </div>\n ',encapsulation:t.ViewEncapsulation.None}),m("design:paramtypes",[t.IterableDiffers,t.ChangeDetectorRef])],n)}();(C=e.GridEventType||(e.GridEventType={}))[C.RowExpanded=0]="RowExpanded",C[C.RowContracted=1]="RowContracted",C[C.RowRemoved=2]="RowRemoved",C[C.RowAdded=3]="RowAdded",C[C.Reloaded=4]="Reloaded",C[C.ColumnRemoved=5]="ColumnRemoved",C[C.ColumnAdded=6]="ColumnAdded",C[C.DataChange=7]="DataChange",C[C.Initialized=8]="Initialized",C[C.RowClicked=9]="RowClicked",C[C.RowSelected=10]="RowSelected",C[C.RowDeselected=11]="RowDeselected",(v=e.GridModelEventType||(e.GridModelEventType={}))[v.ADD=0]="ADD",v[v.REMOVE=1]="REMOVE",v[v.UPDATE=2]="UPDATE";var M,G,N=function(){function t(e,t){void 0===t&&(t={}),this.columns=[],this._changes=new o.Subject,this.config={selection:!a.isNil(e.selection)&&e.selection,showExpander:!a.isNil(e.showExpander)&&e.showExpander,expanderFormatter:a.isNil(e.expanderFormatter)?null:e.expanderFormatter,expanderTemplate:a.isNil(e.expanderTemplate)?null:e.expanderTemplate,expandRowIndex:e.expandRowIndex},this.styles={containerClasses:a.isNil(t.containerClasses)?[]:t.containerClasses,gridClasses:a.isNil(t.containerClasses)?[]:t.containerClasses,scrollX:!a.isNil(t.scrollX)&&t.scrollX,minColumnWidth:a.isNil(t.minColumnWidth)?null:t.minColumnWidth,dataRowStyleResolver:t.dataRowStyleResolver||null}}return t.prototype.toggleExpander=function(e){this.grid.toggleRowExpander(e)},t.prototype.addColumn=function(t){t.model=this,this.columns.push(t),this.notifyChanges(e.GridModelEventType.ADD)},t.prototype.getColumnByKey=function(e){return a.find(this.columns,{config:{key:e}})},t.prototype.insertColumn=function(t,n){this.columns.splice(n,0,t),this.notifyChanges(e.GridModelEventType.ADD)},t.prototype.removeColumn=function(t){this.columns=a.without(this.columns,t),this.notifyChanges(e.GridModelEventType.REMOVE)},t.prototype.removeColumnByIndex=function(t){this.columns.splice(t,1),this.notifyChanges(e.GridModelEventType.REMOVE)},t.prototype.removeColumnsByKey=function(t){a.remove(this.columns,function(e){return e.config.key==t}),this.notifyChanges(e.GridModelEventType.REMOVE)},t.prototype.updateStyles=function(){this.notifyChanges(e.GridModelEventType.UPDATE,null)},t.prototype.updateColumn=function(t){var n=this.columns.indexOf(t);n>-1&&(this.columns[n]=t),this.notifyChanges(e.GridModelEventType.UPDATE,t)},t.prototype.removeAll=function(){this.columns=[],this.notifyChanges(e.GridModelEventType.REMOVE)},t.prototype.notifyChanges=function(e,t){this._changes.next({type:e,column:t,columns:this.columns})},t}(),P=function(e,t,n){var o=this;if(void 0===t&&(t={}),void 0===n&&(n={}),this.refresh=!1,this.config={key:e.key,type:e.type||"text",heading:e.heading,sortable:!a.isNil(e.sortable)&&e.sortable,noHeading:e.noHeading,headingFormatter:e.headingFormatter||z,formatter:e.formatter,context:e.context||{},headingTemplate:e.headingTemplate,dataTemplate:e.dataTemplate},this.styles={headerCellStyleClasses:a.isNil(t.headerCellStyleClasses)?[]:t.headerCellStyleClasses,filterCellStyleClasses:a.isNil(t.filterCellStyleClasses)?[]:t.filterCellStyleClasses,dataCellStyleClasses:a.isNil(t.dataCellStyleClasses)?[]:t.dataCellStyleClasses,flex:a.isNil(t.flex)?1:t.flex,minWidth:a.isNil(t.minWidth)?null:t.minWidth,maxWidth:a.isNil(t.maxWidth)?null:t.maxWidth,dataCellStyleResolver:t.dataCellStyleResolver||null},!this.config.heading&&!this.config.noHeading){var i=this.config.key;this.config.heading="",i.split(".").forEach(function(e,t){o.config.heading+=a.startCase(e)+" "})}this.options=n},$=function(){function e(){}return e.prototype.getValue=function(){return a.get(this.row.data,this.column.config.key)},p([t.Input(),m("design:type",P)],e.prototype,"column",void 0),p([t.Input(),m("design:type",Object)],e.prototype,"row",void 0),e=p([t.Component({template:"{{getValue()}}"})],e)}(),q=function(e){function n(t){var n=e.call(this)||this;return n.gridDateFormat=t,t||(n.gridDateFormat={format:"fullDate"}),n}return u(n,e),n.prototype.getFormat=function(){return this.column.options.dateFormat||this.gridDateFormat.format},n.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Optional},{type:t.Inject,args:[y]}]}]},p([t.Input(),m("design:type",P)],n.prototype,"column",void 0),p([t.Input(),m("design:type",Object)],n.prototype,"row",void 0),n=p([t.Component({template:"{{getValue() || '' | date : getFormat()}}"}),h(0,t.Optional()),h(0,t.Inject(y)),m("design:paramtypes",[Object])],n)}($),z=function(){function e(){}return p([t.Input(),m("design:type",P)],e.prototype,"column",void 0),e=p([t.Component({template:"{{column.config.heading}}"})],e)}(),W=function(){function e(){this.columns=new Map;var e=new P({type:"date",key:"date",formatter:q},{},{}),t=new P({type:"text",key:"text",formatter:$});this.setDefaultColumn(e.config.type,e),this.setDefaultColumn(t.config.type,t)}return e.prototype.setDefaultColumn=function(e,t){this.columns.set(e,t)},e.prototype.getDefaultColumn=function(e){return this.columns.get(e)},e.prototype.applyDefaults=function(e){var t=this;e&&0!=e.length&&e.forEach(function(e,n){var o=t.getDefaultColumn(e.config.type);o&&a.defaultsDeep(e,o)})},e}(),B=g,H=function(){function e(){}return e=p([t.NgModule({imports:[n.CommonModule,c.BrowserAnimationsModule,l.MatIconModule,l.MatPaginatorModule],exports:[F],declarations:[F,b,k,O,_,I,j,T,V,R,x,D,E,S,z,$,q],entryComponents:[z,$,q],providers:[{provide:y,useValue:B}]})],e)}(),U=function(e){function t(t){var n=e.call(this)||this;return n.paginator=t,n.itemSource$=new r.BehaviorSubject([]),n.items=[],n.pageSize=5,n.pageIndex=0,n.totalSize=0,n.paginator&&n.paginator.page.subscribe(function(e){n.pageSize=e.pageSize,n.pageIndex=e.pageIndex,n.reload()}),n}return u(t,e),t.prototype.connect=function(){return this.itemSource$.asObservable()},t.prototype.disconnect=function(){},t.prototype.reload=function(){this.totalSize=this.items.length;var e=a.chunk(this.items,this.pageSize);this.itemSource$.next(e[this.pageIndex])},t.prototype.addAll=function(e){this.items=this.items.concat(e),this.reload()},t.prototype.addItem=function(e){this.items.push(e),this.reload()},t.prototype.insertItem=function(e,t){this.items.splice(t,0,e),this.reload()},t.prototype.removeColumn=function(e){this.items=a.without(this.items,e),this.reload()},t.prototype.removeItemByIndex=function(e){this.items.splice(e,1),this.reload()},t.prototype.removeAll=function(){this.items=[],this.reload()},t}(i.DataSource);(M=e.Operation||(e.Operation={}))[M.gt=0]="gt",M[M.lt=1]="lt",M[M.gte=2]="gte",M[M.lte=3]="lte",M[M.eq=4]="eq",M[M.ieq=5]="ieq",M[M.neq=6]="neq",M[M.ineq=7]="ineq",M[M.like=8]="like",M[M.ilike=9]="ilike",(G=e.SortOrder||(e.SortOrder={}))[G.asc=0]="asc",G[G.desc=1]="desc";var L=function(){function t(e){this.ctx=e,e||(this.ctx={})}return t.prototype.getContext=function(){return this.ctx},t.prototype.applyFilter=function(e,t,n){if(n){var o={path:e,operation:t,value:n};return this.ctx.criteria||(this.ctx.criteria=[]),this.ctx.criteria.push(o),this}},t.prototype.format=function(){var t,n,o={};switch(this.ctx.size&&(o.size=this.ctx.size),this.ctx.page&&(o.page=this.ctx.page),null!=this.ctx.inclusive&&(o.inclusive=this.ctx.inclusive),null!=this.ctx.sortField&&(o.sortField=this.ctx.sortField),this.ctx.sortOrder){case e.SortOrder.asc:o.sortOrder="asc";break;case e.SortOrder.desc:o.sortOrder="desc"}if(this.ctx.criteria&&this.ctx.criteria.length>0){o.criteria=[];try{for(var i=f(this.ctx.criteria),r=i.next();!r.done;r=i.next()){var a=r.value,s={value:a.value,path:a.path};switch(a.operation){case e.Operation.eq:s.operation="=";break;case e.Operation.gt:s.operation=">";break;case e.Operation.gte:s.operation=">=";break;case e.Operation.ilike:s.operation="ilike";break;case e.Operation.like:s.operation="like";break;case e.Operation.lt:s.operation="<";break;case e.Operation.lte:s.operation="<=";break;case e.Operation.ieq:s.operation=":";break;case e.Operation.neq:s.operation="!=";break;case e.Operation.ineq:s.operation="!:"}o.criteria.push(s)}}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}}return o},t}(),X=function(){function e(e){this.loadFn=e}return e.prototype.prepare=function(e){var t=this;return this.loadFn(e).map(function(e){return t.processResponse(e)})},e.prototype.processResponse=function(e){return{total:e.total,items:e.results}},e}(),K=function(){function e(e,t){var n=this;this.loader=e,this.paginator=t,this.dataSubject=new r.BehaviorSubject([]),this.items=[],this.lastCtx={},this.pageSize=5,this.pageIndex=0,this.totalSize=0,this.dataSource=new Q(this.dataSubject),this.paginator.page.subscribe(function(e){n.pageSize=e.pageSize,n.pageIndex=e.pageIndex,n.reload(n.lastCtx)})}return e.prototype.reload=function(e){var t=this,n=e||{};n.page=this.pageIndex,n.size=this.pageSize,this.lastCtx=n,this.loader.prepare(n).subscribe(function(e){t.items=e.items,t.totalSize=e.total,t.items=e.items,t.dataSubject.next(e.items)})},e}(),Q=function(e){function t(t){var n=e.call(this)||this;return n.subject=t,n}return u(t,e),t.prototype.connect=function(){return this.subject.asObservable()},t.prototype.disconnect=function(){},t}(i.DataSource);e.AM_GRID_DATE_DEFAULT=g,e.AM_GRID_DATE_FORMAT=y,e.AmDataTableModule=H,e.ArrayDS=U,e.CellOutlet=S,e.CriteriaTableDB=K,e.CriteriaTableDS=Q,e.DataCell=V,e.DataCellDef=T,e.DataRow=j,e.DataRowDef=I,e.DataRowOutlet=x,e.ExpanderOutlet=E,e.FilterCriteriaUtils=L,e.FunctionCriteriaLoader=X,e.GridColumn=P,e.GridComponent=F,e.GridDateFormatter=q,e.GridDefaults=W,e.GridKeyHeaderFormatter=z,e.GridModel=N,e.GridPropertyFormatter=$,e.HeaderCell=_,e.HeaderCellDef=O,e.HeaderRow=k,e.HeaderRowDef=b,e.HeaderRowOutlet=R,e.RowOutlet=D,e.SelectionMapper=function(e,t,n){return n.map(function(n){return n.results.forEach(function(n,o){n.code=n[e],n.value=n[t]}),n.results})},e.StringSelectionMapper=function(e){return e.map(function(e){var t=[];return e.results.forEach(function(e,n){t.push({code:e,value:e})}),t})},Object.defineProperty(e,"__esModule",{value:!0})}); //# sourceMappingURL=bi8-am-data-table.umd.min.js.map