@siemens/dashboards-ng 49.5.0 → 49.7.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.
|
@@ -222,11 +222,6 @@ class SiDashboardToolbarComponent {
|
|
|
222
222
|
* Emits on save button click.
|
|
223
223
|
*/
|
|
224
224
|
save = output();
|
|
225
|
-
/**
|
|
226
|
-
* Emits on cancel button click.
|
|
227
|
-
*/
|
|
228
|
-
// eslint-disable-next-line @angular-eslint/no-output-native
|
|
229
|
-
cancel = output();
|
|
230
225
|
labelEdit = t(() => $localize `:@@DASHBOARD.EDIT:Edit`);
|
|
231
226
|
labelCancel = t(() => $localize `:@@DASHBOARD.CANCEL:Cancel`);
|
|
232
227
|
labelSave = t(() => $localize `:@@DASHBOARD.SAVE:Save`);
|
|
@@ -253,7 +248,7 @@ class SiDashboardToolbarComponent {
|
|
|
253
248
|
}
|
|
254
249
|
onCancel() {
|
|
255
250
|
if (this.editable()) {
|
|
256
|
-
this.
|
|
251
|
+
this.editable.set(false);
|
|
257
252
|
}
|
|
258
253
|
}
|
|
259
254
|
isToolbarItem(item) {
|
|
@@ -269,7 +264,7 @@ class SiDashboardToolbarComponent {
|
|
|
269
264
|
return item;
|
|
270
265
|
}
|
|
271
266
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiDashboardToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
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"
|
|
267
|
+
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" }, 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" }] });
|
|
273
268
|
}
|
|
274
269
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiDashboardToolbarComponent, decorators: [{
|
|
275
270
|
type: Component,
|
|
@@ -284,7 +279,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
|
|
|
284
279
|
], host: {
|
|
285
280
|
class: 'd-flex flex-column flex-grow-1'
|
|
286
281
|
}, 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" }]
|
|
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"] }],
|
|
282
|
+
}], 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"] }], dashboardToolbarContainer: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SiResponsiveContainerDirective), { isSignal: true }] }] } });
|
|
288
283
|
|
|
289
284
|
/**
|
|
290
285
|
* Copyright (c) Siemens 2016 - 2026
|
|
@@ -342,13 +337,6 @@ class SiGridService {
|
|
|
342
337
|
/** @defaultValue [] */
|
|
343
338
|
widgetCatalog = signal([], ...(ngDevMode ? [{ debugName: "widgetCatalog" }] : []));
|
|
344
339
|
widgetCatalogMap = computed(() => new Map(this.widgetCatalog().map(widget => [widget.id, widget])), ...(ngDevMode ? [{ debugName: "widgetCatalogMap" }] : []));
|
|
345
|
-
/**
|
|
346
|
-
* Observable that emits true if si-grid is set to editable.
|
|
347
|
-
* The owner of the editable state is the si-grid component.
|
|
348
|
-
* This subject is used to propagate these state changes via
|
|
349
|
-
* the si-widget-host components to the widgets.
|
|
350
|
-
*/
|
|
351
|
-
editable$ = new BehaviorSubject(false);
|
|
352
340
|
getWidget(id) {
|
|
353
341
|
return this.widgetCatalogMap().get(id);
|
|
354
342
|
}
|
|
@@ -609,6 +597,12 @@ class SiWidgetHostComponent {
|
|
|
609
597
|
envInjector = inject(EnvironmentInjector);
|
|
610
598
|
destroyRef = inject(DestroyRef);
|
|
611
599
|
widgetConfig = input.required(...(ngDevMode ? [{ debugName: "widgetConfig" }] : []));
|
|
600
|
+
/**
|
|
601
|
+
* Sets the widget host into editable mode.
|
|
602
|
+
*
|
|
603
|
+
* @defaultValue false
|
|
604
|
+
*/
|
|
605
|
+
editable = input(false, ...(ngDevMode ? [{ debugName: "editable" }] : []));
|
|
612
606
|
remove = output();
|
|
613
607
|
edit = output();
|
|
614
608
|
card = viewChild.required('card');
|
|
@@ -629,7 +623,6 @@ class SiWidgetHostComponent {
|
|
|
629
623
|
secondaryActions = [];
|
|
630
624
|
/** @defaultValue 'expanded' */
|
|
631
625
|
actionBarViewType = 'expanded';
|
|
632
|
-
editable$ = this.gridService.editable$;
|
|
633
626
|
/** @defaultValue [] */
|
|
634
627
|
editablePrimaryActions = [];
|
|
635
628
|
/** @defaultValue [] */
|
|
@@ -688,12 +681,12 @@ class SiWidgetHostComponent {
|
|
|
688
681
|
}
|
|
689
682
|
}
|
|
690
683
|
}
|
|
684
|
+
if (changes.editable && !changes.editable.firstChange) {
|
|
685
|
+
this.setupEditable(this.editable());
|
|
686
|
+
}
|
|
691
687
|
}
|
|
692
688
|
ngOnInit() {
|
|
693
689
|
this.attachWidgetInstance();
|
|
694
|
-
this.editable$
|
|
695
|
-
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
696
|
-
.subscribe(editable => this.setupEditable(editable));
|
|
697
690
|
}
|
|
698
691
|
attachWidgetInstance() {
|
|
699
692
|
const widget = this.gridService.getWidget(this.widgetConfig().widgetId);
|
|
@@ -708,7 +701,7 @@ class SiWidgetHostComponent {
|
|
|
708
701
|
// to the DOM.
|
|
709
702
|
this.widgetInstance.configChange
|
|
710
703
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
711
|
-
.subscribe(event => setTimeout(() => this.setupEditable(this.editable
|
|
704
|
+
.subscribe(event => setTimeout(() => this.setupEditable(this.editable(), event)));
|
|
712
705
|
}
|
|
713
706
|
if (isSignal(this.widgetInstance.config)) {
|
|
714
707
|
this.widgetRef.setInput('config', this.widgetConfig());
|
|
@@ -717,7 +710,7 @@ class SiWidgetHostComponent {
|
|
|
717
710
|
this.widgetInstance.config = this.widgetConfig();
|
|
718
711
|
}
|
|
719
712
|
this.widgetInstanceFooter = this.widgetInstance.footer;
|
|
720
|
-
this.setupEditable(this.
|
|
713
|
+
this.setupEditable(this.editable());
|
|
721
714
|
},
|
|
722
715
|
error: error => console.error('Error: ', error)
|
|
723
716
|
});
|
|
@@ -806,14 +799,14 @@ class SiWidgetHostComponent {
|
|
|
806
799
|
});
|
|
807
800
|
}
|
|
808
801
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiWidgetHostComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
809
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.8", type: SiWidgetHostComponent, isStandalone: true, selector: "si-widget-host", inputs: { widgetConfig: { classPropertyName: "widgetConfig", publicName: "widgetConfig", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { remove: "remove", edit: "edit" }, host: { classAttribute: "grid-stack-item" }, viewQueries: [{ propertyName: "card", first: true, predicate: ["card"], descendants: true, isSignal: true }, { propertyName: "widgetHost", first: true, predicate: ["widgetHost"], descendants: true, read: ViewContainerRef, isSignal: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"grid-stack-item-content p-4\">\n @if (editable
|
|
802
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.8", type: SiWidgetHostComponent, isStandalone: true, selector: "si-widget-host", inputs: { widgetConfig: { classPropertyName: "widgetConfig", publicName: "widgetConfig", isSignal: true, isRequired: true, transformFunction: null }, editable: { classPropertyName: "editable", publicName: "editable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { remove: "remove", edit: "edit" }, host: { classAttribute: "grid-stack-item" }, viewQueries: [{ propertyName: "card", first: true, predicate: ["card"], descendants: true, isSignal: true }, { propertyName: "widgetHost", first: true, predicate: ["widgetHost"], descendants: true, read: ViewContainerRef, isSignal: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"grid-stack-item-content p-4\">\n @if (editable()) {\n <div class=\"resize-handle\">\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <g>\n <path d=\"M16 16H18V18H16V16Z\" fill=\"currentColor\" />\n <path d=\"M11 16H13V18H11V16Z\" fill=\"currentColor\" />\n <path d=\"M11 11H13V13H11V11Z\" fill=\"currentColor\" />\n <path d=\"M6 16H8V18H6V16Z\" fill=\"currentColor\" />\n <path d=\"M16 11H18V13H16V11Z\" fill=\"currentColor\" />\n <path d=\"M16 6H18V8H16V6Z\" fill=\"currentColor\" />\n </g>\n </svg>\n </div>\n <div class=\"draggable-overlay\"></div>\n }\n <si-dashboard-card\n #card\n class=\"h-100 dragging-card\"\n [class]=\"accentLine\"\n [expandText]=\"labelExpand\"\n [restoreText]=\"labelRestore\"\n [heading]=\"widgetConfig().heading\"\n [primaryActions]=\"primaryActions\"\n [secondaryActions]=\"secondaryActions\"\n [actionBarViewType]=\"actionBarViewType\"\n [enableExpandInteraction]=\"widgetConfig().expandable\"\n [imgAlt]=\"widgetConfig().image?.alt\"\n [imgDir]=\"widgetConfig().image?.dir\"\n [imgObjectFit]=\"widgetConfig().image?.objectFit\"\n [imgObjectPosition]=\"widgetConfig().image?.objectPosition\"\n [imgSrc]=\"widgetConfig().image?.src\"\n >\n <div class=\"card-body overflow-auto\" body>\n <ng-container #widgetHost />\n </div>\n\n @if (widgetInstanceFooter) {\n <div class=\"card-footer\" footer>\n <ng-container *ngTemplateOutlet=\"widgetInstanceFooter\" />\n </div>\n }\n </si-dashboard-card>\n</div>\n", styles: [":host{display:flex}::ng-deep body:not(:has(.ui-draggable-dragging)) .draggable-overlay{cursor:grab}::ng-deep si-content-action-bar{z-index:500}::ng-deep .ui-droppable.ui-droppable-over>*:not(.ui-droppable){cursor:move!important;pointer-events:inherit!important}::ng-deep .ui-draggable-dragging .dragging-card,::ng-deep .ui-resizable-resizing .dragging-card{box-shadow:0 0 8px var(--element-box-shadow-color-1),0 8px 8px var(--element-box-shadow-color-2)!important}::ng-deep .ui-draggable-dragging>.grid-stack-item-content,::ng-deep .ui-resizable-resizing>.grid-stack-item-content{box-shadow:none;opacity:1}::ng-deep .ui-resizable-handle{display:block!important}::ng-deep .ui-resizable-se{background-image:none!important;transform:none!important;inset-block-end:6px!important;inset-inline-end:6px!important}.resize-handle{inset-block-end:6px;color:var(--element-ui-2);pointer-events:none;position:absolute;inset-inline-end:6px;text-align:center;z-index:10}.draggable-overlay{inset:8px;position:absolute;z-index:100}\n"], dependencies: [{ kind: "component", type: SiDashboardCardComponent, selector: "si-dashboard-card", inputs: ["restoreText", "expandText", "enableExpandInteraction", "showMenubar"], outputs: ["expandChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
810
803
|
}
|
|
811
804
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiWidgetHostComponent, decorators: [{
|
|
812
805
|
type: Component,
|
|
813
|
-
args: [{ selector: 'si-widget-host', imports: [SiDashboardCardComponent,
|
|
806
|
+
args: [{ selector: 'si-widget-host', imports: [SiDashboardCardComponent, NgTemplateOutlet], host: {
|
|
814
807
|
class: 'grid-stack-item'
|
|
815
|
-
}, template: "<div class=\"grid-stack-item-content p-4\">\n @if (editable
|
|
816
|
-
}], propDecorators: { widgetConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgetConfig", required: true }] }], remove: [{ type: i0.Output, args: ["remove"] }], edit: [{ type: i0.Output, args: ["edit"] }], card: [{ type: i0.ViewChild, args: ['card', { isSignal: true }] }], widgetHost: [{ type: i0.ViewChild, args: ['widgetHost', { ...{ read: ViewContainerRef }, isSignal: true }] }] } });
|
|
808
|
+
}, template: "<div class=\"grid-stack-item-content p-4\">\n @if (editable()) {\n <div class=\"resize-handle\">\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <g>\n <path d=\"M16 16H18V18H16V16Z\" fill=\"currentColor\" />\n <path d=\"M11 16H13V18H11V16Z\" fill=\"currentColor\" />\n <path d=\"M11 11H13V13H11V11Z\" fill=\"currentColor\" />\n <path d=\"M6 16H8V18H6V16Z\" fill=\"currentColor\" />\n <path d=\"M16 11H18V13H16V11Z\" fill=\"currentColor\" />\n <path d=\"M16 6H18V8H16V6Z\" fill=\"currentColor\" />\n </g>\n </svg>\n </div>\n <div class=\"draggable-overlay\"></div>\n }\n <si-dashboard-card\n #card\n class=\"h-100 dragging-card\"\n [class]=\"accentLine\"\n [expandText]=\"labelExpand\"\n [restoreText]=\"labelRestore\"\n [heading]=\"widgetConfig().heading\"\n [primaryActions]=\"primaryActions\"\n [secondaryActions]=\"secondaryActions\"\n [actionBarViewType]=\"actionBarViewType\"\n [enableExpandInteraction]=\"widgetConfig().expandable\"\n [imgAlt]=\"widgetConfig().image?.alt\"\n [imgDir]=\"widgetConfig().image?.dir\"\n [imgObjectFit]=\"widgetConfig().image?.objectFit\"\n [imgObjectPosition]=\"widgetConfig().image?.objectPosition\"\n [imgSrc]=\"widgetConfig().image?.src\"\n >\n <div class=\"card-body overflow-auto\" body>\n <ng-container #widgetHost />\n </div>\n\n @if (widgetInstanceFooter) {\n <div class=\"card-footer\" footer>\n <ng-container *ngTemplateOutlet=\"widgetInstanceFooter\" />\n </div>\n }\n </si-dashboard-card>\n</div>\n", styles: [":host{display:flex}::ng-deep body:not(:has(.ui-draggable-dragging)) .draggable-overlay{cursor:grab}::ng-deep si-content-action-bar{z-index:500}::ng-deep .ui-droppable.ui-droppable-over>*:not(.ui-droppable){cursor:move!important;pointer-events:inherit!important}::ng-deep .ui-draggable-dragging .dragging-card,::ng-deep .ui-resizable-resizing .dragging-card{box-shadow:0 0 8px var(--element-box-shadow-color-1),0 8px 8px var(--element-box-shadow-color-2)!important}::ng-deep .ui-draggable-dragging>.grid-stack-item-content,::ng-deep .ui-resizable-resizing>.grid-stack-item-content{box-shadow:none;opacity:1}::ng-deep .ui-resizable-handle{display:block!important}::ng-deep .ui-resizable-se{background-image:none!important;transform:none!important;inset-block-end:6px!important;inset-inline-end:6px!important}.resize-handle{inset-block-end:6px;color:var(--element-ui-2);pointer-events:none;position:absolute;inset-inline-end:6px;text-align:center;z-index:10}.draggable-overlay{inset:8px;position:absolute;z-index:100}\n"] }]
|
|
809
|
+
}], propDecorators: { widgetConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgetConfig", required: true }] }], editable: [{ type: i0.Input, args: [{ isSignal: true, alias: "editable", required: false }] }], remove: [{ type: i0.Output, args: ["remove"] }], edit: [{ type: i0.Output, args: ["edit"] }], card: [{ type: i0.ViewChild, args: ['card', { isSignal: true }] }], widgetHost: [{ type: i0.ViewChild, args: ['widgetHost', { ...{ read: ViewContainerRef }, isSignal: true }] }] } });
|
|
817
810
|
|
|
818
811
|
/**
|
|
819
812
|
* Copyright (c) Siemens 2016 - 2026
|
|
@@ -913,22 +906,23 @@ class SiGridstackWrapperComponent {
|
|
|
913
906
|
});
|
|
914
907
|
}
|
|
915
908
|
}
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
909
|
+
/**
|
|
910
|
+
*
|
|
911
|
+
* Returns the position of a specific widget in the grid.
|
|
912
|
+
*/
|
|
913
|
+
getWidgetLayout(widgetId) {
|
|
914
|
+
const gridItem = this.gridItemsMap().get(widgetId);
|
|
915
|
+
if (!gridItem) {
|
|
916
|
+
return undefined;
|
|
917
|
+
}
|
|
918
|
+
const element = gridItem.component.location.nativeElement;
|
|
919
|
+
return {
|
|
920
|
+
id: widgetId,
|
|
921
|
+
x: Number(element.getAttribute('gs-x')) || 0,
|
|
922
|
+
y: Number(element.getAttribute('gs-y')) || 0,
|
|
923
|
+
width: Number(element.getAttribute('gs-w')) || 0,
|
|
924
|
+
height: Number(element.getAttribute('gs-h')) || 0
|
|
925
|
+
};
|
|
932
926
|
}
|
|
933
927
|
updateLayout(widgets) {
|
|
934
928
|
const widgetConfigMap = new Map(widgets.map(w => [w.id, { ...w, w: w.width, h: w.height }]));
|
|
@@ -949,6 +943,7 @@ class SiGridstackWrapperComponent {
|
|
|
949
943
|
const componentRef = this.gridstackContainer().createComponent(SiWidgetHostComponent, {
|
|
950
944
|
bindings: [
|
|
951
945
|
inputBinding('widgetConfig', configSignal),
|
|
946
|
+
inputBinding('editable', this.editable),
|
|
952
947
|
outputBinding('remove', widgetId => {
|
|
953
948
|
this.widgetInstanceRemove.emit(widgetId);
|
|
954
949
|
}),
|
|
@@ -1116,9 +1111,7 @@ class SiWidgetInstanceEditorDialogComponent {
|
|
|
1116
1111
|
if (this.isEditorWizard(this.widgetInstanceEditor)) {
|
|
1117
1112
|
this.editorWizardState.set(this.widgetInstanceEditor.state);
|
|
1118
1113
|
if (this.widgetInstanceEditor.stateChange) {
|
|
1119
|
-
this.subscriptions.push(this.widgetInstanceEditor.stateChange.subscribe(state =>
|
|
1120
|
-
this.editorWizardState.set(state);
|
|
1121
|
-
}));
|
|
1114
|
+
this.subscriptions.push(this.widgetInstanceEditor.stateChange.subscribe(state => this.editorWizardState.set(state)));
|
|
1122
1115
|
}
|
|
1123
1116
|
}
|
|
1124
1117
|
this.editorSetupCompleted.emit();
|
|
@@ -1233,14 +1226,6 @@ class SiGridComponent {
|
|
|
1233
1226
|
* @defaultValue false
|
|
1234
1227
|
*/
|
|
1235
1228
|
editable = model(false, ...(ngDevMode ? [{ debugName: "editable" }] : []));
|
|
1236
|
-
/**
|
|
1237
|
-
* This is the internal owner of the current editable state and is used to track if
|
|
1238
|
-
* editable or not. Not editable can be changed by either calling the `edit()` api
|
|
1239
|
-
* method or by setting the `editable` input. When setting the input, the `ngOnChanges(...)`
|
|
1240
|
-
* hook is used to call the `edit()` method. Similar, to get from editable to not editable,
|
|
1241
|
-
* `cancel()` or `save()` is used and can be triggered from `ngOnChanges(...)`.
|
|
1242
|
-
*/
|
|
1243
|
-
editableInternal = false;
|
|
1244
1229
|
/**
|
|
1245
1230
|
* An optional, but recommended dashboard id that is used in persistence and passed
|
|
1246
1231
|
* to the widget store for saving and loading data.
|
|
@@ -1341,10 +1326,10 @@ class SiGridComponent {
|
|
|
1341
1326
|
}
|
|
1342
1327
|
if (changes.editable) {
|
|
1343
1328
|
if (changes.editable.currentValue) {
|
|
1344
|
-
this.
|
|
1329
|
+
this.resetEditState();
|
|
1345
1330
|
}
|
|
1346
1331
|
else {
|
|
1347
|
-
this.
|
|
1332
|
+
this.restoreSavedState();
|
|
1348
1333
|
}
|
|
1349
1334
|
}
|
|
1350
1335
|
if (changes.widgetCatalog) {
|
|
@@ -1363,13 +1348,9 @@ class SiGridComponent {
|
|
|
1363
1348
|
* Set dashboard grid in editable mode to modify widget instances.
|
|
1364
1349
|
*/
|
|
1365
1350
|
edit() {
|
|
1366
|
-
if (!this.
|
|
1367
|
-
this.transientWidgetInstances = [];
|
|
1368
|
-
this.markedForRemoval = [];
|
|
1369
|
-
this.setModified(false);
|
|
1370
|
-
this.editableInternal = true;
|
|
1351
|
+
if (!this.editable()) {
|
|
1371
1352
|
this.editable.set(true);
|
|
1372
|
-
this.
|
|
1353
|
+
this.resetEditState();
|
|
1373
1354
|
}
|
|
1374
1355
|
}
|
|
1375
1356
|
/**
|
|
@@ -1377,7 +1358,7 @@ class SiGridComponent {
|
|
|
1377
1358
|
* changes the editable and isModified modes.
|
|
1378
1359
|
*/
|
|
1379
1360
|
save() {
|
|
1380
|
-
if (!this.
|
|
1361
|
+
if (!this.editable()) {
|
|
1381
1362
|
return;
|
|
1382
1363
|
}
|
|
1383
1364
|
this.isLoading.next(true);
|
|
@@ -1392,9 +1373,7 @@ class SiGridComponent {
|
|
|
1392
1373
|
.subscribe({
|
|
1393
1374
|
next: (value) => {
|
|
1394
1375
|
this.setModified(false);
|
|
1395
|
-
this.editableInternal = false;
|
|
1396
1376
|
this.editable.set(false);
|
|
1397
|
-
this.gridService.editable$.next(this.editableInternal);
|
|
1398
1377
|
this.isLoading.next(false);
|
|
1399
1378
|
},
|
|
1400
1379
|
error: (err) => {
|
|
@@ -1407,18 +1386,10 @@ class SiGridComponent {
|
|
|
1407
1386
|
* Cancel current changes and restore last saved state.
|
|
1408
1387
|
*/
|
|
1409
1388
|
cancel() {
|
|
1410
|
-
if (!this.editableInternal) {
|
|
1411
|
-
return;
|
|
1412
|
-
}
|
|
1413
|
-
if (this.modified) {
|
|
1414
|
-
this.visibleWidgetInstances$.next([...this.persistedWidgetInstances]);
|
|
1415
|
-
this.setModified(false);
|
|
1416
|
-
}
|
|
1417
|
-
this.editableInternal = false;
|
|
1418
1389
|
if (this.editable()) {
|
|
1419
1390
|
this.editable.set(false);
|
|
1391
|
+
this.restoreSavedState();
|
|
1420
1392
|
}
|
|
1421
|
-
this.gridService.editable$.next(this.editableInternal);
|
|
1422
1393
|
}
|
|
1423
1394
|
/**
|
|
1424
1395
|
* Adds a new widget instance configuration to the dashboard grid. It is not
|
|
@@ -1507,6 +1478,14 @@ class SiGridComponent {
|
|
|
1507
1478
|
}
|
|
1508
1479
|
handleGridEvent(event) {
|
|
1509
1480
|
const relevantEventTypes = ['added', 'removed', 'dragstop', 'resizestop'];
|
|
1481
|
+
// When widgets without explicit x/y are first added, GridStack auto-positions them.
|
|
1482
|
+
// Capture these resolved positions so cancel() can restore the exact layout
|
|
1483
|
+
// instead of re-triggering auto-positioning which may produce a different result.
|
|
1484
|
+
if (event.event.type === 'added' &&
|
|
1485
|
+
!this.editable() &&
|
|
1486
|
+
this.persistedWidgetInstances.some(w => w.x === undefined || w.y === undefined)) {
|
|
1487
|
+
this.persistedWidgetInstances = this.updateWidgetPositions(this.persistedWidgetInstances);
|
|
1488
|
+
}
|
|
1510
1489
|
if (this.editable() && relevantEventTypes.includes(event.event.type)) {
|
|
1511
1490
|
// Make sure the widget config always holds the latest position information
|
|
1512
1491
|
const widgets = this.updateWidgetPositions(this.visibleWidgetInstances$.value);
|
|
@@ -1542,9 +1521,9 @@ class SiGridComponent {
|
|
|
1542
1521
|
});
|
|
1543
1522
|
}
|
|
1544
1523
|
updateWidgetPositions(widgetConfigs) {
|
|
1545
|
-
const
|
|
1524
|
+
const wrapper = this.gridStackWrapper();
|
|
1546
1525
|
const widgets = widgetConfigs.map(widget => {
|
|
1547
|
-
const position =
|
|
1526
|
+
const position = wrapper.getWidgetLayout(widget.id);
|
|
1548
1527
|
if (position &&
|
|
1549
1528
|
(widget.x !== position.x ||
|
|
1550
1529
|
widget.y !== position.y ||
|
|
@@ -1564,6 +1543,17 @@ class SiGridComponent {
|
|
|
1564
1543
|
});
|
|
1565
1544
|
return widgets || [];
|
|
1566
1545
|
}
|
|
1546
|
+
resetEditState() {
|
|
1547
|
+
this.transientWidgetInstances = [];
|
|
1548
|
+
this.markedForRemoval = [];
|
|
1549
|
+
this.setModified(false);
|
|
1550
|
+
}
|
|
1551
|
+
restoreSavedState() {
|
|
1552
|
+
if (this.modified) {
|
|
1553
|
+
this.visibleWidgetInstances$.next([...this.persistedWidgetInstances]);
|
|
1554
|
+
this.setModified(false);
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1567
1557
|
setModified(modified) {
|
|
1568
1558
|
if (this.modified !== modified) {
|
|
1569
1559
|
this.modified = modified;
|
|
@@ -1691,7 +1681,6 @@ class SiWidgetCatalogComponent {
|
|
|
1691
1681
|
widgetConfigModified = false;
|
|
1692
1682
|
widgetInstanceEditor;
|
|
1693
1683
|
editorWizardState = signal(undefined, ...(ngDevMode ? [{ debugName: "editorWizardState" }] : []));
|
|
1694
|
-
widgetInstanceEditorRef;
|
|
1695
1684
|
subscriptions = [];
|
|
1696
1685
|
dialogService = inject(SiActionDialogService);
|
|
1697
1686
|
injector = inject(Injector);
|
|
@@ -1789,10 +1778,9 @@ class SiWidgetCatalogComponent {
|
|
|
1789
1778
|
this.widgetConfig = createWidgetConfig(selected);
|
|
1790
1779
|
setupWidgetEditor(selected.componentFactory, this.editorHost(), this.injector, this.envInjector).subscribe({
|
|
1791
1780
|
next: componentRef => {
|
|
1792
|
-
this.widgetInstanceEditorRef = componentRef;
|
|
1793
1781
|
this.widgetInstanceEditor = componentRef.instance;
|
|
1794
1782
|
if (isSignal(this.widgetInstanceEditor.config)) {
|
|
1795
|
-
|
|
1783
|
+
componentRef.setInput('config', this.widgetConfig);
|
|
1796
1784
|
}
|
|
1797
1785
|
else {
|
|
1798
1786
|
this.widgetInstanceEditor.config = this.widgetConfig;
|
|
@@ -1801,26 +1789,16 @@ class SiWidgetCatalogComponent {
|
|
|
1801
1789
|
if ('statusChangesHandler' in this.widgetInstanceEditor) {
|
|
1802
1790
|
this.widgetInstanceEditor.statusChangesHandler = this.handleStatusChanges.bind(this);
|
|
1803
1791
|
}
|
|
1804
|
-
let hasStatusChangesEmitter = false;
|
|
1805
1792
|
if (this.widgetInstanceEditor.statusChanges) {
|
|
1806
|
-
|
|
1807
|
-
this.subscriptions.push(this.widgetInstanceEditor.statusChanges.subscribe(statusChanges => {
|
|
1808
|
-
this.handleStatusChanges(statusChanges);
|
|
1809
|
-
}));
|
|
1793
|
+
this.subscriptions.push(this.widgetInstanceEditor.statusChanges.subscribe(statusChanges => this.handleStatusChanges(statusChanges)));
|
|
1810
1794
|
}
|
|
1811
|
-
if (this.widgetInstanceEditor.configChange) {
|
|
1812
|
-
this.subscriptions.push(this.widgetInstanceEditor.configChange.subscribe(
|
|
1813
|
-
if (!hasStatusChangesEmitter) {
|
|
1814
|
-
this.widgetConfigModified = true;
|
|
1815
|
-
}
|
|
1816
|
-
}));
|
|
1795
|
+
else if (this.widgetInstanceEditor.configChange) {
|
|
1796
|
+
this.subscriptions.push(this.widgetInstanceEditor.configChange.subscribe(() => (this.widgetConfigModified = true)));
|
|
1817
1797
|
}
|
|
1818
1798
|
if (this.isEditorWizard(this.widgetInstanceEditor)) {
|
|
1819
1799
|
this.editorWizardState.set(this.widgetInstanceEditor.state);
|
|
1820
1800
|
if (this.widgetInstanceEditor.stateChange) {
|
|
1821
|
-
this.subscriptions.push(this.widgetInstanceEditor.stateChange.subscribe(state =>
|
|
1822
|
-
this.editorWizardState.set(state);
|
|
1823
|
-
}));
|
|
1801
|
+
this.subscriptions.push(this.widgetInstanceEditor.stateChange.subscribe(state => this.editorWizardState.set(state)));
|
|
1824
1802
|
}
|
|
1825
1803
|
}
|
|
1826
1804
|
},
|
|
@@ -1883,7 +1861,7 @@ class SiWidgetCatalogComponent {
|
|
|
1883
1861
|
}
|
|
1884
1862
|
}
|
|
1885
1863
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiWidgetCatalogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1886
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.8", type: SiWidgetCatalogComponent, isStandalone: true, selector: "si-widget-catalog", inputs: { searchPlaceholder: { classPropertyName: "searchPlaceholder", publicName: "searchPlaceholder", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closed: "closed" }, viewQueries: [{ propertyName: "editorHost", first: true, predicate: ["editorHost"], descendants: true, read: ViewContainerRef, isSignal: true }, { propertyName: "widgetCdkListbox", first: true, predicate: (CdkListbox), descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"si-layout-fixed-height mb-8 mx-0 overflow-auto px-2 pt-2\">\n @if (view() === 'list') {\n <div class=\"si-layout-fixed-height\">\n <div class=\"mx-0\">\n <si-search-bar\n class=\"w-100\"\n colorVariant=\"base-1\"\n showIcon=\"true\"\n [placeholder]=\"searchPlaceholder() | translate\"\n [value]=\"searchTerm\"\n (searchChange)=\"onSearch($event)\"\n />\n </div>\n <div
|
|
1864
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.8", type: SiWidgetCatalogComponent, isStandalone: true, selector: "si-widget-catalog", inputs: { searchPlaceholder: { classPropertyName: "searchPlaceholder", publicName: "searchPlaceholder", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closed: "closed" }, viewQueries: [{ propertyName: "editorHost", first: true, predicate: ["editorHost"], descendants: true, read: ViewContainerRef, isSignal: true }, { propertyName: "widgetCdkListbox", first: true, predicate: (CdkListbox), descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"si-layout-fixed-height mb-8 mx-0 overflow-auto px-2 pt-2\">\n @if (view() === 'list') {\n <div class=\"si-layout-fixed-height\">\n <div class=\"mx-0\">\n <si-search-bar\n class=\"w-100\"\n colorVariant=\"base-1\"\n showIcon=\"true\"\n [placeholder]=\"searchPlaceholder() | translate\"\n [value]=\"searchTerm\"\n (searchChange)=\"onSearch($event)\"\n />\n </div>\n <div class=\"si-layout-fixed-height text-pre-wrap text-break mt-6 bg-base-1 rounded-2\">\n @if (filteredWidgetCatalog.length > 0) {\n <span id=\"widget-catalog-list-description\" class=\"visually-hidden\">\n {{ labelWidgetCatalogList | translate }}\n </span>\n <ul\n class=\"si-layout-fixed-height list-group overflow-auto mb-0\"\n aria-labelledby=\"widget-catalog-list-description\"\n cdkListbox\n [cdkListboxValue]=\"[]\"\n (cdkListboxValueChange)=\"selectWidget($event.value[0])\"\n >\n @for (widget of filteredWidgetCatalog; track $index) {\n <li\n class=\"list-group-item list-group-item-action d-flex\"\n [cdkOption]=\"widget\"\n [class.active]=\"selected() === widget\"\n >\n <si-circle-status class=\"my-n4 me-5\" [icon]=\"widget.iconClass\" />\n <div class=\"d-flex flex-column align-items-start align-self-center\">\n <span class=\"si-h5\">{{ widget.name }}</span>\n <span class=\"si-body\">{{ widget.description?.trim() }}</span>\n </div>\n </li>\n }\n </ul>\n } @else {\n <div>\n <si-empty-state icon=\"element-report\" [heading]=\"labelEmpty\" />\n </div>\n }\n </div>\n </div>\n }\n <ng-container #editorHost />\n</div>\n\n<div class=\"catalog-footer pb-4 px-2\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"onCancel()\">{{\n labelCancel | translate\n }}</button>\n @if (showPreviousButton()) {\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"onPrevious()\">{{\n labelPrevious | translate\n }}</button>\n }\n @if (showNextButton()) {\n <button\n type=\"button\"\n class=\"btn\"\n [class.btn-primary]=\"view() === 'list'\"\n [class.btn-secondary]=\"view() !== 'list'\"\n [disabled]=\"disableNextButton()\"\n (click)=\"onNext()\"\n >{{ labelNext | translate }}</button\n >\n }\n @if (showAddButton()) {\n <button\n type=\"button\"\n class=\"btn btn-primary\"\n [disabled]=\"disableAddButton()\"\n (click)=\"onAddWidget()\"\n >{{ labelAdd | translate }}</button\n >\n }\n</div>\n", styles: [":host{display:flex;flex:1 1 0;flex-direction:column;margin-inline:-4px;margin-block-start:-4px}.list-group-item{cursor:pointer}.catalog-footer{align-items:center;display:flex;flex-shrink:0;flex-wrap:wrap;justify-content:flex-end}.catalog-footer>*{margin-inline-start:16px}\n"], dependencies: [{ kind: "component", type: SiSearchBarComponent, selector: "si-search-bar", inputs: ["debounceTime", "prohibitedCharacters", "placeholder", "showIcon", "tabbable", "value", "readonly", "colorVariant", "disabled", "clearButtonAriaLabel"], outputs: ["searchChange"] }, { kind: "component", type: SiCircleStatusComponent, selector: "si-circle-status", inputs: ["status", "color", "icon", "size", "eventOut", "eventIcon", "blink", "blinkPulse", "ariaLabel"] }, { kind: "component", type: SiEmptyStateComponent, selector: "si-empty-state", inputs: ["icon", "heading", "content"] }, { kind: "directive", type: CdkListbox, selector: "[cdkListbox]", inputs: ["id", "tabindex", "cdkListboxValue", "cdkListboxMultiple", "cdkListboxDisabled", "cdkListboxUseActiveDescendant", "cdkListboxOrientation", "cdkListboxCompareWith", "cdkListboxNavigationWrapDisabled", "cdkListboxNavigatesDisabledOptions"], outputs: ["cdkListboxValueChange"], exportAs: ["cdkListbox"] }, { kind: "directive", type: CdkOption, selector: "[cdkOption]", inputs: ["id", "cdkOption", "cdkOptionTypeaheadLabel", "cdkOptionDisabled", "tabindex"], exportAs: ["cdkOption"] }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }] });
|
|
1887
1865
|
}
|
|
1888
1866
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiWidgetCatalogComponent, decorators: [{
|
|
1889
1867
|
type: Component,
|
|
@@ -1894,7 +1872,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
|
|
|
1894
1872
|
SiTranslatePipe,
|
|
1895
1873
|
CdkListbox,
|
|
1896
1874
|
CdkOption
|
|
1897
|
-
], template: "<div class=\"si-layout-fixed-height mb-8 mx-0 overflow-auto px-2 pt-2\">\n @if (view() === 'list') {\n <div class=\"si-layout-fixed-height\">\n <div class=\"mx-0\">\n <si-search-bar\n class=\"w-100\"\n colorVariant=\"base-1\"\n showIcon=\"true\"\n [placeholder]=\"searchPlaceholder() | translate\"\n [value]=\"searchTerm\"\n (searchChange)=\"onSearch($event)\"\n />\n </div>\n <div
|
|
1875
|
+
], template: "<div class=\"si-layout-fixed-height mb-8 mx-0 overflow-auto px-2 pt-2\">\n @if (view() === 'list') {\n <div class=\"si-layout-fixed-height\">\n <div class=\"mx-0\">\n <si-search-bar\n class=\"w-100\"\n colorVariant=\"base-1\"\n showIcon=\"true\"\n [placeholder]=\"searchPlaceholder() | translate\"\n [value]=\"searchTerm\"\n (searchChange)=\"onSearch($event)\"\n />\n </div>\n <div class=\"si-layout-fixed-height text-pre-wrap text-break mt-6 bg-base-1 rounded-2\">\n @if (filteredWidgetCatalog.length > 0) {\n <span id=\"widget-catalog-list-description\" class=\"visually-hidden\">\n {{ labelWidgetCatalogList | translate }}\n </span>\n <ul\n class=\"si-layout-fixed-height list-group overflow-auto mb-0\"\n aria-labelledby=\"widget-catalog-list-description\"\n cdkListbox\n [cdkListboxValue]=\"[]\"\n (cdkListboxValueChange)=\"selectWidget($event.value[0])\"\n >\n @for (widget of filteredWidgetCatalog; track $index) {\n <li\n class=\"list-group-item list-group-item-action d-flex\"\n [cdkOption]=\"widget\"\n [class.active]=\"selected() === widget\"\n >\n <si-circle-status class=\"my-n4 me-5\" [icon]=\"widget.iconClass\" />\n <div class=\"d-flex flex-column align-items-start align-self-center\">\n <span class=\"si-h5\">{{ widget.name }}</span>\n <span class=\"si-body\">{{ widget.description?.trim() }}</span>\n </div>\n </li>\n }\n </ul>\n } @else {\n <div>\n <si-empty-state icon=\"element-report\" [heading]=\"labelEmpty\" />\n </div>\n }\n </div>\n </div>\n }\n <ng-container #editorHost />\n</div>\n\n<div class=\"catalog-footer pb-4 px-2\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"onCancel()\">{{\n labelCancel | translate\n }}</button>\n @if (showPreviousButton()) {\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"onPrevious()\">{{\n labelPrevious | translate\n }}</button>\n }\n @if (showNextButton()) {\n <button\n type=\"button\"\n class=\"btn\"\n [class.btn-primary]=\"view() === 'list'\"\n [class.btn-secondary]=\"view() !== 'list'\"\n [disabled]=\"disableNextButton()\"\n (click)=\"onNext()\"\n >{{ labelNext | translate }}</button\n >\n }\n @if (showAddButton()) {\n <button\n type=\"button\"\n class=\"btn btn-primary\"\n [disabled]=\"disableAddButton()\"\n (click)=\"onAddWidget()\"\n >{{ labelAdd | translate }}</button\n >\n }\n</div>\n", styles: [":host{display:flex;flex:1 1 0;flex-direction:column;margin-inline:-4px;margin-block-start:-4px}.list-group-item{cursor:pointer}.catalog-footer{align-items:center;display:flex;flex-shrink:0;flex-wrap:wrap;justify-content:flex-end}.catalog-footer>*{margin-inline-start:16px}\n"] }]
|
|
1898
1876
|
}], propDecorators: { searchPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchPlaceholder", required: false }] }], closed: [{ type: i0.Output, args: ["closed"] }], editorHost: [{ type: i0.ViewChild, args: ['editorHost', { ...{ read: ViewContainerRef }, isSignal: true }] }], widgetCdkListbox: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CdkListbox), { isSignal: true }] }] } });
|
|
1899
1877
|
|
|
1900
1878
|
/**
|
|
@@ -2059,21 +2037,13 @@ class SiFlexibleDashboardComponent {
|
|
|
2059
2037
|
dashboard.restore();
|
|
2060
2038
|
}
|
|
2061
2039
|
if (this.editable()) {
|
|
2062
|
-
this.
|
|
2040
|
+
this.editable.set(false);
|
|
2063
2041
|
this.viewState.set('dashboard');
|
|
2064
2042
|
this.catalogHost().clear();
|
|
2065
2043
|
}
|
|
2066
2044
|
this.dashboardId$.next(changes.dashboardId.currentValue);
|
|
2067
2045
|
this.setupMenuItems();
|
|
2068
2046
|
}
|
|
2069
|
-
if (changes.editable) {
|
|
2070
|
-
if (changes.editable.currentValue) {
|
|
2071
|
-
this.grid().edit();
|
|
2072
|
-
}
|
|
2073
|
-
else {
|
|
2074
|
-
this.grid().cancel();
|
|
2075
|
-
}
|
|
2076
|
-
}
|
|
2077
2047
|
if (changes.hideAddWidgetInstanceButton) {
|
|
2078
2048
|
this.hideAddWidgetInstanceButton$.next(changes.hideAddWidgetInstanceButton.currentValue);
|
|
2079
2049
|
}
|
|
@@ -2094,7 +2064,7 @@ class SiFlexibleDashboardComponent {
|
|
|
2094
2064
|
dashboard.restore();
|
|
2095
2065
|
}
|
|
2096
2066
|
if (!this.editable()) {
|
|
2097
|
-
this.
|
|
2067
|
+
this.editable.set(true);
|
|
2098
2068
|
}
|
|
2099
2069
|
this.viewState.set('catalog');
|
|
2100
2070
|
const componentType = this.widgetCatalogComponent() ?? SiWidgetCatalogComponent;
|
|
@@ -2175,11 +2145,11 @@ class SiFlexibleDashboardComponent {
|
|
|
2175
2145
|
return this.widgetCatalog().find(widget => widget.id === id);
|
|
2176
2146
|
}
|
|
2177
2147
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiFlexibleDashboardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2178
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.0.8", type: SiFlexibleDashboardComponent, isStandalone: true, selector: "si-flexible-dashboard", inputs: { editable: { classPropertyName: "editable", publicName: "editable", isSignal: true, isRequired: false, transformFunction: null }, heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: false, transformFunction: null }, widgetCatalogComponent: { classPropertyName: "widgetCatalogComponent", publicName: "widgetCatalogComponent", isSignal: true, isRequired: false, transformFunction: null }, widgetInstanceEditorDialogComponent: { classPropertyName: "widgetInstanceEditorDialogComponent", publicName: "widgetInstanceEditorDialogComponent", isSignal: true, isRequired: false, transformFunction: null }, dashboardId: { classPropertyName: "dashboardId", publicName: "dashboardId", isSignal: true, isRequired: false, transformFunction: null }, widgetCatalog: { classPropertyName: "widgetCatalog", publicName: "widgetCatalog", isSignal: true, isRequired: false, transformFunction: null }, hideAddWidgetInstanceButton: { classPropertyName: "hideAddWidgetInstanceButton", publicName: "hideAddWidgetInstanceButton", 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 }, hideProgressIndicator: { classPropertyName: "hideProgressIndicator", publicName: "hideProgressIndicator", isSignal: true, isRequired: false, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null }, searchPlaceholder: { classPropertyName: "searchPlaceholder", publicName: "searchPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, primaryEditActions: { classPropertyName: "primaryEditActions", publicName: "primaryEditActions", isSignal: true, isRequired: false, transformFunction: null }, secondaryEditActions: { classPropertyName: "secondaryEditActions", publicName: "secondaryEditActions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { editable: "editableChange", isModified: "isModified" }, viewQueries: [{ propertyName: "grid", first: true, predicate: ["grid"], descendants: true, isSignal: true }, { propertyName: "dashboard", first: true, predicate: ["dashboard"], descendants: true, isSignal: true }, { propertyName: "catalogHost", first: true, predicate: ["catalogHost"], descendants: true, read: ViewContainerRef, isSignal: true }, { propertyName: "toolbar", first: true, predicate: ["toolbar"], descendants: true, isSignal: true }], usesOnChanges: true, ngImport: i0, template: "<si-dashboard #dashboard [heading]=\"pageTitle()\" [sticky]=\"true\">\n <si-dashboard-toolbar\n #toolbar\n menubar\n [class.d-none]=\"!isDashboardVisible()\"\n [primaryEditActions]=\"(primaryEditActions$ | async) ?? []\"\n [secondaryEditActions]=\"(secondaryEditActions$ | async) ?? []\"\n [
|
|
2148
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.0.8", type: SiFlexibleDashboardComponent, isStandalone: true, selector: "si-flexible-dashboard", inputs: { editable: { classPropertyName: "editable", publicName: "editable", isSignal: true, isRequired: false, transformFunction: null }, heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: false, transformFunction: null }, widgetCatalogComponent: { classPropertyName: "widgetCatalogComponent", publicName: "widgetCatalogComponent", isSignal: true, isRequired: false, transformFunction: null }, widgetInstanceEditorDialogComponent: { classPropertyName: "widgetInstanceEditorDialogComponent", publicName: "widgetInstanceEditorDialogComponent", isSignal: true, isRequired: false, transformFunction: null }, dashboardId: { classPropertyName: "dashboardId", publicName: "dashboardId", isSignal: true, isRequired: false, transformFunction: null }, widgetCatalog: { classPropertyName: "widgetCatalog", publicName: "widgetCatalog", isSignal: true, isRequired: false, transformFunction: null }, hideAddWidgetInstanceButton: { classPropertyName: "hideAddWidgetInstanceButton", publicName: "hideAddWidgetInstanceButton", 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 }, hideProgressIndicator: { classPropertyName: "hideProgressIndicator", publicName: "hideProgressIndicator", isSignal: true, isRequired: false, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null }, searchPlaceholder: { classPropertyName: "searchPlaceholder", publicName: "searchPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, primaryEditActions: { classPropertyName: "primaryEditActions", publicName: "primaryEditActions", isSignal: true, isRequired: false, transformFunction: null }, secondaryEditActions: { classPropertyName: "secondaryEditActions", publicName: "secondaryEditActions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { editable: "editableChange", isModified: "isModified" }, viewQueries: [{ propertyName: "grid", first: true, predicate: ["grid"], descendants: true, isSignal: true }, { propertyName: "dashboard", first: true, predicate: ["dashboard"], descendants: true, isSignal: true }, { propertyName: "catalogHost", first: true, predicate: ["catalogHost"], descendants: true, read: ViewContainerRef, isSignal: true }, { propertyName: "toolbar", first: true, predicate: ["toolbar"], descendants: true, isSignal: true }], usesOnChanges: true, ngImport: i0, template: "<si-dashboard #dashboard [heading]=\"pageTitle()\" [sticky]=\"true\">\n <si-dashboard-toolbar\n #toolbar\n menubar\n [class.d-none]=\"!isDashboardVisible()\"\n [primaryEditActions]=\"(primaryEditActions$ | async) ?? []\"\n [secondaryEditActions]=\"(secondaryEditActions$ | async) ?? []\"\n [disabled]=\"(grid.isLoading | async) ?? false\"\n [hideEditButton]=\"hideEditButton()\"\n [showEditButtonLabel]=\"showEditButtonLabel()\"\n [grid]=\"grid\"\n [(editable)]=\"editable\"\n (save)=\"grid.save()\"\n >\n <ng-content select=\"[filters-slot]\" filters-slot />\n </si-dashboard-toolbar>\n\n <div dashboard class=\"d-contents\">\n <si-grid\n #grid\n [class.d-none]=\"!isDashboardVisible()\"\n [gridConfig]=\"config()?.grid\"\n [dashboardId]=\"dashboardId()\"\n [widgetCatalog]=\"widgetCatalog()\"\n [hideProgressIndicator]=\"hideProgressIndicator()\"\n [widgetInstanceEditorDialogComponent]=\"widgetInstanceEditorDialogComponent()\"\n [emitWidgetInstanceEditEvents]=\"true\"\n [(editable)]=\"editable\"\n (isModified)=\"onModified($event)\"\n (widgetInstanceEdit)=\"editWidgetInstance($event)\"\n >\n <ng-content select=\"[empty-state]\" empty-state />\n </si-grid>\n <ng-container #catalogHost />\n </div>\n</si-dashboard>\n", styles: [":host{display:flex;flex:1 1 0;flex-direction:column}\n"], dependencies: [{ kind: "component", type: SiDashboardComponent, selector: "si-dashboard", inputs: ["heading", "enableExpandInteractions", "sticky", "hideMenubar"] }, { kind: "component", type: SiDashboardToolbarComponent, selector: "si-dashboard-toolbar", inputs: ["primaryEditActions", "secondaryEditActions", "disableSaveButton", "disabled", "editable", "hideEditButton", "showEditButtonLabel", "grid"], outputs: ["disableSaveButtonChange", "editableChange", "save"] }, { kind: "component", type: SiGridComponent, selector: "si-grid", inputs: ["gridConfig", "editable", "dashboardId", "widgetCatalog", "emitWidgetInstanceEditEvents", "hideProgressIndicator", "widgetInstanceEditorDialogComponent"], outputs: ["editableChange", "isModified", "widgetInstanceEdit"] }, { kind: "pipe", type: AsyncPipe, name: "async" }] });
|
|
2179
2149
|
}
|
|
2180
2150
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiFlexibleDashboardComponent, decorators: [{
|
|
2181
2151
|
type: Component,
|
|
2182
|
-
args: [{ selector: 'si-flexible-dashboard', imports: [SiDashboardComponent, SiDashboardToolbarComponent, SiGridComponent, AsyncPipe], template: "<si-dashboard #dashboard [heading]=\"pageTitle()\" [sticky]=\"true\">\n <si-dashboard-toolbar\n #toolbar\n menubar\n [class.d-none]=\"!isDashboardVisible()\"\n [primaryEditActions]=\"(primaryEditActions$ | async) ?? []\"\n [secondaryEditActions]=\"(secondaryEditActions$ | async) ?? []\"\n [
|
|
2152
|
+
args: [{ selector: 'si-flexible-dashboard', imports: [SiDashboardComponent, SiDashboardToolbarComponent, SiGridComponent, AsyncPipe], template: "<si-dashboard #dashboard [heading]=\"pageTitle()\" [sticky]=\"true\">\n <si-dashboard-toolbar\n #toolbar\n menubar\n [class.d-none]=\"!isDashboardVisible()\"\n [primaryEditActions]=\"(primaryEditActions$ | async) ?? []\"\n [secondaryEditActions]=\"(secondaryEditActions$ | async) ?? []\"\n [disabled]=\"(grid.isLoading | async) ?? false\"\n [hideEditButton]=\"hideEditButton()\"\n [showEditButtonLabel]=\"showEditButtonLabel()\"\n [grid]=\"grid\"\n [(editable)]=\"editable\"\n (save)=\"grid.save()\"\n >\n <ng-content select=\"[filters-slot]\" filters-slot />\n </si-dashboard-toolbar>\n\n <div dashboard class=\"d-contents\">\n <si-grid\n #grid\n [class.d-none]=\"!isDashboardVisible()\"\n [gridConfig]=\"config()?.grid\"\n [dashboardId]=\"dashboardId()\"\n [widgetCatalog]=\"widgetCatalog()\"\n [hideProgressIndicator]=\"hideProgressIndicator()\"\n [widgetInstanceEditorDialogComponent]=\"widgetInstanceEditorDialogComponent()\"\n [emitWidgetInstanceEditEvents]=\"true\"\n [(editable)]=\"editable\"\n (isModified)=\"onModified($event)\"\n (widgetInstanceEdit)=\"editWidgetInstance($event)\"\n >\n <ng-content select=\"[empty-state]\" empty-state />\n </si-grid>\n <ng-container #catalogHost />\n </div>\n</si-dashboard>\n", styles: [":host{display:flex;flex:1 1 0;flex-direction:column}\n"] }]
|
|
2183
2153
|
}], propDecorators: { editable: [{ type: i0.Input, args: [{ isSignal: true, alias: "editable", required: false }] }, { type: i0.Output, args: ["editableChange"] }], heading: [{ type: i0.Input, args: [{ isSignal: true, alias: "heading", required: false }] }], widgetCatalogComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgetCatalogComponent", required: false }] }], widgetInstanceEditorDialogComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgetInstanceEditorDialogComponent", required: false }] }], dashboardId: [{ type: i0.Input, args: [{ isSignal: true, alias: "dashboardId", required: false }] }], widgetCatalog: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgetCatalog", required: false }] }], hideAddWidgetInstanceButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideAddWidgetInstanceButton", required: false }] }], hideEditButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideEditButton", required: false }] }], showEditButtonLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "showEditButtonLabel", required: false }] }], hideProgressIndicator: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideProgressIndicator", required: false }] }], config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: false }] }], searchPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchPlaceholder", required: false }] }], primaryEditActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "primaryEditActions", required: false }] }], secondaryEditActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "secondaryEditActions", required: false }] }], grid: [{ type: i0.ViewChild, args: ['grid', { isSignal: true }] }], dashboard: [{ type: i0.ViewChild, args: ['dashboard', { isSignal: true }] }], catalogHost: [{ type: i0.ViewChild, args: ['catalogHost', { ...{ read: ViewContainerRef }, isSignal: true }] }], isModified: [{ type: i0.Output, args: ["isModified"] }], toolbar: [{ type: i0.ViewChild, args: ['toolbar', { isSignal: true }] }] } });
|
|
2184
2154
|
|
|
2185
2155
|
/**
|