[ADF-2589] conditional visibility for DL/DT components (#3223)

* watch data columns and update layout if needed

* update docs

* support DataTable, docs and tests
This commit is contained in:
Denys Vuika
2018-04-24 10:06:32 +01:00
committed by Eugenio Romano
parent 382ea3c1b3
commit edee2f12b6
9 changed files with 112 additions and 15 deletions

View File

@@ -231,8 +231,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
private _pagination: BehaviorSubject<PaginationModel>;
private layoutPresets = {};
private contextActionHandlerSubscription: Subscription;
private subscriptions: Subscription[] = [];
constructor(private documentListService: DocumentListService,
private ngZone: NgZone,
@@ -342,12 +341,25 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
this.data.setImageResolver(this.imageResolver);
}
this.contextActionHandlerSubscription = this.contextActionHandler.subscribe(val => this.contextActionCallback(val));
this.subscriptions.push(
this.contextActionHandler.subscribe(val => this.contextActionCallback(val))
);
this.enforceSingleClickNavigationForMobile();
}
ngAfterContentInit() {
if (this.columnList) {
this.subscriptions.push(
this.columnList.columns.changes.subscribe(() => {
this.setTableSchema();
})
);
}
this.setTableSchema();
}
private setTableSchema() {
let schema: DataColumn[] = [];
if (this.hasCustomLayout) {
@@ -770,10 +782,8 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
}
ngOnDestroy() {
if (this.contextActionHandlerSubscription) {
this.contextActionHandlerSubscription.unsubscribe();
this.contextActionHandlerSubscription = null;
}
this.subscriptions.forEach(s => s.unsubscribe());
this.subscriptions = [];
}
private handleError(err: any) {