|
|
|
@ -21,8 +21,6 @@ import { |
|
|
|
forwardRef, |
|
|
|
Injector, |
|
|
|
Input, |
|
|
|
OnDestroy, |
|
|
|
OnInit, |
|
|
|
StaticProvider, |
|
|
|
ViewContainerRef |
|
|
|
} from '@angular/core'; |
|
|
|
@ -68,7 +66,7 @@ import { coerceBoolean } from '@shared/decorators/coercion'; |
|
|
|
} |
|
|
|
] |
|
|
|
}) |
|
|
|
export class TimewindowComponent implements OnInit, OnDestroy, ControlValueAccessor { |
|
|
|
export class TimewindowComponent implements ControlValueAccessor { |
|
|
|
|
|
|
|
historyOnlyValue = false; |
|
|
|
|
|
|
|
@ -91,76 +89,38 @@ export class TimewindowComponent implements OnInit, OnDestroy, ControlValueAcces |
|
|
|
@coerceBoolean() |
|
|
|
forAllTimeEnabled = false; |
|
|
|
|
|
|
|
alwaysDisplayTypePrefixValue = false; |
|
|
|
|
|
|
|
@Input() |
|
|
|
set alwaysDisplayTypePrefix(val) { |
|
|
|
this.alwaysDisplayTypePrefixValue = coerceBooleanProperty(val); |
|
|
|
} |
|
|
|
|
|
|
|
get alwaysDisplayTypePrefix() { |
|
|
|
return this.alwaysDisplayTypePrefixValue; |
|
|
|
} |
|
|
|
|
|
|
|
quickIntervalOnlyValue = false; |
|
|
|
@coerceBoolean() |
|
|
|
alwaysDisplayTypePrefix = false; |
|
|
|
|
|
|
|
@Input() |
|
|
|
set quickIntervalOnly(val) { |
|
|
|
this.quickIntervalOnlyValue = coerceBooleanProperty(val); |
|
|
|
} |
|
|
|
|
|
|
|
get quickIntervalOnly() { |
|
|
|
return this.quickIntervalOnlyValue; |
|
|
|
} |
|
|
|
|
|
|
|
aggregationValue = false; |
|
|
|
@coerceBoolean() |
|
|
|
quickIntervalOnly = false; |
|
|
|
|
|
|
|
@Input() |
|
|
|
set aggregation(val) { |
|
|
|
this.aggregationValue = coerceBooleanProperty(val); |
|
|
|
} |
|
|
|
|
|
|
|
get aggregation() { |
|
|
|
return this.aggregationValue; |
|
|
|
} |
|
|
|
|
|
|
|
timezoneValue = false; |
|
|
|
@coerceBoolean() |
|
|
|
aggregation = false; |
|
|
|
|
|
|
|
@Input() |
|
|
|
set timezone(val) { |
|
|
|
this.timezoneValue = coerceBooleanProperty(val); |
|
|
|
} |
|
|
|
|
|
|
|
get timezone() { |
|
|
|
return this.timezoneValue; |
|
|
|
} |
|
|
|
|
|
|
|
isToolbarValue = false; |
|
|
|
@coerceBoolean() |
|
|
|
timezone = false; |
|
|
|
|
|
|
|
@Input() |
|
|
|
set isToolbar(val) { |
|
|
|
this.isToolbarValue = coerceBooleanProperty(val); |
|
|
|
} |
|
|
|
|
|
|
|
get isToolbar() { |
|
|
|
return this.isToolbarValue; |
|
|
|
} |
|
|
|
|
|
|
|
asButtonValue = false; |
|
|
|
@coerceBoolean() |
|
|
|
isToolbar = false; |
|
|
|
|
|
|
|
@Input() |
|
|
|
set asButton(val) { |
|
|
|
this.asButtonValue = coerceBooleanProperty(val); |
|
|
|
} |
|
|
|
|
|
|
|
get asButton() { |
|
|
|
return this.asButtonValue; |
|
|
|
} |
|
|
|
@coerceBoolean() |
|
|
|
asButton = false; |
|
|
|
|
|
|
|
@Input() |
|
|
|
@coerceBoolean() |
|
|
|
strokedButton = false; |
|
|
|
|
|
|
|
@Input() |
|
|
|
@coerceBoolean() |
|
|
|
isNgModel = false; |
|
|
|
|
|
|
|
isEditValue = false; |
|
|
|
|
|
|
|
@Input() |
|
|
|
@ -179,7 +139,9 @@ export class TimewindowComponent implements OnInit, OnDestroy, ControlValueAcces |
|
|
|
@Input() |
|
|
|
tooltipPosition: TooltipPosition = 'above'; |
|
|
|
|
|
|
|
@Input() disabled: boolean; |
|
|
|
@Input() |
|
|
|
@coerceBoolean() |
|
|
|
disabled: boolean; |
|
|
|
|
|
|
|
innerValue: Timewindow; |
|
|
|
|
|
|
|
@ -187,6 +149,8 @@ export class TimewindowComponent implements OnInit, OnDestroy, ControlValueAcces |
|
|
|
|
|
|
|
private propagateChange = (_: any) => {}; |
|
|
|
|
|
|
|
private _isControlInitialized = false; |
|
|
|
|
|
|
|
constructor(private overlay: Overlay, |
|
|
|
private translate: TranslateService, |
|
|
|
private timeService: TimeService, |
|
|
|
@ -198,12 +162,6 @@ export class TimewindowComponent implements OnInit, OnDestroy, ControlValueAcces |
|
|
|
public breakpointObserver: BreakpointObserver) { |
|
|
|
} |
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
} |
|
|
|
|
|
|
|
ngOnDestroy(): void { |
|
|
|
} |
|
|
|
|
|
|
|
toggleTimewindow($event: Event) { |
|
|
|
if ($event) { |
|
|
|
$event.stopPropagation(); |
|
|
|
@ -215,7 +173,6 @@ export class TimewindowComponent implements OnInit, OnDestroy, ControlValueAcces |
|
|
|
maxHeight: '80vh', |
|
|
|
height: 'min-content' |
|
|
|
}); |
|
|
|
config.hasBackdrop = true; |
|
|
|
const connectedPosition: ConnectedPosition = { |
|
|
|
originX: 'start', |
|
|
|
originY: 'bottom', |
|
|
|
@ -262,18 +219,17 @@ export class TimewindowComponent implements OnInit, OnDestroy, ControlValueAcces |
|
|
|
} |
|
|
|
|
|
|
|
private onHistoryOnlyChanged(): boolean { |
|
|
|
if (this.historyOnlyValue && this.innerValue) { |
|
|
|
if (this.innerValue.selectedTab !== TimewindowType.HISTORY) { |
|
|
|
this.innerValue.selectedTab = TimewindowType.HISTORY; |
|
|
|
this.updateDisplayValue(); |
|
|
|
return true; |
|
|
|
} |
|
|
|
if (this.historyOnlyValue && this.innerValue && this.innerValue.selectedTab !== TimewindowType.HISTORY) { |
|
|
|
this.innerValue.selectedTab = TimewindowType.HISTORY; |
|
|
|
this.updateDisplayValue(); |
|
|
|
return true; |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
registerOnChange(fn: any): void { |
|
|
|
this.propagateChange = fn; |
|
|
|
this._isControlInitialized = true; |
|
|
|
} |
|
|
|
|
|
|
|
registerOnTouched(fn: any): void { |
|
|
|
@ -285,14 +241,16 @@ export class TimewindowComponent implements OnInit, OnDestroy, ControlValueAcces |
|
|
|
} |
|
|
|
|
|
|
|
writeValue(obj: Timewindow): void { |
|
|
|
this.innerValue = initModelFromDefaultTimewindow(obj, this.quickIntervalOnly, this.timeService); |
|
|
|
this.timewindowDisabled = this.isTimewindowDisabled(); |
|
|
|
if (this.onHistoryOnlyChanged()) { |
|
|
|
setTimeout(() => { |
|
|
|
this.notifyChanged(); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.updateDisplayValue(); |
|
|
|
if (this._isControlInitialized || !this.isNgModel) { |
|
|
|
this.innerValue = initModelFromDefaultTimewindow(obj, this.quickIntervalOnly, this.timeService); |
|
|
|
this.timewindowDisabled = this.isTimewindowDisabled(); |
|
|
|
if (this.onHistoryOnlyChanged()) { |
|
|
|
setTimeout(() => { |
|
|
|
this.notifyChanged(); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.updateDisplayValue(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|