@siemens/dashboards-ng 47.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/LICENSE.md +20 -0
- package/README.md +230 -0
- package/assets/i18n/de.json +46 -0
- package/assets/i18n/en.json +46 -0
- package/components/dashboard-toolbar/si-dashboard-toolbar.component.d.ts +80 -0
- package/components/flexible-dashboard/si-flexible-dashboard.component.d.ts +151 -0
- package/components/grid/si-grid.component.d.ts +189 -0
- package/components/gridstack-wrapper/si-gridstack-wrapper.component.d.ts +70 -0
- package/components/web-component-wrapper/si-web-component-editor-wrapper.component.d.ts +27 -0
- package/components/web-component-wrapper/si-web-component-wrapper-base.component.d.ts +18 -0
- package/components/web-component-wrapper/si-web-component-wrapper.component.d.ts +27 -0
- package/components/widget-catalog/si-widget-catalog.component.d.ts +101 -0
- package/components/widget-host/si-widget-host.component.d.ts +80 -0
- package/components/widget-instance-editor-dialog/si-widget-instance-editor-dialog.component.d.ts +73 -0
- package/fesm2022/siemens-dashboards-ng-module-federation.mjs +37 -0
- package/fesm2022/siemens-dashboards-ng-module-federation.mjs.map +1 -0
- package/fesm2022/siemens-dashboards-ng-translate.mjs +21 -0
- package/fesm2022/siemens-dashboards-ng-translate.mjs.map +1 -0
- package/fesm2022/siemens-dashboards-ng.mjs +2184 -0
- package/fesm2022/siemens-dashboards-ng.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/model/configuration.d.ts +22 -0
- package/model/gridstack.model.d.ts +15 -0
- package/model/si-dashboard-toolbar.model.d.ts +37 -0
- package/model/si-widget-storage.d.ts +78 -0
- package/model/widgets.model.d.ts +316 -0
- package/module-federation/index.d.ts +1 -0
- package/module-federation/package.json +3 -0
- package/package.json +51 -0
- package/public-api.d.ts +16 -0
- package/public-api.module.d.ts +38 -0
- package/services/si-grid.service.d.ts +17 -0
- package/template-i18n.json +35 -0
- package/translate/index.d.ts +6 -0
- package/translate/package.json +3 -0
- package/translate/si-translatable-keys.interface.d.ts +35 -0
- package/translate/si-translatable-overrides.provider.d.ts +7 -0
- package/widget-loader.d.ts +18 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Siemens 2016 - 2025
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the “Software”), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
# Siemens Dashboards
|
|
2
|
+
|
|
3
|
+
## Usage
|
|
4
|
+
|
|
5
|
+
Check out our [dashboard demo project](../dashboards-demo/) for examples on how
|
|
6
|
+
to integrate the Siemens Dashboards library in your project.
|
|
7
|
+
|
|
8
|
+
### Install dependencies
|
|
9
|
+
|
|
10
|
+
To use the Siemens Dashboards in your project, add it to your dependencies
|
|
11
|
+
by executing:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm install --save @siemens/dashboards-ng gridstack
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Add libraries to your project
|
|
18
|
+
|
|
19
|
+
The library supports standalone components and modules. However, the widgets when not using web components
|
|
20
|
+
or module federation still need a module definition.
|
|
21
|
+
|
|
22
|
+
### Standalone
|
|
23
|
+
|
|
24
|
+
Import and include the `SiFlexibleDashboardComponent` in the component that shall provide the dashboard.
|
|
25
|
+
Optionally, configure the grid and the widget storage in the global app configuration providers.
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
providers: [
|
|
29
|
+
provideRouter(routes, withHashLocation()),
|
|
30
|
+
{ provide: SI_WIDGET_STORE, useClass: AppWidgetStorage },
|
|
31
|
+
{ provide: SI_DASHBOARD_CONFIGURATION, useValue: config },
|
|
32
|
+
importProvidersFrom(
|
|
33
|
+
TranslateModule.forRoot({
|
|
34
|
+
loader: {
|
|
35
|
+
provide: TranslateLoader,
|
|
36
|
+
useFactory: createTranslateLoader,
|
|
37
|
+
deps: [HttpBackend]
|
|
38
|
+
}
|
|
39
|
+
}),
|
|
40
|
+
SiTranslateNgxTModule
|
|
41
|
+
),
|
|
42
|
+
provideAnimations(),
|
|
43
|
+
provideNgxTranslateForElement(),
|
|
44
|
+
provideHttpClient(withInterceptorsFromDi())
|
|
45
|
+
];
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Modules
|
|
49
|
+
|
|
50
|
+
Import the library to your Angular `AppModule`, mostly residing in your
|
|
51
|
+
`src/app/app.modules.ts` file as follows:
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
// [...]
|
|
55
|
+
// Import this library
|
|
56
|
+
import { SiDashboardsNgModule } from '@siemens/dashboards-ng';
|
|
57
|
+
// Import needed peer dependency
|
|
58
|
+
import { SiTranslateModule } from '@siemens/element-translate-ng/translate';
|
|
59
|
+
|
|
60
|
+
@NgModule({
|
|
61
|
+
declarations: [AppComponent],
|
|
62
|
+
imports: [
|
|
63
|
+
BrowserModule,
|
|
64
|
+
|
|
65
|
+
// Import this library
|
|
66
|
+
SiDashboardsNgModule.forRoot({})
|
|
67
|
+
],
|
|
68
|
+
providers: [
|
|
69
|
+
provideNgxTranslateForElement()
|
|
70
|
+
]
|
|
71
|
+
bootstrap: [AppComponent]
|
|
72
|
+
})
|
|
73
|
+
export class AppModule { }
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Add `gridstack` CSS files to you application by editing
|
|
77
|
+
the `angular.json` file.
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
"styles": [
|
|
81
|
+
"src/styles.scss",
|
|
82
|
+
"node_modules/gridstack/dist/gridstack.css",
|
|
83
|
+
"node_modules/gridstack/dist/gridstack-extra.css"
|
|
84
|
+
],
|
|
85
|
+
"allowedCommonJsDependencies": [
|
|
86
|
+
"gridstack"
|
|
87
|
+
],
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Add the dashboard to your application
|
|
91
|
+
|
|
92
|
+
To add the dashboard to your application, add the `si-flexible-dashboard component
|
|
93
|
+
to your template. Configure the widget catalog by setting the _widgetCatalog_ input
|
|
94
|
+
property.
|
|
95
|
+
|
|
96
|
+
The component expects to be added to a flex container with a defined height, as it grows in height
|
|
97
|
+
to the available space, following the [Fixed-height](https://element.siemens.io/fundamentals/layouts/content/#fixed-height)
|
|
98
|
+
concept.
|
|
99
|
+
|
|
100
|
+
For testing, set `style="display: flex; block-size: 800px;"` to the parent element. Please
|
|
101
|
+
note that the `si-flexible-dashboard` comes with the correct page margins.
|
|
102
|
+
|
|
103
|
+
```html
|
|
104
|
+
<div style="display: flex; block-size: 800px;">
|
|
105
|
+
<si-flexible-dashboard heading="Sample Dashboard" [widgetCatalog]="[]">
|
|
106
|
+
<div filters-slot><button class="btn btn-secondary">My Menu</button></div>
|
|
107
|
+
</si-flexible-dashboard>
|
|
108
|
+
</div>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The correct approach is to use the full page height as explained at
|
|
112
|
+
[Fixed-height](https://element.siemens.io/fundamentals/layouts/content/#fixed-height).
|
|
113
|
+
|
|
114
|
+
```html
|
|
115
|
+
<div class="has-navbar-fixed-top si-layout-fixed-height h-100">
|
|
116
|
+
<si-application-header> ... </si-application-header>
|
|
117
|
+
<div class="si-layout-fixed-height">
|
|
118
|
+
<si-flexible-dashboard heading="Sample Dashboard" [widgetCatalog]="[]">
|
|
119
|
+
<div filters-slot><button class="btn btn-secondary">My Menu</button></div>
|
|
120
|
+
</si-flexible-dashboard>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Translations
|
|
126
|
+
|
|
127
|
+
The dashboards comes with a couple of components with i18n support.
|
|
128
|
+
The library uses translation keys in the components and ships English
|
|
129
|
+
and German (`en.json`, `de.json`) translations for demonstration. The
|
|
130
|
+
files are located at the folder `node_modules/@siemens/dashboards-ng/assets/i18n/`
|
|
131
|
+
and provides you all used keys. You should include the keys in your translation
|
|
132
|
+
files and update the translations to your need.
|
|
133
|
+
|
|
134
|
+
For a quick test you can include the files from the library in your app.
|
|
135
|
+
Copy the files to your target by updated the `assets` definition in the `angular.json`
|
|
136
|
+
file.
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"glob": "**/*",
|
|
141
|
+
"input": "node_modules/@siemens/dashboards-ng/assets/i18n",
|
|
142
|
+
"output": "./assets/i18n/dashboard/"
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Use the `MultiTranslateHttpLoader` to load your and the library translation
|
|
147
|
+
files.
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
...
|
|
151
|
+
export function createTranslateLoader(_httpBackend: HttpBackend) {
|
|
152
|
+
return new MultiTranslateHttpLoader(_httpBackend, ['/assets/i18n/', '/assets/i18n/dashboard/']);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
...
|
|
156
|
+
|
|
157
|
+
TranslateModule.forRoot({
|
|
158
|
+
loader: {
|
|
159
|
+
provide: TranslateLoader,
|
|
160
|
+
useFactory: (createTranslateLoader),
|
|
161
|
+
deps: [HttpBackend]
|
|
162
|
+
}
|
|
163
|
+
})
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Widget development
|
|
167
|
+
|
|
168
|
+
You can develop your own widgets that are managed by the dashboard. One or multiple widgets
|
|
169
|
+
have to be provided by an Angular module and described by a `Widget` object, that includes
|
|
170
|
+
the meta information and the Angular widget instance component and editor names that are
|
|
171
|
+
used to instantiate the widget at runtime.
|
|
172
|
+
|
|
173
|
+
The widget instance component has to implement the `WidgetInstance` interface and the
|
|
174
|
+
editor has to implement the `WidgetInstanceEditor` interface. You have to provide a
|
|
175
|
+
module loader function that is used to load the widget when needed.
|
|
176
|
+
|
|
177
|
+
The library ships with a [hello-widget](./src/app/widgets/hello-widget/) example for illustration.
|
|
178
|
+
|
|
179
|
+
E.g. a widget implements a user interface that is added at runtime into the body of a dashboard card.
|
|
180
|
+
Optionally, the widget template may include a `<ng-template/>` to provides a footer implementation like
|
|
181
|
+
`<ng-template #footer><a [siLink]="link">Go to issues</a></ng-template>` in the [value-widget](./src/app/widgets/charts/value-widget.component.ts).
|
|
182
|
+
The Angular component should export the template as the public attribute `footer`.
|
|
183
|
+
|
|
184
|
+
```ts
|
|
185
|
+
`@ViewChild('footer', { static: true }) footer?: TemplateRef<unknown>;`;
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Dashboard persistence
|
|
189
|
+
|
|
190
|
+
The library persists a dashboard configuration by the default `SiDefaultWidgetStorage` implementation
|
|
191
|
+
of the API [SiWidgetStorage](./projects/dashboards-ng/src/model/si-widget-storage.ts). The
|
|
192
|
+
`SiDefaultWidgetStorage` uses the `Storage` implementation `sessionStorage`. You can set a different
|
|
193
|
+
`Storage` like the `localStorage` by providing the `DEFAULT_WIDGET_STORAGE_TOKEN` in the related module.
|
|
194
|
+
|
|
195
|
+
```ts
|
|
196
|
+
providers: [..., { provide: DEFAULT_WIDGET_STORAGE_TOKEN, useValue: localStorage }],
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
For persistence in a backend service, you should implement your own
|
|
200
|
+
[SiWidgetStorage](./projects/dashboards-ng/src/model/si-widget-storage.ts) and provide it in
|
|
201
|
+
the library module definition.
|
|
202
|
+
|
|
203
|
+
```ts
|
|
204
|
+
SiDashboardsNgModule.forRoot({
|
|
205
|
+
config: {},
|
|
206
|
+
dashboardApi: {
|
|
207
|
+
provide: SiWidgetStorage,
|
|
208
|
+
useClass: CustomWidgetStorage
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Configuration
|
|
214
|
+
|
|
215
|
+
The dashboard is configurable through the Angular inputs of the exposed components and by
|
|
216
|
+
the usage of the configuration object `Config`, which includes a `GridConfig` and including
|
|
217
|
+
the [GridStackOptions](./projects/dashboards-ng/src/model/gridstack.model.ts).
|
|
218
|
+
|
|
219
|
+
To configure all dashboard instances, you can leverage dependency injection when importing
|
|
220
|
+
the `SiDashboardsNgModule` using `SiDashboardsNgModule.forRoot({...})`.
|
|
221
|
+
Alternatively, you have the option to configure individual dashboard instances by setting
|
|
222
|
+
the input property `SiFlexibleDashboardComponent.config = {...}`.
|
|
223
|
+
|
|
224
|
+
Here is the [demo](./src/app/pages/fixed-widgets-dashboard/fixed-widgets-dashboard.component.ts)
|
|
225
|
+
|
|
226
|
+
## License
|
|
227
|
+
|
|
228
|
+
Code and documentation copyright 2021-2025 Siemens AG.
|
|
229
|
+
|
|
230
|
+
See [LICENSE.md](../../LICENSE.md).
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"DASHBOARD": {
|
|
3
|
+
"EDIT": "Bearbeiten",
|
|
4
|
+
"SAVE": "Speichern",
|
|
5
|
+
"CANCEL": "Abbrechen",
|
|
6
|
+
"ADD_WIDGET": "Widget hinzufügen",
|
|
7
|
+
"REMOVE_WIDGET_CONFIRMATION_DIALOG": {
|
|
8
|
+
"HEADING": "Widget entfernen",
|
|
9
|
+
"MESSAGE": "Möchten Sie wirklich das Widget entfernen?",
|
|
10
|
+
"REMOVE": "Entfernen",
|
|
11
|
+
"CANCEL": "Abbrechen"
|
|
12
|
+
},
|
|
13
|
+
"WIDGET_LIBRARY": {
|
|
14
|
+
"TITLE": "Widget hinzufügen",
|
|
15
|
+
"CANCEL": "Abbrechen",
|
|
16
|
+
"ADD": "Hinzufügen",
|
|
17
|
+
"NEXT": "Weiter",
|
|
18
|
+
"PREVIOUS": "Zurück",
|
|
19
|
+
"EMPTY": "Es sind keine Widgets vorhanden.",
|
|
20
|
+
"DISCARD_CONFIG_CHANGE_DIALOG": {
|
|
21
|
+
"HEADING": "Widgetkonfiguration geändert",
|
|
22
|
+
"MESSAGE": "Die Widgetkonfiguration wurde geändert. Möchten Sie die Änderungen verwerfen?",
|
|
23
|
+
"DISCARD": "Verwerfen",
|
|
24
|
+
"CANCEL": "Abbrechen"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"WIDGET_EDITOR_DIALOG": {
|
|
28
|
+
"TITLE": "Bearbeiten",
|
|
29
|
+
"CANCEL": "Abbrechen",
|
|
30
|
+
"SAVE": "Speichern",
|
|
31
|
+
"DISCARD_CONFIG_CHANGE_DIALOG": {
|
|
32
|
+
"HEADING": "Widgetkonfiguration geändert",
|
|
33
|
+
"MESSAGE": "Die Widgetkonfiguration wurde geändert. Möchten Sie die Änderungen verwerfen?",
|
|
34
|
+
"SAVE": "Speichern",
|
|
35
|
+
"DISCARD": "Verwerfen",
|
|
36
|
+
"CANCEL": "Abbrechen"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"WIDGET": {
|
|
40
|
+
"REMOVE": "Entfernen",
|
|
41
|
+
"EDIT": "Bearbeiten",
|
|
42
|
+
"EXPAND": "Vergrößern",
|
|
43
|
+
"RESTORE": "Verkleinern"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"DASHBOARD": {
|
|
3
|
+
"EDIT": "Edit",
|
|
4
|
+
"SAVE": "Save",
|
|
5
|
+
"CANCEL": "Cancel",
|
|
6
|
+
"ADD_WIDGET": "Add widget",
|
|
7
|
+
"REMOVE_WIDGET_CONFIRMATION_DIALOG": {
|
|
8
|
+
"HEADING": "Remove widget",
|
|
9
|
+
"MESSAGE": "Do you really want to remove the widget?",
|
|
10
|
+
"REMOVE": "Remove",
|
|
11
|
+
"CANCEL": "Cancel"
|
|
12
|
+
},
|
|
13
|
+
"WIDGET_LIBRARY": {
|
|
14
|
+
"TITLE": "Add widget",
|
|
15
|
+
"CANCEL": "Cancel",
|
|
16
|
+
"ADD": "Add",
|
|
17
|
+
"NEXT": "Next",
|
|
18
|
+
"PREVIOUS": "Previous",
|
|
19
|
+
"EMPTY": "No widgets available.",
|
|
20
|
+
"DISCARD_CONFIG_CHANGE_DIALOG": {
|
|
21
|
+
"HEADING": "Widget configuration changed",
|
|
22
|
+
"MESSAGE": "The widget configuration changed. Do you want to discard the changes?",
|
|
23
|
+
"DISCARD": "Discard",
|
|
24
|
+
"CANCEL": "Cancel"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"WIDGET_EDITOR_DIALOG": {
|
|
28
|
+
"TITLE": "Edit",
|
|
29
|
+
"CANCEL": "Cancel",
|
|
30
|
+
"SAVE": "Save",
|
|
31
|
+
"DISCARD_CONFIG_CHANGE_DIALOG": {
|
|
32
|
+
"HEADING": "Widget configuration changed",
|
|
33
|
+
"MESSAGE": "The widget configuration changed. Do you want to discard the changes?",
|
|
34
|
+
"SAVE": "Save",
|
|
35
|
+
"DISCARD": "Discard",
|
|
36
|
+
"CANCEL": "Cancel"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"WIDGET": {
|
|
40
|
+
"REMOVE": "Remove",
|
|
41
|
+
"EDIT": "Edit",
|
|
42
|
+
"EXPAND": "Expand",
|
|
43
|
+
"RESTORE": "Restore"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ActivatedRoute } from '@angular/router';
|
|
2
|
+
import { MenuItem } from '@siemens/element-ng/common';
|
|
3
|
+
import { SiResponsiveContainerDirective } from '@siemens/element-ng/resize-observer';
|
|
4
|
+
import { DashboardToolbarItem } from '../../model/si-dashboard-toolbar.model';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* The toolbar of the flexible dashboard is either `editable` or not. When not
|
|
8
|
+
* `editable`, it supports content projection for applications to inject toolbar
|
|
9
|
+
* controls for e.g. filtering. Use the attribute `filters-slot` to inject the filters.
|
|
10
|
+
* In addition it shows the button to switch to the `editable`. When `editable`, it support
|
|
11
|
+
* the cancel and save buttons, as well as displaying primary and secondary actions.
|
|
12
|
+
*/
|
|
13
|
+
export declare class SiDashboardToolbarComponent {
|
|
14
|
+
/**
|
|
15
|
+
* Set primary actions that are in `editable` mode first visible or in
|
|
16
|
+
* the expanded content action bar of the toolbar.
|
|
17
|
+
*
|
|
18
|
+
* @defaultValue []
|
|
19
|
+
*/
|
|
20
|
+
readonly primaryEditActions: import("@angular/core").InputSignal<(MenuItem | DashboardToolbarItem)[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Set secondary actions that are in `editable` mode second visible or in
|
|
23
|
+
* the dropdown part of the content action bar of the toolbar.
|
|
24
|
+
*
|
|
25
|
+
* @defaultValue [] */
|
|
26
|
+
readonly secondaryEditActions: import("@angular/core").InputSignal<(MenuItem | DashboardToolbarItem)[]>;
|
|
27
|
+
/**
|
|
28
|
+
* Input to disable the save button. Note, the input `disabled` disables all
|
|
29
|
+
* actions and the save button of the toolbar.
|
|
30
|
+
*
|
|
31
|
+
* @defaultValue true
|
|
32
|
+
*/
|
|
33
|
+
readonly disableSaveButton: import("@angular/core").ModelSignal<boolean>;
|
|
34
|
+
/**
|
|
35
|
+
* Input to disable all actions and buttons of the toolbar.
|
|
36
|
+
*
|
|
37
|
+
* @defaultValue false */
|
|
38
|
+
readonly disabled: import("@angular/core").InputSignal<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* Input option to set the `editable` mode. When editable
|
|
41
|
+
* the toolbar shows a cancel and save button. Otherwise,
|
|
42
|
+
* it displays an edit button.
|
|
43
|
+
*
|
|
44
|
+
* @defaultValue false */
|
|
45
|
+
readonly editable: import("@angular/core").ModelSignal<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Option to hide the dashboard edit button.
|
|
48
|
+
*
|
|
49
|
+
* @defaultValue false
|
|
50
|
+
*/
|
|
51
|
+
readonly hideEditButton: import("@angular/core").InputSignal<boolean>;
|
|
52
|
+
/**
|
|
53
|
+
* Option to display the edit button as a text button instead, only if the window is larger than xs {@link SiResponsiveContainerDirective}.
|
|
54
|
+
*
|
|
55
|
+
* @defaultValue false
|
|
56
|
+
*/
|
|
57
|
+
readonly showEditButtonLabel: import("@angular/core").InputSignal<boolean>;
|
|
58
|
+
/**
|
|
59
|
+
* Emits on save button click.
|
|
60
|
+
*/
|
|
61
|
+
readonly save: import("@angular/core").OutputEmitterRef<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Emits on cancel button click.
|
|
64
|
+
*/
|
|
65
|
+
readonly cancel: import("@angular/core").OutputEmitterRef<void>;
|
|
66
|
+
protected labelEdit: import("@siemens/element-translate-ng/translate").TranslatableString;
|
|
67
|
+
protected labelCancel: import("@siemens/element-translate-ng/translate").TranslatableString;
|
|
68
|
+
protected labelSave: import("@siemens/element-translate-ng/translate").TranslatableString;
|
|
69
|
+
protected readonly activatedRoute: ActivatedRoute | null;
|
|
70
|
+
protected dashboardToolbarContainer: SiResponsiveContainerDirective;
|
|
71
|
+
protected readonly showContentActionBar: import("@angular/core").Signal<boolean>;
|
|
72
|
+
protected readonly editActions: import("@angular/core").Signal<(MenuItem | DashboardToolbarItem)[]>;
|
|
73
|
+
protected onEdit(): void;
|
|
74
|
+
protected onSave(): void;
|
|
75
|
+
protected onCancel(): void;
|
|
76
|
+
protected isToolbarItem(item: MenuItem | DashboardToolbarItem): item is DashboardToolbarItem;
|
|
77
|
+
protected showEditButtonLabelDesktop(): boolean;
|
|
78
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SiDashboardToolbarComponent, never>;
|
|
79
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SiDashboardToolbarComponent, "si-dashboard-toolbar", never, { "primaryEditActions": { "alias": "primaryEditActions"; "required": false; "isSignal": true; }; "secondaryEditActions": { "alias": "secondaryEditActions"; "required": false; "isSignal": true; }; "disableSaveButton": { "alias": "disableSaveButton"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "editable": { "alias": "editable"; "required": false; "isSignal": true; }; "hideEditButton": { "alias": "hideEditButton"; "required": false; "isSignal": true; }; "showEditButtonLabel": { "alias": "showEditButtonLabel"; "required": false; "isSignal": true; }; }, { "disableSaveButton": "disableSaveButtonChange"; "editable": "editableChange"; "save": "save"; "cancel": "cancel"; }, never, ["[filters-slot]"], true, never>;
|
|
80
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { OnChanges, OnDestroy, OnInit, SimpleChanges, Type, ViewContainerRef } from '@angular/core';
|
|
2
|
+
import { MenuItem } from '@siemens/element-ng/common';
|
|
3
|
+
import { SiDashboardComponent } from '@siemens/element-ng/dashboard';
|
|
4
|
+
import { BehaviorSubject } from 'rxjs';
|
|
5
|
+
import { Config } from '../../model/configuration';
|
|
6
|
+
import { DashboardToolbarItem } from '../../model/si-dashboard-toolbar.model';
|
|
7
|
+
import { Widget } from '../../model/widgets.model';
|
|
8
|
+
import { SiGridComponent } from '../grid/si-grid.component';
|
|
9
|
+
import { SiWidgetCatalogComponent } from '../widget-catalog/si-widget-catalog.component';
|
|
10
|
+
import { SiWidgetInstanceEditorDialogComponent } from '../widget-instance-editor-dialog/si-widget-instance-editor-dialog.component';
|
|
11
|
+
import * as i0 from "@angular/core";
|
|
12
|
+
/**
|
|
13
|
+
* The component implements a dashboard with adding, removing and resizing widgets.
|
|
14
|
+
* It consists and connects a toolbar, a grid with widgets, and a widget catalog.
|
|
15
|
+
*/
|
|
16
|
+
export declare class SiFlexibleDashboardComponent implements OnInit, OnChanges, OnDestroy {
|
|
17
|
+
/**
|
|
18
|
+
* Input to change the dashboard editable state.
|
|
19
|
+
*
|
|
20
|
+
* @defaultValue false
|
|
21
|
+
*/
|
|
22
|
+
readonly editable: import("@angular/core").ModelSignal<boolean>;
|
|
23
|
+
/**
|
|
24
|
+
* Heading for the dashboard.
|
|
25
|
+
*/
|
|
26
|
+
readonly heading: import("@angular/core").InputSignal<string | undefined>;
|
|
27
|
+
/**
|
|
28
|
+
* Optionally, provide a custom subclass of the SiWidgetCatalogComponent
|
|
29
|
+
* to use your own catalog component.
|
|
30
|
+
*/
|
|
31
|
+
readonly widgetCatalogComponent: import("@angular/core").InputSignal<Type<SiWidgetCatalogComponent> | undefined>;
|
|
32
|
+
/**
|
|
33
|
+
* Optionally, provide a custom subclass of the {@link SiWidgetInstanceEditorDialogComponent}
|
|
34
|
+
* to use your own implementation.
|
|
35
|
+
*/
|
|
36
|
+
readonly widgetInstanceEditorDialogComponent: import("@angular/core").InputSignal<Type<SiWidgetInstanceEditorDialogComponent> | undefined>;
|
|
37
|
+
/**
|
|
38
|
+
* Optionally, but it is recommended to include an id for a dashboard.
|
|
39
|
+
* The id is utilized in the persistence calls on the {@link SiWidgetStorage}.
|
|
40
|
+
*/
|
|
41
|
+
readonly dashboardId: import("@angular/core").InputSignal<string | undefined>;
|
|
42
|
+
/**
|
|
43
|
+
* Sets the available widgets for the widget catalog to the dashboard.
|
|
44
|
+
*
|
|
45
|
+
* @defaultValue [] */
|
|
46
|
+
readonly widgetCatalog: import("@angular/core").InputSignal<Widget[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Option to remove the add widget instance button from the primary toolbar.
|
|
49
|
+
*
|
|
50
|
+
* @defaultValue false
|
|
51
|
+
*/
|
|
52
|
+
readonly hideAddWidgetInstanceButton: import("@angular/core").InputSignal<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* Option to hide the dashboard edit button.
|
|
55
|
+
*
|
|
56
|
+
* @defaultValue false
|
|
57
|
+
*/
|
|
58
|
+
readonly hideEditButton: import("@angular/core").InputSignal<boolean>;
|
|
59
|
+
/**
|
|
60
|
+
* Option to display the edit button as a text button instead, only if the window is larger than xs {@link SiResponsiveContainerDirective}.
|
|
61
|
+
*
|
|
62
|
+
* @defaultValue false
|
|
63
|
+
*/
|
|
64
|
+
readonly showEditButtonLabel: import("@angular/core").InputSignal<boolean>;
|
|
65
|
+
/**
|
|
66
|
+
* Option to turn off the loading spinner on save and load operations.
|
|
67
|
+
*
|
|
68
|
+
* @defaultValue false
|
|
69
|
+
*/
|
|
70
|
+
readonly hideProgressIndicator: import("@angular/core").InputSignal<boolean>;
|
|
71
|
+
/**
|
|
72
|
+
* Option to configure a dashboard instance. Default is the optional value from
|
|
73
|
+
* the {@link SI_DASHBOARD_CONFIGURATION}.
|
|
74
|
+
*
|
|
75
|
+
* @defaultValue inject(SI_DASHBOARD_CONFIGURATION)
|
|
76
|
+
*/
|
|
77
|
+
readonly config: import("@angular/core").InputSignal<Config | undefined>;
|
|
78
|
+
/**
|
|
79
|
+
* Placeholder text for the search input field in the widget catalog.
|
|
80
|
+
*
|
|
81
|
+
* @defaultValue
|
|
82
|
+
* ```
|
|
83
|
+
* $localize`:@@DASHBOARD.WIDGET_LIBRARY.SEARCH_PLACEHOLDER:Search widget`
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
readonly searchPlaceholder: import("@angular/core").InputSignal<import("@siemens/element-translate-ng/translate-types").TranslatableString>;
|
|
87
|
+
/**
|
|
88
|
+
* The grid component is the actual container for the widgets.
|
|
89
|
+
*/
|
|
90
|
+
readonly grid: import("@angular/core").Signal<SiGridComponent>;
|
|
91
|
+
/** Property to access the dashboard component instance.
|
|
92
|
+
*/
|
|
93
|
+
readonly dashboard: import("@angular/core").Signal<SiDashboardComponent>;
|
|
94
|
+
/** The view child holds the container that hosts the widget catalog.
|
|
95
|
+
*/
|
|
96
|
+
protected readonly catalogHost: import("@angular/core").Signal<ViewContainerRef>;
|
|
97
|
+
/**
|
|
98
|
+
* Emits the modification state of the grid. It is `unmodified` when the visible state
|
|
99
|
+
* is equal to the loaded state from the widget storage. When the user modifies the dashboard by
|
|
100
|
+
* e.g. while moving the widgets, the dashboard is marked as `modified` and emits `true` and when the user
|
|
101
|
+
* persists the change by saving, or reverts the state by canceling, the state is `unmodified`
|
|
102
|
+
* again and emits `false`.
|
|
103
|
+
*/
|
|
104
|
+
readonly isModified: import("@angular/core").OutputEmitterRef<boolean>;
|
|
105
|
+
protected labelAddWidget: import("@siemens/element-translate-ng/translate-types").TranslatableString;
|
|
106
|
+
protected labelEditor: import("@siemens/element-translate-ng/translate-types").TranslatableString;
|
|
107
|
+
protected labelCatalog: import("@siemens/element-translate-ng/translate-types").TranslatableString;
|
|
108
|
+
protected addWidgetInstanceAction: DashboardToolbarItem;
|
|
109
|
+
/**
|
|
110
|
+
* The primary action menu items shown in the edit mode of the dashboard.
|
|
111
|
+
*/
|
|
112
|
+
readonly primaryEditActions$: BehaviorSubject<(MenuItem | DashboardToolbarItem)[]>;
|
|
113
|
+
/**
|
|
114
|
+
* The secondary action menu items shown in the edit mode of the dashboard. When all menu items are more than
|
|
115
|
+
* three, they will be places in the secondary menu of the content action bar.
|
|
116
|
+
*/
|
|
117
|
+
readonly secondaryEditActions$: BehaviorSubject<(MenuItem | DashboardToolbarItem)[]>;
|
|
118
|
+
/**
|
|
119
|
+
* @returns True, if the dashboard shows its widgets and not a catalog or and editor.
|
|
120
|
+
*/
|
|
121
|
+
readonly isDashboardVisible: import("@angular/core").Signal<boolean>;
|
|
122
|
+
/**
|
|
123
|
+
* The page title of the dashboard, which is either {@link SiFlexibleDashboardComponent.heading} for the
|
|
124
|
+
* default widget view or `DASHBOARD.WIDGET_EDITOR_DIALOG.TITLE` or 'DASHBOARD.WIDGET_LIBRARY.TITLE' when
|
|
125
|
+
* adding new or editing widgets.
|
|
126
|
+
*/
|
|
127
|
+
readonly pageTitle: import("@angular/core").Signal<string | undefined>;
|
|
128
|
+
private readonly viewState;
|
|
129
|
+
private subscriptions;
|
|
130
|
+
private widgetStorage;
|
|
131
|
+
private hideAddWidgetInstanceButton$;
|
|
132
|
+
private dashboardId$;
|
|
133
|
+
private outputRefSubscription;
|
|
134
|
+
private readonly toolbar;
|
|
135
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
136
|
+
ngOnInit(): void;
|
|
137
|
+
ngOnDestroy(): void;
|
|
138
|
+
/**
|
|
139
|
+
* Shows the widget catalog of the dashboard. If a widget instance is expanded
|
|
140
|
+
* it restores the widget instances before.
|
|
141
|
+
*/
|
|
142
|
+
showWidgetCatalog(): void;
|
|
143
|
+
protected onModified(event: boolean): void;
|
|
144
|
+
private setupMenuItems;
|
|
145
|
+
private setupPrimaryMenuItems;
|
|
146
|
+
private editWidgetInstance;
|
|
147
|
+
private proxyMenuItemAction;
|
|
148
|
+
private getWidget;
|
|
149
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SiFlexibleDashboardComponent, never>;
|
|
150
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SiFlexibleDashboardComponent, "si-flexible-dashboard", never, { "editable": { "alias": "editable"; "required": false; "isSignal": true; }; "heading": { "alias": "heading"; "required": false; "isSignal": true; }; "widgetCatalogComponent": { "alias": "widgetCatalogComponent"; "required": false; "isSignal": true; }; "widgetInstanceEditorDialogComponent": { "alias": "widgetInstanceEditorDialogComponent"; "required": false; "isSignal": true; }; "dashboardId": { "alias": "dashboardId"; "required": false; "isSignal": true; }; "widgetCatalog": { "alias": "widgetCatalog"; "required": false; "isSignal": true; }; "hideAddWidgetInstanceButton": { "alias": "hideAddWidgetInstanceButton"; "required": false; "isSignal": true; }; "hideEditButton": { "alias": "hideEditButton"; "required": false; "isSignal": true; }; "showEditButtonLabel": { "alias": "showEditButtonLabel"; "required": false; "isSignal": true; }; "hideProgressIndicator": { "alias": "hideProgressIndicator"; "required": false; "isSignal": true; }; "config": { "alias": "config"; "required": false; "isSignal": true; }; "searchPlaceholder": { "alias": "searchPlaceholder"; "required": false; "isSignal": true; }; }, { "editable": "editableChange"; "isModified": "isModified"; }, never, ["[filters-slot]", "[empty-state]"], true, never>;
|
|
151
|
+
}
|