diff --git a/npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-list.directive.ts b/npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-list.directive.ts index 0f603e0eaa..c10df704cc 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-list.directive.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-list.directive.ts @@ -10,7 +10,7 @@ import { OnInit, SimpleChanges, } from '@angular/core'; -import { DatatableComponent } from '@swimlane/ngx-datatable'; +import { ColumnMode, DatatableComponent } from '@swimlane/ngx-datatable'; import { Subscription } from 'rxjs'; @Directive({ @@ -22,26 +22,25 @@ export class NgxDatatableListDirective implements OnChanges, OnDestroy, OnInit { /* tslint:disable-next-line:no-input-rename */ @Input('abpList') list: ListService; - @Input() columnMode: 'standard' | 'flex' | 'force' = 'force'; - @Input() externalPaging = true; - @Input() externalSorting = true; - @Input() footerHeight = 50; - @Input() headerHeight = 50; - @Input() rowHeight: Function | number | 'auto' | undefined = 'auto'; - @HostBinding() @Input() class = 'ngx-datatable material bordered'; + @Input() class = 'material bordered'; - constructor( - @Host() private cdRef: ChangeDetectorRef, - @Host() private table: DatatableComponent, - ) {} + @HostBinding('class') + get classes(): string { + return `ngx-datatable ${this.class}`; + } - ngOnChanges({ list, ...changes }: SimpleChanges) { - if (!(list && list.firstChange)) return; + constructor(@Host() private cdRef: ChangeDetectorRef, @Host() private table: DatatableComponent) { + this.table.columnMode = ColumnMode.force; + this.table.externalPaging = true; + this.table.externalSorting = true; + this.table.footerHeight = 50; + this.table.headerHeight = 50; + this.table.rowHeight = 'auto'; + } - ['columnMode', 'externalPaging', 'externalSorting', 'footerHeight', 'headerHeight', 'rowHeight'] - .filter(key => Object.keys(changes).indexOf(key) < 0) - .forEach(key => (this.table[key] = this[key])); + ngOnChanges({ list }: SimpleChanges) { + if (!(list && list.firstChange)) return; const { maxResultCount, page } = list.currentValue; this.table.limit = maxResultCount;