|
|
|
@ -56,7 +56,7 @@ import cssjs from '@core/css/css'; |
|
|
|
import { PageLink } from '@shared/models/page/page-link'; |
|
|
|
import { Direction, SortOrder, sortOrderFromString } from '@shared/models/page/sort-order'; |
|
|
|
import { CollectionViewer, DataSource } from '@angular/cdk/collections'; |
|
|
|
import { BehaviorSubject, merge, Observable, of, Subject, Subscription } from 'rxjs'; |
|
|
|
import { BehaviorSubject, fromEvent, merge, Observable, of, Subject, Subscription } from 'rxjs'; |
|
|
|
import { emptyPageData, PageData } from '@shared/models/page/page-data'; |
|
|
|
import { catchError, debounceTime, distinctUntilChanged, map, skip, startWith, takeUntil } from 'rxjs/operators'; |
|
|
|
import { MatPaginator } from '@angular/material/paginator'; |
|
|
|
@ -81,7 +81,7 @@ import { |
|
|
|
TableWidgetDataKeySettings, |
|
|
|
TableWidgetSettings |
|
|
|
} from '@home/components/widget/lib/table-widget.models'; |
|
|
|
import { ConnectedPosition, Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay'; |
|
|
|
import { Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay'; |
|
|
|
import { SubscriptionEntityInfo } from '@core/api/widget-api.models'; |
|
|
|
import { DatePipe } from '@angular/common'; |
|
|
|
import { coerceBooleanProperty } from '@angular/cdk/coercion'; |
|
|
|
@ -93,6 +93,7 @@ import { |
|
|
|
} from '@home/components/widget/lib/display-columns-panel.component'; |
|
|
|
import { ComponentPortal } from '@angular/cdk/portal'; |
|
|
|
import { FormBuilder } from '@angular/forms'; |
|
|
|
import { DEFAULT_OVERLAY_POSITIONS } from '@shared/models/overlay.models'; |
|
|
|
|
|
|
|
export interface TimeseriesTableWidgetSettings extends TableWidgetSettings { |
|
|
|
showTimestamp: boolean; |
|
|
|
@ -411,23 +412,23 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI |
|
|
|
$event.stopPropagation(); |
|
|
|
} |
|
|
|
if (this.sources.length) { |
|
|
|
const target = $event.target || $event.currentTarget; |
|
|
|
const config = new OverlayConfig(); |
|
|
|
config.backdropClass = 'cdk-overlay-transparent-backdrop'; |
|
|
|
config.hasBackdrop = true; |
|
|
|
const connectedPosition: ConnectedPosition = { |
|
|
|
originX: 'end', |
|
|
|
originY: 'bottom', |
|
|
|
overlayX: 'end', |
|
|
|
overlayY: 'top' |
|
|
|
}; |
|
|
|
config.positionStrategy = this.overlay.position().flexibleConnectedTo(target as HTMLElement) |
|
|
|
.withPositions([connectedPosition]); |
|
|
|
const target = $event.target || $event.srcElement || $event.currentTarget; |
|
|
|
const config = new OverlayConfig({ |
|
|
|
panelClass: 'tb-display-columns', |
|
|
|
backdropClass: 'cdk-overlay-transparent-backdrop', |
|
|
|
hasBackdrop: true, |
|
|
|
height: 'fit-content', |
|
|
|
maxHeight: '75vh' |
|
|
|
}); |
|
|
|
config.positionStrategy = this.overlay.position() |
|
|
|
.flexibleConnectedTo(target as HTMLElement) |
|
|
|
.withPositions(DEFAULT_OVERLAY_POSITIONS); |
|
|
|
|
|
|
|
const overlayRef = this.overlay.create(config); |
|
|
|
overlayRef.backdropClick().subscribe(() => { |
|
|
|
overlayRef.dispose(); |
|
|
|
}); |
|
|
|
|
|
|
|
const source = this.sources[this.sourceIndex]; |
|
|
|
|
|
|
|
this.prepareDisplayedColumn(); |
|
|
|
@ -450,8 +451,16 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI |
|
|
|
]; |
|
|
|
|
|
|
|
const injector = Injector.create({parent: this.viewContainerRef.injector, providers}); |
|
|
|
overlayRef.attach(new ComponentPortal(DisplayColumnsPanelComponent, |
|
|
|
const componentRef = overlayRef.attach(new ComponentPortal(DisplayColumnsPanelComponent, |
|
|
|
this.viewContainerRef, injector)); |
|
|
|
|
|
|
|
const resizeWindows$ = fromEvent(window, 'resize').subscribe(() => { |
|
|
|
overlayRef.updatePosition(); |
|
|
|
}); |
|
|
|
componentRef.onDestroy(() => { |
|
|
|
resizeWindows$.unsubscribe(); |
|
|
|
}); |
|
|
|
|
|
|
|
this.ctx.detectChanges(); |
|
|
|
} |
|
|
|
} |
|
|
|
|