@valtimo/dashboard-management 10.8.0 → 11.1.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.
Files changed (37) hide show
  1. package/esm2022/lib/components/dashboard-details/dashboard-details.component.mjs +153 -0
  2. package/esm2022/lib/components/dashboard-management/dashboard-management.component.mjs +119 -0
  3. package/esm2022/lib/components/edit-dashboard-modal/edit-dashboard-modal.mjs +99 -0
  4. package/esm2022/lib/components/widget-configuration-container/widget-configuration-container.component.mjs +137 -0
  5. package/esm2022/lib/components/widget-modal/widget-modal.component.mjs +250 -0
  6. package/{esm2020 → esm2022}/lib/dashboard-management-routing.module.mjs +5 -5
  7. package/esm2022/lib/dashboard-management.module.mjs +100 -0
  8. package/esm2022/lib/models/dashboard-item.type.mjs +17 -0
  9. package/esm2022/lib/models/index.mjs +18 -0
  10. package/esm2022/lib/models/widget.model.mjs +17 -0
  11. package/esm2022/lib/services/dashboard-management.service.mjs +88 -0
  12. package/{esm2020 → esm2022}/public-api.mjs +2 -2
  13. package/fesm2022/valtimo-dashboard-management.mjs +969 -0
  14. package/fesm2022/valtimo-dashboard-management.mjs.map +1 -0
  15. package/lib/components/dashboard-details/dashboard-details.component.d.ts +4 -4
  16. package/lib/components/dashboard-management/dashboard-management.component.d.ts +4 -4
  17. package/lib/components/edit-dashboard-modal/edit-dashboard-modal.d.ts +1 -1
  18. package/lib/components/widget-configuration-container/widget-configuration-container.component.d.ts +1 -1
  19. package/lib/components/widget-modal/widget-modal.component.d.ts +1 -1
  20. package/lib/dashboard-management.module.d.ts +4 -4
  21. package/lib/models/widget.model.d.ts +1 -1
  22. package/package.json +8 -14
  23. package/esm2020/lib/components/dashboard-details/dashboard-details.component.mjs +0 -155
  24. package/esm2020/lib/components/dashboard-management/dashboard-management.component.mjs +0 -106
  25. package/esm2020/lib/components/edit-dashboard-modal/edit-dashboard-modal.mjs +0 -99
  26. package/esm2020/lib/components/widget-configuration-container/widget-configuration-container.component.mjs +0 -137
  27. package/esm2020/lib/components/widget-modal/widget-modal.component.mjs +0 -235
  28. package/esm2020/lib/dashboard-management.module.mjs +0 -100
  29. package/esm2020/lib/models/dashboard-item.type.mjs +0 -2
  30. package/esm2020/lib/models/index.mjs +0 -3
  31. package/esm2020/lib/models/widget.model.mjs +0 -2
  32. package/esm2020/lib/services/dashboard-management.service.mjs +0 -88
  33. package/fesm2015/valtimo-dashboard-management.mjs +0 -949
  34. package/fesm2015/valtimo-dashboard-management.mjs.map +0 -1
  35. package/fesm2020/valtimo-dashboard-management.mjs +0 -940
  36. package/fesm2020/valtimo-dashboard-management.mjs.map +0 -1
  37. /package/{esm2020 → esm2022}/valtimo-dashboard-management.mjs +0 -0
@@ -0,0 +1,969 @@
1
+ import * as i2$2 from '@angular/common';
2
+ import { DOCUMENT, CommonModule } from '@angular/common';
3
+ import * as i0 from '@angular/core';
4
+ import { Injectable, EventEmitter, ViewContainerRef, Component, ViewChild, Input, Output, ViewEncapsulation, Inject, ChangeDetectionStrategy, NgModule } from '@angular/core';
5
+ import * as i1$1 from '@angular/forms';
6
+ import { Validators, ReactiveFormsModule } from '@angular/forms';
7
+ import * as i2$1 from '@ngx-translate/core';
8
+ import { TranslateModule } from '@ngx-translate/core';
9
+ import * as i4 from '@valtimo/components';
10
+ import { CARBON_CONSTANTS, ViewType, ListModule, SpinnerModule, RenderInPageHeaderDirectiveModule, ConfirmationModalModule, CarbonListModule } from '@valtimo/components';
11
+ import * as i3 from 'carbon-components-angular';
12
+ import { NotificationService, ButtonModule, DropdownModule, InputModule, ModalModule, NotificationModule, IconModule } from 'carbon-components-angular';
13
+ import { ArrowDown16, ArrowUp16, Edit16 } from '@carbon/icons';
14
+ import { take, tap, BehaviorSubject, switchMap, catchError, of, Subscription, combineLatest, filter, map, finalize } from 'rxjs';
15
+ import * as i1 from '@angular/common/http';
16
+ import * as i2 from '@valtimo/config';
17
+ import { ROLE_ADMIN } from '@valtimo/config';
18
+ import * as i5$1 from '@angular/router';
19
+ import { RouterModule } from '@angular/router';
20
+ import * as i5 from '@valtimo/dashboard';
21
+ import { WidgetTranslatePipeModule } from '@valtimo/dashboard';
22
+ import { tap as tap$1 } from 'rxjs/operators';
23
+ import { AuthGuardService } from '@valtimo/security';
24
+
25
+ class DashboardManagementService {
26
+ loadData() {
27
+ this.http
28
+ .get(this.valtimoEndpointUri)
29
+ .pipe(take(1), tap(() => {
30
+ this.dashboards$.next({ items: null, loading: true });
31
+ }))
32
+ .subscribe({
33
+ next: (items) => {
34
+ this.dashboards$.next({ items, loading: false });
35
+ },
36
+ error: error => {
37
+ console.error(error);
38
+ },
39
+ });
40
+ }
41
+ constructor(http, configService) {
42
+ this.http = http;
43
+ this.configService = configService;
44
+ this.dashboards$ = new BehaviorSubject({
45
+ items: null,
46
+ loading: true,
47
+ });
48
+ this.valtimoEndpointUri = `${this.configService.config.valtimoApi.endpointUri}management/v1/dashboard`;
49
+ }
50
+ createDashboard(dashboard) {
51
+ return this.http.post(this.valtimoEndpointUri, dashboard);
52
+ }
53
+ updateDashboards(dashboards) {
54
+ return this.http.put(this.valtimoEndpointUri, dashboards);
55
+ }
56
+ updateDashboard(dashboard) {
57
+ return this.http.put(`${this.valtimoEndpointUri}/${dashboard.key}`, dashboard);
58
+ }
59
+ deleteDashboard(dashboardKey) {
60
+ return this.http.delete(`${this.valtimoEndpointUri}/${dashboardKey}`);
61
+ }
62
+ dispatchAction(actionResult) {
63
+ actionResult
64
+ .pipe(switchMap(() => this.getDashboards()), tap(() => {
65
+ this.dashboards$.next({ items: null, loading: true });
66
+ }), take(1), catchError(error => of(error)))
67
+ .subscribe({
68
+ next: (items) => this.dashboards$.next({ items, loading: false }),
69
+ error: error => {
70
+ console.error(error);
71
+ },
72
+ });
73
+ }
74
+ getDashboard(dashboardKey) {
75
+ return this.http.get(`${this.valtimoEndpointUri}/${dashboardKey}`);
76
+ }
77
+ getDashboardWidgetConfiguration(dashboardKey) {
78
+ return this.http.get(`${this.valtimoEndpointUri}/${dashboardKey}/widget-configuration`);
79
+ }
80
+ createDashboardWidgetConfiguration(dashboardKey, widgetConfiguration) {
81
+ return this.http.post(`${this.valtimoEndpointUri}/${dashboardKey}/widget-configuration`, widgetConfiguration);
82
+ }
83
+ updateDashboardWidgetConfigurations(dashboardKey, widgetConfigurations) {
84
+ return this.http.put(`${this.valtimoEndpointUri}/${dashboardKey}/widget-configuration`, widgetConfigurations);
85
+ }
86
+ updateDashboardWidgetConfiguration(dashboardKey, widgetConfiguration) {
87
+ return this.http.put(`${this.valtimoEndpointUri}/${dashboardKey}/widget-configuration/${widgetConfiguration.key}`, widgetConfiguration);
88
+ }
89
+ deleteDashboardWidgetConfiguration(dashboardKey, widgetKey) {
90
+ return this.http.delete(`${this.valtimoEndpointUri}/${dashboardKey}/widget-configuration/${widgetKey}`);
91
+ }
92
+ getDataSources() {
93
+ return this.http.get(`${this.valtimoEndpointUri}/widget-data-sources`);
94
+ }
95
+ getDashboards() {
96
+ return this.http.get(this.valtimoEndpointUri);
97
+ }
98
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DashboardManagementService, deps: [{ token: i1.HttpClient }, { token: i2.ConfigService }], target: i0.ɵɵFactoryTarget.Injectable }); }
99
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DashboardManagementService, providedIn: 'root' }); }
100
+ }
101
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DashboardManagementService, decorators: [{
102
+ type: Injectable,
103
+ args: [{
104
+ providedIn: 'root',
105
+ }]
106
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i2.ConfigService }]; } });
107
+
108
+ /*
109
+ * Copyright 2015-2023 Ritense BV, the Netherlands.
110
+ *
111
+ * Licensed under EUPL, Version 1.2 (the "License");
112
+ * you may not use this file except in compliance with the License.
113
+ * You may obtain a copy of the License at
114
+ *
115
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
116
+ *
117
+ * Unless required by applicable law or agreed to in writing, software
118
+ * distributed under the License is distributed on an "AS IS" basis,
119
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
120
+ * See the License for the specific language governing permissions and
121
+ * limitations under the License.
122
+ */
123
+ class WidgetConfigurationContainerComponent {
124
+ set dataSourceKey(value) {
125
+ this._dataSourceKey$.next(value);
126
+ }
127
+ set displayTypeKey(value) {
128
+ this._displayTypeKey$.next(value);
129
+ }
130
+ set disabled(disabledValue) {
131
+ this._disabled$.next(disabledValue);
132
+ }
133
+ set prefillConfiguration(prefillConfigurationValue) {
134
+ this._prefillConfiguration$.next(prefillConfigurationValue);
135
+ }
136
+ constructor(widgetService) {
137
+ this.widgetService = widgetService;
138
+ this.configurationEvent = new EventEmitter();
139
+ this._subscriptions = new Subscription();
140
+ this._componentRef$ = new BehaviorSubject(undefined);
141
+ this._dataSourceKey$ = new BehaviorSubject('');
142
+ this._displayTypeKey$ = new BehaviorSubject('');
143
+ this._disabled$ = new BehaviorSubject(false);
144
+ this._prefillConfiguration$ = new BehaviorSubject(null);
145
+ }
146
+ ngOnInit() {
147
+ this.openConfigurationComponentSubscription();
148
+ this.openComponentInstanceSubscription();
149
+ this.openDisabledSubscription();
150
+ this.openPrefillConfigurationSubscription();
151
+ }
152
+ ngOnDestroy() {
153
+ this._subscriptions.unsubscribe();
154
+ }
155
+ openConfigurationComponentSubscription() {
156
+ this._subscriptions.add(combineLatest([
157
+ this._displayTypeKey$,
158
+ this._dataSourceKey$,
159
+ this.widgetService.supportedDisplayTypes$,
160
+ this.widgetService.supportedDataSources$,
161
+ ])
162
+ .pipe(tap$1(([displayTypeKey, dataSourceKey, supportedDisplayTypes, supportedDataSources]) => {
163
+ let configurationComponent;
164
+ this._dynamicContainer.clear();
165
+ const displayTypeSpecification = displayTypeKey &&
166
+ supportedDisplayTypes.find(type => type.displayTypeKey === displayTypeKey);
167
+ const dataSourceSpecification = dataSourceKey &&
168
+ supportedDataSources.find(source => source.dataSourceKey === dataSourceKey);
169
+ if (displayTypeSpecification && displayTypeSpecification.configurationComponent) {
170
+ configurationComponent = displayTypeSpecification.configurationComponent;
171
+ }
172
+ else if (dataSourceSpecification && dataSourceSpecification.configurationComponent) {
173
+ configurationComponent = dataSourceSpecification.configurationComponent;
174
+ }
175
+ if (configurationComponent) {
176
+ const componentRef = this._dynamicContainer.createComponent(configurationComponent);
177
+ this.configurationEvent.emit({ valid: false, data: {} });
178
+ this._componentRef$.next(componentRef);
179
+ }
180
+ else {
181
+ this.configurationEvent.emit({ valid: true, data: {} });
182
+ }
183
+ }))
184
+ .subscribe());
185
+ }
186
+ openComponentInstanceSubscription() {
187
+ this._subscriptions.add(combineLatest([this._componentRef$, this._dataSourceKey$, this._displayTypeKey$]).subscribe(([ref, dataSourceKey, displayTypeKey]) => {
188
+ const instance = ref?.instance;
189
+ this._configurationSubscription?.unsubscribe();
190
+ if (instance) {
191
+ if (displayTypeKey) {
192
+ instance.displayTypeKey = displayTypeKey;
193
+ }
194
+ else if (dataSourceKey) {
195
+ instance.dataSourceKey = dataSourceKey;
196
+ }
197
+ this._configurationSubscription = instance.configurationEvent.subscribe(configuration => {
198
+ this.configurationEvent.emit(configuration);
199
+ });
200
+ }
201
+ }));
202
+ }
203
+ openDisabledSubscription() {
204
+ this._subscriptions.add(combineLatest([this._componentRef$, this._disabled$]).subscribe(([ref, disabled]) => {
205
+ const instance = ref?.instance;
206
+ if (instance) {
207
+ instance.disabled = disabled;
208
+ }
209
+ }));
210
+ }
211
+ openPrefillConfigurationSubscription() {
212
+ this._subscriptions.add(combineLatest([this._componentRef$, this._prefillConfiguration$]).subscribe(([ref, prefillConfiguration]) => {
213
+ const instance = ref?.instance;
214
+ if (instance && prefillConfiguration) {
215
+ instance.prefillConfiguration = prefillConfiguration;
216
+ }
217
+ }));
218
+ }
219
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WidgetConfigurationContainerComponent, deps: [{ token: i5.WidgetService }], target: i0.ɵɵFactoryTarget.Component }); }
220
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: WidgetConfigurationContainerComponent, selector: "valtimo-widget-configuration-container", inputs: { dataSourceKey: "dataSourceKey", displayTypeKey: "displayTypeKey", disabled: "disabled", prefillConfiguration: "prefillConfiguration" }, outputs: { configurationEvent: "configurationEvent" }, viewQueries: [{ propertyName: "_dynamicContainer", first: true, predicate: ["widgetConfigurationComponent"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-template #widgetConfigurationComponent></ng-template>\n" }); }
221
+ }
222
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WidgetConfigurationContainerComponent, decorators: [{
223
+ type: Component,
224
+ args: [{ selector: 'valtimo-widget-configuration-container', template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-template #widgetConfigurationComponent></ng-template>\n" }]
225
+ }], ctorParameters: function () { return [{ type: i5.WidgetService }]; }, propDecorators: { _dynamicContainer: [{
226
+ type: ViewChild,
227
+ args: ['widgetConfigurationComponent', { static: true, read: ViewContainerRef }]
228
+ }], dataSourceKey: [{
229
+ type: Input
230
+ }], displayTypeKey: [{
231
+ type: Input
232
+ }], disabled: [{
233
+ type: Input
234
+ }], prefillConfiguration: [{
235
+ type: Input
236
+ }], configurationEvent: [{
237
+ type: Output
238
+ }] } });
239
+
240
+ /*
241
+ * Copyright 2015-2023 Ritense BV, the Netherlands.
242
+ *
243
+ * Licensed under EUPL, Version 1.2 (the "License");
244
+ * you may not use this file except in compliance with the License.
245
+ * You may obtain a copy of the License at
246
+ *
247
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
248
+ *
249
+ * Unless required by applicable law or agreed to in writing, software
250
+ * distributed under the License is distributed on an "AS IS" basis,
251
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
252
+ * See the License for the specific language governing permissions and
253
+ * limitations under the License.
254
+ */
255
+ class WidgetModalComponent {
256
+ set editWidgetConfiguration(configuration) {
257
+ if (configuration) {
258
+ this.title.setValue(configuration.title);
259
+ this.dataSourceSelected({ item: { key: configuration.dataSourceKey } });
260
+ this.displayTypeSelected({ item: { key: configuration.displayType } });
261
+ this.dataSourcePrefillConfig$.next(configuration.dataSourceProperties);
262
+ this.displayTypePrefillConfig$.next(configuration.displayTypeProperties);
263
+ }
264
+ else {
265
+ this.dataSourcePrefillConfig$.next(null);
266
+ this.displayTypePrefillConfig$.next(null);
267
+ }
268
+ }
269
+ get title() {
270
+ return this.form.get('title');
271
+ }
272
+ get key() {
273
+ return this.form.get('key');
274
+ }
275
+ get dataSource() {
276
+ return this.form.get('dataSource');
277
+ }
278
+ get displayType() {
279
+ return this.form.get('displayType');
280
+ }
281
+ constructor(document, fb, translateService, notificationService, dashboardManagementService, widgetService, widgetTranslationService) {
282
+ this.document = document;
283
+ this.fb = fb;
284
+ this.translateService = translateService;
285
+ this.notificationService = notificationService;
286
+ this.dashboardManagementService = dashboardManagementService;
287
+ this.widgetService = widgetService;
288
+ this.widgetTranslationService = widgetTranslationService;
289
+ this.saveEvent = new EventEmitter();
290
+ this.form = this.fb.group({
291
+ title: this.fb.control('', [Validators.required]),
292
+ dataSource: this.fb.control(null, [Validators.required]),
293
+ displayType: this.fb.control(null, [Validators.required]),
294
+ });
295
+ this.open$ = new BehaviorSubject(false);
296
+ this.selectedDataSourceKey$ = new BehaviorSubject('');
297
+ this.selectedDisplayTypeKey$ = new BehaviorSubject('');
298
+ this.dataSourceItems$ = combineLatest([
299
+ this.dashboardManagementService.getDataSources(),
300
+ this.selectedDataSourceKey$,
301
+ this.widgetService.supportedDataSources$,
302
+ this.translateService.stream('key'),
303
+ ]).pipe(filter(([dataSources]) => !!dataSources), tap(([dataSources, selectedDataSourceKey]) => {
304
+ if (selectedDataSourceKey) {
305
+ this.setCompatibleDisplayTypes(dataSources, selectedDataSourceKey);
306
+ }
307
+ else {
308
+ this.resetCompatibleDisplayTypes();
309
+ }
310
+ }), map(([dataSources, selectedDataSourceKey, supportedDataSources]) => dataSources
311
+ .filter(dataSource => supportedDataSources.find(supportedDataSource => supportedDataSource.dataSourceKey === dataSource.key))
312
+ .map(dataSource => ({
313
+ content: this.widgetTranslationService.instant('title', dataSource.key),
314
+ selected: selectedDataSourceKey === dataSource.key,
315
+ key: dataSource.key,
316
+ }))));
317
+ this.dataSourcePrefillConfig$ = new BehaviorSubject(null);
318
+ this.displayTypePrefillConfig$ = new BehaviorSubject(null);
319
+ this._compatibleDisplayTypes$ = new BehaviorSubject([]);
320
+ this.displayTypeItems$ = combineLatest([
321
+ this._compatibleDisplayTypes$,
322
+ this.selectedDisplayTypeKey$,
323
+ this.translateService.stream('key'),
324
+ ]).pipe(map(([compatibleDisplayTypes, selectedDisplayTypeKey]) => compatibleDisplayTypes.map(displayType => ({
325
+ content: this.widgetTranslationService.instant('title', displayType.displayTypeKey),
326
+ selected: displayType.displayTypeKey === selectedDisplayTypeKey,
327
+ key: displayType.displayTypeKey,
328
+ }))));
329
+ this.displayTypeDropdownDisabled$ = combineLatest([
330
+ this._compatibleDisplayTypes$,
331
+ this.selectedDataSourceKey$,
332
+ ]).pipe(map(([compatibleDisplayTypes, selectedDataSourceKey]) => compatibleDisplayTypes?.length === 0 || !selectedDataSourceKey), tap(displayTypeDropdownDisabled => {
333
+ if (displayTypeDropdownDisabled) {
334
+ this.displayType?.disable();
335
+ }
336
+ else {
337
+ this.displayType?.enable();
338
+ }
339
+ }));
340
+ this.dataSourceConfiguration$ = new BehaviorSubject({
341
+ valid: false,
342
+ data: {},
343
+ });
344
+ this.displayTypeConfiguration$ = new BehaviorSubject({
345
+ valid: false,
346
+ data: {},
347
+ });
348
+ this.disabled$ = new BehaviorSubject(false);
349
+ }
350
+ ngOnInit() {
351
+ this.openOpenSubscription();
352
+ }
353
+ ngOnDestroy() {
354
+ this._openSubscription?.unsubscribe();
355
+ }
356
+ closeModal() {
357
+ this.open$.next(false);
358
+ setTimeout(() => {
359
+ this.enable();
360
+ this.form.reset();
361
+ this.selectedDataSourceKey$.next('');
362
+ this.selectedDisplayTypeKey$.next('');
363
+ }, CARBON_CONSTANTS.modalAnimationMs);
364
+ }
365
+ save() {
366
+ this.disable();
367
+ combineLatest([
368
+ this.selectedDataSourceKey$,
369
+ this.selectedDisplayTypeKey$,
370
+ this.displayTypeConfiguration$,
371
+ this.dataSourceConfiguration$,
372
+ ])
373
+ .pipe(take(1), map(([selectedDataSourceKey, selectedDisplayTypeKey, displayTypeConfiguration, dataSourceConfiguration,]) => ({
374
+ title: this.title.value,
375
+ displayType: selectedDisplayTypeKey,
376
+ dataSourceKey: selectedDataSourceKey,
377
+ dataSourceProperties: { ...dataSourceConfiguration.data },
378
+ displayTypeProperties: { ...displayTypeConfiguration.data },
379
+ })), switchMap(widgetUpdateObject => this.type === 'create'
380
+ ? this.dashboardManagementService.createDashboardWidgetConfiguration(this.dashboard.key, widgetUpdateObject)
381
+ : this.dashboardManagementService.updateDashboardWidgetConfiguration(this.dashboard.key, { ...widgetUpdateObject, key: this.widgetKey })))
382
+ .subscribe({
383
+ complete: () => {
384
+ this.saveEvent.emit();
385
+ this.closeModal();
386
+ },
387
+ error: () => {
388
+ this.enable();
389
+ },
390
+ });
391
+ }
392
+ delete() {
393
+ this.disable();
394
+ this.dashboardManagementService
395
+ .deleteDashboardWidgetConfiguration(this.dashboard.key, this.widgetKey)
396
+ .subscribe({
397
+ complete: () => {
398
+ this.saveEvent.emit();
399
+ this.closeModal();
400
+ },
401
+ error: () => {
402
+ this.enable();
403
+ },
404
+ });
405
+ }
406
+ dataSourceSelected(dataSource) {
407
+ if (!dataSource) {
408
+ return;
409
+ }
410
+ this.selectedDataSourceKey$.next(dataSource?.item?.key);
411
+ this.dataSource.setValue(dataSource?.item?.key);
412
+ }
413
+ displayTypeSelected(displayType) {
414
+ if (!displayType) {
415
+ return;
416
+ }
417
+ this.selectedDisplayTypeKey$.next(displayType?.item?.key);
418
+ this.displayType.setValue(displayType?.item?.key);
419
+ }
420
+ dataSourceConfiguration(configuration) {
421
+ this.dataSourceConfiguration$.next(configuration);
422
+ }
423
+ displayTypeConfiguration(configuration) {
424
+ this.displayTypeConfiguration$.next(configuration);
425
+ }
426
+ openOpenSubscription() {
427
+ this._openSubscription = this.showModal$.subscribe(show => {
428
+ this.open$.next(show);
429
+ });
430
+ }
431
+ resetCompatibleDisplayTypes() {
432
+ this._compatibleDisplayTypes$.next([]);
433
+ }
434
+ setCompatibleDisplayTypes(dataSources, selectedDataSourceKey) {
435
+ this.widgetService.supportedDisplayTypes$.pipe(take(1)).subscribe(supportedDisplayTypes => {
436
+ const selectedDataSource = dataSources.find(source => source.key === selectedDataSourceKey);
437
+ const availableDataFeatures = selectedDataSource?.dataFeatures;
438
+ const compatibleDisplayTypes = supportedDisplayTypes.filter(displayType => {
439
+ const supportedDataFeatures = displayType.requiredDataFeatures.filter(feature => availableDataFeatures?.includes(feature));
440
+ return supportedDataFeatures.length === displayType.requiredDataFeatures.length;
441
+ });
442
+ this._compatibleDisplayTypes$.next(compatibleDisplayTypes);
443
+ });
444
+ }
445
+ disable() {
446
+ this.disabled$.next(true);
447
+ this.form.disable();
448
+ }
449
+ enable() {
450
+ this.disabled$.next(false);
451
+ this.form.enable();
452
+ }
453
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WidgetModalComponent, deps: [{ token: DOCUMENT }, { token: i1$1.FormBuilder }, { token: i2$1.TranslateService }, { token: i3.NotificationService }, { token: DashboardManagementService }, { token: i5.WidgetService }, { token: i5.WidgetTranslationService }], target: i0.ɵɵFactoryTarget.Component }); }
454
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: WidgetModalComponent, selector: "valtimo-widget-modal", inputs: { showModal$: "showModal$", type: "type", dashboard: "dashboard", widgetKey: "widgetKey", editWidgetConfiguration: "editWidgetConfiguration" }, outputs: { saveEvent: "saveEvent" }, providers: [NotificationService], ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container\n *ngIf=\"{\n disabled: disabled$ | async,\n isCreate: type === 'create',\n isDelete: type === 'delete',\n isEdit: type === 'edit',\n open: open$ | async\n } as vars\"\n>\n <ng-container\n *ngIf=\"{\n create: vars.isCreate && ('dashboardManagement.widgets.add' | translate),\n delete: vars.isDelete && ('dashboardManagement.widgets.delete' | translate),\n edit: vars.isEdit && ('dashboardManagement.widgets.edit' | translate)\n } as titles\"\n >\n <cds-modal\n *ngIf=\"{\n title: titles.edit || titles.create || titles.delete\n } as translations\"\n valtimoCdsModal\n [open]=\"vars.open\"\n showFooter=\"true\"\n size=\"md\"\n title=\"{{ translations.title }}\"\n class=\"widget-modal\"\n >\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"closeModal()\">\n <h3 cdsModalHeaderHeading>\n {{ translations.title }}\n </h3>\n </cds-modal-header>\n\n <section cdsModalContent>\n <ng-container *ngIf=\"vars.isDelete\">\n {{ 'dashboardManagement.widgets.deleteDescription' | translate }}</ng-container\n >\n\n <ng-container *ngIf=\"vars.isEdit || vars.isCreate\">\n <ng-container *ngTemplateOutlet=\"widgetForm; context: {vars: vars}\"></ng-container>\n </ng-container>\n </section>\n\n <cds-modal-footer>\n <ng-container *ngIf=\"vars.isEdit || vars.isCreate\">\n <ng-container *ngTemplateOutlet=\"editButtons; context: {vars: vars}\"></ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"vars.isDelete\">\n <ng-container *ngTemplateOutlet=\"deleteButtons; context: {vars: vars}\"></ng-container>\n </ng-container>\n </cds-modal-footer>\n </cds-modal>\n </ng-container>\n</ng-container>\n\n<ng-template #widgetForm let-vars=\"vars\">\n <form\n *ngIf=\"\n form && {\n dataSourceItems: dataSourceItems$ | async,\n displayTypeDropdownDisabled: displayTypeDropdownDisabled$ | async,\n displayTypeItems: displayTypeItems$ | async,\n selectedDataSourceKey: selectedDataSourceKey$ | async,\n selectedDisplayTypeKey: selectedDisplayTypeKey$ | async\n } as obs\n \"\n [formGroup]=\"form\"\n class=\"dashboard-modal__form\"\n >\n <div class=\"form__element\">\n <cds-label\n [helperText]=\"'dashboardManagement.widgets.form.titleHelperText' | translate\"\n [invalidText]=\"'dashboardManagement.widgets.form.titleHelperText' | translate\"\n [invalid]=\"title.dirty && title.invalid\"\n >\n {{ 'dashboardManagement.widgets.form.title' | translate }}\n\n <input\n cdsText\n formControlName=\"title\"\n [invalid]=\"title.dirty && title.invalid\"\n [attr.modal-primary-focus]=\"true\"\n />\n </cds-label>\n </div>\n\n <div class=\"form__element\" *ngIf=\"obs.dataSourceItems\">\n <cds-dropdown\n formControlName=\"dataSource\"\n [helperText]=\"'dashboardManagement.widgets.form.dataSourceHelperText' | translate\"\n [invalidText]=\"'dashboardManagement.widgets.form.dateSourceHelperText' | translate\"\n [invalid]=\"dataSource.dirty && dataSource.invalid\"\n [label]=\"'dashboardManagement.widgets.form.dataSource' | translate\"\n (selected)=\"dataSourceSelected($event)\"\n >\n <cds-dropdown-list [items]=\"obs.dataSourceItems\" type=\"multi\"></cds-dropdown-list>\n </cds-dropdown>\n </div>\n\n <valtimo-widget-configuration-container\n *ngIf=\"obs.selectedDataSourceKey\"\n [dataSourceKey]=\"obs.selectedDataSourceKey\"\n [disabled]=\"vars.disabled\"\n [prefillConfiguration]=\"dataSourcePrefillConfig$ | async\"\n (configurationEvent)=\"dataSourceConfiguration($event)\"\n ></valtimo-widget-configuration-container>\n\n <div class=\"form__element\" *ngIf=\"obs.displayTypeItems\">\n <cds-dropdown\n formControlName=\"displayType\"\n [helperText]=\"'dashboardManagement.widgets.form.displayTypeHelperText' | translate\"\n [invalid]=\"displayType.dirty && displayType.invalid\"\n [invalidText]=\"'dashboardManagement.widgets.form.displayTypeHelperText' | translate\"\n [label]=\"'dashboardManagement.widgets.form.displayType' | translate\"\n (selected)=\"displayTypeSelected($event)\"\n >\n <cds-dropdown-list [items]=\"obs.displayTypeItems\" type=\"multi\"></cds-dropdown-list>\n </cds-dropdown>\n </div>\n\n <valtimo-widget-configuration-container\n *ngIf=\"obs.selectedDisplayTypeKey\"\n [disabled]=\"vars.disabled\"\n [displayTypeKey]=\"obs.selectedDisplayTypeKey\"\n [prefillConfiguration]=\"displayTypePrefillConfig$ | async\"\n (configurationEvent)=\"displayTypeConfiguration($event)\"\n ></valtimo-widget-configuration-container>\n </form>\n</ng-template>\n\n<ng-template #editButtons let-vars=\"vars\">\n <ng-container\n *ngIf=\"{\n dataSourceConfiguration: dataSourceConfiguration$ | async,\n displayTypeConfiguration: displayTypeConfiguration$ | async\n } as obs\"\n >\n <button cdsButton=\"ghost\" [disabled]=\"vars.disabled\" (click)=\"closeModal()\">\n {{ 'dashboardManagement.widgets.cancel' | translate }}\n </button>\n\n <button\n cdsButton=\"primary\"\n [disabled]=\"\n form.invalid ||\n !obs.dataSourceConfiguration.valid ||\n !obs.displayTypeConfiguration.valid ||\n vars.disabled\n \"\n (click)=\"save()\"\n >\n {{ 'dashboardManagement.widgets.save' | translate }}\n </button>\n </ng-container>\n</ng-template>\n\n<ng-template #deleteButtons let-vars=\"vars\">\n <button cdsButton=\"secondary\" [disabled]=\"vars.disabled\" (click)=\"closeModal()\">\n {{ 'dashboardManagement.widgets.cancel' | translate }}\n </button>\n\n <button cdsButton=\"danger\" [disabled]=\"vars.disabled\" (click)=\"delete()\">\n {{ 'dashboardManagement.widgets.delete' | translate }}\n </button>\n</ng-template>\n", styles: ["/*!\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.widget-modal .form__row{display:flex;flex-direction:row;justify-content:space-between;align-items:flex-start}.widget-modal .form__spacer{width:32px}.widget-modal .form__element{width:100%;margin-bottom:32px}.widget-modal .form__element.--with-button{display:flex;align-items:flex-end;flex-direction:row}.widget-modal .form__element.--with-button button{margin-left:16px}.widget-modal .form__element.--readonly input{background-color:transparent}\n"], dependencies: [{ kind: "directive", type: i3.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "directive", type: i2$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3.Dropdown, selector: "cds-dropdown, ibm-dropdown", inputs: ["id", "label", "helperText", "placeholder", "displayValue", "clearText", "size", "type", "theme", "disabled", "skeleton", "inline", "disableArrowKeys", "invalid", "invalidText", "warn", "warnText", "appendInline", "scrollableContainer", "itemValueKey", "selectionFeedback", "menuButtonLabel", "selectedLabel", "dropUp"], outputs: ["selected", "onClose", "close"] }, { kind: "component", type: i3.DropdownList, selector: "cds-dropdown-list, ibm-dropdown-list", inputs: ["ariaLabel", "items", "listTpl", "type", "showTitles"], outputs: ["select", "scroll", "blurIntent"] }, { kind: "component", type: i3.Label, selector: "cds-label, ibm-label", inputs: ["labelInputID", "disabled", "skeleton", "helperText", "invalidText", "invalid", "warn", "warnText", "ariaLabel"] }, { kind: "directive", type: i3.TextInput, selector: "[cdsText], [ibmText]", inputs: ["theme", "size", "invalid", "warn", "skeleton"] }, { kind: "component", type: i3.Modal, selector: "cds-modal, ibm-modal", inputs: ["size", "theme", "ariaLabel", "open", "trigger", "hasScrollingContent"], outputs: ["overlaySelected", "close"] }, { kind: "component", type: i3.ModalHeader, selector: "cds-modal-header, ibm-modal-header", inputs: ["theme", "closeLabel", "showCloseButton"], outputs: ["closeSelect"] }, { kind: "component", type: i3.ModalFooter, selector: "cds-modal-footer, ibm-modal-footer" }, { kind: "directive", type: i3.ModalContent, selector: "[cdsModalContent], [ibmModalContent]", inputs: ["hasForm"] }, { kind: "directive", type: i3.ModalHeaderHeading, selector: "[cdsModalHeaderHeading], [ibmModalHeaderHeading]" }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: WidgetConfigurationContainerComponent, selector: "valtimo-widget-configuration-container", inputs: ["dataSourceKey", "displayTypeKey", "disabled", "prefillConfiguration"], outputs: ["configurationEvent"] }, { kind: "pipe", type: i2$2.AsyncPipe, name: "async" }, { kind: "pipe", type: i2$1.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None }); }
455
+ }
456
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WidgetModalComponent, decorators: [{
457
+ type: Component,
458
+ args: [{ selector: 'valtimo-widget-modal', encapsulation: ViewEncapsulation.None, providers: [NotificationService], template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container\n *ngIf=\"{\n disabled: disabled$ | async,\n isCreate: type === 'create',\n isDelete: type === 'delete',\n isEdit: type === 'edit',\n open: open$ | async\n } as vars\"\n>\n <ng-container\n *ngIf=\"{\n create: vars.isCreate && ('dashboardManagement.widgets.add' | translate),\n delete: vars.isDelete && ('dashboardManagement.widgets.delete' | translate),\n edit: vars.isEdit && ('dashboardManagement.widgets.edit' | translate)\n } as titles\"\n >\n <cds-modal\n *ngIf=\"{\n title: titles.edit || titles.create || titles.delete\n } as translations\"\n valtimoCdsModal\n [open]=\"vars.open\"\n showFooter=\"true\"\n size=\"md\"\n title=\"{{ translations.title }}\"\n class=\"widget-modal\"\n >\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"closeModal()\">\n <h3 cdsModalHeaderHeading>\n {{ translations.title }}\n </h3>\n </cds-modal-header>\n\n <section cdsModalContent>\n <ng-container *ngIf=\"vars.isDelete\">\n {{ 'dashboardManagement.widgets.deleteDescription' | translate }}</ng-container\n >\n\n <ng-container *ngIf=\"vars.isEdit || vars.isCreate\">\n <ng-container *ngTemplateOutlet=\"widgetForm; context: {vars: vars}\"></ng-container>\n </ng-container>\n </section>\n\n <cds-modal-footer>\n <ng-container *ngIf=\"vars.isEdit || vars.isCreate\">\n <ng-container *ngTemplateOutlet=\"editButtons; context: {vars: vars}\"></ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"vars.isDelete\">\n <ng-container *ngTemplateOutlet=\"deleteButtons; context: {vars: vars}\"></ng-container>\n </ng-container>\n </cds-modal-footer>\n </cds-modal>\n </ng-container>\n</ng-container>\n\n<ng-template #widgetForm let-vars=\"vars\">\n <form\n *ngIf=\"\n form && {\n dataSourceItems: dataSourceItems$ | async,\n displayTypeDropdownDisabled: displayTypeDropdownDisabled$ | async,\n displayTypeItems: displayTypeItems$ | async,\n selectedDataSourceKey: selectedDataSourceKey$ | async,\n selectedDisplayTypeKey: selectedDisplayTypeKey$ | async\n } as obs\n \"\n [formGroup]=\"form\"\n class=\"dashboard-modal__form\"\n >\n <div class=\"form__element\">\n <cds-label\n [helperText]=\"'dashboardManagement.widgets.form.titleHelperText' | translate\"\n [invalidText]=\"'dashboardManagement.widgets.form.titleHelperText' | translate\"\n [invalid]=\"title.dirty && title.invalid\"\n >\n {{ 'dashboardManagement.widgets.form.title' | translate }}\n\n <input\n cdsText\n formControlName=\"title\"\n [invalid]=\"title.dirty && title.invalid\"\n [attr.modal-primary-focus]=\"true\"\n />\n </cds-label>\n </div>\n\n <div class=\"form__element\" *ngIf=\"obs.dataSourceItems\">\n <cds-dropdown\n formControlName=\"dataSource\"\n [helperText]=\"'dashboardManagement.widgets.form.dataSourceHelperText' | translate\"\n [invalidText]=\"'dashboardManagement.widgets.form.dateSourceHelperText' | translate\"\n [invalid]=\"dataSource.dirty && dataSource.invalid\"\n [label]=\"'dashboardManagement.widgets.form.dataSource' | translate\"\n (selected)=\"dataSourceSelected($event)\"\n >\n <cds-dropdown-list [items]=\"obs.dataSourceItems\" type=\"multi\"></cds-dropdown-list>\n </cds-dropdown>\n </div>\n\n <valtimo-widget-configuration-container\n *ngIf=\"obs.selectedDataSourceKey\"\n [dataSourceKey]=\"obs.selectedDataSourceKey\"\n [disabled]=\"vars.disabled\"\n [prefillConfiguration]=\"dataSourcePrefillConfig$ | async\"\n (configurationEvent)=\"dataSourceConfiguration($event)\"\n ></valtimo-widget-configuration-container>\n\n <div class=\"form__element\" *ngIf=\"obs.displayTypeItems\">\n <cds-dropdown\n formControlName=\"displayType\"\n [helperText]=\"'dashboardManagement.widgets.form.displayTypeHelperText' | translate\"\n [invalid]=\"displayType.dirty && displayType.invalid\"\n [invalidText]=\"'dashboardManagement.widgets.form.displayTypeHelperText' | translate\"\n [label]=\"'dashboardManagement.widgets.form.displayType' | translate\"\n (selected)=\"displayTypeSelected($event)\"\n >\n <cds-dropdown-list [items]=\"obs.displayTypeItems\" type=\"multi\"></cds-dropdown-list>\n </cds-dropdown>\n </div>\n\n <valtimo-widget-configuration-container\n *ngIf=\"obs.selectedDisplayTypeKey\"\n [disabled]=\"vars.disabled\"\n [displayTypeKey]=\"obs.selectedDisplayTypeKey\"\n [prefillConfiguration]=\"displayTypePrefillConfig$ | async\"\n (configurationEvent)=\"displayTypeConfiguration($event)\"\n ></valtimo-widget-configuration-container>\n </form>\n</ng-template>\n\n<ng-template #editButtons let-vars=\"vars\">\n <ng-container\n *ngIf=\"{\n dataSourceConfiguration: dataSourceConfiguration$ | async,\n displayTypeConfiguration: displayTypeConfiguration$ | async\n } as obs\"\n >\n <button cdsButton=\"ghost\" [disabled]=\"vars.disabled\" (click)=\"closeModal()\">\n {{ 'dashboardManagement.widgets.cancel' | translate }}\n </button>\n\n <button\n cdsButton=\"primary\"\n [disabled]=\"\n form.invalid ||\n !obs.dataSourceConfiguration.valid ||\n !obs.displayTypeConfiguration.valid ||\n vars.disabled\n \"\n (click)=\"save()\"\n >\n {{ 'dashboardManagement.widgets.save' | translate }}\n </button>\n </ng-container>\n</ng-template>\n\n<ng-template #deleteButtons let-vars=\"vars\">\n <button cdsButton=\"secondary\" [disabled]=\"vars.disabled\" (click)=\"closeModal()\">\n {{ 'dashboardManagement.widgets.cancel' | translate }}\n </button>\n\n <button cdsButton=\"danger\" [disabled]=\"vars.disabled\" (click)=\"delete()\">\n {{ 'dashboardManagement.widgets.delete' | translate }}\n </button>\n</ng-template>\n", styles: ["/*!\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.widget-modal .form__row{display:flex;flex-direction:row;justify-content:space-between;align-items:flex-start}.widget-modal .form__spacer{width:32px}.widget-modal .form__element{width:100%;margin-bottom:32px}.widget-modal .form__element.--with-button{display:flex;align-items:flex-end;flex-direction:row}.widget-modal .form__element.--with-button button{margin-left:16px}.widget-modal .form__element.--readonly input{background-color:transparent}\n"] }]
459
+ }], ctorParameters: function () { return [{ type: Document, decorators: [{
460
+ type: Inject,
461
+ args: [DOCUMENT]
462
+ }] }, { type: i1$1.FormBuilder }, { type: i2$1.TranslateService }, { type: i3.NotificationService }, { type: DashboardManagementService }, { type: i5.WidgetService }, { type: i5.WidgetTranslationService }]; }, propDecorators: { showModal$: [{
463
+ type: Input
464
+ }], type: [{
465
+ type: Input
466
+ }], dashboard: [{
467
+ type: Input
468
+ }], widgetKey: [{
469
+ type: Input
470
+ }], editWidgetConfiguration: [{
471
+ type: Input
472
+ }], saveEvent: [{
473
+ type: Output
474
+ }] } });
475
+
476
+ /*
477
+ * Copyright 2015-2023 Ritense BV, the Netherlands.
478
+ *
479
+ * Licensed under EUPL, Version 1.2 (the "License");
480
+ * you may not use this file except in compliance with the License.
481
+ * You may obtain a copy of the License at
482
+ *
483
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
484
+ *
485
+ * Unless required by applicable law or agreed to in writing, software
486
+ * distributed under the License is distributed on an "AS IS" basis,
487
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
488
+ * See the License for the specific language governing permissions and
489
+ * limitations under the License.
490
+ */
491
+ class EditDashboardModalComponent {
492
+ get dashboardTitle() {
493
+ return this.editDashboardForm.get('title');
494
+ }
495
+ get dashboardDescription() {
496
+ return this.editDashboardForm.get('description');
497
+ }
498
+ constructor(fb, dashboardManagementService) {
499
+ this.fb = fb;
500
+ this.dashboardManagementService = dashboardManagementService;
501
+ this.saveEvent = new EventEmitter();
502
+ this.open$ = new BehaviorSubject(false);
503
+ this.disabled$ = new BehaviorSubject(false);
504
+ this.editDashboardForm = this.fb.group({
505
+ title: this.fb.control('', [Validators.required]),
506
+ description: this.fb.control('', [Validators.required]),
507
+ });
508
+ }
509
+ ngOnInit() {
510
+ this.openOpenSubscription();
511
+ }
512
+ closeModal() {
513
+ this.open$.next(false);
514
+ setTimeout(() => {
515
+ this.editDashboardForm.reset();
516
+ }, CARBON_CONSTANTS.modalAnimationMs);
517
+ }
518
+ saveDashboard() {
519
+ this.disable();
520
+ this.dashboardManagementService
521
+ .updateDashboard({
522
+ description: this.dashboardDescription.value,
523
+ title: this.dashboardTitle.value,
524
+ key: this.dashboard.key,
525
+ })
526
+ .subscribe(() => {
527
+ this.saveEvent.emit();
528
+ this.closeModal();
529
+ });
530
+ }
531
+ setEditDashboardForm() {
532
+ if (this.dashboard) {
533
+ this.dashboardTitle?.setValue(this.dashboard.title);
534
+ this.dashboardDescription?.setValue(this.dashboard.description);
535
+ }
536
+ this.enable();
537
+ }
538
+ openOpenSubscription() {
539
+ this._openSubscription = this.showModal$.subscribe(show => {
540
+ this.setEditDashboardForm();
541
+ this.open$.next(show);
542
+ });
543
+ }
544
+ disable() {
545
+ this.disabled$.next(true);
546
+ }
547
+ enable() {
548
+ this.disabled$.next(false);
549
+ }
550
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EditDashboardModalComponent, deps: [{ token: i1$1.FormBuilder }, { token: DashboardManagementService }], target: i0.ɵɵFactoryTarget.Component }); }
551
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: EditDashboardModalComponent, selector: "valtimo-edit-dashboard-modal", inputs: { showModal$: "showModal$", dashboard: "dashboard" }, outputs: { saveEvent: "saveEvent" }, providers: [NotificationService], ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<cds-modal\n *ngIf=\"{disabled: disabled$ | async} as obs\"\n valtimoCdsModal\n [open]=\"open$ | async\"\n showFooter=\"true\"\n title=\"{{ 'dashboardManagement.widgets.editDashboard' | translate }}\"\n class=\"edit-dashboard-modal\"\n>\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"closeModal()\">\n <h3 cdsModalHeaderHeading>{{ 'dashboardManagement.widgets.editDashboard' | translate }}</h3>\n </cds-modal-header>\n\n <section cdsModalContent>\n <ng-container *ngTemplateOutlet=\"editDashboardFormTemplate;context:{obs: obs}\"></ng-container>\n </section>\n\n <cds-modal-footer>\n <ng-container *ngTemplateOutlet=\"editDashboardButtons;context:{obs: obs}\"></ng-container>\n </cds-modal-footer>\n</cds-modal>\n\n<ng-template #editDashboardFormTemplate let-obs=\"obs\">\n <form *ngIf=\"editDashboardForm\" [formGroup]=\"editDashboardForm\" class=\"dashboard-modal__form\">\n <div class=\"form__element\">\n <cds-label\n [disabled]=\"obs.disabled\"\n [invalid]=\"dashboardTitle.dirty && dashboardTitle.invalid\"\n >\n {{ 'dashboardManagement.widgets.form.dashboardTitle' | translate }}\n\n <input\n cdsText\n [disabled]=\"obs.disabled\"\n [invalid]=\"dashboardTitle.dirty && dashboardTitle.invalid\"\n formControlName=\"title\"\n [attr.modal-primary-focus]=\"true\"\n />\n </cds-label>\n </div>\n\n <div class=\"form__element\">\n <cds-label\n [disabled]=\"obs.disabled\"\n [helperText]=\"'dashboardManagement.widgets.form.dashboardDescriptionHelperText' | translate\"\n [invalid]=\"dashboardDescription.dirty && dashboardDescription.invalid\"\n [invalidText]=\"\n 'dashboardManagement.widgets.form.dashboardDescriptionHelperText' | translate\n \"\n >\n {{ 'dashboardManagement.widgets.form.dashboardDescription' | translate }}\n\n <input\n cdsText\n [disabled]=\"obs.disabled\"\n [invalid]=\"dashboardDescription.dirty && dashboardDescription.invalid\"\n formControlName=\"description\"\n />\n </cds-label>\n </div>\n </form>\n</ng-template>\n\n<ng-template #editDashboardButtons let-obs=\"obs\">\n <button cdsButton=\"ghost\" [disabled]=\"obs.disabled\" (click)=\"closeModal()\">\n {{ 'dashboardManagement.widgets.cancel' | translate }}\n </button>\n\n <button\n cdsButton=\"primary\"\n [disabled]=\"editDashboardForm.invalid || obs.disabled\"\n (click)=\"saveDashboard()\"\n >\n {{ 'dashboardManagement.widgets.complete' | translate }}\n </button>\n</ng-template>\n", styles: ["/*!\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.edit-dashboard-modal .form__row{display:flex;flex-direction:row;justify-content:space-between;align-items:flex-end}.edit-dashboard-modal .form__element{width:100%;margin-bottom:32px}\n"], dependencies: [{ kind: "directive", type: i3.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "directive", type: i2$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3.Label, selector: "cds-label, ibm-label", inputs: ["labelInputID", "disabled", "skeleton", "helperText", "invalidText", "invalid", "warn", "warnText", "ariaLabel"] }, { kind: "directive", type: i3.TextInput, selector: "[cdsText], [ibmText]", inputs: ["theme", "size", "invalid", "warn", "skeleton"] }, { kind: "component", type: i3.Modal, selector: "cds-modal, ibm-modal", inputs: ["size", "theme", "ariaLabel", "open", "trigger", "hasScrollingContent"], outputs: ["overlaySelected", "close"] }, { kind: "component", type: i3.ModalHeader, selector: "cds-modal-header, ibm-modal-header", inputs: ["theme", "closeLabel", "showCloseButton"], outputs: ["closeSelect"] }, { kind: "component", type: i3.ModalFooter, selector: "cds-modal-footer, ibm-modal-footer" }, { kind: "directive", type: i3.ModalContent, selector: "[cdsModalContent], [ibmModalContent]", inputs: ["hasForm"] }, { kind: "directive", type: i3.ModalHeaderHeading, selector: "[cdsModalHeaderHeading], [ibmModalHeaderHeading]" }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "pipe", type: i2$2.AsyncPipe, name: "async" }, { kind: "pipe", type: i2$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
552
+ }
553
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EditDashboardModalComponent, decorators: [{
554
+ type: Component,
555
+ args: [{ selector: 'valtimo-edit-dashboard-modal', encapsulation: ViewEncapsulation.None, providers: [NotificationService], changeDetection: ChangeDetectionStrategy.OnPush, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<cds-modal\n *ngIf=\"{disabled: disabled$ | async} as obs\"\n valtimoCdsModal\n [open]=\"open$ | async\"\n showFooter=\"true\"\n title=\"{{ 'dashboardManagement.widgets.editDashboard' | translate }}\"\n class=\"edit-dashboard-modal\"\n>\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"closeModal()\">\n <h3 cdsModalHeaderHeading>{{ 'dashboardManagement.widgets.editDashboard' | translate }}</h3>\n </cds-modal-header>\n\n <section cdsModalContent>\n <ng-container *ngTemplateOutlet=\"editDashboardFormTemplate;context:{obs: obs}\"></ng-container>\n </section>\n\n <cds-modal-footer>\n <ng-container *ngTemplateOutlet=\"editDashboardButtons;context:{obs: obs}\"></ng-container>\n </cds-modal-footer>\n</cds-modal>\n\n<ng-template #editDashboardFormTemplate let-obs=\"obs\">\n <form *ngIf=\"editDashboardForm\" [formGroup]=\"editDashboardForm\" class=\"dashboard-modal__form\">\n <div class=\"form__element\">\n <cds-label\n [disabled]=\"obs.disabled\"\n [invalid]=\"dashboardTitle.dirty && dashboardTitle.invalid\"\n >\n {{ 'dashboardManagement.widgets.form.dashboardTitle' | translate }}\n\n <input\n cdsText\n [disabled]=\"obs.disabled\"\n [invalid]=\"dashboardTitle.dirty && dashboardTitle.invalid\"\n formControlName=\"title\"\n [attr.modal-primary-focus]=\"true\"\n />\n </cds-label>\n </div>\n\n <div class=\"form__element\">\n <cds-label\n [disabled]=\"obs.disabled\"\n [helperText]=\"'dashboardManagement.widgets.form.dashboardDescriptionHelperText' | translate\"\n [invalid]=\"dashboardDescription.dirty && dashboardDescription.invalid\"\n [invalidText]=\"\n 'dashboardManagement.widgets.form.dashboardDescriptionHelperText' | translate\n \"\n >\n {{ 'dashboardManagement.widgets.form.dashboardDescription' | translate }}\n\n <input\n cdsText\n [disabled]=\"obs.disabled\"\n [invalid]=\"dashboardDescription.dirty && dashboardDescription.invalid\"\n formControlName=\"description\"\n />\n </cds-label>\n </div>\n </form>\n</ng-template>\n\n<ng-template #editDashboardButtons let-obs=\"obs\">\n <button cdsButton=\"ghost\" [disabled]=\"obs.disabled\" (click)=\"closeModal()\">\n {{ 'dashboardManagement.widgets.cancel' | translate }}\n </button>\n\n <button\n cdsButton=\"primary\"\n [disabled]=\"editDashboardForm.invalid || obs.disabled\"\n (click)=\"saveDashboard()\"\n >\n {{ 'dashboardManagement.widgets.complete' | translate }}\n </button>\n</ng-template>\n", styles: ["/*!\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.edit-dashboard-modal .form__row{display:flex;flex-direction:row;justify-content:space-between;align-items:flex-end}.edit-dashboard-modal .form__element{width:100%;margin-bottom:32px}\n"] }]
556
+ }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: DashboardManagementService }]; }, propDecorators: { showModal$: [{
557
+ type: Input
558
+ }], dashboard: [{
559
+ type: Input
560
+ }], saveEvent: [{
561
+ type: Output
562
+ }] } });
563
+
564
+ class DashboardDetailsComponent {
565
+ constructor(dashboardManagementService, datePipe, iconService, pageTitleService, route, translateService) {
566
+ this.dashboardManagementService = dashboardManagementService;
567
+ this.datePipe = datePipe;
568
+ this.iconService = iconService;
569
+ this.pageTitleService = pageTitleService;
570
+ this.route = route;
571
+ this.translateService = translateService;
572
+ this.modalType = 'create';
573
+ this._dashboardKey$ = this.route.params.pipe(map(params => params.id));
574
+ this._refreshDashboardSubject$ = new BehaviorSubject(null);
575
+ this.currentDashboard$ = combineLatest([
576
+ this._dashboardKey$,
577
+ this.translateService.stream('key'),
578
+ this._refreshDashboardSubject$,
579
+ ]).pipe(switchMap(([dashboardKey]) => this.dashboardManagementService.getDashboard(dashboardKey)), tap((currentDashboard) => {
580
+ if (!currentDashboard) {
581
+ return;
582
+ }
583
+ this.pageTitleService.setCustomPageTitle(currentDashboard.title);
584
+ this.pageTitleService.setCustomPageSubtitle(this.translateService.instant('dashboardManagement.widgets.metadata', {
585
+ createdBy: currentDashboard.createdBy,
586
+ createdOn: this.datePipe.transform(currentDashboard.createdOn ?? '', 'd/M/yy, H:mm'),
587
+ key: currentDashboard.key,
588
+ }));
589
+ }));
590
+ this.lastItemIndex$ = new BehaviorSubject(0);
591
+ this.loading$ = new BehaviorSubject(true);
592
+ this._refreshWidgetsSubject$ = new BehaviorSubject(null);
593
+ this._widgetData = null;
594
+ this.widgetData$ = combineLatest([
595
+ this._dashboardKey$,
596
+ this._refreshWidgetsSubject$,
597
+ ]).pipe(switchMap(([dashboardKey, refreshWidgets]) => {
598
+ this.loading$.next(true);
599
+ if (!this._widgetData || !refreshWidgets) {
600
+ return this.dashboardManagementService.getDashboardWidgetConfiguration(dashboardKey);
601
+ }
602
+ const { direction, index } = refreshWidgets;
603
+ return this.dashboardManagementService.updateDashboardWidgetConfigurations(dashboardKey, direction === 'UP'
604
+ ? this.swapWidgets(this._widgetData, index - 1, index)
605
+ : this.swapWidgets(this._widgetData, index, index + 1));
606
+ }), tap((data) => {
607
+ this._widgetData = data;
608
+ this.lastItemIndex$.next(data.length - 1);
609
+ this.loading$.next(false);
610
+ }));
611
+ this.showModal$ = new BehaviorSubject(false);
612
+ this.showEditDashboardModal$ = new BehaviorSubject(false);
613
+ this.editWidgetConfiguration$ = new BehaviorSubject(null);
614
+ }
615
+ ngAfterViewInit() {
616
+ this.iconService.registerAll([ArrowDown16, ArrowUp16, Edit16]);
617
+ this.setFields();
618
+ }
619
+ addWidget() {
620
+ this.editWidgetConfiguration$.next(null);
621
+ this.modalType = 'create';
622
+ this.showModal();
623
+ }
624
+ editDashboard() {
625
+ this.showEditDashboardModal();
626
+ }
627
+ refreshWidgets() {
628
+ this._refreshWidgetsSubject$.next(null);
629
+ }
630
+ refreshDashboard() {
631
+ this._refreshDashboardSubject$.next(null);
632
+ }
633
+ onArrowDownClick(data) {
634
+ this._refreshWidgetsSubject$.next({ direction: 'DOWN', index: data.index });
635
+ }
636
+ onArrowUpClick(data) {
637
+ this._refreshWidgetsSubject$.next({ direction: 'UP', index: data.index });
638
+ }
639
+ setFields() {
640
+ this.fields = [
641
+ {
642
+ viewType: ViewType.TEXT,
643
+ key: 'title',
644
+ label: 'Name',
645
+ },
646
+ {
647
+ viewType: ViewType.TEMPLATE,
648
+ template: this.moveButtonsTemplate,
649
+ className: 'dashboard-detail-table__actions',
650
+ key: '',
651
+ label: '',
652
+ },
653
+ {
654
+ viewType: ViewType.ACTION,
655
+ className: 'dashboard-detail-table__actions',
656
+ key: '',
657
+ label: '',
658
+ actions: [
659
+ {
660
+ label: 'Edit',
661
+ callback: this.editWidget.bind(this),
662
+ },
663
+ {
664
+ label: 'Delete',
665
+ callback: this.deleteWidget.bind(this),
666
+ type: 'danger',
667
+ },
668
+ ],
669
+ },
670
+ ];
671
+ }
672
+ editWidget(event) {
673
+ this.editWidgetConfiguration$.next({ ...event });
674
+ this.modalType = 'edit';
675
+ this.showModal();
676
+ }
677
+ deleteWidget(event) {
678
+ this.editWidgetConfiguration$.next({ ...event });
679
+ this.modalType = 'delete';
680
+ this.showModal();
681
+ }
682
+ showModal() {
683
+ this.showModal$.next(true);
684
+ }
685
+ showEditDashboardModal() {
686
+ this.showEditDashboardModal$.next(true);
687
+ }
688
+ swapWidgets(dashboardWidgets, index1, index2) {
689
+ const temp = [...dashboardWidgets];
690
+ temp[index1] = temp.splice(index2, 1, temp[index1])[0];
691
+ return temp;
692
+ }
693
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DashboardDetailsComponent, deps: [{ token: DashboardManagementService }, { token: i2$2.DatePipe }, { token: i3.IconService }, { token: i4.PageTitleService }, { token: i5$1.ActivatedRoute }, { token: i2$1.TranslateService }], target: i0.ɵɵFactoryTarget.Component }); }
694
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DashboardDetailsComponent, selector: "ng-component", viewQueries: [{ propertyName: "moveButtonsTemplate", first: true, predicate: ["moveButtonsTemplate"], descendants: true }], ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container\n *ngIf=\"\n fields && {\n currentDashboard: currentDashboard$ | async,\n editWidgetConfiguration: editWidgetConfiguration$ | async,\n loading: loading$ | async,\n widgetData: widgetData$ | async\n } as obs\n \"\n>\n <div class=\"dashboard-detail-table\">\n <valtimo-carbon-list\n [items]=\"obs.widgetData\"\n [fields]=\"fields\"\n [header]=\"false\"\n [loading]=\"obs.loading\"\n >\n <div carbonToolbarContent>\n <ng-container [ngTemplateOutlet]=\"addWidgetButton\"></ng-container>\n </div>\n\n <valtimo-no-results\n [action]=\"addWidgetButton\"\n description=\"{{ 'dashboardManagement.widgets.noResults.description' | translate }}\"\n title=\"{{ 'dashboardManagement.widgets.noResults.title' | translate }}\"\n ></valtimo-no-results>\n </valtimo-carbon-list>\n </div>\n\n <valtimo-widget-modal\n [dashboard]=\"obs.currentDashboard\"\n [editWidgetConfiguration]=\"obs.editWidgetConfiguration\"\n [showModal$]=\"showModal$\"\n [type]=\"modalType\"\n [widgetKey]=\"obs.editWidgetConfiguration?.key\"\n (saveEvent)=\"refreshWidgets()\"\n ></valtimo-widget-modal>\n\n <valtimo-edit-dashboard-modal\n [dashboard]=\"obs.currentDashboard\"\n [showModal$]=\"showEditDashboardModal$\"\n (saveEvent)=\"refreshDashboard()\"\n >\n </valtimo-edit-dashboard-modal>\n</ng-container>\n\n<ng-template #moveButtonsTemplate let-data=\"data\">\n <div class=\"move-buttons-container\">\n <button\n cdsButton=\"tertiary\"\n [disabled]=\"data.index === 0\"\n [iconOnly]=\"true\"\n (click)=\"onArrowUpClick(data)\"\n >\n <svg cdsIcon=\"arrow--up\" size=\"16\" class=\"cds--btn__icon\"></svg>\n </button>\n\n <button\n cdsButton=\"tertiary\"\n [disabled]=\"(lastItemIndex$ | async) === data.index\"\n [iconOnly]=\"true\"\n (click)=\"onArrowDownClick(data)\"\n >\n <svg cdsIcon=\"arrow--down\" size=\"16\" class=\"cds--btn__icon\"></svg>\n </button>\n </div>\n</ng-template>\n\n<ng-container renderInPageHeader>\n <ng-template>\n <button cdsButton=\"tertiary\" size=\"md\" (click)=\"editDashboard()\">\n {{ 'dashboardManagement.widgets.editButton' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"edit\" size=\"16\"></svg>\n </button>\n </ng-template>\n</ng-container>\n\n<ng-template #addWidgetButton>\n <button cdsButton=\"primary\" [disabled]=\"loading$ | async\" (click)=\"addWidget()\">\n {{ 'dashboardManagement.widgets.add' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"add\" size=\"16\"></svg>\n </button>\n</ng-template>\n", styles: ["/*!\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.dashboard-detail-table .move-buttons-container{width:100%;justify-content:flex-end;display:flex;flex-direction:row;right:-1rem;position:relative}.dashboard-detail-table .move-buttons-container button:not(:last-child){margin-right:8px}.dashboard-detail-table__actions{width:1px}.dashboard-detail-table-no-results{display:flex;justify-content:space-around;padding:6.25rem 0;gap:4rem}.dashboard-detail-table-no-results__title{font-size:1.75rem}.dashboard-detail-table-no-results__content{display:flex;flex-direction:column;justify-content:space-around}\n"], dependencies: [{ kind: "directive", type: i3.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "directive", type: i2$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i4.RenderInPageHeaderDirective, selector: "[renderInPageHeader]" }, { kind: "directive", type: i3.IconDirective, selector: "[cdsIcon], [ibmIcon]", inputs: ["ibmIcon", "cdsIcon", "size", "title", "ariaLabel", "ariaLabelledBy", "ariaHidden", "isFocusable"] }, { kind: "component", type: i4.CarbonListComponent, selector: "valtimo-carbon-list", inputs: ["items", "fields", "tableTranslations", "paginatorConfig", "pagination", "loading", "actions", "header", "initialSortState", "isSearchable", "enableSingleSelection", "lastColumnTemplate", "paginationIdentifier", "showSelectionColumn", "striped"], outputs: ["rowClicked", "paginationClicked", "paginationSet", "search", "sortChanged"] }, { kind: "component", type: i4.CarbonNoResultsComponent, selector: "valtimo-no-results", inputs: ["action", "description", "illustration", "title"] }, { kind: "component", type: WidgetModalComponent, selector: "valtimo-widget-modal", inputs: ["showModal$", "type", "dashboard", "widgetKey", "editWidgetConfiguration"], outputs: ["saveEvent"] }, { kind: "component", type: EditDashboardModalComponent, selector: "valtimo-edit-dashboard-modal", inputs: ["showModal$", "dashboard"], outputs: ["saveEvent"] }, { kind: "pipe", type: i2$2.AsyncPipe, name: "async" }, { kind: "pipe", type: i2$1.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None }); }
695
+ }
696
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DashboardDetailsComponent, decorators: [{
697
+ type: Component,
698
+ args: [{ encapsulation: ViewEncapsulation.None, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container\n *ngIf=\"\n fields && {\n currentDashboard: currentDashboard$ | async,\n editWidgetConfiguration: editWidgetConfiguration$ | async,\n loading: loading$ | async,\n widgetData: widgetData$ | async\n } as obs\n \"\n>\n <div class=\"dashboard-detail-table\">\n <valtimo-carbon-list\n [items]=\"obs.widgetData\"\n [fields]=\"fields\"\n [header]=\"false\"\n [loading]=\"obs.loading\"\n >\n <div carbonToolbarContent>\n <ng-container [ngTemplateOutlet]=\"addWidgetButton\"></ng-container>\n </div>\n\n <valtimo-no-results\n [action]=\"addWidgetButton\"\n description=\"{{ 'dashboardManagement.widgets.noResults.description' | translate }}\"\n title=\"{{ 'dashboardManagement.widgets.noResults.title' | translate }}\"\n ></valtimo-no-results>\n </valtimo-carbon-list>\n </div>\n\n <valtimo-widget-modal\n [dashboard]=\"obs.currentDashboard\"\n [editWidgetConfiguration]=\"obs.editWidgetConfiguration\"\n [showModal$]=\"showModal$\"\n [type]=\"modalType\"\n [widgetKey]=\"obs.editWidgetConfiguration?.key\"\n (saveEvent)=\"refreshWidgets()\"\n ></valtimo-widget-modal>\n\n <valtimo-edit-dashboard-modal\n [dashboard]=\"obs.currentDashboard\"\n [showModal$]=\"showEditDashboardModal$\"\n (saveEvent)=\"refreshDashboard()\"\n >\n </valtimo-edit-dashboard-modal>\n</ng-container>\n\n<ng-template #moveButtonsTemplate let-data=\"data\">\n <div class=\"move-buttons-container\">\n <button\n cdsButton=\"tertiary\"\n [disabled]=\"data.index === 0\"\n [iconOnly]=\"true\"\n (click)=\"onArrowUpClick(data)\"\n >\n <svg cdsIcon=\"arrow--up\" size=\"16\" class=\"cds--btn__icon\"></svg>\n </button>\n\n <button\n cdsButton=\"tertiary\"\n [disabled]=\"(lastItemIndex$ | async) === data.index\"\n [iconOnly]=\"true\"\n (click)=\"onArrowDownClick(data)\"\n >\n <svg cdsIcon=\"arrow--down\" size=\"16\" class=\"cds--btn__icon\"></svg>\n </button>\n </div>\n</ng-template>\n\n<ng-container renderInPageHeader>\n <ng-template>\n <button cdsButton=\"tertiary\" size=\"md\" (click)=\"editDashboard()\">\n {{ 'dashboardManagement.widgets.editButton' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"edit\" size=\"16\"></svg>\n </button>\n </ng-template>\n</ng-container>\n\n<ng-template #addWidgetButton>\n <button cdsButton=\"primary\" [disabled]=\"loading$ | async\" (click)=\"addWidget()\">\n {{ 'dashboardManagement.widgets.add' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"add\" size=\"16\"></svg>\n </button>\n</ng-template>\n", styles: ["/*!\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.dashboard-detail-table .move-buttons-container{width:100%;justify-content:flex-end;display:flex;flex-direction:row;right:-1rem;position:relative}.dashboard-detail-table .move-buttons-container button:not(:last-child){margin-right:8px}.dashboard-detail-table__actions{width:1px}.dashboard-detail-table-no-results{display:flex;justify-content:space-around;padding:6.25rem 0;gap:4rem}.dashboard-detail-table-no-results__title{font-size:1.75rem}.dashboard-detail-table-no-results__content{display:flex;flex-direction:column;justify-content:space-around}\n"] }]
699
+ }], ctorParameters: function () { return [{ type: DashboardManagementService }, { type: i2$2.DatePipe }, { type: i3.IconService }, { type: i4.PageTitleService }, { type: i5$1.ActivatedRoute }, { type: i2$1.TranslateService }]; }, propDecorators: { moveButtonsTemplate: [{
700
+ type: ViewChild,
701
+ args: ['moveButtonsTemplate']
702
+ }] } });
703
+
704
+ /*
705
+ * Copyright 2015-2023 Ritense BV, the Netherlands.
706
+ *
707
+ * Licensed under EUPL, Version 1.2 (the "License");
708
+ * you may not use this file except in compliance with the License.
709
+ * You may obtain a copy of the License at
710
+ *
711
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
712
+ *
713
+ * Unless required by applicable law or agreed to in writing, software
714
+ * distributed under the License is distributed on an "AS IS" basis,
715
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
716
+ * See the License for the specific language governing permissions and
717
+ * limitations under the License.
718
+ */
719
+ class DashboardManagementComponent {
720
+ constructor(dashboardManagementService, fb, router) {
721
+ this.dashboardManagementService = dashboardManagementService;
722
+ this.fb = fb;
723
+ this.router = router;
724
+ this.deleteRowKey$ = new BehaviorSubject('');
725
+ this.openModal$ = new BehaviorSubject(false);
726
+ this.showDeleteModal$ = new BehaviorSubject(false);
727
+ this.tableData$ = this.dashboardManagementService.dashboards$;
728
+ this.fields = [
729
+ {
730
+ viewType: ViewType.TEXT,
731
+ key: 'title',
732
+ label: 'dashboardManagement.name',
733
+ },
734
+ {
735
+ viewType: ViewType.TEXT,
736
+ key: 'description',
737
+ label: 'dashboardManagement.description',
738
+ },
739
+ {
740
+ viewType: ViewType.TEXT,
741
+ key: 'key',
742
+ label: 'dashboardManagement.key',
743
+ },
744
+ {
745
+ actions: [
746
+ {
747
+ label: 'interface.delete',
748
+ callback: this.deleteDashboard.bind(this),
749
+ type: 'danger',
750
+ },
751
+ ],
752
+ className: 'valtimo-dashboard-management__actions',
753
+ viewType: ViewType.ACTION,
754
+ label: '',
755
+ key: '',
756
+ sortable: false,
757
+ },
758
+ ];
759
+ }
760
+ ngOnInit() {
761
+ this.dashboardManagementService.loadData();
762
+ this.form = this.fb.group({
763
+ description: this.fb.control('', [Validators.required]),
764
+ title: this.fb.control('', [Validators.required]),
765
+ });
766
+ }
767
+ closeModal() {
768
+ this.openModal$.next(false);
769
+ this.form.reset();
770
+ }
771
+ createDashboard() {
772
+ const control = this.form.get('title');
773
+ if (!control || !control.valid) {
774
+ return;
775
+ }
776
+ const newDashboard = this.form.getRawValue();
777
+ this.dashboardManagementService.dispatchAction(this.dashboardManagementService.createDashboard(newDashboard).pipe(finalize(() => {
778
+ this.closeModal();
779
+ })));
780
+ }
781
+ onConfirmEvent(dashboardKey) {
782
+ this.dashboardManagementService.dispatchAction(this.dashboardManagementService.deleteDashboard(dashboardKey).pipe(finalize(() => {
783
+ this.closeModal();
784
+ })));
785
+ }
786
+ getControlInvalid(controlKey) {
787
+ const control = this.form.get(controlKey);
788
+ if (!control) {
789
+ return true;
790
+ }
791
+ return !control.valid && !control.pristine;
792
+ }
793
+ openModal() {
794
+ this.openModal$.next(true);
795
+ }
796
+ onRowClick(item) {
797
+ this.router.navigate([`/dashboard-management/${item.key}`]);
798
+ }
799
+ deleteDashboard(dashboard) {
800
+ this.deleteRowKey$.next(dashboard.key);
801
+ this.showDeleteModal$.next(true);
802
+ }
803
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DashboardManagementComponent, deps: [{ token: DashboardManagementService }, { token: i1$1.FormBuilder }, { token: i5$1.Router }], target: i0.ɵɵFactoryTarget.Component }); }
804
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DashboardManagementComponent, selector: "ng-component", ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container *ngIf=\"tableData$ | async as data\">\n <valtimo-carbon-list\n [header]=\"true\"\n [items]=\"data.items\"\n [loading]=\"data.loading\"\n [fields]=\"fields\"\n (rowClicked)=\"onRowClick($event)\"\n class=\"valtimo-dashboard-management__table\"\n >\n <ng-container header> {{ 'dashboardManagement.title' | translate }} </ng-container>\n\n <div carbonToolbarContent>\n <ng-container [ngTemplateOutlet]=\"addDashboardButton\"></ng-container>\n </div>\n\n <valtimo-no-results\n [action]=\"addDashboardButton\"\n description=\"{{ 'dashboardManagement.noResults.description' | translate }}\"\n title=\"{{ 'dashboardManagement.noResults.title' | translate }}\"\n ></valtimo-no-results>\n </valtimo-carbon-list>\n</ng-container>\n\n<cds-modal\n valtimoCdsModal\n [open]=\"openModal$ | async\"\n showFooter=\"true\"\n title=\"{{ 'dashboardManagement.addDashboard' | translate }}\"\n>\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"closeModal()\">\n <h3 cdsModalHeaderHeading>\n {{ 'dashboardManagement.addDashboard' | translate }}\n </h3>\n </cds-modal-header>\n\n <section cdsModalContent>\n <form [formGroup]=\"form\" class=\"valtimo-dashboard-management__form\">\n <cds-label [invalid]=\"getControlInvalid('title')\">\n {{ 'dashboardManagement.addModal.name' | translate }}\n\n <input\n [attr.modal-primary-focus]=\"true\"\n [invalid]=\"getControlInvalid('title')\"\n formControlName=\"title\"\n cdsText\n placeholder=\"{{ 'dashboardManagement.addModal.namePlaceholder' | translate }}\"\n />\n </cds-label>\n\n <cds-label\n [helperText]=\"'dashboardManagement.addModal.descriptionHelperText' | translate\"\n [invalid]=\"getControlInvalid('description')\"\n >\n {{ 'dashboardManagement.description' | translate }}\n\n <input\n [invalid]=\"getControlInvalid('description')\"\n formControlName=\"description\"\n cdsText\n placeholder=\"{{ 'dashboardManagement.addModal.descriptionPlaceholder' | translate }}\"\n />\n </cds-label>\n </form>\n </section>\n\n <cds-modal-footer>\n <button cdsButton=\"ghost\" (click)=\"closeModal()\">\n {{ 'dashboardManagement.cancel' | translate }}\n </button>\n\n <button [disabled]=\"this.form.invalid\" cdsButton=\"primary\" (click)=\"createDashboard()\">\n {{ 'dashboardManagement.create' | translate }}\n </button>\n </cds-modal-footer>\n</cds-modal>\n\n<valtimo-confirmation-modal\n confirmButtonTextTranslationKey=\"dashboardManagement.deleteModal.confirm\"\n confirmButtonType=\"danger\"\n contentTranslationKey=\"dashboardManagement.deleteModalContent\"\n [outputOnConfirm]=\"deleteRowKey$ | async\"\n [showModalSubject$]=\"showDeleteModal$\"\n titleTranslationKey=\"dashboardManagement.delete\"\n (confirmEvent)=\"onConfirmEvent($event)\"\n></valtimo-confirmation-modal>\n\n<ng-template #addDashboardButton>\n <button cdsButton=\"primary\" (click)=\"openModal()\">\n {{ 'dashboardManagement.addDashboard' | translate }}\n\n <svg cdsIcon=\"add\" size=\"16\" class=\"cds--btn__icon\"></svg>\n </button>\n</ng-template>\n", styles: ["/*!\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.valtimo-dashboard-management__actions{width:1px}.valtimo-dashboard-management__form>*:not(:last-child){margin-bottom:32px}\n"], dependencies: [{ kind: "directive", type: i3.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "directive", type: i2$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3.Label, selector: "cds-label, ibm-label", inputs: ["labelInputID", "disabled", "skeleton", "helperText", "invalidText", "invalid", "warn", "warnText", "ariaLabel"] }, { kind: "directive", type: i3.TextInput, selector: "[cdsText], [ibmText]", inputs: ["theme", "size", "invalid", "warn", "skeleton"] }, { kind: "component", type: i3.Modal, selector: "cds-modal, ibm-modal", inputs: ["size", "theme", "ariaLabel", "open", "trigger", "hasScrollingContent"], outputs: ["overlaySelected", "close"] }, { kind: "component", type: i3.ModalHeader, selector: "cds-modal-header, ibm-modal-header", inputs: ["theme", "closeLabel", "showCloseButton"], outputs: ["closeSelect"] }, { kind: "component", type: i3.ModalFooter, selector: "cds-modal-footer, ibm-modal-footer" }, { kind: "directive", type: i3.ModalContent, selector: "[cdsModalContent], [ibmModalContent]", inputs: ["hasForm"] }, { kind: "directive", type: i3.ModalHeaderHeading, selector: "[cdsModalHeaderHeading], [ibmModalHeaderHeading]" }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i4.ConfirmationModalComponent, selector: "valtimo-confirmation-modal", inputs: ["titleTranslationKey", "title", "content", "contentTranslationKey", "confirmButtonText", "confirmButtonTextTranslationKey", "confirmButtonType", "cancelButtonText", "cancelButtonTextTranslationKey", "cancelButtonType", "showModalSubject$", "outputOnConfirm"], outputs: ["confirmEvent", "cancelEvent"] }, { kind: "directive", type: i3.IconDirective, selector: "[cdsIcon], [ibmIcon]", inputs: ["ibmIcon", "cdsIcon", "size", "title", "ariaLabel", "ariaLabelledBy", "ariaHidden", "isFocusable"] }, { kind: "component", type: i4.CarbonListComponent, selector: "valtimo-carbon-list", inputs: ["items", "fields", "tableTranslations", "paginatorConfig", "pagination", "loading", "actions", "header", "initialSortState", "isSearchable", "enableSingleSelection", "lastColumnTemplate", "paginationIdentifier", "showSelectionColumn", "striped"], outputs: ["rowClicked", "paginationClicked", "paginationSet", "search", "sortChanged"] }, { kind: "component", type: i4.CarbonNoResultsComponent, selector: "valtimo-no-results", inputs: ["action", "description", "illustration", "title"] }, { kind: "pipe", type: i2$2.AsyncPipe, name: "async" }, { kind: "pipe", type: i2$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
805
+ }
806
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DashboardManagementComponent, decorators: [{
807
+ type: Component,
808
+ args: [{ changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container *ngIf=\"tableData$ | async as data\">\n <valtimo-carbon-list\n [header]=\"true\"\n [items]=\"data.items\"\n [loading]=\"data.loading\"\n [fields]=\"fields\"\n (rowClicked)=\"onRowClick($event)\"\n class=\"valtimo-dashboard-management__table\"\n >\n <ng-container header> {{ 'dashboardManagement.title' | translate }} </ng-container>\n\n <div carbonToolbarContent>\n <ng-container [ngTemplateOutlet]=\"addDashboardButton\"></ng-container>\n </div>\n\n <valtimo-no-results\n [action]=\"addDashboardButton\"\n description=\"{{ 'dashboardManagement.noResults.description' | translate }}\"\n title=\"{{ 'dashboardManagement.noResults.title' | translate }}\"\n ></valtimo-no-results>\n </valtimo-carbon-list>\n</ng-container>\n\n<cds-modal\n valtimoCdsModal\n [open]=\"openModal$ | async\"\n showFooter=\"true\"\n title=\"{{ 'dashboardManagement.addDashboard' | translate }}\"\n>\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"closeModal()\">\n <h3 cdsModalHeaderHeading>\n {{ 'dashboardManagement.addDashboard' | translate }}\n </h3>\n </cds-modal-header>\n\n <section cdsModalContent>\n <form [formGroup]=\"form\" class=\"valtimo-dashboard-management__form\">\n <cds-label [invalid]=\"getControlInvalid('title')\">\n {{ 'dashboardManagement.addModal.name' | translate }}\n\n <input\n [attr.modal-primary-focus]=\"true\"\n [invalid]=\"getControlInvalid('title')\"\n formControlName=\"title\"\n cdsText\n placeholder=\"{{ 'dashboardManagement.addModal.namePlaceholder' | translate }}\"\n />\n </cds-label>\n\n <cds-label\n [helperText]=\"'dashboardManagement.addModal.descriptionHelperText' | translate\"\n [invalid]=\"getControlInvalid('description')\"\n >\n {{ 'dashboardManagement.description' | translate }}\n\n <input\n [invalid]=\"getControlInvalid('description')\"\n formControlName=\"description\"\n cdsText\n placeholder=\"{{ 'dashboardManagement.addModal.descriptionPlaceholder' | translate }}\"\n />\n </cds-label>\n </form>\n </section>\n\n <cds-modal-footer>\n <button cdsButton=\"ghost\" (click)=\"closeModal()\">\n {{ 'dashboardManagement.cancel' | translate }}\n </button>\n\n <button [disabled]=\"this.form.invalid\" cdsButton=\"primary\" (click)=\"createDashboard()\">\n {{ 'dashboardManagement.create' | translate }}\n </button>\n </cds-modal-footer>\n</cds-modal>\n\n<valtimo-confirmation-modal\n confirmButtonTextTranslationKey=\"dashboardManagement.deleteModal.confirm\"\n confirmButtonType=\"danger\"\n contentTranslationKey=\"dashboardManagement.deleteModalContent\"\n [outputOnConfirm]=\"deleteRowKey$ | async\"\n [showModalSubject$]=\"showDeleteModal$\"\n titleTranslationKey=\"dashboardManagement.delete\"\n (confirmEvent)=\"onConfirmEvent($event)\"\n></valtimo-confirmation-modal>\n\n<ng-template #addDashboardButton>\n <button cdsButton=\"primary\" (click)=\"openModal()\">\n {{ 'dashboardManagement.addDashboard' | translate }}\n\n <svg cdsIcon=\"add\" size=\"16\" class=\"cds--btn__icon\"></svg>\n </button>\n</ng-template>\n", styles: ["/*!\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.valtimo-dashboard-management__actions{width:1px}.valtimo-dashboard-management__form>*:not(:last-child){margin-bottom:32px}\n"] }]
809
+ }], ctorParameters: function () { return [{ type: DashboardManagementService }, { type: i1$1.FormBuilder }, { type: i5$1.Router }]; } });
810
+
811
+ /*
812
+ * Copyright 2015-2023 Ritense BV, the Netherlands.
813
+ *
814
+ * Licensed under EUPL, Version 1.2 (the "License");
815
+ * you may not use this file except in compliance with the License.
816
+ * You may obtain a copy of the License at
817
+ *
818
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
819
+ *
820
+ * Unless required by applicable law or agreed to in writing, software
821
+ * distributed under the License is distributed on an "AS IS" basis,
822
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
823
+ * See the License for the specific language governing permissions and
824
+ * limitations under the License.
825
+ */
826
+ const routes = [
827
+ {
828
+ path: 'dashboard-management',
829
+ component: DashboardManagementComponent,
830
+ canActivate: [AuthGuardService],
831
+ data: { title: 'Dashboard configuration', roles: [ROLE_ADMIN] },
832
+ },
833
+ {
834
+ path: 'dashboard-management/:id',
835
+ component: DashboardDetailsComponent,
836
+ canActivate: [AuthGuardService],
837
+ data: {
838
+ title: 'Dashboard details',
839
+ roles: [ROLE_ADMIN],
840
+ customPageTitle: true,
841
+ customPageSubtitle: true,
842
+ },
843
+ },
844
+ ];
845
+ class DashboardManagementRoutingModule {
846
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DashboardManagementRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
847
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: DashboardManagementRoutingModule, imports: [i5$1.RouterModule], exports: [RouterModule] }); }
848
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DashboardManagementRoutingModule, imports: [RouterModule.forRoot(routes), RouterModule] }); }
849
+ }
850
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DashboardManagementRoutingModule, decorators: [{
851
+ type: NgModule,
852
+ args: [{
853
+ imports: [RouterModule.forRoot(routes)],
854
+ exports: [RouterModule],
855
+ declarations: [],
856
+ }]
857
+ }] });
858
+
859
+ /*
860
+ * Copyright 2015-2023 Ritense BV, the Netherlands.
861
+ *
862
+ * Licensed under EUPL, Version 1.2 (the "License");
863
+ * you may not use this file except in compliance with the License.
864
+ * You may obtain a copy of the License at
865
+ *
866
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
867
+ *
868
+ * Unless required by applicable law or agreed to in writing, software
869
+ * distributed under the License is distributed on an "AS IS" basis,
870
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
871
+ * See the License for the specific language governing permissions and
872
+ * limitations under the License.
873
+ */
874
+ class DashboardManagementModule {
875
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DashboardManagementModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
876
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: DashboardManagementModule, declarations: [DashboardManagementComponent,
877
+ DashboardDetailsComponent,
878
+ WidgetModalComponent,
879
+ EditDashboardModalComponent,
880
+ WidgetConfigurationContainerComponent], imports: [ButtonModule,
881
+ CommonModule,
882
+ DashboardManagementRoutingModule,
883
+ DropdownModule,
884
+ InputModule,
885
+ ListModule,
886
+ ModalModule,
887
+ ReactiveFormsModule,
888
+ SpinnerModule,
889
+ TranslateModule,
890
+ RenderInPageHeaderDirectiveModule,
891
+ ConfirmationModalModule,
892
+ NotificationModule,
893
+ IconModule,
894
+ WidgetTranslatePipeModule,
895
+ CarbonListModule] }); }
896
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DashboardManagementModule, imports: [ButtonModule,
897
+ CommonModule,
898
+ DashboardManagementRoutingModule,
899
+ DropdownModule,
900
+ InputModule,
901
+ ListModule,
902
+ ModalModule,
903
+ ReactiveFormsModule,
904
+ SpinnerModule,
905
+ TranslateModule,
906
+ RenderInPageHeaderDirectiveModule,
907
+ ConfirmationModalModule,
908
+ NotificationModule,
909
+ IconModule,
910
+ WidgetTranslatePipeModule,
911
+ CarbonListModule] }); }
912
+ }
913
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DashboardManagementModule, decorators: [{
914
+ type: NgModule,
915
+ args: [{
916
+ declarations: [
917
+ DashboardManagementComponent,
918
+ DashboardDetailsComponent,
919
+ WidgetModalComponent,
920
+ EditDashboardModalComponent,
921
+ WidgetConfigurationContainerComponent,
922
+ ],
923
+ imports: [
924
+ ButtonModule,
925
+ CommonModule,
926
+ DashboardManagementRoutingModule,
927
+ DropdownModule,
928
+ InputModule,
929
+ ListModule,
930
+ ModalModule,
931
+ ReactiveFormsModule,
932
+ SpinnerModule,
933
+ TranslateModule,
934
+ RenderInPageHeaderDirectiveModule,
935
+ ConfirmationModalModule,
936
+ NotificationModule,
937
+ IconModule,
938
+ WidgetTranslatePipeModule,
939
+ CarbonListModule,
940
+ ],
941
+ exports: [],
942
+ }]
943
+ }] });
944
+
945
+ /*
946
+ * Copyright 2015-2023 Ritense BV, the Netherlands.
947
+ *
948
+ * Licensed under EUPL, Version 1.2 (the "License");
949
+ * you may not use this file except in compliance with the License.
950
+ * You may obtain a copy of the License at
951
+ *
952
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
953
+ *
954
+ * Unless required by applicable law or agreed to in writing, software
955
+ * distributed under the License is distributed on an "AS IS" basis,
956
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
957
+ * See the License for the specific language governing permissions and
958
+ * limitations under the License.
959
+ */
960
+ /*
961
+ * Public API Surface of dashboard-management
962
+ */
963
+
964
+ /**
965
+ * Generated bundle index. Do not edit.
966
+ */
967
+
968
+ export { DashboardManagementModule };
969
+ //# sourceMappingURL=valtimo-dashboard-management.mjs.map