@siemens/dashboards-ng 49.12.0 → 51.0.0-rc.3
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/README.md +4 -5
- package/fesm2022/siemens-dashboards-ng-translate.mjs.map +1 -1
- package/fesm2022/siemens-dashboards-ng.mjs +289 -258
- package/fesm2022/siemens-dashboards-ng.mjs.map +1 -1
- package/package.json +13 -11
- package/template-i18n.json +1 -0
- package/types/siemens-dashboards-ng-translate.d.ts +1 -0
- package/types/siemens-dashboards-ng.d.ts +22 -24
- /package/{LICENSE.md → LICENSE} +0 -0
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { NgTemplateOutlet, AsyncPipe } from '@angular/common';
|
|
1
|
+
import { NgTemplateOutlet, isPlatformBrowser, AsyncPipe } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { InjectionToken, inject, input, model, output, viewChild, computed,
|
|
3
|
+
import { InjectionToken, inject, input, model, output, viewChild, computed, Component, Injectable, ElementRef, Renderer2, DOCUMENT, Directive, EventEmitter, createNgModule, Injector, EnvironmentInjector, DestroyRef, signal, ViewContainerRef, isSignal, viewChildren, NgZone, PLATFORM_ID, afterNextRender, ChangeDetectionStrategy, inputBinding, outputBinding, NgModule } from '@angular/core';
|
|
4
4
|
import { SiDashboardCardComponent, SiDashboardComponent } from '@siemens/element-ng/dashboard';
|
|
5
5
|
import { t, SiTranslatePipe, injectSiTranslateService } from '@siemens/element-translate-ng/translate';
|
|
6
6
|
import { BehaviorSubject, of, Subject, throwError, ReplaySubject, first, combineLatest } from 'rxjs';
|
|
7
7
|
import { take, takeUntil } from 'rxjs/operators';
|
|
8
8
|
import { BOOTSTRAP_BREAKPOINTS, SiResponsiveContainerDirective } from '@siemens/element-ng/resize-observer';
|
|
9
9
|
import { ActivatedRoute, RouterLink } from '@angular/router';
|
|
10
|
+
import { elementEdit } from '@siemens/element-icons';
|
|
10
11
|
import { SiContentActionBarComponent } from '@siemens/element-ng/content-action-bar';
|
|
12
|
+
import { addIcons, SiIconComponent } from '@siemens/element-ng/icon';
|
|
11
13
|
import { SiLinkDirective } from '@siemens/element-ng/link';
|
|
12
14
|
import { SiLoadingButtonComponent, SiLoadingSpinnerDirective } from '@siemens/element-ng/loading-spinner';
|
|
13
15
|
import { SiTooltipDirective } from '@siemens/element-ng/tooltip';
|
|
@@ -174,51 +176,60 @@ class SiDefaultWidgetStorage extends SiWidgetStorage {
|
|
|
174
176
|
* the cancel and save buttons, as well as displaying primary and secondary actions.
|
|
175
177
|
*/
|
|
176
178
|
class SiDashboardToolbarComponent {
|
|
179
|
+
icons = addIcons({ elementEdit });
|
|
177
180
|
/**
|
|
178
181
|
* Set primary actions that are in `editable` mode first visible or in
|
|
179
182
|
* the expanded content action bar of the toolbar.
|
|
180
183
|
*
|
|
181
184
|
* @defaultValue []
|
|
182
185
|
*/
|
|
183
|
-
primaryEditActions = input([],
|
|
186
|
+
primaryEditActions = input([], /* @ts-ignore */
|
|
187
|
+
...(ngDevMode ? [{ debugName: "primaryEditActions" }] : /* istanbul ignore next */ []));
|
|
184
188
|
/**
|
|
185
189
|
* Set secondary actions that are in `editable` mode second visible or in
|
|
186
190
|
* the dropdown part of the content action bar of the toolbar.
|
|
187
191
|
*
|
|
188
192
|
* @defaultValue [] */
|
|
189
|
-
secondaryEditActions = input([],
|
|
193
|
+
secondaryEditActions = input([], /* @ts-ignore */
|
|
194
|
+
...(ngDevMode ? [{ debugName: "secondaryEditActions" }] : /* istanbul ignore next */ []));
|
|
190
195
|
/**
|
|
191
196
|
* Input to disable the save button. Note, the input `disabled` disables all
|
|
192
197
|
* actions and the save button of the toolbar.
|
|
193
198
|
*
|
|
194
199
|
* @defaultValue true
|
|
195
200
|
*/
|
|
196
|
-
disableSaveButton = model(true,
|
|
201
|
+
disableSaveButton = model(true, /* @ts-ignore */
|
|
202
|
+
...(ngDevMode ? [{ debugName: "disableSaveButton" }] : /* istanbul ignore next */ []));
|
|
197
203
|
/**
|
|
198
204
|
* Input to disable all actions and buttons of the toolbar.
|
|
199
205
|
*
|
|
200
206
|
* @defaultValue false */
|
|
201
|
-
disabled = input(false,
|
|
207
|
+
disabled = input(false, /* @ts-ignore */
|
|
208
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
202
209
|
/**
|
|
203
210
|
* Input option to set the `editable` mode. When editable
|
|
204
211
|
* the toolbar shows a cancel and save button. Otherwise,
|
|
205
212
|
* it displays an edit button.
|
|
206
213
|
*
|
|
207
214
|
* @defaultValue false */
|
|
208
|
-
editable = model(false,
|
|
215
|
+
editable = model(false, /* @ts-ignore */
|
|
216
|
+
...(ngDevMode ? [{ debugName: "editable" }] : /* istanbul ignore next */ []));
|
|
209
217
|
/**
|
|
210
218
|
* Option to hide the dashboard edit button.
|
|
211
219
|
*
|
|
212
220
|
* @defaultValue false
|
|
213
221
|
*/
|
|
214
|
-
hideEditButton = input(false,
|
|
222
|
+
hideEditButton = input(false, /* @ts-ignore */
|
|
223
|
+
...(ngDevMode ? [{ debugName: "hideEditButton" }] : /* istanbul ignore next */ []));
|
|
215
224
|
/**
|
|
216
225
|
* Option to display the edit button as a text button instead, only if the window is larger than xs {@link SiResponsiveContainerDirective}.
|
|
217
226
|
*
|
|
218
227
|
* @defaultValue false
|
|
219
228
|
*/
|
|
220
|
-
showEditButtonLabel = input(false,
|
|
221
|
-
|
|
229
|
+
showEditButtonLabel = input(false, /* @ts-ignore */
|
|
230
|
+
...(ngDevMode ? [{ debugName: "showEditButtonLabel" }] : /* istanbul ignore next */ []));
|
|
231
|
+
grid = input.required(/* @ts-ignore */
|
|
232
|
+
...(ngDevMode ? [{ debugName: "grid" }] : /* istanbul ignore next */ []));
|
|
222
233
|
/**
|
|
223
234
|
* Emits on save button click.
|
|
224
235
|
*/
|
|
@@ -228,17 +239,21 @@ class SiDashboardToolbarComponent {
|
|
|
228
239
|
labelSave = t(() => $localize `:@@DASHBOARD.SAVE:Save`);
|
|
229
240
|
activatedRoute = inject(ActivatedRoute, { optional: true });
|
|
230
241
|
dashboardToolbarContainer = viewChild.required(SiResponsiveContainerDirective);
|
|
231
|
-
showContentActionBar = computed(() => this.primaryEditActions()?.length + this.secondaryEditActions()?.length > 3,
|
|
242
|
+
showContentActionBar = computed(() => this.primaryEditActions()?.length + this.secondaryEditActions()?.length > 3, /* @ts-ignore */
|
|
243
|
+
...(ngDevMode ? [{ debugName: "showContentActionBar" }] : /* istanbul ignore next */ []));
|
|
232
244
|
editActions = computed(() => [
|
|
233
245
|
...this.primaryEditActions(),
|
|
234
246
|
...this.secondaryEditActions()
|
|
235
|
-
],
|
|
247
|
+
], /* @ts-ignore */
|
|
248
|
+
...(ngDevMode ? [{ debugName: "editActions" }] : /* istanbul ignore next */ []));
|
|
236
249
|
primaryEditActionsComputed = computed(() => {
|
|
237
250
|
return this.primaryEditActions().map(item => this.proxyMenuItemAction(item));
|
|
238
|
-
},
|
|
251
|
+
}, /* @ts-ignore */
|
|
252
|
+
...(ngDevMode ? [{ debugName: "primaryEditActionsComputed" }] : /* istanbul ignore next */ []));
|
|
239
253
|
secondaryEditActionsComputed = computed(() => {
|
|
240
254
|
return this.secondaryEditActions().map(item => this.proxyMenuItemAction(item));
|
|
241
|
-
},
|
|
255
|
+
}, /* @ts-ignore */
|
|
256
|
+
...(ngDevMode ? [{ debugName: "secondaryEditActionsComputed" }] : /* istanbul ignore next */ []));
|
|
242
257
|
onEdit() {
|
|
243
258
|
this.editable.set(true);
|
|
244
259
|
}
|
|
@@ -257,29 +272,31 @@ class SiDashboardToolbarComponent {
|
|
|
257
272
|
}
|
|
258
273
|
showEditButtonLabelDesktop = computed(() => {
|
|
259
274
|
return this.showEditButtonLabel() && !this.dashboardToolbarContainer()?.xs();
|
|
260
|
-
},
|
|
275
|
+
}, /* @ts-ignore */
|
|
276
|
+
...(ngDevMode ? [{ debugName: "showEditButtonLabelDesktop" }] : /* istanbul ignore next */ []));
|
|
261
277
|
proxyMenuItemAction(item) {
|
|
262
278
|
if (item.type === 'action' && typeof item.action === 'function') {
|
|
263
279
|
item.action = item.action.bind(this, this.grid());
|
|
264
280
|
}
|
|
265
281
|
return item;
|
|
266
282
|
}
|
|
267
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
268
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
283
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiDashboardToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
284
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", 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]=\"showEditButtonLabelDesktop ? 'btn-secondary' : 'btn-icon btn-tertiary'\"\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 } @else {\n <si-icon [icon]=\"icons.elementEdit\" />\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: "component", type: SiIconComponent, selector: "si-icon", inputs: ["icon"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "directive", type: SiResponsiveContainerDirective, selector: "[siResponsiveContainer]", inputs: ["resizeThrottle", "breakpoints"], exportAs: ["siResponsiveContainer"] }, { kind: "directive", type: SiTooltipDirective, selector: "[siTooltip]", inputs: ["siTooltip", "placement", "isDisabled", "tooltipScrollStrategy", "tooltipContext"] }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }] });
|
|
269
285
|
}
|
|
270
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
286
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiDashboardToolbarComponent, decorators: [{
|
|
271
287
|
type: Component,
|
|
272
288
|
args: [{ selector: 'si-dashboard-toolbar', imports: [
|
|
273
289
|
SiContentActionBarComponent,
|
|
274
290
|
SiLinkDirective,
|
|
275
291
|
SiLoadingButtonComponent,
|
|
292
|
+
SiIconComponent,
|
|
276
293
|
RouterLink,
|
|
277
294
|
SiResponsiveContainerDirective,
|
|
278
295
|
SiTranslatePipe,
|
|
279
296
|
SiTooltipDirective
|
|
280
|
-
],
|
|
297
|
+
], host: {
|
|
281
298
|
class: 'd-flex flex-column flex-grow-1'
|
|
282
|
-
}, 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]=\"
|
|
299
|
+
}, 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]=\"showEditButtonLabelDesktop ? 'btn-secondary' : 'btn-icon btn-tertiary'\"\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 } @else {\n <si-icon [icon]=\"icons.elementEdit\" />\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
300
|
}], 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 }] }] } });
|
|
284
301
|
|
|
285
302
|
/**
|
|
@@ -322,10 +339,10 @@ class SiWidgetDefaultIdProvider extends SiWidgetIdProvider {
|
|
|
322
339
|
generateWidgetId(widget, dashboardId) {
|
|
323
340
|
return crypto.randomUUID();
|
|
324
341
|
}
|
|
325
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
326
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
342
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiWidgetDefaultIdProvider, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
343
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiWidgetDefaultIdProvider, providedIn: 'root' });
|
|
327
344
|
}
|
|
328
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
345
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiWidgetDefaultIdProvider, decorators: [{
|
|
329
346
|
type: Injectable,
|
|
330
347
|
args: [{ providedIn: 'root' }]
|
|
331
348
|
}] });
|
|
@@ -335,9 +352,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
|
|
|
335
352
|
* SPDX-License-Identifier: MIT
|
|
336
353
|
*/
|
|
337
354
|
class SiWebComponentWrapperBaseComponent {
|
|
338
|
-
config = input.required(
|
|
339
|
-
|
|
340
|
-
|
|
355
|
+
config = input.required(/* @ts-ignore */
|
|
356
|
+
...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
357
|
+
elementTagName = input.required(/* @ts-ignore */
|
|
358
|
+
...(ngDevMode ? [{ debugName: "elementTagName" }] : /* istanbul ignore next */ []));
|
|
359
|
+
url = input.required(/* @ts-ignore */
|
|
360
|
+
...(ngDevMode ? [{ debugName: "url" }] : /* istanbul ignore next */ []));
|
|
341
361
|
webComponentHost = viewChild.required('webComponentHost', {
|
|
342
362
|
read: ElementRef
|
|
343
363
|
});
|
|
@@ -364,10 +384,10 @@ class SiWebComponentWrapperBaseComponent {
|
|
|
364
384
|
const script = document.querySelector(`script[src='${url}']`);
|
|
365
385
|
return script ? true : false;
|
|
366
386
|
}
|
|
367
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
368
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "
|
|
387
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiWebComponentWrapperBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
388
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "22.0.5", type: SiWebComponentWrapperBaseComponent, isStandalone: true, inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, elementTagName: { classPropertyName: "elementTagName", publicName: "elementTagName", isSignal: true, isRequired: true, transformFunction: null }, url: { classPropertyName: "url", publicName: "url", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "webComponentHost", first: true, predicate: ["webComponentHost"], descendants: true, read: ElementRef, isSignal: true }], usesOnChanges: true, ngImport: i0 });
|
|
369
389
|
}
|
|
370
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
390
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiWebComponentWrapperBaseComponent, decorators: [{
|
|
371
391
|
type: Directive
|
|
372
392
|
}], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], elementTagName: [{ type: i0.Input, args: [{ isSignal: true, alias: "elementTagName", required: true }] }], url: [{ type: i0.Input, args: [{ isSignal: true, alias: "url", required: true }] }], webComponentHost: [{ type: i0.ViewChild, args: ['webComponentHost', { ...{
|
|
373
393
|
read: ElementRef
|
|
@@ -415,12 +435,12 @@ class SiWebComponentEditorWrapperComponent extends SiWebComponentWrapperBaseComp
|
|
|
415
435
|
previous() {
|
|
416
436
|
this.webComponent?.dispatchEvent(new CustomEvent('previous'));
|
|
417
437
|
}
|
|
418
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
419
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
438
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiWebComponentEditorWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
439
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.5", type: SiWebComponentEditorWrapperComponent, isStandalone: true, selector: "si-web-component-editor-wrapper", usesInheritance: true, ngImport: i0, template: "<div #webComponentHost class=\"h-100\"></div>\n" });
|
|
420
440
|
}
|
|
421
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
441
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiWebComponentEditorWrapperComponent, decorators: [{
|
|
422
442
|
type: Component,
|
|
423
|
-
args: [{ selector: 'si-web-component-editor-wrapper',
|
|
443
|
+
args: [{ selector: 'si-web-component-editor-wrapper', template: "<div #webComponentHost class=\"h-100\"></div>\n" }]
|
|
424
444
|
}] });
|
|
425
445
|
|
|
426
446
|
/**
|
|
@@ -459,12 +479,12 @@ class SiWebComponentWrapperComponent extends SiWebComponentWrapperBaseComponent
|
|
|
459
479
|
this.secondaryEditActions = event.secondaryEditActions ?? this.secondaryEditActions;
|
|
460
480
|
this.configChange.emit(event);
|
|
461
481
|
}
|
|
462
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
463
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
482
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiWebComponentWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
483
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.5", type: SiWebComponentWrapperComponent, isStandalone: true, selector: "si-web-component-wrapper", usesInheritance: true, ngImport: i0, template: "<div #webComponentHost class=\"h-100\"></div>\n" });
|
|
464
484
|
}
|
|
465
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
485
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiWebComponentWrapperComponent, decorators: [{
|
|
466
486
|
type: Component,
|
|
467
|
-
args: [{ selector: 'si-web-component-wrapper',
|
|
487
|
+
args: [{ selector: 'si-web-component-wrapper', template: "<div #webComponentHost class=\"h-100\"></div>\n" }]
|
|
468
488
|
}] });
|
|
469
489
|
|
|
470
490
|
/**
|
|
@@ -580,20 +600,27 @@ class SiWidgetHostComponent {
|
|
|
580
600
|
destroyRef = inject(DestroyRef);
|
|
581
601
|
translateService = injectSiTranslateService();
|
|
582
602
|
liveAnnouncer = inject(LiveAnnouncer);
|
|
603
|
+
/** @internal */
|
|
583
604
|
elementRef = inject(ElementRef).nativeElement;
|
|
584
605
|
/** @defaultValue false */
|
|
585
|
-
keyboardActive = signal(false,
|
|
586
|
-
|
|
606
|
+
keyboardActive = signal(false, /* @ts-ignore */
|
|
607
|
+
...(ngDevMode ? [{ debugName: "keyboardActive" }] : /* istanbul ignore next */ []));
|
|
608
|
+
widgetConfig = input.required(/* @ts-ignore */
|
|
609
|
+
...(ngDevMode ? [{ debugName: "widgetConfig" }] : /* istanbul ignore next */ []));
|
|
610
|
+
grid = input(/* @ts-ignore */
|
|
611
|
+
...(ngDevMode ? [undefined, { debugName: "grid" }] : /* istanbul ignore next */ []));
|
|
587
612
|
/**
|
|
588
613
|
* The component factory for this widget's type.
|
|
589
614
|
*/
|
|
590
|
-
componentFactory = input(
|
|
615
|
+
componentFactory = input(/* @ts-ignore */
|
|
616
|
+
...(ngDevMode ? [undefined, { debugName: "componentFactory" }] : /* istanbul ignore next */ []));
|
|
591
617
|
/**
|
|
592
618
|
* Sets the widget host into editable mode.
|
|
593
619
|
*
|
|
594
620
|
* @defaultValue false
|
|
595
621
|
*/
|
|
596
|
-
editable = input(false,
|
|
622
|
+
editable = input(false, /* @ts-ignore */
|
|
623
|
+
...(ngDevMode ? [{ debugName: "editable" }] : /* istanbul ignore next */ []));
|
|
597
624
|
remove = output();
|
|
598
625
|
edit = output();
|
|
599
626
|
gridEvent = output();
|
|
@@ -612,18 +639,31 @@ class SiWidgetHostComponent {
|
|
|
612
639
|
a11yWidgetActivatedMessage = t(() => $localize `:@@DASHBOARD.WIDGET.A11Y.ACTIVATED:Widget activated. Use arrow keys to move, Shift+arrow keys to resize, Escape to exit.`);
|
|
613
640
|
a11yWidgetDeactivatedMessage = t(() => $localize `:@@DASHBOARD.WIDGET.A11Y.DEACTIVATED:Widget deactivated.`);
|
|
614
641
|
a11yWidgetDescription = t(() => $localize `:@@DASHBOARD.WIDGET.A11Y.DESCRIPTION:Press Enter or Space to activate. Then use arrow keys to move, Shift+arrow keys to resize, Escape to exit.`);
|
|
642
|
+
widgetAriaLabel = computed(() => {
|
|
643
|
+
const widgetHeading = this.widgetConfig().heading;
|
|
644
|
+
if (widgetHeading) {
|
|
645
|
+
return this.translateService.translateSync(widgetHeading);
|
|
646
|
+
}
|
|
647
|
+
return null;
|
|
648
|
+
}, /* @ts-ignore */
|
|
649
|
+
...(ngDevMode ? [{ debugName: "widgetAriaLabel" }] : /* istanbul ignore next */ []));
|
|
615
650
|
widgetInstance;
|
|
616
651
|
widgetRef;
|
|
617
652
|
/** @defaultValue [] */
|
|
618
|
-
primaryActions = signal([],
|
|
653
|
+
primaryActions = signal([], /* @ts-ignore */
|
|
654
|
+
...(ngDevMode ? [{ debugName: "primaryActions" }] : /* istanbul ignore next */ []));
|
|
619
655
|
/** @defaultValue [] */
|
|
620
|
-
secondaryActions = signal([],
|
|
656
|
+
secondaryActions = signal([], /* @ts-ignore */
|
|
657
|
+
...(ngDevMode ? [{ debugName: "secondaryActions" }] : /* istanbul ignore next */ []));
|
|
621
658
|
/** @defaultValue 'expanded' */
|
|
622
|
-
actionBarViewType = signal('expanded',
|
|
659
|
+
actionBarViewType = signal('expanded', /* @ts-ignore */
|
|
660
|
+
...(ngDevMode ? [{ debugName: "actionBarViewType" }] : /* istanbul ignore next */ []));
|
|
623
661
|
/** @defaultValue [] */
|
|
624
|
-
editablePrimaryActions = signal([],
|
|
662
|
+
editablePrimaryActions = signal([], /* @ts-ignore */
|
|
663
|
+
...(ngDevMode ? [{ debugName: "editablePrimaryActions" }] : /* istanbul ignore next */ []));
|
|
625
664
|
/** @defaultValue [] */
|
|
626
|
-
editableSecondaryActions = signal([],
|
|
665
|
+
editableSecondaryActions = signal([], /* @ts-ignore */
|
|
666
|
+
...(ngDevMode ? [{ debugName: "editableSecondaryActions" }] : /* istanbul ignore next */ []));
|
|
627
667
|
/**
|
|
628
668
|
* @defaultValue
|
|
629
669
|
* ```
|
|
@@ -662,13 +702,30 @@ class SiWidgetHostComponent {
|
|
|
662
702
|
iconOnly: true,
|
|
663
703
|
action: () => this.onRemove()
|
|
664
704
|
};
|
|
665
|
-
widgetInstanceFooter = signal(undefined,
|
|
705
|
+
widgetInstanceFooter = signal(undefined, /* @ts-ignore */
|
|
706
|
+
...(ngDevMode ? [{ debugName: "widgetInstanceFooter" }] : /* istanbul ignore next */ []));
|
|
666
707
|
accentLine = computed(() => {
|
|
667
708
|
const { accentLine } = this.widgetConfig();
|
|
668
709
|
return accentLine ? 'accent-' + accentLine : '';
|
|
669
|
-
},
|
|
710
|
+
}, /* @ts-ignore */
|
|
711
|
+
...(ngDevMode ? [{ debugName: "accentLine" }] : /* istanbul ignore next */ []));
|
|
670
712
|
ngOnChanges(changes) {
|
|
671
713
|
if (changes.widgetConfig) {
|
|
714
|
+
const options = {
|
|
715
|
+
...this.widgetConfig(),
|
|
716
|
+
w: this.widgetConfig().width,
|
|
717
|
+
h: this.widgetConfig().height,
|
|
718
|
+
x: this.widgetConfig().x,
|
|
719
|
+
y: this.widgetConfig().y,
|
|
720
|
+
minW: this.widgetConfig().minWidth,
|
|
721
|
+
minH: this.widgetConfig().minHeight
|
|
722
|
+
};
|
|
723
|
+
if (!changes.widgetConfig.firstChange) {
|
|
724
|
+
this.grid()?.update(this.elementRef, options);
|
|
725
|
+
}
|
|
726
|
+
else {
|
|
727
|
+
this.grid()?.makeWidget(this.elementRef, options);
|
|
728
|
+
}
|
|
672
729
|
if (this.widgetRef) {
|
|
673
730
|
if (isSignal(this.widgetRef.instance.config)) {
|
|
674
731
|
this.widgetRef.setInput('config', this.widgetConfig());
|
|
@@ -931,15 +988,21 @@ class SiWidgetHostComponent {
|
|
|
931
988
|
}
|
|
932
989
|
});
|
|
933
990
|
}
|
|
934
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
935
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
991
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiWidgetHostComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
992
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: SiWidgetHostComponent, isStandalone: true, selector: "si-widget-host", inputs: { widgetConfig: { classPropertyName: "widgetConfig", publicName: "widgetConfig", isSignal: true, isRequired: true, transformFunction: null }, grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: false, transformFunction: null }, componentFactory: { classPropertyName: "componentFactory", publicName: "componentFactory", isSignal: true, isRequired: false, transformFunction: null }, editable: { classPropertyName: "editable", publicName: "editable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { remove: "remove", edit: "edit", gridEvent: "gridEvent" }, host: { properties: { "attr.role": "editable() ? null : 'listitem'", "attr.aria-roledescription": "editable() ? null : 'widget'", "attr.aria-label": "editable() || !widgetAriaLabel() ? null : widgetAriaLabel()" }, 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 [class.elevation-2]=\"keyboardActive()\"\n [class.si-widget-keyboard-active]=\"keyboardActive()\"\n [attr.tabindex]=\"editable() ? 0 : null\"\n [attr.role]=\"editable() ? 'application' : null\"\n [attr.aria-roledescription]=\"editable() ? 'widget' : null\"\n [attr.aria-label]=\"editable() ? widgetConfig().heading : null\"\n [attr.aria-description]=\"editable() ? (a11yWidgetDescription | translate) : null\"\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 (keydown.enter)=\"onToggleActive($event)\"\n (keydown.space)=\"onToggleActive($event)\"\n (keydown.escape)=\"onDeactivate($event)\"\n (keydown.arrowRight)=\"onArrowKey($event)\"\n (keydown.arrowLeft)=\"onArrowKey($event)\"\n (keydown.arrowUp)=\"onArrowKey($event)\"\n (keydown.arrowDown)=\"onArrowKey($event)\"\n (keydown.shift.arrowRight)=\"onArrowKey($event)\"\n (keydown.shift.arrowLeft)=\"onArrowKey($event)\"\n (keydown.shift.arrowUp)=\"onArrowKey($event)\"\n (keydown.shift.arrowDown)=\"onArrowKey($event)\"\n (focusout)=\"onFocusOut()\"\n >\n <div class=\"card-body overflow-auto\" body>\n <ng-container #widgetHost />\n </div>\n @let footer = widgetInstanceFooter();\n @if (footer) {\n <div class=\"card-footer\" footer>\n <ng-container *ngTemplateOutlet=\"footer\" />\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"] }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }] });
|
|
936
993
|
}
|
|
937
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
994
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiWidgetHostComponent, decorators: [{
|
|
938
995
|
type: Component,
|
|
939
|
-
args: [{ selector: 'si-widget-host', imports: [SiDashboardCardComponent, NgTemplateOutlet, SiTranslatePipe],
|
|
940
|
-
class: 'grid-stack-item'
|
|
996
|
+
args: [{ selector: 'si-widget-host', imports: [SiDashboardCardComponent, NgTemplateOutlet, SiTranslatePipe], host: {
|
|
997
|
+
class: 'grid-stack-item',
|
|
998
|
+
// In non-edit mode, expose each widget as a labeled list item so screen
|
|
999
|
+
// readers group the widgets and let users jump between them. In edit mode
|
|
1000
|
+
// the inner card carries the interactive `application` role instead.
|
|
1001
|
+
'[attr.role]': "editable() ? null : 'listitem'",
|
|
1002
|
+
'[attr.aria-roledescription]': "editable() ? null : 'widget'",
|
|
1003
|
+
'[attr.aria-label]': 'editable() || !widgetAriaLabel() ? null : widgetAriaLabel()'
|
|
941
1004
|
}, 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 [class.elevation-2]=\"keyboardActive()\"\n [class.si-widget-keyboard-active]=\"keyboardActive()\"\n [attr.tabindex]=\"editable() ? 0 : null\"\n [attr.role]=\"editable() ? 'application' : null\"\n [attr.aria-roledescription]=\"editable() ? 'widget' : null\"\n [attr.aria-label]=\"editable() ? widgetConfig().heading : null\"\n [attr.aria-description]=\"editable() ? (a11yWidgetDescription | translate) : null\"\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 (keydown.enter)=\"onToggleActive($event)\"\n (keydown.space)=\"onToggleActive($event)\"\n (keydown.escape)=\"onDeactivate($event)\"\n (keydown.arrowRight)=\"onArrowKey($event)\"\n (keydown.arrowLeft)=\"onArrowKey($event)\"\n (keydown.arrowUp)=\"onArrowKey($event)\"\n (keydown.arrowDown)=\"onArrowKey($event)\"\n (keydown.shift.arrowRight)=\"onArrowKey($event)\"\n (keydown.shift.arrowLeft)=\"onArrowKey($event)\"\n (keydown.shift.arrowUp)=\"onArrowKey($event)\"\n (keydown.shift.arrowDown)=\"onArrowKey($event)\"\n (focusout)=\"onFocusOut()\"\n >\n <div class=\"card-body overflow-auto\" body>\n <ng-container #widgetHost />\n </div>\n @let footer = widgetInstanceFooter();\n @if (footer) {\n <div class=\"card-footer\" footer>\n <ng-container *ngTemplateOutlet=\"footer\" />\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"] }]
|
|
942
|
-
}], propDecorators: { widgetConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgetConfig", required: true }] }], componentFactory: [{ type: i0.Input, args: [{ isSignal: true, alias: "componentFactory", required: false }] }], editable: [{ type: i0.Input, args: [{ isSignal: true, alias: "editable", required: false }] }], remove: [{ type: i0.Output, args: ["remove"] }], edit: [{ type: i0.Output, args: ["edit"] }], gridEvent: [{ type: i0.Output, args: ["gridEvent"] }], card: [{ type: i0.ViewChild, args: ['card', { isSignal: true }] }], widgetHost: [{ type: i0.ViewChild, args: ['widgetHost', { ...{ read: ViewContainerRef }, isSignal: true }] }] } });
|
|
1005
|
+
}], propDecorators: { widgetConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgetConfig", required: true }] }], grid: [{ type: i0.Input, args: [{ isSignal: true, alias: "grid", required: false }] }], componentFactory: [{ type: i0.Input, args: [{ isSignal: true, alias: "componentFactory", required: false }] }], editable: [{ type: i0.Input, args: [{ isSignal: true, alias: "editable", required: false }] }], remove: [{ type: i0.Output, args: ["remove"] }], edit: [{ type: i0.Output, args: ["edit"] }], gridEvent: [{ type: i0.Output, args: ["gridEvent"] }], card: [{ type: i0.ViewChild, args: ['card', { isSignal: true }] }], widgetHost: [{ type: i0.ViewChild, args: ['widgetHost', { ...{ read: ViewContainerRef }, isSignal: true }] }] } });
|
|
943
1006
|
|
|
944
1007
|
/**
|
|
945
1008
|
* Copyright (c) Siemens 2016 - 2026
|
|
@@ -951,23 +1014,27 @@ class SiGridstackWrapperComponent {
|
|
|
951
1014
|
*
|
|
952
1015
|
* @defaultValue []
|
|
953
1016
|
*/
|
|
954
|
-
widgetConfigs = input([],
|
|
1017
|
+
widgetConfigs = input([], /* @ts-ignore */
|
|
1018
|
+
...(ngDevMode ? [{ debugName: "widgetConfigs" }] : /* istanbul ignore next */ []));
|
|
955
1019
|
/**
|
|
956
1020
|
* Whenever gridstack allows to drag, resize or delete the grid item
|
|
957
1021
|
*
|
|
958
1022
|
* @defaultValue false
|
|
959
1023
|
*/
|
|
960
|
-
editable = input(false,
|
|
1024
|
+
editable = input(false, /* @ts-ignore */
|
|
1025
|
+
...(ngDevMode ? [{ debugName: "editable" }] : /* istanbul ignore next */ []));
|
|
961
1026
|
/**
|
|
962
1027
|
* Module configuration
|
|
963
1028
|
*/
|
|
964
|
-
gridConfig = input(
|
|
1029
|
+
gridConfig = input(/* @ts-ignore */
|
|
1030
|
+
...(ngDevMode ? [undefined, { debugName: "gridConfig" }] : /* istanbul ignore next */ []));
|
|
965
1031
|
/**
|
|
966
1032
|
* Map of widget id to widget definition, passed through to widget hosts.
|
|
967
1033
|
*
|
|
968
1034
|
* @defaultValue new Map()
|
|
969
1035
|
*/
|
|
970
|
-
widgetCatalogMap = input(new Map(),
|
|
1036
|
+
widgetCatalogMap = input(new Map(), /* @ts-ignore */
|
|
1037
|
+
...(ngDevMode ? [{ debugName: "widgetCatalogMap" }] : /* istanbul ignore next */ []));
|
|
971
1038
|
/**
|
|
972
1039
|
* Emits dashboard grid events.
|
|
973
1040
|
*/
|
|
@@ -980,39 +1047,38 @@ class SiGridstackWrapperComponent {
|
|
|
980
1047
|
* Emits the id of a widget instance that shall be edited.
|
|
981
1048
|
*/
|
|
982
1049
|
widgetInstanceEdit = output();
|
|
983
|
-
|
|
1050
|
+
widgetHosts = viewChildren(SiWidgetHostComponent, /* @ts-ignore */
|
|
1051
|
+
...(ngDevMode ? [{ debugName: "widgetHosts" }] : /* istanbul ignore next */ []));
|
|
1052
|
+
widgetHostsMap = computed(() => new Map(this.widgetHosts().map(host => [host.widgetConfig().id, host])), /* @ts-ignore */
|
|
1053
|
+
...(ngDevMode ? [{ debugName: "widgetHostsMap" }] : /* istanbul ignore next */ []));
|
|
1054
|
+
a11yWidgetsListLabel = t(() => $localize `:@@DASHBOARD.A11Y.WIDGETS_LIST:Dashboard widgets`);
|
|
984
1055
|
grid;
|
|
985
|
-
markedForRender = [];
|
|
986
|
-
gridItems = signal([], ...(ngDevMode ? [{ debugName: "gridItems" }] : []));
|
|
987
|
-
gridItemsMap = computed(() => new Map(this.gridItems().map(item => [item.id, item])), ...(ngDevMode ? [{ debugName: "gridItemsMap" }] : []));
|
|
988
|
-
itemIdAttr = 'item-id';
|
|
989
1056
|
ngZone = inject(NgZone);
|
|
990
1057
|
elementRef = inject(ElementRef);
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
1058
|
+
injector = inject(Injector);
|
|
1059
|
+
platformId = inject(PLATFORM_ID);
|
|
1060
|
+
isBrowser = isPlatformBrowser(this.platformId);
|
|
1061
|
+
destroyRef = inject(DestroyRef);
|
|
994
1062
|
ngOnChanges(changes) {
|
|
995
|
-
if (changes.widgetConfigs) {
|
|
996
|
-
const
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
.create((_, item) => item.id);
|
|
1063
|
+
if (changes.widgetConfigs && !changes.widgetConfigs.firstChange) {
|
|
1064
|
+
const configs = changes.widgetConfigs.currentValue;
|
|
1065
|
+
const newIds = new Set(configs.map(w => w.id));
|
|
1066
|
+
const hostMap = this.widgetHostsMap();
|
|
1067
|
+
const hasAdds = configs.some(w => !hostMap.has(w.id));
|
|
1068
|
+
if (hasAdds) {
|
|
1069
|
+
this.startBatch();
|
|
1003
1070
|
}
|
|
1004
|
-
|
|
1005
|
-
|
|
1071
|
+
if (this.isBrowser) {
|
|
1072
|
+
for (const [id, host] of hostMap) {
|
|
1073
|
+
if (!newIds.has(id)) {
|
|
1074
|
+
this.grid?.removeWidget(host.elementRef);
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1006
1077
|
}
|
|
1007
|
-
this.updateLayout(currentValue);
|
|
1008
|
-
this.grid?.batchUpdate(false);
|
|
1009
1078
|
}
|
|
1010
|
-
if (changes.editable) {
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
this.grid.enableMove(currentValue);
|
|
1014
|
-
this.grid.enableResize(currentValue);
|
|
1015
|
-
}
|
|
1079
|
+
if (changes.editable && !changes.editable.firstChange) {
|
|
1080
|
+
this.grid?.enableMove(changes.editable.currentValue);
|
|
1081
|
+
this.grid?.enableResize(changes.editable.currentValue);
|
|
1016
1082
|
}
|
|
1017
1083
|
}
|
|
1018
1084
|
ngOnInit() {
|
|
@@ -1026,35 +1092,25 @@ class SiGridstackWrapperComponent {
|
|
|
1026
1092
|
...initialViewMode
|
|
1027
1093
|
};
|
|
1028
1094
|
this.grid = GridStack.init(options, this.elementRef.nativeElement.firstChild);
|
|
1095
|
+
this.startBatch();
|
|
1029
1096
|
this.hookEvents(this.grid);
|
|
1030
|
-
this.
|
|
1031
|
-
// Run initial diff to prime the differ with the current state
|
|
1032
|
-
this.widgetConfigsDiffer?.diff(this.markedForRender);
|
|
1033
|
-
}
|
|
1034
|
-
mount(items) {
|
|
1035
|
-
if (items.length > 0) {
|
|
1036
|
-
items.forEach(item => {
|
|
1037
|
-
this.addToView(item);
|
|
1038
|
-
});
|
|
1039
|
-
}
|
|
1097
|
+
this.destroyRef.onDestroy(() => this.grid?.destroy());
|
|
1040
1098
|
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
});
|
|
1046
|
-
}
|
|
1099
|
+
startBatch() {
|
|
1100
|
+
this.grid?.batchUpdate(true);
|
|
1101
|
+
// this ensures that si-widget-host components are rendered before turning off batch mode.
|
|
1102
|
+
afterNextRender(() => this.grid?.batchUpdate(false), { injector: this.injector });
|
|
1047
1103
|
}
|
|
1048
1104
|
/**
|
|
1049
1105
|
*
|
|
1050
1106
|
* Returns the position of a specific widget in the grid.
|
|
1051
1107
|
*/
|
|
1052
1108
|
getWidgetLayout(widgetId) {
|
|
1053
|
-
const gridItem = this.
|
|
1109
|
+
const gridItem = this.widgetHostsMap().get(widgetId);
|
|
1054
1110
|
if (!gridItem) {
|
|
1055
1111
|
return undefined;
|
|
1056
1112
|
}
|
|
1057
|
-
const element = gridItem.
|
|
1113
|
+
const element = gridItem.elementRef;
|
|
1058
1114
|
return {
|
|
1059
1115
|
id: widgetId,
|
|
1060
1116
|
x: Number(element.getAttribute('gs-x')) || 0,
|
|
@@ -1063,83 +1119,6 @@ class SiGridstackWrapperComponent {
|
|
|
1063
1119
|
height: Number(element.getAttribute('gs-h')) || 0
|
|
1064
1120
|
};
|
|
1065
1121
|
}
|
|
1066
|
-
updateLayout(widgets) {
|
|
1067
|
-
const widgetConfigMap = new Map(widgets.map(w => [w.id, { ...w, w: w.width, h: w.height }]));
|
|
1068
|
-
if (this.grid) {
|
|
1069
|
-
const gridItems = this.grid.getGridItems();
|
|
1070
|
-
gridItems.forEach(gridItem => {
|
|
1071
|
-
const itemId = gridItem.getAttribute('item-id');
|
|
1072
|
-
const config = widgetConfigMap.get(itemId);
|
|
1073
|
-
if (config) {
|
|
1074
|
-
this.grid.update(gridItem, config);
|
|
1075
|
-
}
|
|
1076
|
-
});
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1079
|
-
addToView(item) {
|
|
1080
|
-
const configSignal = signal(item, ...(ngDevMode ? [{ debugName: "configSignal" }] : []));
|
|
1081
|
-
this.widgetConfigSignals.set(item.id, configSignal);
|
|
1082
|
-
const componentFactory = computed(() => this.widgetCatalogMap().get(item.widgetId)?.componentFactory, ...(ngDevMode ? [{ debugName: "componentFactory" }] : []));
|
|
1083
|
-
const componentRef = this.gridstackContainer().createComponent(SiWidgetHostComponent, {
|
|
1084
|
-
bindings: [
|
|
1085
|
-
inputBinding('widgetConfig', configSignal),
|
|
1086
|
-
inputBinding('editable', this.editable),
|
|
1087
|
-
inputBinding('componentFactory', componentFactory),
|
|
1088
|
-
outputBinding('remove', widgetId => {
|
|
1089
|
-
this.widgetInstanceRemove.emit(widgetId);
|
|
1090
|
-
}),
|
|
1091
|
-
outputBinding('edit', widgetConfig => {
|
|
1092
|
-
this.widgetInstanceEdit.emit(widgetConfig);
|
|
1093
|
-
}),
|
|
1094
|
-
outputBinding('gridEvent', event => {
|
|
1095
|
-
this.gridEvent.emit({ event, grid: this.grid });
|
|
1096
|
-
})
|
|
1097
|
-
]
|
|
1098
|
-
});
|
|
1099
|
-
const element = componentRef.location.nativeElement;
|
|
1100
|
-
element.setAttribute(this.itemIdAttr, item.id);
|
|
1101
|
-
this.gridItems.update(items => [...items, { id: item.id, component: componentRef }]);
|
|
1102
|
-
this.grid.makeWidget(element, {
|
|
1103
|
-
w: item.width,
|
|
1104
|
-
h: item.height,
|
|
1105
|
-
x: item.x,
|
|
1106
|
-
y: item.y,
|
|
1107
|
-
minW: item.minWidth,
|
|
1108
|
-
minH: item.minHeight
|
|
1109
|
-
});
|
|
1110
|
-
}
|
|
1111
|
-
removeFromView(widgetId) {
|
|
1112
|
-
const gridItemElements = this.grid.getGridItems();
|
|
1113
|
-
const toRemove = gridItemElements.find((el) => el.getAttribute(this.itemIdAttr) === widgetId);
|
|
1114
|
-
if (toRemove) {
|
|
1115
|
-
this.grid.removeWidget(toRemove);
|
|
1116
|
-
const gridItemToRemove = this.gridItemsMap().get(widgetId);
|
|
1117
|
-
gridItemToRemove?.component.destroy();
|
|
1118
|
-
this.widgetConfigSignals.delete(widgetId);
|
|
1119
|
-
this.gridItemsMap().delete(widgetId);
|
|
1120
|
-
this.gridItems.set(Array.from(this.gridItemsMap().values()));
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
1123
|
-
/**
|
|
1124
|
-
* Uses IterableDiffer to detect added, removed, and identity-changed items.
|
|
1125
|
-
* Only widgets whose object reference changed get their signal updated.
|
|
1126
|
-
*/
|
|
1127
|
-
diffWidgetConfigs(configs) {
|
|
1128
|
-
const changes = this.widgetConfigsDiffer?.diff(configs);
|
|
1129
|
-
if (changes) {
|
|
1130
|
-
const toMount = [];
|
|
1131
|
-
const toUnmount = [];
|
|
1132
|
-
changes.forEachAddedItem(record => toMount.push(record.item));
|
|
1133
|
-
changes.forEachRemovedItem(record => toUnmount.push(record.item));
|
|
1134
|
-
changes.forEachIdentityChange(record => this.widgetConfigSignals.get(record.item.id)?.set(record.item));
|
|
1135
|
-
if (toMount.length) {
|
|
1136
|
-
this.mount(toMount);
|
|
1137
|
-
}
|
|
1138
|
-
if (toUnmount.length) {
|
|
1139
|
-
this.unmount(toUnmount);
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
1122
|
hookEvents(grid) {
|
|
1144
1123
|
grid.on('added removed dragstop resizestop disable enable dropped resize resizestart drag dragstart change', (event) => {
|
|
1145
1124
|
this.ngZone.run(() => {
|
|
@@ -1150,13 +1129,13 @@ class SiGridstackWrapperComponent {
|
|
|
1150
1129
|
});
|
|
1151
1130
|
});
|
|
1152
1131
|
}
|
|
1153
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1154
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
1132
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiGridstackWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1133
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: SiGridstackWrapperComponent, isStandalone: true, selector: "si-gridstack-wrapper", inputs: { widgetConfigs: { classPropertyName: "widgetConfigs", publicName: "widgetConfigs", isSignal: true, isRequired: false, transformFunction: null }, editable: { classPropertyName: "editable", publicName: "editable", isSignal: true, isRequired: false, transformFunction: null }, gridConfig: { classPropertyName: "gridConfig", publicName: "gridConfig", isSignal: true, isRequired: false, transformFunction: null }, widgetCatalogMap: { classPropertyName: "widgetCatalogMap", publicName: "widgetCatalogMap", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { gridEvent: "gridEvent", widgetInstanceRemove: "widgetInstanceRemove", widgetInstanceEdit: "widgetInstanceEdit" }, viewQueries: [{ propertyName: "widgetHosts", predicate: SiWidgetHostComponent, descendants: true, isSignal: true }], usesOnChanges: true, ngImport: i0, template: "<div\n class=\"grid-stack\"\n [attr.role]=\"editable() ? null : 'list'\"\n [attr.aria-label]=\"editable() ? null : (a11yWidgetsListLabel | translate)\"\n>\n @if (grid) {\n @for (item of widgetConfigs(); track item.id) {\n <si-widget-host\n [grid]=\"grid\"\n [editable]=\"editable()\"\n [widgetConfig]=\"item\"\n [componentFactory]=\"widgetCatalogMap().get(item.widgetId)?.componentFactory\"\n (remove)=\"widgetInstanceRemove.emit(item.id)\"\n (edit)=\"widgetInstanceEdit.emit(item)\"\n />\n }\n }\n</div>\n", styles: ["::ng-deep .si-grid-stack-placeholder{background-color:var(--element-base-information);opacity:.3}:host{display:flex;flex:1 1 0;flex-direction:column;margin-inline-start:-8px;margin-inline-end:-8px;margin-block-start:-8px}.grid-stack{display:block}\n"], dependencies: [{ kind: "component", type: SiWidgetHostComponent, selector: "si-widget-host", inputs: ["widgetConfig", "grid", "componentFactory", "editable"], outputs: ["remove", "edit", "gridEvent"] }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }] });
|
|
1155
1134
|
}
|
|
1156
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1135
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiGridstackWrapperComponent, decorators: [{
|
|
1157
1136
|
type: Component,
|
|
1158
|
-
args: [{ selector: 'si-gridstack-wrapper',
|
|
1159
|
-
}], propDecorators: { widgetConfigs: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgetConfigs", required: false }] }], editable: [{ type: i0.Input, args: [{ isSignal: true, alias: "editable", required: false }] }], gridConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "gridConfig", required: false }] }], widgetCatalogMap: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgetCatalogMap", required: false }] }], gridEvent: [{ type: i0.Output, args: ["gridEvent"] }], widgetInstanceRemove: [{ type: i0.Output, args: ["widgetInstanceRemove"] }], widgetInstanceEdit: [{ type: i0.Output, args: ["widgetInstanceEdit"] }],
|
|
1137
|
+
args: [{ selector: 'si-gridstack-wrapper', imports: [SiWidgetHostComponent, SiTranslatePipe], template: "<div\n class=\"grid-stack\"\n [attr.role]=\"editable() ? null : 'list'\"\n [attr.aria-label]=\"editable() ? null : (a11yWidgetsListLabel | translate)\"\n>\n @if (grid) {\n @for (item of widgetConfigs(); track item.id) {\n <si-widget-host\n [grid]=\"grid\"\n [editable]=\"editable()\"\n [widgetConfig]=\"item\"\n [componentFactory]=\"widgetCatalogMap().get(item.widgetId)?.componentFactory\"\n (remove)=\"widgetInstanceRemove.emit(item.id)\"\n (edit)=\"widgetInstanceEdit.emit(item)\"\n />\n }\n }\n</div>\n", styles: ["::ng-deep .si-grid-stack-placeholder{background-color:var(--element-base-information);opacity:.3}:host{display:flex;flex:1 1 0;flex-direction:column;margin-inline-start:-8px;margin-inline-end:-8px;margin-block-start:-8px}.grid-stack{display:block}\n"] }]
|
|
1138
|
+
}], propDecorators: { widgetConfigs: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgetConfigs", required: false }] }], editable: [{ type: i0.Input, args: [{ isSignal: true, alias: "editable", required: false }] }], gridConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "gridConfig", required: false }] }], widgetCatalogMap: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgetCatalogMap", required: false }] }], gridEvent: [{ type: i0.Output, args: ["gridEvent"] }], widgetInstanceRemove: [{ type: i0.Output, args: ["widgetInstanceRemove"] }], widgetInstanceEdit: [{ type: i0.Output, args: ["widgetInstanceEdit"] }], widgetHosts: [{ type: i0.ViewChildren, args: [i0.forwardRef(() => SiWidgetHostComponent), { isSignal: true }] }] } });
|
|
1160
1139
|
|
|
1161
1140
|
/**
|
|
1162
1141
|
* Copyright (c) Siemens 2016 - 2026
|
|
@@ -1169,10 +1148,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
|
|
|
1169
1148
|
*/
|
|
1170
1149
|
class SiWidgetEditorBase {
|
|
1171
1150
|
/** Indicates if the current config is valid or not. */
|
|
1172
|
-
invalidConfig = signal(false,
|
|
1151
|
+
invalidConfig = signal(false, /* @ts-ignore */
|
|
1152
|
+
...(ngDevMode ? [{ debugName: "invalidConfig" }] : /* istanbul ignore next */ []));
|
|
1173
1153
|
/** Marks the widget configuration as modified. */
|
|
1174
|
-
widgetConfigModified = signal(false,
|
|
1175
|
-
|
|
1154
|
+
widgetConfigModified = signal(false, /* @ts-ignore */
|
|
1155
|
+
...(ngDevMode ? [{ debugName: "widgetConfigModified" }] : /* istanbul ignore next */ []));
|
|
1156
|
+
editorWizardState = signal(undefined, /* @ts-ignore */
|
|
1157
|
+
...(ngDevMode ? [{ debugName: "editorWizardState" }] : /* istanbul ignore next */ []));
|
|
1176
1158
|
widgetInstanceEditor;
|
|
1177
1159
|
subscriptions = [];
|
|
1178
1160
|
editorHost = viewChild.required('editorHost', { read: ViewContainerRef });
|
|
@@ -1228,10 +1210,10 @@ class SiWidgetEditorBase {
|
|
|
1228
1210
|
this.widgetConfigModified.set(statusChanges.modified);
|
|
1229
1211
|
}
|
|
1230
1212
|
}
|
|
1231
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1232
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "
|
|
1213
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiWidgetEditorBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1214
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "22.0.5", type: SiWidgetEditorBase, isStandalone: true, viewQueries: [{ propertyName: "editorHost", first: true, predicate: ["editorHost"], descendants: true, read: ViewContainerRef, isSignal: true }], ngImport: i0 });
|
|
1233
1215
|
}
|
|
1234
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1216
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiWidgetEditorBase, decorators: [{
|
|
1235
1217
|
type: Directive
|
|
1236
1218
|
}], propDecorators: { editorHost: [{ type: i0.ViewChild, args: ['editorHost', { ...{ read: ViewContainerRef }, isSignal: true }] }] } });
|
|
1237
1219
|
|
|
@@ -1250,12 +1232,14 @@ class SiWidgetInstanceEditorDialogComponent extends SiWidgetEditorBase {
|
|
|
1250
1232
|
* Input for the widget instance configuration. It is used to populate the
|
|
1251
1233
|
* widget editor.
|
|
1252
1234
|
*/
|
|
1253
|
-
widgetConfig = model.required(
|
|
1235
|
+
widgetConfig = model.required(/* @ts-ignore */
|
|
1236
|
+
...(ngDevMode ? [{ debugName: "widgetConfig" }] : /* istanbul ignore next */ []));
|
|
1254
1237
|
/**
|
|
1255
1238
|
* Input for the widget definition. It is required to retrieve the component
|
|
1256
1239
|
* factory to instantiate the widget editor.
|
|
1257
1240
|
*/
|
|
1258
|
-
widget = input.required(
|
|
1241
|
+
widget = input.required(/* @ts-ignore */
|
|
1242
|
+
...(ngDevMode ? [{ debugName: "widget" }] : /* istanbul ignore next */ []));
|
|
1259
1243
|
/**
|
|
1260
1244
|
* Emits the edited widget instance configuration if the user confirms by
|
|
1261
1245
|
* saving, or `undefined` if the user cancels the dialog.
|
|
@@ -1265,7 +1249,8 @@ class SiWidgetInstanceEditorDialogComponent extends SiWidgetEditorBase {
|
|
|
1265
1249
|
* Emits when the editor instantiation is completed.
|
|
1266
1250
|
*/
|
|
1267
1251
|
editorSetupCompleted = output();
|
|
1268
|
-
showNextButton = computed(() => this.editorWizardState() !== undefined ? true : false,
|
|
1252
|
+
showNextButton = computed(() => this.editorWizardState() !== undefined ? true : false, /* @ts-ignore */
|
|
1253
|
+
...(ngDevMode ? [{ debugName: "showNextButton" }] : /* istanbul ignore next */ []));
|
|
1269
1254
|
disableNextButton = computed(() => {
|
|
1270
1255
|
const wizardState = this.editorWizardState();
|
|
1271
1256
|
if (!wizardState) {
|
|
@@ -1280,12 +1265,15 @@ class SiWidgetInstanceEditorDialogComponent extends SiWidgetEditorBase {
|
|
|
1280
1265
|
else {
|
|
1281
1266
|
return false;
|
|
1282
1267
|
}
|
|
1283
|
-
},
|
|
1284
|
-
|
|
1268
|
+
}, /* @ts-ignore */
|
|
1269
|
+
...(ngDevMode ? [{ debugName: "disableNextButton" }] : /* istanbul ignore next */ []));
|
|
1270
|
+
showPreviousButton = computed(() => !!this.editorWizardState(), /* @ts-ignore */
|
|
1271
|
+
...(ngDevMode ? [{ debugName: "showPreviousButton" }] : /* istanbul ignore next */ []));
|
|
1285
1272
|
disablePreviousButton = computed(() => {
|
|
1286
1273
|
const wizardState = this.editorWizardState();
|
|
1287
1274
|
return wizardState ? !wizardState.hasPrevious : true;
|
|
1288
|
-
},
|
|
1275
|
+
}, /* @ts-ignore */
|
|
1276
|
+
...(ngDevMode ? [{ debugName: "disablePreviousButton" }] : /* istanbul ignore next */ []));
|
|
1289
1277
|
labelSave = t(() => $localize `:@@DASHBOARD.WIDGET_EDITOR_DIALOG.SAVE:Save`);
|
|
1290
1278
|
labelCancel = t(() => $localize `:@@DASHBOARD.WIDGET_EDITOR_DIALOG.CANCEL:Cancel`);
|
|
1291
1279
|
labelPrevious = t(() => $localize `:@@DASHBOARD.WIDGET_EDITOR_DIALOG.PREVIOUS:Previous`);
|
|
@@ -1355,12 +1343,12 @@ class SiWidgetInstanceEditorDialogComponent extends SiWidgetEditorBase {
|
|
|
1355
1343
|
}
|
|
1356
1344
|
this.closed.emit(this.widgetConfig());
|
|
1357
1345
|
}
|
|
1358
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1359
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
1346
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiWidgetInstanceEditorDialogComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1347
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: SiWidgetInstanceEditorDialogComponent, isStandalone: true, selector: "si-widget-instance-editor-dialog", inputs: { widgetConfig: { classPropertyName: "widgetConfig", publicName: "widgetConfig", isSignal: true, isRequired: true, transformFunction: null }, widget: { classPropertyName: "widget", publicName: "widget", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { widgetConfig: "widgetConfigChange", closed: "closed", editorSetupCompleted: "editorSetupCompleted" }, usesInheritance: true, ngImport: i0, template: "<div class=\"si-layout-fixed-height mb-8 mx-0 overflow-auto px-2 pt-2\">\n <ng-container #editorHost />\n</div>\n\n<div class=\"editor-footer px-2\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"onCancel()\">{{\n labelCancel | translate\n }}</button>\n\n @if (showPreviousButton()) {\n <button\n type=\"button\"\n class=\"btn btn-secondary\"\n [disabled]=\"disablePreviousButton()\"\n (click)=\"onPrevious()\"\n >{{ labelPrevious | translate }}</button\n >\n }\n @if (showNextButton()) {\n <button\n type=\"button\"\n class=\"btn btn-secondary\"\n [disabled]=\"disableNextButton()\"\n (click)=\"onNext()\"\n >{{ labelNext | translate }}</button\n >\n }\n\n <button type=\"button\" class=\"btn btn-primary\" [disabled]=\"invalidConfig()\" (click)=\"onSave()\">{{\n labelSave | translate\n }}</button>\n</div>\n", styles: [":host{display:flex;flex:1 1 0;flex-direction:column;margin-inline:-4px;margin-block-start:-4px}.editor-footer{align-items:center;display:flex;flex-shrink:0;flex-wrap:wrap;justify-content:flex-end}.editor-footer>*{margin-inline-start:16px}\n"], dependencies: [{ kind: "pipe", type: SiTranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
1360
1348
|
}
|
|
1361
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1349
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiWidgetInstanceEditorDialogComponent, decorators: [{
|
|
1362
1350
|
type: Component,
|
|
1363
|
-
args: [{ selector: 'si-widget-instance-editor-dialog', imports: [SiTranslatePipe], changeDetection: ChangeDetectionStrategy.
|
|
1351
|
+
args: [{ selector: 'si-widget-instance-editor-dialog', imports: [SiTranslatePipe], changeDetection: ChangeDetectionStrategy.Eager, template: "<div class=\"si-layout-fixed-height mb-8 mx-0 overflow-auto px-2 pt-2\">\n <ng-container #editorHost />\n</div>\n\n<div class=\"editor-footer px-2\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"onCancel()\">{{\n labelCancel | translate\n }}</button>\n\n @if (showPreviousButton()) {\n <button\n type=\"button\"\n class=\"btn btn-secondary\"\n [disabled]=\"disablePreviousButton()\"\n (click)=\"onPrevious()\"\n >{{ labelPrevious | translate }}</button\n >\n }\n @if (showNextButton()) {\n <button\n type=\"button\"\n class=\"btn btn-secondary\"\n [disabled]=\"disableNextButton()\"\n (click)=\"onNext()\"\n >{{ labelNext | translate }}</button\n >\n }\n\n <button type=\"button\" class=\"btn btn-primary\" [disabled]=\"invalidConfig()\" (click)=\"onSave()\">{{\n labelSave | translate\n }}</button>\n</div>\n", styles: [":host{display:flex;flex:1 1 0;flex-direction:column;margin-inline:-4px;margin-block-start:-4px}.editor-footer{align-items:center;display:flex;flex-shrink:0;flex-wrap:wrap;justify-content:flex-end}.editor-footer>*{margin-inline-start:16px}\n"] }]
|
|
1364
1352
|
}], propDecorators: { widgetConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgetConfig", required: true }] }, { type: i0.Output, args: ["widgetConfigChange"] }], widget: [{ type: i0.Input, args: [{ isSignal: true, alias: "widget", required: true }] }], closed: [{ type: i0.Output, args: ["closed"] }], editorSetupCompleted: [{ type: i0.Output, args: ["editorSetupCompleted"] }] } });
|
|
1365
1353
|
|
|
1366
1354
|
/**
|
|
@@ -1382,27 +1370,32 @@ class SiGridComponent {
|
|
|
1382
1370
|
*
|
|
1383
1371
|
* @defaultValue inject(SI_DASHBOARD_CONFIGURATION)?.grid
|
|
1384
1372
|
*/
|
|
1385
|
-
gridConfig = input(inject(SI_DASHBOARD_CONFIGURATION)?.grid,
|
|
1373
|
+
gridConfig = input(inject(SI_DASHBOARD_CONFIGURATION)?.grid, /* @ts-ignore */
|
|
1374
|
+
...(ngDevMode ? [{ debugName: "gridConfig" }] : /* istanbul ignore next */ []));
|
|
1386
1375
|
/**
|
|
1387
1376
|
* Sets the grid into editable mode, in which the widget instances can be moved,
|
|
1388
1377
|
* resized, removed or new ones added.
|
|
1389
1378
|
*
|
|
1390
1379
|
* @defaultValue false
|
|
1391
1380
|
*/
|
|
1392
|
-
editable = model(false,
|
|
1381
|
+
editable = model(false, /* @ts-ignore */
|
|
1382
|
+
...(ngDevMode ? [{ debugName: "editable" }] : /* istanbul ignore next */ []));
|
|
1393
1383
|
/**
|
|
1394
1384
|
* An optional, but recommended dashboard id that is used in persistence and passed
|
|
1395
1385
|
* to the widget store for saving and loading data.
|
|
1396
1386
|
*/
|
|
1397
|
-
dashboardId = input(
|
|
1387
|
+
dashboardId = input(/* @ts-ignore */
|
|
1388
|
+
...(ngDevMode ? [undefined, { debugName: "dashboardId" }] : /* istanbul ignore next */ []));
|
|
1398
1389
|
/**
|
|
1399
1390
|
* Provides the available widgets to the grid. When loading the widget configurations from
|
|
1400
1391
|
* the storage, we need to have the widget definition available to be able to create the widget
|
|
1401
1392
|
* instances on the grid.
|
|
1402
1393
|
*
|
|
1403
1394
|
* @defaultValue [] */
|
|
1404
|
-
widgetCatalog = input([],
|
|
1405
|
-
|
|
1395
|
+
widgetCatalog = input([], /* @ts-ignore */
|
|
1396
|
+
...(ngDevMode ? [{ debugName: "widgetCatalog" }] : /* istanbul ignore next */ []));
|
|
1397
|
+
widgetCatalogMap = computed(() => new Map(this.widgetCatalog().map(widget => [widget.id, widget])), /* @ts-ignore */
|
|
1398
|
+
...(ngDevMode ? [{ debugName: "widgetCatalogMap" }] : /* istanbul ignore next */ []));
|
|
1406
1399
|
/**
|
|
1407
1400
|
* When the user clicks edit on a widget instance, an editor need to appear and the
|
|
1408
1401
|
* widget editor component need to be loaded. When the grid is used standalone, it
|
|
@@ -1413,18 +1406,21 @@ class SiGridComponent {
|
|
|
1413
1406
|
* widget `edit` action.
|
|
1414
1407
|
*
|
|
1415
1408
|
* @defaultValue false */
|
|
1416
|
-
emitWidgetInstanceEditEvents = input(false,
|
|
1409
|
+
emitWidgetInstanceEditEvents = input(false, /* @ts-ignore */
|
|
1410
|
+
...(ngDevMode ? [{ debugName: "emitWidgetInstanceEditEvents" }] : /* istanbul ignore next */ []));
|
|
1417
1411
|
/**
|
|
1418
1412
|
* Option to turn off the loading spinner on save and load operations.
|
|
1419
1413
|
*
|
|
1420
1414
|
* @defaultValue false
|
|
1421
1415
|
*/
|
|
1422
|
-
hideProgressIndicator = input(false,
|
|
1416
|
+
hideProgressIndicator = input(false, /* @ts-ignore */
|
|
1417
|
+
...(ngDevMode ? [{ debugName: "hideProgressIndicator" }] : /* istanbul ignore next */ []));
|
|
1423
1418
|
/**
|
|
1424
1419
|
* Option to configure a custom widget instance editor dialog component. The component provides the
|
|
1425
1420
|
* editor hosting and the buttons to save and cancel.
|
|
1426
1421
|
*/
|
|
1427
|
-
widgetInstanceEditorDialogComponent = input(
|
|
1422
|
+
widgetInstanceEditorDialogComponent = input(/* @ts-ignore */
|
|
1423
|
+
...(ngDevMode ? [undefined, { debugName: "widgetInstanceEditorDialogComponent" }] : /* istanbul ignore next */ []));
|
|
1428
1424
|
/**
|
|
1429
1425
|
* Emits the modification state of the grid. It is `unmodified` when the visible state
|
|
1430
1426
|
* is equal to the loaded state from the widget storage. When the user modifies the dashboard by
|
|
@@ -1721,12 +1717,12 @@ class SiGridComponent {
|
|
|
1721
1717
|
this.isModified.emit(this.modified);
|
|
1722
1718
|
}
|
|
1723
1719
|
}
|
|
1724
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1725
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
1720
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiGridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1721
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: SiGridComponent, isStandalone: true, selector: "si-grid", inputs: { gridConfig: { classPropertyName: "gridConfig", publicName: "gridConfig", isSignal: true, isRequired: false, transformFunction: null }, editable: { classPropertyName: "editable", publicName: "editable", 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 }, emitWidgetInstanceEditEvents: { classPropertyName: "emitWidgetInstanceEditEvents", publicName: "emitWidgetInstanceEditEvents", isSignal: true, isRequired: false, transformFunction: null }, hideProgressIndicator: { classPropertyName: "hideProgressIndicator", publicName: "hideProgressIndicator", isSignal: true, isRequired: false, transformFunction: null }, widgetInstanceEditorDialogComponent: { classPropertyName: "widgetInstanceEditorDialogComponent", publicName: "widgetInstanceEditorDialogComponent", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { editable: "editableChange", isModified: "isModified", widgetInstanceEdit: "widgetInstanceEdit" }, viewQueries: [{ propertyName: "gridStackWrapper", first: true, predicate: SiGridstackWrapperComponent, descendants: true, isSignal: true }], usesOnChanges: true, ngImport: i0, template: "@if (showEmptyState) {\n <ng-content select=\"[empty-state]\" />\n}\n<si-gridstack-wrapper\n [widgetConfigs]=\"(visibleWidgetInstances$ | async) ?? []\"\n [gridConfig]=\"gridConfig()\"\n [editable]=\"editable()\"\n [widgetCatalogMap]=\"widgetCatalogMap()\"\n [siLoading]=\"!hideProgressIndicator() && initialLoad && (isLoading | async)!\"\n [blocking]=\"false\"\n (gridEvent)=\"handleGridEvent($event)\"\n (widgetInstanceRemove)=\"removeWidgetInstance($event)\"\n (widgetInstanceEdit)=\"editWidgetInstance($event)\"\n/>\n", styles: [":host{display:flex;flex:1 1 0;flex-direction:column}::ng-deep .grid-stack-animate,::ng-deep .grid-stack-animate .grid-stack-item{transition-property:inset-inline-start,inset-block-start}\n"], dependencies: [{ kind: "component", type: SiGridstackWrapperComponent, selector: "si-gridstack-wrapper", inputs: ["widgetConfigs", "editable", "gridConfig", "widgetCatalogMap"], outputs: ["gridEvent", "widgetInstanceRemove", "widgetInstanceEdit"] }, { kind: "directive", type: SiLoadingSpinnerDirective, selector: "[siLoading]", inputs: ["siLoading", "blocking", "initialDelay"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
1726
1722
|
}
|
|
1727
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1723
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiGridComponent, decorators: [{
|
|
1728
1724
|
type: Component,
|
|
1729
|
-
args: [{ selector: 'si-grid', imports: [SiGridstackWrapperComponent, SiLoadingSpinnerDirective, AsyncPipe], changeDetection: ChangeDetectionStrategy.
|
|
1725
|
+
args: [{ selector: 'si-grid', imports: [SiGridstackWrapperComponent, SiLoadingSpinnerDirective, AsyncPipe], changeDetection: ChangeDetectionStrategy.Eager, template: "@if (showEmptyState) {\n <ng-content select=\"[empty-state]\" />\n}\n<si-gridstack-wrapper\n [widgetConfigs]=\"(visibleWidgetInstances$ | async) ?? []\"\n [gridConfig]=\"gridConfig()\"\n [editable]=\"editable()\"\n [widgetCatalogMap]=\"widgetCatalogMap()\"\n [siLoading]=\"!hideProgressIndicator() && initialLoad && (isLoading | async)!\"\n [blocking]=\"false\"\n (gridEvent)=\"handleGridEvent($event)\"\n (widgetInstanceRemove)=\"removeWidgetInstance($event)\"\n (widgetInstanceEdit)=\"editWidgetInstance($event)\"\n/>\n", styles: [":host{display:flex;flex:1 1 0;flex-direction:column}::ng-deep .grid-stack-animate,::ng-deep .grid-stack-animate .grid-stack-item{transition-property:inset-inline-start,inset-block-start}\n"] }]
|
|
1730
1726
|
}], propDecorators: { gridConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "gridConfig", required: false }] }], editable: [{ type: i0.Input, args: [{ isSignal: true, alias: "editable", required: false }] }, { type: i0.Output, args: ["editableChange"] }], dashboardId: [{ type: i0.Input, args: [{ isSignal: true, alias: "dashboardId", required: false }] }], widgetCatalog: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgetCatalog", required: false }] }], emitWidgetInstanceEditEvents: [{ type: i0.Input, args: [{ isSignal: true, alias: "emitWidgetInstanceEditEvents", required: false }] }], hideProgressIndicator: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideProgressIndicator", required: false }] }], widgetInstanceEditorDialogComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgetInstanceEditorDialogComponent", required: false }] }], isModified: [{ type: i0.Output, args: ["isModified"] }], widgetInstanceEdit: [{ type: i0.Output, args: ["widgetInstanceEdit"] }], gridStackWrapper: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SiGridstackWrapperComponent), { isSignal: true }] }] } });
|
|
1731
1727
|
|
|
1732
1728
|
/**
|
|
@@ -1766,7 +1762,8 @@ class SiWidgetCatalogComponent extends SiWidgetEditorBase {
|
|
|
1766
1762
|
* t(() => $localize`:@@DASHBOARD.WIDGET_LIBRARY.SEARCH_PLACEHOLDER:Search widget`)
|
|
1767
1763
|
* ```
|
|
1768
1764
|
*/
|
|
1769
|
-
searchPlaceholder = input(t(() => $localize `:@@DASHBOARD.WIDGET_LIBRARY.SEARCH_PLACEHOLDER:Search widget`),
|
|
1765
|
+
searchPlaceholder = input(t(() => $localize `:@@DASHBOARD.WIDGET_LIBRARY.SEARCH_PLACEHOLDER:Search widget`), /* @ts-ignore */
|
|
1766
|
+
...(ngDevMode ? [{ debugName: "searchPlaceholder" }] : /* istanbul ignore next */ []));
|
|
1770
1767
|
/**
|
|
1771
1768
|
* Emits when the catalog is `closed`, either by canceling or by adding or saving
|
|
1772
1769
|
* a widget configuration. On cancel `undefined` is emitted, otherwise the related
|
|
@@ -1779,7 +1776,8 @@ class SiWidgetCatalogComponent extends SiWidgetEditorBase {
|
|
|
1779
1776
|
* @internal
|
|
1780
1777
|
* @defaultValue 'list'
|
|
1781
1778
|
*/
|
|
1782
|
-
view = signal('list',
|
|
1779
|
+
view = signal('list', /* @ts-ignore */
|
|
1780
|
+
...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
|
|
1783
1781
|
/**
|
|
1784
1782
|
* Property to provide the available widgets to the catalog. The flexible
|
|
1785
1783
|
* dashboard creates the catalog by Angular's `createComponent()` method
|
|
@@ -1796,9 +1794,11 @@ class SiWidgetCatalogComponent extends SiWidgetEditorBase {
|
|
|
1796
1794
|
* Array used to hold the search result on the widget catalog.
|
|
1797
1795
|
* @defaultValue [] */
|
|
1798
1796
|
filteredWidgetCatalog = [];
|
|
1799
|
-
selected = signal(undefined,
|
|
1797
|
+
selected = signal(undefined, /* @ts-ignore */
|
|
1798
|
+
...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
1800
1799
|
widgetConfig;
|
|
1801
|
-
hasEditor = computed(() => !!this.selected()?.componentFactory.editorComponentName,
|
|
1800
|
+
hasEditor = computed(() => !!this.selected()?.componentFactory.editorComponentName, /* @ts-ignore */
|
|
1801
|
+
...(ngDevMode ? [{ debugName: "hasEditor" }] : /* istanbul ignore next */ []));
|
|
1802
1802
|
translateService = injectSiTranslateService();
|
|
1803
1803
|
labelCancel = t(() => $localize `:@@DASHBOARD.WIDGET_LIBRARY.CANCEL:Cancel`);
|
|
1804
1804
|
labelPrevious = t(() => $localize `:@@DASHBOARD.WIDGET_LIBRARY.PREVIOUS:Previous`);
|
|
@@ -1810,10 +1810,14 @@ class SiWidgetCatalogComponent extends SiWidgetEditorBase {
|
|
|
1810
1810
|
labelDialogMessage = t(() => $localize `:@@DASHBOARD.WIDGET_LIBRARY.DISCARD_CONFIG_CHANGE_DIALOG.MESSAGE:The widget configuration changed. Do you want to discard the changes?`);
|
|
1811
1811
|
labelDialogDiscard = t(() => $localize `:@@DASHBOARD.WIDGET_LIBRARY.DISCARD_CONFIG_CHANGE_DIALOG.DISCARD:Discard`);
|
|
1812
1812
|
labelWidgetCatalogList = t(() => $localize `:@@DASHBOARD.WIDGET_LIBRARY.WIDGET_CATALOG_LIST:Widget catalog list`);
|
|
1813
|
-
showAddButton = computed(() => this.view() === 'list' ? !this.hasEditor() : true,
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1813
|
+
showAddButton = computed(() => this.view() === 'list' ? !this.hasEditor() : true, /* @ts-ignore */
|
|
1814
|
+
...(ngDevMode ? [{ debugName: "showAddButton" }] : /* istanbul ignore next */ []));
|
|
1815
|
+
showNextButton = computed(() => this.view() === 'list' ? this.hasEditor() : this.editorWizardState() !== undefined, /* @ts-ignore */
|
|
1816
|
+
...(ngDevMode ? [{ debugName: "showNextButton" }] : /* istanbul ignore next */ []));
|
|
1817
|
+
showPreviousButton = computed(() => this.view() === 'editor', /* @ts-ignore */
|
|
1818
|
+
...(ngDevMode ? [{ debugName: "showPreviousButton" }] : /* istanbul ignore next */ []));
|
|
1819
|
+
disableAddButton = computed(() => !this.selected() || this.invalidConfig(), /* @ts-ignore */
|
|
1820
|
+
...(ngDevMode ? [{ debugName: "disableAddButton" }] : /* istanbul ignore next */ []));
|
|
1817
1821
|
disableNextButton = computed(() => {
|
|
1818
1822
|
const wizardState = this.editorWizardState();
|
|
1819
1823
|
if (this.view() === 'list') {
|
|
@@ -1831,9 +1835,11 @@ class SiWidgetCatalogComponent extends SiWidgetEditorBase {
|
|
|
1831
1835
|
else {
|
|
1832
1836
|
return false;
|
|
1833
1837
|
}
|
|
1834
|
-
},
|
|
1838
|
+
}, /* @ts-ignore */
|
|
1839
|
+
...(ngDevMode ? [{ debugName: "disableNextButton" }] : /* istanbul ignore next */ []));
|
|
1835
1840
|
dialogService = inject(SiActionDialogService);
|
|
1836
|
-
widgetCdkListbox = viewChild((CdkListbox),
|
|
1841
|
+
widgetCdkListbox = viewChild((CdkListbox), /* @ts-ignore */
|
|
1842
|
+
...(ngDevMode ? [{ debugName: "widgetCdkListbox" }] : /* istanbul ignore next */ []));
|
|
1837
1843
|
ngOnInit() {
|
|
1838
1844
|
this.filteredWidgetCatalog = this.widgetCatalog;
|
|
1839
1845
|
if (this.widgetCatalog.length > 0) {
|
|
@@ -1968,10 +1974,10 @@ class SiWidgetCatalogComponent extends SiWidgetEditorBase {
|
|
|
1968
1974
|
});
|
|
1969
1975
|
}
|
|
1970
1976
|
}
|
|
1971
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1972
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
1977
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiWidgetCatalogComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1978
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", 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: "widgetCdkListbox", first: true, predicate: (CdkListbox), descendants: true, isSignal: true }], usesInheritance: 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 | translate }}</span>\n <span class=\"si-body\">{{ widget.description?.trim() | translate }}</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", "maxlength", "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" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
1973
1979
|
}
|
|
1974
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1980
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiWidgetCatalogComponent, decorators: [{
|
|
1975
1981
|
type: Component,
|
|
1976
1982
|
args: [{ selector: 'si-widget-catalog', imports: [
|
|
1977
1983
|
SiSearchBarComponent,
|
|
@@ -1980,7 +1986,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
|
|
|
1980
1986
|
SiTranslatePipe,
|
|
1981
1987
|
CdkListbox,
|
|
1982
1988
|
CdkOption
|
|
1983
|
-
], changeDetection: ChangeDetectionStrategy.
|
|
1989
|
+
], changeDetection: ChangeDetectionStrategy.Eager, 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 | translate }}</span>\n <span class=\"si-body\">{{ widget.description?.trim() | translate }}</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"] }]
|
|
1984
1990
|
}], propDecorators: { searchPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchPlaceholder", required: false }] }], closed: [{ type: i0.Output, args: ["closed"] }], widgetCdkListbox: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CdkListbox), { isSignal: true }] }] } });
|
|
1985
1991
|
|
|
1986
1992
|
/**
|
|
@@ -1997,62 +2003,73 @@ class SiFlexibleDashboardComponent {
|
|
|
1997
2003
|
*
|
|
1998
2004
|
* @defaultValue false
|
|
1999
2005
|
*/
|
|
2000
|
-
editable = model(false,
|
|
2006
|
+
editable = model(false, /* @ts-ignore */
|
|
2007
|
+
...(ngDevMode ? [{ debugName: "editable" }] : /* istanbul ignore next */ []));
|
|
2001
2008
|
/**
|
|
2002
2009
|
* Heading for the dashboard.
|
|
2003
2010
|
*/
|
|
2004
|
-
heading = input(
|
|
2011
|
+
heading = input(/* @ts-ignore */
|
|
2012
|
+
...(ngDevMode ? [undefined, { debugName: "heading" }] : /* istanbul ignore next */ []));
|
|
2005
2013
|
/**
|
|
2006
2014
|
* Optionally, provide a custom subclass of the SiWidgetCatalogComponent
|
|
2007
2015
|
* to use your own catalog component.
|
|
2008
2016
|
*/
|
|
2009
|
-
widgetCatalogComponent = input(
|
|
2017
|
+
widgetCatalogComponent = input(/* @ts-ignore */
|
|
2018
|
+
...(ngDevMode ? [undefined, { debugName: "widgetCatalogComponent" }] : /* istanbul ignore next */ []));
|
|
2010
2019
|
/**
|
|
2011
2020
|
* Optionally, provide a custom subclass of the {@link SiWidgetInstanceEditorDialogComponent}
|
|
2012
2021
|
* to use your own implementation.
|
|
2013
2022
|
*/
|
|
2014
|
-
widgetInstanceEditorDialogComponent = input(
|
|
2023
|
+
widgetInstanceEditorDialogComponent = input(/* @ts-ignore */
|
|
2024
|
+
...(ngDevMode ? [undefined, { debugName: "widgetInstanceEditorDialogComponent" }] : /* istanbul ignore next */ []));
|
|
2015
2025
|
/**
|
|
2016
2026
|
* Optionally, but it is recommended to include an id for a dashboard.
|
|
2017
2027
|
* The id is utilized in the persistence calls on the {@link SiWidgetStorage}.
|
|
2018
2028
|
*/
|
|
2019
|
-
dashboardId = input(
|
|
2029
|
+
dashboardId = input(/* @ts-ignore */
|
|
2030
|
+
...(ngDevMode ? [undefined, { debugName: "dashboardId" }] : /* istanbul ignore next */ []));
|
|
2020
2031
|
/**
|
|
2021
2032
|
* Sets the available widgets for the widget catalog to the dashboard.
|
|
2022
2033
|
*
|
|
2023
2034
|
* @defaultValue [] */
|
|
2024
|
-
widgetCatalog = input([],
|
|
2035
|
+
widgetCatalog = input([], /* @ts-ignore */
|
|
2036
|
+
...(ngDevMode ? [{ debugName: "widgetCatalog" }] : /* istanbul ignore next */ []));
|
|
2025
2037
|
/**
|
|
2026
2038
|
* Option to remove the add widget instance button from the primary toolbar.
|
|
2027
2039
|
*
|
|
2028
2040
|
* @defaultValue false
|
|
2029
2041
|
*/
|
|
2030
|
-
hideAddWidgetInstanceButton = input(false,
|
|
2042
|
+
hideAddWidgetInstanceButton = input(false, /* @ts-ignore */
|
|
2043
|
+
...(ngDevMode ? [{ debugName: "hideAddWidgetInstanceButton" }] : /* istanbul ignore next */ []));
|
|
2031
2044
|
/**
|
|
2032
2045
|
* Option to hide the dashboard edit button.
|
|
2033
2046
|
*
|
|
2034
2047
|
* @defaultValue false
|
|
2035
2048
|
*/
|
|
2036
|
-
hideEditButton = input(false,
|
|
2049
|
+
hideEditButton = input(false, /* @ts-ignore */
|
|
2050
|
+
...(ngDevMode ? [{ debugName: "hideEditButton" }] : /* istanbul ignore next */ []));
|
|
2037
2051
|
/**
|
|
2038
2052
|
* Option to display the edit button as a text button instead, only if the window is larger than xs {@link SiResponsiveContainerDirective}.
|
|
2039
2053
|
*
|
|
2040
2054
|
* @defaultValue false
|
|
2041
2055
|
*/
|
|
2042
|
-
showEditButtonLabel = input(false,
|
|
2056
|
+
showEditButtonLabel = input(false, /* @ts-ignore */
|
|
2057
|
+
...(ngDevMode ? [{ debugName: "showEditButtonLabel" }] : /* istanbul ignore next */ []));
|
|
2043
2058
|
/**
|
|
2044
2059
|
* Option to turn off the loading spinner on save and load operations.
|
|
2045
2060
|
*
|
|
2046
2061
|
* @defaultValue false
|
|
2047
2062
|
*/
|
|
2048
|
-
hideProgressIndicator = input(false,
|
|
2063
|
+
hideProgressIndicator = input(false, /* @ts-ignore */
|
|
2064
|
+
...(ngDevMode ? [{ debugName: "hideProgressIndicator" }] : /* istanbul ignore next */ []));
|
|
2049
2065
|
/**
|
|
2050
2066
|
* Option to configure a dashboard instance. Default is the optional value from
|
|
2051
2067
|
* the {@link SI_DASHBOARD_CONFIGURATION}.
|
|
2052
2068
|
*
|
|
2053
2069
|
* @defaultValue inject(SI_DASHBOARD_CONFIGURATION)
|
|
2054
2070
|
*/
|
|
2055
|
-
config = input(inject(SI_DASHBOARD_CONFIGURATION),
|
|
2071
|
+
config = input(inject(SI_DASHBOARD_CONFIGURATION), /* @ts-ignore */
|
|
2072
|
+
...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
2056
2073
|
/**
|
|
2057
2074
|
* Placeholder text for the search input field in the widget catalog.
|
|
2058
2075
|
*
|
|
@@ -2061,17 +2078,20 @@ class SiFlexibleDashboardComponent {
|
|
|
2061
2078
|
* t(() => $localize`:@@DASHBOARD.WIDGET_LIBRARY.SEARCH_PLACEHOLDER:Search widget`)
|
|
2062
2079
|
* ```
|
|
2063
2080
|
*/
|
|
2064
|
-
searchPlaceholder = input(t(() => $localize `:@@DASHBOARD.WIDGET_LIBRARY.SEARCH_PLACEHOLDER:Search widget`),
|
|
2081
|
+
searchPlaceholder = input(t(() => $localize `:@@DASHBOARD.WIDGET_LIBRARY.SEARCH_PLACEHOLDER:Search widget`), /* @ts-ignore */
|
|
2082
|
+
...(ngDevMode ? [{ debugName: "searchPlaceholder" }] : /* istanbul ignore next */ []));
|
|
2065
2083
|
/**
|
|
2066
2084
|
* Primary action menu items shown in the edit mode of the dashboard.
|
|
2067
2085
|
* @defaultValue []
|
|
2068
2086
|
*/
|
|
2069
|
-
primaryEditActions = input([],
|
|
2087
|
+
primaryEditActions = input([], /* @ts-ignore */
|
|
2088
|
+
...(ngDevMode ? [{ debugName: "primaryEditActions" }] : /* istanbul ignore next */ []));
|
|
2070
2089
|
/**
|
|
2071
2090
|
* Secondary action menu items shown in the edit mode of the dashboard.
|
|
2072
2091
|
* @defaultValue []
|
|
2073
2092
|
*/
|
|
2074
|
-
secondaryEditActions = input([],
|
|
2093
|
+
secondaryEditActions = input([], /* @ts-ignore */
|
|
2094
|
+
...(ngDevMode ? [{ debugName: "secondaryEditActions" }] : /* istanbul ignore next */ []));
|
|
2075
2095
|
/**
|
|
2076
2096
|
* The grid component is the actual container for the widgets.
|
|
2077
2097
|
*/
|
|
@@ -2112,7 +2132,8 @@ class SiFlexibleDashboardComponent {
|
|
|
2112
2132
|
/**
|
|
2113
2133
|
* @returns True, if the dashboard shows its widgets and not a catalog or and editor.
|
|
2114
2134
|
*/
|
|
2115
|
-
isDashboardVisible = computed(() => this.viewState() === 'dashboard',
|
|
2135
|
+
isDashboardVisible = computed(() => this.viewState() === 'dashboard', /* @ts-ignore */
|
|
2136
|
+
...(ngDevMode ? [{ debugName: "isDashboardVisible" }] : /* istanbul ignore next */ []));
|
|
2116
2137
|
/**
|
|
2117
2138
|
* The page title of the dashboard, which is either {@link SiFlexibleDashboardComponent.heading} for the
|
|
2118
2139
|
* default widget view or `DASHBOARD.WIDGET_EDITOR_DIALOG.TITLE` or 'DASHBOARD.WIDGET_LIBRARY.TITLE' when
|
|
@@ -2128,8 +2149,10 @@ class SiFlexibleDashboardComponent {
|
|
|
2128
2149
|
default:
|
|
2129
2150
|
return this.heading();
|
|
2130
2151
|
}
|
|
2131
|
-
},
|
|
2132
|
-
|
|
2152
|
+
}, /* @ts-ignore */
|
|
2153
|
+
...(ngDevMode ? [{ debugName: "pageTitle" }] : /* istanbul ignore next */ []));
|
|
2154
|
+
viewState = signal('dashboard', /* @ts-ignore */
|
|
2155
|
+
...(ngDevMode ? [{ debugName: "viewState" }] : /* istanbul ignore next */ []));
|
|
2133
2156
|
widgetStorage = inject(SI_WIDGET_STORE);
|
|
2134
2157
|
hideAddWidgetInstanceButton$ = new BehaviorSubject(this.hideAddWidgetInstanceButton());
|
|
2135
2158
|
dashboardId$ = new Subject();
|
|
@@ -2252,12 +2275,12 @@ class SiFlexibleDashboardComponent {
|
|
|
2252
2275
|
getWidget(id) {
|
|
2253
2276
|
return this.widgetCatalog().find(widget => widget.id === id);
|
|
2254
2277
|
}
|
|
2255
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2256
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "
|
|
2278
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiFlexibleDashboardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2279
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.5", 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" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
2257
2280
|
}
|
|
2258
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2281
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiFlexibleDashboardComponent, decorators: [{
|
|
2259
2282
|
type: Component,
|
|
2260
|
-
args: [{ selector: 'si-flexible-dashboard', imports: [SiDashboardComponent, SiDashboardToolbarComponent, SiGridComponent, AsyncPipe], changeDetection: ChangeDetectionStrategy.
|
|
2283
|
+
args: [{ selector: 'si-flexible-dashboard', imports: [SiDashboardComponent, SiDashboardToolbarComponent, SiGridComponent, AsyncPipe], changeDetection: ChangeDetectionStrategy.Eager, 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"] }]
|
|
2261
2284
|
}], 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 }] }] } });
|
|
2262
2285
|
|
|
2263
2286
|
/**
|
|
@@ -2285,18 +2308,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
|
|
|
2285
2308
|
*/
|
|
2286
2309
|
class SiWidgetRendererComponent {
|
|
2287
2310
|
/** The configuration of the widget instance to render. */
|
|
2288
|
-
widgetConfig = input.required(
|
|
2311
|
+
widgetConfig = input.required(/* @ts-ignore */
|
|
2312
|
+
...(ngDevMode ? [{ debugName: "widgetConfig" }] : /* istanbul ignore next */ []));
|
|
2289
2313
|
/**
|
|
2290
2314
|
* The {@link Widget} definition used to render the given {@link widgetConfig}.
|
|
2291
2315
|
* It must match the config's `widgetId`.
|
|
2292
2316
|
*/
|
|
2293
|
-
widget = input.required(
|
|
2294
|
-
|
|
2295
|
-
static
|
|
2317
|
+
widget = input.required(/* @ts-ignore */
|
|
2318
|
+
...(ngDevMode ? [{ debugName: "widget" }] : /* istanbul ignore next */ []));
|
|
2319
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiWidgetRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2320
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.5", type: SiWidgetRendererComponent, isStandalone: true, selector: "si-widget-renderer", inputs: { widgetConfig: { classPropertyName: "widgetConfig", publicName: "widgetConfig", isSignal: true, isRequired: true, transformFunction: null }, widget: { classPropertyName: "widget", publicName: "widget", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<si-widget-host\n class=\"h-100\"\n [widgetConfig]=\"widgetConfig()\"\n [componentFactory]=\"widget().componentFactory\"\n/>\n", styles: ["si-widget-host ::ng-deep .grid-stack-item-content{flex:1 1 auto;min-inline-size:0;min-block-size:0;padding:0!important}\n"], dependencies: [{ kind: "component", type: SiWidgetHostComponent, selector: "si-widget-host", inputs: ["widgetConfig", "grid", "componentFactory", "editable"], outputs: ["remove", "edit", "gridEvent"] }] });
|
|
2296
2321
|
}
|
|
2297
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2322
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiWidgetRendererComponent, decorators: [{
|
|
2298
2323
|
type: Component,
|
|
2299
|
-
args: [{ selector: 'si-widget-renderer', imports: [SiWidgetHostComponent],
|
|
2324
|
+
args: [{ selector: 'si-widget-renderer', imports: [SiWidgetHostComponent], template: "<si-widget-host\n class=\"h-100\"\n [widgetConfig]=\"widgetConfig()\"\n [componentFactory]=\"widget().componentFactory\"\n/>\n", styles: ["si-widget-host ::ng-deep .grid-stack-item-content{flex:1 1 auto;min-inline-size:0;min-block-size:0;padding:0!important}\n"] }]
|
|
2300
2325
|
}], propDecorators: { widgetConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgetConfig", required: true }] }], widget: [{ type: i0.Input, args: [{ isSignal: true, alias: "widget", required: true }] }] } });
|
|
2301
2326
|
|
|
2302
2327
|
/**
|
|
@@ -2335,18 +2360,19 @@ const handleFederatedModuleLoad = ({ loadPromise, factory, componentName, host,
|
|
|
2335
2360
|
* SPDX-License-Identifier: MIT
|
|
2336
2361
|
*/
|
|
2337
2362
|
class SiDashboardsNgModule {
|
|
2338
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2339
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
2363
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiDashboardsNgModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2364
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.5", ngImport: i0, type: SiDashboardsNgModule, imports: [SiFlexibleDashboardComponent,
|
|
2340
2365
|
SiGridComponent,
|
|
2341
2366
|
SiWidgetCatalogComponent,
|
|
2342
2367
|
SiWidgetInstanceEditorDialogComponent], exports: [SiFlexibleDashboardComponent,
|
|
2343
2368
|
SiGridComponent,
|
|
2344
2369
|
SiWidgetCatalogComponent,
|
|
2345
2370
|
SiWidgetInstanceEditorDialogComponent] });
|
|
2346
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
2371
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiDashboardsNgModule, imports: [SiFlexibleDashboardComponent,
|
|
2372
|
+
SiGridComponent,
|
|
2347
2373
|
SiWidgetCatalogComponent] });
|
|
2348
2374
|
}
|
|
2349
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2375
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SiDashboardsNgModule, decorators: [{
|
|
2350
2376
|
type: NgModule,
|
|
2351
2377
|
args: [{
|
|
2352
2378
|
imports: [
|
|
@@ -2363,6 +2389,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
|
|
|
2363
2389
|
]
|
|
2364
2390
|
}]
|
|
2365
2391
|
}] });
|
|
2392
|
+
/**
|
|
2393
|
+
* @deprecated Use {@link SiDashboardsNgModule} instead. The `Simpl` prefix is deprecated and will be removed in v51.
|
|
2394
|
+
*/
|
|
2395
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2396
|
+
const SimplDashboardsNgModule = SiDashboardsNgModule;
|
|
2366
2397
|
|
|
2367
2398
|
/**
|
|
2368
2399
|
* Copyright (c) Siemens 2016 - 2026
|
|
@@ -2373,5 +2404,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
|
|
|
2373
2404
|
* Generated bundle index. Do not edit.
|
|
2374
2405
|
*/
|
|
2375
2406
|
|
|
2376
|
-
export { DEFAULT_GRIDSTACK_OPTIONS, DEFAULT_WIDGET_STORAGE_TOKEN, SI_DASHBOARD_CONFIGURATION, SI_DASHBOARD_TOOLBAR_ITEMS, SI_WIDGET_ID_PROVIDER, SI_WIDGET_STORE, STORAGE_KEY, SiDashboardsNgModule, SiDefaultWidgetStorage, SiFlexibleDashboardComponent, SiGridComponent, SiWidgetCatalogComponent, SiWidgetDefaultIdProvider, SiWidgetIdProvider, SiWidgetInstanceEditorDialogComponent, SiWidgetRendererComponent, SiWidgetStorage,
|
|
2407
|
+
export { DEFAULT_GRIDSTACK_OPTIONS, DEFAULT_WIDGET_STORAGE_TOKEN, SI_DASHBOARD_CONFIGURATION, SI_DASHBOARD_TOOLBAR_ITEMS, SI_WIDGET_ID_PROVIDER, SI_WIDGET_STORE, STORAGE_KEY, SiDashboardsNgModule, SiDefaultWidgetStorage, SiFlexibleDashboardComponent, SiGridComponent, SiWidgetCatalogComponent, SiWidgetDefaultIdProvider, SiWidgetIdProvider, SiWidgetInstanceEditorDialogComponent, SiWidgetRendererComponent, SiWidgetStorage, SimplDashboardsNgModule, createWidgetConfig, handleFederatedModuleLoad, provideDashboardToolbarItems, setupWidgetEditor, setupWidgetInstance, widgetFactoryRegistry };
|
|
2377
2408
|
//# sourceMappingURL=siemens-dashboards-ng.mjs.map
|