@valtimo/form-management 4.15.3-next-main.14 → 4.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -6
- package/bundles/valtimo-form-management.umd.js +124 -61
- package/bundles/valtimo-form-management.umd.js.map +1 -1
- package/bundles/valtimo-form-management.umd.min.js +1 -1
- package/bundles/valtimo-form-management.umd.min.js.map +1 -1
- package/esm2015/lib/form-management-create/form-management-create.component.js +13 -8
- package/esm2015/lib/form-management-edit/form-management-edit.component.js +12 -10
- package/esm2015/lib/form-management-list/form-management-list.component.js +6 -7
- package/esm2015/lib/form-management-routing.module.js +9 -13
- package/esm2015/lib/form-management-upload/form-management-upload.component.js +4 -6
- package/esm2015/lib/form-management.component.js +4 -6
- package/esm2015/lib/form-management.module.js +5 -5
- package/esm2015/lib/form-management.service.js +6 -3
- package/esm2015/lib/models/form-definition.model.js +25 -0
- package/esm2015/lib/models/index.js +19 -0
- package/esm2015/public-api.js +2 -1
- package/esm2015/valtimo-form-management.js +1 -1
- package/fesm2015/valtimo-form-management.js +93 -50
- package/fesm2015/valtimo-form-management.js.map +1 -1
- package/lib/form-management-edit/form-management-edit.component.d.ts +1 -1
- package/lib/form-management-list/form-management-list.component.d.ts +1 -1
- package/lib/form-management.service.d.ts +1 -1
- package/lib/models/form-definition.model.d.ts +17 -0
- package/lib/models/index.d.ts +1 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/valtimo-form-management.metadata.json +1 -1
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { ɵɵdefineInjectable, ɵɵinject, Injectable, Component, ViewEncapsulation, NgModule, EventEmitter, ViewChild, Input, Output } from '@angular/core';
|
|
2
2
|
import { HttpClient } from '@angular/common/http';
|
|
3
|
-
import { ConfigService } from '@valtimo/config';
|
|
3
|
+
import { ConfigService, ROLE_ADMIN } from '@valtimo/config';
|
|
4
4
|
import { Router, ActivatedRoute, RouterModule } from '@angular/router';
|
|
5
5
|
import { AuthGuardService } from '@valtimo/security';
|
|
6
6
|
import { FormControl, Validators, FormBuilder, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
7
7
|
import { AlertService, FormIoModule, WidgetModule, ListModule, DropzoneModule, ModalModule } from '@valtimo/components';
|
|
8
8
|
import { combineLatest, BehaviorSubject, Subscription, Subject } from 'rxjs';
|
|
9
9
|
import { take, first } from 'rxjs/operators';
|
|
10
|
-
import { ROLE_ADMIN } from '@valtimo/contract';
|
|
11
10
|
import { CommonModule } from '@angular/common';
|
|
12
11
|
import { TranslateService, TranslateModule } from '@ngx-translate/core';
|
|
13
12
|
import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
|
|
@@ -38,7 +37,10 @@ class FormManagementService {
|
|
|
38
37
|
return this.http.get(`${this.valtimoApiConfig.endpointUri}form-management/${formDefinitionId}`);
|
|
39
38
|
}
|
|
40
39
|
queryFormDefinitions(params) {
|
|
41
|
-
return this.http.get(`${this.valtimoApiConfig.endpointUri}form-management`, {
|
|
40
|
+
return this.http.get(`${this.valtimoApiConfig.endpointUri}form-management`, {
|
|
41
|
+
observe: 'response',
|
|
42
|
+
params: params,
|
|
43
|
+
});
|
|
42
44
|
}
|
|
43
45
|
createFormDefinition(request) {
|
|
44
46
|
return this.http.post(`${this.valtimoApiConfig.endpointUri}form-management`, request);
|
|
@@ -53,7 +55,7 @@ class FormManagementService {
|
|
|
53
55
|
FormManagementService.ɵprov = ɵɵdefineInjectable({ factory: function FormManagementService_Factory() { return new FormManagementService(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: FormManagementService, providedIn: "root" });
|
|
54
56
|
FormManagementService.decorators = [
|
|
55
57
|
{ type: Injectable, args: [{
|
|
56
|
-
providedIn: 'root'
|
|
58
|
+
providedIn: 'root',
|
|
57
59
|
},] }
|
|
58
60
|
];
|
|
59
61
|
FormManagementService.ctorParameters = () => [
|
|
@@ -77,15 +79,13 @@ FormManagementService.ctorParameters = () => [
|
|
|
77
79
|
* limitations under the License.
|
|
78
80
|
*/
|
|
79
81
|
class FormManagementComponent {
|
|
80
|
-
constructor() {
|
|
81
|
-
}
|
|
82
|
-
ngOnInit() {
|
|
83
|
-
}
|
|
82
|
+
constructor() { }
|
|
83
|
+
ngOnInit() { }
|
|
84
84
|
}
|
|
85
85
|
FormManagementComponent.decorators = [
|
|
86
86
|
{ type: Component, args: [{
|
|
87
87
|
selector: 'valtimo-form-management',
|
|
88
|
-
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
|
|
88
|
+
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\"></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\"></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",
|
|
89
89
|
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 */"]
|
|
90
90
|
},] }
|
|
91
91
|
];
|
|
@@ -119,29 +119,34 @@ class FormManagementCreateComponent {
|
|
|
119
119
|
}
|
|
120
120
|
ngOnInit() {
|
|
121
121
|
this.form = this.formBuilder.group({
|
|
122
|
-
name: new FormControl('', Validators.required)
|
|
122
|
+
name: new FormControl('', Validators.required),
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
125
|
reset() {
|
|
126
126
|
this.form.setValue({
|
|
127
|
-
name: ''
|
|
127
|
+
name: '',
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
createFormDefinition() {
|
|
131
131
|
const emptyForm = {
|
|
132
132
|
display: 'form',
|
|
133
|
-
components: []
|
|
133
|
+
components: [],
|
|
134
134
|
};
|
|
135
135
|
const request = {
|
|
136
136
|
name: this.form.value.name,
|
|
137
|
-
formDefinition: JSON.stringify(emptyForm)
|
|
137
|
+
formDefinition: JSON.stringify(emptyForm),
|
|
138
138
|
};
|
|
139
|
-
combineLatest([
|
|
139
|
+
combineLatest([
|
|
140
|
+
this.formManagementService.createFormDefinition(request),
|
|
141
|
+
this.route.queryParams,
|
|
142
|
+
])
|
|
140
143
|
.pipe(take(1))
|
|
141
144
|
.subscribe(([formDefinition, params]) => {
|
|
142
145
|
this.alertService.success('Created new Form');
|
|
143
146
|
if ((params === null || params === void 0 ? void 0 : params.upload) === 'true') {
|
|
144
|
-
this.router.navigate(['/form-management/edit', formDefinition.id], {
|
|
147
|
+
this.router.navigate(['/form-management/edit', formDefinition.id], {
|
|
148
|
+
queryParams: { upload: 'true' },
|
|
149
|
+
});
|
|
145
150
|
}
|
|
146
151
|
else {
|
|
147
152
|
this.router.navigate(['/form-management/edit', formDefinition.id]);
|
|
@@ -154,7 +159,7 @@ class FormManagementCreateComponent {
|
|
|
154
159
|
FormManagementCreateComponent.decorators = [
|
|
155
160
|
{ type: Component, args: [{
|
|
156
161
|
selector: 'valtimo-form-management-create',
|
|
157
|
-
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\">Name</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input
|
|
162
|
+
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\">Name</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\">Name is required</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\">Back</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 Reset\n </button>\n <button class=\"btn btn-space btn-primary\" type=\"submit\" [disabled]=\"form.invalid\">\n Submit\n </button>\n </div>\n </div>\n </form>\n </div>\n </valtimo-widget>\n </div>\n </div>\n</div>\n",
|
|
158
163
|
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 */"]
|
|
159
164
|
},] }
|
|
160
165
|
];
|
|
@@ -210,11 +215,13 @@ class FormManagementEditComponent {
|
|
|
210
215
|
});
|
|
211
216
|
}
|
|
212
217
|
modifyFormDefinition() {
|
|
213
|
-
const form = JSON.stringify(this.modifiedFormDefinition != null
|
|
218
|
+
const form = JSON.stringify(this.modifiedFormDefinition != null
|
|
219
|
+
? this.modifiedFormDefinition
|
|
220
|
+
: this.formDefinition.formDefinition);
|
|
214
221
|
const request = {
|
|
215
222
|
id: this.formDefinition.id,
|
|
216
223
|
name: this.formDefinition.name,
|
|
217
|
-
formDefinition: form
|
|
224
|
+
formDefinition: form,
|
|
218
225
|
};
|
|
219
226
|
this.formManagementService.modifyFormDefinition(request).subscribe(() => {
|
|
220
227
|
this.router.navigate(['/form-management']);
|
|
@@ -235,16 +242,17 @@ class FormManagementEditComponent {
|
|
|
235
242
|
{
|
|
236
243
|
label: 'Cancel',
|
|
237
244
|
class: 'btn btn-default',
|
|
238
|
-
value: false
|
|
245
|
+
value: false,
|
|
239
246
|
},
|
|
240
247
|
{
|
|
241
248
|
label: 'Delete',
|
|
242
249
|
class: 'btn btn-primary',
|
|
243
|
-
value: true
|
|
244
|
-
}
|
|
250
|
+
value: true,
|
|
251
|
+
},
|
|
245
252
|
];
|
|
246
253
|
this.alertService.notification(mssg, confirmations);
|
|
247
|
-
this.alertSub = this.alertService
|
|
254
|
+
this.alertSub = this.alertService
|
|
255
|
+
.getAlertConfirmChangeEmitter()
|
|
248
256
|
.pipe(first())
|
|
249
257
|
.subscribe(alert => {
|
|
250
258
|
if (alert.confirm === true) {
|
|
@@ -284,8 +292,7 @@ class FormManagementEditComponent {
|
|
|
284
292
|
this.reloading$.next(false);
|
|
285
293
|
}
|
|
286
294
|
checkToOpenUploadModal() {
|
|
287
|
-
this.route.queryParams.pipe(take(1))
|
|
288
|
-
.subscribe((params) => {
|
|
295
|
+
this.route.queryParams.pipe(take(1)).subscribe(params => {
|
|
289
296
|
if ((params === null || params === void 0 ? void 0 : params.upload) === 'true') {
|
|
290
297
|
this.showModal();
|
|
291
298
|
}
|
|
@@ -295,7 +302,7 @@ class FormManagementEditComponent {
|
|
|
295
302
|
FormManagementEditComponent.decorators = [
|
|
296
303
|
{ type: Component, args: [{
|
|
297
304
|
selector: 'valtimo-form-management-edit',
|
|
298
|
-
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
|
|
305
|
+
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=\"fa fa-save\"></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\"></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=\"fa fa-trash\"></i> Delete\n </button>\n <button\n class=\"btn btn-success btn-space\"\n (click)=\"modifyFormDefinition()\"\n [disabled]=\"formDefinition.readOnly\"\n >\n <i class=\"fa fa-upload\"></i> Deploy\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\">Read-only</span>\n </div>\n </h3>\n </div>\n <ng-container *ngIf=\"!(reloading$ | async)\">\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",
|
|
299
306
|
encapsulation: ViewEncapsulation.None,
|
|
300
307
|
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 */.btn.formcomponent.gu-mirror,.formbuilder .btn.formcomponent.drag-copy{background-color:silver;border-color:silver;color:#fff;font-weight:400}.btn.formcomponent.gu-mirror:active,.btn.formcomponent.gu-mirror:hover,.formbuilder .btn.formcomponent.drag-copy:active,.formbuilder .btn.formcomponent.drag-copy:hover{box-shadow:none}.btn.formcomponent.gu-mirror:active,.formbuilder .btn.formcomponent.drag-copy:active{background-color:silver;border-color:silver}.formbuilder-header{border:1px solid #dee2e6;border-bottom:0;font-size:18px;height:80px;padding-left:18px;padding-right:18px}.formbuilder-header .formbuilder-title{margin-bottom:7px;margin-top:21px}.formbuilder-header .formbuilder-subtitle{margin-bottom:12px;margin-top:0}.formbuilder{background:#fff;border:1px solid #dee2e6;margin-left:0!important;margin-right:0!important;padding:1rem}.formbuilder .form-builder-panel .builder-group-button[aria-expanded=\"\"],.formbuilder .form-builder-panel .builder-group-button[aria-expanded=false]{color:#a9a9a9}.formbuilder .form-builder-panel .builder-group-button[aria-expanded=true]{color:#000}.formbuilder .drag-and-drop-alert{display:none}.formbuilder .formarea{background-color:#fff;border:1px solid silver;padding:10px}.increase-size{font-size:1rem}"]
|
|
301
308
|
},] }
|
|
@@ -328,32 +335,28 @@ const routes = [
|
|
|
328
335
|
path: 'form-management',
|
|
329
336
|
component: FormManagementComponent,
|
|
330
337
|
canActivate: [AuthGuardService],
|
|
331
|
-
data: ɵ0
|
|
338
|
+
data: ɵ0,
|
|
332
339
|
},
|
|
333
340
|
{
|
|
334
341
|
path: 'form-management/create',
|
|
335
342
|
component: FormManagementCreateComponent,
|
|
336
343
|
canActivate: [AuthGuardService],
|
|
337
|
-
data: ɵ1
|
|
344
|
+
data: ɵ1,
|
|
338
345
|
},
|
|
339
346
|
{
|
|
340
347
|
path: 'form-management/edit/:id',
|
|
341
348
|
component: FormManagementEditComponent,
|
|
342
349
|
canActivate: [AuthGuardService],
|
|
343
|
-
data: ɵ2
|
|
344
|
-
}
|
|
350
|
+
data: ɵ2,
|
|
351
|
+
},
|
|
345
352
|
];
|
|
346
353
|
class FormManagementRoutingModule {
|
|
347
354
|
}
|
|
348
355
|
FormManagementRoutingModule.decorators = [
|
|
349
356
|
{ type: NgModule, args: [{
|
|
350
|
-
imports: [
|
|
351
|
-
|
|
352
|
-
],
|
|
353
|
-
exports: [
|
|
354
|
-
RouterModule
|
|
355
|
-
],
|
|
356
|
-
declarations: []
|
|
357
|
+
imports: [RouterModule.forChild(routes)],
|
|
358
|
+
exports: [RouterModule],
|
|
359
|
+
declarations: [],
|
|
357
360
|
},] }
|
|
358
361
|
];
|
|
359
362
|
|
|
@@ -379,13 +382,13 @@ class FormManagementListComponent {
|
|
|
379
382
|
this.formDefinitions = [];
|
|
380
383
|
this.formDefinitionFields = [
|
|
381
384
|
{ key: 'name', label: 'Name' },
|
|
382
|
-
{ key: 'readOnly', label: 'Read-only' }
|
|
385
|
+
{ key: 'readOnly', label: 'Read-only' },
|
|
383
386
|
];
|
|
384
387
|
this.pagination = {
|
|
385
388
|
collectionSize: 0,
|
|
386
389
|
page: 1,
|
|
387
390
|
size: 10,
|
|
388
|
-
maxPaginationItemSize: 5
|
|
391
|
+
maxPaginationItemSize: 5,
|
|
389
392
|
};
|
|
390
393
|
this.pageParam = 0;
|
|
391
394
|
}
|
|
@@ -393,8 +396,7 @@ class FormManagementListComponent {
|
|
|
393
396
|
this.pageParam = page - 1;
|
|
394
397
|
this.loadFormDefinitions();
|
|
395
398
|
}
|
|
396
|
-
ngOnInit() {
|
|
397
|
-
}
|
|
399
|
+
ngOnInit() { }
|
|
398
400
|
paginationSet() {
|
|
399
401
|
this.loadFormDefinitions();
|
|
400
402
|
}
|
|
@@ -403,7 +405,7 @@ class FormManagementListComponent {
|
|
|
403
405
|
if (searchTerm) {
|
|
404
406
|
params['searchTerm'] = searchTerm;
|
|
405
407
|
}
|
|
406
|
-
this.formManagementService.queryFormDefinitions(params).subscribe(
|
|
408
|
+
this.formManagementService.queryFormDefinitions(params).subscribe(results => {
|
|
407
409
|
this.pagination.collectionSize = results.body.totalElements;
|
|
408
410
|
this.formDefinitions = results.body.content;
|
|
409
411
|
});
|
|
@@ -418,7 +420,7 @@ class FormManagementListComponent {
|
|
|
418
420
|
FormManagementListComponent.decorators = [
|
|
419
421
|
{ type: Component, args: [{
|
|
420
422
|
selector: 'valtimo-form-management-list',
|
|
421
|
-
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
|
|
423
|
+
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",
|
|
422
424
|
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 */"]
|
|
423
425
|
},] }
|
|
424
426
|
];
|
|
@@ -468,9 +470,7 @@ class FormManagementUploadComponent {
|
|
|
468
470
|
}
|
|
469
471
|
uploadDefinition() {
|
|
470
472
|
this.disable();
|
|
471
|
-
this.jsonString
|
|
472
|
-
.pipe(take(1))
|
|
473
|
-
.subscribe((definition) => {
|
|
473
|
+
this.jsonString$.pipe(take(1)).subscribe(definition => {
|
|
474
474
|
this.closeErrorSubscription();
|
|
475
475
|
this.clearError();
|
|
476
476
|
this.enable();
|
|
@@ -557,7 +557,7 @@ class FormManagementUploadComponent {
|
|
|
557
557
|
FormManagementUploadComponent.decorators = [
|
|
558
558
|
{ type: Component, args: [{
|
|
559
559
|
selector: 'valtimo-form-management-upload',
|
|
560
|
-
template: "<valtimo-modal
|
|
560
|
+
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",
|
|
561
561
|
styles: [""]
|
|
562
562
|
},] }
|
|
563
563
|
];
|
|
@@ -595,7 +595,7 @@ FormManagementModule.decorators = [
|
|
|
595
595
|
FormManagementCreateComponent,
|
|
596
596
|
FormManagementListComponent,
|
|
597
597
|
FormManagementEditComponent,
|
|
598
|
-
FormManagementUploadComponent
|
|
598
|
+
FormManagementUploadComponent,
|
|
599
599
|
],
|
|
600
600
|
imports: [
|
|
601
601
|
FormManagementRoutingModule,
|
|
@@ -608,12 +608,55 @@ FormManagementModule.decorators = [
|
|
|
608
608
|
TranslateModule,
|
|
609
609
|
NgbTooltipModule,
|
|
610
610
|
DropzoneModule,
|
|
611
|
-
ModalModule
|
|
611
|
+
ModalModule,
|
|
612
612
|
],
|
|
613
|
-
exports: [FormManagementComponent]
|
|
613
|
+
exports: [FormManagementComponent],
|
|
614
614
|
},] }
|
|
615
615
|
];
|
|
616
616
|
|
|
617
|
+
/*
|
|
618
|
+
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
619
|
+
*
|
|
620
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
621
|
+
* you may not use this file except in compliance with the License.
|
|
622
|
+
* You may obtain a copy of the License at
|
|
623
|
+
*
|
|
624
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
625
|
+
*
|
|
626
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
627
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
628
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
629
|
+
* See the License for the specific language governing permissions and
|
|
630
|
+
* limitations under the License.
|
|
631
|
+
*/
|
|
632
|
+
function compareFormDefinitions(fd1, fd2) {
|
|
633
|
+
if (fd1 === null && fd2 === null) {
|
|
634
|
+
return true;
|
|
635
|
+
}
|
|
636
|
+
if (fd1 === null || fd2 === null) {
|
|
637
|
+
return false;
|
|
638
|
+
}
|
|
639
|
+
return fd1.id === fd2.id;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
/*
|
|
643
|
+
*
|
|
644
|
+
* * Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
645
|
+
* *
|
|
646
|
+
* * Licensed under EUPL, Version 1.2 (the "License");
|
|
647
|
+
* * you may not use this file except in compliance with the License.
|
|
648
|
+
* * You may obtain a copy of the License at
|
|
649
|
+
* *
|
|
650
|
+
* * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
651
|
+
* *
|
|
652
|
+
* * Unless required by applicable law or agreed to in writing, software
|
|
653
|
+
* * distributed under the License is distributed on an "AS IS" basis,
|
|
654
|
+
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
655
|
+
* * See the License for the specific language governing permissions and
|
|
656
|
+
* * limitations under the License.
|
|
657
|
+
*
|
|
658
|
+
*/
|
|
659
|
+
|
|
617
660
|
/*
|
|
618
661
|
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
619
662
|
*
|
|
@@ -634,5 +677,5 @@ FormManagementModule.decorators = [
|
|
|
634
677
|
* Generated bundle index. Do not edit.
|
|
635
678
|
*/
|
|
636
679
|
|
|
637
|
-
export { FormManagementComponent, FormManagementModule, FormManagementService, FormManagementCreateComponent as ɵa, FormManagementListComponent as ɵb, FormManagementEditComponent as ɵc, FormManagementUploadComponent as ɵd, FormManagementRoutingModule as ɵe };
|
|
680
|
+
export { FormManagementComponent, FormManagementModule, FormManagementService, compareFormDefinitions, FormManagementCreateComponent as ɵa, FormManagementListComponent as ɵb, FormManagementEditComponent as ɵc, FormManagementUploadComponent as ɵd, FormManagementRoutingModule as ɵe };
|
|
638
681
|
//# sourceMappingURL=valtimo-form-management.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"valtimo-form-management.js","sources":["../../../../projects/valtimo/form-management/src/lib/form-management.service.ts","../../../../projects/valtimo/form-management/src/lib/form-management.component.ts","../../../../projects/valtimo/form-management/src/lib/form-management-create/form-management-create.component.ts","../../../../projects/valtimo/form-management/src/lib/form-management-edit/form-management-edit.component.ts","../../../../projects/valtimo/form-management/src/lib/form-management-routing.module.ts","../../../../projects/valtimo/form-management/src/lib/form-management-list/form-management-list.component.ts","../../../../projects/valtimo/form-management/src/lib/form-management-upload/form-management-upload.component.ts","../../../../projects/valtimo/form-management/src/lib/form-management.module.ts","../../../../projects/valtimo/form-management/src/public-api.ts","../../../../projects/valtimo/form-management/src/valtimo-form-management.ts"],"sourcesContent":["/*\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\nimport {Injectable} from '@angular/core';\nimport {HttpClient} from '@angular/common/http';\nimport {CreateFormDefinitionRequest, FormDefinition, ModifyFormDefinitionRequest} from '@valtimo/contract';\nimport {Observable} from 'rxjs';\nimport {ConfigService} from '@valtimo/config';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class FormManagementService {\n\n private valtimoApiConfig: any;\n\n constructor(\n private http: HttpClient,\n private configService: ConfigService\n ) {\n this.valtimoApiConfig = configService.config.valtimoApi;\n }\n\n getFormDefinition(formDefinitionId: string): Observable<FormDefinition> {\n return this.http.get<FormDefinition>(`${this.valtimoApiConfig.endpointUri}form-management/${formDefinitionId}`);\n }\n\n queryFormDefinitions(params?: any): Observable<any> {\n return this.http.get(`${this.valtimoApiConfig.endpointUri}form-management`, {observe: 'response', params: params});\n }\n\n createFormDefinition(request: CreateFormDefinitionRequest): Observable<FormDefinition> {\n return this.http.post<FormDefinition>(`${this.valtimoApiConfig.endpointUri}form-management`, request);\n }\n\n modifyFormDefinition(request: ModifyFormDefinitionRequest): Observable<FormDefinition> {\n return this.http.put<FormDefinition>(`${this.valtimoApiConfig.endpointUri}form-management`, request);\n }\n\n deleteFormDefinition(formDefinitionId: string): Observable<void> {\n return this.http.delete<void>(`${this.valtimoApiConfig.endpointUri}form-management/${formDefinitionId}`);\n }\n\n}\n","/*\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\nimport {Component, OnInit} from '@angular/core';\n\n@Component({\n selector: 'valtimo-form-management',\n templateUrl: './form-management.component.html',\n styleUrls: ['./form-management.component.scss']\n})\nexport class FormManagementComponent implements OnInit {\n\n constructor() {\n }\n\n ngOnInit() {\n }\n}\n","/*\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\nimport {Component, OnInit} from '@angular/core';\nimport {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';\nimport {ActivatedRoute, Router} from '@angular/router';\nimport {AlertService} from '@valtimo/components';\nimport {FormManagementService} from '../form-management.service';\nimport {CreateFormDefinitionRequest} from '@valtimo/contract';\nimport {combineLatest} from 'rxjs';\nimport {take} from 'rxjs/operators';\n\n@Component({\n selector: 'valtimo-form-management-create',\n templateUrl: './form-management-create.component.html',\n styleUrls: ['./form-management-create.component.scss']\n})\nexport class FormManagementCreateComponent implements OnInit {\n\n public form: FormGroup;\n\n constructor(\n private formManagementService: FormManagementService,\n private formBuilder: FormBuilder,\n private router: Router,\n private alertService: AlertService,\n private route: ActivatedRoute\n ) {\n }\n\n get formControls() {\n return this.form.controls;\n }\n\n ngOnInit() {\n this.form = this.formBuilder.group({\n name: new FormControl('', Validators.required)\n });\n }\n\n reset() {\n this.form.setValue({\n name: ''\n });\n }\n\n createFormDefinition() {\n const emptyForm = {\n display: 'form',\n components: []\n };\n const request: CreateFormDefinitionRequest = {\n name: this.form.value.name,\n formDefinition: JSON.stringify(emptyForm)\n };\n combineLatest([this.formManagementService.createFormDefinition(request), this.route.queryParams])\n .pipe(take(1))\n .subscribe(([formDefinition, params]) => {\n this.alertService.success('Created new Form');\n\n if (params?.upload === 'true') {\n this.router.navigate(['/form-management/edit', formDefinition.id], {queryParams: {upload: 'true'}});\n } else {\n this.router.navigate(['/form-management/edit', formDefinition.id]);\n }\n }, err => {\n this.alertService.error('Error creating new Form');\n });\n }\n\n}\n","/*\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\nimport {Component, OnDestroy, OnInit, ViewEncapsulation} from '@angular/core';\nimport {FormManagementService} from '../form-management.service';\nimport {AlertService} from '@valtimo/components';\nimport {FormDefinition, ModifyFormDefinitionRequest} from '@valtimo/contract';\nimport {ActivatedRoute, Router} from '@angular/router';\nimport {first, take} from 'rxjs/operators';\nimport {BehaviorSubject, Subscription} from 'rxjs';\nimport {FormioForm} from 'angular-formio';\n\n@Component({\n selector: 'valtimo-form-management-edit',\n templateUrl: './form-management-edit.component.html',\n styleUrls: ['./form-management-edit.component.scss'],\n encapsulation: ViewEncapsulation.None\n})\nexport class FormManagementEditComponent implements OnInit, OnDestroy {\n\n readonly showModal$ = new BehaviorSubject<boolean>(false);\n readonly reloading$ = new BehaviorSubject<boolean>(false);\n public modifiedFormDefinition: FormioForm = null;\n public formDefinition: FormDefinition | null = null;\n private alertSub: Subscription = Subscription.EMPTY;\n private formDefinitionId: string | null = null;\n\n constructor(\n private formManagementService: FormManagementService,\n private alertService: AlertService,\n private route: ActivatedRoute,\n private router: Router\n ) {\n }\n\n ngOnInit() {\n this.loadFormDefinition();\n this.checkToOpenUploadModal();\n }\n\n ngOnDestroy() {\n this.alertSub.unsubscribe();\n }\n\n loadFormDefinition() {\n this.formDefinitionId = this.route.snapshot.paramMap.get('id');\n this.formManagementService.getFormDefinition(this.formDefinitionId).subscribe(formDefinition => {\n this.formDefinition = formDefinition;\n }, () => {\n this.alertService.error('Error retrieving Form Definition');\n });\n }\n\n modifyFormDefinition() {\n const form = JSON.stringify(\n this.modifiedFormDefinition != null ? this.modifiedFormDefinition : this.formDefinition.formDefinition\n );\n const request: ModifyFormDefinitionRequest = {\n id: this.formDefinition.id,\n name: this.formDefinition.name,\n formDefinition: form\n };\n this.formManagementService.modifyFormDefinition(request).subscribe(() => {\n this.router.navigate(['/form-management']);\n this.alertService.success('Form deployed');\n }, err => {\n this.alertService.error('Error deploying Form');\n });\n }\n\n public formBuilderChanged(event) {\n this.modifiedFormDefinition = event.form;\n }\n\n public delete() {\n if (!this.alertSub.closed) {\n return;\n }\n const mssg = 'Delete Form?';\n const confirmations = [\n {\n label: 'Cancel',\n class: 'btn btn-default',\n value: false\n },\n {\n label: 'Delete',\n class: 'btn btn-primary',\n value: true\n }\n ];\n this.alertService.notification(mssg, confirmations);\n this.alertSub = this.alertService.getAlertConfirmChangeEmitter()\n .pipe(first())\n .subscribe(alert => {\n if (alert.confirm === true) {\n this.deleteFormDefinition();\n }\n });\n }\n\n deleteFormDefinition() {\n this.formManagementService.deleteFormDefinition(this.formDefinition.id).subscribe(() => {\n this.router.navigate(['/form-management']);\n this.alertService.success('Form deleted');\n }, err => {\n this.alertService.error('Error deleting Form');\n });\n }\n\n downloadFormDefinition() {\n const file = new Blob([JSON.stringify(this.formDefinition)], {type: 'text/json'});\n const link = document.createElement('a');\n link.download = `form_${this.formDefinition.name}.json`;\n link.href = window.URL.createObjectURL(file);\n link.click();\n window.URL.revokeObjectURL(link.href);\n link.remove();\n }\n\n showModal() {\n this.showModal$.next(true);\n }\n\n setFormDefinition(formDefinition: any) {\n this.reloading$.next(true);\n\n const definition = JSON.parse(formDefinition);\n const components = definition?.formDefinition?.components;\n const currentDefinition = this.modifiedFormDefinition || this.formDefinition.formDefinition;\n const newDefinition = {...currentDefinition, ...(components && {components})};\n\n this.modifiedFormDefinition = newDefinition;\n this.formDefinition.formDefinition = newDefinition;\n\n this.reloading$.next(false);\n }\n\n private checkToOpenUploadModal(): void {\n this.route.queryParams.pipe(take(1))\n .subscribe((params) => {\n if (params?.upload === 'true') {\n this.showModal();\n }\n });\n }\n}\n","/*\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\nimport {NgModule} from '@angular/core';\nimport {RouterModule, Routes} from '@angular/router';\nimport {FormManagementComponent} from './form-management.component';\nimport {AuthGuardService} from '@valtimo/security';\nimport {FormManagementCreateComponent} from './form-management-create/form-management-create.component';\nimport {FormManagementEditComponent} from './form-management-edit/form-management-edit.component';\nimport {ROLE_ADMIN} from '@valtimo/contract';\n\nconst routes: Routes = [\n {\n path: 'form-management',\n component: FormManagementComponent,\n canActivate: [AuthGuardService],\n data: {title: 'Form management', roles: [ROLE_ADMIN]}\n },\n {\n path: 'form-management/create',\n component: FormManagementCreateComponent,\n canActivate: [AuthGuardService],\n data: {title: 'Create new Form', roles: [ROLE_ADMIN]}\n },\n {\n path: 'form-management/edit/:id',\n component: FormManagementEditComponent,\n canActivate: [AuthGuardService],\n data: {title: 'Form Builder', roles: [ROLE_ADMIN]}\n }\n];\n\n@NgModule({\n imports: [\n RouterModule.forChild(routes)\n ],\n exports: [\n RouterModule\n ],\n declarations: []\n})\nexport class FormManagementRoutingModule {\n}\n","/*\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\nimport {Component, OnInit} from '@angular/core';\nimport {FormDefinition} from '@valtimo/contract';\nimport {FormManagementService} from '../form-management.service';\nimport {Router} from '@angular/router';\n\n@Component({\n selector: 'valtimo-form-management-list',\n templateUrl: './form-management-list.component.html',\n styleUrls: ['./form-management-list.component.scss']\n})\nexport class FormManagementListComponent implements OnInit {\n\n public formDefinitions: FormDefinition[] = [];\n public formDefinitionFields: any[] = [\n {key: 'name', label: 'Name'},\n {key: 'readOnly', label: 'Read-only'}\n ];\n public pagination = {\n collectionSize: 0,\n page: 1,\n size: 10,\n maxPaginationItemSize: 5\n };\n public pageParam = 0;\n\n public paginationClicked(page) {\n this.pageParam = page - 1;\n this.loadFormDefinitions();\n }\n\n constructor(\n private formManagementService: FormManagementService,\n private router: Router\n ) {\n }\n\n ngOnInit() {\n }\n\n paginationSet() {\n this.loadFormDefinitions();\n }\n\n loadFormDefinitions(searchTerm?: string) {\n const params = {page: this.pageParam, size: this.pagination.size};\n if (searchTerm) {\n params['searchTerm'] = searchTerm;\n }\n this.formManagementService.queryFormDefinitions(params).subscribe((results) => {\n this.pagination.collectionSize = results.body.totalElements;\n this.formDefinitions = results.body.content;\n });\n }\n\n editFormDefinition(formDefinition: FormDefinition) {\n this.router.navigate(['/form-management/edit', formDefinition.id]);\n }\n\n searchTermEntered(searchTerm: string) {\n this.loadFormDefinitions(searchTerm);\n }\n\n}\n","/*\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\nimport {AfterViewInit, Component, EventEmitter, Input, OnDestroy, Output, ViewChild} from '@angular/core';\nimport {TranslateService} from '@ngx-translate/core';\nimport {ModalComponent} from '@valtimo/components';\nimport {DocumentService} from '@valtimo/document';\nimport {BehaviorSubject, Observable, Subject, Subscription} from 'rxjs';\nimport {take} from 'rxjs/operators';\n\n@Component({\n selector: 'valtimo-form-management-upload',\n templateUrl: './form-management-upload.component.html',\n styleUrls: ['./form-management-upload.component.scss']\n})\nexport class FormManagementUploadComponent implements AfterViewInit, OnDestroy {\n @ViewChild('uploadFormDefinitionModal') modal: ModalComponent;\n\n @Input() show$: Observable<boolean>;\n @Output() definitionUploaded: EventEmitter<any> = new EventEmitter();\n\n readonly clear$ = new Subject();\n readonly jsonString$ = new BehaviorSubject<string>('');\n readonly error$ = new BehaviorSubject<string>('');\n readonly disabled$ = new BehaviorSubject<boolean>(false);\n\n private showSubscription: Subscription;\n private fileSubscription: Subscription;\n private errorSubscription: Subscription;\n\n private readonly file$ = new BehaviorSubject<File>(undefined);\n\n constructor(\n private readonly documentService: DocumentService,\n private readonly translateService: TranslateService,\n ) {\n }\n\n ngAfterViewInit(): void {\n this.openShowSubscription();\n this.openFileSubscription();\n }\n\n ngOnDestroy(): void {\n this.showSubscription.unsubscribe();\n this.fileSubscription.unsubscribe();\n this.closeErrorSubscription();\n }\n\n setFile(file: File): void {\n this.clearError();\n this.file$.next(file);\n }\n\n uploadDefinition(): void {\n this.disable();\n\n this.jsonString$\n .pipe(\n take(1)\n )\n .subscribe((definition) => {\n this.closeErrorSubscription();\n this.clearError();\n this.enable();\n this.hideModal();\n this.definitionUploaded.emit(definition);\n });\n }\n\n private openErrorSubscription(errorCode: string): void {\n this.closeErrorSubscription();\n this.errorSubscription = this.translateService.stream(errorCode).subscribe(error => {\n this.error$.next(error);\n });\n }\n\n private closeErrorSubscription(): void {\n if (this.errorSubscription) {\n this.errorSubscription.unsubscribe();\n }\n }\n\n private clearError(): void {\n this.error$.next('');\n }\n\n private openFileSubscription(): void {\n this.fileSubscription = this.file$.subscribe(file => {\n if (file) {\n const reader = new FileReader();\n\n reader.onloadend = () => {\n const result = reader.result.toString();\n if (this.stringIsValidJson(result)) {\n this.jsonString$.next(result);\n }\n };\n\n reader.readAsText(file);\n } else {\n this.clearJsonString();\n }\n });\n }\n\n private openShowSubscription(): void {\n this.showSubscription = this.show$.subscribe(show => {\n if (show) {\n this.showModal();\n } else {\n this.hideModal();\n }\n\n this.clearJsonString();\n this.clearError();\n this.clearDropzone();\n });\n }\n\n private clearJsonString(): void {\n this.jsonString$.next('');\n }\n\n private clearDropzone(): void {\n this.clear$.next();\n }\n\n private showModal(): void {\n this.modal.show();\n }\n\n private hideModal(): void {\n this.modal.hide();\n }\n\n private stringIsValidJson(string: string) {\n try {\n // tslint:disable-next-line\n JSON.parse(string)?.formDefinition?.components;\n } catch (e) {\n this.clearDropzone();\n this.openErrorSubscription('dropzone.error.invalidFormDef');\n return false;\n }\n return true;\n }\n\n private disable(): void {\n this.disabled$.next(true);\n }\n\n private enable(): void {\n this.disabled$.next(false);\n }\n}\n","/*\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\nimport {NgModule} from '@angular/core';\nimport {FormManagementComponent} from './form-management.component';\nimport {FormManagementRoutingModule} from './form-management-routing.module';\nimport {DropzoneModule, FormIoModule, ListModule, ModalModule, WidgetModule} from '@valtimo/components';\nimport {CommonModule} from '@angular/common';\nimport {FormsModule, ReactiveFormsModule} from '@angular/forms';\nimport {FormManagementCreateComponent} from './form-management-create/form-management-create.component';\nimport {FormManagementListComponent} from './form-management-list/form-management-list.component';\nimport {FormManagementEditComponent} from './form-management-edit/form-management-edit.component';\nimport {TranslateModule} from '@ngx-translate/core';\nimport {NgbTooltipModule} from '@ng-bootstrap/ng-bootstrap';\nimport {FormManagementUploadComponent} from './form-management-upload/form-management-upload.component';\n\n@NgModule({\n declarations: [\n FormManagementComponent,\n FormManagementCreateComponent,\n FormManagementListComponent,\n FormManagementEditComponent,\n FormManagementUploadComponent\n ],\n imports: [\n FormManagementRoutingModule,\n FormIoModule,\n CommonModule,\n ReactiveFormsModule,\n FormsModule,\n WidgetModule,\n ListModule,\n TranslateModule,\n NgbTooltipModule,\n DropzoneModule,\n ModalModule\n ],\n exports: [FormManagementComponent]\n})\nexport class FormManagementModule {\n\n}\n","/*\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/*\n * Public API Surface of form-management\n */\n\nexport * from './lib/form-management.service';\nexport * from './lib/form-management.component';\nexport * from './lib/form-management.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n\nexport {FormManagementCreateComponent as ɵa} from './lib/form-management-create/form-management-create.component';\nexport {FormManagementEditComponent as ɵc} from './lib/form-management-edit/form-management-edit.component';\nexport {FormManagementListComponent as ɵb} from './lib/form-management-list/form-management-list.component';\nexport {FormManagementRoutingModule as ɵe} from './lib/form-management-routing.module';\nexport {FormManagementUploadComponent as ɵd} from './lib/form-management-upload/form-management-upload.component';"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;MAyBa,qBAAqB;IAIhC,YACU,IAAgB,EAChB,aAA4B;QAD5B,SAAI,GAAJ,IAAI,CAAY;QAChB,kBAAa,GAAb,aAAa,CAAe;QAEpC,IAAI,CAAC,gBAAgB,GAAG,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC;KACzD;IAED,iBAAiB,CAAC,gBAAwB;QACxC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAiB,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,mBAAmB,gBAAgB,EAAE,CAAC,CAAC;KACjH;IAED,oBAAoB,CAAC,MAAY;QAC/B,OA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,CAAC;SAChD;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,IAAI,CAAC,qBAAqB,CAAC,+BAA+B,CAAC,CAAC;YAC5D,OAAO,KAAK,CAAC;SACd;QACD,OAAO,IAAI,CAAC;KACb;IAEO,OAAO;QACb,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAC3B;IAEO,MAAM;QACZ,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAC5B;;;YAhJF,SAAS,SAAC;gBACT,QAAQ,EAAE,gCAAgC;gBAC1C,q6BAAsD;;aAEvD;;;YARO,eAAe;YAFf,gBAAgB;;;oBAYrB,SAAS,SAAC,2BAA2B;oBAErC,KAAK;iCACL,MAAM;;;AChCT;;;;;;;;;;;;;;;MAoDa,oBAAoB;;;YAvBhC,QAAQ,SAAC;gBACR,YAAY,EAAE;oBACZ,uBAAuB;oBACvB,6BAA6B;oBAC7B,2BAA2B;oBAC3B,2BAA2B;oBAC3B,6BAA6B;iBAC9B;gBACD,OAAO,EAAE;oBACP,2BAA2B;oBAC3B,YAAY;oBACZ,YAAY;oBACZ,mBAAmB;oBACnB,WAAW;oBACX,YAAY;oBACZ,UAAU;oBACV,eAAe;oBACf,gBAAgB;oBAChB,cAAc;oBACd,WAAW;iBACZ;gBACD,OAAO,EAAE,CAAC,uBAAuB,CAAC;aACnC;;;ACnDD;;;;;;;;;;;;;;;;ACAA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"valtimo-form-management.js","sources":["../../../../projects/valtimo/form-management/src/lib/form-management.service.ts","../../../../projects/valtimo/form-management/src/lib/form-management.component.ts","../../../../projects/valtimo/form-management/src/lib/form-management-create/form-management-create.component.ts","../../../../projects/valtimo/form-management/src/lib/form-management-edit/form-management-edit.component.ts","../../../../projects/valtimo/form-management/src/lib/form-management-routing.module.ts","../../../../projects/valtimo/form-management/src/lib/form-management-list/form-management-list.component.ts","../../../../projects/valtimo/form-management/src/lib/form-management-upload/form-management-upload.component.ts","../../../../projects/valtimo/form-management/src/lib/form-management.module.ts","../../../../projects/valtimo/form-management/src/lib/models/form-definition.model.ts","../../../../projects/valtimo/form-management/src/lib/models/index.ts","../../../../projects/valtimo/form-management/src/public-api.ts","../../../../projects/valtimo/form-management/src/valtimo-form-management.ts"],"sourcesContent":["/*\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\nimport {Injectable} from '@angular/core';\nimport {HttpClient} from '@angular/common/http';\nimport {CreateFormDefinitionRequest, FormDefinition, ModifyFormDefinitionRequest} from './models';\nimport {Observable} from 'rxjs';\nimport {ConfigService} from '@valtimo/config';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class FormManagementService {\n private valtimoApiConfig: any;\n\n constructor(private http: HttpClient, private configService: ConfigService) {\n this.valtimoApiConfig = configService.config.valtimoApi;\n }\n\n getFormDefinition(formDefinitionId: string): Observable<FormDefinition> {\n return this.http.get<FormDefinition>(\n `${this.valtimoApiConfig.endpointUri}form-management/${formDefinitionId}`\n );\n }\n\n queryFormDefinitions(params?: any): Observable<any> {\n return this.http.get(`${this.valtimoApiConfig.endpointUri}form-management`, {\n observe: 'response',\n params: params,\n });\n }\n\n createFormDefinition(request: CreateFormDefinitionRequest): Observable<FormDefinition> {\n return this.http.post<FormDefinition>(\n `${this.valtimoApiConfig.endpointUri}form-management`,\n request\n );\n }\n\n modifyFormDefinition(request: ModifyFormDefinitionRequest): Observable<FormDefinition> {\n return this.http.put<FormDefinition>(\n `${this.valtimoApiConfig.endpointUri}form-management`,\n request\n );\n }\n\n deleteFormDefinition(formDefinitionId: string): Observable<void> {\n return this.http.delete<void>(\n `${this.valtimoApiConfig.endpointUri}form-management/${formDefinitionId}`\n );\n }\n}\n","/*\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\nimport {Component, OnInit} from '@angular/core';\n\n@Component({\n selector: 'valtimo-form-management',\n templateUrl: './form-management.component.html',\n styleUrls: ['./form-management.component.scss'],\n})\nexport class FormManagementComponent implements OnInit {\n constructor() {}\n\n ngOnInit() {}\n}\n","/*\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\nimport {Component, OnInit} from '@angular/core';\nimport {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';\nimport {ActivatedRoute, Router} from '@angular/router';\nimport {AlertService} from '@valtimo/components';\nimport {FormManagementService} from '../form-management.service';\nimport {CreateFormDefinitionRequest} from '../models';\nimport {combineLatest} from 'rxjs';\nimport {take} from 'rxjs/operators';\n\n@Component({\n selector: 'valtimo-form-management-create',\n templateUrl: './form-management-create.component.html',\n styleUrls: ['./form-management-create.component.scss'],\n})\nexport class FormManagementCreateComponent implements OnInit {\n public form: FormGroup;\n\n constructor(\n private formManagementService: FormManagementService,\n private formBuilder: FormBuilder,\n private router: Router,\n private alertService: AlertService,\n private route: ActivatedRoute\n ) {}\n\n get formControls() {\n return this.form.controls;\n }\n\n ngOnInit() {\n this.form = this.formBuilder.group({\n name: new FormControl('', Validators.required),\n });\n }\n\n reset() {\n this.form.setValue({\n name: '',\n });\n }\n\n createFormDefinition() {\n const emptyForm = {\n display: 'form',\n components: [],\n };\n const request: CreateFormDefinitionRequest = {\n name: this.form.value.name,\n formDefinition: JSON.stringify(emptyForm),\n };\n combineLatest([\n this.formManagementService.createFormDefinition(request),\n this.route.queryParams,\n ])\n .pipe(take(1))\n .subscribe(\n ([formDefinition, params]) => {\n this.alertService.success('Created new Form');\n\n if (params?.upload === 'true') {\n this.router.navigate(['/form-management/edit', formDefinition.id], {\n queryParams: {upload: 'true'},\n });\n } else {\n this.router.navigate(['/form-management/edit', formDefinition.id]);\n }\n },\n err => {\n this.alertService.error('Error creating new Form');\n }\n );\n }\n}\n","/*\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\nimport {Component, OnDestroy, OnInit, ViewEncapsulation} from '@angular/core';\nimport {FormManagementService} from '../form-management.service';\nimport {AlertService} from '@valtimo/components';\nimport {FormDefinition, ModifyFormDefinitionRequest} from '../models';\nimport {ActivatedRoute, Router} from '@angular/router';\nimport {first, take} from 'rxjs/operators';\nimport {BehaviorSubject, Subscription} from 'rxjs';\nimport {FormioForm} from 'angular-formio';\n\n@Component({\n selector: 'valtimo-form-management-edit',\n templateUrl: './form-management-edit.component.html',\n styleUrls: ['./form-management-edit.component.scss'],\n encapsulation: ViewEncapsulation.None,\n})\nexport class FormManagementEditComponent implements OnInit, OnDestroy {\n readonly showModal$ = new BehaviorSubject<boolean>(false);\n readonly reloading$ = new BehaviorSubject<boolean>(false);\n public modifiedFormDefinition: FormioForm = null;\n public formDefinition: FormDefinition | null = null;\n private alertSub: Subscription = Subscription.EMPTY;\n private formDefinitionId: string | null = null;\n\n constructor(\n private formManagementService: FormManagementService,\n private alertService: AlertService,\n private route: ActivatedRoute,\n private router: Router\n ) {}\n\n ngOnInit() {\n this.loadFormDefinition();\n this.checkToOpenUploadModal();\n }\n\n ngOnDestroy() {\n this.alertSub.unsubscribe();\n }\n\n loadFormDefinition() {\n this.formDefinitionId = this.route.snapshot.paramMap.get('id');\n this.formManagementService.getFormDefinition(this.formDefinitionId).subscribe(\n formDefinition => {\n this.formDefinition = formDefinition;\n },\n () => {\n this.alertService.error('Error retrieving Form Definition');\n }\n );\n }\n\n modifyFormDefinition() {\n const form = JSON.stringify(\n this.modifiedFormDefinition != null\n ? this.modifiedFormDefinition\n : this.formDefinition.formDefinition\n );\n const request: ModifyFormDefinitionRequest = {\n id: this.formDefinition.id,\n name: this.formDefinition.name,\n formDefinition: form,\n };\n this.formManagementService.modifyFormDefinition(request).subscribe(\n () => {\n this.router.navigate(['/form-management']);\n this.alertService.success('Form deployed');\n },\n err => {\n this.alertService.error('Error deploying Form');\n }\n );\n }\n\n public formBuilderChanged(event) {\n this.modifiedFormDefinition = event.form;\n }\n\n public delete() {\n if (!this.alertSub.closed) {\n return;\n }\n const mssg = 'Delete Form?';\n const confirmations = [\n {\n label: 'Cancel',\n class: 'btn btn-default',\n value: false,\n },\n {\n label: 'Delete',\n class: 'btn btn-primary',\n value: true,\n },\n ];\n this.alertService.notification(mssg, confirmations);\n this.alertSub = this.alertService\n .getAlertConfirmChangeEmitter()\n .pipe(first())\n .subscribe(alert => {\n if (alert.confirm === true) {\n this.deleteFormDefinition();\n }\n });\n }\n\n deleteFormDefinition() {\n this.formManagementService.deleteFormDefinition(this.formDefinition.id).subscribe(\n () => {\n this.router.navigate(['/form-management']);\n this.alertService.success('Form deleted');\n },\n err => {\n this.alertService.error('Error deleting Form');\n }\n );\n }\n\n downloadFormDefinition() {\n const file = new Blob([JSON.stringify(this.formDefinition)], {type: 'text/json'});\n const link = document.createElement('a');\n link.download = `form_${this.formDefinition.name}.json`;\n link.href = window.URL.createObjectURL(file);\n link.click();\n window.URL.revokeObjectURL(link.href);\n link.remove();\n }\n\n showModal() {\n this.showModal$.next(true);\n }\n\n setFormDefinition(formDefinition: any) {\n this.reloading$.next(true);\n\n const definition = JSON.parse(formDefinition);\n const components = definition?.formDefinition?.components;\n const currentDefinition = this.modifiedFormDefinition || this.formDefinition.formDefinition;\n const newDefinition = {...currentDefinition, ...(components && {components})};\n\n this.modifiedFormDefinition = newDefinition;\n this.formDefinition.formDefinition = newDefinition;\n\n this.reloading$.next(false);\n }\n\n private checkToOpenUploadModal(): void {\n this.route.queryParams.pipe(take(1)).subscribe(params => {\n if (params?.upload === 'true') {\n this.showModal();\n }\n });\n }\n}\n","/*\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\nimport {NgModule} from '@angular/core';\nimport {RouterModule, Routes} from '@angular/router';\nimport {FormManagementComponent} from './form-management.component';\nimport {AuthGuardService} from '@valtimo/security';\nimport {FormManagementCreateComponent} from './form-management-create/form-management-create.component';\nimport {FormManagementEditComponent} from './form-management-edit/form-management-edit.component';\nimport {ROLE_ADMIN} from '@valtimo/config';\n\nconst routes: Routes = [\n {\n path: 'form-management',\n component: FormManagementComponent,\n canActivate: [AuthGuardService],\n data: {title: 'Form management', roles: [ROLE_ADMIN]},\n },\n {\n path: 'form-management/create',\n component: FormManagementCreateComponent,\n canActivate: [AuthGuardService],\n data: {title: 'Create new Form', roles: [ROLE_ADMIN]},\n },\n {\n path: 'form-management/edit/:id',\n component: FormManagementEditComponent,\n canActivate: [AuthGuardService],\n data: {title: 'Form Builder', roles: [ROLE_ADMIN]},\n },\n];\n\n@NgModule({\n imports: [RouterModule.forChild(routes)],\n exports: [RouterModule],\n declarations: [],\n})\nexport class FormManagementRoutingModule {}\n","/*\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\nimport {Component, OnInit} from '@angular/core';\nimport {FormDefinition} from '../models';\nimport {FormManagementService} from '../form-management.service';\nimport {Router} from '@angular/router';\n\n@Component({\n selector: 'valtimo-form-management-list',\n templateUrl: './form-management-list.component.html',\n styleUrls: ['./form-management-list.component.scss'],\n})\nexport class FormManagementListComponent implements OnInit {\n public formDefinitions: FormDefinition[] = [];\n public formDefinitionFields: any[] = [\n {key: 'name', label: 'Name'},\n {key: 'readOnly', label: 'Read-only'},\n ];\n public pagination = {\n collectionSize: 0,\n page: 1,\n size: 10,\n maxPaginationItemSize: 5,\n };\n public pageParam = 0;\n\n public paginationClicked(page) {\n this.pageParam = page - 1;\n this.loadFormDefinitions();\n }\n\n constructor(private formManagementService: FormManagementService, private router: Router) {}\n\n ngOnInit() {}\n\n paginationSet() {\n this.loadFormDefinitions();\n }\n\n loadFormDefinitions(searchTerm?: string) {\n const params = {page: this.pageParam, size: this.pagination.size};\n if (searchTerm) {\n params['searchTerm'] = searchTerm;\n }\n this.formManagementService.queryFormDefinitions(params).subscribe(results => {\n this.pagination.collectionSize = results.body.totalElements;\n this.formDefinitions = results.body.content;\n });\n }\n\n editFormDefinition(formDefinition: FormDefinition) {\n this.router.navigate(['/form-management/edit', formDefinition.id]);\n }\n\n searchTermEntered(searchTerm: string) {\n this.loadFormDefinitions(searchTerm);\n }\n}\n","/*\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\nimport {\n AfterViewInit,\n Component,\n EventEmitter,\n Input,\n OnDestroy,\n Output,\n ViewChild,\n} from '@angular/core';\nimport {TranslateService} from '@ngx-translate/core';\nimport {ModalComponent} from '@valtimo/components';\nimport {DocumentService} from '@valtimo/document';\nimport {BehaviorSubject, Observable, Subject, Subscription} from 'rxjs';\nimport {take} from 'rxjs/operators';\n\n@Component({\n selector: 'valtimo-form-management-upload',\n templateUrl: './form-management-upload.component.html',\n styleUrls: ['./form-management-upload.component.scss'],\n})\nexport class FormManagementUploadComponent implements AfterViewInit, OnDestroy {\n @ViewChild('uploadFormDefinitionModal') modal: ModalComponent;\n\n @Input() show$: Observable<boolean>;\n @Output() definitionUploaded: EventEmitter<any> = new EventEmitter();\n\n readonly clear$ = new Subject();\n readonly jsonString$ = new BehaviorSubject<string>('');\n readonly error$ = new BehaviorSubject<string>('');\n readonly disabled$ = new BehaviorSubject<boolean>(false);\n\n private showSubscription: Subscription;\n private fileSubscription: Subscription;\n private errorSubscription: Subscription;\n\n private readonly file$ = new BehaviorSubject<File>(undefined);\n\n constructor(\n private readonly documentService: DocumentService,\n private readonly translateService: TranslateService\n ) {}\n\n ngAfterViewInit(): void {\n this.openShowSubscription();\n this.openFileSubscription();\n }\n\n ngOnDestroy(): void {\n this.showSubscription.unsubscribe();\n this.fileSubscription.unsubscribe();\n this.closeErrorSubscription();\n }\n\n setFile(file: File): void {\n this.clearError();\n this.file$.next(file);\n }\n\n uploadDefinition(): void {\n this.disable();\n\n this.jsonString$.pipe(take(1)).subscribe(definition => {\n this.closeErrorSubscription();\n this.clearError();\n this.enable();\n this.hideModal();\n this.definitionUploaded.emit(definition);\n });\n }\n\n private openErrorSubscription(errorCode: string): void {\n this.closeErrorSubscription();\n this.errorSubscription = this.translateService.stream(errorCode).subscribe(error => {\n this.error$.next(error);\n });\n }\n\n private closeErrorSubscription(): void {\n if (this.errorSubscription) {\n this.errorSubscription.unsubscribe();\n }\n }\n\n private clearError(): void {\n this.error$.next('');\n }\n\n private openFileSubscription(): void {\n this.fileSubscription = this.file$.subscribe(file => {\n if (file) {\n const reader = new FileReader();\n\n reader.onloadend = () => {\n const result = reader.result.toString();\n if (this.stringIsValidJson(result)) {\n this.jsonString$.next(result);\n }\n };\n\n reader.readAsText(file);\n } else {\n this.clearJsonString();\n }\n });\n }\n\n private openShowSubscription(): void {\n this.showSubscription = this.show$.subscribe(show => {\n if (show) {\n this.showModal();\n } else {\n this.hideModal();\n }\n\n this.clearJsonString();\n this.clearError();\n this.clearDropzone();\n });\n }\n\n private clearJsonString(): void {\n this.jsonString$.next('');\n }\n\n private clearDropzone(): void {\n this.clear$.next();\n }\n\n private showModal(): void {\n this.modal.show();\n }\n\n private hideModal(): void {\n this.modal.hide();\n }\n\n private stringIsValidJson(string: string) {\n try {\n // tslint:disable-next-line\n JSON.parse(string)?.formDefinition?.components;\n } catch (e) {\n this.clearDropzone();\n this.openErrorSubscription('dropzone.error.invalidFormDef');\n return false;\n }\n return true;\n }\n\n private disable(): void {\n this.disabled$.next(true);\n }\n\n private enable(): void {\n this.disabled$.next(false);\n }\n}\n","/*\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\nimport {NgModule} from '@angular/core';\nimport {FormManagementComponent} from './form-management.component';\nimport {FormManagementRoutingModule} from './form-management-routing.module';\nimport {\n DropzoneModule,\n FormIoModule,\n ListModule,\n ModalModule,\n WidgetModule,\n} from '@valtimo/components';\nimport {CommonModule} from '@angular/common';\nimport {FormsModule, ReactiveFormsModule} from '@angular/forms';\nimport {FormManagementCreateComponent} from './form-management-create/form-management-create.component';\nimport {FormManagementListComponent} from './form-management-list/form-management-list.component';\nimport {FormManagementEditComponent} from './form-management-edit/form-management-edit.component';\nimport {TranslateModule} from '@ngx-translate/core';\nimport {NgbTooltipModule} from '@ng-bootstrap/ng-bootstrap';\nimport {FormManagementUploadComponent} from './form-management-upload/form-management-upload.component';\n\n@NgModule({\n declarations: [\n FormManagementComponent,\n FormManagementCreateComponent,\n FormManagementListComponent,\n FormManagementEditComponent,\n FormManagementUploadComponent,\n ],\n imports: [\n FormManagementRoutingModule,\n FormIoModule,\n CommonModule,\n ReactiveFormsModule,\n FormsModule,\n WidgetModule,\n ListModule,\n TranslateModule,\n NgbTooltipModule,\n DropzoneModule,\n ModalModule,\n ],\n exports: [FormManagementComponent],\n})\nexport class FormManagementModule {}\n","/*\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\nimport {FormioForm} from 'angular-formio';\n\nexport function compareFormDefinitions(fd1: FormDefinition, fd2: FormDefinition) {\n if (fd1 === null && fd2 === null) {\n return true;\n }\n if (fd1 === null || fd2 === null) {\n return false;\n }\n return fd1.id === fd2.id;\n}\n\nexport interface FormDefinition {\n id: string;\n name: string;\n formDefinition: FormioForm;\n readOnly: boolean;\n}\n\nexport interface CreateFormDefinitionRequest {\n name: string;\n formDefinition: string;\n}\n\nexport interface ModifyFormDefinitionRequest {\n id: string;\n name: string;\n formDefinition: string;\n}\n","/*\n *\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\nexport * from './form-definition.model';\n","/*\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/*\n * Public API Surface of form-management\n */\n\nexport * from './lib/form-management.service';\nexport * from './lib/form-management.component';\nexport * from './lib/form-management.module';\nexport * from './lib/models';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n\nexport {FormManagementCreateComponent as ɵa} from './lib/form-management-create/form-management-create.component';\nexport {FormManagementEditComponent as ɵc} from './lib/form-management-edit/form-management-edit.component';\nexport {FormManagementListComponent as ɵb} from './lib/form-management-list/form-management-list.component';\nexport {FormManagementRoutingModule as ɵe} from './lib/form-management-routing.module';\nexport {FormManagementUploadComponent as ɵd} from './lib/form-management-upload/form-management-upload.component';"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;MAyBa,qBAAqB;IAGhC,YAAoB,IAAgB,EAAU,aAA4B;QAAtD,SAAI,GAAJ,IAAI,CAAY;QAAU,kBAAa,GAAb,aAAa,CAAe;QACxE,IAAI,CAAC,gBAAgB,GAAG,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC;KACzD;IAED,iBAAiB,CAAC,gBAAwB;QACxC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAClB,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,mBAAmB,gBAAgB,EAAE,CAC1E,CAAC;KACH;IAED,oBAAoB,CAAC,MAAY;QAC/B,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,iBAAiB,EAAE;YAC1E,OAAO,EAAE,UAAU;YACnB,MAAM,EAAE,MAAM;SACf,CAAC,CAAC;KACJ;IAED,oBAAoB,CAAC,OAAoC;QACvD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CACnB,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,iBAAiB,EACrD,OAAO,CACR,CAAC;KACH;IAED,oBAAoB,CAAC,OAAoC;QACvD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAClB,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,iBAAiB,EACrD,OAAO,CACR,CAAC;KACH;IAED,oBAAoB,CAAC,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;;ACxCT;;;;;;;;;;;;;;;MA0Da,oBAAoB;;;YAvBhC,QAAQ,SAAC;gBACR,YAAY,EAAE;oBACZ,uBAAuB;oBACvB,6BAA6B;oBAC7B,2BAA2B;oBAC3B,2BAA2B;oBAC3B,6BAA6B;iBAC9B;gBACD,OAAO,EAAE;oBACP,2BAA2B;oBAC3B,YAAY;oBACZ,YAAY;oBACZ,mBAAmB;oBACnB,WAAW;oBACX,YAAY;oBACZ,UAAU;oBACV,eAAe;oBACf,gBAAgB;oBAChB,cAAc;oBACd,WAAW;iBACZ;gBACD,OAAO,EAAE,CAAC,uBAAuB,CAAC;aACnC;;;ACzDD;;;;;;;;;;;;;;;SAkBgB,sBAAsB,CAAC,GAAmB,EAAE,GAAmB;IAC7E,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI,EAAE;QAChC,OAAO,IAAI,CAAC;KACb;IACD,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI,EAAE;QAChC,OAAO,KAAK,CAAC;KACd;IACD,OAAO,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC;AAC3B;;AC1BA;;;;;;;;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;ACAA;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OnDestroy, OnInit } from '@angular/core';
|
|
2
2
|
import { FormManagementService } from '../form-management.service';
|
|
3
3
|
import { AlertService } from '@valtimo/components';
|
|
4
|
-
import { FormDefinition } from '
|
|
4
|
+
import { FormDefinition } from '../models';
|
|
5
5
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
6
6
|
import { BehaviorSubject } from 'rxjs';
|
|
7
7
|
import { FormioForm } from 'angular-formio';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OnInit } from '@angular/core';
|
|
2
|
-
import { FormDefinition } from '
|
|
2
|
+
import { FormDefinition } from '../models';
|
|
3
3
|
import { FormManagementService } from '../form-management.service';
|
|
4
4
|
import { Router } from '@angular/router';
|
|
5
5
|
export declare class FormManagementListComponent implements OnInit {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HttpClient } from '@angular/common/http';
|
|
2
|
-
import { CreateFormDefinitionRequest, FormDefinition, ModifyFormDefinitionRequest } from '
|
|
2
|
+
import { CreateFormDefinitionRequest, FormDefinition, ModifyFormDefinitionRequest } from './models';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
import { ConfigService } from '@valtimo/config';
|
|
5
5
|
export declare class FormManagementService {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FormioForm } from 'angular-formio';
|
|
2
|
+
export declare function compareFormDefinitions(fd1: FormDefinition, fd2: FormDefinition): boolean;
|
|
3
|
+
export interface FormDefinition {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
formDefinition: FormioForm;
|
|
7
|
+
readOnly: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface CreateFormDefinitionRequest {
|
|
10
|
+
name: string;
|
|
11
|
+
formDefinition: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ModifyFormDefinitionRequest {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
formDefinition: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './form-definition.model';
|