@valtimo/form-management 4.23.0 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/esm2020/lib/form-management-create/form-management-create.component.mjs +83 -0
  2. package/esm2020/lib/form-management-edit/form-management-edit.component.mjs +144 -0
  3. package/esm2020/lib/form-management-list/form-management-list.component.mjs +70 -0
  4. package/esm2020/lib/form-management-routing.module.mjs +58 -0
  5. package/esm2020/lib/form-management-upload/form-management-upload.component.mjs +146 -0
  6. package/esm2020/lib/form-management.component.mjs +32 -0
  7. package/esm2020/lib/form-management.module.mjs +86 -0
  8. package/esm2020/lib/form-management.service.mjs +53 -0
  9. package/esm2020/lib/models/form-definition.model.mjs +25 -0
  10. package/esm2020/lib/models/index.mjs +19 -0
  11. package/esm2020/public-api.mjs +23 -0
  12. package/esm2020/valtimo-form-management.mjs +5 -0
  13. package/fesm2015/valtimo-form-management.mjs +693 -0
  14. package/fesm2015/valtimo-form-management.mjs.map +1 -0
  15. package/fesm2020/valtimo-form-management.mjs +691 -0
  16. package/fesm2020/valtimo-form-management.mjs.map +1 -0
  17. package/lib/form-management-create/form-management-create.component.d.ts +4 -0
  18. package/lib/form-management-create/form-management-create.component.d.ts.map +1 -0
  19. package/lib/form-management-edit/form-management-edit.component.d.ts +4 -0
  20. package/lib/form-management-edit/form-management-edit.component.d.ts.map +1 -0
  21. package/lib/form-management-list/form-management-list.component.d.ts +4 -0
  22. package/lib/form-management-list/form-management-list.component.d.ts.map +1 -0
  23. package/lib/form-management-routing.module.d.ts +6 -0
  24. package/lib/form-management-routing.module.d.ts.map +1 -0
  25. package/lib/form-management-upload/form-management-upload.component.d.ts +4 -0
  26. package/lib/form-management-upload/form-management-upload.component.d.ts.map +1 -0
  27. package/lib/form-management.component.d.ts +4 -0
  28. package/lib/form-management.component.d.ts.map +1 -0
  29. package/lib/form-management.module.d.ts +16 -0
  30. package/lib/form-management.module.d.ts.map +1 -0
  31. package/lib/form-management.service.d.ts +4 -0
  32. package/lib/form-management.service.d.ts.map +1 -0
  33. package/lib/models/form-definition.model.d.ts +1 -0
  34. package/lib/models/form-definition.model.d.ts.map +1 -0
  35. package/lib/models/index.d.ts +1 -0
  36. package/lib/models/index.d.ts.map +1 -0
  37. package/package.json +22 -10
  38. package/public-api.d.ts +1 -0
  39. package/public-api.d.ts.map +1 -0
  40. package/valtimo-form-management.d.ts +2 -5
  41. package/valtimo-form-management.d.ts.map +1 -0
  42. package/bundles/valtimo-form-management.umd.js +0 -1017
  43. package/bundles/valtimo-form-management.umd.js.map +0 -1
  44. package/bundles/valtimo-form-management.umd.min.js +0 -2
  45. package/bundles/valtimo-form-management.umd.min.js.map +0 -1
  46. package/esm2015/lib/form-management-create/form-management-create.component.js +0 -87
  47. package/esm2015/lib/form-management-edit/form-management-edit.component.js +0 -149
  48. package/esm2015/lib/form-management-list/form-management-list.component.js +0 -72
  49. package/esm2015/lib/form-management-routing.module.js +0 -54
  50. package/esm2015/lib/form-management-upload/form-management-upload.component.js +0 -148
  51. package/esm2015/lib/form-management.component.js +0 -29
  52. package/esm2015/lib/form-management.module.js +0 -55
  53. package/esm2015/lib/form-management.service.js +0 -57
  54. package/esm2015/lib/models/form-definition.model.js +0 -25
  55. package/esm2015/lib/models/index.js +0 -19
  56. package/esm2015/public-api.js +0 -23
  57. package/esm2015/valtimo-form-management.js +0 -10
  58. package/fesm2015/valtimo-form-management.js +0 -681
  59. package/fesm2015/valtimo-form-management.js.map +0 -1
  60. package/valtimo-form-management.metadata.json +0 -1
@@ -1,1017 +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/router'), require('@valtimo/security'), require('@angular/forms'), require('@valtimo/components'), require('rxjs'), require('rxjs/operators'), require('@angular/common'), require('@ngx-translate/core'), require('@ng-bootstrap/ng-bootstrap'), require('@valtimo/document')) :
3
- typeof define === 'function' && define.amd ? define('@valtimo/form-management', ['exports', '@angular/core', '@angular/common/http', '@valtimo/config', '@angular/router', '@valtimo/security', '@angular/forms', '@valtimo/components', 'rxjs', 'rxjs/operators', '@angular/common', '@ngx-translate/core', '@ng-bootstrap/ng-bootstrap', '@valtimo/document'], factory) :
4
- (global = global || self, factory((global.valtimo = global.valtimo || {}, global.valtimo['form-management'] = {}), global.ng.core, global.ng.common.http, global.config, global.ng.router, global.security, global.ng.forms, global.components, global.rxjs, global.rxjs.operators, global.ng.common, global.core$1, global.ngBootstrap, global.document$1));
5
- }(this, (function (exports, i0, i1, i2, router, security, forms, components, rxjs, operators, common, core, ngBootstrap, document$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 FormManagementService = /** @class */ (function () {
23
- function FormManagementService(http, configService) {
24
- this.http = http;
25
- this.configService = configService;
26
- this.valtimoApiConfig = configService.config.valtimoApi;
27
- }
28
- FormManagementService.prototype.getFormDefinition = function (formDefinitionId) {
29
- return this.http.get(this.valtimoApiConfig.endpointUri + "form-management/" + formDefinitionId);
30
- };
31
- FormManagementService.prototype.queryFormDefinitions = function (params) {
32
- return this.http.get(this.valtimoApiConfig.endpointUri + "form-management", {
33
- observe: 'response',
34
- params: params,
35
- });
36
- };
37
- FormManagementService.prototype.createFormDefinition = function (request) {
38
- return this.http.post(this.valtimoApiConfig.endpointUri + "form-management", request);
39
- };
40
- FormManagementService.prototype.modifyFormDefinition = function (request) {
41
- return this.http.put(this.valtimoApiConfig.endpointUri + "form-management", request);
42
- };
43
- FormManagementService.prototype.deleteFormDefinition = function (formDefinitionId) {
44
- return this.http.delete(this.valtimoApiConfig.endpointUri + "form-management/" + formDefinitionId);
45
- };
46
- return FormManagementService;
47
- }());
48
- FormManagementService.ɵprov = i0.ɵɵdefineInjectable({ factory: function FormManagementService_Factory() { return new FormManagementService(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(i2.ConfigService)); }, token: FormManagementService, providedIn: "root" });
49
- FormManagementService.decorators = [
50
- { type: i0.Injectable, args: [{
51
- providedIn: 'root',
52
- },] }
53
- ];
54
- FormManagementService.ctorParameters = function () { return [
55
- { type: i1.HttpClient },
56
- { type: i2.ConfigService }
57
- ]; };
58
-
59
- /*
60
- * Copyright 2015-2020 Ritense BV, the Netherlands.
61
- *
62
- * Licensed under EUPL, Version 1.2 (the "License");
63
- * you may not use this file except in compliance with the License.
64
- * You may obtain a copy of the License at
65
- *
66
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
67
- *
68
- * Unless required by applicable law or agreed to in writing, software
69
- * distributed under the License is distributed on an "AS IS" basis,
70
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
71
- * See the License for the specific language governing permissions and
72
- * limitations under the License.
73
- */
74
- var FormManagementComponent = /** @class */ (function () {
75
- function FormManagementComponent() {
76
- }
77
- FormManagementComponent.prototype.ngOnInit = function () { };
78
- return FormManagementComponent;
79
- }());
80
- FormManagementComponent.decorators = [
81
- { type: i0.Component, args: [{
82
- selector: 'valtimo-form-management',
83
- template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"main-content pt-0\">\n <div class=\"container-fluid\">\n <div class=\"text-right\">\n <div class=\"btn-group mt-m3px mb-3\">\n <button\n [routerLink]=\"'create'\"\n [queryParams]=\"{upload: 'true'}\"\n class=\"btn btn-secondary btn-space\"\n >\n <i class=\"icon mdi mdi-upload mr-1\"></i>\n {{ 'Upload' | translate }}\n </button>\n <button [routerLink]=\"'create'\" class=\"btn btn-primary btn-space mr-0\">\n <i class=\"icon mdi mdi-plus mr-1\"></i>\n <span>{{ 'Create new Form' | translate }}</span>\n </button>\n </div>\n </div>\n <valtimo-widget>\n <valtimo-form-management-list></valtimo-form-management-list>\n </valtimo-widget>\n </div>\n</div>\n",
84
- styles: ["/*!\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */"]
85
- },] }
86
- ];
87
- FormManagementComponent.ctorParameters = function () { return []; };
88
-
89
- /*! *****************************************************************************
90
- Copyright (c) Microsoft Corporation.
91
-
92
- Permission to use, copy, modify, and/or distribute this software for any
93
- purpose with or without fee is hereby granted.
94
-
95
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
96
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
97
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
98
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
99
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
100
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
101
- PERFORMANCE OF THIS SOFTWARE.
102
- ***************************************************************************** */
103
- /* global Reflect, Promise */
104
- var extendStatics = function (d, b) {
105
- extendStatics = Object.setPrototypeOf ||
106
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
107
- function (d, b) { for (var p in b)
108
- if (Object.prototype.hasOwnProperty.call(b, p))
109
- d[p] = b[p]; };
110
- return extendStatics(d, b);
111
- };
112
- function __extends(d, b) {
113
- if (typeof b !== "function" && b !== null)
114
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
115
- extendStatics(d, b);
116
- function __() { this.constructor = d; }
117
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
118
- }
119
- var __assign = function () {
120
- __assign = Object.assign || function __assign(t) {
121
- for (var s, i = 1, n = arguments.length; i < n; i++) {
122
- s = arguments[i];
123
- for (var p in s)
124
- if (Object.prototype.hasOwnProperty.call(s, p))
125
- t[p] = s[p];
126
- }
127
- return t;
128
- };
129
- return __assign.apply(this, arguments);
130
- };
131
- function __rest(s, e) {
132
- var t = {};
133
- for (var p in s)
134
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
135
- t[p] = s[p];
136
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
137
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
138
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
139
- t[p[i]] = s[p[i]];
140
- }
141
- return t;
142
- }
143
- function __decorate(decorators, target, key, desc) {
144
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
145
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
146
- r = Reflect.decorate(decorators, target, key, desc);
147
- else
148
- for (var i = decorators.length - 1; i >= 0; i--)
149
- if (d = decorators[i])
150
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
151
- return c > 3 && r && Object.defineProperty(target, key, r), r;
152
- }
153
- function __param(paramIndex, decorator) {
154
- return function (target, key) { decorator(target, key, paramIndex); };
155
- }
156
- function __metadata(metadataKey, metadataValue) {
157
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
158
- return Reflect.metadata(metadataKey, metadataValue);
159
- }
160
- function __awaiter(thisArg, _arguments, P, generator) {
161
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
162
- return new (P || (P = Promise))(function (resolve, reject) {
163
- function fulfilled(value) { try {
164
- step(generator.next(value));
165
- }
166
- catch (e) {
167
- reject(e);
168
- } }
169
- function rejected(value) { try {
170
- step(generator["throw"](value));
171
- }
172
- catch (e) {
173
- reject(e);
174
- } }
175
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
176
- step((generator = generator.apply(thisArg, _arguments || [])).next());
177
- });
178
- }
179
- function __generator(thisArg, body) {
180
- var _ = { label: 0, sent: function () { if (t[0] & 1)
181
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
182
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
183
- function verb(n) { return function (v) { return step([n, v]); }; }
184
- function step(op) {
185
- if (f)
186
- throw new TypeError("Generator is already executing.");
187
- while (_)
188
- try {
189
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
190
- return t;
191
- if (y = 0, t)
192
- op = [op[0] & 2, t.value];
193
- switch (op[0]) {
194
- case 0:
195
- case 1:
196
- t = op;
197
- break;
198
- case 4:
199
- _.label++;
200
- return { value: op[1], done: false };
201
- case 5:
202
- _.label++;
203
- y = op[1];
204
- op = [0];
205
- continue;
206
- case 7:
207
- op = _.ops.pop();
208
- _.trys.pop();
209
- continue;
210
- default:
211
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
212
- _ = 0;
213
- continue;
214
- }
215
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
216
- _.label = op[1];
217
- break;
218
- }
219
- if (op[0] === 6 && _.label < t[1]) {
220
- _.label = t[1];
221
- t = op;
222
- break;
223
- }
224
- if (t && _.label < t[2]) {
225
- _.label = t[2];
226
- _.ops.push(op);
227
- break;
228
- }
229
- if (t[2])
230
- _.ops.pop();
231
- _.trys.pop();
232
- continue;
233
- }
234
- op = body.call(thisArg, _);
235
- }
236
- catch (e) {
237
- op = [6, e];
238
- y = 0;
239
- }
240
- finally {
241
- f = t = 0;
242
- }
243
- if (op[0] & 5)
244
- throw op[1];
245
- return { value: op[0] ? op[1] : void 0, done: true };
246
- }
247
- }
248
- var __createBinding = Object.create ? (function (o, m, k, k2) {
249
- if (k2 === undefined)
250
- k2 = k;
251
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
252
- }) : (function (o, m, k, k2) {
253
- if (k2 === undefined)
254
- k2 = k;
255
- o[k2] = m[k];
256
- });
257
- function __exportStar(m, o) {
258
- for (var p in m)
259
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
260
- __createBinding(o, m, p);
261
- }
262
- function __values(o) {
263
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
264
- if (m)
265
- return m.call(o);
266
- if (o && typeof o.length === "number")
267
- return {
268
- next: function () {
269
- if (o && i >= o.length)
270
- o = void 0;
271
- return { value: o && o[i++], done: !o };
272
- }
273
- };
274
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
275
- }
276
- function __read(o, n) {
277
- var m = typeof Symbol === "function" && o[Symbol.iterator];
278
- if (!m)
279
- return o;
280
- var i = m.call(o), r, ar = [], e;
281
- try {
282
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
283
- ar.push(r.value);
284
- }
285
- catch (error) {
286
- e = { error: error };
287
- }
288
- finally {
289
- try {
290
- if (r && !r.done && (m = i["return"]))
291
- m.call(i);
292
- }
293
- finally {
294
- if (e)
295
- throw e.error;
296
- }
297
- }
298
- return ar;
299
- }
300
- /** @deprecated */
301
- function __spread() {
302
- for (var ar = [], i = 0; i < arguments.length; i++)
303
- ar = ar.concat(__read(arguments[i]));
304
- return ar;
305
- }
306
- /** @deprecated */
307
- function __spreadArrays() {
308
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
309
- s += arguments[i].length;
310
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
311
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
312
- r[k] = a[j];
313
- return r;
314
- }
315
- function __spreadArray(to, from, pack) {
316
- if (pack || arguments.length === 2)
317
- for (var i = 0, l = from.length, ar; i < l; i++) {
318
- if (ar || !(i in from)) {
319
- if (!ar)
320
- ar = Array.prototype.slice.call(from, 0, i);
321
- ar[i] = from[i];
322
- }
323
- }
324
- return to.concat(ar || Array.prototype.slice.call(from));
325
- }
326
- function __await(v) {
327
- return this instanceof __await ? (this.v = v, this) : new __await(v);
328
- }
329
- function __asyncGenerator(thisArg, _arguments, generator) {
330
- if (!Symbol.asyncIterator)
331
- throw new TypeError("Symbol.asyncIterator is not defined.");
332
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
333
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
334
- function verb(n) { if (g[n])
335
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
336
- function resume(n, v) { try {
337
- step(g[n](v));
338
- }
339
- catch (e) {
340
- settle(q[0][3], e);
341
- } }
342
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
343
- function fulfill(value) { resume("next", value); }
344
- function reject(value) { resume("throw", value); }
345
- function settle(f, v) { if (f(v), q.shift(), q.length)
346
- resume(q[0][0], q[0][1]); }
347
- }
348
- function __asyncDelegator(o) {
349
- var i, p;
350
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
351
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
352
- }
353
- function __asyncValues(o) {
354
- if (!Symbol.asyncIterator)
355
- throw new TypeError("Symbol.asyncIterator is not defined.");
356
- var m = o[Symbol.asyncIterator], i;
357
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
358
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
359
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
360
- }
361
- function __makeTemplateObject(cooked, raw) {
362
- if (Object.defineProperty) {
363
- Object.defineProperty(cooked, "raw", { value: raw });
364
- }
365
- else {
366
- cooked.raw = raw;
367
- }
368
- return cooked;
369
- }
370
- ;
371
- var __setModuleDefault = Object.create ? (function (o, v) {
372
- Object.defineProperty(o, "default", { enumerable: true, value: v });
373
- }) : function (o, v) {
374
- o["default"] = v;
375
- };
376
- function __importStar(mod) {
377
- if (mod && mod.__esModule)
378
- return mod;
379
- var result = {};
380
- if (mod != null)
381
- for (var k in mod)
382
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
383
- __createBinding(result, mod, k);
384
- __setModuleDefault(result, mod);
385
- return result;
386
- }
387
- function __importDefault(mod) {
388
- return (mod && mod.__esModule) ? mod : { default: mod };
389
- }
390
- function __classPrivateFieldGet(receiver, state, kind, f) {
391
- if (kind === "a" && !f)
392
- throw new TypeError("Private accessor was defined without a getter");
393
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
394
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
395
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
396
- }
397
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
398
- if (kind === "m")
399
- throw new TypeError("Private method is not writable");
400
- if (kind === "a" && !f)
401
- throw new TypeError("Private accessor was defined without a setter");
402
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
403
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
404
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
405
- }
406
-
407
- var FormManagementCreateComponent = /** @class */ (function () {
408
- function FormManagementCreateComponent(formManagementService, formBuilder, router, alertService, route) {
409
- this.formManagementService = formManagementService;
410
- this.formBuilder = formBuilder;
411
- this.router = router;
412
- this.alertService = alertService;
413
- this.route = route;
414
- }
415
- Object.defineProperty(FormManagementCreateComponent.prototype, "formControls", {
416
- get: function () {
417
- return this.form.controls;
418
- },
419
- enumerable: false,
420
- configurable: true
421
- });
422
- FormManagementCreateComponent.prototype.ngOnInit = function () {
423
- this.form = this.formBuilder.group({
424
- name: new forms.FormControl('', forms.Validators.required),
425
- });
426
- };
427
- FormManagementCreateComponent.prototype.reset = function () {
428
- this.form.setValue({
429
- name: '',
430
- });
431
- };
432
- FormManagementCreateComponent.prototype.createFormDefinition = function () {
433
- var _this = this;
434
- var emptyForm = {
435
- display: 'form',
436
- components: [],
437
- };
438
- var request = {
439
- name: this.form.value.name,
440
- formDefinition: JSON.stringify(emptyForm),
441
- };
442
- rxjs.combineLatest([
443
- this.formManagementService.createFormDefinition(request),
444
- this.route.queryParams,
445
- ])
446
- .pipe(operators.take(1))
447
- .subscribe(function (_a) {
448
- var _b = __read(_a, 2), formDefinition = _b[0], params = _b[1];
449
- _this.alertService.success('Created new Form');
450
- if ((params === null || params === void 0 ? void 0 : params.upload) === 'true') {
451
- _this.router.navigate(['/form-management/edit', formDefinition.id], {
452
- queryParams: { upload: 'true' },
453
- });
454
- }
455
- else {
456
- _this.router.navigate(['/form-management/edit', formDefinition.id]);
457
- }
458
- }, function (err) {
459
- _this.alertService.error('Error creating new Form');
460
- });
461
- };
462
- return FormManagementCreateComponent;
463
- }());
464
- FormManagementCreateComponent.decorators = [
465
- { type: i0.Component, args: [{
466
- selector: 'valtimo-form-management-create',
467
- template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"main-content\">\n <div class=\"container-fluid\">\n <div class=\"col-12 px-0 mb-5\">\n <valtimo-widget>\n <div class=\"bg-white p-5\">\n <form [formGroup]=\"form\" (ngSubmit)=\"createFormDefinition()\">\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"name\">{{\n 'formManagement.name' | translate\n }}</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input\n type=\"text\"\n id=\"name\"\n formControlName=\"name\"\n class=\"form-control\"\n placeholder=\"Form definition name\"\n [ngClass]=\"{\n 'is-valid': formControls.name.touched && formControls.name.valid,\n 'is-invalid': formControls.name.touched && formControls.name.errors\n }\"\n required\n />\n <div\n *ngIf=\"formControls.name.touched && formControls.name.errors\"\n class=\"invalid-feedback\"\n >\n <div *ngIf=\"formControls.name.errors.required\">\n {{ 'formManagement.nameIsRequired' | translate }}\n </div>\n </div>\n </div>\n </div>\n <div class=\"row pt-3 mt-1\">\n <div class=\"col-12 col-sm-6 text-left\">\n <a [routerLink]=\"'/forms'\" class=\"btn btn-space btn-default\">{{\n 'formManagement.back' | translate\n }}</a>\n </div>\n <div class=\"col-12 col-sm-6 text-right\">\n <button class=\"btn btn-space btn-secondary\" type=\"button\" (click)=\"reset()\">\n {{ 'formManagement.reset' | translate }}\n </button>\n <button class=\"btn btn-space btn-primary\" type=\"submit\" [disabled]=\"form.invalid\">\n {{ 'formManagement.submit' | translate }}\n </button>\n </div>\n </div>\n </form>\n </div>\n </valtimo-widget>\n </div>\n </div>\n</div>\n",
468
- styles: ["/*!\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */"]
469
- },] }
470
- ];
471
- FormManagementCreateComponent.ctorParameters = function () { return [
472
- { type: FormManagementService },
473
- { type: forms.FormBuilder },
474
- { type: router.Router },
475
- { type: components.AlertService },
476
- { type: router.ActivatedRoute }
477
- ]; };
478
-
479
- /*
480
- * Copyright 2015-2020 Ritense BV, the Netherlands.
481
- *
482
- * Licensed under EUPL, Version 1.2 (the "License");
483
- * you may not use this file except in compliance with the License.
484
- * You may obtain a copy of the License at
485
- *
486
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
487
- *
488
- * Unless required by applicable law or agreed to in writing, software
489
- * distributed under the License is distributed on an "AS IS" basis,
490
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
491
- * See the License for the specific language governing permissions and
492
- * limitations under the License.
493
- */
494
- var FormManagementEditComponent = /** @class */ (function () {
495
- function FormManagementEditComponent(formManagementService, alertService, route, router) {
496
- this.formManagementService = formManagementService;
497
- this.alertService = alertService;
498
- this.route = route;
499
- this.router = router;
500
- this.showModal$ = new rxjs.BehaviorSubject(false);
501
- this.reloading$ = new rxjs.BehaviorSubject(false);
502
- this.modifiedFormDefinition = null;
503
- this.formDefinition = null;
504
- this.alertSub = rxjs.Subscription.EMPTY;
505
- this.formDefinitionId = null;
506
- }
507
- FormManagementEditComponent.prototype.ngOnInit = function () {
508
- this.loadFormDefinition();
509
- this.checkToOpenUploadModal();
510
- };
511
- FormManagementEditComponent.prototype.ngOnDestroy = function () {
512
- this.alertSub.unsubscribe();
513
- };
514
- FormManagementEditComponent.prototype.loadFormDefinition = function () {
515
- var _this = this;
516
- this.formDefinitionId = this.route.snapshot.paramMap.get('id');
517
- this.formManagementService.getFormDefinition(this.formDefinitionId).subscribe(function (formDefinition) {
518
- _this.formDefinition = formDefinition;
519
- }, function () {
520
- _this.alertService.error('Error retrieving Form Definition');
521
- });
522
- };
523
- FormManagementEditComponent.prototype.modifyFormDefinition = function () {
524
- var _this = this;
525
- var form = JSON.stringify(this.modifiedFormDefinition != null
526
- ? this.modifiedFormDefinition
527
- : this.formDefinition.formDefinition);
528
- var request = {
529
- id: this.formDefinition.id,
530
- name: this.formDefinition.name,
531
- formDefinition: form,
532
- };
533
- this.formManagementService.modifyFormDefinition(request).subscribe(function () {
534
- _this.router.navigate(['/form-management']);
535
- _this.alertService.success('Form deployed');
536
- }, function (err) {
537
- _this.alertService.error('Error deploying Form');
538
- });
539
- };
540
- FormManagementEditComponent.prototype.formBuilderChanged = function (event) {
541
- this.modifiedFormDefinition = event.form;
542
- };
543
- FormManagementEditComponent.prototype.delete = function () {
544
- var _this = this;
545
- if (!this.alertSub.closed) {
546
- return;
547
- }
548
- var mssg = 'Delete Form?';
549
- var confirmations = [
550
- {
551
- label: 'Cancel',
552
- class: 'btn btn-default',
553
- value: false,
554
- },
555
- {
556
- label: 'Delete',
557
- class: 'btn btn-primary',
558
- value: true,
559
- },
560
- ];
561
- this.alertService.notification(mssg, confirmations);
562
- this.alertSub = this.alertService
563
- .getAlertConfirmChangeEmitter()
564
- .pipe(operators.first())
565
- .subscribe(function (alert) {
566
- if (alert.confirm === true) {
567
- _this.deleteFormDefinition();
568
- }
569
- });
570
- };
571
- FormManagementEditComponent.prototype.deleteFormDefinition = function () {
572
- var _this = this;
573
- this.formManagementService.deleteFormDefinition(this.formDefinition.id).subscribe(function () {
574
- _this.router.navigate(['/form-management']);
575
- _this.alertService.success('Form deleted');
576
- }, function (err) {
577
- _this.alertService.error('Error deleting Form');
578
- });
579
- };
580
- FormManagementEditComponent.prototype.downloadFormDefinition = function () {
581
- var file = new Blob([JSON.stringify(this.formDefinition)], { type: 'text/json' });
582
- var link = document.createElement('a');
583
- link.download = "form_" + this.formDefinition.name + ".json";
584
- link.href = window.URL.createObjectURL(file);
585
- link.click();
586
- window.URL.revokeObjectURL(link.href);
587
- link.remove();
588
- };
589
- FormManagementEditComponent.prototype.showModal = function () {
590
- this.showModal$.next(true);
591
- };
592
- FormManagementEditComponent.prototype.setFormDefinition = function (formDefinition) {
593
- var _a;
594
- this.reloading$.next(true);
595
- var definition = JSON.parse(formDefinition);
596
- var components = (_a = definition === null || definition === void 0 ? void 0 : definition.formDefinition) === null || _a === void 0 ? void 0 : _a.components;
597
- var currentDefinition = this.modifiedFormDefinition || this.formDefinition.formDefinition;
598
- var newDefinition = Object.assign(Object.assign({}, currentDefinition), (components && { components: components }));
599
- this.modifiedFormDefinition = newDefinition;
600
- this.formDefinition.formDefinition = newDefinition;
601
- this.reloading$.next(false);
602
- };
603
- FormManagementEditComponent.prototype.checkToOpenUploadModal = function () {
604
- var _this = this;
605
- this.route.queryParams.pipe(operators.take(1)).subscribe(function (params) {
606
- if ((params === null || params === void 0 ? void 0 : params.upload) === 'true') {
607
- _this.showModal();
608
- }
609
- });
610
- };
611
- return FormManagementEditComponent;
612
- }());
613
- FormManagementEditComponent.decorators = [
614
- { type: i0.Component, args: [{
615
- selector: 'valtimo-form-management-edit',
616
- template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"main-content pt-0\">\n <div class=\"container-fluid\" *ngIf=\"formDefinition\">\n <div class=\"btn-group mt-m3px mb-3 float-right\">\n <button class=\"btn btn-primary btn-space\" (click)=\"downloadFormDefinition()\">\n <i class=\"icon mdi mdi-download mr-1\"></i>\n {{ 'Download' | translate }}\n </button>\n <button\n class=\"btn btn-secondary btn-space\"\n (click)=\"showModal()\"\n [disabled]=\"formDefinition.readOnly\"\n >\n <i class=\"icon mdi mdi-upload mr-1\"></i>\n {{ 'Upload' | translate }}\n </button>\n <button\n class=\"btn btn-danger btn-space\"\n (click)=\"delete()\"\n [disabled]=\"formDefinition.readOnly\"\n >\n <i class=\"icon mdi mdi-delete mr-1\"></i>{{ 'formManagement.delete' | translate }}\n </button>\n <button\n class=\"btn btn-success btn-space\"\n (click)=\"modifyFormDefinition()\"\n [disabled]=\"formDefinition.readOnly\"\n >\n <i class=\"icon mdi mdi-upload mr-1\"></i>{{ 'formManagement.deploy' | translate }}\n </button>\n </div>\n <div class=\"clearfix\"></div>\n <div class=\"bg-light formbuilder-header overflow-auto\">\n <h3 class=\"formbuilder-title\">\n {{ formDefinition.name }}\n <div *ngIf=\"formDefinition.readOnly\" class=\"pull-right\">\n <span class=\"badge badge-pill badge-info increase-size\">{{\n 'formManagement.readOnly' | translate\n }}</span>\n </div>\n </h3>\n </div>\n <ng-container *ngIf=\"!(reloading$ | async)\">\n <valtimo-form-io-builder\n [form]=\"formDefinition.formDefinition\"\n (change)=\"formBuilderChanged($event)\"\n ></valtimo-form-io-builder>\n </ng-container>\n </div>\n</div>\n\n<valtimo-form-management-upload\n [show$]=\"showModal$\"\n (definitionUploaded)=\"setFormDefinition($event)\"\n></valtimo-form-management-upload>\n",
617
- encapsulation: i0.ViewEncapsulation.None,
618
- styles: ["/*!\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.btn.formcomponent.gu-mirror,.formbuilder .btn.formcomponent.drag-copy{background-color:silver;border-color:silver;color:#fff;font-weight:400}.btn.formcomponent.gu-mirror:active,.btn.formcomponent.gu-mirror:hover,.formbuilder .btn.formcomponent.drag-copy:active,.formbuilder .btn.formcomponent.drag-copy:hover{box-shadow:none}.btn.formcomponent.gu-mirror:active,.formbuilder .btn.formcomponent.drag-copy:active{background-color:silver;border-color:silver}.formbuilder-header{border:1px solid #dee2e6;border-bottom:0;font-size:18px;height:80px;padding-left:18px;padding-right:18px}.formbuilder-header .formbuilder-title{margin-bottom:7px;margin-top:21px}.formbuilder-header .formbuilder-subtitle{margin-bottom:12px;margin-top:0}.formbuilder{background:#fff;border:1px solid #dee2e6;margin-left:0!important;margin-right:0!important;padding:1rem}.formbuilder .form-builder-panel .builder-group-button[aria-expanded=\"\"],.formbuilder .form-builder-panel .builder-group-button[aria-expanded=false]{color:#a9a9a9}.formbuilder .form-builder-panel .builder-group-button[aria-expanded=true]{color:#000}.formbuilder .drag-and-drop-alert{display:none}.formbuilder .formarea{background-color:#fff;border:1px solid silver;padding:10px}.increase-size{font-size:1rem}"]
619
- },] }
620
- ];
621
- FormManagementEditComponent.ctorParameters = function () { return [
622
- { type: FormManagementService },
623
- { type: components.AlertService },
624
- { type: router.ActivatedRoute },
625
- { type: router.Router }
626
- ]; };
627
-
628
- /*
629
- * Copyright 2015-2020 Ritense BV, the Netherlands.
630
- *
631
- * Licensed under EUPL, Version 1.2 (the "License");
632
- * you may not use this file except in compliance with the License.
633
- * You may obtain a copy of the License at
634
- *
635
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
636
- *
637
- * Unless required by applicable law or agreed to in writing, software
638
- * distributed under the License is distributed on an "AS IS" basis,
639
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
640
- * See the License for the specific language governing permissions and
641
- * limitations under the License.
642
- */
643
- var ɵ0 = { title: 'Form management', roles: [i2.ROLE_ADMIN] }, ɵ1 = { title: 'Create new Form', roles: [i2.ROLE_ADMIN] }, ɵ2 = { title: 'Form Builder', roles: [i2.ROLE_ADMIN] };
644
- var routes = [
645
- {
646
- path: 'form-management',
647
- component: FormManagementComponent,
648
- canActivate: [security.AuthGuardService],
649
- data: ɵ0,
650
- },
651
- {
652
- path: 'form-management/create',
653
- component: FormManagementCreateComponent,
654
- canActivate: [security.AuthGuardService],
655
- data: ɵ1,
656
- },
657
- {
658
- path: 'form-management/edit/:id',
659
- component: FormManagementEditComponent,
660
- canActivate: [security.AuthGuardService],
661
- data: ɵ2,
662
- },
663
- ];
664
- var FormManagementRoutingModule = /** @class */ (function () {
665
- function FormManagementRoutingModule() {
666
- }
667
- return FormManagementRoutingModule;
668
- }());
669
- FormManagementRoutingModule.decorators = [
670
- { type: i0.NgModule, args: [{
671
- imports: [router.RouterModule.forChild(routes)],
672
- exports: [router.RouterModule],
673
- declarations: [],
674
- },] }
675
- ];
676
-
677
- /*
678
- * Copyright 2015-2020 Ritense BV, the Netherlands.
679
- *
680
- * Licensed under EUPL, Version 1.2 (the "License");
681
- * you may not use this file except in compliance with the License.
682
- * You may obtain a copy of the License at
683
- *
684
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
685
- *
686
- * Unless required by applicable law or agreed to in writing, software
687
- * distributed under the License is distributed on an "AS IS" basis,
688
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
689
- * See the License for the specific language governing permissions and
690
- * limitations under the License.
691
- */
692
- var FormManagementListComponent = /** @class */ (function () {
693
- function FormManagementListComponent(formManagementService, router) {
694
- this.formManagementService = formManagementService;
695
- this.router = router;
696
- this.formDefinitions = [];
697
- this.formDefinitionFields = [
698
- { key: 'name', label: 'Name' },
699
- { key: 'readOnly', label: 'Read-only' },
700
- ];
701
- this.pagination = {
702
- collectionSize: 0,
703
- page: 1,
704
- size: 10,
705
- maxPaginationItemSize: 5,
706
- };
707
- this.pageParam = 0;
708
- }
709
- FormManagementListComponent.prototype.paginationClicked = function (page) {
710
- this.pageParam = page - 1;
711
- this.loadFormDefinitions();
712
- };
713
- FormManagementListComponent.prototype.ngOnInit = function () { };
714
- FormManagementListComponent.prototype.paginationSet = function () {
715
- this.loadFormDefinitions();
716
- };
717
- FormManagementListComponent.prototype.loadFormDefinitions = function (searchTerm) {
718
- var _this = this;
719
- var params = { page: this.pageParam, size: this.pagination.size };
720
- if (searchTerm) {
721
- params['searchTerm'] = searchTerm;
722
- }
723
- this.formManagementService.queryFormDefinitions(params).subscribe(function (results) {
724
- _this.pagination.collectionSize = results.body.totalElements;
725
- _this.formDefinitions = results.body.content;
726
- });
727
- };
728
- FormManagementListComponent.prototype.editFormDefinition = function (formDefinition) {
729
- this.router.navigate(['/form-management/edit', formDefinition.id]);
730
- };
731
- FormManagementListComponent.prototype.searchTermEntered = function (searchTerm) {
732
- this.loadFormDefinitions(searchTerm);
733
- };
734
- return FormManagementListComponent;
735
- }());
736
- FormManagementListComponent.decorators = [
737
- { type: i0.Component, args: [{
738
- selector: 'valtimo-form-management-list',
739
- template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<valtimo-list\n [items]=\"formDefinitions\"\n [fields]=\"formDefinitionFields\"\n [viewMode]=\"true\"\n [isSearchable]=\"true\"\n [pagination]=\"pagination\"\n paginationIdentifier=\"formManagementList\"\n (paginationClicked)=\"paginationClicked($event)\"\n (paginationSet)=\"paginationSet()\"\n (rowClicked)=\"editFormDefinition($event)\"\n [header]=\"true\"\n (search)=\"searchTermEntered($event)\"\n>\n <div header>\n <h3 class=\"list-header-title\">{{ 'Forms' | translate }}</h3>\n <h5 class=\"list-header-description\">{{ 'Overview of all Forms' | translate }}</h5>\n </div>\n</valtimo-list>\n",
740
- styles: ["/*!\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */"]
741
- },] }
742
- ];
743
- FormManagementListComponent.ctorParameters = function () { return [
744
- { type: FormManagementService },
745
- { type: router.Router }
746
- ]; };
747
-
748
- /*
749
- * Copyright 2015-2020 Ritense BV, the Netherlands.
750
- *
751
- * Licensed under EUPL, Version 1.2 (the "License");
752
- * you may not use this file except in compliance with the License.
753
- * You may obtain a copy of the License at
754
- *
755
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
756
- *
757
- * Unless required by applicable law or agreed to in writing, software
758
- * distributed under the License is distributed on an "AS IS" basis,
759
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
760
- * See the License for the specific language governing permissions and
761
- * limitations under the License.
762
- */
763
- var FormManagementUploadComponent = /** @class */ (function () {
764
- function FormManagementUploadComponent(documentService, translateService) {
765
- this.documentService = documentService;
766
- this.translateService = translateService;
767
- this.definitionUploaded = new i0.EventEmitter();
768
- this.clear$ = new rxjs.Subject();
769
- this.jsonString$ = new rxjs.BehaviorSubject('');
770
- this.error$ = new rxjs.BehaviorSubject('');
771
- this.disabled$ = new rxjs.BehaviorSubject(false);
772
- this.file$ = new rxjs.BehaviorSubject(undefined);
773
- }
774
- FormManagementUploadComponent.prototype.ngAfterViewInit = function () {
775
- this.openShowSubscription();
776
- this.openFileSubscription();
777
- };
778
- FormManagementUploadComponent.prototype.ngOnDestroy = function () {
779
- this.showSubscription.unsubscribe();
780
- this.fileSubscription.unsubscribe();
781
- this.closeErrorSubscription();
782
- };
783
- FormManagementUploadComponent.prototype.setFile = function (file) {
784
- this.clearError();
785
- this.file$.next(file);
786
- };
787
- FormManagementUploadComponent.prototype.uploadDefinition = function () {
788
- var _this = this;
789
- this.disable();
790
- this.jsonString$.pipe(operators.take(1)).subscribe(function (definition) {
791
- _this.closeErrorSubscription();
792
- _this.clearError();
793
- _this.enable();
794
- _this.hideModal();
795
- _this.definitionUploaded.emit(definition);
796
- });
797
- };
798
- FormManagementUploadComponent.prototype.openErrorSubscription = function (errorCode) {
799
- var _this = this;
800
- this.closeErrorSubscription();
801
- this.errorSubscription = this.translateService.stream(errorCode).subscribe(function (error) {
802
- _this.error$.next(error);
803
- });
804
- };
805
- FormManagementUploadComponent.prototype.closeErrorSubscription = function () {
806
- if (this.errorSubscription) {
807
- this.errorSubscription.unsubscribe();
808
- }
809
- };
810
- FormManagementUploadComponent.prototype.clearError = function () {
811
- this.error$.next('');
812
- };
813
- FormManagementUploadComponent.prototype.openFileSubscription = function () {
814
- var _this = this;
815
- this.fileSubscription = this.file$.subscribe(function (file) {
816
- if (file) {
817
- var reader_1 = new FileReader();
818
- reader_1.onloadend = function () {
819
- var result = reader_1.result.toString();
820
- if (_this.stringIsValidJson(result)) {
821
- _this.jsonString$.next(result);
822
- }
823
- };
824
- reader_1.readAsText(file);
825
- }
826
- else {
827
- _this.clearJsonString();
828
- }
829
- });
830
- };
831
- FormManagementUploadComponent.prototype.openShowSubscription = function () {
832
- var _this = this;
833
- this.showSubscription = this.show$.subscribe(function (show) {
834
- if (show) {
835
- _this.showModal();
836
- }
837
- else {
838
- _this.hideModal();
839
- }
840
- _this.clearJsonString();
841
- _this.clearError();
842
- _this.clearDropzone();
843
- });
844
- };
845
- FormManagementUploadComponent.prototype.clearJsonString = function () {
846
- this.jsonString$.next('');
847
- };
848
- FormManagementUploadComponent.prototype.clearDropzone = function () {
849
- this.clear$.next();
850
- };
851
- FormManagementUploadComponent.prototype.showModal = function () {
852
- this.modal.show();
853
- };
854
- FormManagementUploadComponent.prototype.hideModal = function () {
855
- this.modal.hide();
856
- };
857
- FormManagementUploadComponent.prototype.stringIsValidJson = function (string) {
858
- var _a, _b;
859
- try {
860
- // tslint:disable-next-line
861
- (_b = (_a = JSON.parse(string)) === null || _a === void 0 ? void 0 : _a.formDefinition) === null || _b === void 0 ? void 0 : _b.components;
862
- }
863
- catch (e) {
864
- this.clearDropzone();
865
- this.openErrorSubscription('dropzone.error.invalidFormDef');
866
- return false;
867
- }
868
- return true;
869
- };
870
- FormManagementUploadComponent.prototype.disable = function () {
871
- this.disabled$.next(true);
872
- };
873
- FormManagementUploadComponent.prototype.enable = function () {
874
- this.disabled$.next(false);
875
- };
876
- return FormManagementUploadComponent;
877
- }());
878
- FormManagementUploadComponent.decorators = [
879
- { type: i0.Component, args: [{
880
- selector: 'valtimo-form-management-upload',
881
- template: "<valtimo-modal\n #uploadFormDefinitionModal\n [title]=\"'uploadFormDefinition' | translate\"\n showFooter=\"true\"\n>\n <div class=\"mt-2\" body>\n <valtimo-dropzone\n [clear$]=\"clear$\"\n (fileSelected)=\"setFile($event)\"\n [disabled]=\"disabled$ | async\"\n [subtitle]=\"'dropzone.formJsonDocDef' | translate\"\n [externalError$]=\"error$\"\n ></valtimo-dropzone>\n </div>\n <div footer>\n <ng-container *ngIf=\"(jsonString$ | async) && !(error$ | async); else pleaseSelect\">\n <button [disabled]=\"disabled$ | async\" class=\"btn btn-primary\" (click)=\"uploadDefinition()\">\n {{ 'Upload' | translate }}\n </button>\n </ng-container>\n </div>\n</valtimo-modal>\n\n<ng-template #pleaseSelect>\n <button class=\"btn btn-primary\" [disabled]=\"true\">\n {{ 'Select a document definition' | translate }}\n </button>\n</ng-template>\n",
882
- styles: [""]
883
- },] }
884
- ];
885
- FormManagementUploadComponent.ctorParameters = function () { return [
886
- { type: document$1.DocumentService },
887
- { type: core.TranslateService }
888
- ]; };
889
- FormManagementUploadComponent.propDecorators = {
890
- modal: [{ type: i0.ViewChild, args: ['uploadFormDefinitionModal',] }],
891
- show$: [{ type: i0.Input }],
892
- definitionUploaded: [{ type: i0.Output }]
893
- };
894
-
895
- /*
896
- * Copyright 2015-2020 Ritense BV, the Netherlands.
897
- *
898
- * Licensed under EUPL, Version 1.2 (the "License");
899
- * you may not use this file except in compliance with the License.
900
- * You may obtain a copy of the License at
901
- *
902
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
903
- *
904
- * Unless required by applicable law or agreed to in writing, software
905
- * distributed under the License is distributed on an "AS IS" basis,
906
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
907
- * See the License for the specific language governing permissions and
908
- * limitations under the License.
909
- */
910
- var FormManagementModule = /** @class */ (function () {
911
- function FormManagementModule() {
912
- }
913
- return FormManagementModule;
914
- }());
915
- FormManagementModule.decorators = [
916
- { type: i0.NgModule, args: [{
917
- declarations: [
918
- FormManagementComponent,
919
- FormManagementCreateComponent,
920
- FormManagementListComponent,
921
- FormManagementEditComponent,
922
- FormManagementUploadComponent,
923
- ],
924
- imports: [
925
- FormManagementRoutingModule,
926
- components.FormIoModule,
927
- common.CommonModule,
928
- forms.ReactiveFormsModule,
929
- forms.FormsModule,
930
- components.WidgetModule,
931
- components.ListModule,
932
- core.TranslateModule,
933
- ngBootstrap.NgbTooltipModule,
934
- components.DropzoneModule,
935
- components.ModalModule,
936
- ],
937
- exports: [FormManagementComponent],
938
- },] }
939
- ];
940
-
941
- /*
942
- * Copyright 2015-2020 Ritense BV, the Netherlands.
943
- *
944
- * Licensed under EUPL, Version 1.2 (the "License");
945
- * you may not use this file except in compliance with the License.
946
- * You may obtain a copy of the License at
947
- *
948
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
949
- *
950
- * Unless required by applicable law or agreed to in writing, software
951
- * distributed under the License is distributed on an "AS IS" basis,
952
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
953
- * See the License for the specific language governing permissions and
954
- * limitations under the License.
955
- */
956
- function compareFormDefinitions(fd1, fd2) {
957
- if (fd1 === null && fd2 === null) {
958
- return true;
959
- }
960
- if (fd1 === null || fd2 === null) {
961
- return false;
962
- }
963
- return fd1.id === fd2.id;
964
- }
965
-
966
- /*
967
- *
968
- * * Copyright 2015-2020 Ritense BV, the Netherlands.
969
- * *
970
- * * Licensed under EUPL, Version 1.2 (the "License");
971
- * * you may not use this file except in compliance with the License.
972
- * * You may obtain a copy of the License at
973
- * *
974
- * * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
975
- * *
976
- * * Unless required by applicable law or agreed to in writing, software
977
- * * distributed under the License is distributed on an "AS IS" basis,
978
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
979
- * * See the License for the specific language governing permissions and
980
- * * limitations under the License.
981
- *
982
- */
983
-
984
- /*
985
- * Copyright 2015-2020 Ritense BV, the Netherlands.
986
- *
987
- * Licensed under EUPL, Version 1.2 (the "License");
988
- * you may not use this file except in compliance with the License.
989
- * You may obtain a copy of the License at
990
- *
991
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
992
- *
993
- * Unless required by applicable law or agreed to in writing, software
994
- * distributed under the License is distributed on an "AS IS" basis,
995
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
996
- * See the License for the specific language governing permissions and
997
- * limitations under the License.
998
- */
999
-
1000
- /**
1001
- * Generated bundle index. Do not edit.
1002
- */
1003
-
1004
- exports.FormManagementComponent = FormManagementComponent;
1005
- exports.FormManagementModule = FormManagementModule;
1006
- exports.FormManagementService = FormManagementService;
1007
- exports.compareFormDefinitions = compareFormDefinitions;
1008
- exports.ɵa = FormManagementCreateComponent;
1009
- exports.ɵb = FormManagementListComponent;
1010
- exports.ɵc = FormManagementEditComponent;
1011
- exports.ɵd = FormManagementUploadComponent;
1012
- exports.ɵe = FormManagementRoutingModule;
1013
-
1014
- Object.defineProperty(exports, '__esModule', { value: true });
1015
-
1016
- })));
1017
- //# sourceMappingURL=valtimo-form-management.umd.js.map