Browse Source

fix: avoid ng-packagr error by mocking Document type

pull/5326/head
Arman Ozak 6 years ago
parent
commit
8e2cd0e5b9
  1. 17
      npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-default.directive.ts

17
npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-default.directive.ts

@ -21,7 +21,7 @@ export class NgxDatatableDefaultDirective implements AfterViewInit, OnDestroy {
return `ngx-datatable ${this.class}`;
}
constructor(private table: DatatableComponent, @Inject(DOCUMENT) private document: Document) {
constructor(private table: DatatableComponent, @Inject(DOCUMENT) private document: MockDocument) {
this.table.columnMode = ColumnMode.force;
this.table.footerHeight = 50;
this.table.headerHeight = 50;
@ -67,3 +67,18 @@ export class NgxDatatableDefaultDirective implements AfterViewInit, OnDestroy {
this.subscription.unsubscribe();
}
}
// fix: https://github.com/angular/angular/issues/20351
interface MockDocument {
body: MockBody;
documentElement: MockDocumentElement;
}
interface MockBody {
offsetWidth: number;
}
interface MockDocumentElement {
clientHeight: number;
scrollHeight: number;
}

Loading…
Cancel
Save