blob: 68bb27123a83650eb14919eb0980a688d33dbce1 [file] [log] [blame]
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/material/checkbox"),require("@angular/material/tooltip"),require("@angular/material/icon"),require("@angular/material/core"),require("@angular/common"),require("@angular/platform-browser"),require("@angular/forms"),require("@angular/cdk/coercion"),require("@angular/cdk/keycodes"),require("rxjs"),require("rxjs/operators"),require("@angular/cdk/portal"),require("@covalent/core/common"),require("@angular/core")):"function"==typeof define&&define.amd?define("@covalent/core/data-table",["exports","@angular/material/checkbox","@angular/material/tooltip","@angular/material/icon","@angular/material/core","@angular/common","@angular/platform-browser","@angular/forms","@angular/cdk/coercion","@angular/cdk/keycodes","rxjs","rxjs/operators","@angular/cdk/portal","@covalent/core/common","@angular/core"],e):e((t.covalent=t.covalent||{},t.covalent.core=t.covalent.core||{},t.covalent.core["data-table"]={}),t.ng.material.checkbox,t.ng.material.tooltip,t.ng.material.icon,t.ng.material.core,t.ng.common,t.ng.platformBrowser,t.ng.forms,t.ng.cdk.coercion,t.ng.cdk.keycodes,t.rxjs,t.rxjs.operators,t.ng.cdk.portal,t.covalent.core.common,t.ng.core)}(this,function(t,e,i,n,a,r,o,l,s,d,c,h,u,m,b){"use strict";var p=function(t,e){return(p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};function f(t,e){function i(){this.constructor=t}p(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var g=(_.decorators=[{type:b.Component,args:[{selector:"tr[td-data-table-column-row]",template:"<ng-content></ng-content>",styles:[":host{border-bottom-style:solid;border-bottom-width:1px}:host.td-data-table-row{height:48px}:host.td-data-table-column-row{height:56px}"]}]}],_.ctorParameters=function(){return[{type:b.ElementRef},{type:b.Renderer2}]},_);function _(t,e){this._elementRef=t,this._renderer=e,this._renderer.addClass(this._elementRef.nativeElement,"td-data-table-column-row")}var y=(Object.defineProperty(w.prototype,"selected",{get:function(){return this._selected},set:function(t){t?this._renderer.addClass(this._elementRef.nativeElement,"td-selected"):this._renderer.removeClass(this._elementRef.nativeElement,"td-selected"),this._selected=t},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"height",{get:function(){var t=48;return this._elementRef.nativeElement&&(t=this._elementRef.nativeElement.getBoundingClientRect().height),t},enumerable:!0,configurable:!0}),w.prototype.clickListener=function(){this.focus()},w.prototype.focus=function(){this._elementRef.nativeElement.focus()},w.decorators=[{type:b.Component,args:[{selector:"tr[td-data-table-row]",template:"<ng-content></ng-content>",styles:[":host{border-bottom-style:solid;border-bottom-width:1px}:host.td-data-table-row{height:48px}:host.td-data-table-column-row{height:56px}"]}]}],w.ctorParameters=function(){return[{type:b.ElementRef},{type:b.Renderer2}]},w.propDecorators={selected:[{type:b.Input,args:["selected"]}],clickListener:[{type:b.HostListener,args:["click"]}]},w);function w(t,e){this._elementRef=t,this._renderer=e,this._selected=!1,this._renderer.addClass(this._elementRef.nativeElement,"td-data-table-row")}var x,v=(f(C,x=u.TemplatePortalDirective),C.decorators=[{type:b.Directive,args:[{selector:"[tdDataTableTemplate]ng-template"}]}],C.ctorParameters=function(){return[{type:b.TemplateRef},{type:b.ViewContainerRef}]},C.propDecorators={tdDataTableTemplate:[{type:b.Input}]},C);function C(t,e){return x.call(this,t,e)||this}function k(t){this._changeDetectorRef=t}var S,R={Ascending:"ASC",Descending:"DESC"},O=m.mixinControlValueAccessor(k,[]),D=(f(E,S=O),Object.defineProperty(E.prototype,"resizingColumn",{get:function(){return this._resizingColumn},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"hostWidth",{get:function(){return this.selectable?this._hostWidth-42:this._hostWidth},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"offsetTransform",{get:function(){return this._offsetTransform},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"totalHeight",{get:function(){return this._totalHeight},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"fromRow",{get:function(){return this._fromRow},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"toRow",{get:function(){return this._toRow},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"columnsLeftScroll",{get:function(){return-1*this._scrollHorizontalOffset},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"allSelected",{get:function(){return this._allSelected},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"indeterminate",{get:function(){return this._indeterminate},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"data",{get:function(){return this._data},set:function(t){var e=this;this._data=t,this._rowHeightCache=[],Promise.resolve().then(function(){e.refresh(),e._scrollableDiv.nativeElement.scrollTop=0})},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"virtualData",{get:function(){return this._virtualData},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"columns",{get:function(){var t=this;if(this._columns)return this._columns;if(this.hasData){this._columns=[];var e=this._data[0];return Object.keys(e).forEach(function(e){t._columns.find(function(t){return t.name===e})||t._columns.push({name:e,label:e})}),this._columns}return[]},set:function(t){this._columns=t},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"resizableColumns",{get:function(){return this._resizableColumns},set:function(t){this._resizableColumns=s.coerceBooleanProperty(t)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"selectable",{get:function(){return this._selectable},set:function(t){this._selectable=s.coerceBooleanProperty(t)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"clickable",{get:function(){return this._clickable},set:function(t){this._clickable=s.coerceBooleanProperty(t)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"multiple",{get:function(){return this._multiple},set:function(t){this._multiple=s.coerceBooleanProperty(t)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"sortable",{get:function(){return this._sortable},set:function(t){this._sortable=s.coerceBooleanProperty(t)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"sortBy",{set:function(e){if(e){var t=this.columns.find(function(t){return t.name===e});if(!t)throw new Error("[sortBy] must be a valid column name");this._sortBy=t}},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"sortByColumn",{get:function(){return this._sortBy},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"sortOrder",{set:function(t){var e=t?t.toUpperCase():"ASC";if("DESC"!==e&&"ASC"!==e)throw new Error("[sortOrder] must be empty, ASC or DESC");this._sortOrder="ASC"===e?R.Ascending:R.Descending},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"sortOrderEnum",{get:function(){return this._sortOrder},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"hasData",{get:function(){return this._data&&0<this._data.length},enumerable:!0,configurable:!0}),E.prototype.ngOnInit=function(){var i=this;this._resizeSubs=this._onResize.asObservable().subscribe(function(){i._rows&&i._rows.toArray().forEach(function(t,e){i._rowHeightCache[i.fromRow+e]=t.height+1}),i._calculateWidths(),i._calculateVirtualRows()}),this._columnResizeSubs=this._onColumnResize.asObservable().pipe(h.debounceTime(0)).subscribe(function(t){i._columnClientX=t,i._calculateWidths(),i._changeDetectorRef.markForCheck()}),this._horizontalScrollSubs=this._onHorizontalScroll.asObservable().subscribe(function(t){i._scrollHorizontalOffset=t,i._changeDetectorRef.markForCheck()}),this._verticalScrollSubs=this._onVerticalScroll.asObservable().subscribe(function(t){i._scrollVerticalOffset=t,i._calculateVirtualRows(),i._changeDetectorRef.markForCheck()}),this._valueChangesSubs=this.valueChanges.subscribe(function(t){i.refresh()})},E.prototype.ngAfterContentInit=function(){for(var t=0;t<this._templates.toArray().length;t++)this._templateMap.set(this._templates.toArray()[t].tdDataTableTemplate,this._templates.toArray()[t].templateRef)},E.prototype.ngAfterContentChecked=function(){var t=this;if(5<this._scrollVerticalOffset-this._scrollableDiv.nativeElement.scrollTop&&this._onVerticalScroll.next(0),this._elementRef.nativeElement){var e=this._elementRef.nativeElement.getBoundingClientRect().width;this._hostWidth!==e&&setTimeout(function(){t._hostWidth=e,t._onResize.next()},0)}if(this._scrollableDiv.nativeElement){var i=this._scrollableDiv.nativeElement.getBoundingClientRect().height;this._hostHeight!==i&&(this._hostHeight=i,this._calculateVirtualRows(),this._changeDetectorRef.markForCheck())}},E.prototype.ngAfterViewInit=function(){var t=this;this._rowsChangedSubs=this._rows.changes.pipe(h.debounceTime(0)).subscribe(function(){t._onResize.next()}),this._calculateVirtualRows()},E.prototype.ngOnDestroy=function(){this._resizeSubs&&this._resizeSubs.unsubscribe(),this._columnResizeSubs&&this._columnResizeSubs.unsubscribe(),this._horizontalScrollSubs&&this._horizontalScrollSubs.unsubscribe(),this._verticalScrollSubs&&this._verticalScrollSubs.unsubscribe(),this._rowsChangedSubs&&this._rowsChangedSubs.unsubscribe(),this._valueChangesSubs&&this._valueChangesSubs.unsubscribe()},E.prototype.handleScroll=function(t){var e=t.target;if(e){var i=e.scrollLeft;this._scrollHorizontalOffset!==i&&this._onHorizontalScroll.next(i);var n=e.scrollTop;this._scrollVerticalOffset!==n&&this._onVerticalScroll.next(n)}},E.prototype.getColumnWidth=function(t){return this._widths[t]?this._widths[t].value:undefined},E.prototype.getCellValue=function(t,e){return t.nested===undefined||t.nested?this._getNestedValue(t.name,e):e[t.name]},E.prototype.getTemplateRef=function(t){return this._templateMap.get(t)},E.prototype.clearModel=function(){this.value.splice(0,this.value.length)},E.prototype.refresh=function(){this._calculateVirtualRows(),this._calculateWidths(),this._calculateCheckboxState(),this._changeDetectorRef.markForCheck()},E.prototype.selectAll=function(t){var n=this,a=[];t?(this._data.forEach(function(t){n.isRowSelected(t)||(n.value.push(t),a.push(t))}),this._allSelected=!0,this._indeterminate=!0):(this._data.forEach(function(e){if(n.isRowSelected(e)){a.push(e);var t=n.value.filter(function(t){return n.compareWith(e,t)})[0],i=n.value.indexOf(t);-1<i&&n.value.splice(i,1)}}),this._allSelected=!1,this._indeterminate=!1),this.onSelectAll.emit({rows:a,selected:t}),this.onChange(this.value)},E.prototype.isRowSelected=function(e){var i=this;return!!this.value&&0<this.value.filter(function(t){return i.compareWith(e,t)}).length},E.prototype.select=function(t,e,i){if(this.selectable){this.blockEvent(e);var n=e;if(this.multiple&&n&&n.shiftKey&&-1<this._lastSelectedIndex){var a=i,r=this._lastSelectedIndex;if(i>this._lastSelectedIndex&&(a=this._lastSelectedIndex,r=i),this._firstSelectedIndex>=i&&this._lastSelectedIndex>this._firstSelectedIndex||this._firstSelectedIndex<=i&&this._lastSelectedIndex<this._firstSelectedIndex)for(var o=a;o<=r;o++)this._firstSelectedIndex!==o&&this._doSelection(this._data[o],o);else if(this._firstSelectedIndex>i||this._firstSelectedIndex<i)for(this._firstSelectedIndex>i?r--:this._firstSelectedIndex<i&&a++,o=a;o<=r;o++){var l=this.isRowSelected(this._data[o]);this._firstCheckboxValue&&!l||!this._firstCheckboxValue&&l?this._doSelection(this._data[o],o):this._shiftPreviouslyPressed&&(i>=this._firstSelectedIndex&&i<=this._lastSelectedIndex||i<=this._firstSelectedIndex&&i>=this._lastSelectedIndex)&&this._doSelection(this._data[o],o)}this._shiftPreviouslyPressed=!0}else n&&!n.shiftKey&&(this._firstCheckboxValue=this._doSelection(t,i),this._shiftPreviouslyPressed=!1,this._firstSelectedIndex=i);this._lastSelectedIndex=i}},E.prototype.disableTextSelection=function(){this._document&&(this._document.onselectstart=function(){return!1})},E.prototype.enableTextSelection=function(){this._document&&(this._document.onselectstart=undefined)},E.prototype.handleRowClick=function(t,e,i){if(this.clickable){var n=i.srcElement||i.currentTarget,a=i.target;null===n.getAttribute("stopRowClick")&&"mat-pseudo-checkbox"!==a.tagName.toLowerCase()&&this.onRowClick.emit({row:t,index:e})}},E.prototype.handleSort=function(t){this._sortBy===t?this._sortOrder=this._sortOrder===R.Ascending?R.Descending:R.Ascending:(this._sortBy=t,this._sortOrder=R.Ascending),this.onSortChange.next({name:this._sortBy.name,order:this._sortOrder})},E.prototype._rowKeyup=function(t,e,i){switch(t.keyCode){case d.ENTER:case d.SPACE:this.selectable&&this._doSelection(this._data[this.fromRow+i],this.fromRow+i);break;case d.UP_ARROW:0<i&&this._rows.toArray()[i-1].focus(),this.blockEvent(t),this.selectable&&this.multiple&&t.shiftKey&&0<=this.fromRow+i&&this._doSelection(this._data[this.fromRow+i],this.fromRow+i);break;case d.DOWN_ARROW:i<this._rows.toArray().length-1&&this._rows.toArray()[i+1].focus(),this.blockEvent(t),this.selectable&&this.multiple&&t.shiftKey&&this.fromRow+i<this._data.length&&this._doSelection(this._data[this.fromRow+i],this.fromRow+i)}},E.prototype._handleStartColumnDrag=function(t,e){this._columnClientX=e.clientX,this._resizingColumn=t},E.prototype._handleColumnDrag=function(t){if(this._resizingColumn!==undefined&&0<t.clientX){var e=t.clientX;if(0<e&&0<this._columnClientX&&e-this._columnClientX!=0){var i=this._widths[this._resizingColumn].value+(e-this._columnClientX);i<this._colElements.toArray()[this._resizingColumn].projectedWidth&&(i=this._colElements.toArray()[this._resizingColumn].projectedWidth),this.columns[this._resizingColumn].width=i,this._onColumnResize.next(e)}}},E.prototype._handleEndColumnDrag=function(){this._columnClientX=undefined,this._resizingColumn=undefined},E.prototype.blockEvent=function(t){t.preventDefault()},E.prototype._getNestedValue=function(t,e){if(!(e instanceof Object&&t))return e;if(-1<t.indexOf(".")){var i=t.split(/\.(.+)/,2);return this._getNestedValue(i[1],e[i[0]])}return e[t]},E.prototype._doSelection=function(e,t){var i=this,n=this.isRowSelected(e);if(n){e=this.value.filter(function(t){return i.compareWith(e,t)})[0];var a=this.value.indexOf(e);-1<a&&this.value.splice(a,1)}else this._multiple||this.clearModel(),this.value.push(e);return this._calculateCheckboxState(),this.onRowSelect.emit({row:e,index:t,selected:!n}),this.onChange(this.value),!n},E.prototype._calculateCheckboxState=function(){var t,e,i=this;if(this._data){this._allSelected=void 0===this._data.find(function(t){return!i.isRowSelected(t)}),this._indeterminate=!1;try{for(var n=function o(t){var e="function"==typeof Symbol&&t[Symbol.iterator],i=0;return e?e.call(t):{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}}}(this._data),a=n.next();!a.done;a=n.next()){var r=a.value;if(this.isRowSelected(r)){this._indeterminate=!0;break}}}catch(l){t={error:l}}finally{try{a&&!a.done&&(e=n["return"])&&e.call(n)}finally{if(t)throw t.error}}}},E.prototype._calculateWidths=function(){var i=this;this._colElements&&this._colElements.length&&(this._widths=[],this._colElements.forEach(function(t,e){i._adjustColumnWidth(e,i._calculateWidth())}),this._adjustColumnWidhts(),this._changeDetectorRef.markForCheck())},E.prototype._adjustColumnWidhts=function(){var i=this,n=0,t=this._widths.filter(function(t,e){return!(i.columns[e].hidden||((t.limit||t.max||t.min)&&(n+=t.value),t.limit||t.max||t.min))}).length,e=0;if(n<this.hostWidth&&(e=this.hostWidth-n),t&&e){var a=Math.floor(e/t),r=0;this._widths.forEach(function(t){(i._widths[t.index].max&&i._widths[t.index].value>a||i._widths[t.index].min&&i._widths[t.index].value<a||!i._widths[t.index].limit)&&(i._adjustColumnWidth(t.index,a),r++)});var o=this._widths.filter(function(t){return!t.limit&&!t.max}).length;o!==r&&o!==t&&this._adjustColumnWidhts()}},E.prototype._adjustColumnWidth=function(t,e){var i=!(this._widths[t]={value:e,index:t,limit:!1,min:!1,max:!1});if(this.columns[t])if("object"==typeof this.columns[t].width){var n=this.columns[t].width;i=n&&!!n.min,n&&n.min>=this._widths[t].value?(this._widths[t].value=n.min,this._widths[t].min=!0):n&&n.max<=this._widths[t].value&&(this._widths[t].value=n.max,this._widths[t].max=!0)}else"number"==typeof this.columns[t].width&&(this._widths[t].value=this.columns[t].width,i=this._widths[t].limit=!0);!i&&this._widths[t].value<this._colElements.toArray()[t].projectedWidth&&(this._widths[t].value=this._colElements.toArray()[t].projectedWidth,this._widths[t].min=!0,this._widths[t].limit=!1)},E.prototype._calculateWidth=function(){var t=this.columns.filter(function(t){return!t.hidden});return Math.floor(this.hostWidth/t.length)},E.prototype._calculateVirtualRows=function(){var i=this,n=0;if(this._data){var a=this._totalHeight=0;this._data.forEach(function(t,e){i._rowHeightCache[e]||(i._rowHeightCache[e]=i._rowHeightCache[0]||48),a+=i._rowHeightCache[e],0<i._scrollVerticalOffset-a&&n++}),this._totalHeight=a;var t=n-2;this._fromRow=0<t?t:0;for(var e=this._hostHeight,r=0;0<e;)e-=this._rowHeightCache[this.fromRow+r],r++;var o=r-1+4+this.fromRow;isFinite(o)&&o>this._data.length?o=this._data.length:isFinite(o)||(o=2),this._toRow=o}else this._totalHeight=0,this._fromRow=0,this._toRow=0;var l=0;if(2<n)for(r=0;r<this.fromRow;r++)l+=this._rowHeightCache[r];this._offsetTransform=this._domSanitizer.bypassSecurityTrustStyle("translateY("+(l-this.totalHeight)+"px)"),this._data&&(this._virtualData=this.data.slice(this.fromRow,this.toRow)),Promise.resolve().then(function(){i._changeDetectorRef.markForCheck()})},E.decorators=[{type:b.Component,args:[{providers:[{provide:l.NG_VALUE_ACCESSOR,useExisting:b.forwardRef(function(){return E}),multi:!0}],selector:"td-data-table",template:'<table td-data-table\n [style.left.px]="columnsLeftScroll"\n [class.mat-selectable]="selectable">\n <thead class="td-data-table-head"\n (dragover)="_handleColumnDrag($event)">\n <tr td-data-table-column-row>\n <th td-data-table-column class="mat-checkbox-column" *ngIf="selectable">\n <mat-checkbox\n #checkBoxAll\n *ngIf="multiple"\n [disabled]="!hasData"\n [indeterminate]="indeterminate && !allSelected && hasData"\n [checked]="allSelected && hasData"\n (click)="blockEvent($event); selectAll(!checkBoxAll.checked)"\n (keyup.enter)="selectAll(!checkBoxAll.checked)"\n (keyup.space)="selectAll(!checkBoxAll.checked)"\n (keydown.space)="blockEvent($event)">\n </mat-checkbox>\n </th>\n <th td-data-table-column\n #columnElement\n *ngFor="let column of columns; let i = index; let last = last"\n [style.min-width.px]="getColumnWidth(i)"\n [style.max-width.px]="getColumnWidth(i)"\n [name]="column.name"\n [numeric]="column.numeric"\n [active]="(column.sortable || sortable) && column === sortByColumn"\n [sortable]="column.sortable || (sortable && column.sortable !== false)"\n [sortOrder]="sortOrderEnum"\n [hidden]="column.hidden"\n (sortChange)="handleSort(column)">\n <span [matTooltip]="column.tooltip">{{column.label}}</span>\n <span td-column-resizer\n *ngIf="resizableColumns"\n draggable="true"\n class="td-data-table-column-resizer"\n [class.td-resizing]="i === resizingColumn"\n (mousedown)="_handleStartColumnDrag(i, $event)"\n (dragstart)="$event?.dataTransfer?.setData(\'text\', \'\')"\n (drag)="_handleColumnDrag($event)"\n (dragend)="_handleEndColumnDrag()"\n (mouseup)="_handleEndColumnDrag()">\n <span class="td-data-table-column-separator"></span>\n </span>\n </th>\n </tr>\n </thead>\n</table>\n<div #scrollableDiv class="td-data-table-scrollable"\n (scroll)="handleScroll($event)">\n <div [style.height.px]="totalHeight"></div>\n <table td-data-table\n [style.transform]="offsetTransform"\n [style.position]="\'absolute\'"\n [class.mat-selectable]="selectable"\n [class.mat-clickable]="clickable">\n <tbody class="td-data-table-body">\n <tr td-data-table-row\n #dtRow\n [tabIndex]="selectable ? 0 : -1"\n [selected]="(clickable || selectable) && isRowSelected(row)"\n *ngFor="let row of virtualData; let rowIndex = index"\n (click)="handleRowClick(row, fromRow + rowIndex, $event)"\n (keyup)="selectable && _rowKeyup($event, row, rowIndex)"\n (keydown.space)="blockEvent($event)"\n (keydown.shift.space)="blockEvent($event)"\n (keydown.shift)="disableTextSelection()"\n (keyup.shift)="enableTextSelection()">\n <td td-data-table-cell class="mat-checkbox-cell" *ngIf="selectable">\n <mat-pseudo-checkbox\n [state]="dtRow.selected ? \'checked\' : \'unchecked\'"\n (mousedown)="disableTextSelection()"\n (mouseup)="enableTextSelection()"\n stopRowClick\n (click)="select(row, $event, fromRow + rowIndex)">\n </mat-pseudo-checkbox>\n </td>\n <td td-data-table-cell\n [numeric]="column.numeric"\n [hidden]="column.hidden"\n *ngFor="let column of columns; let i = index"\n [style.min-width.px]="getColumnWidth(i)"\n [style.max-width.px]="getColumnWidth(i)">\n <span *ngIf="!getTemplateRef(column.name)">{{column.format ? column.format(getCellValue(column, row)) : getCellValue(column, row)}}</span>\n <ng-template\n *ngIf="getTemplateRef(column.name)"\n [ngTemplateOutlet]="getTemplateRef(column.name)"\n [ngTemplateOutletContext]="{ value: getCellValue(column, row), row: row, column: column.name, index: rowIndex }">\n </ng-template>\n </td>\n </tr>\n </tbody>\n </table>\n</div>\n<ng-content></ng-content>\n',inputs:["value"],changeDetection:b.ChangeDetectionStrategy.OnPush,styles:[":host{display:block;overflow:hidden}:host .td-data-table-scrollable{position:relative;overflow:auto;height:calc(100% - 56px)}.td-data-table-column-resizer{right:0;width:6px;cursor:col-resize}.td-data-table-column-resizer,.td-data-table-column-resizer .td-data-table-column-separator{position:absolute;height:100%;top:0}.td-data-table-column-resizer .td-data-table-column-separator{left:2px}.td-data-table-column-resizer.td-resizing{cursor:-webkit-grabbing}table.td-data-table{width:auto!important}table.td-data-table.mat-selectable tbody>tr.td-data-table-row{-webkit-transition:background-color .2s;transition:background-color .2s}table.td-data-table.mat-selectable .td-data-table-column:first-child>.td-data-table-column-content-wrapper,table.td-data-table.mat-selectable td.td-data-table-cell:first-child>.td-data-table-column-content-wrapper,table.td-data-table.mat-selectable th.td-data-table-column:first-child>.td-data-table-column-content-wrapper{width:18px;min-width:18px;padding:0 24px}table.td-data-table.mat-selectable .td-data-table-column:nth-child(2)>.td-data-table-column-content-wrapper,table.td-data-table.mat-selectable td.td-data-table-cell:nth-child(2)>.td-data-table-column-content-wrapper,table.td-data-table.mat-selectable th.td-data-table-column:nth-child(2)>.td-data-table-column-content-wrapper{padding-left:0}[dir=rtl] table.td-data-table.mat-selectable .td-data-table-column:nth-child(2)>.td-data-table-column-content-wrapper,[dir=rtl] table.td-data-table.mat-selectable td.td-data-table-cell:nth-child(2)>.td-data-table-column-content-wrapper,[dir=rtl] table.td-data-table.mat-selectable th.td-data-table-column:nth-child(2)>.td-data-table-column-content-wrapper{padding-right:0;padding-left:28px}table.td-data-table td.mat-checkbox-cell,table.td-data-table th.mat-checkbox-column{min-width:42px;width:42px;font-size:0!important}table.td-data-table td.mat-checkbox-cell mat-pseudo-checkbox,table.td-data-table th.mat-checkbox-column mat-pseudo-checkbox{width:18px;height:18px}::ng-deep table.td-data-table td.mat-checkbox-cell mat-pseudo-checkbox.mat-pseudo-checkbox-checked::after,::ng-deep table.td-data-table th.mat-checkbox-column mat-pseudo-checkbox.mat-pseudo-checkbox-checked::after{width:11px!important;height:4px!important}table.td-data-table td.mat-checkbox-cell mat-checkbox ::ng-deep .mat-checkbox-inner-container,table.td-data-table th.mat-checkbox-column mat-checkbox ::ng-deep .mat-checkbox-inner-container{width:18px;height:18px;margin:0}"]}]}],E.ctorParameters=function(){return[{type:undefined,decorators:[{type:b.Optional},{type:b.Inject,args:[r.DOCUMENT]}]},{type:b.ElementRef},{type:o.DomSanitizer},{type:b.ChangeDetectorRef}]},E.propDecorators={_templates:[{type:b.ContentChildren,args:[v]}],_scrollableDiv:[{type:b.ViewChild,args:["scrollableDiv"]}],_colElements:[{type:b.ViewChildren,args:["columnElement"]}],_rows:[{type:b.ViewChildren,args:[y]}],data:[{type:b.Input,args:["data"]}],columns:[{type:b.Input,args:["columns"]}],resizableColumns:[{type:b.Input,args:["resizableColumns"]}],selectable:[{type:b.Input,args:["selectable"]}],clickable:[{type:b.Input,args:["clickable"]}],multiple:[{type:b.Input,args:["multiple"]}],sortable:[{type:b.Input,args:["sortable"]}],sortBy:[{type:b.Input,args:["sortBy"]}],sortOrder:[{type:b.Input,args:["sortOrder"]}],onSortChange:[{type:b.Output,args:["sortChange"]}],onRowSelect:[{type:b.Output,args:["rowSelect"]}],onRowClick:[{type:b.Output,args:["rowClick"]}],onSelectAll:[{type:b.Output,args:["selectAll"]}],compareWith:[{type:b.Input,args:["compareWith"]}]},E);function E(t,e,i,n){var a=S.call(this,n)||this;return a._document=t,a._elementRef=e,a._domSanitizer=i,a._hostWidth=0,a._resizableColumns=!1,a._columnClientX=0,a._onColumnResize=new c.Subject,a._widths=[],a._onResize=new c.Subject,a._scrollHorizontalOffset=0,a._onHorizontalScroll=new c.Subject,a._onVerticalScroll=new c.Subject,a._rowHeightCache=[],a._totalHeight=0,a._hostHeight=0,a._scrollVerticalOffset=0,a._fromRow=0,a._toRow=0,a._selectable=!1,a._clickable=!1,a._multiple=!0,a._allSelected=!1,a._indeterminate=!1,a._sortable=!1,a._sortOrder=R.Ascending,a._shiftPreviouslyPressed=!1,a._lastSelectedIndex=-1,a._firstSelectedIndex=-1,a._firstCheckboxValue=!1,a._templateMap=new Map,a.onSortChange=new b.EventEmitter,a.onRowSelect=new b.EventEmitter,a.onRowClick=new b.EventEmitter,a.onSelectAll=new b.EventEmitter,a.compareWith=function(t,e){return t===e},a}var j=(Object.defineProperty(T.prototype,"projectedWidth",{get:function(){return this._columnContent&&this._columnContent.nativeElement?this._columnContent.nativeElement.getBoundingClientRect().width:100},enumerable:!0,configurable:!0}),Object.defineProperty(T.prototype,"sortOrder",{set:function(t){var e=t?t.toUpperCase():"ASC";if("DESC"!==e&&"ASC"!==e)throw new Error("[sortOrder] must be empty, ASC or DESC");this._sortOrder="ASC"===e?R.Ascending:R.Descending},enumerable:!0,configurable:!0}),Object.defineProperty(T.prototype,"bindClickable",{get:function(){return this.sortable},enumerable:!0,configurable:!0}),Object.defineProperty(T.prototype,"bingSortable",{get:function(){return this.sortable},enumerable:!0,configurable:!0}),Object.defineProperty(T.prototype,"bindActive",{get:function(){return this.active},enumerable:!0,configurable:!0}),Object.defineProperty(T.prototype,"bindNumeric",{get:function(){return this.numeric},enumerable:!0,configurable:!0}),T.prototype.handleClick=function(){this.sortable&&this.onSortChange.emit({name:this.name,order:this._sortOrder})},T.prototype.isAscending=function(){return this._sortOrder===R.Ascending},T.prototype.isDescending=function(){return this._sortOrder===R.Descending},T.decorators=[{type:b.Component,args:[{selector:"th[td-data-table-column]",template:'<span #columnContent class="td-data-table-heading">\n <mat-icon \n class="td-data-table-sort-icon" \n *ngIf="sortable && numeric"\n [class.mat-asc]="isAscending()"\n [class.mat-desc]="isDescending()">\n arrow_upward\n </mat-icon>\n <span>\n <ng-content></ng-content>\n </span>\n <mat-icon \n class="td-data-table-sort-icon" \n *ngIf="sortable && !numeric"\n [class.mat-asc]="isAscending()"\n [class.mat-desc]="isDescending()">\n arrow_upward\n </mat-icon>\n</span>\n<ng-content select="[td-column-resizer]"></ng-content>\n',styles:[":host{white-space:nowrap;position:relative;padding:0;vertical-align:middle;text-align:left}:host>.td-data-table-heading{padding:0 28px}:host:first-child>.td-data-table-heading{padding-left:24px;padding-right:initial}html[dir=rtl] :host:first-child>.td-data-table-heading{padding-left:initial;unicode-bidi:embed;padding-right:24px;unicode-bidi:embed}body[dir=rtl] :host:first-child>.td-data-table-heading{padding-left:initial;unicode-bidi:embed;padding-right:24px;unicode-bidi:embed}[dir=rtl] :host:first-child>.td-data-table-heading{padding-left:initial;unicode-bidi:embed;padding-right:24px;unicode-bidi:embed}:host:first-child>.td-data-table-heading bdo[dir=rtl]{direction:rtl;unicode-bidi:bidi-override}:host:first-child>.td-data-table-heading bdo[dir=ltr]{direction:ltr;unicode-bidi:bidi-override}:host:last-child>.td-data-table-heading{padding-left:28px;padding-right:24px}html[dir=rtl] :host:last-child>.td-data-table-heading{padding-left:24px;unicode-bidi:embed;padding-right:28px;unicode-bidi:embed}body[dir=rtl] :host:last-child>.td-data-table-heading{padding-left:24px;unicode-bidi:embed;padding-right:28px;unicode-bidi:embed}[dir=rtl] :host:last-child>.td-data-table-heading{padding-left:24px;unicode-bidi:embed;padding-right:28px;unicode-bidi:embed}:host:last-child>.td-data-table-heading bdo[dir=rtl]{direction:rtl;unicode-bidi:bidi-override}:host:last-child>.td-data-table-heading bdo[dir=ltr]{direction:ltr;unicode-bidi:bidi-override}:host mat-icon{height:16px;width:16px;font-size:16px!important;line-height:16px!important}:host mat-icon.td-data-table-sort-icon{opacity:0;-webkit-transition:-webkit-transform .25s;transition:transform .25s;transition:transform .25s,-webkit-transform .25s;position:absolute;top:0}:host mat-icon.td-data-table-sort-icon.mat-asc{-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0)}:host mat-icon.td-data-table-sort-icon.mat-desc{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}:host.mat-active.mat-sortable mat-icon.td-data-table-sort-icon,:host:hover.mat-sortable mat-icon.td-data-table-sort-icon{opacity:1}html[dir=rtl] :host{text-align:right;unicode-bidi:embed}body[dir=rtl] :host{text-align:right;unicode-bidi:embed}[dir=rtl] :host{text-align:right;unicode-bidi:embed}:host bdo[dir=rtl]{direction:rtl;unicode-bidi:bidi-override}:host bdo[dir=ltr]{direction:ltr;unicode-bidi:bidi-override}:host>*{vertical-align:middle}:host.mat-clickable{cursor:pointer}:host.mat-clickable:focus{outline:0}:host .td-data-table-heading{display:inline-block;position:relative}:host.mat-numeric{text-align:right}html[dir=rtl] :host.mat-numeric{text-align:left;unicode-bidi:embed}body[dir=rtl] :host.mat-numeric{text-align:left;unicode-bidi:embed}[dir=rtl] :host.mat-numeric{text-align:left;unicode-bidi:embed}:host.mat-numeric bdo[dir=rtl]{direction:rtl;unicode-bidi:bidi-override}:host.mat-numeric bdo[dir=ltr]{direction:ltr;unicode-bidi:bidi-override}:host.mat-numeric mat-icon.td-data-table-sort-icon{margin-left:-22px;margin-right:initial}html[dir=rtl] :host.mat-numeric mat-icon.td-data-table-sort-icon{margin-left:initial;unicode-bidi:embed;margin-right:-22px;unicode-bidi:embed}body[dir=rtl] :host.mat-numeric mat-icon.td-data-table-sort-icon{margin-left:initial;unicode-bidi:embed;margin-right:-22px;unicode-bidi:embed}[dir=rtl] :host.mat-numeric mat-icon.td-data-table-sort-icon{margin-left:initial;unicode-bidi:embed;margin-right:-22px;unicode-bidi:embed}:host.mat-numeric mat-icon.td-data-table-sort-icon bdo[dir=rtl]{direction:rtl;unicode-bidi:bidi-override}:host.mat-numeric mat-icon.td-data-table-sort-icon bdo[dir=ltr]{direction:ltr;unicode-bidi:bidi-override}:host:not(.mat-numeric) mat-icon.td-data-table-sort-icon{margin-left:6px;margin-right:initial}html[dir=rtl] :host:not(.mat-numeric) mat-icon.td-data-table-sort-icon{margin-left:initial;unicode-bidi:embed;margin-right:6px;unicode-bidi:embed}body[dir=rtl] :host:not(.mat-numeric) mat-icon.td-data-table-sort-icon{margin-left:initial;unicode-bidi:embed;margin-right:6px;unicode-bidi:embed}[dir=rtl] :host:not(.mat-numeric) mat-icon.td-data-table-sort-icon{margin-left:initial;unicode-bidi:embed;margin-right:6px;unicode-bidi:embed}:host:not(.mat-numeric) mat-icon.td-data-table-sort-icon bdo[dir=rtl]{direction:rtl;unicode-bidi:bidi-override}:host:not(.mat-numeric) mat-icon.td-data-table-sort-icon bdo[dir=ltr]{direction:ltr;unicode-bidi:bidi-override}"]}]}],T.ctorParameters=function(){return[{type:b.ElementRef},{type:b.Renderer2}]},T.propDecorators={_columnContent:[{type:b.ViewChild,args:["columnContent",{read:b.ElementRef}]}],name:[{type:b.Input,args:["name"]}],sortable:[{type:b.Input,args:["sortable"]}],active:[{type:b.Input,args:["active"]}],numeric:[{type:b.Input,args:["numeric"]}],sortOrder:[{type:b.Input,args:["sortOrder"]}],onSortChange:[{type:b.Output,args:["sortChange"]}],bindClickable:[{type:b.HostBinding,args:["class.mat-clickable"]}],bingSortable:[{type:b.HostBinding,args:["class.mat-sortable"]}],bindActive:[{type:b.HostBinding,args:["class.mat-active"]}],bindNumeric:[{type:b.HostBinding,args:["class.mat-numeric"]}],handleClick:[{type:b.HostListener,args:["click"]}]},T);function T(t,e){this._elementRef=t,this._renderer=e,this._sortOrder=R.Ascending,this.name="",this.sortable=!1,this.active=!1,this.numeric=!1,this.onSortChange=new b.EventEmitter,this._renderer.addClass(this._elementRef.nativeElement,"td-data-table-column")}var A=(Object.defineProperty(I.prototype,"align",{get:function(){return this._align},set:function(t){this._align=t},enumerable:!0,configurable:!0}),Object.defineProperty(I.prototype,"bindNumeric",{get:function(){return this.numeric},enumerable:!0,configurable:!0}),I.decorators=[{type:b.Component,args:[{selector:"td[td-data-table-cell]",template:'<div class="td-data-table-cell-content-wrapper"\n [class.td-data-table-cell-numeric]="numeric"\n [class.td-data-table-cell-align-center]="align === \'center\'"\n [class.td-data-table-cell-align-end]="align === \'end\'"\n [class.td-data-table-cell-align-start]="align === \'start\'"\n >\n <ng-content></ng-content>\n</div>',styles:[":host{vertical-align:middle;text-align:left;padding:0}html[dir=rtl] :host{text-align:right;unicode-bidi:embed}body[dir=rtl] :host{text-align:right;unicode-bidi:embed}[dir=rtl] :host{text-align:right;unicode-bidi:embed}:host bdo[dir=rtl]{direction:rtl;unicode-bidi:bidi-override}:host bdo[dir=ltr]{direction:ltr;unicode-bidi:bidi-override}:host>.td-data-table-cell-content-wrapper{padding:0 28px;-webkit-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-ms-flex-line-pack:center;align-content:center;max-width:100%;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}:host>.td-data-table-cell-content-wrapper.td-data-table-cell-numeric{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}:host>.td-data-table-cell-content-wrapper.td-data-table-cell-align-start{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}:host>.td-data-table-cell-content-wrapper.td-data-table-cell-align-end{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}:host>.td-data-table-cell-content-wrapper.td-data-table-cell-align-center{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}:host:first-child>.td-data-table-cell-content-wrapper{padding-left:24px;padding-right:initial}html[dir=rtl] :host:first-child>.td-data-table-cell-content-wrapper{padding-left:initial;unicode-bidi:embed;padding-right:24px;unicode-bidi:embed}body[dir=rtl] :host:first-child>.td-data-table-cell-content-wrapper{padding-left:initial;unicode-bidi:embed;padding-right:24px;unicode-bidi:embed}[dir=rtl] :host:first-child>.td-data-table-cell-content-wrapper{padding-left:initial;unicode-bidi:embed;padding-right:24px;unicode-bidi:embed}:host:first-child>.td-data-table-cell-content-wrapper bdo[dir=rtl]{direction:rtl;unicode-bidi:bidi-override}:host:first-child>.td-data-table-cell-content-wrapper bdo[dir=ltr]{direction:ltr;unicode-bidi:bidi-override}:host:last-child>.td-data-table-cell-content-wrapper{padding-left:28px;padding-right:24px}html[dir=rtl] :host:last-child>.td-data-table-cell-content-wrapper{padding-left:24px;unicode-bidi:embed;padding-right:28px;unicode-bidi:embed}body[dir=rtl] :host:last-child>.td-data-table-cell-content-wrapper{padding-left:24px;unicode-bidi:embed;padding-right:28px;unicode-bidi:embed}[dir=rtl] :host:last-child>.td-data-table-cell-content-wrapper{padding-left:24px;unicode-bidi:embed;padding-right:28px;unicode-bidi:embed}:host:last-child>.td-data-table-cell-content-wrapper bdo[dir=rtl]{direction:rtl;unicode-bidi:bidi-override}:host:last-child>.td-data-table-cell-content-wrapper bdo[dir=ltr]{direction:ltr;unicode-bidi:bidi-override}:host>*{vertical-align:middle}:host.mat-clickable{cursor:pointer}:host.mat-clickable:focus{outline:0}:host.mat-numeric{text-align:right}html[dir=rtl] :host.mat-numeric{text-align:left;unicode-bidi:embed}body[dir=rtl] :host.mat-numeric{text-align:left;unicode-bidi:embed}[dir=rtl] :host.mat-numeric{text-align:left;unicode-bidi:embed}:host.mat-numeric bdo[dir=rtl]{direction:rtl;unicode-bidi:bidi-override}:host.mat-numeric bdo[dir=ltr]{direction:ltr;unicode-bidi:bidi-override}"]}]}],I.ctorParameters=function(){return[{type:b.ElementRef},{type:b.Renderer2}]},I.propDecorators={numeric:[{type:b.Input,args:["numeric"]}],align:[{type:b.Input}],bindNumeric:[{type:b.HostBinding,args:["class.mat-numeric"]}]},I);function I(t,e){this._elementRef=t,this._renderer=e,this.numeric=!1,this._renderer.addClass(this._elementRef.nativeElement,"td-data-table-cell")}var P=(z.decorators=[{type:b.Component,args:[{selector:"table[td-data-table]",template:"<ng-content></ng-content>",styles:[":host{width:100%;position:relative;border-spacing:0;overflow:hidden;border-collapse:collapse}"]}]}],z.ctorParameters=function(){return[{type:b.ElementRef},{type:b.Renderer2}]},z);function z(t,e){this._elementRef=t,this._renderer=e,this._renderer.addClass(this._elementRef.nativeElement,"td-data-table")}var W=(V.prototype.filterData=function(t,e,n,a){void 0===n&&(n=!1);var r=e?n?e.toLowerCase():e:"";return r&&(t=t.filter(function(i){return!(void 0===Object.keys(i).find(function(t){if(!a||-1===a.indexOf(t)){var e=""+i[t];return-1<(n?e.toLowerCase():e).indexOf(r)}}))})),t},V.prototype.sortData=function(t,r,o){return void 0===o&&(o=R.Ascending),r&&(t=Array.from(t)).sort(function(t,e){var i=t[r],n=e[r],a=0;return Number.isNaN(Number.parseFloat(i))||Number.isNaN(Number.parseFloat(n))?i<n?a=-1:n<i&&(a=1):a=Number.parseFloat(i)-Number.parseFloat(n),a*(o===R.Descending?-1:1)}),t},V.prototype.pageData=function(t,e,i){return 1<=e&&(t=t.slice(e-1,i)),t},V.decorators=[{type:b.Injectable}],V);function V(){}function H(t){return t||new W}var B={provide:W,deps:[[new b.Optional,new b.SkipSelf,W]],useFactory:H},N=[D,v,j,A,y,g,P],M=(F.decorators=[{type:b.NgModule,args:[{imports:[r.CommonModule,e.MatCheckboxModule,i.MatTooltipModule,n.MatIconModule,a.MatPseudoCheckboxModule],declarations:[N],exports:[N],providers:[B]}]}],F);function F(){}t.CovalentDataTableModule=M,t.TdDataTableSortingOrder=R,t.TdDataTableBase=k,t._TdDataTableMixinBase=O,t.TdDataTableComponent=D,t.TdDataTableCellComponent=A,t.TdDataTableColumnComponent=j,t.TdDataTableColumnRowComponent=g,t.TdDataTableRowComponent=y,t.TdDataTableTableComponent=P,t.TdDataTableTemplateDirective=v,t.DATA_TABLE_PROVIDER_FACTORY=H,t.TdDataTableService=W,t.DATA_TABLE_PROVIDER=B,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=covalent-core-data-table.umd.min.js.map