UI: Fixed display columns without sources
This commit is contained in:
parent
dd900dafba
commit
9fceba291c
@ -388,9 +388,11 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
|
|||||||
this.sources.push(source);
|
this.sources.push(source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.prepareDisplayedColumn();
|
if (this.sources.length) {
|
||||||
this.sources[this.sourceIndex].displayedColumns =
|
this.prepareDisplayedColumn();
|
||||||
this.displayedColumns[this.sourceIndex].filter(value => value.display).map(value => value.def);
|
this.sources[this.sourceIndex].displayedColumns =
|
||||||
|
this.displayedColumns[this.sourceIndex].filter(value => value.display).map(value => value.def);
|
||||||
|
}
|
||||||
this.updateActiveEntityInfo();
|
this.updateActiveEntityInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,48 +400,50 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
|
|||||||
if ($event) {
|
if ($event) {
|
||||||
$event.stopPropagation();
|
$event.stopPropagation();
|
||||||
}
|
}
|
||||||
const target = $event.target || $event.currentTarget;
|
if (this.sources.length) {
|
||||||
const config = new OverlayConfig();
|
const target = $event.target || $event.currentTarget;
|
||||||
config.backdropClass = 'cdk-overlay-transparent-backdrop';
|
const config = new OverlayConfig();
|
||||||
config.hasBackdrop = true;
|
config.backdropClass = 'cdk-overlay-transparent-backdrop';
|
||||||
const connectedPosition: ConnectedPosition = {
|
config.hasBackdrop = true;
|
||||||
originX: 'end',
|
const connectedPosition: ConnectedPosition = {
|
||||||
originY: 'bottom',
|
originX: 'end',
|
||||||
overlayX: 'end',
|
originY: 'bottom',
|
||||||
overlayY: 'top'
|
overlayX: 'end',
|
||||||
};
|
overlayY: 'top'
|
||||||
config.positionStrategy = this.overlay.position().flexibleConnectedTo(target as HTMLElement)
|
};
|
||||||
.withPositions([connectedPosition]);
|
config.positionStrategy = this.overlay.position().flexibleConnectedTo(target as HTMLElement)
|
||||||
|
.withPositions([connectedPosition]);
|
||||||
|
|
||||||
const overlayRef = this.overlay.create(config);
|
const overlayRef = this.overlay.create(config);
|
||||||
overlayRef.backdropClick().subscribe(() => {
|
overlayRef.backdropClick().subscribe(() => {
|
||||||
overlayRef.dispose();
|
overlayRef.dispose();
|
||||||
});
|
});
|
||||||
const source = this.sources[this.sourceIndex];
|
const source = this.sources[this.sourceIndex];
|
||||||
|
|
||||||
this.prepareDisplayedColumn();
|
this.prepareDisplayedColumn();
|
||||||
|
|
||||||
const providers: StaticProvider[] = [
|
const providers: StaticProvider[] = [
|
||||||
{
|
{
|
||||||
provide: DISPLAY_COLUMNS_PANEL_DATA,
|
provide: DISPLAY_COLUMNS_PANEL_DATA,
|
||||||
useValue: {
|
useValue: {
|
||||||
columns: this.displayedColumns[this.sourceIndex],
|
columns: this.displayedColumns[this.sourceIndex],
|
||||||
columnsUpdated: (newColumns) => {
|
columnsUpdated: (newColumns) => {
|
||||||
source.displayedColumns = newColumns.filter(value => value.display).map(value => value.def);
|
source.displayedColumns = newColumns.filter(value => value.display).map(value => value.def);
|
||||||
this.clearCache();
|
this.clearCache();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provide: OverlayRef,
|
||||||
|
useValue: overlayRef
|
||||||
}
|
}
|
||||||
},
|
];
|
||||||
{
|
|
||||||
provide: OverlayRef,
|
|
||||||
useValue: overlayRef
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
const injector = Injector.create({parent: this.viewContainerRef.injector, providers});
|
const injector = Injector.create({parent: this.viewContainerRef.injector, providers});
|
||||||
overlayRef.attach(new ComponentPortal(DisplayColumnsPanelComponent,
|
overlayRef.attach(new ComponentPortal(DisplayColumnsPanelComponent,
|
||||||
this.viewContainerRef, injector));
|
this.viewContainerRef, injector));
|
||||||
this.ctx.detectChanges();
|
this.ctx.detectChanges();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private prepareDisplayedColumn() {
|
private prepareDisplayedColumn() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user