@valtimo/form 4.22.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/esm2020/lib/form-routing.module.mjs +35 -0
  2. package/esm2020/lib/form.module.mjs +33 -0
  3. package/esm2020/lib/form.service.mjs +44 -0
  4. package/esm2020/lib/services/form-mapping/form-mapping.service.mjs +48 -0
  5. package/esm2020/lib/services/form-translation/form-translation.service.mjs +61 -0
  6. package/esm2020/public_api.mjs +23 -0
  7. package/esm2020/valtimo-form.mjs +5 -0
  8. package/fesm2015/{valtimo-form.js → valtimo-form.mjs} +57 -46
  9. package/fesm2015/valtimo-form.mjs.map +1 -0
  10. package/fesm2020/valtimo-form.mjs +233 -0
  11. package/fesm2020/valtimo-form.mjs.map +1 -0
  12. package/lib/form-routing.module.d.ts +7 -0
  13. package/lib/form-routing.module.d.ts.map +1 -0
  14. package/lib/form.module.d.ts +8 -0
  15. package/lib/form.module.d.ts.map +1 -0
  16. package/lib/form.service.d.ts +4 -0
  17. package/lib/form.service.d.ts.map +1 -0
  18. package/lib/services/form-mapping/form-mapping.service.d.ts +4 -0
  19. package/lib/services/form-mapping/form-mapping.service.d.ts.map +1 -0
  20. package/lib/services/form-translation/form-translation.service.d.ts +4 -0
  21. package/lib/services/form-translation/form-translation.service.d.ts.map +1 -0
  22. package/package.json +22 -10
  23. package/public_api.d.ts +1 -0
  24. package/public_api.d.ts.map +1 -0
  25. package/valtimo-form.d.ts +2 -1
  26. package/valtimo-form.d.ts.map +1 -0
  27. package/bundles/valtimo-form.umd.js +0 -227
  28. package/bundles/valtimo-form.umd.js.map +0 -1
  29. package/bundles/valtimo-form.umd.min.js +0 -2
  30. package/bundles/valtimo-form.umd.min.js.map +0 -1
  31. package/esm2015/lib/form-routing.module.js +0 -29
  32. package/esm2015/lib/form.module.js +0 -28
  33. package/esm2015/lib/form.service.js +0 -45
  34. package/esm2015/lib/services/form-mapping/form-mapping.service.js +0 -40
  35. package/esm2015/lib/services/form-translation/form-translation.service.js +0 -58
  36. package/esm2015/public_api.js +0 -23
  37. package/esm2015/valtimo-form.js +0 -6
  38. package/fesm2015/valtimo-form.js.map +0 -1
  39. package/valtimo-form.metadata.json +0 -1
@@ -0,0 +1,233 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, NgModule } from '@angular/core';
3
+ import { InterceptorSkipHeader } from '@valtimo/security';
4
+ import * as i1 from '@valtimo/config';
5
+ import * as i2 from '@angular/common/http';
6
+ import { CommonModule } from '@angular/common';
7
+ import * as i1$1 from '@angular/router';
8
+ import { RouterModule } from '@angular/router';
9
+ import { FormIoModule } from '@valtimo/components';
10
+ import * as i1$2 from '@ngx-translate/core';
11
+
12
+ /*
13
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
14
+ *
15
+ * Licensed under EUPL, Version 1.2 (the "License");
16
+ * you may not use this file except in compliance with the License.
17
+ * You may obtain a copy of the License at
18
+ *
19
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
20
+ *
21
+ * Unless required by applicable law or agreed to in writing, software
22
+ * distributed under the License is distributed on an "AS IS" basis,
23
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
+ * See the License for the specific language governing permissions and
25
+ * limitations under the License.
26
+ */
27
+ class FormService {
28
+ constructor(configService, http) {
29
+ this.configService = configService;
30
+ this.http = http;
31
+ this.valtimoApiConfig = configService.config.valtimoApi;
32
+ }
33
+ getFormDefinitionByName(formDefinitionName) {
34
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}form/${formDefinitionName}`);
35
+ }
36
+ getFormDefinitionByNamePreFilled(formDefinitionName, documentId) {
37
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}form-association/form-definition/${formDefinitionName}?documentId=${documentId}`, {
38
+ headers: InterceptorSkipHeader
39
+ });
40
+ }
41
+ }
42
+ FormService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormService, deps: [{ token: i1.ConfigService }, { token: i2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
43
+ FormService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormService, providedIn: 'root' });
44
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormService, decorators: [{
45
+ type: Injectable,
46
+ args: [{
47
+ providedIn: 'root',
48
+ }]
49
+ }], ctorParameters: function () { return [{ type: i1.ConfigService }, { type: i2.HttpClient }]; } });
50
+
51
+ /*
52
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
53
+ *
54
+ * Licensed under EUPL, Version 1.2 (the "License");
55
+ * you may not use this file except in compliance with the License.
56
+ * You may obtain a copy of the License at
57
+ *
58
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
59
+ *
60
+ * Unless required by applicable law or agreed to in writing, software
61
+ * distributed under the License is distributed on an "AS IS" basis,
62
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
63
+ * See the License for the specific language governing permissions and
64
+ * limitations under the License.
65
+ */
66
+ const routes = [];
67
+ class FormRoutingModule {
68
+ }
69
+ FormRoutingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
70
+ FormRoutingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormRoutingModule, imports: [CommonModule, i1$1.RouterModule], exports: [RouterModule] });
71
+ FormRoutingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormRoutingModule, imports: [[CommonModule, RouterModule.forChild(routes)], RouterModule] });
72
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormRoutingModule, decorators: [{
73
+ type: NgModule,
74
+ args: [{
75
+ declarations: [],
76
+ imports: [CommonModule, RouterModule.forChild(routes)],
77
+ exports: [RouterModule],
78
+ }]
79
+ }] });
80
+
81
+ /*
82
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
83
+ *
84
+ * Licensed under EUPL, Version 1.2 (the "License");
85
+ * you may not use this file except in compliance with the License.
86
+ * You may obtain a copy of the License at
87
+ *
88
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
89
+ *
90
+ * Unless required by applicable law or agreed to in writing, software
91
+ * distributed under the License is distributed on an "AS IS" basis,
92
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
93
+ * See the License for the specific language governing permissions and
94
+ * limitations under the License.
95
+ */
96
+ class FormModule {
97
+ }
98
+ FormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
99
+ FormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormModule, imports: [CommonModule, FormRoutingModule, FormIoModule] });
100
+ FormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormModule, imports: [[CommonModule, FormRoutingModule, FormIoModule]] });
101
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormModule, decorators: [{
102
+ type: NgModule,
103
+ args: [{
104
+ imports: [CommonModule, FormRoutingModule, FormIoModule],
105
+ exports: [],
106
+ }]
107
+ }] });
108
+
109
+ /*
110
+ * Copyright 2015-2021 Ritense BV, the Netherlands.
111
+ *
112
+ * Licensed under EUPL, Version 1.2 (the "License");
113
+ * you may not use this file except in compliance with the License.
114
+ * You may obtain a copy of the License at
115
+ *
116
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
117
+ *
118
+ * Unless required by applicable law or agreed to in writing, software
119
+ * distributed under the License is distributed on an "AS IS" basis,
120
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
121
+ * See the License for the specific language governing permissions and
122
+ * limitations under the License.
123
+ */
124
+ class FormMappingService {
125
+ mapComponents(form, mappingFunction) {
126
+ const recursiveMappingFunction = (component) => {
127
+ const mappedComponent = mappingFunction(component);
128
+ const innerComponents = component.components;
129
+ if (innerComponents && innerComponents.length > 0) {
130
+ return {
131
+ ...mappedComponent,
132
+ components: innerComponents.map((innerComponent) => recursiveMappingFunction(innerComponent)),
133
+ };
134
+ }
135
+ return mappedComponent;
136
+ };
137
+ return {
138
+ ...form,
139
+ // @ts-ignore
140
+ ...(form?.components?.length > 0 && {
141
+ components: form?.components?.map(component => recursiveMappingFunction(component)),
142
+ }),
143
+ };
144
+ }
145
+ }
146
+ FormMappingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormMappingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
147
+ FormMappingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormMappingService, providedIn: 'root' });
148
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormMappingService, decorators: [{
149
+ type: Injectable,
150
+ args: [{
151
+ providedIn: 'root',
152
+ }]
153
+ }] });
154
+
155
+ /*
156
+ * Copyright 2015-2021 Ritense BV, the Netherlands.
157
+ *
158
+ * Licensed under EUPL, Version 1.2 (the "License");
159
+ * you may not use this file except in compliance with the License.
160
+ * You may obtain a copy of the License at
161
+ *
162
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
163
+ *
164
+ * Unless required by applicable law or agreed to in writing, software
165
+ * distributed under the License is distributed on an "AS IS" basis,
166
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
167
+ * See the License for the specific language governing permissions and
168
+ * limitations under the License.
169
+ */
170
+ class FormTranslationService {
171
+ constructor(translateService, formMappingService) {
172
+ this.translateService = translateService;
173
+ this.formMappingService = formMappingService;
174
+ }
175
+ translateForm(form) {
176
+ const translateFunction = (component) => {
177
+ const labelTranslation = this.getTranslation(`${component.label}`);
178
+ const titleTranslation = this.getTranslation(`${component.title}`);
179
+ const contentTranslation = this.getTranslation(`${component.content}`);
180
+ const placeholderTranslation = this.getTranslation(`${component.placeholder}`);
181
+ const tooltipTranslation = this.getTranslation(`${component.tooltip}`);
182
+ return {
183
+ ...component,
184
+ ...(labelTranslation && { label: `${labelTranslation}` }),
185
+ ...(titleTranslation && { title: `${titleTranslation}` }),
186
+ ...(contentTranslation && { content: `${contentTranslation}` }),
187
+ ...(placeholderTranslation && { placeholder: `${placeholderTranslation}` }),
188
+ ...(tooltipTranslation && { tooltip: `${tooltipTranslation}` }),
189
+ };
190
+ };
191
+ return this.formMappingService.mapComponents(form, translateFunction);
192
+ }
193
+ getTranslation(translationKey) {
194
+ const translation = this.translateService.instant(translationKey);
195
+ if (translation !== translationKey) {
196
+ return translation;
197
+ }
198
+ else {
199
+ return false;
200
+ }
201
+ }
202
+ }
203
+ FormTranslationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormTranslationService, deps: [{ token: i1$2.TranslateService }, { token: FormMappingService }], target: i0.ɵɵFactoryTarget.Injectable });
204
+ FormTranslationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormTranslationService, providedIn: 'root' });
205
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: FormTranslationService, decorators: [{
206
+ type: Injectable,
207
+ args: [{
208
+ providedIn: 'root',
209
+ }]
210
+ }], ctorParameters: function () { return [{ type: i1$2.TranslateService }, { type: FormMappingService }]; } });
211
+
212
+ /*
213
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
214
+ *
215
+ * Licensed under EUPL, Version 1.2 (the "License");
216
+ * you may not use this file except in compliance with the License.
217
+ * You may obtain a copy of the License at
218
+ *
219
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
220
+ *
221
+ * Unless required by applicable law or agreed to in writing, software
222
+ * distributed under the License is distributed on an "AS IS" basis,
223
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
224
+ * See the License for the specific language governing permissions and
225
+ * limitations under the License.
226
+ */
227
+
228
+ /**
229
+ * Generated bundle index. Do not edit.
230
+ */
231
+
232
+ export { FormMappingService, FormModule, FormService, FormTranslationService };
233
+ //# sourceMappingURL=valtimo-form.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"valtimo-form.mjs","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';\nimport {InterceptorSkipHeader} from '@valtimo/security';\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 headers: InterceptorSkipHeader\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 {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"],"names":["i1","i2.FormMappingService"],"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;;;;;AAcG;MAYU,WAAW,CAAA;IAGtB,WAAoB,CAAA,aAA4B,EAAU,IAAgB,EAAA;QAAtD,IAAa,CAAA,aAAA,GAAb,aAAa,CAAe;QAAU,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAY;QACxE,IAAI,CAAC,gBAAgB,GAAG,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC;KACzD;AAED,IAAA,uBAAuB,CAAC,kBAA0B,EAAA;AAChD,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAClB,CAAG,EAAA,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAA,KAAA,EAAQ,kBAAkB,CAAA,CAAE,CACjE,CAAC;KACH;IAED,gCAAgC,CAC9B,kBAA0B,EAC1B,UAAkB,EAAA;AAElB,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAClB,CAAG,EAAA,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAA,iCAAA,EAAoC,kBAAkB,CAAe,YAAA,EAAA,UAAU,EAAE,EAAE;AACrH,YAAA,OAAO,EAAE,qBAAqB;AAC/B,SAAA,CACF,CAAC;KACH;;wGAtBU,WAAW,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,aAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,UAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAX,WAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAA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UAAA,EAAA,CAAA,CAAA;AAAtB,sBAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,sBAAsB,cAFrB,MAAM,EAAA,CAAA,CAAA;2FAEP,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAHlC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;;ACxBD;;;;;;;;;;;;;;AAcG;;ACdH;;AAEG;;;;"}
@@ -1,2 +1,9 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "@angular/common";
3
+ import * as i2 from "@angular/router";
1
4
  export declare class FormRoutingModule {
5
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormRoutingModule, never>;
6
+ static ɵmod: i0.ɵɵNgModuleDeclaration<FormRoutingModule, never, [typeof i1.CommonModule, typeof i2.RouterModule], [typeof i2.RouterModule]>;
7
+ static ɵinj: i0.ɵɵInjectorDeclaration<FormRoutingModule>;
2
8
  }
9
+ //# sourceMappingURL=form-routing.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-routing.module.d.ts","sourceRoot":"","sources":["../../../../projects/valtimo/form/src/lib/form-routing.module.ts"],"names":[],"mappings":";;;AAsBA,qBAKa,iBAAiB;yCAAjB,iBAAiB;0CAAjB,iBAAiB;0CAAjB,iBAAiB;CAAG"}
@@ -1,2 +1,10 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "@angular/common";
3
+ import * as i2 from "./form-routing.module";
4
+ import * as i3 from "@valtimo/components";
1
5
  export declare class FormModule {
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormModule, never>;
7
+ static ɵmod: i0.ɵɵNgModuleDeclaration<FormModule, never, [typeof i1.CommonModule, typeof i2.FormRoutingModule, typeof i3.FormIoModule], never>;
8
+ static ɵinj: i0.ɵɵInjectorDeclaration<FormModule>;
2
9
  }
10
+ //# sourceMappingURL=form.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form.module.d.ts","sourceRoot":"","sources":["../../../../projects/valtimo/form/src/lib/form.module.ts"],"names":[],"mappings":";;;;AAqBA,qBAIa,UAAU;yCAAV,UAAU;0CAAV,UAAU;0CAAV,UAAU;CAAG"}
@@ -2,6 +2,7 @@ import { HttpClient } from '@angular/common/http';
2
2
  import { Observable } from 'rxjs';
3
3
  import { FormioForm } from 'angular-formio';
4
4
  import { ConfigService } from '@valtimo/config';
5
+ import * as i0 from "@angular/core";
5
6
  export declare class FormService {
6
7
  private configService;
7
8
  private http;
@@ -9,4 +10,7 @@ export declare class FormService {
9
10
  constructor(configService: ConfigService, http: HttpClient);
10
11
  getFormDefinitionByName(formDefinitionName: string): Observable<FormioForm>;
11
12
  getFormDefinitionByNamePreFilled(formDefinitionName: string, documentId: string): Observable<FormioForm>;
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormService, never>;
14
+ static ɵprov: i0.ɵɵInjectableDeclaration<FormService>;
12
15
  }
16
+ //# sourceMappingURL=form.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form.service.d.ts","sourceRoot":"","sources":["../../../../projects/valtimo/form/src/lib/form.service.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAC,UAAU,EAAC,MAAM,MAAM,CAAC;AAChC,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;;AAG9C,qBAGa,WAAW;IAGV,OAAO,CAAC,aAAa;IAAiB,OAAO,CAAC,IAAI;IAF9D,OAAO,CAAC,gBAAgB,CAAM;gBAEV,aAAa,EAAE,aAAa,EAAU,IAAI,EAAE,UAAU;IAI1E,uBAAuB,CAAC,kBAAkB,EAAE,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC;IAM3E,gCAAgC,CAC9B,kBAAkB,EAAE,MAAM,EAC1B,UAAU,EAAE,MAAM,GACjB,UAAU,CAAC,UAAU,CAAC;yCAhBd,WAAW;6CAAX,WAAW;CAuBvB"}
@@ -1,5 +1,9 @@
1
1
  import { FormioForm } from 'angular-formio';
2
2
  import { ExtendedComponentSchema } from 'formiojs';
3
+ import * as i0 from "@angular/core";
3
4
  export declare class FormMappingService {
4
5
  mapComponents(form: FormioForm, mappingFunction: (component: ExtendedComponentSchema) => ExtendedComponentSchema): FormioForm;
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormMappingService, never>;
7
+ static ɵprov: i0.ɵɵInjectableDeclaration<FormMappingService>;
5
8
  }
9
+ //# sourceMappingURL=form-mapping.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-mapping.service.d.ts","sourceRoot":"","sources":["../../../../../../projects/valtimo/form/src/lib/services/form-mapping/form-mapping.service.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAC,uBAAuB,EAAC,MAAM,UAAU,CAAC;;AAEjD,qBAGa,kBAAkB;IAC7B,aAAa,CACX,IAAI,EAAE,UAAU,EAChB,eAAe,EAAE,CAAC,SAAS,EAAE,uBAAuB,KAAK,uBAAuB,GAC/E,UAAU;yCAJF,kBAAkB;6CAAlB,kBAAkB;CA6B9B"}
@@ -1,10 +1,14 @@
1
1
  import { TranslateService } from '@ngx-translate/core';
2
2
  import { FormioForm } from 'angular-formio';
3
3
  import { FormMappingService } from '../form-mapping/form-mapping.service';
4
+ import * as i0 from "@angular/core";
4
5
  export declare class FormTranslationService {
5
6
  private readonly translateService;
6
7
  private readonly formMappingService;
7
8
  constructor(translateService: TranslateService, formMappingService: FormMappingService);
8
9
  translateForm(form: FormioForm): FormioForm;
9
10
  private getTranslation;
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormTranslationService, never>;
12
+ static ɵprov: i0.ɵɵInjectableDeclaration<FormTranslationService>;
10
13
  }
14
+ //# sourceMappingURL=form-translation.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-translation.service.d.ts","sourceRoot":"","sources":["../../../../../../projects/valtimo/form/src/lib/services/form-translation/form-translation.service.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAC,kBAAkB,EAAC,MAAM,sCAAsC,CAAC;;AAGxE,qBAGa,sBAAsB;IAE/B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,kBAAkB;gBADlB,gBAAgB,EAAE,gBAAgB,EAClC,kBAAkB,EAAE,kBAAkB;IAGzD,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU;IAqB3C,OAAO,CAAC,cAAc;yCA3BX,sBAAsB;6CAAtB,sBAAsB;CAoClC"}
package/package.json CHANGED
@@ -1,20 +1,32 @@
1
1
  {
2
2
  "name": "@valtimo/form",
3
3
  "license": "EUPL-1.2",
4
- "version": "4.22.0",
4
+ "version": "5.1.0",
5
5
  "peerDependencies": {
6
- "@angular/common": "^10.0.11",
7
- "@angular/core": "^10.0.11"
6
+ "@angular/common": "^13.2.3",
7
+ "@angular/core": "^13.2.3"
8
8
  },
9
9
  "dependencies": {
10
10
  "tslib": "^2.0.0"
11
11
  },
12
- "main": "bundles/valtimo-form.umd.js",
13
- "module": "fesm2015/valtimo-form.js",
14
- "es2015": "fesm2015/valtimo-form.js",
15
- "esm2015": "esm2015/valtimo-form.js",
16
- "fesm2015": "fesm2015/valtimo-form.js",
12
+ "module": "fesm2015/valtimo-form.mjs",
13
+ "es2020": "fesm2020/valtimo-form.mjs",
14
+ "esm2020": "esm2020/valtimo-form.mjs",
15
+ "fesm2020": "fesm2020/valtimo-form.mjs",
16
+ "fesm2015": "fesm2015/valtimo-form.mjs",
17
17
  "typings": "valtimo-form.d.ts",
18
- "metadata": "valtimo-form.metadata.json",
18
+ "exports": {
19
+ "./package.json": {
20
+ "default": "./package.json"
21
+ },
22
+ ".": {
23
+ "types": "./valtimo-form.d.ts",
24
+ "esm2020": "./esm2020/valtimo-form.mjs",
25
+ "es2020": "./fesm2020/valtimo-form.mjs",
26
+ "es2015": "./fesm2015/valtimo-form.mjs",
27
+ "node": "./fesm2015/valtimo-form.mjs",
28
+ "default": "./fesm2020/valtimo-form.mjs"
29
+ }
30
+ },
19
31
  "sideEffects": false
20
- }
32
+ }
package/public_api.d.ts CHANGED
@@ -2,3 +2,4 @@ export * from './lib/form.service';
2
2
  export * from './lib/form.module';
3
3
  export * from './lib/services/form-mapping/form-mapping.service';
4
4
  export * from './lib/services/form-translation/form-translation.service';
5
+ //# sourceMappingURL=public_api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public_api.d.ts","sourceRoot":"","sources":["../../../projects/valtimo/form/src/public_api.ts"],"names":[],"mappings":"AAoBA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kDAAkD,CAAC;AACjE,cAAc,0DAA0D,CAAC"}
package/valtimo-form.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * Generated bundle index. Do not edit.
3
3
  */
4
+ /// <amd-module name="@valtimo/form" />
4
5
  export * from './public_api';
5
- export { FormRoutingModule as ɵa } from './lib/form-routing.module';
6
+ //# sourceMappingURL=valtimo-form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"valtimo-form.d.ts","sourceRoot":"","sources":["../../../projects/valtimo/form/src/valtimo-form.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,cAAc,cAAc,CAAC"}
@@ -1,227 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common/http'), require('@valtimo/config'), require('@angular/common'), require('@angular/router'), require('@valtimo/components'), require('@ngx-translate/core')) :
3
- typeof define === 'function' && define.amd ? define('@valtimo/form', ['exports', '@angular/core', '@angular/common/http', '@valtimo/config', '@angular/common', '@angular/router', '@valtimo/components', '@ngx-translate/core'], factory) :
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
- }(this, (function (exports, i0, i2, i1, common, router, components, i1$1) { 'use strict';
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 }
45
- ]; };
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: [common.CommonModule, router.RouterModule.forChild(routes)],
72
- exports: [router.RouterModule],
73
- },] }
74
- ];
75
-
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
- },] }
101
- ];
102
-
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
- },] }
142
- ];
143
-
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 }
196
- ]; };
197
-
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.
212
- */
213
-
214
- /**
215
- * Generated bundle index. Do not edit.
216
- */
217
-
218
- exports.FormMappingService = FormMappingService;
219
- exports.FormModule = FormModule;
220
- exports.FormService = FormService;
221
- exports.FormTranslationService = FormTranslationService;
222
- exports.ɵa = FormRoutingModule;
223
-
224
- Object.defineProperty(exports, '__esModule', { value: true });
225
-
226
- })));
227
- //# sourceMappingURL=valtimo-form.umd.js.map