@siemens/dashboards-ng 49.0.0-rc.1 → 49.0.0-rc.2
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 +117 -10
- package/fesm2022/siemens-dashboards-ng-native-federation-mf-bridge.mjs +38 -0
- package/fesm2022/siemens-dashboards-ng-native-federation-mf-bridge.mjs.map +1 -0
- package/fesm2022/siemens-dashboards-ng-native-federation.mjs +39 -0
- package/fesm2022/siemens-dashboards-ng-native-federation.mjs.map +1 -0
- package/fesm2022/siemens-dashboards-ng.mjs +2 -2
- package/fesm2022/siemens-dashboards-ng.mjs.map +1 -1
- package/native-federation/mf-bridge/package.json +4 -0
- package/native-federation/package.json +4 -0
- package/package.json +26 -4
- package/types/siemens-dashboards-ng-native-federation-mf-bridge.d.ts +9 -0
- package/types/siemens-dashboards-ng-native-federation.d.ts +3 -0
- package/types/siemens-dashboards-ng.d.ts +27 -4
package/README.md
CHANGED
|
@@ -28,16 +28,14 @@ providers: [
|
|
|
28
28
|
provideRouter(routes, withHashLocation()),
|
|
29
29
|
{ provide: SI_WIDGET_STORE, useClass: AppWidgetStorage },
|
|
30
30
|
{ provide: SI_DASHBOARD_CONFIGURATION, useValue: config },
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
),
|
|
40
|
-
provideAnimations(),
|
|
31
|
+
provideTranslateService({
|
|
32
|
+
loader: {
|
|
33
|
+
provide: TranslateLoader,
|
|
34
|
+
useFactory: createTranslateLoader,
|
|
35
|
+
deps: [HttpBackend]
|
|
36
|
+
},
|
|
37
|
+
missingTranslationHandler: provideMissingTranslationHandlerForElement()
|
|
38
|
+
}),
|
|
41
39
|
provideNgxTranslateForElement(),
|
|
42
40
|
provideHttpClient(withInterceptorsFromDi())
|
|
43
41
|
];
|
|
@@ -184,6 +182,115 @@ The Angular component should export the template as the public attribute `footer
|
|
|
184
182
|
@ViewChild('footer', { static: true }) footer?: TemplateRef<unknown>;
|
|
185
183
|
```
|
|
186
184
|
|
|
185
|
+
### Remote Widget Loading (Microfrontends)
|
|
186
|
+
|
|
187
|
+
The flexible dashboard supports loading widgets as remote microfrontends, allowing widgets to be deployed and updated independently from the host application. Three integration options are available:
|
|
188
|
+
|
|
189
|
+
#### Pure Module Federation (Webpack-based)
|
|
190
|
+
|
|
191
|
+
Uses `@angular-architects/module-federation` to share code between host and remote applications. Both host and remotes must use Webpack as the bundler.
|
|
192
|
+
|
|
193
|
+
Register the loader in your application bootstrap:
|
|
194
|
+
|
|
195
|
+
```ts
|
|
196
|
+
import { registerModuleFederatedWidgetLoader } from '@siemens/dashboards-ng/module-federation';
|
|
197
|
+
|
|
198
|
+
registerModuleFederatedWidgetLoader();
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
+-------------------------+ +----------------------------------+
|
|
203
|
+
| Host App | | @angular-architects/ |
|
|
204
|
+
| Module Federation |------>| module-federation |
|
|
205
|
+
| (webpack) | | |
|
|
206
|
+
+------------+------------+ +---------------^------------------+
|
|
207
|
+
| |
|
|
208
|
+
registerModuleFederatedWidgetLoader |
|
|
209
|
+
| |
|
|
210
|
+
+------------v------------+ +---------------+------------------+
|
|
211
|
+
| @siemens/dashboards-ng/ | | Remote Widget |
|
|
212
|
+
| module-federation | | Module Federation |
|
|
213
|
+
+-------------------------+ | (webpack) |
|
|
214
|
+
+----------------------------------+
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
#### Pure Native Federation (ESM-based)
|
|
218
|
+
|
|
219
|
+
Uses `@angular-architects/native-federation` with ES Module-based federation, independent of the bundler. Works with any build tool (esbuild, Vite, Webpack). Recommended for modern Angular applications.
|
|
220
|
+
|
|
221
|
+
Register the loader in your application bootstrap:
|
|
222
|
+
|
|
223
|
+
```ts
|
|
224
|
+
import { registerNativeFederatedWidgetLoader } from '@siemens/dashboards-ng/native-federation';
|
|
225
|
+
|
|
226
|
+
registerNativeFederatedWidgetLoader();
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
+-------------------------+ +----------------------------------+
|
|
231
|
+
| Host App | | @angular-architects/ |
|
|
232
|
+
| Native Federation |------>| native-federation |
|
|
233
|
+
| (esbuild/Vite/webpack) | | |
|
|
234
|
+
+------------+------------+ +---------------^------------------+
|
|
235
|
+
| |
|
|
236
|
+
registerNativeFederatedWidgetLoader |
|
|
237
|
+
| |
|
|
238
|
+
+------------v------------+ +---------------+------------------+
|
|
239
|
+
| @siemens/dashboards-ng/ | | Remote Widget |
|
|
240
|
+
| native-federation | | Native Federation |
|
|
241
|
+
+-------------------------+ | (esbuild) |
|
|
242
|
+
+----------------------------------+
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
#### Hybrid/Bridge (Native Federation + Module Federation)
|
|
246
|
+
|
|
247
|
+
Enables a Native Federation shell to load Module Federation remotes using `@module-federation/runtime`. Useful for gradual migration or when integrating existing Webpack-based remotes into a modern ESM-based host.
|
|
248
|
+
|
|
249
|
+
Register the loader with your Module Federation instance:
|
|
250
|
+
|
|
251
|
+
```ts
|
|
252
|
+
import { registerModuleFederatedWidgetLoader } from '@siemens/dashboards-ng/native-federation/mf-bridge';
|
|
253
|
+
|
|
254
|
+
registerModuleFederatedWidgetLoader(mfInstance);
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
```
|
|
258
|
+
+-------------------------+ +----------------------------------+
|
|
259
|
+
| Host App | | @angular-architects/ |
|
|
260
|
+
| Native Federation |------>| native-federation |
|
|
261
|
+
| (esbuild) | | |
|
|
262
|
+
+------------+------------+ +----------------------------------+
|
|
263
|
+
|
|
|
264
|
+
| registerModuleFederatedWidgetLoader(mfInstance)
|
|
265
|
+
|
|
|
266
|
+
+------------v-----------------------+
|
|
267
|
+
| @siemens/dashboards-ng/ |
|
|
268
|
+
| native-federation/mf-bridge |
|
|
269
|
+
+------------+-----------------------+
|
|
270
|
+
|
|
|
271
|
+
| loads
|
|
272
|
+
|
|
|
273
|
+
+------------v------------+ +----------------------------------+
|
|
274
|
+
| @module-federation/ | | Remote Widget |
|
|
275
|
+
| runtime |------>| Module Federation |
|
|
276
|
+
+-------------------------+ | (webpack) |
|
|
277
|
+
+----------------------------------+
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
For more details, refer to [Combining Native Federation and Module Federation](https://www.angulararchitects.io/blog/combining-native-federation-and-module-federation/).
|
|
281
|
+
|
|
282
|
+
#### Running the Demo Application
|
|
283
|
+
|
|
284
|
+
The [dashboard demo project](https://github.com/siemens/element/blob/main/projects/dashboards-demo/) includes examples of all microfrontend modes. Use these npm scripts to run locally:
|
|
285
|
+
|
|
286
|
+
```sh
|
|
287
|
+
# Module Federation mode (Webpack-based host and remotes)
|
|
288
|
+
npm run dashboards-demo:run-all:local
|
|
289
|
+
|
|
290
|
+
# Native Federation mode with Hybrid/Bridge support (ESM-based host with both Native and Module Federation remotes)
|
|
291
|
+
npm run dashboards-demo:run-all:esm:local
|
|
292
|
+
```
|
|
293
|
+
|
|
187
294
|
### Widget instance ID generation
|
|
188
295
|
|
|
189
296
|
Each widget instance on a dashboard requires a unique ID for identification and persistence. The library
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { widgetFactoryRegistry } from '@siemens/dashboards-ng';
|
|
2
|
+
import { Subject } from 'rxjs';
|
|
3
|
+
|
|
4
|
+
function setupRemoteComponent(factory, componentName, host, injector, environmentInjector) {
|
|
5
|
+
const result = new Subject();
|
|
6
|
+
this.loadRemote(factory.id, factory.options).then(module => {
|
|
7
|
+
if (module) {
|
|
8
|
+
const componentType = module[factory[componentName]];
|
|
9
|
+
const widgetInstanceRef = host.createComponent(componentType, {
|
|
10
|
+
injector,
|
|
11
|
+
environmentInjector
|
|
12
|
+
});
|
|
13
|
+
result.next(widgetInstanceRef);
|
|
14
|
+
}
|
|
15
|
+
result.complete();
|
|
16
|
+
}, rejection => {
|
|
17
|
+
const msg = rejection
|
|
18
|
+
? `Loading widget module ${factory.exposedModule} failed with ${JSON.stringify(rejection.toString())}`
|
|
19
|
+
: `Loading widget module ${factory.exposedModule} failed`;
|
|
20
|
+
result.error(msg);
|
|
21
|
+
result.complete();
|
|
22
|
+
});
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Use this when having native federation shell and remote module is using module federation.
|
|
27
|
+
* @param mfInstance - The ModuleFederation instance returned by `createInstance` from '\@module-federation/runtime'
|
|
28
|
+
*/
|
|
29
|
+
const registerModuleFederatedWidgetLoader = (mfInstance) => {
|
|
30
|
+
widgetFactoryRegistry.register('native-federation-module-bridge', setupRemoteComponent.bind(mfInstance));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Generated bundle index. Do not edit.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
export { registerModuleFederatedWidgetLoader };
|
|
38
|
+
//# sourceMappingURL=siemens-dashboards-ng-native-federation-mf-bridge.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"siemens-dashboards-ng-native-federation-mf-bridge.mjs","sources":["../../../../projects/dashboards-ng/native-federation/mf-bridge/index.ts","../../../../projects/dashboards-ng/native-federation/mf-bridge/siemens-dashboards-ng-native-federation-mf-bridge.ts"],"sourcesContent":["/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nimport { ComponentRef, EnvironmentInjector, Injector, ViewContainerRef, Type } from '@angular/core';\nimport { ModuleFederation } from '@module-federation/runtime';\nimport {\n FederatedBridgeModule,\n SetupComponentFn,\n widgetFactoryRegistry\n} from '@siemens/dashboards-ng';\nimport { Observable, Subject } from 'rxjs';\n\nfunction setupRemoteComponent<T>(\n this: ModuleFederation,\n factory: FederatedBridgeModule,\n componentName: string,\n host: ViewContainerRef,\n injector: Injector,\n environmentInjector: EnvironmentInjector\n): Observable<ComponentRef<T>> {\n const result = new Subject<ComponentRef<T>>();\n this.loadRemote<Type<T>[]>(factory.id, factory.options).then(\n module => {\n if (module) {\n const componentType = module[factory[componentName]];\n const widgetInstanceRef = host.createComponent<T>(componentType, {\n injector,\n environmentInjector\n });\n result.next(widgetInstanceRef);\n }\n result.complete();\n },\n rejection => {\n const msg = rejection\n ? `Loading widget module ${factory.exposedModule} failed with ${JSON.stringify(\n rejection.toString()\n )}`\n : `Loading widget module ${factory.exposedModule} failed`;\n result.error(msg);\n result.complete();\n }\n );\n return result;\n}\n\n/**\n * Use this when having native federation shell and remote module is using module federation.\n * @param mfInstance - The ModuleFederation instance returned by `createInstance` from '\\@module-federation/runtime'\n */\nexport const registerModuleFederatedWidgetLoader = (mfInstance: ModuleFederation): void => {\n widgetFactoryRegistry.register(\n 'native-federation-module-bridge',\n setupRemoteComponent.bind(mfInstance) as SetupComponentFn\n );\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAaA,SAAS,oBAAoB,CAE3B,OAA8B,EAC9B,aAAqB,EACrB,IAAsB,EACtB,QAAkB,EAClB,mBAAwC,EAAA;AAExC,IAAA,MAAM,MAAM,GAAG,IAAI,OAAO,EAAmB;AAC7C,IAAA,IAAI,CAAC,UAAU,CAAY,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CAC1D,MAAM,IAAG;QACP,IAAI,MAAM,EAAE;YACV,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;AACpD,YAAA,MAAM,iBAAiB,GAAG,IAAI,CAAC,eAAe,CAAI,aAAa,EAAE;gBAC/D,QAAQ;gBACR;AACD,aAAA,CAAC;AACF,YAAA,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC;QAChC;QACA,MAAM,CAAC,QAAQ,EAAE;IACnB,CAAC,EACD,SAAS,IAAG;QACV,MAAM,GAAG,GAAG;AACV,cAAE,CAAA,sBAAA,EAAyB,OAAO,CAAC,aAAa,CAAA,aAAA,EAAgB,IAAI,CAAC,SAAS,CAC1E,SAAS,CAAC,QAAQ,EAAE,CACrB,CAAA;AACH,cAAE,CAAA,sBAAA,EAAyB,OAAO,CAAC,aAAa,SAAS;AAC3D,QAAA,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;QACjB,MAAM,CAAC,QAAQ,EAAE;AACnB,IAAA,CAAC,CACF;AACD,IAAA,OAAO,MAAM;AACf;AAEA;;;AAGG;AACI,MAAM,mCAAmC,GAAG,CAAC,UAA4B,KAAU;AACxF,IAAA,qBAAqB,CAAC,QAAQ,CAC5B,iCAAiC,EACjC,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAqB,CAC1D;AACH;;ACxDA;;AAEG;;;;"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { loadRemoteModule } from '@angular-architects/native-federation';
|
|
2
|
+
import { widgetFactoryRegistry } from '@siemens/dashboards-ng';
|
|
3
|
+
import { Subject } from 'rxjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Copyright (c) Siemens 2016 - 2025
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
*/
|
|
9
|
+
const setupRemoteComponent = (factory, componentName, host, injector, environmentInjector) => {
|
|
10
|
+
const result = new Subject();
|
|
11
|
+
loadRemoteModule(factory).then(module => {
|
|
12
|
+
if (module) {
|
|
13
|
+
const componentType = module[factory[componentName]];
|
|
14
|
+
const widgetInstanceRef = host.createComponent(componentType, {
|
|
15
|
+
injector,
|
|
16
|
+
environmentInjector
|
|
17
|
+
});
|
|
18
|
+
result.next(widgetInstanceRef);
|
|
19
|
+
}
|
|
20
|
+
result.complete();
|
|
21
|
+
}, rejection => {
|
|
22
|
+
const msg = rejection
|
|
23
|
+
? `Loading widget module ${factory.exposedModule} failed with ${JSON.stringify(rejection.toString())}`
|
|
24
|
+
: `Loading widget module ${factory.exposedModule} failed`;
|
|
25
|
+
result.error(msg);
|
|
26
|
+
result.complete();
|
|
27
|
+
});
|
|
28
|
+
return result;
|
|
29
|
+
};
|
|
30
|
+
const registerNativeFederatedWidgetLoader = () => {
|
|
31
|
+
widgetFactoryRegistry.register('native-federation', setupRemoteComponent);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Generated bundle index. Do not edit.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
export { registerNativeFederatedWidgetLoader };
|
|
39
|
+
//# sourceMappingURL=siemens-dashboards-ng-native-federation.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"siemens-dashboards-ng-native-federation.mjs","sources":["../../../../projects/dashboards-ng/native-federation/index.ts","../../../../projects/dashboards-ng/native-federation/siemens-dashboards-ng-native-federation.ts"],"sourcesContent":["/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nimport { loadRemoteModule } from '@angular-architects/native-federation';\nimport { ComponentRef, EnvironmentInjector, Injector, ViewContainerRef, Type } from '@angular/core';\nimport { FederatedModule, SetupComponentFn, widgetFactoryRegistry } from '@siemens/dashboards-ng';\nimport { Observable, Subject } from 'rxjs';\n\nconst setupRemoteComponent = <T>(\n factory: FederatedModule,\n componentName: string,\n host: ViewContainerRef,\n injector: Injector,\n environmentInjector: EnvironmentInjector\n): Observable<ComponentRef<T>> => {\n const result = new Subject<ComponentRef<T>>();\n\n loadRemoteModule<Type<T>[]>(factory).then(\n module => {\n if (module) {\n const componentType = module[factory[componentName]];\n const widgetInstanceRef = host.createComponent<T>(componentType, {\n injector,\n environmentInjector\n });\n result.next(widgetInstanceRef);\n }\n result.complete();\n },\n rejection => {\n const msg = rejection\n ? `Loading widget module ${factory.exposedModule} failed with ${JSON.stringify(\n rejection.toString()\n )}`\n : `Loading widget module ${factory.exposedModule} failed`;\n result.error(msg);\n result.complete();\n }\n );\n return result;\n};\n\nexport const registerNativeFederatedWidgetLoader = (): void => {\n widgetFactoryRegistry.register('native-federation', setupRemoteComponent as SetupComponentFn);\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAAA;;;AAGG;AAMH,MAAM,oBAAoB,GAAG,CAC3B,OAAwB,EACxB,aAAqB,EACrB,IAAsB,EACtB,QAAkB,EAClB,mBAAwC,KACT;AAC/B,IAAA,MAAM,MAAM,GAAG,IAAI,OAAO,EAAmB;IAE7C,gBAAgB,CAAY,OAAO,CAAC,CAAC,IAAI,CACvC,MAAM,IAAG;QACP,IAAI,MAAM,EAAE;YACV,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;AACpD,YAAA,MAAM,iBAAiB,GAAG,IAAI,CAAC,eAAe,CAAI,aAAa,EAAE;gBAC/D,QAAQ;gBACR;AACD,aAAA,CAAC;AACF,YAAA,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC;QAChC;QACA,MAAM,CAAC,QAAQ,EAAE;IACnB,CAAC,EACD,SAAS,IAAG;QACV,MAAM,GAAG,GAAG;AACV,cAAE,CAAA,sBAAA,EAAyB,OAAO,CAAC,aAAa,CAAA,aAAA,EAAgB,IAAI,CAAC,SAAS,CAC1E,SAAS,CAAC,QAAQ,EAAE,CACrB,CAAA;AACH,cAAE,CAAA,sBAAA,EAAyB,OAAO,CAAC,aAAa,SAAS;AAC3D,QAAA,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;QACjB,MAAM,CAAC,QAAQ,EAAE;AACnB,IAAA,CAAC,CACF;AACD,IAAA,OAAO,MAAM;AACf,CAAC;AAEM,MAAM,mCAAmC,GAAG,MAAW;AAC5D,IAAA,qBAAqB,CAAC,QAAQ,CAAC,mBAAmB,EAAE,oBAAwC,CAAC;AAC/F;;AC7CA;;AAEG;;;;"}
|
|
@@ -239,7 +239,7 @@ class SiDashboardToolbarComponent {
|
|
|
239
239
|
return this.showEditButtonLabel() && !this.dashboardToolbarContainer()?.xs();
|
|
240
240
|
}, ...(ngDevMode ? [{ debugName: "showEditButtonLabelDesktop" }] : []));
|
|
241
241
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiDashboardToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
242
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.8", type: SiDashboardToolbarComponent, isStandalone: true, selector: "si-dashboard-toolbar", inputs: { primaryEditActions: { classPropertyName: "primaryEditActions", publicName: "primaryEditActions", isSignal: true, isRequired: false, transformFunction: null }, secondaryEditActions: { classPropertyName: "secondaryEditActions", publicName: "secondaryEditActions", isSignal: true, isRequired: false, transformFunction: null }, disableSaveButton: { classPropertyName: "disableSaveButton", publicName: "disableSaveButton", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, editable: { classPropertyName: "editable", publicName: "editable", isSignal: true, isRequired: false, transformFunction: null }, hideEditButton: { classPropertyName: "hideEditButton", publicName: "hideEditButton", isSignal: true, isRequired: false, transformFunction: null }, showEditButtonLabel: { classPropertyName: "showEditButtonLabel", publicName: "showEditButtonLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disableSaveButton: "disableSaveButtonChange", editable: "editableChange", save: "save", cancel: "cancel" }, viewQueries: [{ propertyName: "dashboardToolbarContainer", first: true, predicate: SiResponsiveContainerDirective, descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"row mb-3\" siResponsiveContainer>\n <div class=\"col-12 d-flex justify-content-between\">\n @if (!editable()) {\n <ng-content select=\"[filters-slot]\" />\n @if (!hideEditButton()) {\n @let showEditButtonLabelDesktop = this.showEditButtonLabelDesktop();\n <button\n type=\"button\"\n class=\"btn ms-auto\"\n [class]=\"\n showEditButtonLabelDesktop
|
|
242
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.8", type: SiDashboardToolbarComponent, isStandalone: true, selector: "si-dashboard-toolbar", inputs: { primaryEditActions: { classPropertyName: "primaryEditActions", publicName: "primaryEditActions", isSignal: true, isRequired: false, transformFunction: null }, secondaryEditActions: { classPropertyName: "secondaryEditActions", publicName: "secondaryEditActions", isSignal: true, isRequired: false, transformFunction: null }, disableSaveButton: { classPropertyName: "disableSaveButton", publicName: "disableSaveButton", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, editable: { classPropertyName: "editable", publicName: "editable", isSignal: true, isRequired: false, transformFunction: null }, hideEditButton: { classPropertyName: "hideEditButton", publicName: "hideEditButton", isSignal: true, isRequired: false, transformFunction: null }, showEditButtonLabel: { classPropertyName: "showEditButtonLabel", publicName: "showEditButtonLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disableSaveButton: "disableSaveButtonChange", editable: "editableChange", save: "save", cancel: "cancel" }, viewQueries: [{ propertyName: "dashboardToolbarContainer", first: true, predicate: SiResponsiveContainerDirective, descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"row mb-3\" siResponsiveContainer>\n <div class=\"col-12 d-flex justify-content-between\">\n @if (!editable()) {\n <ng-content select=\"[filters-slot]\" />\n @if (!hideEditButton()) {\n @let showEditButtonLabelDesktop = this.showEditButtonLabelDesktop();\n <button\n type=\"button\"\n class=\"btn ms-auto\"\n [class]=\"\n showEditButtonLabelDesktop ? 'btn-secondary' : 'btn-circle btn-tertiary element-edit'\n \"\n [attr.aria-label]=\"labelEdit | translate\"\n [attr.title]=\"!showEditButtonLabelDesktop ? (labelEdit | translate) : undefined\"\n [disabled]=\"disabled()\"\n (click)=\"onEdit()\"\n >\n @if (showEditButtonLabelDesktop) {\n {{ labelEdit | translate }}\n }\n </button>\n }\n } @else {\n @if (showContentActionBar()) {\n <si-content-action-bar\n toggleItemLabel=\"toggle\"\n viewType=\"expanded\"\n [disabled]=\"disabled()\"\n [primaryActions]=\"primaryEditActions()\"\n [secondaryActions]=\"secondaryEditActions()\"\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 <!-- eslint-disable @angular-eslint/template/no-any -->\n <!-- This item has a patched action which will inject the grid. But our types do not reflect this. -->\n <!-- TODO: make our types reflect that this item has a patched action. -->\n <button\n type=\"button\"\n class=\"btn btn-secondary me-4\"\n (click)=\"$any(action.action)()\"\n >\n {{ action.label! | translate }}\n </button>\n <!-- eslint-disable-enable @angular-eslint/template/no-any -->\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 <button\n type=\"button\"\n class=\"btn btn-primary\"\n [disabled]=\"disableSaveButton() || disabled()\"\n (click)=\"onSave()\"\n >\n @if (disabled()) {\n <si-loading-spinner />\n } @else {\n <span>{{ labelSave | translate }}</span>\n }\n </button>\n </div>\n }\n </div>\n</div>\n", styles: [":host{display:flex;flex:1 1 0;flex-direction:column}si-loading-spinner{--loading-spinner-size: 1rem;--loading-spinner-color: var(--element-text-inverse)}\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: SiLoadingSpinnerComponent, selector: "si-loading-spinner", inputs: ["isBlockingSpinner", "isSpinnerOverlay", "ariaLabel"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: SiResponsiveContainerDirective, selector: "[siResponsiveContainer]", inputs: ["resizeThrottle", "breakpoints"], exportAs: ["siResponsiveContainer"] }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }] });
|
|
243
243
|
}
|
|
244
244
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiDashboardToolbarComponent, decorators: [{
|
|
245
245
|
type: Component,
|
|
@@ -250,7 +250,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
|
|
|
250
250
|
RouterLink,
|
|
251
251
|
SiResponsiveContainerDirective,
|
|
252
252
|
SiTranslatePipe
|
|
253
|
-
], template: "<div class=\"row mb-3\" siResponsiveContainer>\n <div class=\"col-12 d-flex justify-content-between\">\n @if (!editable()) {\n <ng-content select=\"[filters-slot]\" />\n @if (!hideEditButton()) {\n @let showEditButtonLabelDesktop = this.showEditButtonLabelDesktop();\n <button\n type=\"button\"\n class=\"btn ms-auto\"\n [class]=\"\n showEditButtonLabelDesktop
|
|
253
|
+
], template: "<div class=\"row mb-3\" siResponsiveContainer>\n <div class=\"col-12 d-flex justify-content-between\">\n @if (!editable()) {\n <ng-content select=\"[filters-slot]\" />\n @if (!hideEditButton()) {\n @let showEditButtonLabelDesktop = this.showEditButtonLabelDesktop();\n <button\n type=\"button\"\n class=\"btn ms-auto\"\n [class]=\"\n showEditButtonLabelDesktop ? 'btn-secondary' : 'btn-circle btn-tertiary element-edit'\n \"\n [attr.aria-label]=\"labelEdit | translate\"\n [attr.title]=\"!showEditButtonLabelDesktop ? (labelEdit | translate) : undefined\"\n [disabled]=\"disabled()\"\n (click)=\"onEdit()\"\n >\n @if (showEditButtonLabelDesktop) {\n {{ labelEdit | translate }}\n }\n </button>\n }\n } @else {\n @if (showContentActionBar()) {\n <si-content-action-bar\n toggleItemLabel=\"toggle\"\n viewType=\"expanded\"\n [disabled]=\"disabled()\"\n [primaryActions]=\"primaryEditActions()\"\n [secondaryActions]=\"secondaryEditActions()\"\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 <!-- eslint-disable @angular-eslint/template/no-any -->\n <!-- This item has a patched action which will inject the grid. But our types do not reflect this. -->\n <!-- TODO: make our types reflect that this item has a patched action. -->\n <button\n type=\"button\"\n class=\"btn btn-secondary me-4\"\n (click)=\"$any(action.action)()\"\n >\n {{ action.label! | translate }}\n </button>\n <!-- eslint-disable-enable @angular-eslint/template/no-any -->\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 <button\n type=\"button\"\n class=\"btn btn-primary\"\n [disabled]=\"disableSaveButton() || disabled()\"\n (click)=\"onSave()\"\n >\n @if (disabled()) {\n <si-loading-spinner />\n } @else {\n <span>{{ labelSave | translate }}</span>\n }\n </button>\n </div>\n }\n </div>\n</div>\n", styles: [":host{display:flex;flex:1 1 0;flex-direction:column}si-loading-spinner{--loading-spinner-size: 1rem;--loading-spinner-color: var(--element-text-inverse)}\n"] }]
|
|
254
254
|
}], 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 }] }], save: [{ type: i0.Output, args: ["save"] }], cancel: [{ type: i0.Output, args: ["cancel"] }], dashboardToolbarContainer: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SiResponsiveContainerDirective), { isSignal: true }] }] } });
|
|
255
255
|
|
|
256
256
|
/**
|