|
|
@ -19,9 +19,11 @@ import { |
|
|
Component, |
|
|
Component, |
|
|
ElementRef, |
|
|
ElementRef, |
|
|
EventEmitter, |
|
|
EventEmitter, |
|
|
|
|
|
Injector, |
|
|
Input, |
|
|
Input, |
|
|
NgZone, |
|
|
NgZone, |
|
|
OnInit, |
|
|
OnInit, |
|
|
|
|
|
StaticProvider, |
|
|
ViewChild, |
|
|
ViewChild, |
|
|
ViewContainerRef |
|
|
ViewContainerRef |
|
|
} from '@angular/core'; |
|
|
} from '@angular/core'; |
|
|
@ -64,7 +66,7 @@ import { |
|
|
widthStyle |
|
|
widthStyle |
|
|
} from '@home/components/widget/lib/table-widget.models'; |
|
|
} from '@home/components/widget/lib/table-widget.models'; |
|
|
import { ConnectedPosition, Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay'; |
|
|
import { ConnectedPosition, Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay'; |
|
|
import { ComponentPortal, PortalInjector } from '@angular/cdk/portal'; |
|
|
import { ComponentPortal } from '@angular/cdk/portal'; |
|
|
import { |
|
|
import { |
|
|
DISPLAY_COLUMNS_PANEL_DATA, |
|
|
DISPLAY_COLUMNS_PANEL_DATA, |
|
|
DisplayColumnsPanelComponent, |
|
|
DisplayColumnsPanelComponent, |
|
|
@ -452,20 +454,26 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit, |
|
|
}; |
|
|
}; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const injectionTokens = new WeakMap<any, any>([ |
|
|
const providers: StaticProvider[] = [ |
|
|
[DISPLAY_COLUMNS_PANEL_DATA, { |
|
|
{ |
|
|
columns, |
|
|
provide: DISPLAY_COLUMNS_PANEL_DATA, |
|
|
columnsUpdated: (newColumns) => { |
|
|
useValue: { |
|
|
this.displayedColumns = newColumns.filter(column => column.display).map(column => column.def); |
|
|
columns, |
|
|
if (this.enableSelection) { |
|
|
columnsUpdated: (newColumns) => { |
|
|
this.displayedColumns.unshift('select'); |
|
|
this.displayedColumns = newColumns.filter(column => column.display).map(column => column.def); |
|
|
|
|
|
if (this.enableSelection) { |
|
|
|
|
|
this.displayedColumns.unshift('select'); |
|
|
|
|
|
} |
|
|
|
|
|
this.displayedColumns.push('actions'); |
|
|
} |
|
|
} |
|
|
this.displayedColumns.push('actions'); |
|
|
} as DisplayColumnsPanelData |
|
|
} |
|
|
}, |
|
|
} as DisplayColumnsPanelData], |
|
|
{ |
|
|
[OverlayRef, overlayRef] |
|
|
provide: OverlayRef, |
|
|
]); |
|
|
useValue: overlayRef |
|
|
const injector = new PortalInjector(this.viewContainerRef.injector, injectionTokens); |
|
|
} |
|
|
|
|
|
]; |
|
|
|
|
|
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(); |
|
|
@ -492,15 +500,21 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit, |
|
|
overlayRef.backdropClick().subscribe(() => { |
|
|
overlayRef.backdropClick().subscribe(() => { |
|
|
overlayRef.dispose(); |
|
|
overlayRef.dispose(); |
|
|
}); |
|
|
}); |
|
|
const injectionTokens = new WeakMap<any, any>([ |
|
|
const providers: StaticProvider[] = [ |
|
|
[ALARM_FILTER_PANEL_DATA, { |
|
|
{ |
|
|
statusList: this.pageLink.statusList, |
|
|
provide: ALARM_FILTER_PANEL_DATA, |
|
|
severityList: this.pageLink.severityList, |
|
|
useValue: { |
|
|
typeList: this.pageLink.typeList |
|
|
statusList: this.pageLink.statusList, |
|
|
} as AlarmFilterPanelData], |
|
|
severityList: this.pageLink.severityList, |
|
|
[OverlayRef, overlayRef] |
|
|
typeList: this.pageLink.typeList |
|
|
]); |
|
|
} as AlarmFilterPanelData |
|
|
const injector = new PortalInjector(this.viewContainerRef.injector, injectionTokens); |
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
provide: OverlayRef, |
|
|
|
|
|
useValue: overlayRef |
|
|
|
|
|
} |
|
|
|
|
|
]; |
|
|
|
|
|
const injector = Injector.create({parent: this.viewContainerRef.injector, providers}); |
|
|
const componentRef = overlayRef.attach(new ComponentPortal(AlarmFilterPanelComponent, |
|
|
const componentRef = overlayRef.attach(new ComponentPortal(AlarmFilterPanelComponent, |
|
|
this.viewContainerRef, injector)); |
|
|
this.viewContainerRef, injector)); |
|
|
componentRef.onDestroy(() => { |
|
|
componentRef.onDestroy(() => { |
|
|
|