@c8y/ngx-components 1024.20.0 → 1024.20.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/c8y-ngx-components-application-select.mjs +1 -1
- package/fesm2022/c8y-ngx-components-application-select.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-asset-properties.mjs +3 -2
- package/fesm2022/c8y-ngx-components-asset-properties.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-context-dashboard.mjs +78 -17
- package/fesm2022/c8y-ngx-components-context-dashboard.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-datapoint-selector.mjs +1 -1
- package/fesm2022/c8y-ngx-components-datapoint-selector.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-device-profile.mjs +1 -1
- package/fesm2022/c8y-ngx-components-device-profile.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-echart-models.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-echart.mjs +571 -401
- package/fesm2022/c8y-ngx-components-echart.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-ecosystem-shared.mjs +1 -1
- package/fesm2022/c8y-ngx-components-ecosystem-shared.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-ecosystem.mjs +1 -1
- package/fesm2022/c8y-ngx-components-ecosystem.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-icon-selector.mjs +4 -4
- package/fesm2022/c8y-ngx-components-icon-selector.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-operations-stepper-bulk-type-configuration.mjs +1 -1
- package/fesm2022/c8y-ngx-components-operations-stepper-bulk-type-configuration.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-operations-stepper-bulk-type-device-profile.mjs +1 -1
- package/fesm2022/c8y-ngx-components-operations-stepper-bulk-type-device-profile.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-operations-stepper-bulk-type-software.mjs +1 -1
- package/fesm2022/c8y-ngx-components-operations-stepper-bulk-type-software.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-protocol-lpwan.mjs +2 -2
- package/fesm2022/c8y-ngx-components-protocol-lpwan.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-repository-configuration.mjs +4 -4
- package/fesm2022/c8y-ngx-components-repository-configuration.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-repository-firmware.mjs +2 -2
- package/fesm2022/c8y-ngx-components-repository-firmware.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-repository-shared.mjs +2 -2
- package/fesm2022/c8y-ngx-components-repository-shared.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-repository-software.mjs +1 -1
- package/fesm2022/c8y-ngx-components-repository-software.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-widgets-definitions-html-widget.mjs +17 -1
- package/fesm2022/c8y-ngx-components-widgets-definitions-html-widget.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-widgets-definitions-scada.mjs +21 -1
- package/fesm2022/c8y-ngx-components-widgets-definitions-scada.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-widgets-implementations-asset-table.mjs +60 -31
- package/fesm2022/c8y-ngx-components-widgets-implementations-asset-table.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-widgets-implementations-datapoints-graph.mjs +15 -7
- package/fesm2022/c8y-ngx-components-widgets-implementations-datapoints-graph.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components.mjs +199 -21
- package/fesm2022/c8y-ngx-components.mjs.map +1 -1
- package/locales/de.po +6 -0
- package/locales/es.po +6 -0
- package/locales/fr.po +6 -0
- package/locales/ja_JP.po +6 -0
- package/locales/ko.po +6 -0
- package/locales/nl.po +6 -0
- package/locales/pl.po +6 -0
- package/locales/pt_BR.po +8 -2
- package/locales/zh_CN.po +6 -0
- package/locales/zh_TW.po +6 -0
- package/package.json +1 -1
- package/types/c8y-ngx-components-asset-properties.d.ts.map +1 -1
- package/types/c8y-ngx-components-context-dashboard.d.ts +37 -3
- package/types/c8y-ngx-components-context-dashboard.d.ts.map +1 -1
- package/types/c8y-ngx-components-echart-models.d.ts +2 -0
- package/types/c8y-ngx-components-echart-models.d.ts.map +1 -1
- package/types/c8y-ngx-components-echart.d.ts +70 -1
- package/types/c8y-ngx-components-echart.d.ts.map +1 -1
- package/types/c8y-ngx-components-widgets-implementations-asset-table.d.ts +5 -0
- package/types/c8y-ngx-components-widgets-implementations-asset-table.d.ts.map +1 -1
- package/types/c8y-ngx-components-widgets-implementations-datapoints-graph.d.ts.map +1 -1
- package/types/c8y-ngx-components.d.ts +141 -4
- package/types/c8y-ngx-components.d.ts.map +1 -1
|
@@ -12,7 +12,7 @@ import { NgTemplateOutlet, CommonModule, NgClass, AsyncPipe, NgIf, NgForOf, NgFo
|
|
|
12
12
|
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
|
13
13
|
import * as i6 from '@c8y/ngx-components/context-dashboard-state';
|
|
14
14
|
import * as i2$1 from '@ngx-translate/core';
|
|
15
|
-
import { assign, pick, isEmpty, cloneDeep, some, keys, keyBy, has, set, forEach, get, isEqual, clone,
|
|
15
|
+
import { assign, pick, isEmpty, cloneDeep, some, keys, keyBy, has, set, forEach, get, isEqual, clone, omit, sortBy, isNull, escapeRegExp, findIndex, kebabCase, every, words, camelCase } from 'lodash-es';
|
|
16
16
|
import * as i2$2 from 'ngx-bootstrap/popover';
|
|
17
17
|
import { PopoverModule, PopoverDirective } from 'ngx-bootstrap/popover';
|
|
18
18
|
import * as i1$1 from '@c8y/client';
|
|
@@ -2470,7 +2470,10 @@ class WidgetConfigService {
|
|
|
2470
2470
|
updateConfig(change, force = false) {
|
|
2471
2471
|
if (force) {
|
|
2472
2472
|
this._currentConfig$.next({ ...this._currentConfig$.value, ...change });
|
|
2473
|
-
|
|
2473
|
+
// Apply the change with a shallow assign (as the non-force path does), not a deep merge.
|
|
2474
|
+
if (this._assignedCurrentConfig$.value) {
|
|
2475
|
+
Object.assign(this._assignedCurrentConfig$.value, change);
|
|
2476
|
+
}
|
|
2474
2477
|
return;
|
|
2475
2478
|
}
|
|
2476
2479
|
this.configChange$.next(change);
|
|
@@ -3131,7 +3134,7 @@ class ContextDashboardComponent {
|
|
|
3131
3134
|
get disabled() {
|
|
3132
3135
|
return (!this.hasPermissionToEditDashboard || !this.dashboardDetails?.isCollapsed || this.isDisabled());
|
|
3133
3136
|
}
|
|
3134
|
-
constructor(route, router, contextDashboardService, alert, renderer, moduleConfig, widgetService, bottomDrawerService, gainsightService, actionBarService, translateService, modal, destroyRef, contextDashboardStateService, editModeService) {
|
|
3137
|
+
constructor(route, router, contextDashboardService, alert, renderer, moduleConfig, widgetService, bottomDrawerService, gainsightService, actionBarService, translateService, modal, destroyRef, contextDashboardStateService, editModeService, widgetContextBinding) {
|
|
3135
3138
|
this.route = route;
|
|
3136
3139
|
this.router = router;
|
|
3137
3140
|
this.contextDashboardService = contextDashboardService;
|
|
@@ -3147,6 +3150,7 @@ class ContextDashboardComponent {
|
|
|
3147
3150
|
this.destroyRef = destroyRef;
|
|
3148
3151
|
this.contextDashboardStateService = contextDashboardStateService;
|
|
3149
3152
|
this.editModeService = editModeService;
|
|
3153
|
+
this.widgetContextBinding = widgetContextBinding;
|
|
3150
3154
|
this.childrenClasses = '';
|
|
3151
3155
|
this.setTitle = false;
|
|
3152
3156
|
this.defaultWidgets = [];
|
|
@@ -3585,12 +3589,12 @@ class ContextDashboardComponent {
|
|
|
3585
3589
|
await this.onLoad();
|
|
3586
3590
|
}
|
|
3587
3591
|
async setWidgets(dashboardChildren, trackExperience = false) {
|
|
3588
|
-
const
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3592
|
+
const widgets = Object.values(dashboardChildren || {});
|
|
3593
|
+
widgets.forEach(widget => (widget.classes = this.mergeWidgetClasses(widget)));
|
|
3594
|
+
if (this.contextDashboardService.isDeviceType(this.mo)) {
|
|
3595
|
+
await this.widgetContextBinding.applyContextToWidgets(widgets, this.context, widget => this.applyDeviceTarget(widget));
|
|
3596
|
+
}
|
|
3597
|
+
this.widgets = await Promise.all(widgets.map(widget => {
|
|
3594
3598
|
if (trackExperience) {
|
|
3595
3599
|
this.gainsightService.triggerEvent('loadWidget', {
|
|
3596
3600
|
widgetName: widget.componentId || widget.name
|
|
@@ -3832,7 +3836,7 @@ class ContextDashboardComponent {
|
|
|
3832
3836
|
? str
|
|
3833
3837
|
: this.gainsightService.hashGroupName(str);
|
|
3834
3838
|
}
|
|
3835
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: ContextDashboardComponent, deps: [{ token: i1.ActivatedRoute }, { token: i1.Router }, { token: ContextDashboardService }, { token: i2.AlertService }, { token: i0.Renderer2 }, { token: CONTEXT_DASHBOARD_CONFIG }, { token: WidgetService }, { token: i2.BottomDrawerService }, { token: i2.GainsightService }, { token: i2.ActionBarService }, { token: i2$1.TranslateService }, { token: i2.ModalService }, { token: i0.DestroyRef }, { token: i6.ContextDashboardStateService }, { token: DashboardEditModeService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3839
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: ContextDashboardComponent, deps: [{ token: i1.ActivatedRoute }, { token: i1.Router }, { token: ContextDashboardService }, { token: i2.AlertService }, { token: i0.Renderer2 }, { token: CONTEXT_DASHBOARD_CONFIG }, { token: WidgetService }, { token: i2.BottomDrawerService }, { token: i2.GainsightService }, { token: i2.ActionBarService }, { token: i2$1.TranslateService }, { token: i2.ModalService }, { token: i0.DestroyRef }, { token: i6.ContextDashboardStateService }, { token: DashboardEditModeService }, { token: i2.WidgetContextBindingService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3836
3840
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.19", type: ContextDashboardComponent, isStandalone: true, selector: "c8y-context-dashboard", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: false, isRequired: false, transformFunction: null }, childrenClasses: { classPropertyName: "childrenClasses", publicName: "childrenClasses", isSignal: false, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: false, isRequired: false, transformFunction: null }, setTitle: { classPropertyName: "setTitle", publicName: "setTitle", isSignal: false, isRequired: false, transformFunction: null }, defaultWidgets: { classPropertyName: "defaultWidgets", publicName: "defaultWidgets", isSignal: false, isRequired: false, transformFunction: null }, _canCopy: { classPropertyName: "_canCopy", publicName: "canCopy", isSignal: false, isRequired: false, transformFunction: null }, canDelete: { classPropertyName: "canDelete", publicName: "canDelete", isSignal: false, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: false, isRequired: false, transformFunction: null }, breadcrumbSettings: { classPropertyName: "breadcrumbSettings", publicName: "breadcrumbSettings", isSignal: false, isRequired: false, transformFunction: null }, showContextHelpButton: { classPropertyName: "showContextHelpButton", publicName: "showContextHelpButton", isSignal: false, isRequired: false, transformFunction: null }, translateWidgetTitle: { classPropertyName: "translateWidgetTitle", publicName: "translateWidgetTitle", isSignal: false, isRequired: false, transformFunction: null }, translateDashboardTitle: { classPropertyName: "translateDashboardTitle", publicName: "translateDashboardTitle", isSignal: false, isRequired: false, transformFunction: null }, hideAvailability: { classPropertyName: "hideAvailability", publicName: "hideAvailability", isSignal: false, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "window:beforeunload": "beforeUnloadHandler($event)" }, properties: { "class": "this.class" }, styleAttribute: "\n display: block;\n ", classAttribute: "dashboard c8y-grid-dashboard" }, viewQueries: [{ propertyName: "dashboardDetails", first: true, predicate: DashboardDetailComponent, descendants: true, static: true }, { propertyName: "widgetsDashboard", first: true, predicate: WidgetsDashboardComponent, descendants: true, static: true }], ngImport: i0, template: "@if (title) {\n <c8y-title>\n {{ title }}\n </c8y-title>\n}\n\n@if (dashboard?.deviceType && dashboard.deviceTypeValue) {\n <c8y-action-bar-item\n [placement]=\"'right'\"\n [priority]=\"10000\"\n >\n <button\n class=\"btn-clean btn-link\"\n popoverTitle=\"{{ 'Dashboard template' | translate }}\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"dashboardTypePopoverRef\"\n placement=\"bottom\"\n triggers=\"focus\"\n container=\"body\"\n type=\"button\"\n >\n <span class=\"tag tag--info text-12\">\n <span class=\"dashboard-template-marker\"></span>\n {{ dashboardTypeLabel | translate: { dashboardType: dashboard.deviceTypeValue } }}\n </span>\n </button>\n <ng-template #dashboardTypePopoverRef>\n <div\n [innerHTML]=\"dashboardTypePopover | translate: { dashboardType: dashboard.deviceTypeValue }\"\n ></div>\n </ng-template>\n </c8y-action-bar-item>\n}\n\n@if (defaultWidgets.length > 0) {\n <c8y-action-bar-item\n [placement]=\"'right'\"\n [priority]=\"-1\"\n >\n <button\n class=\"btn btn-link\"\n title=\"{{ 'Reset widgets' | translate }}\"\n type=\"button\"\n px-event=\"Reset dashboard\"\n (click)=\"restore()\"\n [disabled]=\"disabled || !mo?.id || (widgetsDashboard?.editMode$ | async)\"\n data-cy=\"context-dashboard--button-reset-dashboard\"\n >\n <i\n class=\"m-r-4\"\n c8yIcon=\"reset\"\n ></i>\n <span class=\"visible-xs-inline hidden-sm visible-md-inline visible-lg-inline\">\n {{ 'Reset widgets' | translate }}\n </span>\n </button>\n </c8y-action-bar-item>\n}\n\n@if (showContextHelpButton) {\n <c8y-help src=\"/docs/cockpit/working-with-dashboards/#working-with-dashboards\"></c8y-help>\n}\n\n<c8y-dashboard-detail\n class=\"d-contents\"\n [isReport]=\"isReport\"\n [dashboard]=\"dashboard\"\n [mo]=\"mo\"\n [context]=\"context\"\n [deviceType]=\"context?.type\"\n [hideAvailability]=\"hideAvailability\"\n [isNamedDashboard]=\"isNamedDashboard\"\n (dashboardSaved)=\"reloadDashboard($event)\"\n (previewChanged)=\"dashboardPreview($event)\"\n></c8y-dashboard-detail>\n\n<c8y-widgets-dashboard\n [context]=\"context\"\n [contextDashboard]=\"dashboard\"\n [widgets]=\"widgets\"\n [isCopyDisabled]=\"isCopyDisabled\"\n [isSaveDisabled]=\"contextDashboardStateService.isSaveDisabled | async\"\n [settings]=\"{\n isLoading: isLoading,\n isDisabled: disabled,\n canDelete: canDelete && !!dashboard,\n translateWidgetTitle: dashboard?.translateWidgetTitle ?? translateWidgetTitle,\n translateDashboardTitle: dashboard?.translateDashboardTitle ?? translateDashboardTitle,\n allowFullscreen: moduleConfig.allowFullscreen,\n title: setTitle ? dashboard?.name || title : undefined,\n widgetMargin: dashboard?.widgetMargin,\n canCopy: canCopy && !!dashboard,\n defaultWidth: dashboard?.columns >= 24 ? 8 : 4,\n columns: dashboard?.columns || 12,\n layout: dashboard?.layout || 'grid',\n alignViewHeight: !!dashboard?.alignViewHeight,\n rows: dashboard?.alignViewHeight ? dashboard?.rows || 24 : 'auto',\n float: !!dashboard?.float\n }\"\n [breadcrumb]=\"breadcrumbSettings\"\n [editModeButtons]=\"{\n undoButtonDisabled: editModeService.undoButtonDisabled,\n changeToUndoName: editModeService.changeToUndoName,\n redoButtonDisabled: !editModeService.redoStackLastItem,\n changeToRedoName: editModeService.redoStackLastItem?.name\n }\"\n (onChangeDashboard)=\"positionOrWidgetDimensionChange($event)\"\n (onAddWidget)=\"addWidget()\"\n (onEditWidget)=\"editWidget($event)\"\n (onDeleteWidget)=\"deleteWidget($event)\"\n (onSaveDashboard)=\"saveWidgetsToDashboard()\"\n (onCancelDashboard)=\"cancelEditMode()\"\n (revertChange)=\"revertChange($event)\"\n (onChangeStart)=\"addDashboardClassToBody()\"\n (onChangeEnd)=\"removeDashboardClassFromBody()\"\n (onEditDashboard)=\"editDashboard()\"\n (onCopyDashboard)=\"copyDashboard()\"\n (onDeleteDashboard)=\"deleteDashboard()\"\n></c8y-widgets-dashboard>\n", dependencies: [{ kind: "component", type: TitleComponent, selector: "c8y-title", inputs: ["pageTitleUpdate"] }, { kind: "component", type: ActionBarItemComponent, selector: "c8y-action-bar-item", inputs: ["placement", "priority", "itemClass", "injector", "groupId", "inGroupPriority"] }, { kind: "directive", type: PopoverDirective, selector: "[popover]", inputs: ["adaptivePosition", "boundariesElement", "popover", "popoverContext", "popoverTitle", "placement", "outsideClick", "triggers", "container", "containerClass", "isOpen", "delay"], outputs: ["onShown", "onHidden"], exportAs: ["bs-popover"] }, { kind: "directive", type: IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "component", type: HelpComponent, selector: "c8y-help", inputs: ["src", "isCollapsed", "priority", "icon"] }, { kind: "component", type: DashboardDetailComponent, selector: "c8y-dashboard-detail", inputs: ["isReport", "deviceType", "context", "mo", "dashboard", "isNamedDashboard", "hideAvailability"], outputs: ["dashboardSaved", "previewChanged"] }, { kind: "component", type: WidgetsDashboardComponent, selector: "c8y-widgets-dashboard", inputs: ["widgets", "context", "contextDashboard", "settings", "isCopyDisabled", "breadcrumb", "editModeButtons", "isSaveDisabled", "clearWidgetContentOnLeave"], outputs: ["onAddWidget", "onEditWidget", "onDeleteWidget", "onChangeDashboard", "onResize", "onEditDashboard", "onCopyDashboard", "onDeleteDashboard", "onChangeStart", "onChangeEnd", "onSaveDashboard", "onCancelDashboard", "revertChange"] }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
|
|
3837
3841
|
}
|
|
3838
3842
|
__decorate([
|
|
@@ -3862,7 +3866,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.19", ngImpo
|
|
|
3862
3866
|
}], ctorParameters: () => [{ type: i1.ActivatedRoute }, { type: i1.Router }, { type: ContextDashboardService }, { type: i2.AlertService }, { type: i0.Renderer2 }, { type: undefined, decorators: [{
|
|
3863
3867
|
type: Inject,
|
|
3864
3868
|
args: [CONTEXT_DASHBOARD_CONFIG]
|
|
3865
|
-
}] }, { type: WidgetService }, { type: i2.BottomDrawerService }, { type: i2.GainsightService }, { type: i2.ActionBarService }, { type: i2$1.TranslateService }, { type: i2.ModalService }, { type: i0.DestroyRef }, { type: i6.ContextDashboardStateService }, { type: DashboardEditModeService }], propDecorators: { name: [{
|
|
3869
|
+
}] }, { type: WidgetService }, { type: i2.BottomDrawerService }, { type: i2.GainsightService }, { type: i2.ActionBarService }, { type: i2$1.TranslateService }, { type: i2.ModalService }, { type: i0.DestroyRef }, { type: i6.ContextDashboardStateService }, { type: DashboardEditModeService }, { type: i2.WidgetContextBindingService }], propDecorators: { name: [{
|
|
3866
3870
|
type: Input
|
|
3867
3871
|
}], childrenClasses: [{
|
|
3868
3872
|
type: Input
|
|
@@ -4987,7 +4991,29 @@ function referencesOldContext(id, oldContext) {
|
|
|
4987
4991
|
*/
|
|
4988
4992
|
function replaceContextInAssetReference(reference, newContext, oldContext) {
|
|
4989
4993
|
if (reference && referencesOldContext(reference.id, oldContext)) {
|
|
4990
|
-
|
|
4994
|
+
bindAssetReferenceToContext(reference, newContext);
|
|
4995
|
+
}
|
|
4996
|
+
return reference;
|
|
4997
|
+
}
|
|
4998
|
+
/**
|
|
4999
|
+
* Binds a single asset reference of a widget configuration to the given context, whichever asset it
|
|
5000
|
+
* pointed at before.
|
|
5001
|
+
*
|
|
5002
|
+
* Use this from a widget's `applyContext` hook for every asset, device or group reference the
|
|
5003
|
+
* widget stores. On a device type dashboard one template is shared by all devices of the type, so
|
|
5004
|
+
* every reference has to follow the device being viewed, unlike on paste, where references
|
|
5005
|
+
* deliberately bound to another asset are preserved.
|
|
5006
|
+
*
|
|
5007
|
+
* Only `id` and `name` are copied, so that the widget configuration does not grow to hold a
|
|
5008
|
+
* complete managed object when the dashboard is saved.
|
|
5009
|
+
*
|
|
5010
|
+
* @param reference - The asset reference to rebind, modified in place
|
|
5011
|
+
* @param context - The managed object of the context currently being viewed
|
|
5012
|
+
* @returns The same reference, bound to the context
|
|
5013
|
+
*/
|
|
5014
|
+
function bindAssetReferenceToContext(reference, context) {
|
|
5015
|
+
if (reference) {
|
|
5016
|
+
Object.assign(reference, pick(context, ['id', 'name']));
|
|
4991
5017
|
}
|
|
4992
5018
|
return reference;
|
|
4993
5019
|
}
|
|
@@ -5010,16 +5036,51 @@ const IDENTIFIER_REGEX = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;
|
|
|
5010
5036
|
* @returns The same mappings object, with matching asset references replaced in place
|
|
5011
5037
|
*/
|
|
5012
5038
|
function replaceContextInAssetPropertyMappings(mappings, newContext, oldContext) {
|
|
5039
|
+
return rebindAssetPropertyMappings(mappings, newContext, id => referencesOldContext(id, oldContext));
|
|
5040
|
+
}
|
|
5041
|
+
/**
|
|
5042
|
+
* Binds per-placeholder asset property mappings to the given context, whichever assets they pointed
|
|
5043
|
+
* at before.
|
|
5044
|
+
*
|
|
5045
|
+
* This is the `applyContext` counterpart of `replaceContextInAssetPropertyMappings`: on a device
|
|
5046
|
+
* type dashboard one template is shared by all devices of the type, so every placeholder has to
|
|
5047
|
+
* follow the device being viewed rather than only those bound to a previous context. The same three
|
|
5048
|
+
* references are covered: `assetProperty.asset`, the computed `contextAssetId` and every
|
|
5049
|
+
* `config.dp[].__target`. Mappings with a `null` `assetProperty` (unmapped placeholders) are left
|
|
5050
|
+
* untouched.
|
|
5051
|
+
*
|
|
5052
|
+
* @param mappings - Map of placeholder name to asset property mapping
|
|
5053
|
+
* @param context - The managed object of the context currently being viewed
|
|
5054
|
+
* @returns The same mappings object, with every asset reference bound to the context
|
|
5055
|
+
*/
|
|
5056
|
+
function bindAssetPropertyMappingsToContext(mappings, context) {
|
|
5057
|
+
return rebindAssetPropertyMappings(mappings, context, () => true);
|
|
5058
|
+
}
|
|
5059
|
+
/**
|
|
5060
|
+
* Shared walker of the asset references an `AssetPropertyMappings` holds.
|
|
5061
|
+
*
|
|
5062
|
+
* @param mappings - Map of placeholder name to asset property mapping
|
|
5063
|
+
* @param context - The managed object to bind matching references to
|
|
5064
|
+
* @param shouldRebind - Decides, per stored ID, whether that reference is rebound
|
|
5065
|
+
*/
|
|
5066
|
+
function rebindAssetPropertyMappings(mappings, context, shouldRebind) {
|
|
5013
5067
|
forEach(mappings, mapping => {
|
|
5014
5068
|
const assetProperty = mapping?.assetProperty;
|
|
5015
5069
|
if (!assetProperty) {
|
|
5016
5070
|
return;
|
|
5017
5071
|
}
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
assetProperty.contextAssetId = newContext.id;
|
|
5072
|
+
if (assetProperty.asset && shouldRebind(assetProperty.asset.id)) {
|
|
5073
|
+
bindAssetReferenceToContext(assetProperty.asset, context);
|
|
5021
5074
|
}
|
|
5022
|
-
|
|
5075
|
+
// Only computed properties carry a contextAssetId; never add one to a property without it.
|
|
5076
|
+
if (assetProperty.contextAssetId && shouldRebind(assetProperty.contextAssetId)) {
|
|
5077
|
+
assetProperty.contextAssetId = context.id;
|
|
5078
|
+
}
|
|
5079
|
+
forEach(assetProperty.config?.dp, dataPoint => {
|
|
5080
|
+
if (dataPoint?.__target && shouldRebind(dataPoint.__target.id)) {
|
|
5081
|
+
bindAssetReferenceToContext(dataPoint.__target, context);
|
|
5082
|
+
}
|
|
5083
|
+
});
|
|
5023
5084
|
});
|
|
5024
5085
|
return mappings;
|
|
5025
5086
|
}
|
|
@@ -5417,5 +5478,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.19", ngImpo
|
|
|
5417
5478
|
* Generated bundle index. Do not edit.
|
|
5418
5479
|
*/
|
|
5419
5480
|
|
|
5420
|
-
export { ALL_GLOBAL_ROLES_SELECTED, APPLIED_TO_APPLICATIONS_FRAGMENT, AddDashboardComponent, AddDashboardFactory, AppearanceSettingsComponent, AssetPropertyMappingsComponent, AssetPropertyMappingsService, CONTEXT_DASHBOARD_CONFIG, ContextDashboardComponent, ContextDashboardModule, ContextDashboardService, ContextDashboardType, DASHBOARD_CHILDREN_STATE_NAME, DASHBOARD_DETAILS_OUTLET, DASHBOARD_DETAILS_TABS_OUTLET_NAME, DASHBOARD_FOUNDATION_MAP, DASHBOARD_SETTINGS_CHANGES, DASHBOARD_THEME_CLASSES, DashboardActionBarFactory, DashboardDetailComponent, DashboardDetailService, DashboardDetailsTabId, DeviceInfoDashboardComponent, DeviceInfoDashboardModule, DeviceManagementHomeDashboardComponent, DeviceManagementHomeDashboardModule, FOUNDATION_CLASSES, GlobalContextSectionComponent, HOOK_WIDGET_CONFIG, NewDashboardGuard, PRODUCT_EXPERIENCE, PasteDashboardActionComponent, REPORT_DEFAULT_NAVIGATION_NODE_PRIORITY, STYLING_CLASS_PREFIXES, THEME_FOUNDATION_MAP, TypeDashboardInfoComponent, WIDGET_CONTENT_CLASSES, WIDGET_FOUNDATION_MAP, WIDGET_HEADER_CLASSES, WidgetAssetSelectorComponent, WidgetConfigAppearanceComponent, WidgetConfigChangeMode, WidgetConfigComponent, WidgetConfigFeedbackComponent, WidgetConfigGeneralComponent, WidgetConfigSectionComponent, WidgetConfigSectionService, WidgetConfigService, WidgetPreviewComponent, WidgetPreviewWrapperComponent, WidgetService, applyEntitySharing, escapeForRegExp, getPropertyBaseKey, getSharedApplicationKeys, hookWidgetConfig, newDashboardTab, quoteAndEscape, referencesOldContext, renamePropertyKeyInCode, replaceContextInAssetPropertyMappings, replaceContextInAssetReference };
|
|
5481
|
+
export { ALL_GLOBAL_ROLES_SELECTED, APPLIED_TO_APPLICATIONS_FRAGMENT, AddDashboardComponent, AddDashboardFactory, AppearanceSettingsComponent, AssetPropertyMappingsComponent, AssetPropertyMappingsService, CONTEXT_DASHBOARD_CONFIG, ContextDashboardComponent, ContextDashboardModule, ContextDashboardService, ContextDashboardType, DASHBOARD_CHILDREN_STATE_NAME, DASHBOARD_DETAILS_OUTLET, DASHBOARD_DETAILS_TABS_OUTLET_NAME, DASHBOARD_FOUNDATION_MAP, DASHBOARD_SETTINGS_CHANGES, DASHBOARD_THEME_CLASSES, DashboardActionBarFactory, DashboardDetailComponent, DashboardDetailService, DashboardDetailsTabId, DeviceInfoDashboardComponent, DeviceInfoDashboardModule, DeviceManagementHomeDashboardComponent, DeviceManagementHomeDashboardModule, FOUNDATION_CLASSES, GlobalContextSectionComponent, HOOK_WIDGET_CONFIG, NewDashboardGuard, PRODUCT_EXPERIENCE, PasteDashboardActionComponent, REPORT_DEFAULT_NAVIGATION_NODE_PRIORITY, STYLING_CLASS_PREFIXES, THEME_FOUNDATION_MAP, TypeDashboardInfoComponent, WIDGET_CONTENT_CLASSES, WIDGET_FOUNDATION_MAP, WIDGET_HEADER_CLASSES, WidgetAssetSelectorComponent, WidgetConfigAppearanceComponent, WidgetConfigChangeMode, WidgetConfigComponent, WidgetConfigFeedbackComponent, WidgetConfigGeneralComponent, WidgetConfigSectionComponent, WidgetConfigSectionService, WidgetConfigService, WidgetPreviewComponent, WidgetPreviewWrapperComponent, WidgetService, applyEntitySharing, bindAssetPropertyMappingsToContext, bindAssetReferenceToContext, escapeForRegExp, getPropertyBaseKey, getSharedApplicationKeys, hookWidgetConfig, newDashboardTab, quoteAndEscape, referencesOldContext, renamePropertyKeyInCode, replaceContextInAssetPropertyMappings, replaceContextInAssetReference };
|
|
5421
5482
|
//# sourceMappingURL=c8y-ngx-components-context-dashboard.mjs.map
|