Browse Source

Merge pull request #13010 from vvlladd28/improvement/popover/outside-click

Disabled automatic closing of the settings panel popover when clicking outside
pull/13033/head
Igor Kulikov 2 years ago
committed by GitHub
parent
commit
545cf395f5
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 14
      ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.ts
  2. 14
      ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings.service.ts
  3. 15
      ui-ngx/src/app/modules/home/components/vc/entity-types-version-load.component.ts
  4. 15
      ui-ngx/src/app/modules/home/components/vc/entity-version-diff.component.ts
  5. 81
      ui-ngx/src/app/modules/home/components/vc/entity-versions-table.component.ts
  6. 14
      ui-ngx/src/app/modules/home/components/widget/config/timewindow-style.component.ts
  7. 36
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts
  8. 30
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/set-value-action-settings.component.ts
  9. 28
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action-settings.component.ts
  10. 21
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/auto-date-format-settings.component.ts
  11. 19
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/background-settings.component.ts
  12. 28
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/button/widget-button-custom-style.component.ts
  13. 30
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/button/widget-button-toggle-custom-style.component.ts
  14. 25
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-axis-settings-button.component.ts
  15. 20
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-settings.component.ts
  16. 25
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axis-row.component.ts
  17. 21
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-range-settings.component.ts
  18. 35
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-settings.component.ts
  19. 39
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/date-format-select.component.ts
  20. 25
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/dynamic-form/dynamic-form-property-row.component.ts
  21. 14
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/font-settings.component.ts
  22. 16
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-keys.component.ts
  23. 29
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings.component.ts
  24. 19
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-layer-row.component.ts
  25. 32
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-tooltip-tag-actions.component.ts
  26. 19
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-image-settings.component.ts
  27. 25
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-shape-settings.component.ts
  28. 16
      ui-ngx/src/app/modules/home/pages/mobile/applications/mobile-app.component.ts
  29. 31
      ui-ngx/src/app/modules/home/pages/mobile/bundes/layout/mobile-page-item-row.component.ts
  30. 27
      ui-ngx/src/app/modules/home/pages/scada-symbol/metadata-components/scada-symbol-behavior-row.component.ts
  31. 28
      ui-ngx/src/app/modules/home/pages/scada-symbol/metadata-components/scada-symbol-metadata-tag.component.ts
  32. 14
      ui-ngx/src/app/modules/home/pages/widget/widget-editor.component.ts
  33. 23
      ui-ngx/src/app/shared/components/color-input.component.ts
  34. 19
      ui-ngx/src/app/shared/components/js-func.component.ts
  35. 10
      ui-ngx/src/app/shared/components/popover.component.ts
  36. 34
      ui-ngx/src/app/shared/components/popover.models.ts
  37. 122
      ui-ngx/src/app/shared/components/popover.service.ts
  38. 32
      ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.ts
  39. 15
      ui-ngx/src/app/shared/components/time/timezone.component.ts

14
ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.ts

@ -174,11 +174,15 @@ export class CalculatedFieldArgumentsTableComponent implements ControlValueAcces
entityHasError: this.entityNameErrorSet.has(argument.refEntityId?.id), entityHasError: this.entityNameErrorSet.has(argument.refEntityId?.id),
usedArgumentNames: this.argumentsFormArray.value.map(({ argumentName }) => argumentName).filter(name => name !== argument.argumentName), usedArgumentNames: this.argumentsFormArray.value.map(({ argumentName }) => argumentName).filter(name => name !== argument.argumentName),
}; };
this.popoverComponent = this.popoverService.displayPopover(trigger, this.renderer, this.popoverComponent = this.popoverService.displayPopover({
this.viewContainerRef, CalculatedFieldArgumentPanelComponent, isDefined(index) ? 'left' : 'right', false, null, trigger,
ctx, renderer: this.renderer,
{}, componentType: CalculatedFieldArgumentPanelComponent,
{}, {}, true); hostView: this.viewContainerRef,
preferredPlacement: isDefined(index) ? 'left' : 'right',
context: ctx,
isModal: true
});
this.popoverComponent.tbComponentRef.instance.argumentsDataApplied.subscribe(({ value, index }) => { this.popoverComponent.tbComponentRef.instance.argumentsDataApplied.subscribe(({ value, index }) => {
this.popoverComponent.hide(); this.popoverComponent.hide();
const formGroup = this.fb.group(value); const formGroup = this.fb.group(value);

14
ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings.service.ts

@ -37,14 +37,18 @@ export class EntityDebugSettingsService {
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const debugStrategyPopover = this.popoverService.displayPopover(trigger, this.renderer, const debugStrategyPopover = this.popoverService.displayPopover({
this.viewContainerRef, EntityDebugSettingsPanelComponent, 'bottom', true, null, trigger,
{ renderer: this.renderer,
componentType: EntityDebugSettingsPanelComponent,
hostView: this.viewContainerRef,
preferredPlacement: 'bottom',
context: {
...panelConfig.debugSettings, ...panelConfig.debugSettings,
...panelConfig.debugConfig, ...panelConfig.debugConfig,
}, },
{}, isModal: true,
{}, {}, true); });
debugStrategyPopover.tbComponentRef.instance.onSettingsApplied.subscribe(settings => { debugStrategyPopover.tbComponentRef.instance.onSettingsApplied.subscribe(settings => {
panelConfig.onSettingsAppliedFn(settings); panelConfig.onSettingsAppliedFn(settings);
debugStrategyPopover.hide(); debugStrategyPopover.hide();

15
ui-ngx/src/app/modules/home/components/vc/entity-types-version-load.component.ts

@ -232,16 +232,23 @@ export class EntityTypesVersionLoadComponent extends PageComponent implements On
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const removeOtherEntitiesConfirmPopover = this.popoverService.displayPopover(trigger, this.renderer, const removeOtherEntitiesConfirmPopover = this.popoverService.displayPopover({
this.viewContainerRef, RemoveOtherEntitiesConfirmComponent, 'bottom', true, null, trigger,
{ renderer: this.renderer,
componentType: RemoveOtherEntitiesConfirmComponent,
hostView: this.viewContainerRef,
preferredPlacement: 'bottom',
context: {
onClose: (result: boolean | null) => { onClose: (result: boolean | null) => {
removeOtherEntitiesConfirmPopover.hide(); removeOtherEntitiesConfirmPopover.hide();
if (result) { if (result) {
entityTypeControl.get('config').get('removeOtherEntities').patchValue(true, {emitEvent: true}); entityTypeControl.get('config').get('removeOtherEntities').patchValue(true, {emitEvent: true});
} }
} }
}, {}, {}, {}, false); },
showCloseButton: false,
isModal: true
});
} }
} }
} }

15
ui-ngx/src/app/modules/home/components/vc/entity-version-diff.component.ts

@ -304,9 +304,13 @@ export class EntityVersionDiffComponent extends PageComponent implements OnInit,
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const restoreVersionPopover = this.popoverService.displayPopover(trigger, this.renderer, const restoreVersionPopover = this.popoverService.displayPopover({
this.viewContainerRef, EntityVersionRestoreComponent, 'leftTop', false, null, trigger,
{ renderer: this.renderer,
componentType: EntityVersionRestoreComponent,
hostView: this.viewContainerRef,
preferredPlacement: 'leftTop',
context: {
versionName: this.versionName, versionName: this.versionName,
versionId: this.versionId, versionId: this.versionId,
externalEntityId: this.externalEntityId, externalEntityId: this.externalEntityId,
@ -317,7 +321,10 @@ export class EntityVersionDiffComponent extends PageComponent implements OnInit,
this.versionRestored.emit(); this.versionRestored.emit();
} }
} }
}, {}, {}, {}, false); },
showCloseButton: false,
isModal: true
});
restoreVersionPopover.tbComponentRef.instance.popoverComponent = restoreVersionPopover; restoreVersionPopover.tbComponentRef.instance.popoverComponent = restoreVersionPopover;
} }
} }

81
ui-ngx/src/app/modules/home/components/vc/entity-versions-table.component.ts

@ -211,9 +211,13 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const createVersionPopover = this.popoverService.displayPopover(trigger, this.renderer, const createVersionPopover = this.popoverService.displayPopover({
this.viewContainerRef, EntityVersionCreateComponent, 'leftTop', false, null, trigger,
{ renderer: this.renderer,
componentType: EntityVersionCreateComponent,
hostView: this.viewContainerRef,
preferredPlacement: 'leftTop',
context: {
branch: this.branch, branch: this.branch,
entityId: this.entityId, entityId: this.entityId,
entityName: this.entityName, entityName: this.entityName,
@ -229,8 +233,11 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni
} }
} }
}, },
{maxHeight: '100vh', height: '100%', padding: '10px'}, showCloseButton: false,
{width: '400px', minWidth: '100%', maxWidth: '100%'}, {}, false); overlayStyle: {maxHeight: '100vh', height: '100%', padding: '10px'},
popoverStyle: {width: '400px', minWidth: '100%', maxWidth: '100%'},
isModal: true
});
createVersionPopover.tbComponentRef.instance.popoverComponent = createVersionPopover; createVersionPopover.tbComponentRef.instance.popoverComponent = createVersionPopover;
} }
} }
@ -243,9 +250,13 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const complexCreateVersionPopover = this.popoverService.displayPopover(trigger, this.renderer, const complexCreateVersionPopover = this.popoverService.displayPopover({
this.viewContainerRef, ComplexVersionCreateComponent, 'leftTop', false, null, trigger,
{ renderer: this.renderer,
componentType: ComplexVersionCreateComponent,
hostView: this.viewContainerRef,
preferredPlacement: 'leftTop',
context: {
branch: this.branch, branch: this.branch,
onClose: (result: VersionCreationResult | null, branch: string | null) => { onClose: (result: VersionCreationResult | null, branch: string | null) => {
complexCreateVersionPopover.hide(); complexCreateVersionPopover.hide();
@ -258,8 +269,10 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni
} }
} }
}, },
{maxHeight: '90vh', height: '100%', padding: '10px'}, showCloseButton: false,
{}, {}, false); overlayStyle: {maxHeight: '90vh', height: '100%', padding: '10px'},
isModal: true
});
complexCreateVersionPopover.tbComponentRef.instance.popoverComponent = complexCreateVersionPopover; complexCreateVersionPopover.tbComponentRef.instance.popoverComponent = complexCreateVersionPopover;
} }
} }
@ -272,14 +285,21 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const diffVersionPopover = this.popoverService.displayPopover(trigger, this.renderer, const diffVersionPopover = this.popoverService.displayPopover({
this.viewContainerRef, EntityVersionDiffComponent, 'leftTop', true, null, trigger,
{ renderer: this.renderer,
componentType: EntityVersionDiffComponent,
hostView: this.viewContainerRef,
preferredPlacement: 'leftTop',
context: {
versionName: entityVersion.name, versionName: entityVersion.name,
versionId: entityVersion.id, versionId: entityVersion.id,
entityId: this.entityId, entityId: this.entityId,
externalEntityId: this.externalEntityIdValue externalEntityId: this.externalEntityIdValue
}, {}, {}, {}, false); },
showCloseButton: false,
isModal: true
});
diffVersionPopover.tbComponentRef.instance.popoverComponent = diffVersionPopover; diffVersionPopover.tbComponentRef.instance.popoverComponent = diffVersionPopover;
diffVersionPopover.tbComponentRef.instance.versionRestored.subscribe(() => { diffVersionPopover.tbComponentRef.instance.versionRestored.subscribe(() => {
this.versionRestored.emit(); this.versionRestored.emit();
@ -295,9 +315,13 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const restoreVersionPopover = this.popoverService.displayPopover(trigger, this.renderer, const restoreVersionPopover = this.popoverService.displayPopover({
this.viewContainerRef, EntityVersionRestoreComponent, 'leftTop', false, null, trigger,
{ renderer: this.renderer,
componentType: EntityVersionRestoreComponent,
hostView: this.viewContainerRef,
preferredPlacement: 'leftTop',
context: {
versionName: entityVersion.name, versionName: entityVersion.name,
versionId: entityVersion.id, versionId: entityVersion.id,
externalEntityId: this.externalEntityIdValue, externalEntityId: this.externalEntityIdValue,
@ -308,8 +332,11 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni
} }
} }
}, },
{maxHeight: '100vh', height: '100%', padding: '10px'}, showCloseButton: false,
{width: '400px', minWidth: '100%', maxWidth: '100%'}, {}, false); overlayStyle: {maxHeight: '100vh', height: '100%', padding: '10px'},
popoverStyle: {width: '400px', minWidth: '100%', maxWidth: '100%'},
isModal: true
});
restoreVersionPopover.tbComponentRef.instance.popoverComponent = restoreVersionPopover; restoreVersionPopover.tbComponentRef.instance.popoverComponent = restoreVersionPopover;
} }
} }
@ -322,17 +349,23 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const restoreEntitiesVersionPopover = this.popoverService.displayPopover(trigger, this.renderer, const restoreEntitiesVersionPopover = this.popoverService.displayPopover({
this.viewContainerRef, ComplexVersionLoadComponent, 'leftTop', false, null, trigger,
{ renderer: this.renderer,
componentType: ComplexVersionLoadComponent,
hostView: this.viewContainerRef,
preferredPlacement: 'leftTop',
context: {
versionName: entityVersion.name, versionName: entityVersion.name,
versionId: entityVersion.id, versionId: entityVersion.id,
onClose: (result: VersionLoadResult | null) => { onClose: (result: VersionLoadResult | null) => {
restoreEntitiesVersionPopover.hide(); restoreEntitiesVersionPopover.hide();
} }
}, },
{maxHeight: '80vh', height: '100%', padding: '10px'}, showCloseButton: false,
{}, {}, false); overlayStyle: {maxHeight: '80vh', height: '100%', padding: '10px'},
isModal: true
});
restoreEntitiesVersionPopover.tbComponentRef.instance.popoverComponent = restoreEntitiesVersionPopover; restoreEntitiesVersionPopover.tbComponentRef.instance.popoverComponent = restoreEntitiesVersionPopover;
} }
} }

14
ui-ngx/src/app/modules/home/components/widget/config/timewindow-style.component.ts

@ -80,11 +80,15 @@ export class TimewindowStyleComponent implements OnInit, ControlValueAccessor {
timewindowStyle: this.modelValue, timewindowStyle: this.modelValue,
previewValue: this.previewValue previewValue: this.previewValue
}; };
const timewindowStylePanelPopover = this.popoverService.displayPopover(trigger, this.renderer, const timewindowStylePanelPopover = this.popoverService.displayPopover({
this.viewContainerRef, TimewindowStylePanelComponent, 'left', true, null, trigger,
ctx, renderer: this.renderer,
{}, hostView: this.viewContainerRef,
{}, {}, true); componentType: TimewindowStylePanelComponent,
preferredPlacement: 'left',
context: ctx,
isModal: true
});
timewindowStylePanelPopover.tbComponentRef.instance.popover = timewindowStylePanelPopover; timewindowStylePanelPopover.tbComponentRef.instance.popover = timewindowStylePanelPopover;
timewindowStylePanelPopover.tbComponentRef.instance.timewindowStyleApplied.subscribe((timewindowStyle) => { timewindowStylePanelPopover.tbComponentRef.instance.timewindowStyleApplied.subscribe((timewindowStyle) => {
timewindowStylePanelPopover.hide(); timewindowStylePanelPopover.hide();

36
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts

@ -129,23 +129,25 @@ export class GetValueActionSettingsComponent implements OnInit, ControlValueAcce
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const ctx: any = { const getValueSettingsPanelPopover = this.popoverService.displayPopover({
getValueSettings: this.modelValue, trigger,
panelTitle: this.panelTitle, renderer: this.renderer,
valueType: this.valueType, componentType: GetValueActionSettingsPanelComponent,
trueLabel: this.trueLabel, hostView: this.viewContainerRef,
falseLabel: this.falseLabel, preferredPlacement: ['leftTopOnly', 'leftOnly', 'leftBottomOnly'],
stateLabel: this.stateLabel, context: {
aliasController: this.aliasController, getValueSettings: this.modelValue,
targetDevice: this.targetDevice, panelTitle: this.panelTitle,
widgetType: this.widgetType valueType: this.valueType,
}; trueLabel: this.trueLabel,
const getValueSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, falseLabel: this.falseLabel,
this.viewContainerRef, GetValueActionSettingsPanelComponent, stateLabel: this.stateLabel,
['leftTopOnly', 'leftOnly', 'leftBottomOnly'], false, null, aliasController: this.aliasController,
ctx, targetDevice: this.targetDevice,
{}, widgetType: this.widgetType
{}, {}, true); },
isModal: true
});
getValueSettingsPanelPopover.tbComponentRef.instance.popover = getValueSettingsPanelPopover; getValueSettingsPanelPopover.tbComponentRef.instance.popover = getValueSettingsPanelPopover;
getValueSettingsPanelPopover.tbComponentRef.instance.getValueSettingsApplied.subscribe((getValueSettings) => { getValueSettingsPanelPopover.tbComponentRef.instance.getValueSettingsApplied.subscribe((getValueSettings) => {
getValueSettingsPanelPopover.hide(); getValueSettingsPanelPopover.hide();

30
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/set-value-action-settings.component.ts

@ -115,20 +115,22 @@ export class SetValueActionSettingsComponent implements OnInit, ControlValueAcce
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const ctx: any = { const setValueSettingsPanelPopover = this.popoverService.displayPopover({
setValueSettings: this.modelValue, trigger,
panelTitle: this.panelTitle, renderer: this.renderer,
valueType: this.valueType, componentType: SetValueActionSettingsPanelComponent,
aliasController: this.aliasController, hostView: this.viewContainerRef,
targetDevice: this.targetDevice, preferredPlacement: ['leftTopOnly', 'leftOnly', 'leftBottomOnly'],
widgetType: this.widgetType context: {
}; setValueSettings: this.modelValue,
const setValueSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, panelTitle: this.panelTitle,
this.viewContainerRef, SetValueActionSettingsPanelComponent, valueType: this.valueType,
['leftTopOnly', 'leftOnly', 'leftBottomOnly'], false, null, aliasController: this.aliasController,
ctx, targetDevice: this.targetDevice,
{}, widgetType: this.widgetType
{}, {}, true); },
isModal: true
});
setValueSettingsPanelPopover.tbComponentRef.instance.popover = setValueSettingsPanelPopover; setValueSettingsPanelPopover.tbComponentRef.instance.popover = setValueSettingsPanelPopover;
setValueSettingsPanelPopover.tbComponentRef.instance.setValueSettingsApplied.subscribe((setValueSettings) => { setValueSettingsPanelPopover.tbComponentRef.instance.setValueSettingsApplied.subscribe((setValueSettings) => {
setValueSettingsPanelPopover.hide(); setValueSettingsPanelPopover.hide();

28
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action-settings.component.ts

@ -114,19 +114,21 @@ export class WidgetActionSettingsComponent implements OnInit, ControlValueAccess
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const ctx: any = { const widgetActionSettingsPanelPopover = this.popoverService.displayPopover({
widgetAction: this.modelValue, trigger,
panelTitle: this.panelTitle, renderer: this.renderer,
widgetType: this.widgetType, componentType: WidgetActionSettingsPanelComponent,
callbacks: this.callbacks, hostView: this.viewContainerRef,
additionalWidgetActionTypes: this.additionalWidgetActionTypes preferredPlacement: ['leftTopOnly', 'leftOnly', 'leftBottomOnly'],
}; context: {
const widgetActionSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, widgetAction: this.modelValue,
this.viewContainerRef, WidgetActionSettingsPanelComponent, panelTitle: this.panelTitle,
['leftTopOnly', 'leftOnly', 'leftBottomOnly'], false, null, widgetType: this.widgetType,
ctx, callbacks: this.callbacks,
{}, additionalWidgetActionTypes: this.additionalWidgetActionTypes
{}, {}, true); },
isModal: true
});
widgetActionSettingsPanelPopover.tbComponentRef.instance.widgetActionApplied.subscribe((widgetAction) => { widgetActionSettingsPanelPopover.tbComponentRef.instance.widgetActionApplied.subscribe((widgetAction) => {
widgetActionSettingsPanelPopover.hide(); widgetActionSettingsPanelPopover.hide();
this.modelValue = widgetAction; this.modelValue = widgetAction;

21
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/auto-date-format-settings.component.ts

@ -78,15 +78,18 @@ export class AutoDateFormatSettingsComponent implements OnInit, ControlValueAcce
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const ctx: any = { const autoDateFormatSettingsPanelPopover = this.popoverService.displayPopover({
autoDateFormatSettings: deepClone(this.modelValue), trigger,
defaultValues: this.defaultValues renderer: this.renderer,
}; componentType: AutoDateFormatSettingsPanelComponent,
const autoDateFormatSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, hostView: this.viewContainerRef,
this.viewContainerRef, AutoDateFormatSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, preferredPlacement: ['leftOnly', 'leftTopOnly', 'leftBottomOnly'],
ctx, context: {
{}, autoDateFormatSettings: deepClone(this.modelValue),
{}, {}, true); defaultValues: this.defaultValues
},
isModal: true
});
autoDateFormatSettingsPanelPopover.tbComponentRef.instance.popover = autoDateFormatSettingsPanelPopover; autoDateFormatSettingsPanelPopover.tbComponentRef.instance.popover = autoDateFormatSettingsPanelPopover;
autoDateFormatSettingsPanelPopover.tbComponentRef.instance.autoDateFormatSettingsApplied.subscribe((autoDateFormatSettings) => { autoDateFormatSettingsPanelPopover.tbComponentRef.instance.autoDateFormatSettingsApplied.subscribe((autoDateFormatSettings) => {
autoDateFormatSettingsPanelPopover.hide(); autoDateFormatSettingsPanelPopover.hide();

19
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/background-settings.component.ts

@ -107,14 +107,17 @@ export class BackgroundSettingsComponent implements OnInit, ControlValueAccessor
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const ctx: any = { const backgroundSettingsPanelPopover = this.popoverService.displayPopover({
backgroundSettings: this.modelValue trigger,
}; renderer: this.renderer,
const backgroundSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, componentType: BackgroundSettingsPanelComponent,
this.viewContainerRef, BackgroundSettingsPanelComponent, ['left'], false, null, hostView: this.viewContainerRef,
ctx, preferredPlacement: 'left',
{}, context: {
{}, {}, true); backgroundSettings: this.modelValue
},
isModal: true
});
backgroundSettingsPanelPopover.tbComponentRef.instance.popover = backgroundSettingsPanelPopover; backgroundSettingsPanelPopover.tbComponentRef.instance.popover = backgroundSettingsPanelPopover;
backgroundSettingsPanelPopover.tbComponentRef.instance.backgroundSettingsApplied.subscribe((backgroundSettings) => { backgroundSettingsPanelPopover.tbComponentRef.instance.backgroundSettingsApplied.subscribe((backgroundSettings) => {
backgroundSettingsPanelPopover.hide(); backgroundSettingsPanelPopover.hide();

28
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/button/widget-button-custom-style.component.ts

@ -124,19 +124,21 @@ export class WidgetButtonCustomStyleComponent implements OnInit, OnChanges, Cont
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const ctx: any = { const widgetButtonCustomStylePanelPopover = this.popoverService.displayPopover({
appearance: this.appearance, trigger,
borderRadius: this.borderRadius, renderer: this.renderer,
autoScale: this.autoScale, componentType: WidgetButtonCustomStylePanelComponent,
state: this.state, hostView: this.viewContainerRef,
customStyle: this.modelValue preferredPlacement: ['leftTopOnly', 'leftOnly', 'leftBottomOnly'],
}; context: {
const widgetButtonCustomStylePanelPopover = this.popoverService.displayPopover(trigger, this.renderer, appearance: this.appearance,
this.viewContainerRef, WidgetButtonCustomStylePanelComponent, borderRadius: this.borderRadius,
['leftTopOnly', 'leftOnly', 'leftBottomOnly'], false, null, autoScale: this.autoScale,
ctx, state: this.state,
{}, customStyle: this.modelValue
{}, {}, true); },
isModal: true
});
widgetButtonCustomStylePanelPopover.tbComponentRef.instance.popover = widgetButtonCustomStylePanelPopover; widgetButtonCustomStylePanelPopover.tbComponentRef.instance.popover = widgetButtonCustomStylePanelPopover;
widgetButtonCustomStylePanelPopover.tbComponentRef.instance.customStyleApplied.subscribe((customStyle) => { widgetButtonCustomStylePanelPopover.tbComponentRef.instance.customStyleApplied.subscribe((customStyle) => {
widgetButtonCustomStylePanelPopover.hide(); widgetButtonCustomStylePanelPopover.hide();

30
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/button/widget-button-toggle-custom-style.component.ts

@ -127,20 +127,22 @@ export class WidgetButtonToggleCustomStyleComponent implements OnInit, OnChanges
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const ctx: any = { const widgetButtonCustomStylePanelPopover = this.popoverService.displayPopover({
appearance: this.appearance, trigger,
borderRadius: this.borderRadius, renderer: this.renderer,
autoScale: this.autoScale, componentType: WidgetButtonToggleCustomStylePanelComponent,
state: this.state, hostView: this.viewContainerRef,
value: this.value, preferredPlacement: ['leftTopOnly', 'leftOnly', 'leftBottomOnly'],
customStyle: this.modelValue context: {
}; appearance: this.appearance,
const widgetButtonCustomStylePanelPopover = this.popoverService.displayPopover(trigger, this.renderer, borderRadius: this.borderRadius,
this.viewContainerRef, WidgetButtonToggleCustomStylePanelComponent, autoScale: this.autoScale,
['leftTopOnly', 'leftOnly', 'leftBottomOnly'], false, null, state: this.state,
ctx, value: this.value,
{}, customStyle: this.modelValue
{}, {}, true); },
isModal: true
});
widgetButtonCustomStylePanelPopover.tbComponentRef.instance.popover = widgetButtonCustomStylePanelPopover; widgetButtonCustomStylePanelPopover.tbComponentRef.instance.popover = widgetButtonCustomStylePanelPopover;
widgetButtonCustomStylePanelPopover.tbComponentRef.instance.customStyleApplied.subscribe((customStyle) => { widgetButtonCustomStylePanelPopover.tbComponentRef.instance.customStyleApplied.subscribe((customStyle) => {
widgetButtonCustomStylePanelPopover.hide(); widgetButtonCustomStylePanelPopover.hide();

25
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-axis-settings-button.component.ts

@ -85,17 +85,20 @@ export class TimeSeriesChartAxisSettingsButtonComponent implements OnInit, Contr
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const ctx: any = { const axisSettingsPanelPopover = this.popoverService.displayPopover({
axisSettings: this.modelValue, trigger,
axisType: this.axisType, renderer: this.renderer,
panelTitle: this.panelTitle, componentType: TimeSeriesChartAxisSettingsPanelComponent,
advanced: this.advanced hostView: this.viewContainerRef,
}; preferredPlacement: ['leftOnly', 'leftTopOnly', 'leftBottomOnly'],
const axisSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, context: {
this.viewContainerRef, TimeSeriesChartAxisSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, axisSettings: this.modelValue,
ctx, axisType: this.axisType,
{}, panelTitle: this.panelTitle,
{}, {}, true); advanced: this.advanced
},
isModal: true
});
axisSettingsPanelPopover.tbComponentRef.instance.popover = axisSettingsPanelPopover; axisSettingsPanelPopover.tbComponentRef.instance.popover = axisSettingsPanelPopover;
axisSettingsPanelPopover.tbComponentRef.instance.axisSettingsApplied.subscribe((axisSettings) => { axisSettingsPanelPopover.tbComponentRef.instance.axisSettingsApplied.subscribe((axisSettings) => {
axisSettingsPanelPopover.hide(); axisSettingsPanelPopover.hide();

20
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-settings.component.ts

@ -107,11 +107,21 @@ export class TimeSeriesChartThresholdSettingsComponent implements OnInit, Contro
hideYAxis: this.hideYAxis, hideYAxis: this.hideYAxis,
yAxisIds: this.yAxisIds yAxisIds: this.yAxisIds
}; };
const thresholdSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, const thresholdSettingsPanelPopover = this.popoverService.displayPopover({
this.viewContainerRef, TimeSeriesChartThresholdSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, trigger,
ctx, renderer: this.renderer,
{}, componentType: TimeSeriesChartThresholdSettingsPanelComponent,
{}, {}, true); hostView: this.viewContainerRef,
preferredPlacement: ['leftOnly', 'leftTopOnly', 'leftBottomOnly'],
context: {
thresholdSettings: deepClone(this.modelValue),
panelTitle: this.title,
widgetConfig: this.widgetConfig,
hideYAxis: this.hideYAxis,
yAxisIds: this.yAxisIds
},
isModal: true
});
thresholdSettingsPanelPopover.tbComponentRef.instance.popover = thresholdSettingsPanelPopover; thresholdSettingsPanelPopover.tbComponentRef.instance.popover = thresholdSettingsPanelPopover;
thresholdSettingsPanelPopover.tbComponentRef.instance.thresholdSettingsApplied.subscribe((thresholdSettings) => { thresholdSettingsPanelPopover.tbComponentRef.instance.thresholdSettingsApplied.subscribe((thresholdSettings) => {
thresholdSettingsPanelPopover.hide(); thresholdSettingsPanelPopover.hide();

25
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axis-row.component.ts

@ -151,17 +151,20 @@ export class TimeSeriesChartYAxisRowComponent implements ControlValueAccessor, O
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const ctx: any = { const yAxisSettingsPanelPopover = this.popoverService.displayPopover({
axisType: 'yAxis', trigger,
panelTitle: this.translate.instant('widgets.time-series-chart.axis.y-axis-settings'), renderer: this.renderer,
axisSettings: deepClone(this.modelValue), componentType: TimeSeriesChartAxisSettingsPanelComponent,
advanced: this.advanced hostView: this.viewContainerRef,
}; preferredPlacement: ['leftOnly', 'leftTopOnly', 'leftBottomOnly'],
const yAxisSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, context: {
this.viewContainerRef, TimeSeriesChartAxisSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, axisType: 'yAxis',
ctx, panelTitle: this.translate.instant('widgets.time-series-chart.axis.y-axis-settings'),
{}, axisSettings: deepClone(this.modelValue),
{}, {}, true); advanced: this.advanced
},
isModal: true
});
yAxisSettingsPanelPopover.tbComponentRef.instance.popover = yAxisSettingsPanelPopover; yAxisSettingsPanelPopover.tbComponentRef.instance.popover = yAxisSettingsPanelPopover;
yAxisSettingsPanelPopover.tbComponentRef.instance.axisSettingsApplied.subscribe((yAxisSettings) => { yAxisSettingsPanelPopover.tbComponentRef.instance.axisSettingsApplied.subscribe((yAxisSettings) => {
yAxisSettingsPanelPopover.hide(); yAxisSettingsPanelPopover.hide();

21
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-range-settings.component.ts

@ -121,15 +121,18 @@ export class ColorRangeSettingsComponent implements OnInit, ControlValueAccessor
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const ctx: any = { const colorRangeSettingsPanelPopover = this.popoverService.displayPopover({
colorRangeSettings: this.modelValue, trigger,
settingsComponents: this.colorSettingsComponentService.getOtherColorSettingsComponents(this) renderer: this.renderer,
}; componentType: ColorRangePanelComponent,
const colorRangeSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, hostView: this.viewContainerRef,
this.viewContainerRef, ColorRangePanelComponent, 'left', false, null, preferredPlacement: 'left',
ctx, context: {
{}, colorRangeSettings: this.modelValue,
{}, {}, true); settingsComponents: this.colorSettingsComponentService.getOtherColorSettingsComponents(this)
},
isModal: true
});
colorRangeSettingsPanelPopover.tbComponentRef.instance.popover = colorRangeSettingsPanelPopover; colorRangeSettingsPanelPopover.tbComponentRef.instance.popover = colorRangeSettingsPanelPopover;
colorRangeSettingsPanelPopover.tbComponentRef.instance.colorRangeApplied.subscribe((colorRangeSettings: Array<ColorRange>) => { colorRangeSettingsPanelPopover.tbComponentRef.instance.colorRangeApplied.subscribe((colorRangeSettings: Array<ColorRange>) => {
colorRangeSettingsPanelPopover.hide(); colorRangeSettingsPanelPopover.hide();

35
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-settings.component.ts

@ -159,22 +159,25 @@ export class ColorSettingsComponent implements OnInit, ControlValueAccessor, OnD
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const ctx: any = { const colorSettingsPanelPopover = this.popoverService.displayPopover({
colorSettings: this.modelValue, trigger,
settingsComponents: this.colorSettingsComponentService.getOtherColorSettingsComponents(this), renderer: this.renderer,
aliasController: this.aliasController, componentType: ColorSettingsPanelComponent,
dataKeyCallbacks: this.dataKeyCallbacks, hostView: this.viewContainerRef,
datasource: this.datasource, preferredPlacement: 'left',
rangeAdvancedMode: this.rangeAdvancedMode, context: {
gradientAdvancedMode: this.gradientAdvancedMode, colorSettings: this.modelValue,
minValue: this.minValue, settingsComponents: this.colorSettingsComponentService.getOtherColorSettingsComponents(this),
maxValue: this.maxValue aliasController: this.aliasController,
}; dataKeyCallbacks: this.dataKeyCallbacks,
const colorSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, datasource: this.datasource,
this.viewContainerRef, ColorSettingsPanelComponent, 'left', false, null, rangeAdvancedMode: this.rangeAdvancedMode,
ctx, gradientAdvancedMode: this.gradientAdvancedMode,
{}, minValue: this.minValue,
{}, {}, true); maxValue: this.maxValue
},
isModal: true
});
colorSettingsPanelPopover.tbComponentRef.instance.popover = colorSettingsPanelPopover; colorSettingsPanelPopover.tbComponentRef.instance.popover = colorSettingsPanelPopover;
colorSettingsPanelPopover.tbComponentRef.instance.colorSettingsApplied.subscribe((colorSettings) => { colorSettingsPanelPopover.tbComponentRef.instance.colorSettingsApplied.subscribe((colorSettings) => {
colorSettingsPanelPopover.hide(); colorSettingsPanelPopover.hide();

39
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/date-format-select.component.ts

@ -162,14 +162,16 @@ export class DateFormatSelectComponent implements OnInit, ControlValueAccessor {
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const ctx: any = { const dateFormatSettingsPanelPopover = this.popoverService.displayPopover({
dateFormat: deepClone(this.modelValue) trigger,
}; renderer: this.renderer,
const dateFormatSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, componentType: DateFormatSettingsPanelComponent,
this.viewContainerRef, DateFormatSettingsPanelComponent, 'top', false, null, hostView: this.viewContainerRef,
ctx, context: {
{}, dateFormat: deepClone(this.modelValue)
{}, {}, true); },
isModal: true
});
dateFormatSettingsPanelPopover.tbComponentRef.instance.popover = dateFormatSettingsPanelPopover; dateFormatSettingsPanelPopover.tbComponentRef.instance.popover = dateFormatSettingsPanelPopover;
dateFormatSettingsPanelPopover.tbComponentRef.instance.dateFormatApplied.subscribe((dateFormat) => { dateFormatSettingsPanelPopover.tbComponentRef.instance.dateFormatApplied.subscribe((dateFormat) => {
dateFormatSettingsPanelPopover.hide(); dateFormatSettingsPanelPopover.hide();
@ -187,15 +189,18 @@ export class DateFormatSelectComponent implements OnInit, ControlValueAccessor {
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const ctx: any = { const autoDateFormatSettingsPanelPopover = this.popoverService.displayPopover({
autoDateFormatSettings: mergeDeep({} as AutoDateFormatSettings, trigger,
defaultAutoDateFormatSettings, this.modelValue.autoDateFormatSettings) renderer: this.renderer,
}; componentType: AutoDateFormatSettingsPanelComponent,
const autoDateFormatSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, hostView: this.viewContainerRef,
this.viewContainerRef, AutoDateFormatSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, preferredPlacement: ['leftOnly', 'leftTopOnly', 'leftBottomOnly'],
ctx, context: {
{}, autoDateFormatSettings: mergeDeep({} as AutoDateFormatSettings,
{}, {}, true); defaultAutoDateFormatSettings, this.modelValue.autoDateFormatSettings)
},
isModal: true
});
autoDateFormatSettingsPanelPopover.tbComponentRef.instance.popover = autoDateFormatSettingsPanelPopover; autoDateFormatSettingsPanelPopover.tbComponentRef.instance.popover = autoDateFormatSettingsPanelPopover;
autoDateFormatSettingsPanelPopover.tbComponentRef.instance.autoDateFormatSettingsApplied.subscribe((autoDateFormatSettings) => { autoDateFormatSettingsPanelPopover.tbComponentRef.instance.autoDateFormatSettingsApplied.subscribe((autoDateFormatSettings) => {
autoDateFormatSettingsPanelPopover.hide(); autoDateFormatSettingsPanelPopover.hide();

25
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/dynamic-form/dynamic-form-property-row.component.ts

@ -168,17 +168,20 @@ export class DynamicFormPropertyRowComponent implements ControlValueAccessor, On
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const ctx: any = { const dynamicFormPropertyPanelPopover = this.popoverService.displayPopover({
isAdd: add, trigger,
disabled: this.disabled, renderer: this.renderer,
booleanPropertyIds: this.booleanPropertyIds, componentType: DynamicFormPropertyPanelComponent,
property: deepClone(this.modelValue) hostView: this.viewContainerRef,
}; preferredPlacement: ['leftOnly', 'leftTopOnly', 'leftBottomOnly'],
const dynamicFormPropertyPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, context: {
this.viewContainerRef, DynamicFormPropertyPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, isAdd: add,
ctx, disabled: this.disabled,
{}, booleanPropertyIds: this.booleanPropertyIds,
{}, {}, true); property: deepClone(this.modelValue)
},
isModal: true
});
dynamicFormPropertyPanelPopover.tbComponentRef.instance.popover = dynamicFormPropertyPanelPopover; dynamicFormPropertyPanelPopover.tbComponentRef.instance.popover = dynamicFormPropertyPanelPopover;
dynamicFormPropertyPanelPopover.tbComponentRef.instance.propertySettingsApplied.subscribe((property) => { dynamicFormPropertyPanelPopover.tbComponentRef.instance.propertySettingsApplied.subscribe((property) => {
dynamicFormPropertyPanelPopover.hide(); dynamicFormPropertyPanelPopover.hide();

14
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/font-settings.component.ts

@ -109,11 +109,15 @@ export class FontSettingsComponent implements OnInit, ControlValueAccessor {
ctx.previewText = previewText; ctx.previewText = previewText;
} }
} }
const fontSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, const fontSettingsPanelPopover = this.popoverService.displayPopover({
this.viewContainerRef, FontSettingsPanelComponent, 'left', false, null, trigger,
ctx, renderer: this.renderer,
{}, componentType: FontSettingsPanelComponent,
{}, {}, true); hostView: this.viewContainerRef,
preferredPlacement: 'left',
context: ctx,
isModal: true
});
fontSettingsPanelPopover.tbComponentRef.instance.popover = fontSettingsPanelPopover; fontSettingsPanelPopover.tbComponentRef.instance.popover = fontSettingsPanelPopover;
fontSettingsPanelPopover.tbComponentRef.instance.fontApplied.subscribe((font) => { fontSettingsPanelPopover.tbComponentRef.instance.fontApplied.subscribe((font) => {
fontSettingsPanelPopover.hide(); fontSettingsPanelPopover.hide();

16
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-keys.component.ts

@ -565,14 +565,20 @@ export class DataKeysComponent implements ControlValueAccessor, OnInit, OnChange
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const colorPickerPopover = this.popoverService.displayPopover(trigger, this.renderer, const colorPickerPopover = this.popoverService.displayPopover({
this.viewContainerRef, ColorPickerPanelComponent, ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], true, null, trigger,
{ renderer: this.renderer,
componentType: ColorPickerPanelComponent,
hostView: this.viewContainerRef,
preferredPlacement: ['leftTopOnly', 'leftOnly', 'leftBottomOnly'],
context: {
color: key.color, color: key.color,
colorCancelButton: true colorCancelButton: true
}, },
{}, showCloseButton: false,
{}, {}, false, () => {}, {padding: '12px 4px 12px 12px'}); popoverContentStyle: {padding: '12px 4px 12px 12px'},
isModal: true
});
colorPickerPopover.tbComponentRef.instance.popover = colorPickerPopover; colorPickerPopover.tbComponentRef.instance.popover = colorPickerPopover;
colorPickerPopover.tbComponentRef.instance.colorSelected.subscribe((color) => { colorPickerPopover.tbComponentRef.instance.colorSelected.subscribe((color) => {
colorPickerPopover.hide(); colorPickerPopover.hide();

29
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings.component.ts

@ -97,19 +97,22 @@ export class DataLayerColorSettingsComponent implements ControlValueAccessor {
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const ctx: any = { const colorSettingsPanelPopover = this.popoverService.displayPopover({
colorSettings: this.modelValue, trigger,
context: this.context, renderer: this.renderer,
dsType: this.dsType, componentType: DataLayerColorSettingsPanelComponent,
dsEntityAliasId: this.dsEntityAliasId, hostView: this.viewContainerRef,
dsDeviceId: this.dsDeviceId, preferredPlacement: 'left',
helpId: this.helpId context: {
}; colorSettings: this.modelValue,
const colorSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, context: this.context,
this.viewContainerRef, DataLayerColorSettingsPanelComponent, 'left', false, null, dsType: this.dsType,
ctx, dsEntityAliasId: this.dsEntityAliasId,
{}, dsDeviceId: this.dsDeviceId,
{}, {}, true); helpId: this.helpId
},
isModal: true
});
colorSettingsPanelPopover.tbComponentRef.instance.popover = colorSettingsPanelPopover; colorSettingsPanelPopover.tbComponentRef.instance.popover = colorSettingsPanelPopover;
colorSettingsPanelPopover.tbComponentRef.instance.colorSettingsApplied.subscribe((colorSettings) => { colorSettingsPanelPopover.tbComponentRef.instance.colorSettingsApplied.subscribe((colorSettings) => {
colorSettingsPanelPopover.hide(); colorSettingsPanelPopover.hide();

19
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-layer-row.component.ts

@ -180,14 +180,17 @@ export class MapLayerRowComponent implements ControlValueAccessor, OnInit {
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const ctx: any = { const mapLayerSettingsPanelPopover = this.popoverService.displayPopover({
mapLayerSettings: deepClone(this.modelValue) trigger,
}; renderer: this.renderer,
const mapLayerSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, componentType: MapLayerSettingsPanelComponent,
this.viewContainerRef, MapLayerSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, hostView: this.viewContainerRef,
ctx, preferredPlacement: ['leftOnly', 'leftTopOnly', 'leftBottomOnly'],
{}, context: {
{}, {}, true); mapLayerSettings: deepClone(this.modelValue)
},
isModal: true
});
mapLayerSettingsPanelPopover.tbComponentRef.instance.popover = mapLayerSettingsPanelPopover; mapLayerSettingsPanelPopover.tbComponentRef.instance.popover = mapLayerSettingsPanelPopover;
mapLayerSettingsPanelPopover.tbComponentRef.instance.mapLayerSettingsApplied.subscribe((layer) => { mapLayerSettingsPanelPopover.tbComponentRef.instance.mapLayerSettingsApplied.subscribe((layer) => {
mapLayerSettingsPanelPopover.hide(); mapLayerSettingsPanelPopover.hide();

32
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-tooltip-tag-actions.component.ts

@ -151,21 +151,23 @@ export class MapTooltipTagActionsComponent implements ControlValueAccessor, OnIn
} else { } else {
const title = this.translate.instant(isAdd ? 'widgets.maps.data-layer.add-tooltip-tag-action' : 'widgets.maps.data-layer.edit-tooltip-tag-action'); const title = this.translate.instant(isAdd ? 'widgets.maps.data-layer.add-tooltip-tag-action' : 'widgets.maps.data-layer.edit-tooltip-tag-action');
const applyTitle = this.translate.instant(isAdd ? 'action.add' : 'action.apply'); const applyTitle = this.translate.instant(isAdd ? 'action.add' : 'action.apply');
const ctx: any = { const widgetActionSettingsPanelPopover = this.popoverService.displayPopover({
widgetAction: action, trigger,
withName: true, renderer: this.renderer,
actionNames, componentType: WidgetActionSettingsPanelComponent,
panelTitle: title, hostView: this.viewContainerRef,
applyTitle, preferredPlacement: ['leftTopOnly', 'leftOnly', 'leftBottomOnly'],
widgetType: widgetType.latest, context: {
callbacks: this.context.callbacks widgetAction: action,
}; withName: true,
const widgetActionSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, actionNames,
this.viewContainerRef, WidgetActionSettingsPanelComponent, panelTitle: title,
['leftTopOnly', 'leftOnly', 'leftBottomOnly'], false, null, applyTitle,
ctx, widgetType: widgetType.latest,
{}, callbacks: this.context.callbacks
{}, {}, true); },
isModal: true
});
widgetActionSettingsPanelPopover.tbComponentRef.instance.widgetActionApplied.subscribe((widgetAction) => { widgetActionSettingsPanelPopover.tbComponentRef.instance.widgetActionApplied.subscribe((widgetAction) => {
widgetActionSettingsPanelPopover.hide(); widgetActionSettingsPanelPopover.hide();
callback(widgetAction); callback(widgetAction);

19
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-image-settings.component.ts

@ -76,14 +76,17 @@ export class MarkerImageSettingsComponent implements ControlValueAccessor {
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const ctx: any = { const markerImageSettingsPanelPopover = this.popoverService.displayPopover({
markerImageSettings: this.modelValue, trigger,
}; renderer: this.renderer,
const markerImageSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, componentType: MarkerImageSettingsPanelComponent,
this.viewContainerRef, MarkerImageSettingsPanelComponent, 'left', false, null, hostView: this.viewContainerRef,
ctx, preferredPlacement: 'left',
{}, context: {
{}, {}, true); markerImageSettings: this.modelValue,
},
isModal: true
});
markerImageSettingsPanelPopover.tbComponentRef.instance.popover = markerImageSettingsPanelPopover; markerImageSettingsPanelPopover.tbComponentRef.instance.popover = markerImageSettingsPanelPopover;
markerImageSettingsPanelPopover.tbComponentRef.instance.markerImageSettingsApplied.subscribe((markerImageSettings) => { markerImageSettingsPanelPopover.tbComponentRef.instance.markerImageSettingsApplied.subscribe((markerImageSettings) => {
markerImageSettingsPanelPopover.hide(); markerImageSettingsPanelPopover.hide();

25
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-shape-settings.component.ts

@ -177,17 +177,20 @@ export class MarkerShapeSettingsComponent implements ControlValueAccessor, OnIni
); );
}); });
} else if (this.markerType === MarkerType.icon) { } else if (this.markerType === MarkerType.icon) {
const ctx: any = { const markerIconShapesPopover = this.popoverService.displayPopover({
iconContainer: (this.modelValue as MarkerIconSettings).iconContainer, trigger,
icon: (this.modelValue as MarkerIconSettings).icon, renderer: this.renderer,
color: this.modelValue.color.color, componentType: MarkerIconShapesComponent,
trip: this.trip hostView: this.viewContainerRef,
}; preferredPlacement: 'left',
const markerIconShapesPopover = this.popoverService.displayPopover(trigger, this.renderer, context: {
this.viewContainerRef, MarkerIconShapesComponent, 'left', true, null, iconContainer: (this.modelValue as MarkerIconSettings).iconContainer,
ctx, icon: (this.modelValue as MarkerIconSettings).icon,
{}, color: this.modelValue.color.color,
{}, {}, true); trip: this.trip
},
isModal: true
});
markerIconShapesPopover.tbComponentRef.instance.popover = markerIconShapesPopover; markerIconShapesPopover.tbComponentRef.instance.popover = markerIconShapesPopover;
markerIconShapesPopover.tbComponentRef.instance.markerIconSelected.subscribe((iconInfo) => { markerIconShapesPopover.tbComponentRef.instance.markerIconSelected.subscribe((iconInfo) => {
markerIconShapesPopover.hide(); markerIconShapesPopover.hide();

16
ui-ngx/src/app/modules/home/pages/mobile/applications/mobile-app.component.ts

@ -166,11 +166,17 @@ export class MobileAppComponent extends EntityComponent<MobileApp> {
? this.entityForm.get('versionInfo.latestVersionReleaseNotes').value ? this.entityForm.get('versionInfo.latestVersionReleaseNotes').value
: this.entityForm.get('versionInfo.minVersionReleaseNotes').value : this.entityForm.get('versionInfo.minVersionReleaseNotes').value
}; };
const releaseNotesPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, const releaseNotesPanelPopover = this.popoverService.displayPopover({
this.viewContainerRef, EditorPanelComponent, ['leftOnly', 'leftBottomOnly', 'leftTopOnly'], true, null, trigger,
ctx, renderer: this.renderer,
{}, hostView: this.viewContainerRef,
{}, {}, false, () => {}, {padding: '16px 24px'}); componentType: EditorPanelComponent,
preferredPlacement: ['leftOnly', 'leftBottomOnly', 'leftTopOnly'],
context: ctx,
showCloseButton: false,
popoverContentStyle: {padding: '16px 24px'},
isModal: false
});
releaseNotesPanelPopover.tbComponentRef.instance.popover = releaseNotesPanelPopover; releaseNotesPanelPopover.tbComponentRef.instance.popover = releaseNotesPanelPopover;
releaseNotesPanelPopover.tbComponentRef.instance.editorContentApplied.subscribe((releaseNotes) => { releaseNotesPanelPopover.tbComponentRef.instance.editorContentApplied.subscribe((releaseNotes) => {
releaseNotesPanelPopover.hide(); releaseNotesPanelPopover.hide();

31
ui-ngx/src/app/modules/home/pages/mobile/bundes/layout/mobile-page-item-row.component.ts

@ -55,6 +55,7 @@ import { TbPopoverService } from '@shared/components/popover.service';
import { CustomMobilePagePanelComponent } from '@home/pages/mobile/bundes/layout/custom-mobile-page-panel.component'; import { CustomMobilePagePanelComponent } from '@home/pages/mobile/bundes/layout/custom-mobile-page-panel.component';
import { DefaultMobilePagePanelComponent } from '@home/pages/mobile/bundes/layout/default-mobile-page-panel.component'; import { DefaultMobilePagePanelComponent } from '@home/pages/mobile/bundes/layout/default-mobile-page-panel.component';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { DisplayPopoverConfig } from '@shared/components/popover.models';
@Component({ @Component({
selector: 'tb-mobile-menu-item-row', selector: 'tb-mobile-menu-item-row',
@ -222,27 +223,31 @@ export class MobilePageItemRowComponent implements ControlValueAccessor, OnInit,
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const ctx: any = { const config: DisplayPopoverConfig<any> = {
disabled: this.disabled, trigger,
pageItem: deepClone(this.modelValue) renderer: this.renderer,
componentType: undefined,
hostView: this.viewContainerRef,
preferredPlacement: ['right', 'bottom', 'top'],
context: {
disabled: this.disabled,
pageItem: deepClone(this.modelValue)
},
showCloseButton: false,
popoverContentStyle: {padding: '16px 24px'},
isModal: true
}; };
if (this.isDefaultMenuItem) { if (this.isDefaultMenuItem) {
const defaultMobilePagePanelPopover = this.popoverService.displayPopover(trigger, this.renderer, config.componentType = DefaultMobilePagePanelComponent;
this.viewContainerRef, DefaultMobilePagePanelComponent, ['right', 'bottom', 'top'], true, null, const defaultMobilePagePanelPopover = this.popoverService.displayPopover(config);
ctx,
{},
{}, {}, false, () => {}, {padding: '16px 24px'});
defaultMobilePagePanelPopover.tbComponentRef.instance.popover = defaultMobilePagePanelPopover; defaultMobilePagePanelPopover.tbComponentRef.instance.popover = defaultMobilePagePanelPopover;
defaultMobilePagePanelPopover.tbComponentRef.instance.defaultMobilePageApplied.subscribe((menuItem) => { defaultMobilePagePanelPopover.tbComponentRef.instance.defaultMobilePageApplied.subscribe((menuItem) => {
defaultMobilePagePanelPopover.hide(); defaultMobilePagePanelPopover.hide();
this.afterPageEdit(menuItem); this.afterPageEdit(menuItem);
}); });
} else { } else {
const customMobilePagePanelPopover = this.popoverService.displayPopover(trigger, this.renderer, config.componentType = CustomMobilePagePanelComponent;
this.viewContainerRef, CustomMobilePagePanelComponent, ['right', 'bottom', 'top'], true, null, const customMobilePagePanelPopover = this.popoverService.displayPopover(config);
ctx,
{},
{}, {}, false, () => {}, {padding: '16px 24px'});
customMobilePagePanelPopover.tbComponentRef.instance.popover = customMobilePagePanelPopover; customMobilePagePanelPopover.tbComponentRef.instance.popover = customMobilePagePanelPopover;
customMobilePagePanelPopover.tbComponentRef.instance.customMobilePageApplied.subscribe((page) => { customMobilePagePanelPopover.tbComponentRef.instance.customMobilePageApplied.subscribe((page) => {
customMobilePagePanelPopover.hide(); customMobilePagePanelPopover.hide();

27
ui-ngx/src/app/modules/home/pages/scada-symbol/metadata-components/scada-symbol-behavior-row.component.ts

@ -203,18 +203,21 @@ export class ScadaSymbolBehaviorRowComponent implements ControlValueAccessor, On
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const ctx: any = { const scadaSymbolBehaviorPanelPopover = this.popoverService.displayPopover({
isAdd: add, trigger,
disabled: this.disabled, renderer: this.renderer,
aliasController: this.aliasController, componentType: ScadaSymbolBehaviorPanelComponent,
callbacks: this.callbacks, hostView: this.viewContainerRef,
behavior: deepClone(this.modelValue) preferredPlacement: ['leftOnly', 'leftTopOnly', 'leftBottomOnly'],
}; context: {
const scadaSymbolBehaviorPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, isAdd: add,
this.viewContainerRef, ScadaSymbolBehaviorPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], true, null, disabled: this.disabled,
ctx, aliasController: this.aliasController,
{}, callbacks: this.callbacks,
{}, {}, true); behavior: deepClone(this.modelValue)
},
isModal: true
});
scadaSymbolBehaviorPanelPopover.tbComponentRef.instance.popover = scadaSymbolBehaviorPanelPopover; scadaSymbolBehaviorPanelPopover.tbComponentRef.instance.popover = scadaSymbolBehaviorPanelPopover;
scadaSymbolBehaviorPanelPopover.tbComponentRef.instance.behaviorSettingsApplied.subscribe((behavior) => { scadaSymbolBehaviorPanelPopover.tbComponentRef.instance.behaviorSettingsApplied.subscribe((behavior) => {
scadaSymbolBehaviorPanelPopover.hide(); scadaSymbolBehaviorPanelPopover.hide();

28
ui-ngx/src/app/modules/home/pages/scada-symbol/metadata-components/scada-symbol-metadata-tag.component.ts

@ -158,19 +158,21 @@ export class ScadaSymbolMetadataTagComponent implements ControlValueAccessor, On
tagFunctionControl = this.tagFormGroup.get('clickAction'); tagFunctionControl = this.tagFormGroup.get('clickAction');
completer = this.clickActionFunctionCompleter; completer = this.clickActionFunctionCompleter;
} }
const ctx: any = { const scadaSymbolTagFunctionPanelPopover = this.popoverService.displayPopover({
tagFunction: tagFunctionControl.value, trigger,
tagFunctionType, renderer: this.renderer,
tag: this.tagFormGroup.get('tag').value, componentType: ScadaSymbolMetadataTagFunctionPanelComponent,
completer, hostView: this.viewContainerRef,
disabled: this.disabled preferredPlacement: ['leftOnly', 'leftTopOnly', 'leftBottomOnly'],
}; context: {
const scadaSymbolTagFunctionPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, tagFunction: tagFunctionControl.value,
this.viewContainerRef, ScadaSymbolMetadataTagFunctionPanelComponent, tagFunctionType,
['leftOnly', 'leftTopOnly', 'leftBottomOnly'], true, null, tag: this.tagFormGroup.get('tag').value,
ctx, completer,
{}, disabled: this.disabled
{}, {}, true); },
isModal: true
});
scadaSymbolTagFunctionPanelPopover.tbComponentRef.instance.popover = scadaSymbolTagFunctionPanelPopover; scadaSymbolTagFunctionPanelPopover.tbComponentRef.instance.popover = scadaSymbolTagFunctionPanelPopover;
scadaSymbolTagFunctionPanelPopover.tbComponentRef.instance.tagFunctionApplied.subscribe((tagFunction) => { scadaSymbolTagFunctionPanelPopover.tbComponentRef.instance.tagFunctionApplied.subscribe((tagFunction) => {
scadaSymbolTagFunctionPanelPopover.hide(); scadaSymbolTagFunctionPanelPopover.hide();

14
ui-ngx/src/app/modules/home/pages/widget/widget-editor.component.ts

@ -816,11 +816,15 @@ export class WidgetEditorComponent extends PageComponent implements OnInit, OnDe
const ctx: any = { const ctx: any = {
modules: deepClone(this.controllerScriptModules) modules: deepClone(this.controllerScriptModules)
}; };
const modulesPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, const modulesPanelPopover = this.popoverService.displayPopover({
this.viewContainerRef, JsFuncModulesComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], true, null, trigger,
ctx, renderer: this.renderer,
{}, hostView: this.viewContainerRef,
{}, {}, true); componentType: JsFuncModulesComponent,
preferredPlacement: ['leftOnly', 'leftTopOnly', 'leftBottomOnly'],
context: ctx,
isModal: true
});
modulesPanelPopover.tbComponentRef.instance.popover = modulesPanelPopover; modulesPanelPopover.tbComponentRef.instance.popover = modulesPanelPopover;
modulesPanelPopover.tbComponentRef.instance.modulesApplied.subscribe((modules) => { modulesPanelPopover.tbComponentRef.instance.modulesApplied.subscribe((modules) => {
modulesPanelPopover.hide(); modulesPanelPopover.hide();

23
ui-ngx/src/app/shared/components/color-input.component.ts

@ -196,14 +196,21 @@ export class ColorInputComponent extends PageComponent implements OnInit, Contro
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const colorPickerPopover = this.popoverService.displayPopover(trigger, this.renderer, const colorPickerPopover = this.popoverService.displayPopover({
this.viewContainerRef, ColorPickerPanelComponent, ['left'], true, null, trigger,
{ renderer: this.renderer,
color: this.colorFormGroup.get('color').value, hostView: this.viewContainerRef,
colorClearButton: this.colorClearButton, componentType: ColorPickerPanelComponent,
colorCancelButton: true preferredPlacement: ['left'],
}, context: {
{}, {}, {}, false, () => {}, {padding: '12px 4px 12px 12px'}); color: this.colorFormGroup.get('color').value,
colorClearButton: this.colorClearButton,
colorCancelButton: true
},
showCloseButton: false,
popoverContentStyle: {padding: '12px 4px 12px 12px'},
isModal: true
})
colorPickerPopover.tbComponentRef.instance.popover = colorPickerPopover; colorPickerPopover.tbComponentRef.instance.popover = colorPickerPopover;
colorPickerPopover.tbComponentRef.instance.colorSelected.subscribe((color) => { colorPickerPopover.tbComponentRef.instance.colorSelected.subscribe((color) => {
colorPickerPopover.hide(); colorPickerPopover.hide();

19
ui-ngx/src/app/shared/components/js-func.component.ts

@ -518,14 +518,17 @@ export class JsFuncComponent implements OnInit, OnChanges, OnDestroy, ControlVal
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const ctx: any = { const modulesPanelPopover = this.popoverService.displayPopover({
modules: deepClone(this.modules) trigger,
}; renderer: this.renderer,
const modulesPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, componentType: JsFuncModulesComponent,
this.viewContainerRef, JsFuncModulesComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, hostView: this.viewContainerRef,
ctx, preferredPlacement: 'leftTop',
{}, context: {
{}, {}, true); modules: deepClone(this.modules)
},
isModal: true
});
modulesPanelPopover.tbComponentRef.instance.popover = modulesPanelPopover; modulesPanelPopover.tbComponentRef.instance.popover = modulesPanelPopover;
modulesPanelPopover.tbComponentRef.instance.modulesApplied.subscribe((modules) => { modulesPanelPopover.tbComponentRef.instance.modulesApplied.subscribe((modules) => {
modulesPanelPopover.hide(); modulesPanelPopover.hide();

10
ui-ngx/src/app/shared/components/popover.component.ts

@ -311,6 +311,7 @@ export class TbPopoverDirective implements OnChanges, OnDestroy, AfterViewInit {
#overlay="cdkConnectedOverlay" #overlay="cdkConnectedOverlay"
cdkConnectedOverlay cdkConnectedOverlay
[cdkConnectedOverlayHasBackdrop]="hasBackdrop" [cdkConnectedOverlayHasBackdrop]="hasBackdrop"
[cdkConnectedOverlayBackdropClass]="backdropClass"
[cdkConnectedOverlayOrigin]="origin" [cdkConnectedOverlayOrigin]="origin"
[cdkConnectedOverlayPositions]="positions" [cdkConnectedOverlayPositions]="positions"
[cdkConnectedOverlayScrollStrategy]="scrollStrategy" [cdkConnectedOverlayScrollStrategy]="scrollStrategy"
@ -382,6 +383,7 @@ export class TbPopoverComponent<T = any> implements OnDestroy, OnInit {
tbMouseLeaveDelay?: number; tbMouseLeaveDelay?: number;
tbHideOnClickOutside = true; tbHideOnClickOutside = true;
tbShowCloseButton = true; tbShowCloseButton = true;
tbModal = false;
tbAnimationState = 'active'; tbAnimationState = 'active';
@ -461,7 +463,11 @@ export class TbPopoverComponent<T = any> implements OnDestroy, OnInit {
} }
get hasBackdrop(): boolean { get hasBackdrop(): boolean {
return this.tbTrigger === 'click' ? this.tbBackdrop : false; return this.tbModal || (this.tbTrigger === 'click' && this.tbBackdrop);
}
get backdropClass(): string {
return this.tbModal ? 'tb-popover-overlay-backdrop' : '';
} }
preferredPlacement: PopoverPlacement = 'top'; preferredPlacement: PopoverPlacement = 'top';
@ -634,7 +640,7 @@ export class TbPopoverComponent<T = any> implements OnDestroy, OnInit {
} }
onClickOutside(event: MouseEvent): void { onClickOutside(event: MouseEvent): void {
if (this.tbHideOnClickOutside && !this.origin.elementRef.nativeElement.contains(event.target) && this.tbTrigger !== null) { if (!this.tbModal && this.tbHideOnClickOutside && !this.origin.elementRef.nativeElement.contains(event.target) && this.tbTrigger !== null) {
if (!this.isTopOverlay(event.target as Element)) { if (!this.isTopOverlay(event.target as Element)) {
this.hide(); this.hide();
} }

34
ui-ngx/src/app/shared/components/popover.models.ts

@ -18,6 +18,7 @@ import { animate, AnimationTriggerMetadata, style, transition, trigger } from '@
import { ConnectedOverlayPositionChange } from '@angular/cdk/overlay'; import { ConnectedOverlayPositionChange } from '@angular/cdk/overlay';
import { TbPopoverComponent } from '@shared/components/popover.component'; import { TbPopoverComponent } from '@shared/components/popover.component';
import { POSITION_MAP } from '@shared/models/overlay.models'; import { POSITION_MAP } from '@shared/models/overlay.models';
import { ComponentRef, Injector, Renderer2, Type, ViewContainerRef } from '@angular/core';
export const popoverMotion: AnimationTriggerMetadata = trigger('popoverMotion', [ export const popoverMotion: AnimationTriggerMetadata = trigger('popoverMotion', [
transition('void => active', [ transition('void => active', [
@ -88,3 +89,36 @@ export interface PopoverWithTrigger {
trigger: Element; trigger: Element;
popoverComponent: TbPopoverComponent; popoverComponent: TbPopoverComponent;
} }
export interface DisplayPopoverConfig<T> extends Omit<DisplayPopoverWithComponentRefConfig<T>, 'componentRef'>{
hostView: ViewContainerRef;
}
export interface DisplayPopoverWithComponentRefConfig<T> {
componentRef: ComponentRef<TbPopoverComponent>
trigger: Element;
renderer: Renderer2;
componentType: Type<T>;
preferredPlacement?: PopoverPreferredPlacement;
hideOnClickOutside?: boolean;
injector?: Injector;
context?: any;
overlayStyle?: any;
popoverStyle?: any;
style?: any,
showCloseButton?: boolean;
visibleFn?: (visible: boolean) => void;
popoverContentStyle?: any;
isModal?: boolean;
}
export const defaultPopoverConfig: Partial<DisplayPopoverWithComponentRefConfig<any>> = {
preferredPlacement: 'top',
hideOnClickOutside: true,
overlayStyle: {},
popoverStyle: {},
showCloseButton: true,
visibleFn: () => {},
popoverContentStyle: {},
isModal: false
};

122
ui-ngx/src/app/shared/components/popover.service.ts

@ -24,12 +24,19 @@ import {
Type, Type,
ViewContainerRef ViewContainerRef
} from '@angular/core'; } from '@angular/core';
import { PopoverPreferredPlacement, PopoverWithTrigger } from '@shared/components/popover.models'; import {
defaultPopoverConfig,
DisplayPopoverConfig,
DisplayPopoverWithComponentRefConfig,
PopoverPreferredPlacement,
PopoverWithTrigger
} from '@shared/components/popover.models';
import { TbPopoverComponent } from '@shared/components/popover.component'; import { TbPopoverComponent } from '@shared/components/popover.component';
import { ComponentType } from '@angular/cdk/portal'; import { ComponentType } from '@angular/cdk/portal';
import { HELP_MARKDOWN_COMPONENT_TOKEN } from '@shared/components/tokens'; import { HELP_MARKDOWN_COMPONENT_TOKEN } from '@shared/components/tokens';
import { CdkOverlayOrigin } from '@angular/cdk/overlay'; import { CdkOverlayOrigin } from '@angular/cdk/overlay';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { mergeDeep } from '@core/utils';
@Injectable() @Injectable()
export class TbPopoverService { export class TbPopoverService {
@ -58,57 +65,108 @@ export class TbPopoverService {
return hostView.createComponent(TbPopoverComponent); return hostView.createComponent(TbPopoverComponent);
} }
displayPopover<T>(config: DisplayPopoverConfig<T>): TbPopoverComponent<T>;
displayPopover<T>(trigger: Element, renderer: Renderer2, hostView: ViewContainerRef, displayPopover<T>(trigger: Element, renderer: Renderer2, hostView: ViewContainerRef,
componentType: Type<T>, preferredPlacement: PopoverPreferredPlacement = 'top', componentType: Type<T>, preferredPlacement: PopoverPreferredPlacement,
hideOnClickOutside = true, injector?: Injector, context?: any, overlayStyle: any = {}, hideOnClickOutside: boolean, injector?: Injector, context?: any, overlayStyle?: any,
popoverStyle: any = {}, style?: any, popoverStyle?: any, style?: any,
showCloseButton = true, visibleFn: (visible: boolean) => void = () => {}, showCloseButton?: boolean, visibleFn?: (visible: boolean) => void,
popoverContentStyle: any = {}): TbPopoverComponent<T> { popoverContentStyle?: any): TbPopoverComponent<T>;
const componentRef = this.createPopoverRef(hostView); displayPopover<T>(config: Element | DisplayPopoverConfig<T>, renderer?: Renderer2, hostView?: ViewContainerRef,
return this.displayPopoverWithComponentRef(componentRef, trigger, renderer, componentType, preferredPlacement, hideOnClickOutside, componentType?: Type<T>, preferredPlacement?: PopoverPreferredPlacement,
injector, context, overlayStyle, popoverStyle, style, showCloseButton, visibleFn, popoverContentStyle); hideOnClickOutside?: boolean, injector?: Injector, context?: any, overlayStyle?: any,
popoverStyle?: any, style?: any,
showCloseButton?: boolean, visibleFn?: (visible: boolean) => void,
popoverContentStyle?: any): TbPopoverComponent<T> {
if (!(config instanceof Element) && 'trigger' in config && 'renderer' in config && 'componentType' in config) {
const componentRef = this.createPopoverRef(config.hostView);
return this.displayPopoverWithComponentRef<T>({ ...config, componentRef })
} else if (config instanceof Element) {
const componentRef = this.createPopoverRef(hostView);
return this.displayPopoverWithComponentRef<T>(componentRef, config, renderer, componentType, preferredPlacement, hideOnClickOutside,
injector, context, overlayStyle, popoverStyle, style, showCloseButton, visibleFn, popoverContentStyle);
} else {
throw new Error("Invalid configuration provided for displayPopover");
}
} }
displayPopoverWithComponentRef<T>(config: DisplayPopoverWithComponentRefConfig<T>): TbPopoverComponent<T>;
displayPopoverWithComponentRef<T>(componentRef: ComponentRef<TbPopoverComponent>, trigger: Element, renderer: Renderer2, displayPopoverWithComponentRef<T>(componentRef: ComponentRef<TbPopoverComponent>, trigger: Element, renderer: Renderer2,
componentType: Type<T>, preferredPlacement: PopoverPreferredPlacement = 'top', componentType: Type<T>, preferredPlacement: PopoverPreferredPlacement,
hideOnClickOutside = true, injector?: Injector, context?: any, overlayStyle: any = {}, hideOnClickOutside: boolean, injector?: Injector, context?: any, overlayStyle?: any,
popoverStyle: any = {}, style?: any, showCloseButton = true, popoverStyle?: any, style?: any, showCloseButton?: boolean,
visibleFn: (visible: boolean) => void = () => {}, visibleFn?: (visible: boolean) => void, popoverContentStyle?: any): TbPopoverComponent<T>;
displayPopoverWithComponentRef<T>(config: ComponentRef<TbPopoverComponent> | DisplayPopoverWithComponentRefConfig<T>,
trigger?: Element, renderer?: Renderer2, componentType?: Type<T>,
preferredPlacement?: PopoverPreferredPlacement, hideOnClickOutside?: boolean,
injector?: Injector, context?: any, overlayStyle?: any,
popoverStyle?: any, style?: any, showCloseButton?: boolean,
visibleFn?: (visible: boolean) => void,
popoverContentStyle: any = {}): TbPopoverComponent<T> { popoverContentStyle: any = {}): TbPopoverComponent<T> {
const component = componentRef.instance; let popoverConfig: DisplayPopoverWithComponentRefConfig<T>;
if (!(config instanceof ComponentRef) && 'trigger' in config && 'renderer' in config && 'componentType' in config) {
popoverConfig = config;
} else if(config instanceof ComponentRef) {
popoverConfig = {
componentRef: config,
trigger,
renderer,
componentType,
preferredPlacement,
hideOnClickOutside,
injector,
context,
overlayStyle,
popoverStyle,
style,
showCloseButton,
visibleFn,
popoverContentStyle
}
} else {
throw new Error("Invalid configuration provided for displayPopoverWithComponentRef");
}
popoverConfig = mergeDeep({} as any, defaultPopoverConfig, popoverConfig);
return this._displayPopoverWithComponentRef(popoverConfig);
}
private _displayPopoverWithComponentRef<T>(conf: DisplayPopoverWithComponentRefConfig<T>): TbPopoverComponent<T> {
const component = conf.componentRef.instance;
this.popoverWithTriggers.push({ this.popoverWithTriggers.push({
trigger, trigger: conf.trigger,
popoverComponent: component popoverComponent: component
}); });
renderer.removeChild( conf.renderer.removeChild(
renderer.parentNode(trigger), conf.renderer.parentNode(conf.trigger),
componentRef.location.nativeElement conf.componentRef.location.nativeElement
); );
const originElementRef = new ElementRef(trigger); const originElementRef = new ElementRef(conf.trigger);
component.setOverlayOrigin(new CdkOverlayOrigin(originElementRef)); component.setOverlayOrigin(new CdkOverlayOrigin(originElementRef));
component.tbPlacement = preferredPlacement; component.tbPlacement = conf.preferredPlacement;
component.tbComponent = componentType; component.tbComponent = conf.componentType;
component.tbComponentInjector = injector; component.tbComponentInjector = conf.injector;
component.tbComponentContext = context; component.tbComponentContext = conf.context;
component.tbOverlayStyle = overlayStyle; component.tbOverlayStyle = conf.overlayStyle;
component.tbPopoverInnerStyle = popoverStyle; component.tbModal = conf.isModal;
component.tbPopoverInnerContentStyle = popoverContentStyle; component.tbPopoverInnerStyle = conf.popoverStyle;
component.tbComponentStyle = style; component.tbPopoverInnerContentStyle = conf.popoverContentStyle;
component.tbHideOnClickOutside = hideOnClickOutside; component.tbComponentStyle = conf.style;
component.tbShowCloseButton = showCloseButton; component.tbHideOnClickOutside = conf.hideOnClickOutside;
component.tbShowCloseButton = conf.showCloseButton;
component.tbVisibleChange.subscribe((visible: boolean) => { component.tbVisibleChange.subscribe((visible: boolean) => {
if (!visible) { if (!visible) {
componentRef.destroy(); conf.componentRef.destroy();
} }
}); });
component.tbDestroy.subscribe(() => { component.tbDestroy.subscribe(() => {
this.removePopoverByComponent(component); this.removePopoverByComponent(component);
}); });
component.tbHideStart.subscribe(() => { component.tbHideStart.subscribe(() => {
visibleFn(false); conf.visibleFn(false);
}); });
component.show(); component.show();
visibleFn(true); conf.visibleFn(true);
return component; return component;
} }

32
ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.ts

@ -558,9 +558,13 @@ export class TimewindowConfigDialogComponent extends PageComponent implements On
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const aggregationConfigPopover = this.popoverService.displayPopover(trigger, this.renderer, const aggregationConfigPopover = this.popoverService.displayPopover({
this.viewContainerRef, AggregationOptionsConfigPanelComponent, ['left', 'leftTop', 'leftBottom'], true, null, trigger,
{ renderer: this.renderer,
hostView: this.viewContainerRef,
componentType: AggregationOptionsConfigPanelComponent,
preferredPlacement: ['left', 'leftTop', 'leftBottom'],
context: {
allowedAggregationTypes: deepClone(this.timewindowForm.get('allowedAggTypes').value), allowedAggregationTypes: deepClone(this.timewindowForm.get('allowedAggTypes').value),
onClose: (result: Array<AggregationType> | null) => { onClose: (result: Array<AggregationType> | null) => {
aggregationConfigPopover.hide(); aggregationConfigPopover.hide();
@ -570,8 +574,10 @@ export class TimewindowConfigDialogComponent extends PageComponent implements On
} }
} }
}, },
{maxHeight: '500px', height: '100%'}, overlayStyle: {maxHeight: '500px', height: '100%'},
{}, {}, true, () => {}, {padding: 0}); popoverContentStyle: {padding: 0},
isModal: true
});
aggregationConfigPopover.tbComponentRef.instance.popoverComponent = aggregationConfigPopover; aggregationConfigPopover.tbComponentRef.instance.popoverComponent = aggregationConfigPopover;
} }
this.cd.detectChanges(); this.cd.detectChanges();
@ -612,9 +618,13 @@ export class TimewindowConfigDialogComponent extends PageComponent implements On
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const intervalsConfigPopover = this.popoverService.displayPopover(trigger, this.renderer, const intervalsConfigPopover = this.popoverService.displayPopover({
this.viewContainerRef, IntervalOptionsConfigPanelComponent, ['left', 'leftTop', 'leftBottom'], true, null, trigger,
{ renderer: this.renderer,
hostView: this.viewContainerRef,
componentType: IntervalOptionsConfigPanelComponent,
preferredPlacement: ['left', 'leftTop', 'leftBottom'],
context: {
aggregation: this.aggregation, aggregation: this.aggregation,
allowedIntervals: deepClone(this.timewindowForm.get(allowedIntervalsControlName).value), allowedIntervals: deepClone(this.timewindowForm.get(allowedIntervalsControlName).value),
aggIntervalsConfig: deepClone(this.timewindowForm.get(aggIntervalsConfigControlName).value), aggIntervalsConfig: deepClone(this.timewindowForm.get(aggIntervalsConfigControlName).value),
@ -629,8 +639,10 @@ export class TimewindowConfigDialogComponent extends PageComponent implements On
} }
} }
}, },
{maxHeight: '500px', height: '100%'}, overlayStyle: {maxHeight: '500px', height: '100%'},
{}, {}, true, () => {}, {padding: 0}); popoverContentStyle: {padding: 0},
isModal: true
});
intervalsConfigPopover.tbComponentRef.instance.popoverComponent = intervalsConfigPopover; intervalsConfigPopover.tbComponentRef.instance.popoverComponent = intervalsConfigPopover;
} }
this.cd.detectChanges(); this.cd.detectChanges();

15
ui-ngx/src/app/shared/components/time/timezone.component.ts

@ -155,9 +155,13 @@ export class TimezoneComponent implements ControlValueAccessor, OnInit {
if (this.popoverService.hasPopover(trigger)) { if (this.popoverService.hasPopover(trigger)) {
this.popoverService.hidePopover(trigger); this.popoverService.hidePopover(trigger);
} else { } else {
const timezoneSelectionPopover = this.popoverService.displayPopover(trigger, this.renderer, const timezoneSelectionPopover = this.popoverService.displayPopover({
this.viewContainerRef, TimezonePanelComponent, ['bottomRight', 'leftBottom'], true, null, trigger,
{ renderer: this.renderer,
hostView: this.viewContainerRef,
componentType: TimezonePanelComponent,
preferredPlacement: ['bottomRight', 'leftBottom'],
context: {
timezone: this.modelValue, timezone: this.modelValue,
userTimezoneByDefault: this.userTimezoneByDefaultValue, userTimezoneByDefault: this.userTimezoneByDefaultValue,
localBrowserTimezonePlaceholderOnEmpty: this.localBrowserTimezonePlaceholderOnEmptyValue, localBrowserTimezonePlaceholderOnEmpty: this.localBrowserTimezonePlaceholderOnEmptyValue,
@ -173,8 +177,9 @@ export class TimezoneComponent implements ControlValueAccessor, OnInit {
} }
} }
}, },
{}, showCloseButton: false,
{}, {}, false); isModal: true
});
timezoneSelectionPopover.tbComponentRef.instance.popoverComponent = timezoneSelectionPopover; timezoneSelectionPopover.tbComponentRef.instance.popoverComponent = timezoneSelectionPopover;
} }
this.cd.detectChanges(); this.cd.detectChanges();

Loading…
Cancel
Save