@valtimo/form 4.15.2-next-main.15 → 4.15.3-next-main.16
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/bundles/valtimo-form.umd.js +197 -198
- package/bundles/valtimo-form.umd.js.map +1 -1
- package/bundles/valtimo-form.umd.min.js.map +1 -1
- package/esm2015/lib/form-routing.module.js +29 -32
- package/esm2015/lib/form.module.js +28 -28
- package/esm2015/lib/form.service.js +45 -45
- package/esm2015/lib/services/form-mapping/form-mapping.service.js +40 -38
- package/esm2015/lib/services/form-translation/form-translation.service.js +58 -58
- package/esm2015/public_api.js +23 -23
- package/esm2015/valtimo-form.js +6 -6
- package/fesm2015/valtimo-form.js +185 -186
- package/fesm2015/valtimo-form.js.map +1 -1
- package/lib/form-routing.module.d.ts +2 -2
- package/lib/form.module.d.ts +2 -2
- package/lib/form.service.d.ts +12 -12
- package/lib/services/form-mapping/form-mapping.service.d.ts +5 -5
- package/lib/services/form-translation/form-translation.service.d.ts +10 -10
- package/package.json +1 -1
- package/public_api.d.ts +4 -4
- package/valtimo-form.d.ts +5 -5
- package/valtimo-form.metadata.json +1 -1
|
@@ -4,216 +4,215 @@
|
|
|
4
4
|
(global = global || self, factory((global.valtimo = global.valtimo || {}, global.valtimo.form = {}), global.ng.core, global.ng.common.http, global.config, global.ng.common, global.ng.router, global.components, global.i1$1));
|
|
5
5
|
}(this, (function (exports, i0, i2, i1, common, router, components, i1$1) { 'use strict';
|
|
6
6
|
|
|
7
|
-
/*
|
|
8
|
-
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
9
|
-
*
|
|
10
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
11
|
-
* you may not use this file except in compliance with the License.
|
|
12
|
-
* You may obtain a copy of the License at
|
|
13
|
-
*
|
|
14
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
15
|
-
*
|
|
16
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
18
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
-
* See the License for the specific language governing permissions and
|
|
20
|
-
* limitations under the License.
|
|
21
|
-
*/
|
|
22
|
-
var FormService = /** @class */ (function () {
|
|
23
|
-
function FormService(configService, http) {
|
|
24
|
-
this.configService = configService;
|
|
25
|
-
this.http = http;
|
|
26
|
-
this.valtimoApiConfig = configService.config.valtimoApi;
|
|
27
|
-
}
|
|
28
|
-
FormService.prototype.getFormDefinitionByName = function (formDefinitionName) {
|
|
29
|
-
return this.http.get(this.valtimoApiConfig.endpointUri + "form/" + formDefinitionName);
|
|
30
|
-
};
|
|
31
|
-
FormService.prototype.getFormDefinitionByNamePreFilled = function (formDefinitionName, documentId) {
|
|
32
|
-
return this.http.get(this.valtimoApiConfig.endpointUri + "form-association/form-definition/" + formDefinitionName + "?documentId=" + documentId);
|
|
33
|
-
};
|
|
34
|
-
return FormService;
|
|
35
|
-
}());
|
|
36
|
-
FormService.ɵprov = i0.ɵɵdefineInjectable({ factory: function FormService_Factory() { return new FormService(i0.ɵɵinject(i1.ConfigService), i0.ɵɵinject(i2.HttpClient)); }, token: FormService, providedIn: "root" });
|
|
37
|
-
FormService.decorators = [
|
|
38
|
-
{ type: i0.Injectable, args: [{
|
|
39
|
-
providedIn: 'root'
|
|
40
|
-
},] }
|
|
41
|
-
];
|
|
42
|
-
FormService.ctorParameters = function () { return [
|
|
43
|
-
{ type: i1.ConfigService },
|
|
44
|
-
{ type: i2.HttpClient }
|
|
7
|
+
/*
|
|
8
|
+
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
9
|
+
*
|
|
10
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
11
|
+
* you may not use this file except in compliance with the License.
|
|
12
|
+
* You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
var FormService = /** @class */ (function () {
|
|
23
|
+
function FormService(configService, http) {
|
|
24
|
+
this.configService = configService;
|
|
25
|
+
this.http = http;
|
|
26
|
+
this.valtimoApiConfig = configService.config.valtimoApi;
|
|
27
|
+
}
|
|
28
|
+
FormService.prototype.getFormDefinitionByName = function (formDefinitionName) {
|
|
29
|
+
return this.http.get(this.valtimoApiConfig.endpointUri + "form/" + formDefinitionName);
|
|
30
|
+
};
|
|
31
|
+
FormService.prototype.getFormDefinitionByNamePreFilled = function (formDefinitionName, documentId) {
|
|
32
|
+
return this.http.get(this.valtimoApiConfig.endpointUri + "form-association/form-definition/" + formDefinitionName + "?documentId=" + documentId);
|
|
33
|
+
};
|
|
34
|
+
return FormService;
|
|
35
|
+
}());
|
|
36
|
+
FormService.ɵprov = i0.ɵɵdefineInjectable({ factory: function FormService_Factory() { return new FormService(i0.ɵɵinject(i1.ConfigService), i0.ɵɵinject(i2.HttpClient)); }, token: FormService, providedIn: "root" });
|
|
37
|
+
FormService.decorators = [
|
|
38
|
+
{ type: i0.Injectable, args: [{
|
|
39
|
+
providedIn: 'root',
|
|
40
|
+
},] }
|
|
41
|
+
];
|
|
42
|
+
FormService.ctorParameters = function () { return [
|
|
43
|
+
{ type: i1.ConfigService },
|
|
44
|
+
{ type: i2.HttpClient }
|
|
45
45
|
]; };
|
|
46
46
|
|
|
47
|
-
/*
|
|
48
|
-
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
49
|
-
*
|
|
50
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
51
|
-
* you may not use this file except in compliance with the License.
|
|
52
|
-
* You may obtain a copy of the License at
|
|
53
|
-
*
|
|
54
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
55
|
-
*
|
|
56
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
57
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
58
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
59
|
-
* See the License for the specific language governing permissions and
|
|
60
|
-
* limitations under the License.
|
|
61
|
-
*/
|
|
62
|
-
var routes = [];
|
|
63
|
-
var FormRoutingModule = /** @class */ (function () {
|
|
64
|
-
function FormRoutingModule() {
|
|
65
|
-
}
|
|
66
|
-
return FormRoutingModule;
|
|
67
|
-
}());
|
|
68
|
-
FormRoutingModule.decorators = [
|
|
69
|
-
{ type: i0.NgModule, args: [{
|
|
70
|
-
declarations: [],
|
|
71
|
-
imports: [
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
],
|
|
75
|
-
exports: [router.RouterModule]
|
|
76
|
-
},] }
|
|
47
|
+
/*
|
|
48
|
+
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
49
|
+
*
|
|
50
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
51
|
+
* you may not use this file except in compliance with the License.
|
|
52
|
+
* You may obtain a copy of the License at
|
|
53
|
+
*
|
|
54
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
55
|
+
*
|
|
56
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
57
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
58
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
59
|
+
* See the License for the specific language governing permissions and
|
|
60
|
+
* limitations under the License.
|
|
61
|
+
*/
|
|
62
|
+
var routes = [];
|
|
63
|
+
var FormRoutingModule = /** @class */ (function () {
|
|
64
|
+
function FormRoutingModule() {
|
|
65
|
+
}
|
|
66
|
+
return FormRoutingModule;
|
|
67
|
+
}());
|
|
68
|
+
FormRoutingModule.decorators = [
|
|
69
|
+
{ type: i0.NgModule, args: [{
|
|
70
|
+
declarations: [],
|
|
71
|
+
imports: [common.CommonModule, router.RouterModule.forChild(routes)],
|
|
72
|
+
exports: [router.RouterModule],
|
|
73
|
+
},] }
|
|
77
74
|
];
|
|
78
75
|
|
|
79
|
-
/*
|
|
80
|
-
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
81
|
-
*
|
|
82
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
83
|
-
* you may not use this file except in compliance with the License.
|
|
84
|
-
* You may obtain a copy of the License at
|
|
85
|
-
*
|
|
86
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
87
|
-
*
|
|
88
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
89
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
90
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
91
|
-
* See the License for the specific language governing permissions and
|
|
92
|
-
* limitations under the License.
|
|
93
|
-
*/
|
|
94
|
-
var FormModule = /** @class */ (function () {
|
|
95
|
-
function FormModule() {
|
|
96
|
-
}
|
|
97
|
-
return FormModule;
|
|
98
|
-
}());
|
|
99
|
-
FormModule.decorators = [
|
|
100
|
-
{ type: i0.NgModule, args: [{
|
|
101
|
-
imports: [common.CommonModule, FormRoutingModule, components.FormIoModule],
|
|
102
|
-
exports: []
|
|
103
|
-
},] }
|
|
76
|
+
/*
|
|
77
|
+
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
78
|
+
*
|
|
79
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
80
|
+
* you may not use this file except in compliance with the License.
|
|
81
|
+
* You may obtain a copy of the License at
|
|
82
|
+
*
|
|
83
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
84
|
+
*
|
|
85
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
86
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
87
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
88
|
+
* See the License for the specific language governing permissions and
|
|
89
|
+
* limitations under the License.
|
|
90
|
+
*/
|
|
91
|
+
var FormModule = /** @class */ (function () {
|
|
92
|
+
function FormModule() {
|
|
93
|
+
}
|
|
94
|
+
return FormModule;
|
|
95
|
+
}());
|
|
96
|
+
FormModule.decorators = [
|
|
97
|
+
{ type: i0.NgModule, args: [{
|
|
98
|
+
imports: [common.CommonModule, FormRoutingModule, components.FormIoModule],
|
|
99
|
+
exports: [],
|
|
100
|
+
},] }
|
|
104
101
|
];
|
|
105
102
|
|
|
106
|
-
/*
|
|
107
|
-
* Copyright 2015-2021 Ritense BV, the Netherlands.
|
|
108
|
-
*
|
|
109
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
110
|
-
* you may not use this file except in compliance with the License.
|
|
111
|
-
* You may obtain a copy of the License at
|
|
112
|
-
*
|
|
113
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
114
|
-
*
|
|
115
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
116
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
117
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
118
|
-
* See the License for the specific language governing permissions and
|
|
119
|
-
* limitations under the License.
|
|
120
|
-
*/
|
|
121
|
-
var FormMappingService = /** @class */ (function () {
|
|
122
|
-
function FormMappingService() {
|
|
123
|
-
}
|
|
124
|
-
FormMappingService.prototype.mapComponents = function (form, mappingFunction) {
|
|
125
|
-
var _a, _b;
|
|
126
|
-
var recursiveMappingFunction = function (component) {
|
|
127
|
-
var mappedComponent = mappingFunction(component);
|
|
128
|
-
var innerComponents = component.components;
|
|
129
|
-
if (innerComponents && innerComponents.length > 0) {
|
|
130
|
-
return Object.assign(Object.assign({}, mappedComponent), { components: innerComponents.map(function (innerComponent) { return recursiveMappingFunction(innerComponent); }) });
|
|
131
|
-
}
|
|
132
|
-
return mappedComponent;
|
|
133
|
-
};
|
|
134
|
-
return Object.assign(Object.assign({}, form), (((_a = form === null || form === void 0 ? void 0 : form.components) === null || _a === void 0 ? void 0 : _a.length) > 0 && {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
103
|
+
/*
|
|
104
|
+
* Copyright 2015-2021 Ritense BV, the Netherlands.
|
|
105
|
+
*
|
|
106
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
107
|
+
* you may not use this file except in compliance with the License.
|
|
108
|
+
* You may obtain a copy of the License at
|
|
109
|
+
*
|
|
110
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
111
|
+
*
|
|
112
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
113
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
114
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
115
|
+
* See the License for the specific language governing permissions and
|
|
116
|
+
* limitations under the License.
|
|
117
|
+
*/
|
|
118
|
+
var FormMappingService = /** @class */ (function () {
|
|
119
|
+
function FormMappingService() {
|
|
120
|
+
}
|
|
121
|
+
FormMappingService.prototype.mapComponents = function (form, mappingFunction) {
|
|
122
|
+
var _a, _b;
|
|
123
|
+
var recursiveMappingFunction = function (component) {
|
|
124
|
+
var mappedComponent = mappingFunction(component);
|
|
125
|
+
var innerComponents = component.components;
|
|
126
|
+
if (innerComponents && innerComponents.length > 0) {
|
|
127
|
+
return Object.assign(Object.assign({}, mappedComponent), { components: innerComponents.map(function (innerComponent) { return recursiveMappingFunction(innerComponent); }) });
|
|
128
|
+
}
|
|
129
|
+
return mappedComponent;
|
|
130
|
+
};
|
|
131
|
+
return Object.assign(Object.assign({}, form), (((_a = form === null || form === void 0 ? void 0 : form.components) === null || _a === void 0 ? void 0 : _a.length) > 0 && {
|
|
132
|
+
components: (_b = form === null || form === void 0 ? void 0 : form.components) === null || _b === void 0 ? void 0 : _b.map(function (component) { return recursiveMappingFunction(component); }),
|
|
133
|
+
}));
|
|
134
|
+
};
|
|
135
|
+
return FormMappingService;
|
|
136
|
+
}());
|
|
137
|
+
FormMappingService.ɵprov = i0.ɵɵdefineInjectable({ factory: function FormMappingService_Factory() { return new FormMappingService(); }, token: FormMappingService, providedIn: "root" });
|
|
138
|
+
FormMappingService.decorators = [
|
|
139
|
+
{ type: i0.Injectable, args: [{
|
|
140
|
+
providedIn: 'root',
|
|
141
|
+
},] }
|
|
143
142
|
];
|
|
144
143
|
|
|
145
|
-
/*
|
|
146
|
-
* Copyright 2015-2021 Ritense BV, the Netherlands.
|
|
147
|
-
*
|
|
148
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
149
|
-
* you may not use this file except in compliance with the License.
|
|
150
|
-
* You may obtain a copy of the License at
|
|
151
|
-
*
|
|
152
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
153
|
-
*
|
|
154
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
155
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
156
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
157
|
-
* See the License for the specific language governing permissions and
|
|
158
|
-
* limitations under the License.
|
|
159
|
-
*/
|
|
160
|
-
var FormTranslationService = /** @class */ (function () {
|
|
161
|
-
function FormTranslationService(translateService, formMappingService) {
|
|
162
|
-
this.translateService = translateService;
|
|
163
|
-
this.formMappingService = formMappingService;
|
|
164
|
-
}
|
|
165
|
-
FormTranslationService.prototype.translateForm = function (form) {
|
|
166
|
-
var _this = this;
|
|
167
|
-
var translateFunction = function (component) {
|
|
168
|
-
var labelTranslation = _this.getTranslation("" + component.label);
|
|
169
|
-
var titleTranslation = _this.getTranslation("" + component.title);
|
|
170
|
-
var contentTranslation = _this.getTranslation("" + component.content);
|
|
171
|
-
var placeholderTranslation = _this.getTranslation("" + component.placeholder);
|
|
172
|
-
var tooltipTranslation = _this.getTranslation("" + component.tooltip);
|
|
173
|
-
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, component), (labelTranslation && { label: "" + labelTranslation })), (titleTranslation && { title: "" + titleTranslation })), (contentTranslation && { content: "" + contentTranslation })), (placeholderTranslation && { placeholder: "" + placeholderTranslation })), (tooltipTranslation && { tooltip: "" + tooltipTranslation }));
|
|
174
|
-
};
|
|
175
|
-
return this.formMappingService.mapComponents(form, translateFunction);
|
|
176
|
-
};
|
|
177
|
-
FormTranslationService.prototype.getTranslation = function (translationKey) {
|
|
178
|
-
var translation = this.translateService.instant(translationKey);
|
|
179
|
-
if (translation !== translationKey) {
|
|
180
|
-
return translation;
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
return false;
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
return FormTranslationService;
|
|
187
|
-
}());
|
|
188
|
-
FormTranslationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function FormTranslationService_Factory() { return new FormTranslationService(i0.ɵɵinject(i1$1.TranslateService), i0.ɵɵinject(FormMappingService)); }, token: FormTranslationService, providedIn: "root" });
|
|
189
|
-
FormTranslationService.decorators = [
|
|
190
|
-
{ type: i0.Injectable, args: [{
|
|
191
|
-
providedIn: 'root'
|
|
192
|
-
},] }
|
|
193
|
-
];
|
|
194
|
-
FormTranslationService.ctorParameters = function () { return [
|
|
195
|
-
{ type: i1$1.TranslateService },
|
|
196
|
-
{ type: FormMappingService }
|
|
144
|
+
/*
|
|
145
|
+
* Copyright 2015-2021 Ritense BV, the Netherlands.
|
|
146
|
+
*
|
|
147
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
148
|
+
* you may not use this file except in compliance with the License.
|
|
149
|
+
* You may obtain a copy of the License at
|
|
150
|
+
*
|
|
151
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
152
|
+
*
|
|
153
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
154
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
155
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
156
|
+
* See the License for the specific language governing permissions and
|
|
157
|
+
* limitations under the License.
|
|
158
|
+
*/
|
|
159
|
+
var FormTranslationService = /** @class */ (function () {
|
|
160
|
+
function FormTranslationService(translateService, formMappingService) {
|
|
161
|
+
this.translateService = translateService;
|
|
162
|
+
this.formMappingService = formMappingService;
|
|
163
|
+
}
|
|
164
|
+
FormTranslationService.prototype.translateForm = function (form) {
|
|
165
|
+
var _this = this;
|
|
166
|
+
var translateFunction = function (component) {
|
|
167
|
+
var labelTranslation = _this.getTranslation("" + component.label);
|
|
168
|
+
var titleTranslation = _this.getTranslation("" + component.title);
|
|
169
|
+
var contentTranslation = _this.getTranslation("" + component.content);
|
|
170
|
+
var placeholderTranslation = _this.getTranslation("" + component.placeholder);
|
|
171
|
+
var tooltipTranslation = _this.getTranslation("" + component.tooltip);
|
|
172
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, component), (labelTranslation && { label: "" + labelTranslation })), (titleTranslation && { title: "" + titleTranslation })), (contentTranslation && { content: "" + contentTranslation })), (placeholderTranslation && { placeholder: "" + placeholderTranslation })), (tooltipTranslation && { tooltip: "" + tooltipTranslation }));
|
|
173
|
+
};
|
|
174
|
+
return this.formMappingService.mapComponents(form, translateFunction);
|
|
175
|
+
};
|
|
176
|
+
FormTranslationService.prototype.getTranslation = function (translationKey) {
|
|
177
|
+
var translation = this.translateService.instant(translationKey);
|
|
178
|
+
if (translation !== translationKey) {
|
|
179
|
+
return translation;
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
return FormTranslationService;
|
|
186
|
+
}());
|
|
187
|
+
FormTranslationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function FormTranslationService_Factory() { return new FormTranslationService(i0.ɵɵinject(i1$1.TranslateService), i0.ɵɵinject(FormMappingService)); }, token: FormTranslationService, providedIn: "root" });
|
|
188
|
+
FormTranslationService.decorators = [
|
|
189
|
+
{ type: i0.Injectable, args: [{
|
|
190
|
+
providedIn: 'root',
|
|
191
|
+
},] }
|
|
192
|
+
];
|
|
193
|
+
FormTranslationService.ctorParameters = function () { return [
|
|
194
|
+
{ type: i1$1.TranslateService },
|
|
195
|
+
{ type: FormMappingService }
|
|
197
196
|
]; };
|
|
198
197
|
|
|
199
|
-
/*
|
|
200
|
-
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
201
|
-
*
|
|
202
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
203
|
-
* you may not use this file except in compliance with the License.
|
|
204
|
-
* You may obtain a copy of the License at
|
|
205
|
-
*
|
|
206
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
207
|
-
*
|
|
208
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
209
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
210
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
211
|
-
* See the License for the specific language governing permissions and
|
|
212
|
-
* limitations under the License.
|
|
198
|
+
/*
|
|
199
|
+
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
200
|
+
*
|
|
201
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
202
|
+
* you may not use this file except in compliance with the License.
|
|
203
|
+
* You may obtain a copy of the License at
|
|
204
|
+
*
|
|
205
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
206
|
+
*
|
|
207
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
208
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
209
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
210
|
+
* See the License for the specific language governing permissions and
|
|
211
|
+
* limitations under the License.
|
|
213
212
|
*/
|
|
214
213
|
|
|
215
|
-
/**
|
|
216
|
-
* Generated bundle index. Do not edit.
|
|
214
|
+
/**
|
|
215
|
+
* Generated bundle index. Do not edit.
|
|
217
216
|
*/
|
|
218
217
|
|
|
219
218
|
exports.FormMappingService = FormMappingService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"valtimo-form.umd.js","sources":["../../../../projects/valtimo/form/src/lib/form.service.ts","../../../../projects/valtimo/form/src/lib/form-routing.module.ts","../../../../projects/valtimo/form/src/lib/form.module.ts","../../../../projects/valtimo/form/src/lib/services/form-mapping/form-mapping.service.ts","../../../../projects/valtimo/form/src/lib/services/form-translation/form-translation.service.ts","../../../../projects/valtimo/form/src/public_api.ts","../../../../projects/valtimo/form/src/valtimo-form.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 {Observable} from 'rxjs';\nimport {FormioForm} from 'angular-formio';\nimport {ConfigService} from '@valtimo/config';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class FormService {\n private valtimoApiConfig: any;\n\n constructor(\n private configService: ConfigService,\n private http: HttpClient\n ) {\n this.valtimoApiConfig = configService.config.valtimoApi;\n }\n\n getFormDefinitionByName(formDefinitionName: string): Observable<FormioForm> {\n return this.http.get<FormioForm>(`${this.valtimoApiConfig.endpointUri}form/${formDefinitionName}`);\n }\n\n getFormDefinitionByNamePreFilled(formDefinitionName: string, documentId: string): Observable<FormioForm> {\n return this.http.get<FormioForm>(`${this.valtimoApiConfig.endpointUri}form-association/form-definition/${formDefinitionName}?documentId=${documentId}`);\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 {CommonModule} from '@angular/common';\n\nconst routes: Routes = [\n];\n\n@NgModule({\n declarations: [],\n imports: [\n CommonModule,\n RouterModule.forChild(routes),\n ],\n exports: [RouterModule]\n})\nexport class FormRoutingModule {\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 {CommonModule} from '@angular/common';\nimport {FormRoutingModule} from './form-routing.module';\nimport {FormIoModule} from '@valtimo/components';\n\n@NgModule({\n imports: [CommonModule, FormRoutingModule, FormIoModule],\n exports: []\n})\nexport class FormModule {\n\n}\n","/*\n * Copyright 2015-2021 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 {FormioForm} from 'angular-formio';\nimport {ExtendedComponentSchema} from 'formiojs';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class FormMappingService {\n mapComponents(\n form: FormioForm,\n mappingFunction: (component: ExtendedComponentSchema) => ExtendedComponentSchema\n ): FormioForm {\n const recursiveMappingFunction = (component: ExtendedComponentSchema) => {\n const mappedComponent = mappingFunction(component);\n const innerComponents = component.components;\n\n if (innerComponents && innerComponents.length > 0) {\n return {\n ...mappedComponent,\n components: innerComponents.map((innerComponent: ExtendedComponentSchema) => recursiveMappingFunction(innerComponent))\n };\n }\n\n return mappedComponent;\n };\n\n return {\n ...form,\n // @ts-ignore\n ...(form?.components?.length > 0 && {components: form?.components?.map((component) =>\n recursiveMappingFunction(component))} )\n };\n }\n}\n","/*\n * Copyright 2015-2021 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 {TranslateService} from '@ngx-translate/core';\nimport {FormioForm} from 'angular-formio';\nimport {FormMappingService} from '../form-mapping/form-mapping.service';\nimport {ExtendedComponentSchema} from 'formiojs';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class FormTranslationService {\n constructor(\n private readonly translateService: TranslateService,\n private readonly formMappingService: FormMappingService\n ) {\n }\n\n translateForm(form: FormioForm): FormioForm {\n const translateFunction = (component: ExtendedComponentSchema): ExtendedComponentSchema => {\n const labelTranslation = this.getTranslation(`${component.label}`);\n const titleTranslation = this.getTranslation(`${component.title}`);\n const contentTranslation = this.getTranslation(`${component.content}`);\n const placeholderTranslation = this.getTranslation(`${component.placeholder}`);\n const tooltipTranslation = this.getTranslation(`${component.tooltip}`);\n\n return {\n ...component,\n ...(labelTranslation && {label: `${labelTranslation}`}),\n ...(titleTranslation && {title: `${titleTranslation}`}),\n ...(contentTranslation && {content: `${contentTranslation}`}),\n ...(placeholderTranslation && {placeholder: `${placeholderTranslation}`}),\n ...(tooltipTranslation && {tooltip: `${tooltipTranslation}`}),\n };\n };\n\n return this.formMappingService.mapComponents(form, translateFunction);\n }\n\n private getTranslation(translationKey: string): string | boolean {\n const translation = this.translateService.instant(translationKey);\n\n if (translation !== translationKey) {\n return translation;\n } else {\n return false;\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\n/*\n * Public API Surface of form\n */\n\nexport * from './lib/form.service';\nexport * from './lib/form.module';\nexport * from './lib/services/form-mapping/form-mapping.service';\nexport * from './lib/services/form-translation/form-translation.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n\nexport {FormRoutingModule as ɵa} from './lib/form-routing.module';"],"names":["Injectable","ConfigService","HttpClient","NgModule","CommonModule","RouterModule","FormIoModule","TranslateService"],"mappings":";;;;;;IAAA;;;;;;;;;;;;;;;;QA4BE,qBACU,aAA4B,EAC5B,IAAgB;YADhB,kBAAa,GAAb,aAAa,CAAe;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AE,KAAG,gBAAkB,EAAC,KAClD,gBAAgB,IAAI,EAAC,KAAK,EAAE,KAAG,gBAAkB,EAAC,KAClD,kBAAkB,IAAI,EAAC,OAAO,EAAE,KAAG,kBAAoB,EAAC,KACxD,sBAAsB,IAAI,EAAC,WAAW,EAAE,KAAG,sBAAwB,EAAC,KACpE,kBAAkB,IAAI,EAAC,OAAO,EAAE,KAAG,kBAAoB,EAAC,GAC5D;aACH,CAAC;YAEF,OAAO,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;SACvE;QAEO,+CAAc,GAAd,UAAe,cAAsB;YAC3C,IAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;YAElE,IAAI,WAAW,KAAK,cAAc,EAAE;gBAClC,OAAO,WAAW,CAAC;aACpB;iBAAM;gBACL,OAAO,KAAK,CAAC;aACd;SACF;;;;;gBAvCFA,aAAU,SAAC;oBACV,UAAU,EAAE,MAAM;iBACnB;;;gBAPOO,qBAAgB;gBAEhB,kBAAkB;;;ICnB1B;;;;;;;;;;;;;;;;ICAA;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"valtimo-form.umd.js","sources":["../../../../projects/valtimo/form/src/lib/form.service.ts","../../../../projects/valtimo/form/src/lib/form-routing.module.ts","../../../../projects/valtimo/form/src/lib/form.module.ts","../../../../projects/valtimo/form/src/lib/services/form-mapping/form-mapping.service.ts","../../../../projects/valtimo/form/src/lib/services/form-translation/form-translation.service.ts","../../../../projects/valtimo/form/src/public_api.ts","../../../../projects/valtimo/form/src/valtimo-form.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 {Observable} from 'rxjs';\nimport {FormioForm} from 'angular-formio';\nimport {ConfigService} from '@valtimo/config';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class FormService {\n private valtimoApiConfig: any;\n\n constructor(private configService: ConfigService, private http: HttpClient) {\n this.valtimoApiConfig = configService.config.valtimoApi;\n }\n\n getFormDefinitionByName(formDefinitionName: string): Observable<FormioForm> {\n return this.http.get<FormioForm>(\n `${this.valtimoApiConfig.endpointUri}form/${formDefinitionName}`\n );\n }\n\n getFormDefinitionByNamePreFilled(\n formDefinitionName: string,\n documentId: string\n ): Observable<FormioForm> {\n return this.http.get<FormioForm>(\n `${this.valtimoApiConfig.endpointUri}form-association/form-definition/${formDefinitionName}?documentId=${documentId}`\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 {CommonModule} from '@angular/common';\n\nconst routes: Routes = [];\n\n@NgModule({\n declarations: [],\n imports: [CommonModule, RouterModule.forChild(routes)],\n exports: [RouterModule],\n})\nexport class FormRoutingModule {}\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 {CommonModule} from '@angular/common';\nimport {FormRoutingModule} from './form-routing.module';\nimport {FormIoModule} from '@valtimo/components';\n\n@NgModule({\n imports: [CommonModule, FormRoutingModule, FormIoModule],\n exports: [],\n})\nexport class FormModule {}\n","/*\n * Copyright 2015-2021 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 {FormioForm} from 'angular-formio';\nimport {ExtendedComponentSchema} from 'formiojs';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class FormMappingService {\n mapComponents(\n form: FormioForm,\n mappingFunction: (component: ExtendedComponentSchema) => ExtendedComponentSchema\n ): FormioForm {\n const recursiveMappingFunction = (component: ExtendedComponentSchema) => {\n const mappedComponent = mappingFunction(component);\n const innerComponents = component.components;\n\n if (innerComponents && innerComponents.length > 0) {\n return {\n ...mappedComponent,\n components: innerComponents.map((innerComponent: ExtendedComponentSchema) =>\n recursiveMappingFunction(innerComponent)\n ),\n };\n }\n\n return mappedComponent;\n };\n\n return {\n ...form,\n // @ts-ignore\n ...(form?.components?.length > 0 && {\n components: form?.components?.map(component => recursiveMappingFunction(component)),\n }),\n };\n }\n}\n","/*\n * Copyright 2015-2021 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 {TranslateService} from '@ngx-translate/core';\nimport {FormioForm} from 'angular-formio';\nimport {FormMappingService} from '../form-mapping/form-mapping.service';\nimport {ExtendedComponentSchema} from 'formiojs';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class FormTranslationService {\n constructor(\n private readonly translateService: TranslateService,\n private readonly formMappingService: FormMappingService\n ) {}\n\n translateForm(form: FormioForm): FormioForm {\n const translateFunction = (component: ExtendedComponentSchema): ExtendedComponentSchema => {\n const labelTranslation = this.getTranslation(`${component.label}`);\n const titleTranslation = this.getTranslation(`${component.title}`);\n const contentTranslation = this.getTranslation(`${component.content}`);\n const placeholderTranslation = this.getTranslation(`${component.placeholder}`);\n const tooltipTranslation = this.getTranslation(`${component.tooltip}`);\n\n return {\n ...component,\n ...(labelTranslation && {label: `${labelTranslation}`}),\n ...(titleTranslation && {title: `${titleTranslation}`}),\n ...(contentTranslation && {content: `${contentTranslation}`}),\n ...(placeholderTranslation && {placeholder: `${placeholderTranslation}`}),\n ...(tooltipTranslation && {tooltip: `${tooltipTranslation}`}),\n };\n };\n\n return this.formMappingService.mapComponents(form, translateFunction);\n }\n\n private getTranslation(translationKey: string): string | boolean {\n const translation = this.translateService.instant(translationKey);\n\n if (translation !== translationKey) {\n return translation;\n } else {\n return false;\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\n/*\n * Public API Surface of form\n */\n\nexport * from './lib/form.service';\nexport * from './lib/form.module';\nexport * from './lib/services/form-mapping/form-mapping.service';\nexport * from './lib/services/form-translation/form-translation.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n\nexport {FormRoutingModule as ɵa} from './lib/form-routing.module';"],"names":["Injectable","ConfigService","HttpClient","NgModule","CommonModule","RouterModule","FormIoModule","TranslateService"],"mappings":";;;;;;IAAA;;;;;;;;;;;;;;;;QA4BE,qBAAoB,aAA4B,EAAU,IAAgB;YAAtD,kBAAa,GAAb,aAAa,CAAe;YAAU,SAAI,GAAJ,IAAI,CAAY;YACxE,IAAI,CAAC,gBAAgB,GAAG,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC;SACzD;QAED,6CAAuB,GAAvB,UAAwB,kBAA0B;YAChD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CACf,IAAI,CAAC,gBAAgB,CAAC,WAAW,aAAQ,kBAAoB,CACjE,CAAC;SACH;QAED,sDAAgC,GAAhC,UACE,kBAA0B,EAC1B,UAAkB;YAElB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CACf,IAAI,CAAC,gBAAgB,CAAC,WAAW,yCAAoC,kBAAkB,oBAAe,UAAY,CACtH,CAAC;SACH;;;;;gBAvBFA,aAAU,SAAC;oBACV,UAAU,EAAE,MAAM;iBACnB;;;gBAJOC,gBAAa;gBAHbC,aAAU;;;ICjBlB;;;;;;;;;;;;;;;IAoBA,IAAM,MAAM,GAAW,EAAE,CAAC;;QAO1B;;;;;gBALCC,WAAQ,SAAC;oBACR,YAAY,EAAE,EAAE;oBAChB,OAAO,EAAE,CAACC,mBAAY,EAAEC,mBAAY,CAAC,QAA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;ICAA;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../projects/valtimo/form/src/lib/form.service.ts","../../../../projects/valtimo/form/src/lib/form-routing.module.ts","../../../../projects/valtimo/form/src/lib/form.module.ts","../../../../projects/valtimo/form/src/lib/services/form-mapping/form-mapping.service.ts","../../../../projects/valtimo/form/src/lib/services/form-translation/form-translation.service.ts"],"names":["FormService","configService","http","this","valtimoApiConfig","config","valtimoApi","prototype","getFormDefinitionByName","formDefinitionName","get","endpointUri","getFormDefinitionByNamePreFilled","documentId","Injectable","args","providedIn","ConfigService","HttpClient","NgModule","declarations","imports","CommonModule","RouterModule","forChild","exports","FormRoutingModule","FormIoModule","FormMappingService","mapComponents","form","mappingFunction","recursiveMappingFunction","component","mappedComponent","innerComponents","components","length","Object","assign","map","innerComponent","_a","_b","FormTranslationService","translateService","formMappingService","translateForm","_this","labelTranslation","getTranslation","label","titleTranslation","title","contentTranslation","content","placeholderTranslation","placeholder","tooltipTranslation","tooltip","translationKey","translation","instant","TranslateService"],"mappings":"orBA4BE,SAAAA,EACUC,EACAC,GADAC,KAAAF,cAAAA,EACAE,KAAAD,KAAAA,EAERC,KAAKC,iBAAmBH,EAAcI,OAAOC,kBAG/CN,EAAAO,UAAAC,wBAAA,SAAwBC,GACtB,OAAON,KAAKD,KAAKQ,IAAmBP,KAAKC,iBAAiBO,YAAW,QAAQF,IAG/ET,EAAAO,UAAAK,iCAAA,SAAiCH,EAA4BI,GAC3D,OAAOV,KAAKD,KAAKQ,IAAmBP,KAAKC,iBAAiBO,YAAW,oCAAoCF,EAAkB,eAAeI,8KAlB7IC,EAAAA,WAAUC,KAAA,CAAC,CACVC,WAAY,oDAHNC,EAAAA,qBAHAC,EAAAA,cCGR,MAWA,iCARCC,EAAAA,SAAQJ,KAAA,CAAC,CACRK,aAAc,GACdC,QAAS,CACPC,EAAAA,aACAC,EAAAA,aAAaC,SAPM,KASrBC,QAAS,CAACF,EA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AC,OAAA,GACKN,GACCgB,GAAoB,CAACE,MAAO,GAAGF,IAC/BG,GAAoB,CAACC,MAAO,GAAGD,IAC/BE,GAAsB,CAACC,QAAS,GAAGD,IACnCE,GAA0B,CAACC,YAAa,GAAGD,IAC3CE,GAAsB,CAACC,QAAS,GAAGD,QAOrCd,EAAArC,UAAA2C,eAAA,SAAeU,GACrB,IAAMC,EAAc1D,KAAK0C,iBAAiBiB,QAAQF,GAElD,OAAIC,IAAgBD,GACXC,qKAnCZ/C,EAAAA,WAAUC,KAAA,CAAC,CACVC,WAAY,oDANN+C,EAAAA,wBAEAnC","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 {Observable} from 'rxjs';\nimport {FormioForm} from 'angular-formio';\nimport {ConfigService} from '@valtimo/config';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class FormService {\n private valtimoApiConfig: any;\n\n constructor(\n private configService: ConfigService,\n private http: HttpClient\n ) {\n this.valtimoApiConfig = configService.config.valtimoApi;\n }\n\n getFormDefinitionByName(formDefinitionName: string): Observable<FormioForm> {\n return this.http.get<FormioForm>(`${this.valtimoApiConfig.endpointUri}form/${formDefinitionName}`);\n }\n\n getFormDefinitionByNamePreFilled(formDefinitionName: string, documentId: string): Observable<FormioForm> {\n return this.http.get<FormioForm>(`${this.valtimoApiConfig.endpointUri}form-association/form-definition/${formDefinitionName}?documentId=${documentId}`);\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 {CommonModule} from '@angular/common';\n\nconst routes: Routes = [\n];\n\n@NgModule({\n declarations: [],\n imports: [\n CommonModule,\n RouterModule.forChild(routes),\n ],\n exports: [RouterModule]\n})\nexport class FormRoutingModule {\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 {CommonModule} from '@angular/common';\nimport {FormRoutingModule} from './form-routing.module';\nimport {FormIoModule} from '@valtimo/components';\n\n@NgModule({\n imports: [CommonModule, FormRoutingModule, FormIoModule],\n exports: []\n})\nexport class FormModule {\n\n}\n","/*\n * Copyright 2015-2021 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 {FormioForm} from 'angular-formio';\nimport {ExtendedComponentSchema} from 'formiojs';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class FormMappingService {\n mapComponents(\n form: FormioForm,\n mappingFunction: (component: ExtendedComponentSchema) => ExtendedComponentSchema\n ): FormioForm {\n const recursiveMappingFunction = (component: ExtendedComponentSchema) => {\n const mappedComponent = mappingFunction(component);\n const innerComponents = component.components;\n\n if (innerComponents && innerComponents.length > 0) {\n return {\n ...mappedComponent,\n components: innerComponents.map((innerComponent: ExtendedComponentSchema) => recursiveMappingFunction(innerComponent))\n };\n }\n\n return mappedComponent;\n };\n\n return {\n ...form,\n // @ts-ignore\n ...(form?.components?.length > 0 && {components: form?.components?.map((component) =>\n recursiveMappingFunction(component))} )\n };\n }\n}\n","/*\n * Copyright 2015-2021 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 {TranslateService} from '@ngx-translate/core';\nimport {FormioForm} from 'angular-formio';\nimport {FormMappingService} from '../form-mapping/form-mapping.service';\nimport {ExtendedComponentSchema} from 'formiojs';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class FormTranslationService {\n constructor(\n private readonly translateService: TranslateService,\n private readonly formMappingService: FormMappingService\n ) {\n }\n\n translateForm(form: FormioForm): FormioForm {\n const translateFunction = (component: ExtendedComponentSchema): ExtendedComponentSchema => {\n const labelTranslation = this.getTranslation(`${component.label}`);\n const titleTranslation = this.getTranslation(`${component.title}`);\n const contentTranslation = this.getTranslation(`${component.content}`);\n const placeholderTranslation = this.getTranslation(`${component.placeholder}`);\n const tooltipTranslation = this.getTranslation(`${component.tooltip}`);\n\n return {\n ...component,\n ...(labelTranslation && {label: `${labelTranslation}`}),\n ...(titleTranslation && {title: `${titleTranslation}`}),\n ...(contentTranslation && {content: `${contentTranslation}`}),\n ...(placeholderTranslation && {placeholder: `${placeholderTranslation}`}),\n ...(tooltipTranslation && {tooltip: `${tooltipTranslation}`}),\n };\n };\n\n return this.formMappingService.mapComponents(form, translateFunction);\n }\n\n private getTranslation(translationKey: string): string | boolean {\n const translation = this.translateService.instant(translationKey);\n\n if (translation !== translationKey) {\n return translation;\n } else {\n return false;\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../../projects/valtimo/form/src/lib/form.service.ts","../../../../projects/valtimo/form/src/lib/form-routing.module.ts","../../../../projects/valtimo/form/src/lib/form.module.ts","../../../../projects/valtimo/form/src/lib/services/form-mapping/form-mapping.service.ts","../../../../projects/valtimo/form/src/lib/services/form-translation/form-translation.service.ts"],"names":["FormService","configService","http","this","valtimoApiConfig","config","valtimoApi","prototype","getFormDefinitionByName","formDefinitionName","get","endpointUri","getFormDefinitionByNamePreFilled","documentId","Injectable","args","providedIn","ConfigService","HttpClient","NgModule","declarations","imports","CommonModule","RouterModule","forChild","exports","FormRoutingModule","FormIoModule","FormMappingService","mapComponents","form","mappingFunction","recursiveMappingFunction","component","mappedComponent","innerComponents","components","length","Object","assign","map","innerComponent","_a","_b","FormTranslationService","translateService","formMappingService","translateForm","_this","labelTranslation","getTranslation","label","titleTranslation","title","contentTranslation","content","placeholderTranslation","placeholder","tooltipTranslation","tooltip","translationKey","translation","instant","TranslateService"],"mappings":"orBA4BE,SAAAA,EAAoBC,EAAsCC,GAAtCC,KAAAF,cAAAA,EAAsCE,KAAAD,KAAAA,EACxDC,KAAKC,iBAAmBH,EAAcI,OAAOC,kBAG/CN,EAAAO,UAAAC,wBAAA,SAAwBC,GACtB,OAAON,KAAKD,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A7C,KAkBE,OAAOA,KAAK2C,mBAAmBjB,cAAcC,GAjBnB,SAACG,GACzB,IAAMgB,EAAmBD,EAAKE,eAAe,GAAGjB,EAAUkB,OACpDC,EAAmBJ,EAAKE,eAAe,GAAGjB,EAAUoB,OACpDC,EAAqBN,EAAKE,eAAe,GAAGjB,EAAUsB,SACtDC,EAAyBR,EAAKE,eAAe,GAAGjB,EAAUwB,aAC1DC,EAAqBV,EAAKE,eAAe,GAAGjB,EAAU0B,SAE5D,OAAArB,OAAAC,OAAAD,OAAAC,OAAAD,OAAAC,OAAAD,OAAAC,OAAAD,OAAAC,OAAAD,OAAAC,OAAA,GACKN,GACCgB,GAAoB,CAACE,MAAO,GAAGF,IAC/BG,GAAoB,CAACC,MAAO,GAAGD,IAC/BE,GAAsB,CAACC,QAAS,GAAGD,IACnCE,GAA0B,CAACC,YAAa,GAAGD,IAC3CE,GAAsB,CAACC,QAAS,GAAGD,QAOrCd,EAAArC,UAAA2C,eAAA,SAAeU,GACrB,IAAMC,EAAc1D,KAAK0C,iBAAiBiB,QAAQF,GAElD,OAAIC,IAAgBD,GACXC,qKAlCZ/C,EAAAA,WAAUC,KAAA,CAAC,CACVC,WAAY,oDANN+C,EAAAA,wBAEAnC","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 {Observable} from 'rxjs';\nimport {FormioForm} from 'angular-formio';\nimport {ConfigService} from '@valtimo/config';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class FormService {\n private valtimoApiConfig: any;\n\n constructor(private configService: ConfigService, private http: HttpClient) {\n this.valtimoApiConfig = configService.config.valtimoApi;\n }\n\n getFormDefinitionByName(formDefinitionName: string): Observable<FormioForm> {\n return this.http.get<FormioForm>(\n `${this.valtimoApiConfig.endpointUri}form/${formDefinitionName}`\n );\n }\n\n getFormDefinitionByNamePreFilled(\n formDefinitionName: string,\n documentId: string\n ): Observable<FormioForm> {\n return this.http.get<FormioForm>(\n `${this.valtimoApiConfig.endpointUri}form-association/form-definition/${formDefinitionName}?documentId=${documentId}`\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 {CommonModule} from '@angular/common';\n\nconst routes: Routes = [];\n\n@NgModule({\n declarations: [],\n imports: [CommonModule, RouterModule.forChild(routes)],\n exports: [RouterModule],\n})\nexport class FormRoutingModule {}\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 {CommonModule} from '@angular/common';\nimport {FormRoutingModule} from './form-routing.module';\nimport {FormIoModule} from '@valtimo/components';\n\n@NgModule({\n imports: [CommonModule, FormRoutingModule, FormIoModule],\n exports: [],\n})\nexport class FormModule {}\n","/*\n * Copyright 2015-2021 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 {FormioForm} from 'angular-formio';\nimport {ExtendedComponentSchema} from 'formiojs';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class FormMappingService {\n mapComponents(\n form: FormioForm,\n mappingFunction: (component: ExtendedComponentSchema) => ExtendedComponentSchema\n ): FormioForm {\n const recursiveMappingFunction = (component: ExtendedComponentSchema) => {\n const mappedComponent = mappingFunction(component);\n const innerComponents = component.components;\n\n if (innerComponents && innerComponents.length > 0) {\n return {\n ...mappedComponent,\n components: innerComponents.map((innerComponent: ExtendedComponentSchema) =>\n recursiveMappingFunction(innerComponent)\n ),\n };\n }\n\n return mappedComponent;\n };\n\n return {\n ...form,\n // @ts-ignore\n ...(form?.components?.length > 0 && {\n components: form?.components?.map(component => recursiveMappingFunction(component)),\n }),\n };\n }\n}\n","/*\n * Copyright 2015-2021 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 {TranslateService} from '@ngx-translate/core';\nimport {FormioForm} from 'angular-formio';\nimport {FormMappingService} from '../form-mapping/form-mapping.service';\nimport {ExtendedComponentSchema} from 'formiojs';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class FormTranslationService {\n constructor(\n private readonly translateService: TranslateService,\n private readonly formMappingService: FormMappingService\n ) {}\n\n translateForm(form: FormioForm): FormioForm {\n const translateFunction = (component: ExtendedComponentSchema): ExtendedComponentSchema => {\n const labelTranslation = this.getTranslation(`${component.label}`);\n const titleTranslation = this.getTranslation(`${component.title}`);\n const contentTranslation = this.getTranslation(`${component.content}`);\n const placeholderTranslation = this.getTranslation(`${component.placeholder}`);\n const tooltipTranslation = this.getTranslation(`${component.tooltip}`);\n\n return {\n ...component,\n ...(labelTranslation && {label: `${labelTranslation}`}),\n ...(titleTranslation && {title: `${titleTranslation}`}),\n ...(contentTranslation && {content: `${contentTranslation}`}),\n ...(placeholderTranslation && {placeholder: `${placeholderTranslation}`}),\n ...(tooltipTranslation && {tooltip: `${tooltipTranslation}`}),\n };\n };\n\n return this.formMappingService.mapComponents(form, translateFunction);\n }\n\n private getTranslation(translationKey: string): string | boolean {\n const translation = this.translateService.instant(translationKey);\n\n if (translation !== translationKey) {\n return translation;\n } else {\n return false;\n }\n }\n}\n"]}
|
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { NgModule } from '@angular/core';
|
|
17
|
-
import { RouterModule } from '@angular/router';
|
|
18
|
-
import { CommonModule } from '@angular/common';
|
|
19
|
-
const routes = [];
|
|
20
|
-
export class FormRoutingModule {
|
|
21
|
-
}
|
|
22
|
-
FormRoutingModule.decorators = [
|
|
23
|
-
{ type: NgModule, args: [{
|
|
24
|
-
declarations: [],
|
|
25
|
-
imports: [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
},] }
|
|
31
|
-
];
|
|
32
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9ybS1yb3V0aW5nLm1vZHVsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL3ZhbHRpbW8vZm9ybS9zcmMvbGliL2Zvcm0tcm91dGluZy5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7O0dBY0c7QUFFSCxPQUFPLEVBQUMsUUFBUSxFQUFDLE1BQU0sZUFBZSxDQUFDO0FBQ3ZDLE9BQU8sRUFBQyxZQUFZLEVBQVMsTUFBTSxpQkFBaUIsQ0FBQztBQUNyRCxPQUFPLEVBQUMsWUFBWSxFQUFDLE1BQU0saUJBQWlCLENBQUM7QUFFN0MsTUFBTSxNQUFNLEdBQVcsRUFDdEIsQ0FBQztBQVVGLE1BQU0sT0FBTyxpQkFBaUI7OztZQVI3QixRQUFRLFNBQUM7Z0JBQ1IsWUFBWSxFQUFFLEVBQUU7Z0JBQ2hCLE9BQU8sRUFBRTtvQkFDUCxZQUFZO29CQUNaLFlBQVksQ0FBQyxRQUFRLENBQUMsTUFBTSxDQUFDO2lCQUM5QjtnQkFDRCxPQU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vbk1vZHVsZX0gZnJvbSAnQGFuZ3VsYXIvY29tbW9uJztcblxuY29uc3Qgcm91dGVzOiBSb3V0ZXMgPSBbXG5dO1xuXG5ATmdNb2R1bGUoe1xuICBkZWNsYXJhdGlvbnM6IFtdLFxuICBpbXBvcnRzOiBbXG4gICAgQ29tbW9uTW9kdWxlLFxuICAgIFJvdXRlck1vZHVsZS5mb3JDaGlsZChyb3V0ZXMpLFxuICBdLFxuICBleHBvcnRzOiBbUm91dGVyTW9kdWxlXVxufSlcbmV4cG9ydCBjbGFzcyBGb3JtUm91dGluZ01vZHVsZSB7XG59XG4iXX0=
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { NgModule } from '@angular/core';
|
|
17
|
+
import { RouterModule } from '@angular/router';
|
|
18
|
+
import { CommonModule } from '@angular/common';
|
|
19
|
+
const routes = [];
|
|
20
|
+
export class FormRoutingModule {
|
|
21
|
+
}
|
|
22
|
+
FormRoutingModule.decorators = [
|
|
23
|
+
{ type: NgModule, args: [{
|
|
24
|
+
declarations: [],
|
|
25
|
+
imports: [CommonModule, RouterModule.forChild(routes)],
|
|
26
|
+
exports: [RouterModule],
|
|
27
|
+
},] }
|
|
28
|
+
];
|
|
29
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJ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