Fixed build issues

This commit is contained in:
Zakary Timson 2018-06-26 21:18:00 -04:00
parent 87ada25580
commit b53936a0e1
2 changed files with 10 additions and 10 deletions

View File

@ -3,7 +3,7 @@
<col *ngIf="showCheckbox && selectionMode !== null" width="30px"> <col *ngIf="showCheckbox && selectionMode !== null" width="30px">
<col *ngIf="expandedTemplate" width="30px"> <col *ngIf="expandedTemplate" width="30px">
<ng-container *ngFor="let c of columns"> <ng-container *ngFor="let c of columns">
<col *ngIf="c.hide !== true && !(c.hideMobile === true && width < mobileBreakpoint)" span="1" [width]="convertWidth(c.width)"> <col *ngIf="c.hide !== true && !(c.hideMobile === true && width < mobileBreakpoint)" span="1" [width]="_convertWidth(c.width)">
</ng-container> </ng-container>
</colgroup> </colgroup>
<thead> <thead>
@ -35,7 +35,7 @@
<td *ngIf="c.hide !== true && !(c.hideMobile === true && width < mobileBreakpoint)"> <td *ngIf="c.hide !== true && !(c.hideMobile === true && width < mobileBreakpoint)">
<ng-template #defaultTemplate let-value="value">{{value}}</ng-template> <ng-template #defaultTemplate let-value="value">{{value}}</ng-template>
<ng-template [ngTemplateOutlet]="c.template || defaultTemplate" <ng-template [ngTemplateOutlet]="c.template || defaultTemplate"
[ngTemplateOutletContext]="{object: row, value: dotNotation(row, c.property)}"> [ngTemplateOutletContext]="{object: row, value: _dotNotation(row, c.property)}">
</ng-template> </ng-template>
</td> </td>
</ng-container> </ng-container>

View File

@ -40,7 +40,7 @@ export class NgDatatableComponent implements OnInit {
get data(): any[] { return this.processedData; } // Return the processed data get data(): any[] { return this.processedData; } // Return the processed data
@Input() set data(data: any[]) { @Input() set data(data: any[]) {
this._data = data; this._data = data;
this.process(); this._process();
} }
// =================================================================================================================== // ===================================================================================================================
@ -57,7 +57,7 @@ export class NgDatatableComponent implements OnInit {
} }
// Helpers =========================================================================================================== // Helpers ===========================================================================================================
private process() { private _process() {
this.clearSelected(); this.clearSelected();
this.processedData = this._data; this.processedData = this._data;
this.filters.forEach(f => this.processedData = this.processedData.filter(f)); this.filters.forEach(f => this.processedData = this.processedData.filter(f));
@ -82,31 +82,31 @@ export class NgDatatableComponent implements OnInit {
} }
} }
protected convertWidth(width) { _convertWidth(width) {
if(typeof width == 'number') return `${width}px`; if(typeof width == 'number') return `${width}px`;
return width; return width;
} }
protected dotNotation(obj: object, prop: string) { _dotNotation(obj: object, prop: string) {
return prop.split('.').reduce((obj, prop) => obj[prop], obj); return prop.split('.').reduce((obj, prop) => obj[prop], obj);
} }
addFilter(...filters: ((row?: any, index?: number, arr?: any[]) => boolean)[]) { addFilter(...filters: ((row?: any, index?: number, arr?: any[]) => boolean)[]) {
this.filters = this.filters.concat(filters); this.filters = this.filters.concat(filters);
this.process(); this._process();
this.filterChanged.emit(this.filters); this.filterChanged.emit(this.filters);
} }
changePage(page: number) { changePage(page: number) {
if(!this.paginate || page < 1 || page > this.pages.length) return; if(!this.paginate || page < 1 || page > this.pages.length) return;
this.page = page; this.page = page;
this.process(); this._process();
this.pageChanged.emit(this.page); this.pageChanged.emit(this.page);
} }
clearFilters(update=true) { clearFilters(update=true) {
this.filters = []; this.filters = [];
if(update) this.process(); if(update) this._process();
this.filterChanged.emit(this.filters); this.filterChanged.emit(this.filters);
} }
@ -137,7 +137,7 @@ export class NgDatatableComponent implements OnInit {
this.sortedDesc = desc; this.sortedDesc = desc;
// Preform sort // Preform sort
this.process(); this._process();
} }
updateSelected(index: number) { updateSelected(index: number) {