@valtimo/form-management 4.21.0 → 5.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 (60) hide show
  1. package/esm2020/lib/form-management-create/form-management-create.component.mjs +83 -0
  2. package/esm2020/lib/form-management-edit/form-management-edit.component.mjs +144 -0
  3. package/esm2020/lib/form-management-list/form-management-list.component.mjs +70 -0
  4. package/esm2020/lib/form-management-routing.module.mjs +58 -0
  5. package/esm2020/lib/form-management-upload/form-management-upload.component.mjs +146 -0
  6. package/esm2020/lib/form-management.component.mjs +32 -0
  7. package/esm2020/lib/form-management.module.mjs +86 -0
  8. package/esm2020/lib/form-management.service.mjs +53 -0
  9. package/esm2020/lib/models/form-definition.model.mjs +25 -0
  10. package/esm2020/lib/models/index.mjs +19 -0
  11. package/esm2020/public-api.mjs +23 -0
  12. package/esm2020/valtimo-form-management.mjs +5 -0
  13. package/fesm2015/valtimo-form-management.mjs +693 -0
  14. package/fesm2015/valtimo-form-management.mjs.map +1 -0
  15. package/fesm2020/valtimo-form-management.mjs +691 -0
  16. package/fesm2020/valtimo-form-management.mjs.map +1 -0
  17. package/lib/form-management-create/form-management-create.component.d.ts +4 -0
  18. package/lib/form-management-create/form-management-create.component.d.ts.map +1 -0
  19. package/lib/form-management-edit/form-management-edit.component.d.ts +4 -0
  20. package/lib/form-management-edit/form-management-edit.component.d.ts.map +1 -0
  21. package/lib/form-management-list/form-management-list.component.d.ts +4 -0
  22. package/lib/form-management-list/form-management-list.component.d.ts.map +1 -0
  23. package/lib/form-management-routing.module.d.ts +6 -0
  24. package/lib/form-management-routing.module.d.ts.map +1 -0
  25. package/lib/form-management-upload/form-management-upload.component.d.ts +4 -0
  26. package/lib/form-management-upload/form-management-upload.component.d.ts.map +1 -0
  27. package/lib/form-management.component.d.ts +4 -0
  28. package/lib/form-management.component.d.ts.map +1 -0
  29. package/lib/form-management.module.d.ts +16 -0
  30. package/lib/form-management.module.d.ts.map +1 -0
  31. package/lib/form-management.service.d.ts +4 -0
  32. package/lib/form-management.service.d.ts.map +1 -0
  33. package/lib/models/form-definition.model.d.ts +1 -0
  34. package/lib/models/form-definition.model.d.ts.map +1 -0
  35. package/lib/models/index.d.ts +1 -0
  36. package/lib/models/index.d.ts.map +1 -0
  37. package/package.json +22 -10
  38. package/public-api.d.ts +1 -0
  39. package/public-api.d.ts.map +1 -0
  40. package/valtimo-form-management.d.ts +2 -5
  41. package/valtimo-form-management.d.ts.map +1 -0
  42. package/bundles/valtimo-form-management.umd.js +0 -1017
  43. package/bundles/valtimo-form-management.umd.js.map +0 -1
  44. package/bundles/valtimo-form-management.umd.min.js +0 -2
  45. package/bundles/valtimo-form-management.umd.min.js.map +0 -1
  46. package/esm2015/lib/form-management-create/form-management-create.component.js +0 -87
  47. package/esm2015/lib/form-management-edit/form-management-edit.component.js +0 -149
  48. package/esm2015/lib/form-management-list/form-management-list.component.js +0 -72
  49. package/esm2015/lib/form-management-routing.module.js +0 -54
  50. package/esm2015/lib/form-management-upload/form-management-upload.component.js +0 -148
  51. package/esm2015/lib/form-management.component.js +0 -29
  52. package/esm2015/lib/form-management.module.js +0 -55
  53. package/esm2015/lib/form-management.service.js +0 -57
  54. package/esm2015/lib/models/form-definition.model.js +0 -25
  55. package/esm2015/lib/models/index.js +0 -19
  56. package/esm2015/public-api.js +0 -23
  57. package/esm2015/valtimo-form-management.js +0 -10
  58. package/fesm2015/valtimo-form-management.js +0 -681
  59. package/fesm2015/valtimo-form-management.js.map +0 -1
  60. package/valtimo-form-management.metadata.json +0 -1
@@ -0,0 +1,691 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, Component, EventEmitter, ViewChild, Input, Output, ViewEncapsulation, NgModule } from '@angular/core';
3
+ import * as i1 from '@angular/common/http';
4
+ import * as i2 from '@valtimo/config';
5
+ import { ROLE_ADMIN } from '@valtimo/config';
6
+ import * as i4 from '@valtimo/components';
7
+ import { FormIoModule, WidgetModule, ListModule, DropzoneModule, ModalModule } from '@valtimo/components';
8
+ import * as i3 from '@angular/router';
9
+ import { RouterModule } from '@angular/router';
10
+ import * as i2$1 from '@ngx-translate/core';
11
+ import { TranslateModule } from '@ngx-translate/core';
12
+ import { AuthGuardService } from '@valtimo/security';
13
+ import * as i2$2 from '@angular/forms';
14
+ import { FormControl, Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
15
+ import { combineLatest, Subject, BehaviorSubject, Subscription } from 'rxjs';
16
+ import { take, first } from 'rxjs/operators';
17
+ import * as i5 from '@angular/common';
18
+ import { CommonModule } from '@angular/common';
19
+ import * as i1$1 from '@valtimo/document';
20
+ import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
21
+
22
+ /*
23
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
24
+ *
25
+ * Licensed under EUPL, Version 1.2 (the "License");
26
+ * you may not use this file except in compliance with the License.
27
+ * You may obtain a copy of the License at
28
+ *
29
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
30
+ *
31
+ * Unless required by applicable law or agreed to in writing, software
32
+ * distributed under the License is distributed on an "AS IS" basis,
33
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34
+ * See the License for the specific language governing permissions and
35
+ * limitations under the License.
36
+ */
37
+ class FormManagementService {
38
+ constructor(http, configService) {
39
+ this.http = http;
40
+ this.configService = configService;
41
+ this.valtimoApiConfig = configService.config.valtimoApi;
42
+ }
43
+ getFormDefinition(formDefinitionId) {
44
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}form-management/${formDefinitionId}`);
45
+ }
46
+ queryFormDefinitions(params) {
47
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}form-management`, {
48
+ observe: 'response',
49
+ params,
50
+ });
51
+ }
52
+ createFormDefinition(request) {
53
+ return this.http.post(`${this.valtimoApiConfig.endpointUri}form-management`, request);
54
+ }
55
+ modifyFormDefinition(request) {
56
+ return this.http.put(`${this.valtimoApiConfig.endpointUri}form-management`, request);
57
+ }
58
+ deleteFormDefinition(formDefinitionId) {
59
+ return this.http.delete(`${this.valtimoApiConfig.endpointUri}form-management/${formDefinitionId}`);
60
+ }
61
+ }
62
+ FormManagementService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormManagementService, deps: [{ token: i1.HttpClient }, { token: i2.ConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
63
+ FormManagementService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormManagementService, providedIn: 'root' });
64
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormManagementService, decorators: [{
65
+ type: Injectable,
66
+ args: [{
67
+ providedIn: 'root',
68
+ }]
69
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i2.ConfigService }]; } });
70
+
71
+ /*
72
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
73
+ *
74
+ * Licensed under EUPL, Version 1.2 (the "License");
75
+ * you may not use this file except in compliance with the License.
76
+ * You may obtain a copy of the License at
77
+ *
78
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
79
+ *
80
+ * Unless required by applicable law or agreed to in writing, software
81
+ * distributed under the License is distributed on an "AS IS" basis,
82
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
83
+ * See the License for the specific language governing permissions and
84
+ * limitations under the License.
85
+ */
86
+ class FormManagementListComponent {
87
+ constructor(formManagementService, router) {
88
+ this.formManagementService = formManagementService;
89
+ this.router = router;
90
+ this.formDefinitions = [];
91
+ this.formDefinitionFields = [
92
+ { key: 'name', label: 'Name' },
93
+ { key: 'readOnly', label: 'Read-only' },
94
+ ];
95
+ this.pagination = {
96
+ collectionSize: 0,
97
+ page: 1,
98
+ size: 10,
99
+ maxPaginationItemSize: 5,
100
+ };
101
+ this.pageParam = 0;
102
+ }
103
+ paginationClicked(page) {
104
+ this.pageParam = page - 1;
105
+ this.loadFormDefinitions();
106
+ }
107
+ ngOnInit() { }
108
+ paginationSet() {
109
+ this.loadFormDefinitions();
110
+ }
111
+ loadFormDefinitions(searchTerm) {
112
+ const params = { page: this.pageParam, size: this.pagination.size };
113
+ if (searchTerm) {
114
+ params['searchTerm'] = searchTerm;
115
+ }
116
+ this.formManagementService.queryFormDefinitions(params).subscribe(results => {
117
+ this.pagination.collectionSize = results.body.totalElements;
118
+ this.formDefinitions = results.body.content;
119
+ });
120
+ }
121
+ editFormDefinition(formDefinition) {
122
+ this.router.navigate(['/form-management/edit', formDefinition.id]);
123
+ }
124
+ searchTermEntered(searchTerm) {
125
+ this.loadFormDefinitions(searchTerm);
126
+ }
127
+ }
128
+ FormManagementListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormManagementListComponent, deps: [{ token: FormManagementService }, { token: i3.Router }], target: i0.ɵɵFactoryTarget.Component });
129
+ FormManagementListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.9", type: FormManagementListComponent, selector: "valtimo-form-management-list", ngImport: i0, template: "<!--\n ~ Copyright 2015-2020 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<valtimo-list\n [items]=\"formDefinitions\"\n [fields]=\"formDefinitionFields\"\n [viewMode]=\"true\"\n [isSearchable]=\"true\"\n [pagination]=\"pagination\"\n paginationIdentifier=\"formManagementList\"\n (paginationClicked)=\"paginationClicked($event)\"\n (paginationSet)=\"paginationSet()\"\n (rowClicked)=\"editFormDefinition($event)\"\n [header]=\"true\"\n (search)=\"searchTermEntered($event)\"\n>\n <div header>\n <h3 class=\"list-header-title\">{{ 'Forms' | translate }}</h3>\n <h5 class=\"list-header-description\">{{ 'Overview of all Forms' | translate }}</h5>\n </div>\n</valtimo-list>\n", styles: ["/*!\n * Copyright 2015-2020 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"], components: [{ type: i4.ListComponent, selector: "valtimo-list", inputs: ["items", "fields", "pagination", "viewMode", "isSearchable", "header", "actions", "paginationIdentifier", "initialSortState"], outputs: ["rowClicked", "paginationClicked", "paginationSet", "search", "sortChanged"] }], pipes: { "translate": i2$1.TranslatePipe } });
130
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormManagementListComponent, decorators: [{
131
+ type: Component,
132
+ args: [{ selector: 'valtimo-form-management-list', template: "<!--\n ~ Copyright 2015-2020 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<valtimo-list\n [items]=\"formDefinitions\"\n [fields]=\"formDefinitionFields\"\n [viewMode]=\"true\"\n [isSearchable]=\"true\"\n [pagination]=\"pagination\"\n paginationIdentifier=\"formManagementList\"\n (paginationClicked)=\"paginationClicked($event)\"\n (paginationSet)=\"paginationSet()\"\n (rowClicked)=\"editFormDefinition($event)\"\n [header]=\"true\"\n (search)=\"searchTermEntered($event)\"\n>\n <div header>\n <h3 class=\"list-header-title\">{{ 'Forms' | translate }}</h3>\n <h5 class=\"list-header-description\">{{ 'Overview of all Forms' | translate }}</h5>\n </div>\n</valtimo-list>\n", styles: ["/*!\n * Copyright 2015-2020 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"] }]
133
+ }], ctorParameters: function () { return [{ type: FormManagementService }, { type: i3.Router }]; } });
134
+
135
+ /*
136
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
137
+ *
138
+ * Licensed under EUPL, Version 1.2 (the "License");
139
+ * you may not use this file except in compliance with the License.
140
+ * You may obtain a copy of the License at
141
+ *
142
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
143
+ *
144
+ * Unless required by applicable law or agreed to in writing, software
145
+ * distributed under the License is distributed on an "AS IS" basis,
146
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
147
+ * See the License for the specific language governing permissions and
148
+ * limitations under the License.
149
+ */
150
+ class FormManagementComponent {
151
+ constructor() { }
152
+ ngOnInit() { }
153
+ }
154
+ FormManagementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormManagementComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
155
+ FormManagementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.9", type: FormManagementComponent, selector: "valtimo-form-management", ngImport: i0, template: "<!--\n ~ Copyright 2015-2020 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<div class=\"main-content pt-0\">\n <div class=\"container-fluid\">\n <div class=\"text-right\">\n <div class=\"btn-group mt-m3px mb-3\">\n <button\n [routerLink]=\"'create'\"\n [queryParams]=\"{upload: 'true'}\"\n class=\"btn btn-secondary btn-space\"\n >\n <i class=\"icon mdi mdi-upload mr-1\"></i>\n {{ 'Upload' | translate }}\n </button>\n <button [routerLink]=\"'create'\" class=\"btn btn-primary btn-space mr-0\">\n <i class=\"icon mdi mdi-plus mr-1\"></i>\n <span>{{ 'Create new Form' | translate }}</span>\n </button>\n </div>\n </div>\n <valtimo-widget>\n <valtimo-form-management-list></valtimo-form-management-list>\n </valtimo-widget>\n </div>\n</div>\n", styles: ["/*!\n * Copyright 2015-2020 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"], components: [{ type: i4.WidgetComponent, selector: "valtimo-widget", inputs: ["type", "name", "icon", "contrast", "divider", "title", "subtitle", "collapseAble", "collapse", "additionalClasses"] }, { type: FormManagementListComponent, selector: "valtimo-form-management-list" }], directives: [{ type: i3.RouterLink, selector: ":not(a):not(area)[routerLink]", inputs: ["queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }], pipes: { "translate": i2$1.TranslatePipe } });
156
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormManagementComponent, decorators: [{
157
+ type: Component,
158
+ args: [{ selector: 'valtimo-form-management', template: "<!--\n ~ Copyright 2015-2020 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<div class=\"main-content pt-0\">\n <div class=\"container-fluid\">\n <div class=\"text-right\">\n <div class=\"btn-group mt-m3px mb-3\">\n <button\n [routerLink]=\"'create'\"\n [queryParams]=\"{upload: 'true'}\"\n class=\"btn btn-secondary btn-space\"\n >\n <i class=\"icon mdi mdi-upload mr-1\"></i>\n {{ 'Upload' | translate }}\n </button>\n <button [routerLink]=\"'create'\" class=\"btn btn-primary btn-space mr-0\">\n <i class=\"icon mdi mdi-plus mr-1\"></i>\n <span>{{ 'Create new Form' | translate }}</span>\n </button>\n </div>\n </div>\n <valtimo-widget>\n <valtimo-form-management-list></valtimo-form-management-list>\n </valtimo-widget>\n </div>\n</div>\n", styles: ["/*!\n * Copyright 2015-2020 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"] }]
159
+ }], ctorParameters: function () { return []; } });
160
+
161
+ /*
162
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
163
+ *
164
+ * Licensed under EUPL, Version 1.2 (the "License");
165
+ * you may not use this file except in compliance with the License.
166
+ * You may obtain a copy of the License at
167
+ *
168
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
169
+ *
170
+ * Unless required by applicable law or agreed to in writing, software
171
+ * distributed under the License is distributed on an "AS IS" basis,
172
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
173
+ * See the License for the specific language governing permissions and
174
+ * limitations under the License.
175
+ */
176
+ class FormManagementCreateComponent {
177
+ constructor(formManagementService, formBuilder, router, alertService, route) {
178
+ this.formManagementService = formManagementService;
179
+ this.formBuilder = formBuilder;
180
+ this.router = router;
181
+ this.alertService = alertService;
182
+ this.route = route;
183
+ }
184
+ get formControls() {
185
+ return this.form.controls;
186
+ }
187
+ ngOnInit() {
188
+ this.form = this.formBuilder.group({
189
+ name: new FormControl('', Validators.required),
190
+ });
191
+ }
192
+ reset() {
193
+ this.form.setValue({
194
+ name: '',
195
+ });
196
+ }
197
+ createFormDefinition() {
198
+ const emptyForm = {
199
+ display: 'form',
200
+ components: [],
201
+ };
202
+ const request = {
203
+ name: this.form.value.name,
204
+ formDefinition: JSON.stringify(emptyForm),
205
+ };
206
+ combineLatest([
207
+ this.formManagementService.createFormDefinition(request),
208
+ this.route.queryParams,
209
+ ])
210
+ .pipe(take(1))
211
+ .subscribe(([formDefinition, params]) => {
212
+ this.alertService.success('Created new Form');
213
+ if (params?.upload === 'true') {
214
+ this.router.navigate(['/form-management/edit', formDefinition.id], {
215
+ queryParams: { upload: 'true' },
216
+ });
217
+ }
218
+ else {
219
+ this.router.navigate(['/form-management/edit', formDefinition.id]);
220
+ }
221
+ }, err => {
222
+ this.alertService.error('Error creating new Form');
223
+ });
224
+ }
225
+ }
226
+ FormManagementCreateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormManagementCreateComponent, deps: [{ token: FormManagementService }, { token: i2$2.FormBuilder }, { token: i3.Router }, { token: i4.AlertService }, { token: i3.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component });
227
+ FormManagementCreateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.9", type: FormManagementCreateComponent, selector: "valtimo-form-management-create", ngImport: i0, template: "<!--\n ~ Copyright 2015-2020 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<div class=\"main-content\">\n <div class=\"container-fluid\">\n <div class=\"col-12 px-0 mb-5\">\n <valtimo-widget>\n <div class=\"bg-white p-5\">\n <form [formGroup]=\"form\" (ngSubmit)=\"createFormDefinition()\">\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"name\">{{\n 'formManagement.name' | translate\n }}</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input\n type=\"text\"\n id=\"name\"\n formControlName=\"name\"\n class=\"form-control\"\n placeholder=\"Form definition name\"\n [ngClass]=\"{\n 'is-valid': formControls.name.touched && formControls.name.valid,\n 'is-invalid': formControls.name.touched && formControls.name.errors\n }\"\n required\n />\n <div\n *ngIf=\"formControls.name.touched && formControls.name.errors\"\n class=\"invalid-feedback\"\n >\n <div *ngIf=\"formControls.name.errors.required\">\n {{ 'formManagement.nameIsRequired' | translate }}\n </div>\n </div>\n </div>\n </div>\n <div class=\"row pt-3 mt-1\">\n <div class=\"col-12 col-sm-6 text-left\">\n <a [routerLink]=\"'/forms'\" class=\"btn btn-space btn-default\">{{\n 'formManagement.back' | translate\n }}</a>\n </div>\n <div class=\"col-12 col-sm-6 text-right\">\n <button class=\"btn btn-space btn-secondary\" type=\"button\" (click)=\"reset()\">\n {{ 'formManagement.reset' | translate }}\n </button>\n <button class=\"btn btn-space btn-primary\" type=\"submit\" [disabled]=\"form.invalid\">\n {{ 'formManagement.submit' | translate }}\n </button>\n </div>\n </div>\n </form>\n </div>\n </valtimo-widget>\n </div>\n </div>\n</div>\n", styles: ["/*!\n * Copyright 2015-2020 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"], components: [{ type: i4.WidgetComponent, selector: "valtimo-widget", inputs: ["type", "name", "icon", "contrast", "divider", "title", "subtitle", "collapseAble", "collapse", "additionalClasses"] }], directives: [{ type: i2$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i2$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i2$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i2$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i2$2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }], pipes: { "translate": i2$1.TranslatePipe } });
228
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormManagementCreateComponent, decorators: [{
229
+ type: Component,
230
+ args: [{ selector: 'valtimo-form-management-create', template: "<!--\n ~ Copyright 2015-2020 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<div class=\"main-content\">\n <div class=\"container-fluid\">\n <div class=\"col-12 px-0 mb-5\">\n <valtimo-widget>\n <div class=\"bg-white p-5\">\n <form [formGroup]=\"form\" (ngSubmit)=\"createFormDefinition()\">\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"name\">{{\n 'formManagement.name' | translate\n }}</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input\n type=\"text\"\n id=\"name\"\n formControlName=\"name\"\n class=\"form-control\"\n placeholder=\"Form definition name\"\n [ngClass]=\"{\n 'is-valid': formControls.name.touched && formControls.name.valid,\n 'is-invalid': formControls.name.touched && formControls.name.errors\n }\"\n required\n />\n <div\n *ngIf=\"formControls.name.touched && formControls.name.errors\"\n class=\"invalid-feedback\"\n >\n <div *ngIf=\"formControls.name.errors.required\">\n {{ 'formManagement.nameIsRequired' | translate }}\n </div>\n </div>\n </div>\n </div>\n <div class=\"row pt-3 mt-1\">\n <div class=\"col-12 col-sm-6 text-left\">\n <a [routerLink]=\"'/forms'\" class=\"btn btn-space btn-default\">{{\n 'formManagement.back' | translate\n }}</a>\n </div>\n <div class=\"col-12 col-sm-6 text-right\">\n <button class=\"btn btn-space btn-secondary\" type=\"button\" (click)=\"reset()\">\n {{ 'formManagement.reset' | translate }}\n </button>\n <button class=\"btn btn-space btn-primary\" type=\"submit\" [disabled]=\"form.invalid\">\n {{ 'formManagement.submit' | translate }}\n </button>\n </div>\n </div>\n </form>\n </div>\n </valtimo-widget>\n </div>\n </div>\n</div>\n", styles: ["/*!\n * Copyright 2015-2020 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"] }]
231
+ }], ctorParameters: function () { return [{ type: FormManagementService }, { type: i2$2.FormBuilder }, { type: i3.Router }, { type: i4.AlertService }, { type: i3.ActivatedRoute }]; } });
232
+
233
+ /*
234
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
235
+ *
236
+ * Licensed under EUPL, Version 1.2 (the "License");
237
+ * you may not use this file except in compliance with the License.
238
+ * You may obtain a copy of the License at
239
+ *
240
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
241
+ *
242
+ * Unless required by applicable law or agreed to in writing, software
243
+ * distributed under the License is distributed on an "AS IS" basis,
244
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
245
+ * See the License for the specific language governing permissions and
246
+ * limitations under the License.
247
+ */
248
+ class FormManagementUploadComponent {
249
+ constructor(documentService, translateService) {
250
+ this.documentService = documentService;
251
+ this.translateService = translateService;
252
+ this.definitionUploaded = new EventEmitter();
253
+ this.clear$ = new Subject();
254
+ this.jsonString$ = new BehaviorSubject('');
255
+ this.error$ = new BehaviorSubject('');
256
+ this.disabled$ = new BehaviorSubject(false);
257
+ this.file$ = new BehaviorSubject(undefined);
258
+ }
259
+ ngAfterViewInit() {
260
+ this.openShowSubscription();
261
+ this.openFileSubscription();
262
+ }
263
+ ngOnDestroy() {
264
+ this.showSubscription.unsubscribe();
265
+ this.fileSubscription.unsubscribe();
266
+ this.closeErrorSubscription();
267
+ }
268
+ setFile(file) {
269
+ this.clearError();
270
+ this.file$.next(file);
271
+ }
272
+ uploadDefinition() {
273
+ this.disable();
274
+ this.jsonString$.pipe(take(1)).subscribe(definition => {
275
+ this.closeErrorSubscription();
276
+ this.clearError();
277
+ this.enable();
278
+ this.hideModal();
279
+ this.definitionUploaded.emit(definition);
280
+ });
281
+ }
282
+ openErrorSubscription(errorCode) {
283
+ this.closeErrorSubscription();
284
+ this.errorSubscription = this.translateService.stream(errorCode).subscribe(error => {
285
+ this.error$.next(error);
286
+ });
287
+ }
288
+ closeErrorSubscription() {
289
+ if (this.errorSubscription) {
290
+ this.errorSubscription.unsubscribe();
291
+ }
292
+ }
293
+ clearError() {
294
+ this.error$.next('');
295
+ }
296
+ openFileSubscription() {
297
+ this.fileSubscription = this.file$.subscribe(file => {
298
+ if (file) {
299
+ const reader = new FileReader();
300
+ reader.onloadend = () => {
301
+ const result = reader.result.toString();
302
+ if (this.stringIsValidJson(result)) {
303
+ this.jsonString$.next(result);
304
+ }
305
+ };
306
+ reader.readAsText(file);
307
+ }
308
+ else {
309
+ this.clearJsonString();
310
+ }
311
+ });
312
+ }
313
+ openShowSubscription() {
314
+ this.showSubscription = this.show$.subscribe(show => {
315
+ if (show) {
316
+ this.showModal();
317
+ }
318
+ else {
319
+ this.hideModal();
320
+ }
321
+ this.clearJsonString();
322
+ this.clearError();
323
+ this.clearDropzone();
324
+ });
325
+ }
326
+ clearJsonString() {
327
+ this.jsonString$.next('');
328
+ }
329
+ clearDropzone() {
330
+ this.clear$.next();
331
+ }
332
+ showModal() {
333
+ this.modal.show();
334
+ }
335
+ hideModal() {
336
+ this.modal.hide();
337
+ }
338
+ stringIsValidJson(string) {
339
+ try {
340
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
341
+ JSON.parse(string)?.formDefinition?.components;
342
+ }
343
+ catch (e) {
344
+ this.clearDropzone();
345
+ this.openErrorSubscription('dropzone.error.invalidFormDef');
346
+ return false;
347
+ }
348
+ return true;
349
+ }
350
+ disable() {
351
+ this.disabled$.next(true);
352
+ }
353
+ enable() {
354
+ this.disabled$.next(false);
355
+ }
356
+ }
357
+ FormManagementUploadComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormManagementUploadComponent, deps: [{ token: i1$1.DocumentService }, { token: i2$1.TranslateService }], target: i0.ɵɵFactoryTarget.Component });
358
+ FormManagementUploadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.9", type: FormManagementUploadComponent, selector: "valtimo-form-management-upload", inputs: { show$: "show$" }, outputs: { definitionUploaded: "definitionUploaded" }, viewQueries: [{ propertyName: "modal", first: true, predicate: ["uploadFormDefinitionModal"], descendants: true }], ngImport: i0, template: "<valtimo-modal\n #uploadFormDefinitionModal\n [title]=\"'uploadFormDefinition' | translate\"\n showFooter=\"true\"\n>\n <div class=\"mt-2\" body>\n <valtimo-dropzone\n [clear$]=\"clear$\"\n (fileSelected)=\"setFile($event)\"\n [disabled]=\"disabled$ | async\"\n [subtitle]=\"'dropzone.formJsonDocDef' | translate\"\n [externalError$]=\"error$\"\n ></valtimo-dropzone>\n </div>\n <div footer>\n <ng-container *ngIf=\"(jsonString$ | async) && (error$ | async) === ''; else pleaseSelect\">\n <button [disabled]=\"disabled$ | async\" class=\"btn btn-primary\" (click)=\"uploadDefinition()\">\n {{ 'Upload' | translate }}\n </button>\n </ng-container>\n </div>\n</valtimo-modal>\n\n<ng-template #pleaseSelect>\n <button class=\"btn btn-primary\" [disabled]=\"true\">\n {{ 'Select a document definition' | translate }}\n </button>\n</ng-template>\n", styles: [""], components: [{ type: i4.ModalComponent, selector: "valtimo-modal", inputs: ["elementId", "title", "subtitle", "templateBelowSubtitle", "showFooter"] }, { type: i4.DropzoneComponent, selector: "valtimo-dropzone", inputs: ["title", "hideTitle", "subtitle", "externalError$", "maxFileSize", "showMaxFileSize", "acceptedFiles", "clear$", "disabled", "hideFilePreview", "uploading", "camera"], outputs: ["fileSelected"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "translate": i2$1.TranslatePipe, "async": i5.AsyncPipe } });
359
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormManagementUploadComponent, decorators: [{
360
+ type: Component,
361
+ args: [{ selector: 'valtimo-form-management-upload', template: "<valtimo-modal\n #uploadFormDefinitionModal\n [title]=\"'uploadFormDefinition' | translate\"\n showFooter=\"true\"\n>\n <div class=\"mt-2\" body>\n <valtimo-dropzone\n [clear$]=\"clear$\"\n (fileSelected)=\"setFile($event)\"\n [disabled]=\"disabled$ | async\"\n [subtitle]=\"'dropzone.formJsonDocDef' | translate\"\n [externalError$]=\"error$\"\n ></valtimo-dropzone>\n </div>\n <div footer>\n <ng-container *ngIf=\"(jsonString$ | async) && (error$ | async) === ''; else pleaseSelect\">\n <button [disabled]=\"disabled$ | async\" class=\"btn btn-primary\" (click)=\"uploadDefinition()\">\n {{ 'Upload' | translate }}\n </button>\n </ng-container>\n </div>\n</valtimo-modal>\n\n<ng-template #pleaseSelect>\n <button class=\"btn btn-primary\" [disabled]=\"true\">\n {{ 'Select a document definition' | translate }}\n </button>\n</ng-template>\n", styles: [""] }]
362
+ }], ctorParameters: function () { return [{ type: i1$1.DocumentService }, { type: i2$1.TranslateService }]; }, propDecorators: { modal: [{
363
+ type: ViewChild,
364
+ args: ['uploadFormDefinitionModal']
365
+ }], show$: [{
366
+ type: Input
367
+ }], definitionUploaded: [{
368
+ type: Output
369
+ }] } });
370
+
371
+ /*
372
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
373
+ *
374
+ * Licensed under EUPL, Version 1.2 (the "License");
375
+ * you may not use this file except in compliance with the License.
376
+ * You may obtain a copy of the License at
377
+ *
378
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
379
+ *
380
+ * Unless required by applicable law or agreed to in writing, software
381
+ * distributed under the License is distributed on an "AS IS" basis,
382
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
383
+ * See the License for the specific language governing permissions and
384
+ * limitations under the License.
385
+ */
386
+ class FormManagementEditComponent {
387
+ constructor(formManagementService, alertService, route, router) {
388
+ this.formManagementService = formManagementService;
389
+ this.alertService = alertService;
390
+ this.route = route;
391
+ this.router = router;
392
+ this.showModal$ = new BehaviorSubject(false);
393
+ this.reloading$ = new BehaviorSubject(false);
394
+ this.modifiedFormDefinition = null;
395
+ this.formDefinition = null;
396
+ this.alertSub = Subscription.EMPTY;
397
+ this.formDefinitionId = null;
398
+ }
399
+ ngOnInit() {
400
+ this.loadFormDefinition();
401
+ this.checkToOpenUploadModal();
402
+ }
403
+ ngOnDestroy() {
404
+ this.alertSub.unsubscribe();
405
+ }
406
+ loadFormDefinition() {
407
+ this.formDefinitionId = this.route.snapshot.paramMap.get('id');
408
+ this.formManagementService.getFormDefinition(this.formDefinitionId).subscribe(formDefinition => {
409
+ this.formDefinition = formDefinition;
410
+ }, () => {
411
+ this.alertService.error('Error retrieving Form Definition');
412
+ });
413
+ }
414
+ modifyFormDefinition() {
415
+ const form = JSON.stringify(this.modifiedFormDefinition != null
416
+ ? this.modifiedFormDefinition
417
+ : this.formDefinition.formDefinition);
418
+ const request = {
419
+ id: this.formDefinition.id,
420
+ name: this.formDefinition.name,
421
+ formDefinition: form,
422
+ };
423
+ this.formManagementService.modifyFormDefinition(request).subscribe(() => {
424
+ this.router.navigate(['/form-management']);
425
+ this.alertService.success('Form deployed');
426
+ }, err => {
427
+ this.alertService.error('Error deploying Form');
428
+ });
429
+ }
430
+ formBuilderChanged(event) {
431
+ this.modifiedFormDefinition = event.form;
432
+ }
433
+ delete() {
434
+ if (!this.alertSub.closed) {
435
+ return;
436
+ }
437
+ const mssg = 'Delete Form?';
438
+ const confirmations = [
439
+ {
440
+ label: 'Cancel',
441
+ class: 'btn btn-default',
442
+ value: false,
443
+ },
444
+ {
445
+ label: 'Delete',
446
+ class: 'btn btn-primary',
447
+ value: true,
448
+ },
449
+ ];
450
+ this.alertService.notification(mssg, confirmations);
451
+ this.alertSub = this.alertService
452
+ .getAlertConfirmChangeEmitter()
453
+ .pipe(first())
454
+ .subscribe(alert => {
455
+ if (alert.confirm === true) {
456
+ this.deleteFormDefinition();
457
+ }
458
+ });
459
+ }
460
+ deleteFormDefinition() {
461
+ this.formManagementService.deleteFormDefinition(this.formDefinition.id).subscribe(() => {
462
+ this.router.navigate(['/form-management']);
463
+ this.alertService.success('Form deleted');
464
+ }, err => {
465
+ this.alertService.error('Error deleting Form');
466
+ });
467
+ }
468
+ downloadFormDefinition() {
469
+ const file = new Blob([JSON.stringify(this.formDefinition)], { type: 'text/json' });
470
+ const link = document.createElement('a');
471
+ link.download = `form_${this.formDefinition.name}.json`;
472
+ link.href = window.URL.createObjectURL(file);
473
+ link.click();
474
+ window.URL.revokeObjectURL(link.href);
475
+ link.remove();
476
+ }
477
+ showModal() {
478
+ this.showModal$.next(true);
479
+ }
480
+ setFormDefinition(formDefinition) {
481
+ this.reloading$.next(true);
482
+ const definition = JSON.parse(formDefinition);
483
+ const components = definition?.formDefinition?.components;
484
+ const currentDefinition = this.modifiedFormDefinition || this.formDefinition.formDefinition;
485
+ const newDefinition = { ...currentDefinition, ...(components && { components }) };
486
+ this.modifiedFormDefinition = newDefinition;
487
+ this.formDefinition.formDefinition = newDefinition;
488
+ this.reloading$.next(false);
489
+ }
490
+ checkToOpenUploadModal() {
491
+ this.route.queryParams.pipe(take(1)).subscribe(params => {
492
+ if (params?.upload === 'true') {
493
+ this.showModal();
494
+ }
495
+ });
496
+ }
497
+ }
498
+ FormManagementEditComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormManagementEditComponent, deps: [{ token: FormManagementService }, { token: i4.AlertService }, { token: i3.ActivatedRoute }, { token: i3.Router }], target: i0.ɵɵFactoryTarget.Component });
499
+ FormManagementEditComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.9", type: FormManagementEditComponent, selector: "valtimo-form-management-edit", ngImport: i0, template: "<!--\n ~ Copyright 2015-2020 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<div class=\"main-content pt-0\">\n <div class=\"container-fluid\" *ngIf=\"formDefinition\">\n <div class=\"btn-group mt-m3px mb-3 float-right\">\n <button class=\"btn btn-primary btn-space\" (click)=\"downloadFormDefinition()\">\n <i class=\"icon mdi mdi-download mr-1\"></i>\n {{ 'Download' | translate }}\n </button>\n <button\n class=\"btn btn-secondary btn-space\"\n (click)=\"showModal()\"\n [disabled]=\"formDefinition.readOnly\"\n >\n <i class=\"icon mdi mdi-upload mr-1\"></i>\n {{ 'Upload' | translate }}\n </button>\n <button\n class=\"btn btn-danger btn-space\"\n (click)=\"delete()\"\n [disabled]=\"formDefinition.readOnly\"\n >\n <i class=\"icon mdi mdi-delete mr-1\"></i>{{ 'formManagement.delete' | translate }}\n </button>\n <button\n class=\"btn btn-success btn-space\"\n (click)=\"modifyFormDefinition()\"\n [disabled]=\"formDefinition.readOnly\"\n >\n <i class=\"icon mdi mdi-upload mr-1\"></i>{{ 'formManagement.deploy' | translate }}\n </button>\n </div>\n <div class=\"clearfix\"></div>\n <div class=\"bg-light formbuilder-header overflow-auto\">\n <h3 class=\"formbuilder-title\">\n {{ formDefinition.name }}\n <div *ngIf=\"formDefinition.readOnly\" class=\"pull-right\">\n <span class=\"badge badge-pill badge-info increase-size\">{{\n 'formManagement.readOnly' | translate\n }}</span>\n </div>\n </h3>\n </div>\n <ng-container *ngIf=\"(reloading$ | async) === false\">\n <valtimo-form-io-builder\n [form]=\"formDefinition.formDefinition\"\n (change)=\"formBuilderChanged($event)\"\n ></valtimo-form-io-builder>\n </ng-container>\n </div>\n</div>\n\n<valtimo-form-management-upload\n [show$]=\"showModal$\"\n (definitionUploaded)=\"setFormDefinition($event)\"\n></valtimo-form-management-upload>\n", styles: ["/*!\n * Copyright 2015-2020 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 */.formbuilder .btn.formcomponent.drag-copy,.btn.formcomponent.gu-mirror{font-weight:400;background-color:silver;border-color:silver;color:#fff}.formbuilder .btn.formcomponent.drag-copy:hover,.formbuilder .btn.formcomponent.drag-copy:active,.btn.formcomponent.gu-mirror:hover,.btn.formcomponent.gu-mirror:active{box-shadow:none}.formbuilder .btn.formcomponent.drag-copy:active,.btn.formcomponent.gu-mirror:active{background-color:silver;border-color:silver}.formbuilder-header{padding-left:18px;padding-right:18px;font-size:18px;height:80px;border:1px solid #dee2e6;border-bottom:0}.formbuilder-header .formbuilder-title{margin-top:21px;margin-bottom:7px}.formbuilder-header .formbuilder-subtitle{margin-top:0;margin-bottom:12px}.formbuilder{background:white;padding:1rem;border:1px solid #dee2e6;margin-right:0!important;margin-left:0!important}.formbuilder .form-builder-panel .builder-group-button[aria-expanded=false],.formbuilder .form-builder-panel .builder-group-button[aria-expanded=\"\"]{color:#a9a9a9}.formbuilder .form-builder-panel .builder-group-button[aria-expanded=true]{color:#000}.formbuilder .drag-and-drop-alert{display:none}.formbuilder .formarea{padding:10px;border:solid 1px silver;background-color:#fff}.increase-size{font-size:1rem}\n"], components: [{ type: i4.FormioBuilderComponent, selector: "valtimo-form-io-builder", inputs: ["form"], outputs: ["change"] }, { type: FormManagementUploadComponent, selector: "valtimo-form-management-upload", inputs: ["show$"], outputs: ["definitionUploaded"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "translate": i2$1.TranslatePipe, "async": i5.AsyncPipe }, encapsulation: i0.ViewEncapsulation.None });
500
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormManagementEditComponent, decorators: [{
501
+ type: Component,
502
+ args: [{ selector: 'valtimo-form-management-edit', encapsulation: ViewEncapsulation.None, template: "<!--\n ~ Copyright 2015-2020 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<div class=\"main-content pt-0\">\n <div class=\"container-fluid\" *ngIf=\"formDefinition\">\n <div class=\"btn-group mt-m3px mb-3 float-right\">\n <button class=\"btn btn-primary btn-space\" (click)=\"downloadFormDefinition()\">\n <i class=\"icon mdi mdi-download mr-1\"></i>\n {{ 'Download' | translate }}\n </button>\n <button\n class=\"btn btn-secondary btn-space\"\n (click)=\"showModal()\"\n [disabled]=\"formDefinition.readOnly\"\n >\n <i class=\"icon mdi mdi-upload mr-1\"></i>\n {{ 'Upload' | translate }}\n </button>\n <button\n class=\"btn btn-danger btn-space\"\n (click)=\"delete()\"\n [disabled]=\"formDefinition.readOnly\"\n >\n <i class=\"icon mdi mdi-delete mr-1\"></i>{{ 'formManagement.delete' | translate }}\n </button>\n <button\n class=\"btn btn-success btn-space\"\n (click)=\"modifyFormDefinition()\"\n [disabled]=\"formDefinition.readOnly\"\n >\n <i class=\"icon mdi mdi-upload mr-1\"></i>{{ 'formManagement.deploy' | translate }}\n </button>\n </div>\n <div class=\"clearfix\"></div>\n <div class=\"bg-light formbuilder-header overflow-auto\">\n <h3 class=\"formbuilder-title\">\n {{ formDefinition.name }}\n <div *ngIf=\"formDefinition.readOnly\" class=\"pull-right\">\n <span class=\"badge badge-pill badge-info increase-size\">{{\n 'formManagement.readOnly' | translate\n }}</span>\n </div>\n </h3>\n </div>\n <ng-container *ngIf=\"(reloading$ | async) === false\">\n <valtimo-form-io-builder\n [form]=\"formDefinition.formDefinition\"\n (change)=\"formBuilderChanged($event)\"\n ></valtimo-form-io-builder>\n </ng-container>\n </div>\n</div>\n\n<valtimo-form-management-upload\n [show$]=\"showModal$\"\n (definitionUploaded)=\"setFormDefinition($event)\"\n></valtimo-form-management-upload>\n", styles: ["/*!\n * Copyright 2015-2020 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 */.formbuilder .btn.formcomponent.drag-copy,.btn.formcomponent.gu-mirror{font-weight:400;background-color:silver;border-color:silver;color:#fff}.formbuilder .btn.formcomponent.drag-copy:hover,.formbuilder .btn.formcomponent.drag-copy:active,.btn.formcomponent.gu-mirror:hover,.btn.formcomponent.gu-mirror:active{box-shadow:none}.formbuilder .btn.formcomponent.drag-copy:active,.btn.formcomponent.gu-mirror:active{background-color:silver;border-color:silver}.formbuilder-header{padding-left:18px;padding-right:18px;font-size:18px;height:80px;border:1px solid #dee2e6;border-bottom:0}.formbuilder-header .formbuilder-title{margin-top:21px;margin-bottom:7px}.formbuilder-header .formbuilder-subtitle{margin-top:0;margin-bottom:12px}.formbuilder{background:white;padding:1rem;border:1px solid #dee2e6;margin-right:0!important;margin-left:0!important}.formbuilder .form-builder-panel .builder-group-button[aria-expanded=false],.formbuilder .form-builder-panel .builder-group-button[aria-expanded=\"\"]{color:#a9a9a9}.formbuilder .form-builder-panel .builder-group-button[aria-expanded=true]{color:#000}.formbuilder .drag-and-drop-alert{display:none}.formbuilder .formarea{padding:10px;border:solid 1px silver;background-color:#fff}.increase-size{font-size:1rem}\n"] }]
503
+ }], ctorParameters: function () { return [{ type: FormManagementService }, { type: i4.AlertService }, { type: i3.ActivatedRoute }, { type: i3.Router }]; } });
504
+
505
+ /*
506
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
507
+ *
508
+ * Licensed under EUPL, Version 1.2 (the "License");
509
+ * you may not use this file except in compliance with the License.
510
+ * You may obtain a copy of the License at
511
+ *
512
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
513
+ *
514
+ * Unless required by applicable law or agreed to in writing, software
515
+ * distributed under the License is distributed on an "AS IS" basis,
516
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
517
+ * See the License for the specific language governing permissions and
518
+ * limitations under the License.
519
+ */
520
+ const routes = [
521
+ {
522
+ path: 'form-management',
523
+ component: FormManagementComponent,
524
+ canActivate: [AuthGuardService],
525
+ data: { title: 'Form management', roles: [ROLE_ADMIN] },
526
+ },
527
+ {
528
+ path: 'form-management/create',
529
+ component: FormManagementCreateComponent,
530
+ canActivate: [AuthGuardService],
531
+ data: { title: 'Create new Form', roles: [ROLE_ADMIN] },
532
+ },
533
+ {
534
+ path: 'form-management/edit/:id',
535
+ component: FormManagementEditComponent,
536
+ canActivate: [AuthGuardService],
537
+ data: { title: 'Form Builder', roles: [ROLE_ADMIN] },
538
+ },
539
+ ];
540
+ class FormManagementRoutingModule {
541
+ }
542
+ FormManagementRoutingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormManagementRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
543
+ FormManagementRoutingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormManagementRoutingModule, imports: [i3.RouterModule], exports: [RouterModule] });
544
+ FormManagementRoutingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormManagementRoutingModule, imports: [[RouterModule.forChild(routes)], RouterModule] });
545
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormManagementRoutingModule, decorators: [{
546
+ type: NgModule,
547
+ args: [{
548
+ imports: [RouterModule.forChild(routes)],
549
+ exports: [RouterModule],
550
+ declarations: [],
551
+ }]
552
+ }] });
553
+
554
+ /*
555
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
556
+ *
557
+ * Licensed under EUPL, Version 1.2 (the "License");
558
+ * you may not use this file except in compliance with the License.
559
+ * You may obtain a copy of the License at
560
+ *
561
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
562
+ *
563
+ * Unless required by applicable law or agreed to in writing, software
564
+ * distributed under the License is distributed on an "AS IS" basis,
565
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
566
+ * See the License for the specific language governing permissions and
567
+ * limitations under the License.
568
+ */
569
+ class FormManagementModule {
570
+ }
571
+ FormManagementModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormManagementModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
572
+ FormManagementModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormManagementModule, declarations: [FormManagementComponent,
573
+ FormManagementCreateComponent,
574
+ FormManagementListComponent,
575
+ FormManagementEditComponent,
576
+ FormManagementUploadComponent], imports: [FormManagementRoutingModule,
577
+ FormIoModule,
578
+ CommonModule,
579
+ ReactiveFormsModule,
580
+ FormsModule,
581
+ WidgetModule,
582
+ ListModule,
583
+ TranslateModule,
584
+ NgbTooltipModule,
585
+ DropzoneModule,
586
+ ModalModule], exports: [FormManagementComponent] });
587
+ FormManagementModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormManagementModule, imports: [[
588
+ FormManagementRoutingModule,
589
+ FormIoModule,
590
+ CommonModule,
591
+ ReactiveFormsModule,
592
+ FormsModule,
593
+ WidgetModule,
594
+ ListModule,
595
+ TranslateModule,
596
+ NgbTooltipModule,
597
+ DropzoneModule,
598
+ ModalModule,
599
+ ]] });
600
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormManagementModule, decorators: [{
601
+ type: NgModule,
602
+ args: [{
603
+ declarations: [
604
+ FormManagementComponent,
605
+ FormManagementCreateComponent,
606
+ FormManagementListComponent,
607
+ FormManagementEditComponent,
608
+ FormManagementUploadComponent,
609
+ ],
610
+ imports: [
611
+ FormManagementRoutingModule,
612
+ FormIoModule,
613
+ CommonModule,
614
+ ReactiveFormsModule,
615
+ FormsModule,
616
+ WidgetModule,
617
+ ListModule,
618
+ TranslateModule,
619
+ NgbTooltipModule,
620
+ DropzoneModule,
621
+ ModalModule,
622
+ ],
623
+ exports: [FormManagementComponent],
624
+ }]
625
+ }] });
626
+
627
+ /*
628
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
629
+ *
630
+ * Licensed under EUPL, Version 1.2 (the "License");
631
+ * you may not use this file except in compliance with the License.
632
+ * You may obtain a copy of the License at
633
+ *
634
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
635
+ *
636
+ * Unless required by applicable law or agreed to in writing, software
637
+ * distributed under the License is distributed on an "AS IS" basis,
638
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
639
+ * See the License for the specific language governing permissions and
640
+ * limitations under the License.
641
+ */
642
+ function compareFormDefinitions(fd1, fd2) {
643
+ if (fd1 === null && fd2 === null) {
644
+ return true;
645
+ }
646
+ if (fd1 === null || fd2 === null) {
647
+ return false;
648
+ }
649
+ return fd1.id === fd2.id;
650
+ }
651
+
652
+ /*
653
+ *
654
+ * * Copyright 2015-2020 Ritense BV, the Netherlands.
655
+ * *
656
+ * * Licensed under EUPL, Version 1.2 (the "License");
657
+ * * you may not use this file except in compliance with the License.
658
+ * * You may obtain a copy of the License at
659
+ * *
660
+ * * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
661
+ * *
662
+ * * Unless required by applicable law or agreed to in writing, software
663
+ * * distributed under the License is distributed on an "AS IS" basis,
664
+ * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
665
+ * * See the License for the specific language governing permissions and
666
+ * * limitations under the License.
667
+ *
668
+ */
669
+
670
+ /*
671
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
672
+ *
673
+ * Licensed under EUPL, Version 1.2 (the "License");
674
+ * you may not use this file except in compliance with the License.
675
+ * You may obtain a copy of the License at
676
+ *
677
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
678
+ *
679
+ * Unless required by applicable law or agreed to in writing, software
680
+ * distributed under the License is distributed on an "AS IS" basis,
681
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
682
+ * See the License for the specific language governing permissions and
683
+ * limitations under the License.
684
+ */
685
+
686
+ /**
687
+ * Generated bundle index. Do not edit.
688
+ */
689
+
690
+ export { FormManagementComponent, FormManagementModule, FormManagementService, compareFormDefinitions };
691
+ //# sourceMappingURL=valtimo-form-management.mjs.map