@siemens/dashboards-ng 49.4.0 → 49.6.0
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.
|
@@ -9,7 +9,8 @@ import { BOOTSTRAP_BREAKPOINTS, SiResponsiveContainerDirective } from '@siemens/
|
|
|
9
9
|
import { ActivatedRoute, RouterLink } from '@angular/router';
|
|
10
10
|
import { SiContentActionBarComponent } from '@siemens/element-ng/content-action-bar';
|
|
11
11
|
import { SiLinkDirective } from '@siemens/element-ng/link';
|
|
12
|
-
import {
|
|
12
|
+
import { SiLoadingButtonComponent, SiLoadingSpinnerDirective } from '@siemens/element-ng/loading-spinner';
|
|
13
|
+
import { SiTooltipDirective } from '@siemens/element-ng/tooltip';
|
|
13
14
|
import { SiModalService } from '@siemens/element-ng/modal';
|
|
14
15
|
import { GridStack } from 'gridstack';
|
|
15
16
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
@@ -268,18 +269,21 @@ class SiDashboardToolbarComponent {
|
|
|
268
269
|
return item;
|
|
269
270
|
}
|
|
270
271
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiDashboardToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
271
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.8", type: SiDashboardToolbarComponent, isStandalone: true, selector: "si-dashboard-toolbar", inputs: { primaryEditActions: { classPropertyName: "primaryEditActions", publicName: "primaryEditActions", isSignal: true, isRequired: false, transformFunction: null }, secondaryEditActions: { classPropertyName: "secondaryEditActions", publicName: "secondaryEditActions", isSignal: true, isRequired: false, transformFunction: null }, disableSaveButton: { classPropertyName: "disableSaveButton", publicName: "disableSaveButton", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, editable: { classPropertyName: "editable", publicName: "editable", isSignal: true, isRequired: false, transformFunction: null }, hideEditButton: { classPropertyName: "hideEditButton", publicName: "hideEditButton", isSignal: true, isRequired: false, transformFunction: null }, showEditButtonLabel: { classPropertyName: "showEditButtonLabel", publicName: "showEditButtonLabel", isSignal: true, isRequired: false, transformFunction: null }, grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { disableSaveButton: "disableSaveButtonChange", editable: "editableChange", save: "save", cancel: "cancel" }, viewQueries: [{ propertyName: "dashboardToolbarContainer", first: true, predicate: SiResponsiveContainerDirective, descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"row mb-3\" siResponsiveContainer>\n <div class=\"col-12 d-flex justify-content-between\">\n @if (!editable()) {\n <ng-content select=\"[filters-slot]\" />\n @if (!hideEditButton()) {\n @let showEditButtonLabelDesktop = this.showEditButtonLabelDesktop();\n <button\n type=\"button\"\n class=\"btn ms-auto\"\n [class]=\"\n showEditButtonLabelDesktop ? 'btn-secondary' : 'btn-
|
|
272
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.8", type: SiDashboardToolbarComponent, isStandalone: true, selector: "si-dashboard-toolbar", inputs: { primaryEditActions: { classPropertyName: "primaryEditActions", publicName: "primaryEditActions", isSignal: true, isRequired: false, transformFunction: null }, secondaryEditActions: { classPropertyName: "secondaryEditActions", publicName: "secondaryEditActions", isSignal: true, isRequired: false, transformFunction: null }, disableSaveButton: { classPropertyName: "disableSaveButton", publicName: "disableSaveButton", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, editable: { classPropertyName: "editable", publicName: "editable", isSignal: true, isRequired: false, transformFunction: null }, hideEditButton: { classPropertyName: "hideEditButton", publicName: "hideEditButton", isSignal: true, isRequired: false, transformFunction: null }, showEditButtonLabel: { classPropertyName: "showEditButtonLabel", publicName: "showEditButtonLabel", isSignal: true, isRequired: false, transformFunction: null }, grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { disableSaveButton: "disableSaveButtonChange", editable: "editableChange", save: "save", cancel: "cancel" }, host: { classAttribute: "d-flex flex-column flex-grow-1" }, viewQueries: [{ propertyName: "dashboardToolbarContainer", first: true, predicate: SiResponsiveContainerDirective, descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"row mb-3\" siResponsiveContainer>\n <div class=\"col-12 d-flex justify-content-between\">\n @if (!editable()) {\n <ng-content select=\"[filters-slot]\" />\n @if (!hideEditButton()) {\n @let showEditButtonLabelDesktop = this.showEditButtonLabelDesktop();\n <button\n type=\"button\"\n class=\"btn ms-auto\"\n [class]=\"\n showEditButtonLabelDesktop ? 'btn-secondary' : 'btn-icon btn-tertiary element-edit'\n \"\n [attr.aria-label]=\"labelEdit | translate\"\n [siTooltip]=\"labelEdit\"\n [isDisabled]=\"showEditButtonLabelDesktop\"\n [disabled]=\"disabled()\"\n (click)=\"onEdit()\"\n >\n @if (showEditButtonLabelDesktop) {\n {{ labelEdit | translate }}\n }\n </button>\n }\n } @else {\n @if (showContentActionBar()) {\n <si-content-action-bar\n toggleItemLabel=\"toggle\"\n viewType=\"expanded\"\n [disabled]=\"disabled()\"\n [primaryActions]=\"primaryEditActionsComputed()\"\n [secondaryActions]=\"secondaryEditActionsComputed()\"\n />\n } @else {\n <div>\n @for (action of editActions(); track $index) {\n @if (isToolbarItem(action)) {\n @if (disabled()) {\n <!-- Links do not support disabled, so we need to render a button instead in this case. -->\n <button type=\"button\" class=\"btn btn-secondary me-4\" disabled>\n {{ action.label! | translate }}\n </button>\n } @else {\n @switch (action.type) {\n @case ('action') {\n <button\n type=\"button\"\n class=\"btn btn-secondary me-4\"\n (click)=\"action.action(grid())\"\n >\n {{ action.label! | translate }}\n </button>\n }\n @case ('router-link') {\n <a\n class=\"btn btn-secondary me-4\"\n [routerLink]=\"action.routerLink\"\n [queryParams]=\"action.extras?.queryParams\"\n [queryParamsHandling]=\"action.extras?.queryParamsHandling\"\n [fragment]=\"action.extras?.fragment\"\n [state]=\"action.extras?.state\"\n [relativeTo]=\"action.extras?.relativeTo ?? activatedRoute\"\n [preserveFragment]=\"action.extras?.preserveFragment\"\n [skipLocationChange]=\"action.extras?.skipLocationChange\"\n [replaceUrl]=\"action.extras?.replaceUrl\"\n >\n {{ action.label! | translate }}\n </a>\n }\n @case ('link') {\n <a class=\"btn btn-secondary me-4\" [href]=\"action.href\" [target]=\"action.target\">\n {{ action.label! | translate }}\n </a>\n }\n }\n }\n } @else {\n <button\n type=\"button\"\n class=\"btn btn-secondary me-4\"\n [disabled]=\"disabled()\"\n [siLink]=\"action\"\n >\n {{ action.title! | translate }}\n </button>\n }\n }\n </div>\n }\n <div>\n <button\n type=\"button\"\n class=\"btn btn-secondary me-4\"\n [disabled]=\"disabled()\"\n (click)=\"onCancel()\"\n >\n {{ labelCancel | translate }}\n </button>\n <si-loading-button\n class=\"align-top\"\n buttonClass=\"btn btn-primary\"\n [disabled]=\"disableSaveButton()\"\n [loading]=\"disabled()\"\n (click)=\"onSave()\"\n >\n {{ labelSave | translate }}\n </si-loading-button>\n </div>\n }\n </div>\n</div>\n", dependencies: [{ kind: "component", type: SiContentActionBarComponent, selector: "si-content-action-bar", inputs: ["primaryActions", "secondaryActions", "actionParam", "viewType", "toggleItemLabel", "preventIconsInDropdownMenus", "disabled"] }, { kind: "directive", type: SiLinkDirective, selector: "[siLink]", inputs: ["siLink", "siLinkDefaultTarget", "actionParam", "activeClass", "exactMatch", "ariaCurrent"], outputs: ["activeChange"], exportAs: ["siLink"] }, { kind: "component", type: SiLoadingButtonComponent, selector: "si-loading-button", inputs: ["disabled", "loading", "type", "ariaLabel", "ariaLabelledBy", "buttonClass"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: SiResponsiveContainerDirective, selector: "[siResponsiveContainer]", inputs: ["resizeThrottle", "breakpoints"], exportAs: ["siResponsiveContainer"] }, { kind: "directive", type: SiTooltipDirective, selector: "[siTooltip]", inputs: ["siTooltip", "placement", "isDisabled", "tooltipContext"] }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }] });
|
|
272
273
|
}
|
|
273
274
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiDashboardToolbarComponent, decorators: [{
|
|
274
275
|
type: Component,
|
|
275
276
|
args: [{ selector: 'si-dashboard-toolbar', imports: [
|
|
276
277
|
SiContentActionBarComponent,
|
|
277
278
|
SiLinkDirective,
|
|
278
|
-
|
|
279
|
+
SiLoadingButtonComponent,
|
|
279
280
|
RouterLink,
|
|
280
281
|
SiResponsiveContainerDirective,
|
|
281
|
-
SiTranslatePipe
|
|
282
|
-
|
|
282
|
+
SiTranslatePipe,
|
|
283
|
+
SiTooltipDirective
|
|
284
|
+
], host: {
|
|
285
|
+
class: 'd-flex flex-column flex-grow-1'
|
|
286
|
+
}, template: "<div class=\"row mb-3\" siResponsiveContainer>\n <div class=\"col-12 d-flex justify-content-between\">\n @if (!editable()) {\n <ng-content select=\"[filters-slot]\" />\n @if (!hideEditButton()) {\n @let showEditButtonLabelDesktop = this.showEditButtonLabelDesktop();\n <button\n type=\"button\"\n class=\"btn ms-auto\"\n [class]=\"\n showEditButtonLabelDesktop ? 'btn-secondary' : 'btn-icon btn-tertiary element-edit'\n \"\n [attr.aria-label]=\"labelEdit | translate\"\n [siTooltip]=\"labelEdit\"\n [isDisabled]=\"showEditButtonLabelDesktop\"\n [disabled]=\"disabled()\"\n (click)=\"onEdit()\"\n >\n @if (showEditButtonLabelDesktop) {\n {{ labelEdit | translate }}\n }\n </button>\n }\n } @else {\n @if (showContentActionBar()) {\n <si-content-action-bar\n toggleItemLabel=\"toggle\"\n viewType=\"expanded\"\n [disabled]=\"disabled()\"\n [primaryActions]=\"primaryEditActionsComputed()\"\n [secondaryActions]=\"secondaryEditActionsComputed()\"\n />\n } @else {\n <div>\n @for (action of editActions(); track $index) {\n @if (isToolbarItem(action)) {\n @if (disabled()) {\n <!-- Links do not support disabled, so we need to render a button instead in this case. -->\n <button type=\"button\" class=\"btn btn-secondary me-4\" disabled>\n {{ action.label! | translate }}\n </button>\n } @else {\n @switch (action.type) {\n @case ('action') {\n <button\n type=\"button\"\n class=\"btn btn-secondary me-4\"\n (click)=\"action.action(grid())\"\n >\n {{ action.label! | translate }}\n </button>\n }\n @case ('router-link') {\n <a\n class=\"btn btn-secondary me-4\"\n [routerLink]=\"action.routerLink\"\n [queryParams]=\"action.extras?.queryParams\"\n [queryParamsHandling]=\"action.extras?.queryParamsHandling\"\n [fragment]=\"action.extras?.fragment\"\n [state]=\"action.extras?.state\"\n [relativeTo]=\"action.extras?.relativeTo ?? activatedRoute\"\n [preserveFragment]=\"action.extras?.preserveFragment\"\n [skipLocationChange]=\"action.extras?.skipLocationChange\"\n [replaceUrl]=\"action.extras?.replaceUrl\"\n >\n {{ action.label! | translate }}\n </a>\n }\n @case ('link') {\n <a class=\"btn btn-secondary me-4\" [href]=\"action.href\" [target]=\"action.target\">\n {{ action.label! | translate }}\n </a>\n }\n }\n }\n } @else {\n <button\n type=\"button\"\n class=\"btn btn-secondary me-4\"\n [disabled]=\"disabled()\"\n [siLink]=\"action\"\n >\n {{ action.title! | translate }}\n </button>\n }\n }\n </div>\n }\n <div>\n <button\n type=\"button\"\n class=\"btn btn-secondary me-4\"\n [disabled]=\"disabled()\"\n (click)=\"onCancel()\"\n >\n {{ labelCancel | translate }}\n </button>\n <si-loading-button\n class=\"align-top\"\n buttonClass=\"btn btn-primary\"\n [disabled]=\"disableSaveButton()\"\n [loading]=\"disabled()\"\n (click)=\"onSave()\"\n >\n {{ labelSave | translate }}\n </si-loading-button>\n </div>\n }\n </div>\n</div>\n" }]
|
|
283
287
|
}], propDecorators: { primaryEditActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "primaryEditActions", required: false }] }], secondaryEditActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "secondaryEditActions", required: false }] }], disableSaveButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableSaveButton", required: false }] }, { type: i0.Output, args: ["disableSaveButtonChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], editable: [{ type: i0.Input, args: [{ isSignal: true, alias: "editable", required: false }] }, { type: i0.Output, args: ["editableChange"] }], hideEditButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideEditButton", required: false }] }], showEditButtonLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "showEditButtonLabel", required: false }] }], grid: [{ type: i0.Input, args: [{ isSignal: true, alias: "grid", required: true }] }], save: [{ type: i0.Output, args: ["save"] }], cancel: [{ type: i0.Output, args: ["cancel"] }], dashboardToolbarContainer: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SiResponsiveContainerDirective), { isSignal: true }] }] } });
|
|
284
288
|
|
|
285
289
|
/**
|
|
@@ -496,6 +500,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
|
|
|
496
500
|
* Copyright (c) Siemens 2016 - 2026
|
|
497
501
|
* SPDX-License-Identifier: MIT
|
|
498
502
|
*/
|
|
503
|
+
/** @internal */
|
|
499
504
|
const widgetFactoryRegistry = {
|
|
500
505
|
_factories: {},
|
|
501
506
|
register(name, factoryFn) {
|
|
@@ -1102,21 +1107,13 @@ class SiWidgetInstanceEditorDialogComponent {
|
|
|
1102
1107
|
if ('statusChangesHandler' in this.widgetInstanceEditor) {
|
|
1103
1108
|
this.widgetInstanceEditor.statusChangesHandler = this.handleStatusChanges.bind(this);
|
|
1104
1109
|
}
|
|
1105
|
-
let hasStatusChangesEmitter = false;
|
|
1106
1110
|
if (this.widgetInstanceEditor.statusChanges) {
|
|
1107
|
-
|
|
1108
|
-
this.subscriptions.push(this.widgetInstanceEditor.statusChanges.subscribe(statusChanges => {
|
|
1109
|
-
this.handleStatusChanges(statusChanges);
|
|
1110
|
-
}));
|
|
1111
|
+
this.subscriptions.push(this.widgetInstanceEditor.statusChanges.subscribe(statusChanges => this.handleStatusChanges(statusChanges)));
|
|
1111
1112
|
}
|
|
1112
|
-
if (this.widgetInstanceEditor.configChange) {
|
|
1113
|
-
this.subscriptions.push(this.widgetInstanceEditor.configChange.subscribe(
|
|
1114
|
-
if (!hasStatusChangesEmitter) {
|
|
1115
|
-
this.widgetConfigModified.set(true);
|
|
1116
|
-
}
|
|
1117
|
-
}));
|
|
1113
|
+
else if (this.widgetInstanceEditor.configChange) {
|
|
1114
|
+
this.subscriptions.push(this.widgetInstanceEditor.configChange.subscribe(() => this.widgetConfigModified.set(true)));
|
|
1118
1115
|
}
|
|
1119
|
-
if (this.
|
|
1116
|
+
if (this.isEditorWizard(this.widgetInstanceEditor)) {
|
|
1120
1117
|
this.editorWizardState.set(this.widgetInstanceEditor.state);
|
|
1121
1118
|
if (this.widgetInstanceEditor.stateChange) {
|
|
1122
1119
|
this.subscriptions.push(this.widgetInstanceEditor.stateChange.subscribe(state => {
|
|
@@ -1158,13 +1155,13 @@ class SiWidgetInstanceEditorDialogComponent {
|
|
|
1158
1155
|
}
|
|
1159
1156
|
}
|
|
1160
1157
|
onNext() {
|
|
1161
|
-
if (this.
|
|
1158
|
+
if (this.isEditorWizard(this.widgetInstanceEditor)) {
|
|
1162
1159
|
this.widgetInstanceEditor.next();
|
|
1163
1160
|
this.editorWizardState.set(this.widgetInstanceEditor.state);
|
|
1164
1161
|
}
|
|
1165
1162
|
}
|
|
1166
1163
|
onPrevious() {
|
|
1167
|
-
if (this.
|
|
1164
|
+
if (this.isEditorWizard(this.widgetInstanceEditor) && this.editorWizardState()?.hasPrevious) {
|
|
1168
1165
|
this.widgetInstanceEditor.previous();
|
|
1169
1166
|
this.editorWizardState.set(this.widgetInstanceEditor.state);
|
|
1170
1167
|
}
|
|
@@ -1189,7 +1186,7 @@ class SiWidgetInstanceEditorDialogComponent {
|
|
|
1189
1186
|
this.subscriptions.forEach(s => s.unsubscribe());
|
|
1190
1187
|
this.subscriptions = [];
|
|
1191
1188
|
}
|
|
1192
|
-
|
|
1189
|
+
isEditorWizard(editor) {
|
|
1193
1190
|
return !!editor && 'state' in editor;
|
|
1194
1191
|
}
|
|
1195
1192
|
handleStatusChanges(statusChanges) {
|
|
@@ -1651,7 +1648,7 @@ class SiWidgetCatalogComponent {
|
|
|
1651
1648
|
filteredWidgetCatalog = [];
|
|
1652
1649
|
selected = signal(undefined, ...(ngDevMode ? [{ debugName: "selected" }] : []));
|
|
1653
1650
|
widgetConfig;
|
|
1654
|
-
hasEditor =
|
|
1651
|
+
hasEditor = computed(() => !!this.selected()?.componentFactory.editorComponentName, ...(ngDevMode ? [{ debugName: "hasEditor" }] : []));
|
|
1655
1652
|
labelCancel = t(() => $localize `:@@DASHBOARD.WIDGET_LIBRARY.CANCEL:Cancel`);
|
|
1656
1653
|
labelPrevious = t(() => $localize `:@@DASHBOARD.WIDGET_LIBRARY.PREVIOUS:Previous`);
|
|
1657
1654
|
labelNext = t(() => $localize `:@@DASHBOARD.WIDGET_LIBRARY.NEXT:Next`);
|
|
@@ -1751,14 +1748,14 @@ class SiWidgetCatalogComponent {
|
|
|
1751
1748
|
this.setupWidgetInstanceEditor();
|
|
1752
1749
|
}
|
|
1753
1750
|
else {
|
|
1754
|
-
if (this.
|
|
1751
|
+
if (this.isEditorWizard(this.widgetInstanceEditor)) {
|
|
1755
1752
|
this.widgetInstanceEditor.next();
|
|
1756
1753
|
this.editorWizardState.set(this.widgetInstanceEditor.state);
|
|
1757
1754
|
}
|
|
1758
1755
|
}
|
|
1759
1756
|
}
|
|
1760
1757
|
onPrevious() {
|
|
1761
|
-
if (this.
|
|
1758
|
+
if (this.isEditorWizard(this.widgetInstanceEditor) && this.editorWizardState()?.hasPrevious) {
|
|
1762
1759
|
this.widgetInstanceEditor.previous();
|
|
1763
1760
|
this.editorWizardState.set(this.widgetInstanceEditor.state);
|
|
1764
1761
|
}
|
|
@@ -1818,7 +1815,7 @@ class SiWidgetCatalogComponent {
|
|
|
1818
1815
|
}
|
|
1819
1816
|
}));
|
|
1820
1817
|
}
|
|
1821
|
-
if (this.
|
|
1818
|
+
if (this.isEditorWizard(this.widgetInstanceEditor)) {
|
|
1822
1819
|
this.editorWizardState.set(this.widgetInstanceEditor.state);
|
|
1823
1820
|
if (this.widgetInstanceEditor.stateChange) {
|
|
1824
1821
|
this.subscriptions.push(this.widgetInstanceEditor.stateChange.subscribe(state => {
|
|
@@ -1841,9 +1838,7 @@ class SiWidgetCatalogComponent {
|
|
|
1841
1838
|
this.subscriptions = [];
|
|
1842
1839
|
}
|
|
1843
1840
|
setupCatalog() {
|
|
1844
|
-
|
|
1845
|
-
this.editorHost().remove(0);
|
|
1846
|
-
}
|
|
1841
|
+
this.editorHost().clear();
|
|
1847
1842
|
this.tearDownEditor();
|
|
1848
1843
|
this.widgetConfig = undefined;
|
|
1849
1844
|
this.view.set('list');
|
|
@@ -1869,12 +1864,6 @@ class SiWidgetCatalogComponent {
|
|
|
1869
1864
|
}
|
|
1870
1865
|
selectWidget(widget) {
|
|
1871
1866
|
this.selected.set(widget);
|
|
1872
|
-
if (widget?.componentFactory?.editorComponentName) {
|
|
1873
|
-
this.hasEditor.set(true);
|
|
1874
|
-
}
|
|
1875
|
-
else {
|
|
1876
|
-
this.hasEditor.set(false);
|
|
1877
|
-
}
|
|
1878
1867
|
if (widget) {
|
|
1879
1868
|
// need to keep this in setTimeout to avoid ExpressionChangedAfterItHasBeenCheckedError
|
|
1880
1869
|
setTimeout(() => {
|
|
@@ -1882,7 +1871,7 @@ class SiWidgetCatalogComponent {
|
|
|
1882
1871
|
});
|
|
1883
1872
|
}
|
|
1884
1873
|
}
|
|
1885
|
-
|
|
1874
|
+
isEditorWizard(editor) {
|
|
1886
1875
|
return !!editor && 'state' in editor;
|
|
1887
1876
|
}
|
|
1888
1877
|
handleStatusChanges(statusChanges) {
|