@siemens/dashboards-ng 49.6.0 → 49.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@siemens/dashboards-ng",
3
3
  "description": "Element Dashboards library.",
4
- "version": "49.6.0",
4
+ "version": "49.8.0",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -20,12 +20,13 @@
20
20
  "peerDependencies": {
21
21
  "@angular/common": "21",
22
22
  "@angular/core": "21",
23
- "@siemens/element-ng": "49.6.0",
24
- "@siemens/element-theme": "49.6.0",
23
+ "@siemens/element-ng": "49.8.0",
24
+ "@siemens/element-theme": "49.8.0",
25
25
  "gridstack": "^12.3.3",
26
26
  "@angular-architects/module-federation": "^20.0.0 || ^21.0.0",
27
27
  "@angular-architects/native-federation": "^21.1.0",
28
- "@module-federation/enhanced": "^2.0.0"
28
+ "@module-federation/enhanced": "^2.0.0",
29
+ "@module-federation/runtime": "^2.0.0"
29
30
  },
30
31
  "peerDependenciesMeta": {
31
32
  "@angular-architects/module-federation": {
@@ -1,10 +1,10 @@
1
1
  import * as _siemens_element_translate_ng_translate from '@siemens/element-translate-ng/translate';
2
2
  import { TranslatableString } from '@siemens/element-translate-ng/translate';
3
3
  import * as _angular_core from '@angular/core';
4
- import { Type, InputSignal, EventEmitter, TemplateRef, OutputEmitterRef, OnInit, OnChanges, ViewContainerRef, SimpleChanges, OnDestroy, InjectionToken, Provider, Injector, EnvironmentInjector, ComponentRef } from '@angular/core';
4
+ import { Type, InputSignal, OutputEmitterRef, EventEmitter, TemplateRef, OnInit, OnChanges, ViewContainerRef, SimpleChanges, OnDestroy, OutputRefSubscription, Injector, EnvironmentInjector, ComponentRef, InjectionToken, Provider } from '@angular/core';
5
5
  import { AccentLineType, MenuItem } from '@siemens/element-ng/common';
6
6
  import { SiDashboardComponent } from '@siemens/element-ng/dashboard';
7
- import { Subject, BehaviorSubject, Observable } from 'rxjs';
7
+ import { Subject, Subscription, Observable, BehaviorSubject } from 'rxjs';
8
8
  import { GridStackOptions, GridStackNode, GridStack, GridItemHTMLElement } from 'gridstack';
9
9
  import { NavigationExtras } from '@angular/router';
10
10
  import { ViewType, ContentActionBarMainItem } from '@siemens/element-ng/content-action-bar';
@@ -42,9 +42,9 @@ interface Widget {
42
42
  /** An optional version string. */
43
43
  version?: string;
44
44
  /** The name of the widget that is presented in the widget catalog. */
45
- name: string;
45
+ name: TranslatableString;
46
46
  /** An optional description that is visible in the widget catalog. */
47
- description?: string;
47
+ description?: TranslatableString;
48
48
  /** A CSS icon class that specifies the widget icon, displayed in the catalog. */
49
49
  iconClass?: string;
50
50
  /** The factory to instantiate a widget instance component that is added to the dashboard. */
@@ -177,7 +177,7 @@ interface WidgetConfig {
177
177
  /**
178
178
  * grid item header text.
179
179
  */
180
- heading?: string;
180
+ heading?: TranslatableString;
181
181
  /** Defines whether the widget instance component can be expanded and enlarged over the dashboard. */
182
182
  expandable?: boolean;
183
183
  /** A widget specific payload object. Placeholder to pass in additional configuration. */
@@ -393,6 +393,14 @@ declare class SiGridstackWrapperComponent implements OnInit, OnChanges {
393
393
  * Module configuration
394
394
  */
395
395
  readonly gridConfig: _angular_core.InputSignal<GridConfig | undefined>;
396
+ /**
397
+ * Map of widget id to widget definition, passed through to widget hosts.
398
+ *
399
+ * @defaultValue new Map()
400
+ */
401
+ readonly widgetCatalogMap: _angular_core.InputSignal<Map<string, {
402
+ componentFactory: WidgetComponentFactory;
403
+ }>>;
396
404
  /**
397
405
  * Emits dashboard grid events.
398
406
  */
@@ -420,7 +428,11 @@ declare class SiGridstackWrapperComponent implements OnInit, OnChanges {
420
428
  ngOnInit(): void;
421
429
  mount(items: WidgetConfig[]): void;
422
430
  unmount(items: WidgetConfig[]): void;
423
- getLayout(): WidgetPositionConfig[];
431
+ /**
432
+ *
433
+ * Returns the position of a specific widget in the grid.
434
+ */
435
+ getWidgetLayout(widgetId: string): WidgetPositionConfig | undefined;
424
436
  private updateLayout;
425
437
  private addToView;
426
438
  private removeFromView;
@@ -431,7 +443,33 @@ declare class SiGridstackWrapperComponent implements OnInit, OnChanges {
431
443
  private diffWidgetConfigs;
432
444
  private hookEvents;
433
445
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<SiGridstackWrapperComponent, never>;
434
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<SiGridstackWrapperComponent, "si-gridstack-wrapper", never, { "widgetConfigs": { "alias": "widgetConfigs"; "required": false; "isSignal": true; }; "editable": { "alias": "editable"; "required": false; "isSignal": true; }; "gridConfig": { "alias": "gridConfig"; "required": false; "isSignal": true; }; }, { "gridEvent": "gridEvent"; "widgetInstanceRemove": "widgetInstanceRemove"; "widgetInstanceEdit": "widgetInstanceEdit"; }, never, never, true, never>;
446
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SiGridstackWrapperComponent, "si-gridstack-wrapper", never, { "widgetConfigs": { "alias": "widgetConfigs"; "required": false; "isSignal": true; }; "editable": { "alias": "editable"; "required": false; "isSignal": true; }; "gridConfig": { "alias": "gridConfig"; "required": false; "isSignal": true; }; "widgetCatalogMap": { "alias": "widgetCatalogMap"; "required": false; "isSignal": true; }; }, { "gridEvent": "gridEvent"; "widgetInstanceRemove": "widgetInstanceRemove"; "widgetInstanceEdit": "widgetInstanceEdit"; }, never, never, true, never>;
447
+ }
448
+
449
+ /**
450
+ * Base class encapsulating common widget editor lifecycle management.
451
+ * Both `SiWidgetCatalogComponent` and `SiWidgetInstanceEditorDialogComponent`
452
+ * extend this class to share editor setup, teardown, and status handling logic.
453
+ */
454
+ declare abstract class SiWidgetEditorBase implements OnDestroy {
455
+ /** Indicates if the current config is valid or not. */
456
+ protected readonly invalidConfig: _angular_core.WritableSignal<boolean>;
457
+ /** Marks the widget configuration as modified. */
458
+ protected readonly widgetConfigModified: _angular_core.WritableSignal<boolean>;
459
+ protected readonly editorWizardState: _angular_core.WritableSignal<WidgetInstanceEditorWizardState | undefined>;
460
+ protected widgetInstanceEditor?: WidgetInstanceEditor;
461
+ protected subscriptions: (Subscription | OutputRefSubscription)[];
462
+ protected readonly editorHost: _angular_core.Signal<ViewContainerRef>;
463
+ protected injector: Injector;
464
+ protected envInjector: EnvironmentInjector;
465
+ ngOnDestroy(): void;
466
+ protected loadWidgetEditor(widgetComponentFactory: WidgetComponentFactory, host: ViewContainerRef): Observable<ComponentRef<WidgetInstanceEditor>>;
467
+ protected initializeEditor(componentRef: ComponentRef<WidgetInstanceEditor>, config: WidgetConfig | Omit<WidgetConfig, 'id'>): void;
468
+ protected tearDownEditor(): void;
469
+ protected isEditorWizard(editor?: WidgetInstanceEditor | WidgetInstanceEditorWizard): editor is WidgetInstanceEditorWizard;
470
+ protected handleStatusChanges(statusChanges: Partial<WidgetConfigStatus>): void;
471
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<SiWidgetEditorBase, never>;
472
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<SiWidgetEditorBase, never, never, {}, {}, never, never, true, never>;
435
473
  }
436
474
 
437
475
  /**
@@ -440,7 +478,7 @@ declare class SiGridstackWrapperComponent implements OnInit, OnChanges {
440
478
  * into its content. The dialog component is accountable for interacting with the dashboard
441
479
  * and offers options for saving changes or terminating the editing process.
442
480
  */
443
- declare class SiWidgetInstanceEditorDialogComponent implements OnInit, OnDestroy {
481
+ declare class SiWidgetInstanceEditorDialogComponent extends SiWidgetEditorBase implements OnInit {
444
482
  /**
445
483
  * Input for the widget instance configuration. It is used to populate the
446
484
  * widget editor.
@@ -460,9 +498,6 @@ declare class SiWidgetInstanceEditorDialogComponent implements OnInit, OnDestroy
460
498
  * Emits when the editor instantiation is completed.
461
499
  */
462
500
  readonly editorSetupCompleted: _angular_core.OutputEmitterRef<void>;
463
- protected readonly editorHost: _angular_core.Signal<ViewContainerRef>;
464
- /** Indicates if the current config is valid or not. If invalid, the save button will be disabled. */
465
- protected readonly invalidConfig: _angular_core.WritableSignal<boolean>;
466
501
  protected readonly showNextButton: _angular_core.Signal<boolean>;
467
502
  protected readonly disableNextButton: _angular_core.Signal<boolean>;
468
503
  protected readonly showPreviousButton: _angular_core.Signal<boolean>;
@@ -476,27 +511,12 @@ declare class SiWidgetInstanceEditorDialogComponent implements OnInit, OnDestroy
476
511
  protected labelDialogSave: _siemens_element_translate_ng_translate.TranslatableString;
477
512
  protected labelDialogDiscard: _siemens_element_translate_ng_translate.TranslatableString;
478
513
  protected labelDialogCancel: _siemens_element_translate_ng_translate.TranslatableString;
479
- /**
480
- * Marks the widget configuration as modified. Is set when widget editor instance
481
- * emits configChange events. Triggers edit discard confirmation dialog when widget config
482
- * is modified but not dialog is canceled.
483
- * */
484
- private readonly widgetConfigModified;
485
- private widgetInstanceEditor?;
486
- private readonly editorWizardState;
487
- private subscriptions;
488
- private injector;
489
- private envInjector;
490
514
  private dialogService;
491
515
  ngOnInit(): void;
492
- ngOnDestroy(): void;
493
516
  protected onCancel(): void;
494
517
  protected onNext(): void;
495
518
  protected onPrevious(): void;
496
519
  protected onSave(): void;
497
- private tearDownEditor;
498
- private isEditorWizard;
499
- private handleStatusChanges;
500
520
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<SiWidgetInstanceEditorDialogComponent, never>;
501
521
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<SiWidgetInstanceEditorDialogComponent, "si-widget-instance-editor-dialog", never, { "widgetConfig": { "alias": "widgetConfig"; "required": true; "isSignal": true; }; "widget": { "alias": "widget"; "required": true; "isSignal": true; }; }, { "widgetConfig": "widgetConfigChange"; "closed": "closed"; "editorSetupCompleted": "editorSetupCompleted"; }, never, never, true, never>;
502
522
  }
@@ -507,7 +527,6 @@ declare class SiWidgetInstanceEditorDialogComponent implements OnInit, OnDestroy
507
527
  */
508
528
  declare class SiGridComponent implements OnInit, OnChanges, OnDestroy {
509
529
  private storeSubscription?;
510
- private gridService;
511
530
  private modalService;
512
531
  private widgetStorage;
513
532
  private widgetIdProvider;
@@ -525,14 +544,6 @@ declare class SiGridComponent implements OnInit, OnChanges, OnDestroy {
525
544
  * @defaultValue false
526
545
  */
527
546
  readonly editable: _angular_core.ModelSignal<boolean>;
528
- /**
529
- * This is the internal owner of the current editable state and is used to track if
530
- * editable or not. Not editable can be changed by either calling the `edit()` api
531
- * method or by setting the `editable` input. When setting the input, the `ngOnChanges(...)`
532
- * hook is used to call the `edit()` method. Similar, to get from editable to not editable,
533
- * `cancel()` or `save()` is used and can be triggered from `ngOnChanges(...)`.
534
- */
535
- private editableInternal;
536
547
  /**
537
548
  * An optional, but recommended dashboard id that is used in persistence and passed
538
549
  * to the widget store for saving and loading data.
@@ -545,6 +556,7 @@ declare class SiGridComponent implements OnInit, OnChanges, OnDestroy {
545
556
  *
546
557
  * @defaultValue [] */
547
558
  readonly widgetCatalog: _angular_core.InputSignal<Widget[]>;
559
+ protected readonly widgetCatalogMap: _angular_core.Signal<Map<string, Widget>>;
548
560
  /**
549
561
  * When the user clicks edit on a widget instance, an editor need to appear and the
550
562
  * widget editor component need to be loaded. When the grid is used standalone, it
@@ -671,6 +683,8 @@ declare class SiGridComponent implements OnInit, OnChanges, OnDestroy {
671
683
  protected handleGridEvent(event: GridWrapperEvent): void;
672
684
  private loadAndSubscribeWidgets;
673
685
  private updateWidgetPositions;
686
+ private resetEditState;
687
+ private restoreSavedState;
674
688
  private setModified;
675
689
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<SiGridComponent, never>;
676
690
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<SiGridComponent, "si-grid", never, { "gridConfig": { "alias": "gridConfig"; "required": false; "isSignal": true; }; "editable": { "alias": "editable"; "required": false; "isSignal": true; }; "dashboardId": { "alias": "dashboardId"; "required": false; "isSignal": true; }; "widgetCatalog": { "alias": "widgetCatalog"; "required": false; "isSignal": true; }; "emitWidgetInstanceEditEvents": { "alias": "emitWidgetInstanceEditEvents"; "required": false; "isSignal": true; }; "hideProgressIndicator": { "alias": "hideProgressIndicator"; "required": false; "isSignal": true; }; "widgetInstanceEditorDialogComponent": { "alias": "widgetInstanceEditorDialogComponent"; "required": false; "isSignal": true; }; }, { "editable": "editableChange"; "isModified": "isModified"; "widgetInstanceEdit": "widgetInstanceEdit"; }, never, ["[empty-state]"], true, never>;
@@ -752,7 +766,7 @@ declare const provideDashboardToolbarItems: (toolbarItems?: {
752
766
  * selection, a host in which the widget specific editor is loaded. Applications can either
753
767
  * stay with the default catalog or implement their own by extending this class.
754
768
  */
755
- declare class SiWidgetCatalogComponent implements OnInit, OnDestroy {
769
+ declare class SiWidgetCatalogComponent extends SiWidgetEditorBase implements OnInit {
756
770
  /**
757
771
  * Placeholder text for the search input field in the widget catalog.
758
772
  *
@@ -775,7 +789,6 @@ declare class SiWidgetCatalogComponent implements OnInit, OnDestroy {
775
789
  * @defaultValue 'list'
776
790
  */
777
791
  readonly view: _angular_core.WritableSignal<"list" | "editor" | "editor-only">;
778
- protected readonly editorHost: _angular_core.Signal<ViewContainerRef>;
779
792
  /**
780
793
  * Property to provide the available widgets to the catalog. The flexible
781
794
  * dashboard creates the catalog by Angular's `createComponent()` method
@@ -795,6 +808,7 @@ declare class SiWidgetCatalogComponent implements OnInit, OnDestroy {
795
808
  protected readonly selected: _angular_core.WritableSignal<Widget | undefined>;
796
809
  private widgetConfig?;
797
810
  private readonly hasEditor;
811
+ private readonly translateService;
798
812
  protected labelCancel: _siemens_element_translate_ng_translate.TranslatableString;
799
813
  protected labelPrevious: _siemens_element_translate_ng_translate.TranslatableString;
800
814
  protected labelNext: _siemens_element_translate_ng_translate.TranslatableString;
@@ -810,35 +824,17 @@ declare class SiWidgetCatalogComponent implements OnInit, OnDestroy {
810
824
  protected readonly showPreviousButton: _angular_core.Signal<boolean>;
811
825
  protected readonly disableAddButton: _angular_core.Signal<boolean>;
812
826
  protected readonly disableNextButton: _angular_core.Signal<boolean>;
813
- /** Indicates if the current config is valid or not. If invalid, the add button is disabled. */
814
- private readonly invalidConfig;
815
- /**
816
- * Marks the widget configuration as modified. Is set when widget editor instance
817
- * emits configChange events. Triggers edit discard confirmation dialog when widget config
818
- * is modified but not added to the dashboard.
819
- * */
820
- private widgetConfigModified;
821
- private widgetInstanceEditor?;
822
- private readonly editorWizardState;
823
- private widgetInstanceEditorRef?;
824
- private subscriptions;
825
827
  private dialogService;
826
- private injector;
827
- private envInjector;
828
828
  private readonly widgetCdkListbox;
829
829
  ngOnInit(): void;
830
- ngOnDestroy(): void;
831
830
  protected onSearch(searchTerm?: string): void;
832
831
  protected onCancel(): void;
833
832
  protected onNext(): void;
834
833
  protected onPrevious(): void;
835
834
  private setupWidgetInstanceEditor;
836
- private tearDownEditor;
837
835
  private setupCatalog;
838
836
  protected onAddWidget(): void;
839
837
  protected selectWidget(widget?: Widget): void;
840
- private isEditorWizard;
841
- private handleStatusChanges;
842
838
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<SiWidgetCatalogComponent, never>;
843
839
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<SiWidgetCatalogComponent, "si-widget-catalog", never, { "searchPlaceholder": { "alias": "searchPlaceholder"; "required": false; "isSignal": true; }; }, { "closed": "closed"; }, never, never, true, never>;
844
840
  }