@valtimo/choice-field 4.15.2-next-main.8

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 (30) hide show
  1. package/bundles/valtimo-choice-field.umd.js +755 -0
  2. package/bundles/valtimo-choice-field.umd.js.map +1 -0
  3. package/bundles/valtimo-choice-field.umd.min.js +2 -0
  4. package/bundles/valtimo-choice-field.umd.min.js.map +1 -0
  5. package/esm2015/lib/choice-field-create/choice-field-create.component.js +63 -0
  6. package/esm2015/lib/choice-field-detail/choice-field-detail.component.js +122 -0
  7. package/esm2015/lib/choice-field-list/choice-field-list.component.js +74 -0
  8. package/esm2015/lib/choice-field-routing.module.js +86 -0
  9. package/esm2015/lib/choice-field-value-create/choice-field-value-create.component.js +82 -0
  10. package/esm2015/lib/choice-field-value-detail/choice-field-value-detail.component.js +88 -0
  11. package/esm2015/lib/choice-field-value-list/choice-field-value-list.component.js +96 -0
  12. package/esm2015/lib/choice-field.module.js +54 -0
  13. package/esm2015/lib/choice-field.service.js +68 -0
  14. package/esm2015/public_api.js +21 -0
  15. package/esm2015/valtimo-choice-field.js +12 -0
  16. package/fesm2015/valtimo-choice-field.js +710 -0
  17. package/fesm2015/valtimo-choice-field.js.map +1 -0
  18. package/lib/choice-field-create/choice-field-create.component.d.ts +20 -0
  19. package/lib/choice-field-detail/choice-field-detail.component.d.ts +30 -0
  20. package/lib/choice-field-list/choice-field-list.component.d.ts +23 -0
  21. package/lib/choice-field-routing.module.d.ts +2 -0
  22. package/lib/choice-field-value-create/choice-field-value-create.component.d.ts +26 -0
  23. package/lib/choice-field-value-detail/choice-field-value-detail.component.d.ts +27 -0
  24. package/lib/choice-field-value-list/choice-field-value-list.component.d.ts +29 -0
  25. package/lib/choice-field.module.d.ts +2 -0
  26. package/lib/choice-field.service.d.ts +18 -0
  27. package/package.json +22 -0
  28. package/public_api.d.ts +2 -0
  29. package/valtimo-choice-field.d.ts +11 -0
  30. package/valtimo-choice-field.metadata.json +1 -0
@@ -0,0 +1,755 @@
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/forms'), require('@valtimo/components'), require('@angular/router'), require('@valtimo/security'), require('rxjs'), require('rxjs/operators'), require('@valtimo/contract'), require('@ngx-translate/core')) :
3
+ typeof define === 'function' && define.amd ? define('@valtimo/choice-field', ['exports', '@angular/core', '@angular/common/http', '@valtimo/config', '@angular/common', '@angular/forms', '@valtimo/components', '@angular/router', '@valtimo/security', 'rxjs', 'rxjs/operators', '@valtimo/contract', '@ngx-translate/core'], factory) :
4
+ (global = global || self, factory((global.valtimo = global.valtimo || {}, global.valtimo['choice-field'] = {}), global.ng.core, global.ng.common.http, global.config, global.ng.common, global.ng.forms, global.components, global.ng.router, global.security, global.rxjs, global.rxjs.operators, global.contract, global.core$1));
5
+ }(this, (function (exports, i0, i1, i2, common, forms, components, router, security, rxjs, operators, contract, core) { '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 ChoiceFieldService = /** @class */ (function () {
23
+ function ChoiceFieldService(http, configService) {
24
+ this.http = http;
25
+ this.configService = configService;
26
+ this.valtimoApiConfig = configService.config.valtimoApi;
27
+ }
28
+ ChoiceFieldService.prototype.query = function (params) {
29
+ return this.http.get(this.valtimoApiConfig.endpointUri + "choice-fields", { observe: 'response', params: params });
30
+ };
31
+ ChoiceFieldService.prototype.get = function (id) {
32
+ return this.http.get(this.valtimoApiConfig.endpointUri + "choice-fields/" + id);
33
+ };
34
+ ChoiceFieldService.prototype.create = function (choiceField) {
35
+ return this.http.post(this.valtimoApiConfig.endpointUri + "choice-fields", choiceField);
36
+ };
37
+ ChoiceFieldService.prototype.delete = function (id) {
38
+ return this.http.delete(this.valtimoApiConfig.endpointUri + "choice-fields/" + id);
39
+ };
40
+ ChoiceFieldService.prototype.update = function (choiceField) {
41
+ return this.http.put(this.valtimoApiConfig.endpointUri + "choice-fields", choiceField);
42
+ };
43
+ ChoiceFieldService.prototype.queryValues = function (keyName, params) {
44
+ return this.http.get(this.valtimoApiConfig.endpointUri + "choice-field-values/" + keyName + "/values", { observe: 'response', params: params });
45
+ };
46
+ ChoiceFieldService.prototype.getValue = function (choiceFieldId) {
47
+ return this.http.get(this.valtimoApiConfig.endpointUri + "choice-field-values/" + choiceFieldId);
48
+ };
49
+ ChoiceFieldService.prototype.updateValue = function (choiceFieldValue, choiceFieldName) {
50
+ return this.http.put(this.valtimoApiConfig.endpointUri + "choice-field-values", choiceFieldValue, {
51
+ params: { choice_field_name: choiceFieldName }
52
+ });
53
+ };
54
+ ChoiceFieldService.prototype.createValue = function (choiceFieldValue, choiceFieldName) {
55
+ return this.http.post(this.valtimoApiConfig.endpointUri + "choice-field-values", choiceFieldValue, { params: { choice_field_name: choiceFieldName } });
56
+ };
57
+ return ChoiceFieldService;
58
+ }());
59
+ ChoiceFieldService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ChoiceFieldService_Factory() { return new ChoiceFieldService(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(i2.ConfigService)); }, token: ChoiceFieldService, providedIn: "root" });
60
+ ChoiceFieldService.decorators = [
61
+ { type: i0.Injectable, args: [{
62
+ providedIn: 'root'
63
+ },] }
64
+ ];
65
+ ChoiceFieldService.ctorParameters = function () { return [
66
+ { type: i1.HttpClient },
67
+ { type: i2.ConfigService }
68
+ ]; };
69
+
70
+ /*
71
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
72
+ *
73
+ * Licensed under EUPL, Version 1.2 (the "License");
74
+ * you may not use this file except in compliance with the License.
75
+ * You may obtain a copy of the License at
76
+ *
77
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
78
+ *
79
+ * Unless required by applicable law or agreed to in writing, software
80
+ * distributed under the License is distributed on an "AS IS" basis,
81
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
82
+ * See the License for the specific language governing permissions and
83
+ * limitations under the License.
84
+ */
85
+ var ChoiceFieldListComponent = /** @class */ (function () {
86
+ function ChoiceFieldListComponent(router, service) {
87
+ this.router = router;
88
+ this.service = service;
89
+ this.choiceFields = [];
90
+ this.pagination = {
91
+ collectionSize: 0,
92
+ page: 1,
93
+ size: 10,
94
+ maxPaginationItemSize: 5
95
+ };
96
+ this.pageParam = 0;
97
+ this.fields = [{
98
+ key: 'id',
99
+ label: 'ID'
100
+ },
101
+ {
102
+ key: 'keyName',
103
+ label: 'Key'
104
+ },
105
+ {
106
+ key: 'title',
107
+ label: 'Title'
108
+ }];
109
+ }
110
+ ChoiceFieldListComponent.prototype.ngOnInit = function () {
111
+ };
112
+ ChoiceFieldListComponent.prototype.paginationSet = function () {
113
+ this.initData();
114
+ };
115
+ ChoiceFieldListComponent.prototype.initData = function () {
116
+ var _this = this;
117
+ this.service.query({ page: this.pageParam, size: this.pagination.size }).subscribe(function (results) {
118
+ _this.pagination.collectionSize = results.headers.get('x-total-count');
119
+ _this.choiceFields = results.body;
120
+ });
121
+ };
122
+ ChoiceFieldListComponent.prototype.rowClick = function (data) {
123
+ this.router.navigate(["/choice-fields/field/" + encodeURI(data.id)]);
124
+ };
125
+ ChoiceFieldListComponent.prototype.paginationClicked = function (page) {
126
+ this.pageParam = page - 1;
127
+ this.initData();
128
+ };
129
+ return ChoiceFieldListComponent;
130
+ }());
131
+ ChoiceFieldListComponent.decorators = [
132
+ { type: i0.Component, args: [{
133
+ selector: 'valtimo-choice-field-list',
134
+ 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 [routerLink]=\"'create'\" class=\"btn btn-primary btn-space mr-0\">\n <i class=\"icon mdi mdi-plus\"></i> &nbsp;\n <span>{{ 'Create new Choice field' | translate }}</span>\n </button>\n </div>\n </div>\n <valtimo-widget>\n <valtimo-list [items]=\"choiceFields\"\n [fields]=\"fields\"\n (rowClicked)=\"rowClick($event)\"\n [pagination]=\"pagination\"\n [viewMode]=\"true\"\n [isSearchable]=\"true\"\n paginationIdentifier=\"choiceFieldList\"\n (paginationClicked)=\"paginationClicked($event)\"\n (paginationSet)=\"paginationSet()\"\n [header]=\"true\"\n >\n <div header>\n <h3 class=\"list-header-title\">{{ 'Choice fields' | translate }}</h3>\n <h5 class=\"list-header-description\">{{ 'Overview of all Choice fields' | translate }}</h5>\n </div>\n </valtimo-list>\n </valtimo-widget>\n </div>\n</div>\n",
135
+ styles: [""]
136
+ },] }
137
+ ];
138
+ ChoiceFieldListComponent.ctorParameters = function () { return [
139
+ { type: router.Router },
140
+ { type: ChoiceFieldService }
141
+ ]; };
142
+
143
+ /*
144
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
145
+ *
146
+ * Licensed under EUPL, Version 1.2 (the "License");
147
+ * you may not use this file except in compliance with the License.
148
+ * You may obtain a copy of the License at
149
+ *
150
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
151
+ *
152
+ * Unless required by applicable law or agreed to in writing, software
153
+ * distributed under the License is distributed on an "AS IS" basis,
154
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
155
+ * See the License for the specific language governing permissions and
156
+ * limitations under the License.
157
+ */
158
+ var ChoiceFieldDetailComponent = /** @class */ (function () {
159
+ function ChoiceFieldDetailComponent(router, route, formBuilder, service, alertService) {
160
+ this.router = router;
161
+ this.route = route;
162
+ this.formBuilder = formBuilder;
163
+ this.service = service;
164
+ this.alertService = alertService;
165
+ this.alertSub = rxjs.Subscription.EMPTY;
166
+ var snapshot = this.route.snapshot.paramMap;
167
+ this.id = snapshot.get('id');
168
+ }
169
+ ChoiceFieldDetailComponent.prototype.ngOnInit = function () {
170
+ this.reset();
171
+ };
172
+ ChoiceFieldDetailComponent.prototype.ngOnDestroy = function () {
173
+ this.alertSub.unsubscribe();
174
+ };
175
+ Object.defineProperty(ChoiceFieldDetailComponent.prototype, "formControls", {
176
+ get: function () {
177
+ return this.form.controls;
178
+ },
179
+ enumerable: false,
180
+ configurable: true
181
+ });
182
+ ChoiceFieldDetailComponent.prototype.initData = function (id) {
183
+ var _this = this;
184
+ this.service.get(id).subscribe(function (result) {
185
+ _this.choiceField = result;
186
+ _this.setValues();
187
+ });
188
+ };
189
+ ChoiceFieldDetailComponent.prototype.setValues = function () {
190
+ if (this.choiceField) {
191
+ // set form values
192
+ this.form.controls.id.setValue(this.choiceField.id);
193
+ this.form.controls.keyName.setValue(this.choiceField.keyName);
194
+ this.form.controls.title.setValue(this.choiceField.title);
195
+ }
196
+ };
197
+ ChoiceFieldDetailComponent.prototype.createFormGroup = function () {
198
+ return this.formBuilder.group({
199
+ id: new forms.FormControl('', forms.Validators.required),
200
+ keyName: new forms.FormControl('', forms.Validators.required),
201
+ title: new forms.FormControl('', forms.Validators.required)
202
+ });
203
+ };
204
+ ChoiceFieldDetailComponent.prototype.reset = function () {
205
+ this.form = this.createFormGroup();
206
+ this.initData(this.id);
207
+ };
208
+ ChoiceFieldDetailComponent.prototype.delete = function () {
209
+ var _this = this;
210
+ if (!this.alertSub.closed) {
211
+ return;
212
+ }
213
+ // confirm delete
214
+ var mssg = 'Delete choice field?';
215
+ var confirmations = [
216
+ {
217
+ label: 'Cancel',
218
+ class: 'btn btn-default',
219
+ value: false
220
+ },
221
+ {
222
+ label: 'Delete',
223
+ class: 'btn btn-primary',
224
+ value: true
225
+ }
226
+ ];
227
+ this.alertService.notification(mssg, confirmations);
228
+ this.alertSub = this.alertService.getAlertConfirmChangeEmitter()
229
+ .pipe(operators.first())
230
+ .subscribe(function (alert) {
231
+ if (alert.confirm === true) {
232
+ _this.deleteConfirmed();
233
+ }
234
+ });
235
+ };
236
+ ChoiceFieldDetailComponent.prototype.deleteConfirmed = function () {
237
+ var _this = this;
238
+ this.service.delete(this.id).subscribe(function () {
239
+ _this.router.navigate(["/choice-fields"]);
240
+ _this.alertService.success('Choice field has been deleted');
241
+ });
242
+ };
243
+ ChoiceFieldDetailComponent.prototype.onSubmit = function () {
244
+ var _this = this;
245
+ this.service.update(this.form.value).subscribe(function () {
246
+ _this.reset();
247
+ _this.alertService.success('Choice field details have been updated');
248
+ });
249
+ };
250
+ return ChoiceFieldDetailComponent;
251
+ }());
252
+ ChoiceFieldDetailComponent.decorators = [
253
+ { type: i0.Component, args: [{
254
+ selector: 'valtimo-choice-field-detail',
255
+ 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 *ngIf=\"choiceField\">\n <div>\n <div class=\"card-body bg-light\">\n <div class=\"row py-5\">\n <div class=\"col-12\">\n <div class=\"row mb-3\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>ID</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">{{ choiceField.id }}</div>\n </div>\n <div class=\"row\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>Key</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">{{ choiceField.keyName }}</div>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"p-5 bg-white\">\n <form [formGroup]=\"form\" (ngSubmit)=\"onSubmit()\">\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"title\">Title</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input valtimoFieldAutoFocus type=\"text\" id=\"title\" formControlName=\"title\" class=\"form-control\" placeholder=\"Choice field title\"\n [ngClass]=\"{'is-valid': formControls.title.touched && formControls.title.valid, 'is-invalid': formControls.title.touched && formControls.title.errors}\"\n required/>\n <div *ngIf=\"formControls.title.touched && formControls.title.errors\" class=\"invalid-feedback\">\n <div *ngIf=\"formControls.title.errors.required\">Title is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"row pt-3 mt-1\">\n <div class=\"col-12 col-sm-6 text-left\">\n <a [routerLink]=\"'/choice-fields'\" class=\"btn btn-space btn-default\">Back</a>\n <button class=\"btn btn-space btn-danger\" type=\"button\" (click)=\"delete()\">Delete</button>\n </div>\n <div class=\"col-12 col-sm-6 text-right\">\n <button class=\"btn btn-space btn-secondary\" type=\"button\" (click)=\"reset()\">Reset</button>\n <button class=\"btn btn-space btn-primary\" type=\"submit\" [disabled]=\"form.invalid\">Submit</button>\n </div>\n </div>\n </form>\n </div>\n </div>\n </valtimo-widget>\n </div>\n </div>\n</div>\n\n<div class=\"page-head\">\n <h2 class=\"page-head-title\">Choice field values</h2>\n</div>\n<valtimo-choice-field-value-list></valtimo-choice-field-value-list>\n",
256
+ styles: [""]
257
+ },] }
258
+ ];
259
+ ChoiceFieldDetailComponent.ctorParameters = function () { return [
260
+ { type: router.Router },
261
+ { type: router.ActivatedRoute },
262
+ { type: forms.FormBuilder },
263
+ { type: ChoiceFieldService },
264
+ { type: components.AlertService }
265
+ ]; };
266
+
267
+ /*
268
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
269
+ *
270
+ * Licensed under EUPL, Version 1.2 (the "License");
271
+ * you may not use this file except in compliance with the License.
272
+ * You may obtain a copy of the License at
273
+ *
274
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
275
+ *
276
+ * Unless required by applicable law or agreed to in writing, software
277
+ * distributed under the License is distributed on an "AS IS" basis,
278
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
279
+ * See the License for the specific language governing permissions and
280
+ * limitations under the License.
281
+ */
282
+ var ChoiceFieldCreateComponent = /** @class */ (function () {
283
+ function ChoiceFieldCreateComponent(router, formBuilder, service, alertService) {
284
+ this.router = router;
285
+ this.formBuilder = formBuilder;
286
+ this.service = service;
287
+ this.alertService = alertService;
288
+ }
289
+ ChoiceFieldCreateComponent.prototype.ngOnInit = function () {
290
+ this.reset();
291
+ };
292
+ Object.defineProperty(ChoiceFieldCreateComponent.prototype, "formControls", {
293
+ get: function () {
294
+ return this.form.controls;
295
+ },
296
+ enumerable: false,
297
+ configurable: true
298
+ });
299
+ ChoiceFieldCreateComponent.prototype.createFormGroup = function () {
300
+ return this.formBuilder.group({
301
+ keyName: new forms.FormControl('', forms.Validators.required),
302
+ title: new forms.FormControl('', forms.Validators.required)
303
+ });
304
+ };
305
+ ChoiceFieldCreateComponent.prototype.onSubmit = function () {
306
+ var _this = this;
307
+ this.service.create(this.form.value).subscribe(function (result) {
308
+ _this.router.navigate(["/choice-fields/field/" + result.id]);
309
+ _this.alertService.success('New choice field has been created');
310
+ });
311
+ };
312
+ ChoiceFieldCreateComponent.prototype.reset = function () {
313
+ this.form = this.createFormGroup();
314
+ };
315
+ return ChoiceFieldCreateComponent;
316
+ }());
317
+ ChoiceFieldCreateComponent.decorators = [
318
+ { type: i0.Component, args: [{
319
+ selector: 'valtimo-choice-field-create',
320
+ 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>\n <div class=\"p-5 bg-white\">\n <form [formGroup]=\"form\" (ngSubmit)=\"onSubmit()\">\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"keyName\">Key</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input valtimoFieldAutoFocus type=\"text\" id=\"keyName\" formControlName=\"keyName\" class=\"form-control\" placeholder=\"Choice field key name\"\n [ngClass]=\"{'is-valid': formControls.keyName.touched && formControls.keyName.valid, 'is-invalid': formControls.keyName.touched && formControls.keyName.errors}\"\n required />\n <div *ngIf=\"formControls.keyName.touched && formControls.keyName.errors\" class=\"invalid-feedback\">\n <div *ngIf=\"formControls.keyName.errors.required\">Key name is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"title\">Title</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input type=\"text\" id=\"title\" formControlName=\"title\" class=\"form-control\" placeholder=\"Choice field title\"\n [ngClass]=\"{'is-valid': formControls.title.touched && formControls.title.valid, 'is-invalid': formControls.title.touched && formControls.title.errors}\"\n required/>\n <div *ngIf=\"formControls.title.touched && formControls.title.errors\" class=\"invalid-feedback\">\n <div *ngIf=\"formControls.title.errors.required\">Title is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"row pt-3 mt-1\">\n <div class=\"col-12 col-sm-6 text-left\">\n <a [routerLink]=\"'/choice-fields'\" class=\"btn btn-space btn-default\">Back</a>\n </div>\n <div class=\"col-12 col-sm-6 text-right\">\n <button class=\"btn btn-space btn-secondary\" type=\"button\" (click)=\"reset()\">Reset</button>\n <button class=\"btn btn-space btn-primary\" type=\"submit\" [disabled]=\"form.invalid\">Submit</button>\n </div>\n </div>\n </form>\n </div>\n </div>\n </valtimo-widget>\n </div>\n </div>\n</div>\n",
321
+ styles: [""]
322
+ },] }
323
+ ];
324
+ ChoiceFieldCreateComponent.ctorParameters = function () { return [
325
+ { type: router.Router },
326
+ { type: forms.FormBuilder },
327
+ { type: ChoiceFieldService },
328
+ { type: components.AlertService }
329
+ ]; };
330
+
331
+ /*
332
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
333
+ *
334
+ * Licensed under EUPL, Version 1.2 (the "License");
335
+ * you may not use this file except in compliance with the License.
336
+ * You may obtain a copy of the License at
337
+ *
338
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
339
+ *
340
+ * Unless required by applicable law or agreed to in writing, software
341
+ * distributed under the License is distributed on an "AS IS" basis,
342
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
343
+ * See the License for the specific language governing permissions and
344
+ * limitations under the License.
345
+ */
346
+ var ChoiceFieldValueCreateComponent = /** @class */ (function () {
347
+ function ChoiceFieldValueCreateComponent(router, route, formBuilder, service, alertService) {
348
+ this.router = router;
349
+ this.route = route;
350
+ this.formBuilder = formBuilder;
351
+ this.service = service;
352
+ this.alertService = alertService;
353
+ var snapshot = this.route.snapshot.paramMap;
354
+ this.choiceFieldId = snapshot.get('id');
355
+ }
356
+ ChoiceFieldValueCreateComponent.prototype.ngOnInit = function () {
357
+ this.reset();
358
+ };
359
+ Object.defineProperty(ChoiceFieldValueCreateComponent.prototype, "formControls", {
360
+ get: function () {
361
+ return this.form.controls;
362
+ },
363
+ enumerable: false,
364
+ configurable: true
365
+ });
366
+ ChoiceFieldValueCreateComponent.prototype.createFormGroup = function () {
367
+ return this.formBuilder.group({
368
+ name: new forms.FormControl('', forms.Validators.required),
369
+ value: new forms.FormControl('', forms.Validators.required),
370
+ sortOrder: new forms.FormControl('', forms.Validators.required),
371
+ deprecated: new forms.FormControl('', forms.Validators.required)
372
+ });
373
+ };
374
+ ChoiceFieldValueCreateComponent.prototype.initData = function (id) {
375
+ var _this = this;
376
+ this.service.get(id).subscribe(function (result) {
377
+ _this.choiceField = result;
378
+ _this.setValues();
379
+ });
380
+ };
381
+ ChoiceFieldValueCreateComponent.prototype.setValues = function () {
382
+ if (this.choiceField) {
383
+ // set form values default false
384
+ this.form.controls.deprecated.setValue(false);
385
+ }
386
+ };
387
+ ChoiceFieldValueCreateComponent.prototype.onSubmit = function () {
388
+ var _this = this;
389
+ this.service.createValue(this.form.value, this.choiceField.keyName).subscribe(function (result) {
390
+ _this.router.navigate(["/choice-fields/field/" + encodeURI(_this.choiceFieldId)]);
391
+ _this.alertService.success('New choice field value has been created');
392
+ });
393
+ };
394
+ ChoiceFieldValueCreateComponent.prototype.reset = function () {
395
+ this.form = this.createFormGroup();
396
+ this.initData(this.choiceFieldId);
397
+ };
398
+ return ChoiceFieldValueCreateComponent;
399
+ }());
400
+ ChoiceFieldValueCreateComponent.decorators = [
401
+ { type: i0.Component, args: [{
402
+ selector: 'valtimo-choice-field-value-create',
403
+ 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 *ngIf=\"choiceField\">\n <div>\n <div class=\"card-body bg-light\">\n <div class=\"row py-5\">\n <div class=\"col-12\">\n <div class=\"row mb-3\">\n <div class=\"col-12\">\n <strong>Choice field</strong>\n <hr />\n </div>\n </div>\n <div class=\"row mb-3\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>ID</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">{{ choiceField.id }}</div>\n </div>\n <div class=\"row mb-3\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>Key</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">{{ choiceField.keyName }}</div>\n </div>\n <div class=\"row\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>Title</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">{{ choiceField.title }}</div>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"bg-white p-5\">\n <form [formGroup]=\"form\" (ngSubmit)=\"onSubmit()\">\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"name\">Key</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input valtimoFieldAutoFocus type=\"text\" id=\"name\" formControlName=\"name\" class=\"form-control\" placeholder=\"Choice field value key\"\n [ngClass]=\"{'is-valid': formControls.name.touched && formControls.name.valid, 'is-invalid': formControls.name.touched && formControls.name.errors}\"\n required/>\n <div *ngIf=\"formControls.name.touched && formControls.name.errors\" class=\"invalid-feedback\">\n <div *ngIf=\"formControls.name.errors.required\">Choice field value key is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"value\">Value</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input type=\"text\" id=\"value\" formControlName=\"value\" class=\"form-control\" placeholder=\"Choice field value\"\n [ngClass]=\"{'is-valid': formControls.value.touched && formControls.value.valid, 'is-invalid': formControls.value.touched && formControls.value.errors}\"\n required/>\n <div *ngIf=\"formControls.value.touched && formControls.value.errors\" class=\"invalid-feedback\">\n <div *ngIf=\"formControls.value.errors.required\">Choice field value is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"sortOrder\">Sequence</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input type=\"number\" id=\"sortOrder\" formControlName=\"sortOrder\" class=\"form-control\" placeholder=\"Choice field value sequence\"\n [ngClass]=\"{'is-valid': formControls.sortOrder.touched && formControls.sortOrder.valid, 'is-invalid': formControls.sortOrder.touched && formControls.sortOrder.errors}\"\n required/>\n <div *ngIf=\"formControls.sortOrder.touched && formControls.sortOrder.errors\" class=\"invalid-feedback\">\n <div *ngIf=\"formControls.sortOrder.errors.required\">Choice field value sequence is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"deprecated\">Deprecated</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <div class=\"switch-button switch-button-sm switch-button-success\">\n <input type=\"checkbox\" formControlName=\"deprecated\" id=\"deprecated\"><span>\n <label for=\"deprecated\"></label></span>\n </div>\n </div>\n </div>\n\n <div class=\"row pt-3 mt-1\">\n <div class=\"col-12 col-sm-6 text-left\">\n <a [routerLink]=\"'../'\" class=\"btn btn-space btn-default\">Back</a>\n </div>\n <div class=\"col-12 col-sm-6 text-right\">\n <button class=\"btn btn-space btn-secondary\" type=\"button\" (click)=\"reset()\">Reset</button>\n <button class=\"btn btn-space btn-primary\" type=\"submit\" [disabled]=\"form.invalid\">Submit</button>\n </div>\n </div>\n </form>\n </div>\n </div>\n </valtimo-widget>\n </div>\n </div>\n</div>\n",
404
+ styles: [""]
405
+ },] }
406
+ ];
407
+ ChoiceFieldValueCreateComponent.ctorParameters = function () { return [
408
+ { type: router.Router },
409
+ { type: router.ActivatedRoute },
410
+ { type: forms.FormBuilder },
411
+ { type: ChoiceFieldService },
412
+ { type: components.AlertService }
413
+ ]; };
414
+
415
+ /*
416
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
417
+ *
418
+ * Licensed under EUPL, Version 1.2 (the "License");
419
+ * you may not use this file except in compliance with the License.
420
+ * You may obtain a copy of the License at
421
+ *
422
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
423
+ *
424
+ * Unless required by applicable law or agreed to in writing, software
425
+ * distributed under the License is distributed on an "AS IS" basis,
426
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
427
+ * See the License for the specific language governing permissions and
428
+ * limitations under the License.
429
+ */
430
+ var ChoiceFieldValueDetailComponent = /** @class */ (function () {
431
+ function ChoiceFieldValueDetailComponent(router, route, formBuilder, service, alertService) {
432
+ this.router = router;
433
+ this.route = route;
434
+ this.formBuilder = formBuilder;
435
+ this.service = service;
436
+ this.alertService = alertService;
437
+ var snapshot = this.route.snapshot.paramMap;
438
+ this.choiceFieldValueId = snapshot.get('valueId');
439
+ }
440
+ ChoiceFieldValueDetailComponent.prototype.ngOnInit = function () {
441
+ this.reset();
442
+ };
443
+ Object.defineProperty(ChoiceFieldValueDetailComponent.prototype, "formControls", {
444
+ get: function () {
445
+ return this.form.controls;
446
+ },
447
+ enumerable: false,
448
+ configurable: true
449
+ });
450
+ ChoiceFieldValueDetailComponent.prototype.initData = function (choiceFieldValueId) {
451
+ var _this = this;
452
+ this.service.getValue(choiceFieldValueId).subscribe(function (result) {
453
+ _this.choiceField = result.choiceField;
454
+ _this.choiceFieldValue = result;
455
+ _this.setValues();
456
+ });
457
+ };
458
+ ChoiceFieldValueDetailComponent.prototype.createFormGroup = function () {
459
+ return this.formBuilder.group({
460
+ id: new forms.FormControl('', forms.Validators.required),
461
+ name: new forms.FormControl('', forms.Validators.required),
462
+ value: new forms.FormControl('', forms.Validators.required),
463
+ sortOrder: new forms.FormControl('', forms.Validators.required),
464
+ deprecated: new forms.FormControl('', forms.Validators.required)
465
+ });
466
+ };
467
+ ChoiceFieldValueDetailComponent.prototype.setValues = function () {
468
+ if (this.choiceField) {
469
+ // set form values
470
+ this.form.controls.id.setValue(this.choiceFieldValue.id);
471
+ this.form.controls.name.setValue(this.choiceFieldValue.name);
472
+ this.form.controls.value.setValue(this.choiceFieldValue.value);
473
+ this.form.controls.sortOrder.setValue(this.choiceFieldValue.sortOrder);
474
+ this.form.controls.deprecated.setValue(this.choiceFieldValue.deprecated);
475
+ }
476
+ };
477
+ ChoiceFieldValueDetailComponent.prototype.reset = function () {
478
+ this.form = this.createFormGroup();
479
+ this.initData(this.choiceFieldValueId);
480
+ };
481
+ ChoiceFieldValueDetailComponent.prototype.onSubmit = function () {
482
+ var _this = this;
483
+ this.service.updateValue(this.form.value, this.choiceField.keyName).subscribe(function () {
484
+ _this.reset();
485
+ _this.alertService.success('Choice field value details have been updated');
486
+ });
487
+ };
488
+ return ChoiceFieldValueDetailComponent;
489
+ }());
490
+ ChoiceFieldValueDetailComponent.decorators = [
491
+ { type: i0.Component, args: [{
492
+ selector: 'valtimo-choice-field-value-detail',
493
+ 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 *ngIf=\"choiceField\">\n <div>\n <div class=\"card-body bg-light\">\n <div class=\"row py-5\">\n <div class=\"col-12\">\n <div class=\"row mb-3\">\n <div class=\"col-12\">\n <strong>Choice field</strong>\n <hr />\n </div>\n </div>\n <div class=\"row mb-3\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>ID</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">{{ choiceField.id }}</div>\n </div>\n <div class=\"row mb-3\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>Key</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">{{ choiceField.keyName }}</div>\n </div>\n <div class=\"row mb-3\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>Title</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">{{ choiceField.title }}</div>\n </div>\n <div class=\"row mb-3\">\n <div class=\"col-12 pt-3\">\n <strong>Choice field value</strong>\n <hr />\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>ID</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">{{ choiceFieldValue.id }}</div>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"bg-white p-5\">\n <form [formGroup]=\"form\" (ngSubmit)=\"onSubmit()\">\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"name\">Key</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input valtimoFieldAutoFocus type=\"text\" id=\"name\" formControlName=\"name\" class=\"form-control\" placeholder=\"Choice field value key\"\n [ngClass]=\"{'is-valid': formControls.name.touched && formControls.name.valid, 'is-invalid': formControls.name.touched && formControls.name.errors}\"\n required/>\n <div *ngIf=\"formControls.name.touched && formControls.name.errors\" class=\"invalid-feedback\">\n <div *ngIf=\"formControls.name.errors.required\">Choice field value key is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"value\">Value</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input type=\"text\" id=\"value\" formControlName=\"value\" class=\"form-control\" placeholder=\"Choice field value\"\n [ngClass]=\"{'is-valid': formControls.value.touched && formControls.value.valid, 'is-invalid': formControls.value.touched && formControls.value.errors}\"\n required/>\n <div *ngIf=\"formControls.value.touched && formControls.value.errors\" class=\"invalid-feedback\">\n <div *ngIf=\"formControls.value.errors.required\">Choice field value is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"sortOrder\">Sequence</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input type=\"number\" id=\"sortOrder\" formControlName=\"sortOrder\" class=\"form-control\" placeholder=\"Choice field value sequence\"\n [ngClass]=\"{'is-valid': formControls.sortOrder.touched && formControls.sortOrder.valid, 'is-invalid': formControls.sortOrder.touched && formControls.sortOrder.errors}\"\n required/>\n <div *ngIf=\"formControls.sortOrder.touched && formControls.sortOrder.errors\" class=\"invalid-feedback\">\n <div *ngIf=\"formControls.sortOrder.errors.required\">Choice field value sequence is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"deprecated\">Deprecated</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <div class=\"switch-button switch-button-sm switch-button-success\">\n <input type=\"checkbox\" formControlName=\"deprecated\" id=\"deprecated\"><span>\n <label for=\"deprecated\"></label></span>\n </div>\n </div>\n </div>\n\n <div class=\"row pt-3 mt-1\">\n <div class=\"col-12 col-sm-6 text-left\">\n <a [routerLink]=\"'../../'\" class=\"btn btn-space btn-default\">Back</a>\n </div>\n <div class=\"col-12 col-sm-6 text-right\">\n <button class=\"btn btn-space btn-secondary\" type=\"button\" (click)=\"reset()\">Reset</button>\n <button class=\"btn btn-space btn-primary\" type=\"submit\" [disabled]=\"form.invalid\">Submit</button>\n </div>\n </div>\n </form>\n </div>\n </div>\n </valtimo-widget>\n </div>\n </div>\n</div>\n",
494
+ styles: [""]
495
+ },] }
496
+ ];
497
+ ChoiceFieldValueDetailComponent.ctorParameters = function () { return [
498
+ { type: router.Router },
499
+ { type: router.ActivatedRoute },
500
+ { type: forms.FormBuilder },
501
+ { type: ChoiceFieldService },
502
+ { type: components.AlertService }
503
+ ]; };
504
+
505
+ /*
506
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
507
+ *
508
+ * Licensed under EUPL, Version 1.2 (the "License");
509
+ * you may not use this file except in compliance with the License.
510
+ * You may obtain a copy of the License at
511
+ *
512
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
513
+ *
514
+ * Unless required by applicable law or agreed to in writing, software
515
+ * distributed under the License is distributed on an "AS IS" basis,
516
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
517
+ * See the License for the specific language governing permissions and
518
+ * limitations under the License.
519
+ */
520
+ var ɵ0 = {
521
+ title: 'Choice fields',
522
+ roles: [contract.ROLE_ADMIN]
523
+ }, ɵ1 = {
524
+ title: 'Choice field details',
525
+ roles: [contract.ROLE_ADMIN]
526
+ }, ɵ2 = {
527
+ title: 'Create new Choice field',
528
+ roles: [contract.ROLE_ADMIN]
529
+ }, ɵ3 = {
530
+ title: 'Create new Choice field value',
531
+ roles: [contract.ROLE_ADMIN]
532
+ }, ɵ4 = {
533
+ title: 'Choice field value details',
534
+ roles: [contract.ROLE_ADMIN]
535
+ };
536
+ var routes = [
537
+ {
538
+ path: 'choice-fields',
539
+ data: ɵ0,
540
+ component: ChoiceFieldListComponent,
541
+ canActivate: [security.AuthGuardService]
542
+ },
543
+ {
544
+ path: 'choice-fields/field/:id',
545
+ data: ɵ1,
546
+ component: ChoiceFieldDetailComponent,
547
+ canActivate: [security.AuthGuardService]
548
+ },
549
+ {
550
+ path: 'choice-fields/create',
551
+ data: ɵ2,
552
+ component: ChoiceFieldCreateComponent,
553
+ canActivate: [security.AuthGuardService]
554
+ },
555
+ {
556
+ path: 'choice-fields/field/:id/create-value',
557
+ data: ɵ3,
558
+ component: ChoiceFieldValueCreateComponent,
559
+ canActivate: [security.AuthGuardService]
560
+ },
561
+ {
562
+ path: 'choice-fields/field/:id/value/:valueId',
563
+ data: ɵ4,
564
+ component: ChoiceFieldValueDetailComponent,
565
+ canActivate: [security.AuthGuardService]
566
+ }
567
+ ];
568
+ var ChoiceFieldRoutingModule = /** @class */ (function () {
569
+ function ChoiceFieldRoutingModule() {
570
+ }
571
+ return ChoiceFieldRoutingModule;
572
+ }());
573
+ ChoiceFieldRoutingModule.decorators = [
574
+ { type: i0.NgModule, args: [{
575
+ imports: [
576
+ common.CommonModule,
577
+ router.RouterModule.forChild(routes),
578
+ ],
579
+ exports: [router.RouterModule]
580
+ },] }
581
+ ];
582
+
583
+ /*
584
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
585
+ *
586
+ * Licensed under EUPL, Version 1.2 (the "License");
587
+ * you may not use this file except in compliance with the License.
588
+ * You may obtain a copy of the License at
589
+ *
590
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
591
+ *
592
+ * Unless required by applicable law or agreed to in writing, software
593
+ * distributed under the License is distributed on an "AS IS" basis,
594
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
595
+ * See the License for the specific language governing permissions and
596
+ * limitations under the License.
597
+ */
598
+ var ChoiceFieldValueListComponent = /** @class */ (function () {
599
+ function ChoiceFieldValueListComponent(router, route, formBuilder, service) {
600
+ this.router = router;
601
+ this.route = route;
602
+ this.formBuilder = formBuilder;
603
+ this.service = service;
604
+ this.choiceFieldValues = [];
605
+ this.pagination = {
606
+ collectionSize: 0,
607
+ page: 1,
608
+ size: 10,
609
+ maxPaginationItemSize: 5
610
+ };
611
+ this.pageParam = 0;
612
+ this.fields = [{
613
+ key: 'id',
614
+ label: 'ID'
615
+ },
616
+ {
617
+ key: 'value',
618
+ label: 'Key'
619
+ },
620
+ {
621
+ key: 'name',
622
+ label: 'Title'
623
+ },
624
+ {
625
+ key: 'deprecatedDisplayString',
626
+ label: 'Deprecated'
627
+ },
628
+ {
629
+ key: 'sortOrder',
630
+ label: 'Sequence'
631
+ }];
632
+ var snapshot = this.route.snapshot.paramMap;
633
+ this.id = snapshot.get('id');
634
+ }
635
+ ChoiceFieldValueListComponent.prototype.ngOnInit = function () {
636
+ this.paginationSet();
637
+ };
638
+ ChoiceFieldValueListComponent.prototype.paginationSet = function () {
639
+ this.initData(this.id);
640
+ };
641
+ ChoiceFieldValueListComponent.prototype.initData = function (id) {
642
+ var _this = this;
643
+ this.service.get(id).subscribe(function (result) {
644
+ _this.choiceField = result;
645
+ _this.service.queryValues(_this.choiceField.keyName, { page: _this.pageParam, size: _this.pagination.size }).subscribe(function (values) {
646
+ _this.pagination.collectionSize = values.headers.get('x-total-count');
647
+ _this.choiceFieldValues = values.body;
648
+ _this.choiceFieldValues.forEach(function (choiceFieldValue) {
649
+ choiceFieldValue.deprecatedDisplayString = choiceFieldValue.deprecated ? 'Yes' : 'No';
650
+ });
651
+ });
652
+ });
653
+ };
654
+ ChoiceFieldValueListComponent.prototype.rowClick = function (data) {
655
+ this.router.navigate(["/choice-fields/field/" + data.choiceField.id + "/value/" + data.id]);
656
+ };
657
+ ChoiceFieldValueListComponent.prototype.paginationClicked = function (page) {
658
+ this.pageParam = page - 1;
659
+ this.initData(this.id);
660
+ };
661
+ return ChoiceFieldValueListComponent;
662
+ }());
663
+ ChoiceFieldValueListComponent.decorators = [
664
+ { type: i0.Component, args: [{
665
+ selector: 'valtimo-choice-field-value-list',
666
+ 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 [routerLink]=\"'create-value'\" class=\"btn btn-primary btn-space mr-0\">\n <i class=\"icon mdi mdi-plus\"></i> &nbsp;\n <span>{{ 'Create new Choice field value' | translate }}</span>\n </button>\n </div>\n </div>\n <valtimo-widget>\n <valtimo-list [items]=\"choiceFieldValues\"\n [fields]=\"fields\"\n [viewMode]=\"true\"\n [isSearchable]=\"true\"\n (rowClicked)=\"rowClick($event)\"\n [pagination]=\"pagination\"\n paginationIdentifier=\"choiceFieldValueList\"\n (paginationClicked)=\"paginationClicked($event)\"\n [header]=\"true\">\n <div header>\n <h3 class=\"list-header-title\">{{ 'Choice field values' | translate }}</h3>\n <h5 class=\"list-header-description\">{{ 'Overview of all Choice field values' | translate }}</h5>\n </div>\n </valtimo-list>\n </valtimo-widget>\n </div>\n</div>\n",
667
+ styles: [""]
668
+ },] }
669
+ ];
670
+ ChoiceFieldValueListComponent.ctorParameters = function () { return [
671
+ { type: router.Router },
672
+ { type: router.ActivatedRoute },
673
+ { type: forms.FormBuilder },
674
+ { type: ChoiceFieldService }
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 ChoiceFieldModule = /** @class */ (function () {
693
+ function ChoiceFieldModule() {
694
+ }
695
+ return ChoiceFieldModule;
696
+ }());
697
+ ChoiceFieldModule.decorators = [
698
+ { type: i0.NgModule, args: [{
699
+ declarations: [
700
+ ChoiceFieldListComponent,
701
+ ChoiceFieldDetailComponent,
702
+ ChoiceFieldCreateComponent,
703
+ ChoiceFieldValueListComponent,
704
+ ChoiceFieldValueCreateComponent,
705
+ ChoiceFieldValueDetailComponent
706
+ ],
707
+ imports: [
708
+ common.CommonModule,
709
+ components.ListModule,
710
+ components.WidgetModule,
711
+ components.FieldAutoFocusModule,
712
+ forms.FormsModule,
713
+ forms.ReactiveFormsModule,
714
+ ChoiceFieldRoutingModule,
715
+ components.AlertModule,
716
+ core.TranslateModule
717
+ ],
718
+ exports: []
719
+ },] }
720
+ ];
721
+
722
+ /*
723
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
724
+ *
725
+ * Licensed under EUPL, Version 1.2 (the "License");
726
+ * you may not use this file except in compliance with the License.
727
+ * You may obtain a copy of the License at
728
+ *
729
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
730
+ *
731
+ * Unless required by applicable law or agreed to in writing, software
732
+ * distributed under the License is distributed on an "AS IS" basis,
733
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
734
+ * See the License for the specific language governing permissions and
735
+ * limitations under the License.
736
+ */
737
+
738
+ /**
739
+ * Generated bundle index. Do not edit.
740
+ */
741
+
742
+ exports.ChoiceFieldModule = ChoiceFieldModule;
743
+ exports.ChoiceFieldService = ChoiceFieldService;
744
+ exports.ɵa = ChoiceFieldListComponent;
745
+ exports.ɵb = ChoiceFieldDetailComponent;
746
+ exports.ɵc = ChoiceFieldCreateComponent;
747
+ exports.ɵd = ChoiceFieldValueListComponent;
748
+ exports.ɵe = ChoiceFieldValueCreateComponent;
749
+ exports.ɵf = ChoiceFieldValueDetailComponent;
750
+ exports.ɵg = ChoiceFieldRoutingModule;
751
+
752
+ Object.defineProperty(exports, '__esModule', { value: true });
753
+
754
+ })));
755
+ //# sourceMappingURL=valtimo-choice-field.umd.js.map