@valtimo/form-management 0.0.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 (52) hide show
  1. package/README.md +32 -0
  2. package/fesm2022/valtimo-form-management.mjs +1304 -0
  3. package/fesm2022/valtimo-form-management.mjs.map +1 -0
  4. package/index.d.ts +6 -0
  5. package/lib/components/form-management/form-management.component.d.ts +24 -0
  6. package/lib/components/form-management/form-management.component.d.ts.map +1 -0
  7. package/lib/components/form-management-create/form-management-create.component.d.ts +28 -0
  8. package/lib/components/form-management-create/form-management-create.component.d.ts.map +1 -0
  9. package/lib/components/form-management-create/index.d.ts +2 -0
  10. package/lib/components/form-management-create/index.d.ts.map +1 -0
  11. package/lib/components/form-management-duplicate/form-management-duplicate.component.d.ts +31 -0
  12. package/lib/components/form-management-duplicate/form-management-duplicate.component.d.ts.map +1 -0
  13. package/lib/components/form-management-duplicate/index.d.ts +2 -0
  14. package/lib/components/form-management-duplicate/index.d.ts.map +1 -0
  15. package/lib/components/form-management-edit/form-management-edit.component.d.ts +83 -0
  16. package/lib/components/form-management-edit/form-management-edit.component.d.ts.map +1 -0
  17. package/lib/components/form-management-edit/index.d.ts +2 -0
  18. package/lib/components/form-management-edit/index.d.ts.map +1 -0
  19. package/lib/components/form-management-list/form-management-list.component.d.ts +50 -0
  20. package/lib/components/form-management-list/form-management-list.component.d.ts.map +1 -0
  21. package/lib/components/form-management-list/index.d.ts +2 -0
  22. package/lib/components/form-management-list/index.d.ts.map +1 -0
  23. package/lib/components/form-management-upload/form-management-upload.component.d.ts +28 -0
  24. package/lib/components/form-management-upload/form-management-upload.component.d.ts.map +1 -0
  25. package/lib/components/form-management-upload/index.d.ts +2 -0
  26. package/lib/components/form-management-upload/index.d.ts.map +1 -0
  27. package/lib/components/index.d.ts +6 -0
  28. package/lib/components/index.d.ts.map +1 -0
  29. package/lib/form-management.module.d.ts +14 -0
  30. package/lib/form-management.module.d.ts.map +1 -0
  31. package/lib/models/form-definition.model.d.ts +32 -0
  32. package/lib/models/form-definition.model.d.ts.map +1 -0
  33. package/lib/models/form-edit-tabs.enum.d.ts +6 -0
  34. package/lib/models/form-edit-tabs.enum.d.ts.map +1 -0
  35. package/lib/models/form-management.model.d.ts +11 -0
  36. package/lib/models/form-management.model.d.ts.map +1 -0
  37. package/lib/models/index.d.ts +4 -0
  38. package/lib/models/index.d.ts.map +1 -0
  39. package/lib/services/form-management.service.d.ts +25 -0
  40. package/lib/services/form-management.service.d.ts.map +1 -0
  41. package/lib/services/index.d.ts +2 -0
  42. package/lib/services/index.d.ts.map +1 -0
  43. package/lib/utils/form-management.utils.d.ts +6 -0
  44. package/lib/utils/form-management.utils.d.ts.map +1 -0
  45. package/lib/utils/index.d.ts +2 -0
  46. package/lib/utils/index.d.ts.map +1 -0
  47. package/lib/validators/no-duplicate-form.validator.d.ts +6 -0
  48. package/lib/validators/no-duplicate-form.validator.d.ts.map +1 -0
  49. package/package.json +24 -0
  50. package/public-api.d.ts +6 -0
  51. package/public-api.d.ts.map +1 -0
  52. package/valtimo-form-management.d.ts.map +1 -0
@@ -0,0 +1,1304 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, EventEmitter, Output, Input, Component, Inject, ChangeDetectionStrategy, HostBinding, ViewEncapsulation, NgModule } from '@angular/core';
3
+ import { of, map as map$1, switchMap, tap, BehaviorSubject, startWith, Subscription, combineLatest, filter as filter$1, take as take$1 } from 'rxjs';
4
+ import * as i4 from '@valtimo/shared';
5
+ import { BaseApiService, getCaseManagementRouteParams, getCaseManagementRouteParamsAndContext, ROLE_ADMIN, RouterUtils } from '@valtimo/shared';
6
+ import * as i1 from '@angular/common/http';
7
+ import * as i7 from '@angular/common';
8
+ import { CommonModule } from '@angular/common';
9
+ import * as i3 from '@angular/router';
10
+ import { RouterOutlet, RouterModule } from '@angular/router';
11
+ import * as i2$1 from 'carbon-components-angular';
12
+ import { ButtonModule, InputModule, TilesModule, LayerModule, ModalModule, BaseModal, FileUploaderModule, TabsModule, DialogModule, TagModule, IconModule, LoadingModule } from 'carbon-components-angular';
13
+ import * as i2 from '@angular/forms';
14
+ import { FormControl, Validators, ReactiveFormsModule, FormGroup, FormsModule } from '@angular/forms';
15
+ import * as i5 from '@ngx-translate/core';
16
+ import { TranslateModule } from '@ngx-translate/core';
17
+ import * as i3$1 from '@valtimo/components';
18
+ import { WidgetModule, ValtimoCdsModalDirective, CARBON_CONSTANTS, CarbonListModule, EditorModule, FormIoModule, RenderInPageHeaderDirective, ConfirmationModalModule, SpinnerModule, ViewType } from '@valtimo/components';
19
+ import { map, filter, take, switchMap as switchMap$1, distinctUntilChanged, tap as tap$1 } from 'rxjs/operators';
20
+ import { ArrowLeft16, Upload16 } from '@carbon/icons';
21
+ import { AuthGuardService } from '@valtimo/security';
22
+
23
+ /*
24
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
25
+ *
26
+ * Licensed under EUPL, Version 1.2 (the "License");
27
+ * you may not use this file except in compliance with the License.
28
+ * You may obtain a copy of the License at
29
+ *
30
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
31
+ *
32
+ * Unless required by applicable law or agreed to in writing, software
33
+ * distributed under the License is distributed on an "AS IS" basis,
34
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35
+ * See the License for the specific language governing permissions and
36
+ * limitations under the License.
37
+ */
38
+ class FormManagementService extends BaseApiService {
39
+ constructor(httpClient, configService) {
40
+ super(httpClient, configService);
41
+ this.httpClient = httpClient;
42
+ this.configService = configService;
43
+ }
44
+ getFormDefinition(formDefinitionId) {
45
+ return this.httpClient.get(this.getApiUrl(`/management/v1/form/${formDefinitionId}`));
46
+ }
47
+ getFormDefinitionCase(caseDefinitionKey, caseDefinitionVersionTag, formDefinitionId) {
48
+ return this.httpClient.get(this.getApiUrl(`/management/v1/case-definition/${caseDefinitionKey}/version/${caseDefinitionVersionTag}/form/${formDefinitionId}`));
49
+ }
50
+ existsFormDefinition(formDefinitionName) {
51
+ if (!formDefinitionName)
52
+ return of(false);
53
+ return this.httpClient.get(this.getApiUrl(`/management/v1/form/exists/${formDefinitionName}`));
54
+ }
55
+ existsFormDefinitionCase(caseDefinitionKey, caseDefinitionVersionTag, formDefinitionName) {
56
+ if (!formDefinitionName || !caseDefinitionKey || !caseDefinitionVersionTag)
57
+ return of(false);
58
+ return this.httpClient.get(this.getApiUrl(`management/v1/case-definition/${caseDefinitionKey}/version/${caseDefinitionVersionTag}/form/${formDefinitionName}/exists`));
59
+ }
60
+ queryFormDefinitions(params) {
61
+ return this.httpClient.get(this.getApiUrl(`/management/v1/form`), {
62
+ params,
63
+ });
64
+ }
65
+ queryFormDefinitionsCase(caseDefinitionKey, caseDefinitionVersionTag, params) {
66
+ return this.httpClient.get(this.getApiUrl(`/management/v1/case-definition/${caseDefinitionKey}/version/${caseDefinitionVersionTag}/form`), {
67
+ params,
68
+ });
69
+ }
70
+ createFormDefinition(request) {
71
+ return this.httpClient.post(this.getApiUrl(`/management/v1/form`), request);
72
+ }
73
+ createFormDefinitionsCase(caseDefinitionKey, caseDefinitionVersionTag, request) {
74
+ return this.httpClient.post(this.getApiUrl(`/management/v1/case-definition/${caseDefinitionKey}/version/${caseDefinitionVersionTag}/form`), request);
75
+ }
76
+ modifyFormDefinition(request) {
77
+ return this.httpClient.put(this.getApiUrl(`/management/v1/form`), request);
78
+ }
79
+ modifyFormDefinitionCase(caseDefinitionKey, caseDefinitionVersionTag, request) {
80
+ return this.httpClient.put(this.getApiUrl(`/management/v1/case-definition/${caseDefinitionKey}/version/${caseDefinitionVersionTag}/form`), request);
81
+ }
82
+ deleteFormDefinition(formDefinitionId) {
83
+ return this.httpClient.delete(this.getApiUrl(`/management/v1/form/${formDefinitionId}`));
84
+ }
85
+ deleteFormDefinitionCase(caseDefinitionKey, caseDefinitionVersionTag, formDefinitionId) {
86
+ return this.httpClient.delete(this.getApiUrl(`/management/v1/case-definition/${caseDefinitionKey}/version/${caseDefinitionVersionTag}/form/${formDefinitionId}`));
87
+ }
88
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormManagementService, deps: [{ token: i1.HttpClient }, { token: i4.ConfigService }], target: i0.ɵɵFactoryTarget.Injectable }); }
89
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormManagementService, providedIn: 'root' }); }
90
+ }
91
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormManagementService, decorators: [{
92
+ type: Injectable,
93
+ args: [{
94
+ providedIn: 'root',
95
+ }]
96
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i4.ConfigService }] });
97
+
98
+ function getContextObservable(route) {
99
+ return route.data.pipe(map(data => (data && data['context']) || ''));
100
+ }
101
+
102
+ /*
103
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
104
+ *
105
+ * Licensed under EUPL, Version 1.2 (the "License");
106
+ * you may not use this file except in compliance with the License.
107
+ * You may obtain a copy of the License at
108
+ *
109
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
110
+ *
111
+ * Unless required by applicable law or agreed to in writing, software
112
+ * distributed under the License is distributed on an "AS IS" basis,
113
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
114
+ * See the License for the specific language governing permissions and
115
+ * limitations under the License.
116
+ */
117
+
118
+ /*
119
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
120
+ *
121
+ * Licensed under EUPL, Version 1.2 (the "License");
122
+ * you may not use this file except in compliance with the License.
123
+ * You may obtain a copy of the License at
124
+ *
125
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
126
+ *
127
+ * Unless required by applicable law or agreed to in writing, software
128
+ * distributed under the License is distributed on an "AS IS" basis,
129
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
130
+ * See the License for the specific language governing permissions and
131
+ * limitations under the License.
132
+ */
133
+ function noDuplicateFormValidator(context, params, formManagementService) {
134
+ return (control) => (context === 'case'
135
+ ? formManagementService.existsFormDefinitionCase(params.caseDefinitionKey, params.caseDefinitionVersionTag, control.value.toString())
136
+ : formManagementService.existsFormDefinition(control.value.toString())).pipe(map$1((result) => (result ? { duplicate: true } : null)));
137
+ }
138
+
139
+ /*
140
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
141
+ *
142
+ * Licensed under EUPL, Version 1.2 (the "License");
143
+ * you may not use this file except in compliance with the License.
144
+ * You may obtain a copy of the License at
145
+ *
146
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
147
+ *
148
+ * Unless required by applicable law or agreed to in writing, software
149
+ * distributed under the License is distributed on an "AS IS" basis,
150
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
151
+ * See the License for the specific language governing permissions and
152
+ * limitations under the License.
153
+ */
154
+
155
+ /*
156
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
157
+ *
158
+ * Licensed under EUPL, Version 1.2 (the "License");
159
+ * you may not use this file except in compliance with the License.
160
+ * You may obtain a copy of the License at
161
+ *
162
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
163
+ *
164
+ * Unless required by applicable law or agreed to in writing, software
165
+ * distributed under the License is distributed on an "AS IS" basis,
166
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
167
+ * See the License for the specific language governing permissions and
168
+ * limitations under the License.
169
+ */
170
+ class FormManagementCreateComponent {
171
+ constructor(formManagementService, formBuilder, route) {
172
+ this.formManagementService = formManagementService;
173
+ this.formBuilder = formBuilder;
174
+ this.route = route;
175
+ this.upload = false;
176
+ this.goBackEvent = new EventEmitter();
177
+ this.afterCreateEvent = new EventEmitter();
178
+ this.afterUploadEvent = new EventEmitter();
179
+ this.context$ = getContextObservable(this.route);
180
+ this.caseManagementRouteParams$ = this.context$.pipe(filter(context => context === 'case'), switchMap(() => getCaseManagementRouteParams(this.route)));
181
+ }
182
+ ngOnInit() {
183
+ this.initForm();
184
+ }
185
+ initForm() {
186
+ getCaseManagementRouteParamsAndContext(this.route)
187
+ .pipe(take(1), tap(([context, caseManagementParams]) => {
188
+ this.form = this.formBuilder.group({
189
+ name: new FormControl('', Validators.required, [
190
+ noDuplicateFormValidator(context, caseManagementParams, this.formManagementService),
191
+ ]),
192
+ });
193
+ }))
194
+ .subscribe();
195
+ }
196
+ get formControls() {
197
+ return this.form?.controls;
198
+ }
199
+ onBackButtonClick() {
200
+ this.goBackEvent.emit();
201
+ }
202
+ reset() {
203
+ this.form.setValue({ name: '' });
204
+ }
205
+ onCloseEvent() {
206
+ this.goBackEvent.emit();
207
+ }
208
+ createFormDefinition() {
209
+ const emptyForm = { display: 'form', components: [] };
210
+ const request = {
211
+ name: this.form.value.name,
212
+ formDefinition: JSON.stringify(emptyForm),
213
+ };
214
+ getCaseManagementRouteParamsAndContext(this.route)
215
+ .pipe(take(1), switchMap(([context, caseManagementParams]) => context === 'case'
216
+ ? this.formManagementService.createFormDefinitionsCase(caseManagementParams.caseDefinitionKey, caseManagementParams.caseDefinitionVersionTag, request)
217
+ : this.formManagementService.createFormDefinition(request)), tap(formDefinition => {
218
+ if (this.upload) {
219
+ this.afterUploadEvent.emit(formDefinition.id);
220
+ }
221
+ else {
222
+ this.afterCreateEvent.emit(formDefinition.id);
223
+ }
224
+ }))
225
+ .subscribe();
226
+ }
227
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormManagementCreateComponent, deps: [{ token: FormManagementService }, { token: i2.FormBuilder }, { token: i3.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
228
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: FormManagementCreateComponent, isStandalone: true, selector: "valtimo-form-management-create", inputs: { upload: "upload" }, outputs: { goBackEvent: "goBackEvent", afterCreateEvent: "afterCreateEvent", afterUploadEvent: "afterUploadEvent" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2025 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 valtimoCdsModal\n class=\"form-management-create\"\n size=\"sm\"\n [cdsLayer]=\"0\"\n [open]=\"true\"\n (close)=\"onCloseEvent()\"\n>\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"onCloseEvent()\">\n <h3 cdsModalHeaderHeading>\n {{ 'formManagement.add' | translate }}\n </h3>\n </cds-modal-header>\n\n <form *ngIf=\"form\" [formGroup]=\"form\" (ngSubmit)=\"createFormDefinition()\">\n <section cdsModalContent [cdsLayer]=\"1\">\n <cds-label\n [invalid]=\"formControls?.name?.touched && formControls?.name?.errors\"\n [invalidText]=\"\n (formControls?.name?.errors?.required && ('formManagement.nameIsRequired' | translate)) ||\n (formControls?.name?.errors?.duplicate && ('formManagement.nameIsInUse' | translate)) ||\n 'test'\n \"\n >\n {{ 'formManagement.name' | translate }}\n\n <input\n cdsText\n type=\"text\"\n id=\"name\"\n formControlName=\"name\"\n [invalid]=\"formControls?.name?.touched && formControls?.name?.errors\"\n required\n />\n </cds-label>\n </section>\n\n <cds-modal-footer [cdsLayer]=\"1\">\n <cds-modal-footer>\n <button cdsButton=\"ghost\" (click)=\"$event.preventDefault(); onBackButtonClick()\">\n {{ 'formManagement.back' | translate }}\n </button>\n\n <button cdsButton=\"ghost\" (click)=\"$event.preventDefault(); reset()\">\n {{ 'formManagement.reset' | translate | translate }}\n </button>\n\n <button [disabled]=\"form?.invalid\" type=\"submit\" cdsButton=\"primary\">\n {{ 'formManagement.submit' | translate }}\n </button>\n </cds-modal-footer>\n </cds-modal-footer>\n </form>\n</cds-modal>\n", styles: [".form-management-create{max-width:512px;margin:0 auto}cds-modal-footer{width:100%}\n/*!\n * Copyright 2015-2025 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"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i2$1.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: InputModule }, { kind: "component", type: i2$1.Label, selector: "cds-label, ibm-label", inputs: ["labelInputID", "disabled", "skeleton", "helperText", "invalidText", "invalid", "warn", "warnText", "ariaLabel"] }, { kind: "directive", type: i2$1.TextInput, selector: "[cdsText], [ibmText]", inputs: ["theme", "size", "invalid", "warn", "skeleton"] }, { kind: "ngmodule", type: WidgetModule }, { kind: "ngmodule", type: TilesModule }, { kind: "ngmodule", type: LayerModule }, { kind: "directive", type: i2$1.LayerDirective, selector: "[cdsLayer], [ibmLayer]", inputs: ["ibmLayer", "cdsLayer"], exportAs: ["layer"] }, { kind: "ngmodule", type: ModalModule }, { kind: "component", type: i2$1.Modal, selector: "cds-modal, ibm-modal", inputs: ["size", "theme", "ariaLabel", "open", "trigger", "hasScrollingContent"], outputs: ["overlaySelected", "close"] }, { kind: "component", type: i2$1.ModalHeader, selector: "cds-modal-header, ibm-modal-header", inputs: ["theme", "closeLabel", "showCloseButton"], outputs: ["closeSelect"] }, { kind: "component", type: i2$1.ModalFooter, selector: "cds-modal-footer, ibm-modal-footer" }, { kind: "directive", type: i2$1.ModalContent, selector: "[cdsModalContent], [ibmModalContent]", inputs: ["hasForm"] }, { kind: "directive", type: i2$1.ModalHeaderHeading, selector: "[cdsModalHeaderHeading], [ibmModalHeaderHeading]" }, { kind: "directive", type: ValtimoCdsModalDirective, selector: "[valtimoCdsModal]", inputs: ["minContentHeight"] }] }); }
229
+ }
230
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormManagementCreateComponent, decorators: [{
231
+ type: Component,
232
+ args: [{ selector: 'valtimo-form-management-create', standalone: true, imports: [
233
+ CommonModule,
234
+ ReactiveFormsModule,
235
+ TranslateModule,
236
+ ButtonModule,
237
+ InputModule,
238
+ WidgetModule,
239
+ InputModule,
240
+ TilesModule,
241
+ LayerModule,
242
+ ModalModule,
243
+ ValtimoCdsModalDirective,
244
+ ButtonModule,
245
+ ], template: "<!--\n ~ Copyright 2015-2025 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 valtimoCdsModal\n class=\"form-management-create\"\n size=\"sm\"\n [cdsLayer]=\"0\"\n [open]=\"true\"\n (close)=\"onCloseEvent()\"\n>\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"onCloseEvent()\">\n <h3 cdsModalHeaderHeading>\n {{ 'formManagement.add' | translate }}\n </h3>\n </cds-modal-header>\n\n <form *ngIf=\"form\" [formGroup]=\"form\" (ngSubmit)=\"createFormDefinition()\">\n <section cdsModalContent [cdsLayer]=\"1\">\n <cds-label\n [invalid]=\"formControls?.name?.touched && formControls?.name?.errors\"\n [invalidText]=\"\n (formControls?.name?.errors?.required && ('formManagement.nameIsRequired' | translate)) ||\n (formControls?.name?.errors?.duplicate && ('formManagement.nameIsInUse' | translate)) ||\n 'test'\n \"\n >\n {{ 'formManagement.name' | translate }}\n\n <input\n cdsText\n type=\"text\"\n id=\"name\"\n formControlName=\"name\"\n [invalid]=\"formControls?.name?.touched && formControls?.name?.errors\"\n required\n />\n </cds-label>\n </section>\n\n <cds-modal-footer [cdsLayer]=\"1\">\n <cds-modal-footer>\n <button cdsButton=\"ghost\" (click)=\"$event.preventDefault(); onBackButtonClick()\">\n {{ 'formManagement.back' | translate }}\n </button>\n\n <button cdsButton=\"ghost\" (click)=\"$event.preventDefault(); reset()\">\n {{ 'formManagement.reset' | translate | translate }}\n </button>\n\n <button [disabled]=\"form?.invalid\" type=\"submit\" cdsButton=\"primary\">\n {{ 'formManagement.submit' | translate }}\n </button>\n </cds-modal-footer>\n </cds-modal-footer>\n </form>\n</cds-modal>\n", styles: [".form-management-create{max-width:512px;margin:0 auto}cds-modal-footer{width:100%}\n/*!\n * Copyright 2015-2025 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"] }]
246
+ }], ctorParameters: () => [{ type: FormManagementService }, { type: i2.FormBuilder }, { type: i3.ActivatedRoute }], propDecorators: { upload: [{
247
+ type: Input
248
+ }], goBackEvent: [{
249
+ type: Output
250
+ }], afterCreateEvent: [{
251
+ type: Output
252
+ }], afterUploadEvent: [{
253
+ type: Output
254
+ }] } });
255
+
256
+ /*
257
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
258
+ *
259
+ * Licensed under EUPL, Version 1.2 (the "License");
260
+ * you may not use this file except in compliance with the License.
261
+ * You may obtain a copy of the License at
262
+ *
263
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
264
+ *
265
+ * Unless required by applicable law or agreed to in writing, software
266
+ * distributed under the License is distributed on an "AS IS" basis,
267
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
268
+ * See the License for the specific language governing permissions and
269
+ * limitations under the License.
270
+ */
271
+
272
+ /*
273
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
274
+ *
275
+ * Licensed under EUPL, Version 1.2 (the "License");
276
+ * you may not use this file except in compliance with the License.
277
+ * You may obtain a copy of the License at
278
+ *
279
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
280
+ *
281
+ * Unless required by applicable law or agreed to in writing, software
282
+ * distributed under the License is distributed on an "AS IS" basis,
283
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
284
+ * See the License for the specific language governing permissions and
285
+ * limitations under the License.
286
+ */
287
+ function compareFormDefinitions(fd1, fd2) {
288
+ if (fd1 === null && fd2 === null) {
289
+ return true;
290
+ }
291
+ if (fd1 === null || fd2 === null) {
292
+ return false;
293
+ }
294
+ return fd1.id === fd2.id;
295
+ }
296
+
297
+ /*
298
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
299
+ *
300
+ * Licensed under EUPL, Version 1.2 (the "License");
301
+ * you may not use this file except in compliance with the License.
302
+ * You may obtain a copy of the License at
303
+ *
304
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
305
+ *
306
+ * Unless required by applicable law or agreed to in writing, software
307
+ * distributed under the License is distributed on an "AS IS" basis,
308
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
309
+ * See the License for the specific language governing permissions and
310
+ * limitations under the License.
311
+ */
312
+ var EDIT_TABS;
313
+ (function (EDIT_TABS) {
314
+ EDIT_TABS["BUILDER"] = "formManagement.tabs.formBuilder";
315
+ EDIT_TABS["EDITOR"] = "formManagement.tabs.jsonEditor";
316
+ EDIT_TABS["OUTPUT"] = "formManagement.tabs.output";
317
+ })(EDIT_TABS || (EDIT_TABS = {}));
318
+
319
+ /*
320
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
321
+ *
322
+ * Licensed under EUPL, Version 1.2 (the "License");
323
+ * you may not use this file except in compliance with the License.
324
+ * You may obtain a copy of the License at
325
+ *
326
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
327
+ *
328
+ * Unless required by applicable law or agreed to in writing, software
329
+ * distributed under the License is distributed on an "AS IS" basis,
330
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
331
+ * See the License for the specific language governing permissions and
332
+ * limitations under the License.
333
+ */
334
+
335
+ /*
336
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
337
+ *
338
+ * Licensed under EUPL, Version 1.2 (the "License");
339
+ * you may not use this file except in compliance with the License.
340
+ * You may obtain a copy of the License at
341
+ *
342
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
343
+ *
344
+ * Unless required by applicable law or agreed to in writing, software
345
+ * distributed under the License is distributed on an "AS IS" basis,
346
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
347
+ * See the License for the specific language governing permissions and
348
+ * limitations under the License.
349
+ */
350
+
351
+ /*
352
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
353
+ *
354
+ * Licensed under EUPL, Version 1.2 (the "License");
355
+ * you may not use this file except in compliance with the License.
356
+ * You may obtain a copy of the License at
357
+ *
358
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
359
+ *
360
+ * Unless required by applicable law or agreed to in writing, software
361
+ * distributed under the License is distributed on an "AS IS" basis,
362
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
363
+ * See the License for the specific language governing permissions and
364
+ * limitations under the License.
365
+ */
366
+ class FormManagementDuplicateComponent extends BaseModal {
367
+ get duplicateFormName() {
368
+ return this.duplicateForm.controls['duplicateFormName'];
369
+ }
370
+ getDefaultName() {
371
+ return this.formToDuplicate.name + '-duplicate';
372
+ }
373
+ constructor(formToDuplicate, context, params, modalService, formManagementService, route, router, notificationService, translateService) {
374
+ super();
375
+ this.formToDuplicate = formToDuplicate;
376
+ this.context = context;
377
+ this.params = params;
378
+ this.modalService = modalService;
379
+ this.formManagementService = formManagementService;
380
+ this.route = route;
381
+ this.router = router;
382
+ this.notificationService = notificationService;
383
+ this.translateService = translateService;
384
+ }
385
+ ngOnInit() {
386
+ this.initForm();
387
+ }
388
+ initForm() {
389
+ this.duplicateForm = new FormGroup({
390
+ duplicateFormName: new FormControl(this.getDefaultName(), Validators.compose([Validators.required]), [noDuplicateFormValidator(this.context, this.params, this.formManagementService)]),
391
+ });
392
+ this.duplicateForm.markAllAsTouched();
393
+ }
394
+ duplicate() {
395
+ const control = this.duplicateFormName;
396
+ this.formToDuplicate.name = this.duplicateForm.controls['duplicateFormName'].value;
397
+ const request = {
398
+ name: control.value.toString(),
399
+ formDefinition: JSON.stringify(this.formToDuplicate.formDefinition),
400
+ };
401
+ (this.context === 'case'
402
+ ? this.formManagementService.createFormDefinitionsCase(this.params.caseDefinitionKey, this.params.caseDefinitionVersionTag, request)
403
+ : this.formManagementService.createFormDefinition(request))
404
+ .pipe(take(1))
405
+ .subscribe({
406
+ next: formDefinition => {
407
+ this.navigateWithNewId(formDefinition.id).then(() => {
408
+ this.closeModal();
409
+ this.notificationService.showToast({
410
+ type: 'success',
411
+ title: this.translateService.instant('formManagement.notifications.duplicated'),
412
+ });
413
+ });
414
+ },
415
+ error: err => {
416
+ if (err.toString().includes('Duplicate name')) {
417
+ control.setErrors({ duplicate: true });
418
+ }
419
+ else {
420
+ control.setErrors({ incorrect: true });
421
+ }
422
+ },
423
+ });
424
+ }
425
+ async navigateWithNewId(newId) {
426
+ const currentUrl = this.router.url.split('?')[0];
427
+ const segments = currentUrl.split('/');
428
+ const formIdIndex = segments.findIndex(segment => segment.match(/^[a-f0-9-]{36}$/));
429
+ if (formIdIndex !== -1) {
430
+ segments[formIdIndex] = newId;
431
+ }
432
+ const updatedUrl = segments.join('/');
433
+ const queryParams = { ...this.route.snapshot.queryParams };
434
+ try {
435
+ return await this.router.navigate([updatedUrl], { queryParams });
436
+ }
437
+ catch (error) {
438
+ return false;
439
+ }
440
+ }
441
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormManagementDuplicateComponent, deps: [{ token: 'formToDuplicate' }, { token: 'context' }, { token: 'params' }, { token: i2$1.ModalService }, { token: FormManagementService }, { token: i3.ActivatedRoute }, { token: i3.Router }, { token: i4.GlobalNotificationService }, { token: i5.TranslateService }], target: i0.ɵɵFactoryTarget.Component }); }
442
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: FormManagementDuplicateComponent, isStandalone: true, selector: "valtimo-form-management-duplicate-modal", usesInheritance: true, ngImport: i0, template: "<!--\n ~ Copyright 2015-2025 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 valtimoCdsModal\n class=\"form-management-create\"\n size=\"sm\"\n [cdsLayer]=\"0\"\n [open]=\"true\"\n (close)=\"closeModal()\"\n>\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"closeModal()\">\n <h3 cdsModalHeaderHeading>\n {{ 'formManagement.duplicate' | translate }}\n </h3>\n </cds-modal-header>\n\n <form [formGroup]=\"duplicateForm\">\n <section cdsModalContent [cdsLayer]=\"1\">\n <cds-label\n [invalid]=\"duplicateFormName?.touched && duplicateFormName?.errors\"\n [invalidText]=\"\n (duplicateFormName?.errors?.required && ('formManagement.nameIsRequired' | translate)) ||\n (duplicateFormName?.errors?.duplicate && ('formManagement.nameIsInUse' | translate)) ||\n 'Error'\n \"\n >\n {{ 'formManagement.name' | translate }}\n\n <input\n cdsText\n type=\"text\"\n id=\"duplicateFormName\"\n formControlName=\"duplicateFormName\"\n [invalid]=\"duplicateFormName?.touched && duplicateFormName?.errors\"\n required\n />\n </cds-label>\n </section>\n\n <cds-modal-footer [cdsLayer]=\"1\">\n <cds-modal-footer>\n <button cdsButton=\"secondary\" (click)=\"closeModal()\">\n {{ 'interface.cancel' | translate }}\n </button>\n\n <button [disabled]=\"duplicateForm.invalid\" cdsButton=\"primary\" (click)=\"duplicate()\">\n {{ 'formManagement.submit' | translate }}\n </button>\n </cds-modal-footer>\n </cds-modal-footer>\n </form>\n</cds-modal>\n", styles: ["/*!\n * Copyright 2015-2025 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"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: ModalModule }, { kind: "component", type: i2$1.Modal, selector: "cds-modal, ibm-modal", inputs: ["size", "theme", "ariaLabel", "open", "trigger", "hasScrollingContent"], outputs: ["overlaySelected", "close"] }, { kind: "component", type: i2$1.ModalHeader, selector: "cds-modal-header, ibm-modal-header", inputs: ["theme", "closeLabel", "showCloseButton"], outputs: ["closeSelect"] }, { kind: "component", type: i2$1.ModalFooter, selector: "cds-modal-footer, ibm-modal-footer" }, { kind: "directive", type: i2$1.ModalContent, selector: "[cdsModalContent], [ibmModalContent]", inputs: ["hasForm"] }, { kind: "directive", type: i2$1.ModalHeaderHeading, selector: "[cdsModalHeaderHeading], [ibmModalHeaderHeading]" }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i2$1.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: InputModule }, { kind: "component", type: i2$1.Label, selector: "cds-label, ibm-label", inputs: ["labelInputID", "disabled", "skeleton", "helperText", "invalidText", "invalid", "warn", "warnText", "ariaLabel"] }, { kind: "directive", type: i2$1.TextInput, selector: "[cdsText], [ibmText]", inputs: ["theme", "size", "invalid", "warn", "skeleton"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: LayerModule }, { kind: "directive", type: i2$1.LayerDirective, selector: "[cdsLayer], [ibmLayer]", inputs: ["ibmLayer", "cdsLayer"], exportAs: ["layer"] }, { kind: "directive", type: ValtimoCdsModalDirective, selector: "[valtimoCdsModal]", inputs: ["minContentHeight"] }] }); }
443
+ }
444
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormManagementDuplicateComponent, decorators: [{
445
+ type: Component,
446
+ args: [{ selector: 'valtimo-form-management-duplicate-modal', standalone: true, imports: [
447
+ CommonModule,
448
+ TranslateModule,
449
+ ModalModule,
450
+ ButtonModule,
451
+ InputModule,
452
+ ReactiveFormsModule,
453
+ FormsModule,
454
+ LayerModule,
455
+ ValtimoCdsModalDirective,
456
+ ], template: "<!--\n ~ Copyright 2015-2025 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 valtimoCdsModal\n class=\"form-management-create\"\n size=\"sm\"\n [cdsLayer]=\"0\"\n [open]=\"true\"\n (close)=\"closeModal()\"\n>\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"closeModal()\">\n <h3 cdsModalHeaderHeading>\n {{ 'formManagement.duplicate' | translate }}\n </h3>\n </cds-modal-header>\n\n <form [formGroup]=\"duplicateForm\">\n <section cdsModalContent [cdsLayer]=\"1\">\n <cds-label\n [invalid]=\"duplicateFormName?.touched && duplicateFormName?.errors\"\n [invalidText]=\"\n (duplicateFormName?.errors?.required && ('formManagement.nameIsRequired' | translate)) ||\n (duplicateFormName?.errors?.duplicate && ('formManagement.nameIsInUse' | translate)) ||\n 'Error'\n \"\n >\n {{ 'formManagement.name' | translate }}\n\n <input\n cdsText\n type=\"text\"\n id=\"duplicateFormName\"\n formControlName=\"duplicateFormName\"\n [invalid]=\"duplicateFormName?.touched && duplicateFormName?.errors\"\n required\n />\n </cds-label>\n </section>\n\n <cds-modal-footer [cdsLayer]=\"1\">\n <cds-modal-footer>\n <button cdsButton=\"secondary\" (click)=\"closeModal()\">\n {{ 'interface.cancel' | translate }}\n </button>\n\n <button [disabled]=\"duplicateForm.invalid\" cdsButton=\"primary\" (click)=\"duplicate()\">\n {{ 'formManagement.submit' | translate }}\n </button>\n </cds-modal-footer>\n </cds-modal-footer>\n </form>\n</cds-modal>\n", styles: ["/*!\n * Copyright 2015-2025 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"] }]
457
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
458
+ type: Inject,
459
+ args: ['formToDuplicate']
460
+ }] }, { type: undefined, decorators: [{
461
+ type: Inject,
462
+ args: ['context']
463
+ }] }, { type: undefined, decorators: [{
464
+ type: Inject,
465
+ args: ['params']
466
+ }] }, { type: i2$1.ModalService }, { type: FormManagementService }, { type: i3.ActivatedRoute }, { type: i3.Router }, { type: i4.GlobalNotificationService }, { type: i5.TranslateService }] });
467
+
468
+ /*
469
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
470
+ *
471
+ * Licensed under EUPL, Version 1.2 (the "License");
472
+ * you may not use this file except in compliance with the License.
473
+ * You may obtain a copy of the License at
474
+ *
475
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
476
+ *
477
+ * Unless required by applicable law or agreed to in writing, software
478
+ * distributed under the License is distributed on an "AS IS" basis,
479
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
480
+ * See the License for the specific language governing permissions and
481
+ * limitations under the License.
482
+ */
483
+
484
+ /*
485
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
486
+ *
487
+ * Licensed under EUPL, Version 1.2 (the "License");
488
+ * you may not use this file except in compliance with the License.
489
+ * You may obtain a copy of the License at
490
+ *
491
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
492
+ *
493
+ * Unless required by applicable law or agreed to in writing, software
494
+ * distributed under the License is distributed on an "AS IS" basis,
495
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
496
+ * See the License for the specific language governing permissions and
497
+ * limitations under the License.
498
+ */
499
+ class FormManagementUploadComponent {
500
+ constructor(formBuilder, notificationService, translateService) {
501
+ this.formBuilder = formBuilder;
502
+ this.notificationService = notificationService;
503
+ this.translateService = translateService;
504
+ this.definitionUploaded = new EventEmitter();
505
+ this.modalOpen$ = new BehaviorSubject(false);
506
+ this.ACCEPTED_FILES = ['json'];
507
+ this.form = this.formBuilder.group({
508
+ file: this.formBuilder.control(new Set(), [Validators.required]),
509
+ });
510
+ this.fileSelected$ = this.form.get('file')?.valueChanges.pipe(startWith(null), map$1(value => !!(value instanceof Set && value.size > 0)));
511
+ this._subscriptions = new Subscription();
512
+ }
513
+ ngOnInit() {
514
+ this._subscriptions.add(this.show$.subscribe(show => {
515
+ this.modalOpen$.next(show);
516
+ }));
517
+ }
518
+ ngOnDestroy() {
519
+ this._subscriptions.unsubscribe();
520
+ }
521
+ closeModal() {
522
+ this.modalOpen$.next(false);
523
+ setTimeout(() => {
524
+ this.form.reset();
525
+ }, CARBON_CONSTANTS.modalAnimationMs);
526
+ }
527
+ async uploadFormDefinition() {
528
+ const formioDefinition = this.form.value?.file?.values()?.next()?.value?.file;
529
+ const formioDefinitionString = await formioDefinition.text();
530
+ if (!formioDefinitionString)
531
+ return;
532
+ this.notificationService.showNotification({
533
+ type: 'success',
534
+ title: this.translateService.instant('formManagement.upload.success'),
535
+ });
536
+ this.definitionUploaded.emit(formioDefinitionString);
537
+ this.modalOpen$.next(false);
538
+ }
539
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormManagementUploadComponent, deps: [{ token: i2.FormBuilder }, { token: i4.GlobalNotificationService }, { token: i5.TranslateService }], target: i0.ɵɵFactoryTarget.Component }); }
540
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: FormManagementUploadComponent, isStandalone: true, selector: "valtimo-form-management-upload", inputs: { show$: "show$" }, outputs: { definitionUploaded: "definitionUploaded" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2025 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 valtimoCdsModal [open]=\"modalOpen$ | async\" size=\"sm\" (close)=\"closeModal()\">\n <cds-modal-header showCloseButton=\"true\" (closeSelect)=\"closeModal()\">\n <h3 cdsModalHeaderHeading>{{ 'formManagement.upload.modalTitle' | translate }}</h3>\n </cds-modal-header>\n\n <section cdsModalContent [cdsLayer]=\"1\" [formGroup]=\"form\">\n <cds-file-uploader\n [accept]=\"ACCEPTED_FILES\"\n [buttonText]=\"'formManagement.upload.buttonText' | translate\"\n [description]=\"'formManagement.upload.description' | translate\"\n [multiple]=\"false\"\n [title]=\"'formManagement.upload.title' | translate\"\n buttonType=\"primary\"\n formControlName=\"file\"\n >\n </cds-file-uploader>\n </section>\n\n <cds-modal-footer>\n <button cdsButton=\"ghost\" (click)=\"closeModal()\">\n {{ 'interface.cancel' | translate }}\n </button>\n\n <button\n cdsButton=\"primary\"\n [disabled]=\"(fileSelected$ | async) === false\"\n (click)=\"uploadFormDefinition()\"\n >\n {{ 'interface.upload' | translate }}\n </button>\n </cds-modal-footer>\n</cds-modal>\n", styles: ["/*!\n * Copyright 2015-2025 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"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i7.AsyncPipe, name: "async" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: FileUploaderModule }, { kind: "component", type: i2$1.FileUploader, selector: "cds-file-uploader, ibm-file-uploader", inputs: ["buttonText", "buttonType", "title", "description", "accept", "multiple", "skeleton", "size", "fileItemSize", "drop", "dropText", "fileUploaderId", "files", "disabled"], outputs: ["filesChange"] }, { kind: "ngmodule", type: ModalModule }, { kind: "component", type: i2$1.Modal, selector: "cds-modal, ibm-modal", inputs: ["size", "theme", "ariaLabel", "open", "trigger", "hasScrollingContent"], outputs: ["overlaySelected", "close"] }, { kind: "component", type: i2$1.ModalHeader, selector: "cds-modal-header, ibm-modal-header", inputs: ["theme", "closeLabel", "showCloseButton"], outputs: ["closeSelect"] }, { kind: "component", type: i2$1.ModalFooter, selector: "cds-modal-footer, ibm-modal-footer" }, { kind: "directive", type: i2$1.ModalContent, selector: "[cdsModalContent], [ibmModalContent]", inputs: ["hasForm"] }, { kind: "directive", type: i2$1.ModalHeaderHeading, selector: "[cdsModalHeaderHeading], [ibmModalHeaderHeading]" }, { kind: "ngmodule", type: LayerModule }, { kind: "directive", type: i2$1.LayerDirective, selector: "[cdsLayer], [ibmLayer]", inputs: ["ibmLayer", "cdsLayer"], exportAs: ["layer"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i2$1.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
541
+ }
542
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormManagementUploadComponent, decorators: [{
543
+ type: Component,
544
+ args: [{ selector: 'valtimo-form-management-upload', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
545
+ CommonModule,
546
+ TranslateModule,
547
+ FileUploaderModule,
548
+ ModalModule,
549
+ LayerModule,
550
+ ReactiveFormsModule,
551
+ ButtonModule,
552
+ ], template: "<!--\n ~ Copyright 2015-2025 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 valtimoCdsModal [open]=\"modalOpen$ | async\" size=\"sm\" (close)=\"closeModal()\">\n <cds-modal-header showCloseButton=\"true\" (closeSelect)=\"closeModal()\">\n <h3 cdsModalHeaderHeading>{{ 'formManagement.upload.modalTitle' | translate }}</h3>\n </cds-modal-header>\n\n <section cdsModalContent [cdsLayer]=\"1\" [formGroup]=\"form\">\n <cds-file-uploader\n [accept]=\"ACCEPTED_FILES\"\n [buttonText]=\"'formManagement.upload.buttonText' | translate\"\n [description]=\"'formManagement.upload.description' | translate\"\n [multiple]=\"false\"\n [title]=\"'formManagement.upload.title' | translate\"\n buttonType=\"primary\"\n formControlName=\"file\"\n >\n </cds-file-uploader>\n </section>\n\n <cds-modal-footer>\n <button cdsButton=\"ghost\" (click)=\"closeModal()\">\n {{ 'interface.cancel' | translate }}\n </button>\n\n <button\n cdsButton=\"primary\"\n [disabled]=\"(fileSelected$ | async) === false\"\n (click)=\"uploadFormDefinition()\"\n >\n {{ 'interface.upload' | translate }}\n </button>\n </cds-modal-footer>\n</cds-modal>\n", styles: ["/*!\n * Copyright 2015-2025 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"] }]
553
+ }], ctorParameters: () => [{ type: i2.FormBuilder }, { type: i4.GlobalNotificationService }, { type: i5.TranslateService }], propDecorators: { show$: [{
554
+ type: Input
555
+ }], definitionUploaded: [{
556
+ type: Output
557
+ }] } });
558
+
559
+ /*
560
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
561
+ *
562
+ * Licensed under EUPL, Version 1.2 (the "License");
563
+ * you may not use this file except in compliance with the License.
564
+ * You may obtain a copy of the License at
565
+ *
566
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
567
+ *
568
+ * Unless required by applicable law or agreed to in writing, software
569
+ * distributed under the License is distributed on an "AS IS" basis,
570
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
571
+ * See the License for the specific language governing permissions and
572
+ * limitations under the License.
573
+ */
574
+
575
+ /*
576
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
577
+ *
578
+ * Licensed under EUPL, Version 1.2 (the "License");
579
+ * you may not use this file except in compliance with the License.
580
+ * You may obtain a copy of the License at
581
+ *
582
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
583
+ *
584
+ * Unless required by applicable law or agreed to in writing, software
585
+ * distributed under the License is distributed on an "AS IS" basis,
586
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
587
+ * See the License for the specific language governing permissions and
588
+ * limitations under the License.
589
+ */
590
+ class FormManagementEditComponent {
591
+ get _formDefinition() {
592
+ return this._formDefinition$.getValue();
593
+ }
594
+ constructor(formManagementService, modalService, pageTitleService, route, shellService, pageHeaderService, iconService, router, translateService, notificationService, breadcrumbService, environmentService, draftVersionService, formIoTagsService, injector) {
595
+ this.formManagementService = formManagementService;
596
+ this.modalService = modalService;
597
+ this.pageTitleService = pageTitleService;
598
+ this.route = route;
599
+ this.shellService = shellService;
600
+ this.pageHeaderService = pageHeaderService;
601
+ this.iconService = iconService;
602
+ this.router = router;
603
+ this.translateService = translateService;
604
+ this.notificationService = notificationService;
605
+ this.breadcrumbService = breadcrumbService;
606
+ this.environmentService = environmentService;
607
+ this.draftVersionService = draftVersionService;
608
+ this.formIoTagsService = formIoTagsService;
609
+ this.injector = injector;
610
+ this.class = 'valtimo-form-management-edit';
611
+ this.deleteEvent = new EventEmitter();
612
+ this.goBackEvent = new EventEmitter();
613
+ this.formModifiedEvent = new EventEmitter();
614
+ this.formDeletedEvent = new EventEmitter();
615
+ this.deleteErrorEvent = new EventEmitter();
616
+ this.deployErrorEvent = new EventEmitter();
617
+ this.modifiedFormDefinition = null;
618
+ this.validJsonChange = null;
619
+ this.TABS = EDIT_TABS;
620
+ this.activeTab = EDIT_TABS.BUILDER;
621
+ this.editParam$ = this.route.paramMap.pipe(map$1(params => (params.has('formDefinitionId') ? params.get('formDefinitionId') : null)));
622
+ this.context$ = getContextObservable(this.route);
623
+ this.caseManagementRouteParams$ = this.context$.pipe(filter(context => context === 'case'), switchMap$1(() => getCaseManagementRouteParams(this.route)));
624
+ this._formDefinition$ = new BehaviorSubject(null);
625
+ this.canUpdateGlobalConfiguration$ = this.environmentService.canUpdateGlobalConfiguration();
626
+ this.isDraftVersion$ = getCaseManagementRouteParams(this.route).pipe(switchMap$1(params => this.draftVersionService.isDraftVersion(params?.caseDefinitionKey, params?.caseDefinitionVersionTag)));
627
+ this.formDefinition$ = this._formDefinition$.pipe(filter((definition) => !!definition), distinctUntilChanged((prevFormDefinition, currFormDefinition) => JSON.stringify(prevFormDefinition?.formDefinition?.components) ===
628
+ JSON.stringify(currFormDefinition?.formDefinition?.components)), tap$1(() => {
629
+ if (!this._editorInitialized) {
630
+ this._editorInitialized = true;
631
+ return;
632
+ }
633
+ }));
634
+ this.jsonFormDefinition$ = new BehaviorSubject(null);
635
+ this.jsonOutput$ = new BehaviorSubject(null);
636
+ this.reloading$ = new BehaviorSubject(false);
637
+ this.showDeleteModal$ = new BehaviorSubject(false);
638
+ this.showModal$ = new BehaviorSubject(false);
639
+ this.compactMode$ = this.pageHeaderService.compactMode$;
640
+ this._alertSub = Subscription.EMPTY;
641
+ this._changeActive = false;
642
+ this._editorInitialized = false;
643
+ this.iconService.registerAll([ArrowLeft16]);
644
+ this.formIoTagsService.reregisterTags(this.injector);
645
+ }
646
+ ngOnInit() {
647
+ this.loadFormDefinition().subscribe();
648
+ this.checkToOpenUploadModal();
649
+ this.pageTitleService.disableReset();
650
+ this.initBreadcrumbs();
651
+ }
652
+ ngOnDestroy() {
653
+ this._alertSub.unsubscribe();
654
+ this.pageTitleService.enableReset();
655
+ this.pageTitleService.clearPageActionsViewContainerRef();
656
+ this.breadcrumbService.clearThirdBreadcrumb();
657
+ this.breadcrumbService.clearFourthBreadcrumb();
658
+ }
659
+ formBuilderChanged(event, definition) {
660
+ if (event.type === 'updateComponent') {
661
+ return;
662
+ }
663
+ this._changeActive = true;
664
+ this.modifiedFormDefinition = event.form;
665
+ this._formDefinition$.next({ ...this._formDefinition, formDefinition: event.form });
666
+ this.jsonFormDefinition$.next({ ...definition, value: JSON.stringify(event.form) });
667
+ this._changeActive = false;
668
+ }
669
+ delete() {
670
+ this.showDeleteModal$.next(true);
671
+ }
672
+ deleteFormDefinition(definition) {
673
+ getCaseManagementRouteParamsAndContext(this.route)
674
+ .pipe(switchMap$1(([context, caseManagementRouteParams]) => {
675
+ switch (context) {
676
+ case 'case':
677
+ return this.formManagementService.deleteFormDefinitionCase(caseManagementRouteParams?.caseDefinitionKey, caseManagementRouteParams?.caseDefinitionVersionTag, definition.id);
678
+ case 'independent':
679
+ default:
680
+ return this.formManagementService.deleteFormDefinition(definition.id);
681
+ }
682
+ }))
683
+ .subscribe({
684
+ next: () => {
685
+ this.notificationService.showToast({
686
+ type: 'success',
687
+ title: this.translateService.instant('formManagement.notifications.deleted'),
688
+ });
689
+ this.navigateBack();
690
+ },
691
+ error: () => {
692
+ this.notificationService.showToast({
693
+ type: 'error',
694
+ title: this.translateService.instant('formManagement.notifications.deletionError'),
695
+ });
696
+ },
697
+ });
698
+ }
699
+ onGoBackButtonClick() {
700
+ this.navigateBack();
701
+ }
702
+ modifyFormDefinition(definition) {
703
+ combineLatest([this.pageTitleService.customPageTitle$, this.editParam$])
704
+ .pipe(take(1))
705
+ .subscribe(([customPageTitle, formDefinitionId]) => {
706
+ if (!customPageTitle || !formDefinitionId)
707
+ return;
708
+ const form = JSON.stringify(this.modifiedFormDefinition !== null
709
+ ? this.modifiedFormDefinition
710
+ : definition.formDefinition);
711
+ const request = {
712
+ id: formDefinitionId,
713
+ name: customPageTitle,
714
+ formDefinition: form,
715
+ };
716
+ getCaseManagementRouteParamsAndContext(this.route)
717
+ .pipe(switchMap$1(([context, caseManagementRouteParams]) => {
718
+ switch (context) {
719
+ case 'case':
720
+ return this.formManagementService.modifyFormDefinitionCase(caseManagementRouteParams.caseDefinitionKey, caseManagementRouteParams.caseDefinitionVersionTag, request);
721
+ case 'independent':
722
+ default:
723
+ return this.formManagementService.modifyFormDefinition(request);
724
+ }
725
+ }))
726
+ .subscribe({
727
+ next: () => {
728
+ this.notificationService.showToast({
729
+ type: 'success',
730
+ title: this.translateService.instant('formManagement.notifications.deployed'),
731
+ });
732
+ this.navigateBack();
733
+ },
734
+ error: () => {
735
+ this.notificationService.showToast({
736
+ type: 'error',
737
+ title: this.translateService.instant('formManagement.notifications.deploymentError'),
738
+ });
739
+ },
740
+ });
741
+ });
742
+ }
743
+ loadFormDefinition(setDefinition = true) {
744
+ return getCaseManagementRouteParamsAndContext(this.route).pipe(switchMap$1(([context, params]) => combineLatest([of(context), of(params), this.editParam$])), switchMap$1(([context, caseManagementRouteParams, formDefinitionId]) => {
745
+ if (!formDefinitionId)
746
+ return of(null);
747
+ switch (context) {
748
+ case 'case':
749
+ return this.formManagementService.getFormDefinitionCase(caseManagementRouteParams.caseDefinitionKey, caseManagementRouteParams.caseDefinitionVersionTag, formDefinitionId);
750
+ case 'independent':
751
+ default:
752
+ return this.formManagementService.getFormDefinition(formDefinitionId);
753
+ }
754
+ }), tap$1((definition) => {
755
+ if (!definition)
756
+ return;
757
+ if (setDefinition)
758
+ this._formDefinition$.next(definition);
759
+ if (setDefinition)
760
+ this.jsonFormDefinition$.next({
761
+ value: JSON.stringify(definition.formDefinition),
762
+ language: 'json',
763
+ });
764
+ this.pageTitleService.setCustomPageTitle(definition.name);
765
+ }));
766
+ }
767
+ downloadFormDefinition(definition) {
768
+ const file = new Blob([JSON.stringify(definition.formDefinition)], {
769
+ type: 'text/json',
770
+ });
771
+ const link = document.createElement('a');
772
+ link.download = `form_${definition.name}.json`;
773
+ link.href = window.URL.createObjectURL(file);
774
+ link.click();
775
+ window.URL.revokeObjectURL(link.href);
776
+ link.remove();
777
+ }
778
+ onSelectedTab(tab) {
779
+ this.activeTab = tab;
780
+ this.formIoTagsService.reregisterTags(this.injector);
781
+ if (tab === EDIT_TABS.BUILDER) {
782
+ return;
783
+ }
784
+ setTimeout(() => {
785
+ this.shellService.onMainContentResize();
786
+ });
787
+ }
788
+ onOutputChange(event) {
789
+ this.reloading$.next(false);
790
+ if (!event.data) {
791
+ return;
792
+ }
793
+ else if (JSON.stringify(event.data) === this._activeOuput) {
794
+ return;
795
+ }
796
+ this._activeOuput = JSON.stringify(event.data);
797
+ this.jsonOutput$.next({ value: this._activeOuput, language: 'json' });
798
+ }
799
+ onValueChangeEvent(value, definition, disabled) {
800
+ if (this._changeActive || this.validJsonChange === false || disabled) {
801
+ return;
802
+ }
803
+ const parsedDefinition = JSON.parse(value);
804
+ this.modifiedFormDefinition = parsedDefinition;
805
+ this._formDefinition$.next({
806
+ ...definition,
807
+ formDefinition: parsedDefinition,
808
+ });
809
+ }
810
+ onValidEvent(value, disabled) {
811
+ if (this._changeActive || disabled) {
812
+ return;
813
+ }
814
+ this.validJsonChange = value;
815
+ }
816
+ showUploadModal() {
817
+ this.showModal$.next(true);
818
+ }
819
+ showDuplicateModal(definition) {
820
+ getCaseManagementRouteParamsAndContext(this.route)
821
+ .pipe(take(1))
822
+ .subscribe(([context, params]) => {
823
+ this.modalService.create({
824
+ component: FormManagementDuplicateComponent,
825
+ inputs: {
826
+ formToDuplicate: definition,
827
+ context,
828
+ params,
829
+ },
830
+ });
831
+ });
832
+ }
833
+ setFormDefinition(formDefinition) {
834
+ this.reloading$.next(true);
835
+ const definition = JSON.parse(formDefinition);
836
+ if (!definition?.components) {
837
+ this.reloading$.next(false);
838
+ return;
839
+ }
840
+ const components = definition.components;
841
+ const currentDefinition = this.modifiedFormDefinition || definition.formDefinition;
842
+ const newDefinition = { ...currentDefinition, ...(components && { components }) };
843
+ this.modifiedFormDefinition = newDefinition;
844
+ definition.formDefinition = newDefinition;
845
+ this._formDefinition$.next(definition);
846
+ this.jsonFormDefinition$.next({
847
+ value: JSON.stringify(newDefinition),
848
+ language: 'json',
849
+ });
850
+ this.loadFormDefinition(false).subscribe(() => this.reloading$.next(false));
851
+ }
852
+ onConfirmRedirect() {
853
+ const cancelButton = document.querySelector('button[ref="cancelButton"]');
854
+ if (!cancelButton) {
855
+ return;
856
+ }
857
+ cancelButton.click();
858
+ }
859
+ checkToOpenUploadModal() {
860
+ this.route.queryParams.pipe(take(1)).subscribe(params => {
861
+ if (params?.upload === 'true') {
862
+ this.showUploadModal();
863
+ }
864
+ });
865
+ }
866
+ navigateBack() {
867
+ this.router.navigate(['../'], { relativeTo: this.route });
868
+ }
869
+ initBreadcrumbs() {
870
+ getCaseManagementRouteParamsAndContext(this.route)
871
+ .pipe(take(1))
872
+ .subscribe(([context, params]) => {
873
+ if (context === 'independent')
874
+ return;
875
+ const route = `/case-management/case/${params.caseDefinitionKey}/version/${params.caseDefinitionVersionTag}`;
876
+ this.breadcrumbService.setThirdBreadcrumb({
877
+ route: [route],
878
+ content: `${params.caseDefinitionKey} (${params.caseDefinitionVersionTag})`,
879
+ href: route,
880
+ });
881
+ const routeWithForms = `${route}/forms`;
882
+ this.breadcrumbService.setFourthBreadcrumb({
883
+ route: [routeWithForms],
884
+ content: this.translateService.instant('caseManagement.tabs.forms'),
885
+ href: routeWithForms,
886
+ });
887
+ });
888
+ }
889
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormManagementEditComponent, deps: [{ token: FormManagementService }, { token: i2$1.ModalService }, { token: i3$1.PageTitleService }, { token: i3.ActivatedRoute }, { token: i3$1.ShellService }, { token: i3$1.PageHeaderService }, { token: i2$1.IconService }, { token: i3.Router }, { token: i5.TranslateService }, { token: i4.GlobalNotificationService }, { token: i3$1.BreadcrumbService }, { token: i4.EnvironmentService }, { token: i4.DraftVersionService }, { token: i3$1.FormIoTagsService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
890
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: FormManagementEditComponent, isStandalone: true, selector: "valtimo-form-management-edit", outputs: { deleteEvent: "deleteEvent", goBackEvent: "goBackEvent", formModifiedEvent: "formModifiedEvent", formDeletedEvent: "formDeletedEvent", deleteErrorEvent: "deleteErrorEvent", deployErrorEvent: "deployErrorEvent" }, host: { properties: { "class": "this.class" } }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2025 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<ng-container\n *ngIf=\"{\n formDefinition: formDefinition$ | async,\n jsonFormDefinition: jsonFormDefinition$ | async,\n jsonOutput: jsonOutput$ | async,\n compactMode: compactMode$ | async,\n context: context$ | async,\n canUpdateGlobalConfiguration: canUpdateGlobalConfiguration$ | async,\n isDraftVersion: isDraftVersion$ | async,\n } as obs\"\n>\n @if (obs.formDefinition) {\n <ng-container renderInPageHeader [fullWidth]=\"true\">\n <ng-template>\n <ng-container *ngTemplateOutlet=\"actions; context: {obs: obs}\"></ng-container>\n </ng-template>\n </ng-container>\n\n <cds-tabs type=\"contained\">\n <cds-tab [heading]=\"TABS.BUILDER | translate\" (selected)=\"onSelectedTab(TABS.BUILDER)\">\n <valtimo-form-io-builder\n *ngIf=\"(reloading$ | async) === false && activeTab === TABS.BUILDER\"\n [form]=\"obs.formDefinition.formDefinition\"\n (change)=\"formBuilderChanged($event, obs.jsonFormDefinition)\"\n ></valtimo-form-io-builder>\n </cds-tab>\n\n <cds-tab [heading]=\"TABS.EDITOR | translate\" (selected)=\"onSelectedTab(TABS.EDITOR)\">\n @if (activeTab === TABS.EDITOR) {\n <ng-container\n *ngTemplateOutlet=\"\n jsonEditor;\n context: {\n data: {\n disabled: obs.formDefinition.readOnly || !obs.canUpdateGlobalConfiguration,\n formDefinition: obs.formDefinition,\n model: obs.jsonFormDefinition,\n },\n }\n \"\n ></ng-container>\n }\n </cds-tab>\n\n <cds-tab\n [heading]=\"TABS.OUTPUT | translate\"\n (selected)=\"onSelectedTab(TABS.OUTPUT)\"\n class=\"valtimo-form-management-edit__output\"\n >\n <valtimo-form-io\n *ngIf=\"activeTab === TABS.OUTPUT\"\n [form]=\"obs.formDefinition.formDefinition\"\n (change)=\"onOutputChange($event)\"\n ></valtimo-form-io>\n\n @if (activeTab === TABS.OUTPUT) {\n <ng-container\n *ngTemplateOutlet=\"\n jsonEditor;\n context: {\n data: {disabled: true, formDefinition: obs.formDefinition, model: obs.jsonOutput},\n }\n \"\n ></ng-container>\n }\n </cds-tab>\n </cds-tabs>\n } @else {\n <cds-loading></cds-loading>\n }\n\n <valtimo-confirmation-modal\n confirmButtonTextTranslationKey=\"interface.delete\"\n confirmButtonType=\"danger\"\n contentTranslationKey=\"interface.deleteConfirmation\"\n cancelButtonTextTranslationKey=\"interface.cancel\"\n [outputOnConfirm]=\"obs.formDefinition\"\n [showModalSubject$]=\"showDeleteModal$\"\n titleTranslationKey=\"dashboardManagement.delete\"\n (confirmEvent)=\"deleteFormDefinition($event)\"\n ></valtimo-confirmation-modal>\n\n <valtimo-form-management-upload\n [show$]=\"showModal$\"\n (definitionUploaded)=\"setFormDefinition($event)\"\n ></valtimo-form-management-upload>\n\n <ng-template #jsonEditor let-data=\"data\">\n <valtimo-editor\n [model]=\"data.model\"\n [disabled]=\"data.disabled\"\n (validEvent)=\"onValidEvent($event, data.disabled)\"\n (valueChangeEvent)=\"onValueChangeEvent($event, data.formDefinition, data.disabled)\"\n [fitPage]=\"true\"\n [fitPageSpaceAdjustment]=\"80\"\n ></valtimo-editor>\n </ng-template>\n</ng-container>\n\n<ng-template #actions let-obs=\"obs\">\n <div\n class=\"valtimo-form-management-edit__header-container\"\n [ngClass]=\"{\n '--compact': obs.compactMode,\n 'valtimo-form-management-edit__header-container-case': obs?.context === 'case',\n }\"\n >\n @if (obs.formDefinition.readOnly || !obs.canUpdateGlobalConfiguration) {\n <cds-tag size=\"sm\" type=\"blue\">{{ 'formManagement.readOnly' | translate }}</cds-tag>\n }\n\n <div class=\"valtimo-form-management-edit__header\">\n <cds-overflow-menu>\n <cds-overflow-menu-option (selected)=\"downloadFormDefinition(obs.formDefinition)\">\n {{ 'Download' | translate }}\n </cds-overflow-menu-option>\n\n <cds-overflow-menu-option\n [disabled]=\"obs.formDefinition.readOnly || !obs.canUpdateGlobalConfiguration\"\n (selected)=\"showUploadModal()\"\n >\n {{ 'Upload' | translate }}\n </cds-overflow-menu-option>\n\n <cds-overflow-menu-option\n *ngIf=\"(obs.context === 'case' && obs.isDraftVersion) || obs.context === 'independent'\"\n (selected)=\"showDuplicateModal(obs.formDefinition)\"\n >\n {{ 'formManagement.duplicate' | translate }}\n </cds-overflow-menu-option>\n\n <cds-overflow-menu-option\n [disabled]=\"obs.formDefinition.readOnly || !obs.canUpdateGlobalConfiguration\"\n type=\"danger\"\n (selected)=\"delete()\"\n >\n {{ 'interface.delete' | translate }}\n </cds-overflow-menu-option>\n </cds-overflow-menu>\n\n @if (obs.context === 'case') {\n <button\n cdsButton=\"secondary\"\n [size]=\"obs.compactMode ? 'sm' : 'md'\"\n (click)=\"onGoBackButtonClick()\"\n >\n <svg class=\"cds--btn__icon\" cdsIcon=\"arrow--left\" size=\"16\"></svg>\n\n <span>{{ 'interface.back' | translate }}</span>\n </button>\n }\n\n <button\n *ngIf=\"\n (obs?.canUpdateGlobalConfiguration && obs?.isDraftVersion) ||\n obs.context === 'independent'\n \"\n cdsButton=\"primary\"\n [disabled]=\"obs.formDefinition.readOnly\"\n [size]=\"obs.compactMode ? 'sm' : 'md'\"\n (click)=\"modifyFormDefinition(obs.formDefinition)\"\n >\n {{ 'interface.save' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"save\" size=\"16\"></svg>\n </button>\n </div>\n </div>\n</ng-template>\n", styles: [".valtimo-form-management-edit__header{display:flex;align-items:center;justify-content:flex-end;gap:16px;margin-left:auto}.valtimo-form-management-edit__case-header{display:flex;width:100%;justify-content:flex-end}.valtimo-form-management-edit__header-container{width:100%;display:flex;justify-content:space-between;align-items:flex-end;padding-bottom:4px}.valtimo-form-management-edit__header-container .cds--tag{margin:0;height:var(--cds-layout-size-height-md)}.valtimo-form-management-edit__header-container.--compact{align-items:flex-start;padding-bottom:0}.valtimo-form-management-edit__header-container-case{padding-bottom:24px}.valtimo-form-management-edit__output .cds--tab-content{display:grid;grid-template-columns:1fr 1fr}.valtimo-form-management-edit__output .cds--tab-content>*{min-width:100%!important}.valtimo-form-management-edit .formbuilder .btn.formcomponent.drag-copy,.valtimo-form-management-edit .btn.formcomponent.gu-mirror{font-weight:400;background-color:silver;border-color:silver;color:#fff}.valtimo-form-management-edit .formbuilder .btn.formcomponent.drag-copy:hover,.valtimo-form-management-edit .formbuilder .btn.formcomponent.drag-copy:active,.valtimo-form-management-edit .btn.formcomponent.gu-mirror:hover,.valtimo-form-management-edit .btn.formcomponent.gu-mirror:active{box-shadow:none}.valtimo-form-management-edit .formbuilder .btn.formcomponent.drag-copy:active,.valtimo-form-management-edit .btn.formcomponent.gu-mirror:active{background-color:silver;border-color:silver}.valtimo-form-management-edit .formbuilder-header{padding-left:18px;padding-right:18px;font-size:18px;height:80px;border:1px solid #dee2e6;border-bottom:0}.valtimo-form-management-edit .formbuilder-header .formbuilder-title{margin-top:21px;margin-bottom:7px}.valtimo-form-management-edit .formbuilder-header .formbuilder-subtitle{margin-top:0;margin-bottom:12px}.valtimo-form-management-edit .formbuilder{background:#fff;padding:1rem;border:1px solid #dee2e6;margin-right:0!important;margin-left:0!important}.valtimo-form-management-edit .formbuilder .form-builder-panel .builder-group-button[aria-expanded=false],.valtimo-form-management-edit .formbuilder .form-builder-panel .builder-group-button[aria-expanded=\"\"]{color:#a9a9a9}.valtimo-form-management-edit .formbuilder .form-builder-panel .builder-group-button[aria-expanded=true]{color:#000}.valtimo-form-management-edit .formbuilder .drag-and-drop-alert{display:none}.valtimo-form-management-edit .formbuilder .formarea{padding:10px;border:solid 1px silver;background-color:#fff}.valtimo-form-management-edit .increase-size{font-size:1rem}.valtimo-form-management-edit .cds--tab-content{background:#fff!important}\n/*!\n * Copyright 2015-2025 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"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i7.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i7.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i7.AsyncPipe, name: "async" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: ModalModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i2$1.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: InputModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: WidgetModule }, { kind: "ngmodule", type: CarbonListModule }, { kind: "ngmodule", type: TabsModule }, { kind: "component", type: i2$1.Tabs, selector: "cds-tabs, ibm-tabs", inputs: ["position", "cacheActive", "followFocus", "isNavigation", "ariaLabel", "ariaLabelledby", "type", "theme", "skeleton"] }, { kind: "component", type: i2$1.Tab, selector: "cds-tab, ibm-tab", inputs: ["heading", "title", "context", "active", "disabled", "tabIndex", "id", "cacheActive", "tabContent", "templateContext"], outputs: ["selected"] }, { kind: "ngmodule", type: EditorModule }, { kind: "component", type: i3$1.EditorComponent, selector: "valtimo-editor", inputs: ["editorOptions", "model", "disabled", "formatOnLoad", "widthPx", "heightPx", "heightStyle", "jsonSchema", "fitPage", "fitPageSpaceAdjustment"], outputs: ["validEvent", "valueChangeEvent"] }, { kind: "ngmodule", type: FormIoModule }, { kind: "component", type: i3$1.FormioComponent, selector: "valtimo-form-io", inputs: ["options", "submission", "form", "readOnly", "formRefresh$"], outputs: ["submit", "change", "event"] }, { kind: "component", type: i3$1.FormioBuilderComponent, selector: "valtimo-form-io-builder", inputs: ["form"], outputs: ["change"] }, { kind: "directive", type: RenderInPageHeaderDirective, selector: "[renderInPageHeader]", inputs: ["fullWidth"] }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i2$1.OverflowMenu, selector: "cds-overflow-menu, ibm-overflow-menu", inputs: ["buttonLabel", "description", "flip", "placement", "open", "customTrigger", "offset", "wrapperClass", "triggerClass"], outputs: ["openChange"] }, { kind: "component", type: i2$1.OverflowMenuOption, selector: "cds-overflow-menu-option, ibm-overflow-menu-option", inputs: ["divider", "type", "disabled", "href", "target", "innerClass"], outputs: ["selected"] }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: i2$1.Tag, selector: "cds-tag, ibm-tag", inputs: ["type", "size", "class", "skeleton"] }, { kind: "ngmodule", type: ConfirmationModalModule }, { kind: "component", type: i3$1.ConfirmationModalComponent, selector: "valtimo-confirmation-modal", inputs: ["titleTranslationKey", "title", "content", "contentTranslationKey", "confirmButtonText", "confirmButtonTextTranslationKey", "confirmButtonType", "showOptionalButton", "optionalButtonText", "optionalButtonTextTranslationKey", "optionalButtonType", "cancelButtonText", "cancelButtonTextTranslationKey", "cancelButtonType", "showModalSubject$", "outputOnConfirm", "outputOnOptional", "spacerAfterCancelButton"], outputs: ["confirmEvent", "optionalEvent", "cancelEvent"] }, { kind: "ngmodule", type: SpinnerModule }, { kind: "component", type: FormManagementUploadComponent, selector: "valtimo-form-management-upload", inputs: ["show$"], outputs: ["definitionUploaded"] }, { kind: "ngmodule", type: IconModule }, { kind: "directive", type: i2$1.IconDirective, selector: "[cdsIcon], [ibmIcon]", inputs: ["ibmIcon", "cdsIcon", "size", "title", "ariaLabel", "ariaLabelledBy", "ariaHidden", "isFocusable"] }, { kind: "ngmodule", type: LoadingModule }, { kind: "component", type: i2$1.Loading, selector: "cds-loading, ibm-loading", inputs: ["title", "isActive", "size", "overlay"] }], encapsulation: i0.ViewEncapsulation.None }); }
891
+ }
892
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormManagementEditComponent, decorators: [{
893
+ type: Component,
894
+ args: [{ selector: 'valtimo-form-management-edit', encapsulation: ViewEncapsulation.None, standalone: true, imports: [
895
+ CommonModule,
896
+ TranslateModule,
897
+ ModalModule,
898
+ ButtonModule,
899
+ InputModule,
900
+ ReactiveFormsModule,
901
+ FormsModule,
902
+ WidgetModule,
903
+ CarbonListModule,
904
+ ValtimoCdsModalDirective,
905
+ TabsModule,
906
+ EditorModule,
907
+ FormIoModule,
908
+ RenderInPageHeaderDirective,
909
+ DialogModule,
910
+ TagModule,
911
+ ConfirmationModalModule,
912
+ SpinnerModule,
913
+ FormManagementUploadComponent,
914
+ IconModule,
915
+ SpinnerModule,
916
+ LoadingModule,
917
+ ], template: "<!--\n ~ Copyright 2015-2025 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<ng-container\n *ngIf=\"{\n formDefinition: formDefinition$ | async,\n jsonFormDefinition: jsonFormDefinition$ | async,\n jsonOutput: jsonOutput$ | async,\n compactMode: compactMode$ | async,\n context: context$ | async,\n canUpdateGlobalConfiguration: canUpdateGlobalConfiguration$ | async,\n isDraftVersion: isDraftVersion$ | async,\n } as obs\"\n>\n @if (obs.formDefinition) {\n <ng-container renderInPageHeader [fullWidth]=\"true\">\n <ng-template>\n <ng-container *ngTemplateOutlet=\"actions; context: {obs: obs}\"></ng-container>\n </ng-template>\n </ng-container>\n\n <cds-tabs type=\"contained\">\n <cds-tab [heading]=\"TABS.BUILDER | translate\" (selected)=\"onSelectedTab(TABS.BUILDER)\">\n <valtimo-form-io-builder\n *ngIf=\"(reloading$ | async) === false && activeTab === TABS.BUILDER\"\n [form]=\"obs.formDefinition.formDefinition\"\n (change)=\"formBuilderChanged($event, obs.jsonFormDefinition)\"\n ></valtimo-form-io-builder>\n </cds-tab>\n\n <cds-tab [heading]=\"TABS.EDITOR | translate\" (selected)=\"onSelectedTab(TABS.EDITOR)\">\n @if (activeTab === TABS.EDITOR) {\n <ng-container\n *ngTemplateOutlet=\"\n jsonEditor;\n context: {\n data: {\n disabled: obs.formDefinition.readOnly || !obs.canUpdateGlobalConfiguration,\n formDefinition: obs.formDefinition,\n model: obs.jsonFormDefinition,\n },\n }\n \"\n ></ng-container>\n }\n </cds-tab>\n\n <cds-tab\n [heading]=\"TABS.OUTPUT | translate\"\n (selected)=\"onSelectedTab(TABS.OUTPUT)\"\n class=\"valtimo-form-management-edit__output\"\n >\n <valtimo-form-io\n *ngIf=\"activeTab === TABS.OUTPUT\"\n [form]=\"obs.formDefinition.formDefinition\"\n (change)=\"onOutputChange($event)\"\n ></valtimo-form-io>\n\n @if (activeTab === TABS.OUTPUT) {\n <ng-container\n *ngTemplateOutlet=\"\n jsonEditor;\n context: {\n data: {disabled: true, formDefinition: obs.formDefinition, model: obs.jsonOutput},\n }\n \"\n ></ng-container>\n }\n </cds-tab>\n </cds-tabs>\n } @else {\n <cds-loading></cds-loading>\n }\n\n <valtimo-confirmation-modal\n confirmButtonTextTranslationKey=\"interface.delete\"\n confirmButtonType=\"danger\"\n contentTranslationKey=\"interface.deleteConfirmation\"\n cancelButtonTextTranslationKey=\"interface.cancel\"\n [outputOnConfirm]=\"obs.formDefinition\"\n [showModalSubject$]=\"showDeleteModal$\"\n titleTranslationKey=\"dashboardManagement.delete\"\n (confirmEvent)=\"deleteFormDefinition($event)\"\n ></valtimo-confirmation-modal>\n\n <valtimo-form-management-upload\n [show$]=\"showModal$\"\n (definitionUploaded)=\"setFormDefinition($event)\"\n ></valtimo-form-management-upload>\n\n <ng-template #jsonEditor let-data=\"data\">\n <valtimo-editor\n [model]=\"data.model\"\n [disabled]=\"data.disabled\"\n (validEvent)=\"onValidEvent($event, data.disabled)\"\n (valueChangeEvent)=\"onValueChangeEvent($event, data.formDefinition, data.disabled)\"\n [fitPage]=\"true\"\n [fitPageSpaceAdjustment]=\"80\"\n ></valtimo-editor>\n </ng-template>\n</ng-container>\n\n<ng-template #actions let-obs=\"obs\">\n <div\n class=\"valtimo-form-management-edit__header-container\"\n [ngClass]=\"{\n '--compact': obs.compactMode,\n 'valtimo-form-management-edit__header-container-case': obs?.context === 'case',\n }\"\n >\n @if (obs.formDefinition.readOnly || !obs.canUpdateGlobalConfiguration) {\n <cds-tag size=\"sm\" type=\"blue\">{{ 'formManagement.readOnly' | translate }}</cds-tag>\n }\n\n <div class=\"valtimo-form-management-edit__header\">\n <cds-overflow-menu>\n <cds-overflow-menu-option (selected)=\"downloadFormDefinition(obs.formDefinition)\">\n {{ 'Download' | translate }}\n </cds-overflow-menu-option>\n\n <cds-overflow-menu-option\n [disabled]=\"obs.formDefinition.readOnly || !obs.canUpdateGlobalConfiguration\"\n (selected)=\"showUploadModal()\"\n >\n {{ 'Upload' | translate }}\n </cds-overflow-menu-option>\n\n <cds-overflow-menu-option\n *ngIf=\"(obs.context === 'case' && obs.isDraftVersion) || obs.context === 'independent'\"\n (selected)=\"showDuplicateModal(obs.formDefinition)\"\n >\n {{ 'formManagement.duplicate' | translate }}\n </cds-overflow-menu-option>\n\n <cds-overflow-menu-option\n [disabled]=\"obs.formDefinition.readOnly || !obs.canUpdateGlobalConfiguration\"\n type=\"danger\"\n (selected)=\"delete()\"\n >\n {{ 'interface.delete' | translate }}\n </cds-overflow-menu-option>\n </cds-overflow-menu>\n\n @if (obs.context === 'case') {\n <button\n cdsButton=\"secondary\"\n [size]=\"obs.compactMode ? 'sm' : 'md'\"\n (click)=\"onGoBackButtonClick()\"\n >\n <svg class=\"cds--btn__icon\" cdsIcon=\"arrow--left\" size=\"16\"></svg>\n\n <span>{{ 'interface.back' | translate }}</span>\n </button>\n }\n\n <button\n *ngIf=\"\n (obs?.canUpdateGlobalConfiguration && obs?.isDraftVersion) ||\n obs.context === 'independent'\n \"\n cdsButton=\"primary\"\n [disabled]=\"obs.formDefinition.readOnly\"\n [size]=\"obs.compactMode ? 'sm' : 'md'\"\n (click)=\"modifyFormDefinition(obs.formDefinition)\"\n >\n {{ 'interface.save' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"save\" size=\"16\"></svg>\n </button>\n </div>\n </div>\n</ng-template>\n", styles: [".valtimo-form-management-edit__header{display:flex;align-items:center;justify-content:flex-end;gap:16px;margin-left:auto}.valtimo-form-management-edit__case-header{display:flex;width:100%;justify-content:flex-end}.valtimo-form-management-edit__header-container{width:100%;display:flex;justify-content:space-between;align-items:flex-end;padding-bottom:4px}.valtimo-form-management-edit__header-container .cds--tag{margin:0;height:var(--cds-layout-size-height-md)}.valtimo-form-management-edit__header-container.--compact{align-items:flex-start;padding-bottom:0}.valtimo-form-management-edit__header-container-case{padding-bottom:24px}.valtimo-form-management-edit__output .cds--tab-content{display:grid;grid-template-columns:1fr 1fr}.valtimo-form-management-edit__output .cds--tab-content>*{min-width:100%!important}.valtimo-form-management-edit .formbuilder .btn.formcomponent.drag-copy,.valtimo-form-management-edit .btn.formcomponent.gu-mirror{font-weight:400;background-color:silver;border-color:silver;color:#fff}.valtimo-form-management-edit .formbuilder .btn.formcomponent.drag-copy:hover,.valtimo-form-management-edit .formbuilder .btn.formcomponent.drag-copy:active,.valtimo-form-management-edit .btn.formcomponent.gu-mirror:hover,.valtimo-form-management-edit .btn.formcomponent.gu-mirror:active{box-shadow:none}.valtimo-form-management-edit .formbuilder .btn.formcomponent.drag-copy:active,.valtimo-form-management-edit .btn.formcomponent.gu-mirror:active{background-color:silver;border-color:silver}.valtimo-form-management-edit .formbuilder-header{padding-left:18px;padding-right:18px;font-size:18px;height:80px;border:1px solid #dee2e6;border-bottom:0}.valtimo-form-management-edit .formbuilder-header .formbuilder-title{margin-top:21px;margin-bottom:7px}.valtimo-form-management-edit .formbuilder-header .formbuilder-subtitle{margin-top:0;margin-bottom:12px}.valtimo-form-management-edit .formbuilder{background:#fff;padding:1rem;border:1px solid #dee2e6;margin-right:0!important;margin-left:0!important}.valtimo-form-management-edit .formbuilder .form-builder-panel .builder-group-button[aria-expanded=false],.valtimo-form-management-edit .formbuilder .form-builder-panel .builder-group-button[aria-expanded=\"\"]{color:#a9a9a9}.valtimo-form-management-edit .formbuilder .form-builder-panel .builder-group-button[aria-expanded=true]{color:#000}.valtimo-form-management-edit .formbuilder .drag-and-drop-alert{display:none}.valtimo-form-management-edit .formbuilder .formarea{padding:10px;border:solid 1px silver;background-color:#fff}.valtimo-form-management-edit .increase-size{font-size:1rem}.valtimo-form-management-edit .cds--tab-content{background:#fff!important}\n/*!\n * Copyright 2015-2025 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"] }]
918
+ }], ctorParameters: () => [{ type: FormManagementService }, { type: i2$1.ModalService }, { type: i3$1.PageTitleService }, { type: i3.ActivatedRoute }, { type: i3$1.ShellService }, { type: i3$1.PageHeaderService }, { type: i2$1.IconService }, { type: i3.Router }, { type: i5.TranslateService }, { type: i4.GlobalNotificationService }, { type: i3$1.BreadcrumbService }, { type: i4.EnvironmentService }, { type: i4.DraftVersionService }, { type: i3$1.FormIoTagsService }, { type: i0.Injector }], propDecorators: { class: [{
919
+ type: HostBinding,
920
+ args: ['class']
921
+ }], deleteEvent: [{
922
+ type: Output
923
+ }], goBackEvent: [{
924
+ type: Output
925
+ }], formModifiedEvent: [{
926
+ type: Output
927
+ }], formDeletedEvent: [{
928
+ type: Output
929
+ }], deleteErrorEvent: [{
930
+ type: Output
931
+ }], deployErrorEvent: [{
932
+ type: Output
933
+ }] } });
934
+
935
+ /*
936
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
937
+ *
938
+ * Licensed under EUPL, Version 1.2 (the "License");
939
+ * you may not use this file except in compliance with the License.
940
+ * You may obtain a copy of the License at
941
+ *
942
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
943
+ *
944
+ * Unless required by applicable law or agreed to in writing, software
945
+ * distributed under the License is distributed on an "AS IS" basis,
946
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
947
+ * See the License for the specific language governing permissions and
948
+ * limitations under the License.
949
+ */
950
+
951
+ /*
952
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
953
+ *
954
+ * Licensed under EUPL, Version 1.2 (the "License");
955
+ * you may not use this file except in compliance with the License.
956
+ * You may obtain a copy of the License at
957
+ *
958
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
959
+ *
960
+ * Unless required by applicable law or agreed to in writing, software
961
+ * distributed under the License is distributed on an "AS IS" basis,
962
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
963
+ * See the License for the specific language governing permissions and
964
+ * limitations under the License.
965
+ */
966
+ class FormManagementListComponent {
967
+ get _partialPagination() {
968
+ return this._partialPagination$.getValue();
969
+ }
970
+ constructor(formManagementService, iconService, route, environmentService, draftVersionService, notificationService, translateService, editPermissionsService) {
971
+ this.formManagementService = formManagementService;
972
+ this.iconService = iconService;
973
+ this.route = route;
974
+ this.environmentService = environmentService;
975
+ this.draftVersionService = draftVersionService;
976
+ this.notificationService = notificationService;
977
+ this.translateService = translateService;
978
+ this.editPermissionsService = editPermissionsService;
979
+ this.navigateToCreateEvent = new EventEmitter();
980
+ this.navigateToUploadEvent = new EventEmitter();
981
+ this.navigateToEditEvent = new EventEmitter();
982
+ this.ACTION_ITEMS = [
983
+ {
984
+ callback: this.editFormDefinition.bind(this),
985
+ label: 'interface.edit',
986
+ },
987
+ { callback: this.showDeleteModal.bind(this), label: 'interface.delete', type: 'danger' },
988
+ ];
989
+ this.showDeleteModal$ = new BehaviorSubject(false);
990
+ this.formDefinitionToDelete$ = new BehaviorSubject(null);
991
+ this.loading$ = new BehaviorSubject(true);
992
+ this.searchTerm$ = new BehaviorSubject('');
993
+ this.context$ = getContextObservable(this.route);
994
+ this.caseManagementRouteParams$ = this.context$.pipe(filter$1(context => context === 'case'), switchMap(() => getCaseManagementRouteParams(this.route)));
995
+ this.hasEditPermissions$ = combineLatest([
996
+ getCaseManagementRouteParams(this.route),
997
+ this.context$,
998
+ ]).pipe(switchMap(([params, context]) => this.editPermissionsService.hasPermissionsToEditBasedOnContext(params?.caseDefinitionKey, params?.caseDefinitionVersionTag, context)));
999
+ this._collectionSize$ = new BehaviorSubject(0);
1000
+ this._partialPagination$ = new BehaviorSubject({
1001
+ page: 1,
1002
+ size: 10,
1003
+ });
1004
+ this.pagination$ = combineLatest([
1005
+ this._collectionSize$,
1006
+ this._partialPagination$,
1007
+ ]).pipe(map$1(([collectionSize, partialPagination]) => ({ ...partialPagination, collectionSize })));
1008
+ this.formDefinitions$ = combineLatest([
1009
+ this.context$,
1010
+ this.caseManagementRouteParams$.pipe(startWith(null)),
1011
+ this._partialPagination$,
1012
+ this.searchTerm$,
1013
+ ]).pipe(filter$1(([context, params]) => context === 'case' ? !!(params?.caseDefinitionVersionTag && params?.caseDefinitionKey) : true), switchMap(([context, routeParams, pagination, searchTerm]) => {
1014
+ const params = {
1015
+ ...pagination,
1016
+ page: (pagination?.page ?? 1) - 1,
1017
+ ...(searchTerm && { searchTerm }),
1018
+ };
1019
+ switch (context) {
1020
+ case 'case':
1021
+ return this.formManagementService.queryFormDefinitionsCase(routeParams?.caseDefinitionKey ?? '', routeParams?.caseDefinitionVersionTag ?? '', params);
1022
+ default:
1023
+ case 'independent':
1024
+ return this.formManagementService.queryFormDefinitions(params);
1025
+ }
1026
+ }), map$1((res) => {
1027
+ this._collectionSize$.next(res?.totalElements);
1028
+ return res?.content
1029
+ ? [...res.content].sort((firstForm, secondForm) => (firstForm.name ?? '').localeCompare(secondForm.name ?? ''))
1030
+ : [];
1031
+ }), tap(() => this.loading$.next(false)));
1032
+ this.FIELDS = [
1033
+ { key: 'name', label: 'Form name' },
1034
+ { key: 'readOnly', label: 'Read-only', viewType: ViewType.BOOLEAN },
1035
+ ];
1036
+ this.iconService.registerAll([Upload16]);
1037
+ }
1038
+ navigateToCreateRoute() {
1039
+ this.navigateToCreateEvent.emit();
1040
+ }
1041
+ navigateToUploadRoute() {
1042
+ this.navigateToUploadEvent.emit();
1043
+ }
1044
+ paginationClicked(page) {
1045
+ this.updatePagination({ page });
1046
+ }
1047
+ paginationSet(size) {
1048
+ this.updatePagination({ size, page: 1 });
1049
+ }
1050
+ editFormDefinition(formDefinition) {
1051
+ this.navigateToEditEvent.emit(formDefinition.id);
1052
+ }
1053
+ searchTermEntered(searchTerm) {
1054
+ this.searchTerm$.next(searchTerm);
1055
+ }
1056
+ showDeleteModal(definition) {
1057
+ this.formDefinitionToDelete$.next(definition);
1058
+ this.showDeleteModal$.next(true);
1059
+ }
1060
+ deleteFormDefinition(definition) {
1061
+ getCaseManagementRouteParamsAndContext(this.route)
1062
+ .pipe(take$1(1), switchMap(([context, caseManagementRouteParams]) => {
1063
+ switch (context) {
1064
+ case 'case':
1065
+ return this.formManagementService.deleteFormDefinitionCase(caseManagementRouteParams?.caseDefinitionKey, caseManagementRouteParams?.caseDefinitionVersionTag, definition.id);
1066
+ case 'independent':
1067
+ default:
1068
+ return this.formManagementService.deleteFormDefinition(definition.id);
1069
+ }
1070
+ }))
1071
+ .subscribe({
1072
+ next: () => {
1073
+ this.notificationService.showToast({
1074
+ type: 'success',
1075
+ title: this.translateService.instant('formManagement.notifications.deleted'),
1076
+ });
1077
+ this._partialPagination$.next({ ...this._partialPagination });
1078
+ },
1079
+ error: () => {
1080
+ this.notificationService.showToast({
1081
+ type: 'error',
1082
+ title: this.translateService.instant('formManagement.notifications.deletionError'),
1083
+ });
1084
+ },
1085
+ });
1086
+ }
1087
+ updatePagination(update) {
1088
+ this._partialPagination$.next({ ...this._partialPagination, ...update });
1089
+ }
1090
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormManagementListComponent, deps: [{ token: FormManagementService }, { token: i2$1.IconService }, { token: i3.ActivatedRoute }, { token: i4.EnvironmentService }, { token: i4.DraftVersionService }, { token: i4.GlobalNotificationService }, { token: i5.TranslateService }, { token: i4.EditPermissionsService }], target: i0.ɵɵFactoryTarget.Component }); }
1091
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: FormManagementListComponent, isStandalone: true, selector: "valtimo-form-management-list", outputs: { navigateToCreateEvent: "navigateToCreateEvent", navigateToUploadEvent: "navigateToUploadEvent", navigateToEditEvent: "navigateToEditEvent" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2025 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<valtimo-carbon-list\n *ngIf=\"{\n formDefinitions: formDefinitions$ | async,\n pagination: pagination$ | async,\n loading: loading$ | async,\n context: context$ | async,\n hasEditPermissions: hasEditPermissions$ | async,\n } as obs\"\n [showActionItems]=\"obs.hasEditPermissions\"\n [actionItems]=\"ACTION_ITEMS\"\n [fields]=\"FIELDS\"\n [header]=\"false\"\n [isSearchable]=\"true\"\n [items]=\"obs?.formDefinitions || []\"\n [pagination]=\"obs.pagination\"\n [loading]=\"obs.loading\"\n paginationIdentifier=\"formManagementList\"\n (paginationClicked)=\"paginationClicked($event)\"\n (paginationSet)=\"paginationSet($event)\"\n (rowClicked)=\"editFormDefinition($event)\"\n (search)=\"searchTermEntered($event)\"\n>\n <ng-container *ngIf=\"obs.hasEditPermissions\" carbonToolbarContent>\n <button cdsButton=\"ghost\" [iconOnly]=\"true\" (click)=\"navigateToUploadRoute()\">\n <svg cdsIcon=\"upload\" size=\"16\"></svg>\n </button>\n\n <ng-container [ngTemplateOutlet]=\"createFormButton\"></ng-container>\n </ng-container>\n\n <valtimo-no-results\n [action]=\"createFormButton\"\n [description]=\"'formManagement.noResults.' + obs.context + 'Description' | translate\"\n [title]=\"'formManagement.noResults.title' | translate\"\n ></valtimo-no-results>\n</valtimo-carbon-list>\n\n<valtimo-confirmation-modal\n confirmButtonTextTranslationKey=\"interface.delete\"\n confirmButtonType=\"danger\"\n contentTranslationKey=\"interface.deleteConfirmation\"\n cancelButtonTextTranslationKey=\"interface.cancel\"\n [outputOnConfirm]=\"formDefinitionToDelete$ | async\"\n [showModalSubject$]=\"showDeleteModal$\"\n titleTranslationKey=\"dashboardManagement.delete\"\n (confirmEvent)=\"deleteFormDefinition($event)\"\n></valtimo-confirmation-modal>\n\n<ng-template #createFormButton>\n <button *ngIf=\"hasEditPermissions$ | async\" cdsButton=\"primary\" (click)=\"navigateToCreateRoute()\">\n {{ 'Create Form' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"add\" size=\"16\"></svg>\n </button>\n</ng-template>\n", styles: ["/*!\n * Copyright 2015-2025 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"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i7.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i7.AsyncPipe, name: "async" }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: CarbonListModule }, { kind: "component", type: i3$1.CarbonListComponent, selector: "valtimo-carbon-list", inputs: ["items", "fields", "tableTranslations", "paginatorConfig", "pagination", "loading", "actions", "actionItems", "showActionItems", "header", "hideColumnHeader", "initialSortState", "sortState", "isSearchable", "enableSingleSelection", "lastColumnTemplate", "paginationIdentifier", "showSelectionColumn", "striped", "hideToolbar", "lockedTooltipTranslationKey", "movingRowsEnabled", "dragAndDrop", "dragAndDropDisabled"], outputs: ["rowClicked", "paginationClicked", "paginationSet", "search", "sortChanged", "moveRow", "itemsReordered"] }, { kind: "component", type: i3$1.CarbonNoResultsComponent, selector: "valtimo-no-results", inputs: ["action", "description", "illustration", "title", "smallPadding", "collapseVertically", "alwaysRenderVertically"] }, { kind: "ngmodule", type: IconModule }, { kind: "directive", type: i2$1.IconDirective, selector: "[cdsIcon], [ibmIcon]", inputs: ["ibmIcon", "cdsIcon", "size", "title", "ariaLabel", "ariaLabelledBy", "ariaHidden", "isFocusable"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i2$1.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: ConfirmationModalModule }, { kind: "component", type: i3$1.ConfirmationModalComponent, selector: "valtimo-confirmation-modal", inputs: ["titleTranslationKey", "title", "content", "contentTranslationKey", "confirmButtonText", "confirmButtonTextTranslationKey", "confirmButtonType", "showOptionalButton", "optionalButtonText", "optionalButtonTextTranslationKey", "optionalButtonType", "cancelButtonText", "cancelButtonTextTranslationKey", "cancelButtonType", "showModalSubject$", "outputOnConfirm", "outputOnOptional", "spacerAfterCancelButton"], outputs: ["confirmEvent", "optionalEvent", "cancelEvent"] }] }); }
1092
+ }
1093
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormManagementListComponent, decorators: [{
1094
+ type: Component,
1095
+ args: [{ selector: 'valtimo-form-management-list', standalone: true, imports: [
1096
+ CommonModule,
1097
+ FormsModule,
1098
+ ReactiveFormsModule,
1099
+ TranslateModule,
1100
+ CarbonListModule,
1101
+ IconModule,
1102
+ ButtonModule,
1103
+ ConfirmationModalModule,
1104
+ ], template: "<!--\n ~ Copyright 2015-2025 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<valtimo-carbon-list\n *ngIf=\"{\n formDefinitions: formDefinitions$ | async,\n pagination: pagination$ | async,\n loading: loading$ | async,\n context: context$ | async,\n hasEditPermissions: hasEditPermissions$ | async,\n } as obs\"\n [showActionItems]=\"obs.hasEditPermissions\"\n [actionItems]=\"ACTION_ITEMS\"\n [fields]=\"FIELDS\"\n [header]=\"false\"\n [isSearchable]=\"true\"\n [items]=\"obs?.formDefinitions || []\"\n [pagination]=\"obs.pagination\"\n [loading]=\"obs.loading\"\n paginationIdentifier=\"formManagementList\"\n (paginationClicked)=\"paginationClicked($event)\"\n (paginationSet)=\"paginationSet($event)\"\n (rowClicked)=\"editFormDefinition($event)\"\n (search)=\"searchTermEntered($event)\"\n>\n <ng-container *ngIf=\"obs.hasEditPermissions\" carbonToolbarContent>\n <button cdsButton=\"ghost\" [iconOnly]=\"true\" (click)=\"navigateToUploadRoute()\">\n <svg cdsIcon=\"upload\" size=\"16\"></svg>\n </button>\n\n <ng-container [ngTemplateOutlet]=\"createFormButton\"></ng-container>\n </ng-container>\n\n <valtimo-no-results\n [action]=\"createFormButton\"\n [description]=\"'formManagement.noResults.' + obs.context + 'Description' | translate\"\n [title]=\"'formManagement.noResults.title' | translate\"\n ></valtimo-no-results>\n</valtimo-carbon-list>\n\n<valtimo-confirmation-modal\n confirmButtonTextTranslationKey=\"interface.delete\"\n confirmButtonType=\"danger\"\n contentTranslationKey=\"interface.deleteConfirmation\"\n cancelButtonTextTranslationKey=\"interface.cancel\"\n [outputOnConfirm]=\"formDefinitionToDelete$ | async\"\n [showModalSubject$]=\"showDeleteModal$\"\n titleTranslationKey=\"dashboardManagement.delete\"\n (confirmEvent)=\"deleteFormDefinition($event)\"\n></valtimo-confirmation-modal>\n\n<ng-template #createFormButton>\n <button *ngIf=\"hasEditPermissions$ | async\" cdsButton=\"primary\" (click)=\"navigateToCreateRoute()\">\n {{ 'Create Form' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"add\" size=\"16\"></svg>\n </button>\n</ng-template>\n", styles: ["/*!\n * Copyright 2015-2025 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"] }]
1105
+ }], ctorParameters: () => [{ type: FormManagementService }, { type: i2$1.IconService }, { type: i3.ActivatedRoute }, { type: i4.EnvironmentService }, { type: i4.DraftVersionService }, { type: i4.GlobalNotificationService }, { type: i5.TranslateService }, { type: i4.EditPermissionsService }], propDecorators: { navigateToCreateEvent: [{
1106
+ type: Output
1107
+ }], navigateToUploadEvent: [{
1108
+ type: Output
1109
+ }], navigateToEditEvent: [{
1110
+ type: Output
1111
+ }] } });
1112
+
1113
+ /*
1114
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
1115
+ *
1116
+ * Licensed under EUPL, Version 1.2 (the "License");
1117
+ * you may not use this file except in compliance with the License.
1118
+ * You may obtain a copy of the License at
1119
+ *
1120
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1121
+ *
1122
+ * Unless required by applicable law or agreed to in writing, software
1123
+ * distributed under the License is distributed on an "AS IS" basis,
1124
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1125
+ * See the License for the specific language governing permissions and
1126
+ * limitations under the License.
1127
+ */
1128
+
1129
+ /*
1130
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
1131
+ *
1132
+ * Licensed under EUPL, Version 1.2 (the "License");
1133
+ * you may not use this file except in compliance with the License.
1134
+ * You may obtain a copy of the License at
1135
+ *
1136
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1137
+ *
1138
+ * Unless required by applicable law or agreed to in writing, software
1139
+ * distributed under the License is distributed on an "AS IS" basis,
1140
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1141
+ * See the License for the specific language governing permissions and
1142
+ * limitations under the License.
1143
+ */
1144
+ class FormManagementComponent {
1145
+ constructor(route, router, notificationService, translateService) {
1146
+ this.route = route;
1147
+ this.router = router;
1148
+ this.notificationService = notificationService;
1149
+ this.translateService = translateService;
1150
+ this.create$ = new BehaviorSubject(false);
1151
+ this.upload$ = new BehaviorSubject(false);
1152
+ }
1153
+ onNavigateToCreateEvent() {
1154
+ this.create$.next(true);
1155
+ }
1156
+ onGoBackFromCreateEvent() {
1157
+ this.create$.next(false);
1158
+ this.upload$.next(false);
1159
+ }
1160
+ onFormDefinitionEditEvent(formDefinitionId, upload = false) {
1161
+ this.router.navigate([formDefinitionId], {
1162
+ relativeTo: this.route,
1163
+ queryParams: { ...(upload && { upload: true }) },
1164
+ });
1165
+ }
1166
+ onFormDefinitionCreateEvent(formDefinitionId) {
1167
+ this.resetNotifications();
1168
+ this.notificationService.showToast({
1169
+ type: 'success',
1170
+ title: this.translateService.instant('formManagement.notifications.created'),
1171
+ });
1172
+ this.onFormDefinitionEditEvent(formDefinitionId);
1173
+ }
1174
+ onFormDefinitionUploadEvent(formDefinitionId) {
1175
+ this.resetNotifications();
1176
+ this.notificationService.showToast({
1177
+ type: 'success',
1178
+ title: this.translateService.instant('formManagement.notifications.created'),
1179
+ });
1180
+ this.onFormDefinitionEditEvent(formDefinitionId, true);
1181
+ }
1182
+ onNavigateToUploadEvent() {
1183
+ this.create$.next(true);
1184
+ this.upload$.next(true);
1185
+ }
1186
+ resetNotifications() {
1187
+ this.notificationService
1188
+ ?.getNotificationRefs()
1189
+ .forEach(ref => this.notificationService.close(ref));
1190
+ }
1191
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormManagementComponent, deps: [{ token: i3.ActivatedRoute }, { token: i3.Router }, { token: i4.GlobalNotificationService }, { token: i5.TranslateService }], target: i0.ɵɵFactoryTarget.Component }); }
1192
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: FormManagementComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<!--\n ~ Copyright 2015-2025 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 create: create$ | async,\n upload: upload$ | async,\n } as obs\"\n>\n <valtimo-form-management-list\n (navigateToCreateEvent)=\"onNavigateToCreateEvent()\"\n (navigateToUploadEvent)=\"onNavigateToUploadEvent()\"\n (navigateToEditEvent)=\"onFormDefinitionEditEvent($event)\"\n ></valtimo-form-management-list>\n\n <valtimo-form-management-create\n *ngIf=\"obs.create\"\n [upload]=\"obs.upload\"\n (goBackEvent)=\"onGoBackFromCreateEvent()\"\n (afterCreateEvent)=\"onFormDefinitionCreateEvent($event)\"\n (afterUploadEvent)=\"onFormDefinitionUploadEvent($event)\"\n ></valtimo-form-management-create>\n</ng-container>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i7.AsyncPipe, name: "async" }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: FormManagementListComponent, selector: "valtimo-form-management-list", outputs: ["navigateToCreateEvent", "navigateToUploadEvent", "navigateToEditEvent"] }, { kind: "component", type: FormManagementCreateComponent, selector: "valtimo-form-management-create", inputs: ["upload"], outputs: ["goBackEvent", "afterCreateEvent", "afterUploadEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1193
+ }
1194
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormManagementComponent, decorators: [{
1195
+ type: Component,
1196
+ args: [{ changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
1197
+ CommonModule,
1198
+ ButtonModule,
1199
+ FormManagementListComponent,
1200
+ FormManagementCreateComponent,
1201
+ FormManagementEditComponent,
1202
+ RouterOutlet,
1203
+ ], template: "<!--\n ~ Copyright 2015-2025 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 create: create$ | async,\n upload: upload$ | async,\n } as obs\"\n>\n <valtimo-form-management-list\n (navigateToCreateEvent)=\"onNavigateToCreateEvent()\"\n (navigateToUploadEvent)=\"onNavigateToUploadEvent()\"\n (navigateToEditEvent)=\"onFormDefinitionEditEvent($event)\"\n ></valtimo-form-management-list>\n\n <valtimo-form-management-create\n *ngIf=\"obs.create\"\n [upload]=\"obs.upload\"\n (goBackEvent)=\"onGoBackFromCreateEvent()\"\n (afterCreateEvent)=\"onFormDefinitionCreateEvent($event)\"\n (afterUploadEvent)=\"onFormDefinitionUploadEvent($event)\"\n ></valtimo-form-management-create>\n</ng-container>\n" }]
1204
+ }], ctorParameters: () => [{ type: i3.ActivatedRoute }, { type: i3.Router }, { type: i4.GlobalNotificationService }, { type: i5.TranslateService }] });
1205
+
1206
+ /*
1207
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
1208
+ *
1209
+ * Licensed under EUPL, Version 1.2 (the "License");
1210
+ * you may not use this file except in compliance with the License.
1211
+ * You may obtain a copy of the License at
1212
+ *
1213
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1214
+ *
1215
+ * Unless required by applicable law or agreed to in writing, software
1216
+ * distributed under the License is distributed on an "AS IS" basis,
1217
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1218
+ * See the License for the specific language governing permissions and
1219
+ * limitations under the License.
1220
+ */
1221
+
1222
+ /*
1223
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
1224
+ *
1225
+ * Licensed under EUPL, Version 1.2 (the "License");
1226
+ * you may not use this file except in compliance with the License.
1227
+ * You may obtain a copy of the License at
1228
+ *
1229
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1230
+ *
1231
+ * Unless required by applicable law or agreed to in writing, software
1232
+ * distributed under the License is distributed on an "AS IS" basis,
1233
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1234
+ * See the License for the specific language governing permissions and
1235
+ * limitations under the License.
1236
+ */
1237
+ const routes = [
1238
+ {
1239
+ path: 'form-management',
1240
+ component: FormManagementComponent,
1241
+ canActivate: [AuthGuardService],
1242
+ data: { title: 'Forms', roles: [ROLE_ADMIN], context: 'independent' },
1243
+ },
1244
+ {
1245
+ path: 'form-management/:formDefinitionId',
1246
+ component: FormManagementEditComponent,
1247
+ canActivate: [AuthGuardService],
1248
+ data: {
1249
+ title: 'Forms',
1250
+ roles: [ROLE_ADMIN],
1251
+ context: 'independent',
1252
+ customPageTitle: true,
1253
+ },
1254
+ },
1255
+ ];
1256
+ class FormManagementRoutingModule {
1257
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormManagementRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1258
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.17", ngImport: i0, type: FormManagementRoutingModule, imports: [i3.RouterModule], exports: [RouterModule] }); }
1259
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormManagementRoutingModule, imports: [RouterModule.forRoot(routes, RouterUtils.getRouterExtraOptions()), RouterModule] }); }
1260
+ }
1261
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormManagementRoutingModule, decorators: [{
1262
+ type: NgModule,
1263
+ args: [{
1264
+ imports: [RouterModule.forRoot(routes, RouterUtils.getRouterExtraOptions())],
1265
+ exports: [RouterModule],
1266
+ }]
1267
+ }] });
1268
+ class FormManagementModule {
1269
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormManagementModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1270
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.17", ngImport: i0, type: FormManagementModule, imports: [FormManagementComponent, FormManagementRoutingModule] }); }
1271
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormManagementModule, imports: [FormManagementComponent, FormManagementRoutingModule] }); }
1272
+ }
1273
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormManagementModule, decorators: [{
1274
+ type: NgModule,
1275
+ args: [{
1276
+ imports: [FormManagementComponent, FormManagementRoutingModule],
1277
+ }]
1278
+ }] });
1279
+
1280
+ /*
1281
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
1282
+ *
1283
+ * Licensed under EUPL, Version 1.2 (the "License");
1284
+ * you may not use this file except in compliance with the License.
1285
+ * You may obtain a copy of the License at
1286
+ *
1287
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
1288
+ *
1289
+ * Unless required by applicable law or agreed to in writing, software
1290
+ * distributed under the License is distributed on an "AS IS" basis,
1291
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1292
+ * See the License for the specific language governing permissions and
1293
+ * limitations under the License.
1294
+ */
1295
+ /*
1296
+ * Public API Surface of form-management
1297
+ */
1298
+
1299
+ /**
1300
+ * Generated bundle index. Do not edit.
1301
+ */
1302
+
1303
+ export { EDIT_TABS, FormManagementComponent, FormManagementEditComponent, FormManagementModule, FormManagementRoutingModule, FormManagementService, compareFormDefinitions };
1304
+ //# sourceMappingURL=valtimo-form-management.mjs.map