@stemy/ngx-dynamic-form 12.0.3 → 12.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/stemy-ngx-dynamic-form.umd.js +520 -337
- package/bundles/stemy-ngx-dynamic-form.umd.js.map +1 -1
- package/esm2015/ngx-dynamic-form/common-types.js +22 -15
- package/esm2015/ngx-dynamic-form/components/base/dynamic-form-base.component.js +67 -37
- package/esm2015/ngx-dynamic-form/components/dynamic-form/dynamic-form.component.js +46 -29
- package/esm2015/ngx-dynamic-form/components/dynamic-form-file/dynamic-form-file.component.js +13 -8
- package/esm2015/ngx-dynamic-form/components/dynamic-form-group/dynamic-form-group.component.js +21 -14
- package/esm2015/ngx-dynamic-form/components/dynamic-form-input/dynamic-form-input.component.js +18 -11
- package/esm2015/ngx-dynamic-form/components/dynamic-form-model/dynamic-form-model.component.js +17 -11
- package/esm2015/ngx-dynamic-form/components/dynamic-form-select/dynamic-form-select.component.js +15 -8
- package/esm2015/ngx-dynamic-form/components/dynamic-form-static/dynamic-form-static.component.js +14 -8
- package/esm2015/ngx-dynamic-form/components/dynamic-forms/dynamic-forms.component.js +53 -33
- package/esm2015/ngx-dynamic-form/directives/async-submit.directive.js +32 -22
- package/esm2015/ngx-dynamic-form/directives/dynamic-form-control.directive.js +14 -13
- package/esm2015/ngx-dynamic-form/directives/dynamic-form-group.directive.js +16 -14
- package/esm2015/ngx-dynamic-form/directives/dynamic-form-template.directive.js +32 -22
- package/esm2015/ngx-dynamic-form/ngx-dynamic-form.module.js +63 -26
- package/esm2015/ngx-dynamic-form/services/dynamic-form.service.js +13 -10
- package/esm2015/ngx-dynamic-form/services/form-utilities.js +14 -3
- package/esm2015/ngx-dynamic-form/services/open-api.service.js +10 -7
- package/esm2015/stemy-ngx-dynamic-form.js +1 -3
- package/fesm2015/stemy-ngx-dynamic-form.js +424 -272
- package/fesm2015/stemy-ngx-dynamic-form.js.map +1 -1
- package/ngx-dynamic-form/common-types.d.ts +3 -0
- package/ngx-dynamic-form/components/base/dynamic-form-base.component.d.ts +3 -0
- package/ngx-dynamic-form/components/dynamic-form/dynamic-form.component.d.ts +3 -0
- package/ngx-dynamic-form/components/dynamic-form-file/dynamic-form-file.component.d.ts +3 -0
- package/ngx-dynamic-form/components/dynamic-form-group/dynamic-form-group.component.d.ts +3 -0
- package/ngx-dynamic-form/components/dynamic-form-input/dynamic-form-input.component.d.ts +3 -0
- package/ngx-dynamic-form/components/dynamic-form-model/dynamic-form-model.component.d.ts +3 -0
- package/ngx-dynamic-form/components/dynamic-form-select/dynamic-form-select.component.d.ts +3 -0
- package/ngx-dynamic-form/components/dynamic-form-static/dynamic-form-static.component.d.ts +3 -0
- package/ngx-dynamic-form/components/dynamic-forms/dynamic-forms.component.d.ts +3 -0
- package/ngx-dynamic-form/directives/async-submit.directive.d.ts +3 -0
- package/ngx-dynamic-form/directives/dynamic-form-control.directive.d.ts +3 -0
- package/ngx-dynamic-form/directives/dynamic-form-group.directive.d.ts +3 -0
- package/ngx-dynamic-form/directives/dynamic-form-template.directive.d.ts +3 -0
- package/ngx-dynamic-form/ngx-dynamic-form.module.d.ts +19 -0
- package/ngx-dynamic-form/services/dynamic-form.service.d.ts +3 -0
- package/ngx-dynamic-form/services/open-api.service.d.ts +3 -0
- package/package.json +10 -11
- package/stemy-ngx-dynamic-form.d.ts +1 -2
- package/stemy-ngx-dynamic-form.metadata.json +0 -1
|
@@ -2,7 +2,30 @@
|
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('@stemy/ngx-utils'), require('@angular/common'), require('rxjs/operators')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define('@stemy/ngx-dynamic-form', ['exports', '@angular/core', '@angular/forms', '@stemy/ngx-utils', '@angular/common', 'rxjs/operators'], factory) :
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.stemy = global.stemy || {}, global.stemy["ngx-dynamic-form"] = {}), global.ng.core, global.ng.forms, global["@stemy/ngx-utils"], global.ng.common, global.rxjs.operators));
|
|
5
|
-
})(this, (function (exports,
|
|
5
|
+
})(this, (function (exports, i0, i2, i3, i2$1, operators) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
26
|
+
var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2);
|
|
27
|
+
var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
|
|
28
|
+
var i2__namespace = /*#__PURE__*/_interopNamespace(i2$1);
|
|
6
29
|
|
|
7
30
|
/*! *****************************************************************************
|
|
8
31
|
Copyright (c) Microsoft Corporation.
|
|
@@ -58,7 +81,7 @@
|
|
|
58
81
|
}
|
|
59
82
|
return t;
|
|
60
83
|
}
|
|
61
|
-
function __decorate(decorators, target, key, desc) {
|
|
84
|
+
function __decorate$1(decorators, target, key, desc) {
|
|
62
85
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
63
86
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
64
87
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -71,7 +94,7 @@
|
|
|
71
94
|
function __param(paramIndex, decorator) {
|
|
72
95
|
return function (target, key) { decorator(target, key, paramIndex); };
|
|
73
96
|
}
|
|
74
|
-
function __metadata(metadataKey, metadataValue) {
|
|
97
|
+
function __metadata$1(metadataKey, metadataValue) {
|
|
75
98
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
76
99
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
77
100
|
}
|
|
@@ -313,9 +336,9 @@
|
|
|
313
336
|
return value;
|
|
314
337
|
}
|
|
315
338
|
|
|
316
|
-
var FORM_GROUP_TYPE = new
|
|
317
|
-
var FORM_CONTROL_PROVIDER = new
|
|
318
|
-
var DYNAMIC_FORM = new
|
|
339
|
+
var FORM_GROUP_TYPE = new i0.InjectionToken("form-group-provider");
|
|
340
|
+
var FORM_CONTROL_PROVIDER = new i0.InjectionToken("form-control-provider");
|
|
341
|
+
var DYNAMIC_FORM = new i0.InjectionToken("dynamic-form-base");
|
|
319
342
|
var FormControlComponent = /** @class */ (function () {
|
|
320
343
|
function FormControlComponent(api, form, language, toaster) {
|
|
321
344
|
this.api = api;
|
|
@@ -370,22 +393,32 @@
|
|
|
370
393
|
});
|
|
371
394
|
return FormControlComponent;
|
|
372
395
|
}());
|
|
373
|
-
FormControlComponent
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
396
|
+
FormControlComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FormControlComponent, deps: [{ token: i3.API_SERVICE }, { token: DYNAMIC_FORM }, { token: i3.LANGUAGE_SERVICE }, { token: i3.TOASTER_SERVICE }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
397
|
+
FormControlComponent.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FormControlComponent, host: { properties: { "class.form-input": "this.inputClass" } }, ngImport: i0__namespace });
|
|
398
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FormControlComponent, decorators: [{
|
|
399
|
+
type: i0.Directive
|
|
400
|
+
}], ctorParameters: function () {
|
|
401
|
+
return [{ type: undefined, decorators: [{
|
|
402
|
+
type: i0.Inject,
|
|
403
|
+
args: [i3.API_SERVICE]
|
|
404
|
+
}] }, { type: undefined, decorators: [{
|
|
405
|
+
type: i0.Inject,
|
|
406
|
+
args: [DYNAMIC_FORM]
|
|
407
|
+
}] }, { type: undefined, decorators: [{
|
|
408
|
+
type: i0.Inject,
|
|
409
|
+
args: [i3.LANGUAGE_SERVICE]
|
|
410
|
+
}] }, { type: undefined, decorators: [{
|
|
411
|
+
type: i0.Inject,
|
|
412
|
+
args: [i3.TOASTER_SERVICE]
|
|
413
|
+
}] }];
|
|
414
|
+
}, propDecorators: { inputClass: [{
|
|
415
|
+
type: i0.HostBinding,
|
|
416
|
+
args: ["class.form-input"]
|
|
417
|
+
}] } });
|
|
385
418
|
function createValidator(control) {
|
|
386
419
|
var data = control.data || {};
|
|
387
|
-
var validators = [data.validator].concat(data.validators || []).filter(
|
|
388
|
-
return
|
|
420
|
+
var validators = [data.validator].concat(data.validators || []).filter(i3.ObjectUtils.isDefined).map(function (v) {
|
|
421
|
+
return i3.ReflectUtils.resolve(v, control.injector);
|
|
389
422
|
});
|
|
390
423
|
return function (ctrl) { return new Promise(function (resolve) {
|
|
391
424
|
var control = ctrl;
|
|
@@ -396,16 +429,16 @@
|
|
|
396
429
|
}
|
|
397
430
|
var validate = validators.map(function (v) { return v(control); });
|
|
398
431
|
var metaValidator = control.meta.validator;
|
|
399
|
-
if (
|
|
432
|
+
if (i3.ObjectUtils.isFunction(metaValidator)) {
|
|
400
433
|
validate.push(metaValidator(control));
|
|
401
434
|
}
|
|
402
435
|
Promise.all(validate).then(function (results) {
|
|
403
|
-
results = results.filter(function (error) { return
|
|
436
|
+
results = results.filter(function (error) { return i3.ObjectUtils.isObject(error) || i3.ObjectUtils.isString(error); });
|
|
404
437
|
var result = null;
|
|
405
438
|
if (results.length > 0) {
|
|
406
439
|
result = {};
|
|
407
440
|
results.forEach(function (error) {
|
|
408
|
-
if (
|
|
441
|
+
if (i3.ObjectUtils.isString(error)) {
|
|
409
442
|
result[error] = {};
|
|
410
443
|
return;
|
|
411
444
|
}
|
|
@@ -422,7 +455,7 @@
|
|
|
422
455
|
if (control === void 0) { control = null; }
|
|
423
456
|
this.form = form;
|
|
424
457
|
this.control = control;
|
|
425
|
-
this.formId =
|
|
458
|
+
this.formId = i3.UniqueUtils.uuid();
|
|
426
459
|
this.meta = {};
|
|
427
460
|
this.hidden = false;
|
|
428
461
|
this.dummyData = {};
|
|
@@ -496,7 +529,7 @@
|
|
|
496
529
|
DynamicFormControlHelper.prototype.createTester = function (test, defaultFunc) {
|
|
497
530
|
if (defaultFunc === void 0) { defaultFunc = null; }
|
|
498
531
|
var tester = this.data[test]
|
|
499
|
-
?
|
|
532
|
+
? i3.ReflectUtils.resolve(this.data[test], this.form.injector)
|
|
500
533
|
: (defaultFunc || (function () { return Promise.resolve(false); }));
|
|
501
534
|
return function (control) { return tester(control); };
|
|
502
535
|
};
|
|
@@ -517,7 +550,7 @@
|
|
|
517
550
|
_this.helper.findProvider(_this);
|
|
518
551
|
_this.initialized = false;
|
|
519
552
|
_this.loading = false;
|
|
520
|
-
_this.changeTimer =
|
|
553
|
+
_this.changeTimer = i3.TimerUtils.createTimeout();
|
|
521
554
|
_this.statusChanges.subscribe(function () {
|
|
522
555
|
var root = _this.form.root;
|
|
523
556
|
root.onStatusChange.emit(root);
|
|
@@ -631,11 +664,11 @@
|
|
|
631
664
|
configurable: true
|
|
632
665
|
});
|
|
633
666
|
DynamicFormGroup.createFormControls = function (group, controls) {
|
|
634
|
-
if (!controls &&
|
|
667
|
+
if (!controls && i3.ObjectUtils.isObject(group.model)) {
|
|
635
668
|
var props = Object.keys(group.model);
|
|
636
669
|
controls = props.map(function (id) {
|
|
637
670
|
return getFormControl(group.model, id);
|
|
638
|
-
}).filter(
|
|
671
|
+
}).filter(i3.ObjectUtils.isDefined);
|
|
639
672
|
}
|
|
640
673
|
if (!controls)
|
|
641
674
|
return [];
|
|
@@ -654,7 +687,7 @@
|
|
|
654
687
|
});
|
|
655
688
|
};
|
|
656
689
|
DynamicFormGroup.createFormSerializers = function (group, serializers) {
|
|
657
|
-
if (!serializers &&
|
|
690
|
+
if (!serializers && i3.ObjectUtils.isObject(group.model)) {
|
|
658
691
|
var props = Object.keys(group.model);
|
|
659
692
|
serializers = props.reduce(function (result, id) {
|
|
660
693
|
var serializer = getFormSerializer(group.model, id);
|
|
@@ -670,7 +703,7 @@
|
|
|
670
703
|
var serializer = serializers[id] || defaultSerializer;
|
|
671
704
|
return !serializer ? null : {
|
|
672
705
|
id: id,
|
|
673
|
-
func:
|
|
706
|
+
func: i3.ReflectUtils.resolve(serializer, group.injector)
|
|
674
707
|
};
|
|
675
708
|
});
|
|
676
709
|
};
|
|
@@ -747,7 +780,7 @@
|
|
|
747
780
|
root.onInit.emit(root);
|
|
748
781
|
root.onStatusChange.emit(root);
|
|
749
782
|
// https://github.com/angular/angular/issues/14542
|
|
750
|
-
var statusTimer =
|
|
783
|
+
var statusTimer = i3.TimerUtils.createInterval();
|
|
751
784
|
statusTimer.set(function () {
|
|
752
785
|
if (_this.status == "PENDING")
|
|
753
786
|
return;
|
|
@@ -791,7 +824,7 @@
|
|
|
791
824
|
var data = control.data;
|
|
792
825
|
if (!data || !data.reload)
|
|
793
826
|
return Promise.resolve(null);
|
|
794
|
-
var reload =
|
|
827
|
+
var reload = i3.ObjectUtils.isArray(data.reload) ? data.reload : [data.reload];
|
|
795
828
|
return Promise.all(reload.map(function (id) {
|
|
796
829
|
var nextControl = _this.getControl(id);
|
|
797
830
|
if (!nextControl || controls.has(nextControl))
|
|
@@ -805,7 +838,7 @@
|
|
|
805
838
|
}));
|
|
806
839
|
};
|
|
807
840
|
return DynamicFormGroup;
|
|
808
|
-
}(
|
|
841
|
+
}(i2.FormGroup));
|
|
809
842
|
var DynamicFormControl = /** @class */ (function (_super) {
|
|
810
843
|
__extends(DynamicFormControl, _super);
|
|
811
844
|
function DynamicFormControl(control, group) {
|
|
@@ -929,25 +962,24 @@
|
|
|
929
962
|
this.markAsTouched({ onlySelf: true });
|
|
930
963
|
};
|
|
931
964
|
return DynamicFormControl;
|
|
932
|
-
}(
|
|
965
|
+
}(i2.FormControl));
|
|
933
966
|
// --- Decorator functions ---
|
|
934
967
|
var emptyArray = [];
|
|
935
968
|
var emptyTester = function () {
|
|
936
969
|
return Promise.resolve(false);
|
|
937
970
|
};
|
|
938
|
-
var ɵ0 = emptyTester;
|
|
939
971
|
function defaultSerializer(id, parent) {
|
|
940
972
|
var control = parent.getControl(id);
|
|
941
973
|
return !control ? Promise.resolve(parent.model[id]) : control.serialize();
|
|
942
974
|
}
|
|
943
975
|
function FormSerializable(serializer) {
|
|
944
976
|
return function (target, propertyKey) {
|
|
945
|
-
|
|
977
|
+
i3.ReflectUtils.defineMetadata("dynamicFormSerializer", serializer || defaultSerializer, target, propertyKey);
|
|
946
978
|
};
|
|
947
979
|
}
|
|
948
980
|
function FormInput(data) {
|
|
949
981
|
return function (target, propertyKey) {
|
|
950
|
-
var meta =
|
|
982
|
+
var meta = i3.ReflectUtils.getOwnMetadata("design:type", target, propertyKey);
|
|
951
983
|
var type = meta ? meta.name : "";
|
|
952
984
|
var inputType = propertyKey.indexOf("password") < 0 ? "text" : "password";
|
|
953
985
|
switch (type) {
|
|
@@ -986,7 +1018,7 @@
|
|
|
986
1018
|
var sets = getFormFieldSets(target);
|
|
987
1019
|
data.classes = data.classes || "";
|
|
988
1020
|
sets[data.id] = data;
|
|
989
|
-
|
|
1021
|
+
i3.ReflectUtils.defineMetadata("dynamicFormFieldSets", sets, target);
|
|
990
1022
|
};
|
|
991
1023
|
}
|
|
992
1024
|
function provideFormGroup(component) {
|
|
@@ -1009,22 +1041,22 @@
|
|
|
1009
1041
|
};
|
|
1010
1042
|
}
|
|
1011
1043
|
function defineFormControl(target, propertyKey, control) {
|
|
1012
|
-
|
|
1044
|
+
i3.ReflectUtils.defineMetadata("dynamicFormControl", control, target, propertyKey);
|
|
1013
1045
|
}
|
|
1014
1046
|
function getFormFieldSets(target) {
|
|
1015
|
-
return
|
|
1047
|
+
return i3.ReflectUtils.getMetadata("dynamicFormFieldSets", target) || {};
|
|
1016
1048
|
}
|
|
1017
1049
|
function getFormControl(target, propertyKey) {
|
|
1018
|
-
return
|
|
1050
|
+
return i3.ReflectUtils.getMetadata("dynamicFormControl", target, propertyKey);
|
|
1019
1051
|
}
|
|
1020
1052
|
function getFormSerializer(target, propertyKey) {
|
|
1021
|
-
return
|
|
1053
|
+
return i3.ReflectUtils.getMetadata("dynamicFormSerializer", target, propertyKey);
|
|
1022
1054
|
}
|
|
1023
1055
|
function createFormControl(id, type, data) {
|
|
1024
1056
|
data = data || {};
|
|
1025
|
-
data.label =
|
|
1057
|
+
data.label = i3.ObjectUtils.isNullOrUndefined(data.label) ? id : data.label;
|
|
1026
1058
|
data.labelAlign = data.labelAlign || "left";
|
|
1027
|
-
data.fieldSet = data.fieldSet ||
|
|
1059
|
+
data.fieldSet = data.fieldSet || i3.UniqueUtils.uuid();
|
|
1028
1060
|
data.classes = data.classes || "";
|
|
1029
1061
|
data.readonly = data.readonly || emptyTester;
|
|
1030
1062
|
data.hidden = data.hidden || emptyTester;
|
|
@@ -1071,8 +1103,8 @@
|
|
|
1071
1103
|
data = control.data;
|
|
1072
1104
|
data.accept = data.accept || ".jpg,.jpeg,.png";
|
|
1073
1105
|
data.multi = data.multi || false;
|
|
1074
|
-
data.baseUrl =
|
|
1075
|
-
data.uploadUrl =
|
|
1106
|
+
data.baseUrl = i3.ObjectUtils.isString(data.baseUrl) ? data.baseUrl : "assets/";
|
|
1107
|
+
data.uploadUrl = i3.ObjectUtils.isString(data.uploadUrl) ? data.uploadUrl : "assets";
|
|
1076
1108
|
data.createUploadData = data.createUploadData || (function (file) {
|
|
1077
1109
|
var form = new FormData();
|
|
1078
1110
|
form.append("file", file);
|
|
@@ -1100,7 +1132,7 @@
|
|
|
1100
1132
|
}));
|
|
1101
1133
|
}
|
|
1102
1134
|
// Sort providers
|
|
1103
|
-
providers.sort(function (a, b) { return
|
|
1135
|
+
providers.sort(function (a, b) { return i3.ObjectUtils.compare(a.priority, b.priority); });
|
|
1104
1136
|
return providers[0];
|
|
1105
1137
|
};
|
|
1106
1138
|
DynamicFormService.prototype.createComponent = function (vcr, provider) {
|
|
@@ -1117,16 +1149,34 @@
|
|
|
1117
1149
|
};
|
|
1118
1150
|
return DynamicFormService;
|
|
1119
1151
|
}());
|
|
1120
|
-
DynamicFormService
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1152
|
+
DynamicFormService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormService, deps: [{ token: FORM_CONTROL_PROVIDER }, { token: FORM_GROUP_TYPE }, { token: i0__namespace.ComponentFactoryResolver }, { token: i0__namespace.Injector }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1153
|
+
DynamicFormService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormService });
|
|
1154
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormService, decorators: [{
|
|
1155
|
+
type: i0.Injectable
|
|
1156
|
+
}], ctorParameters: function () {
|
|
1157
|
+
return [{ type: undefined, decorators: [{
|
|
1158
|
+
type: i0.Inject,
|
|
1159
|
+
args: [FORM_CONTROL_PROVIDER]
|
|
1160
|
+
}] }, { type: i0__namespace.Type, decorators: [{
|
|
1161
|
+
type: i0.Inject,
|
|
1162
|
+
args: [FORM_GROUP_TYPE]
|
|
1163
|
+
}] }, { type: i0__namespace.ComponentFactoryResolver }, { type: i0__namespace.Injector }];
|
|
1164
|
+
} });
|
|
1129
1165
|
|
|
1166
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1167
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1168
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1169
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1170
|
+
else
|
|
1171
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
1172
|
+
if (d = decorators[i])
|
|
1173
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1174
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1175
|
+
};
|
|
1176
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
1177
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
1178
|
+
return Reflect.metadata(k, v);
|
|
1179
|
+
};
|
|
1130
1180
|
var FormUtilities = /** @class */ (function () {
|
|
1131
1181
|
function FormUtilities() {
|
|
1132
1182
|
}
|
|
@@ -1134,7 +1184,7 @@
|
|
|
1134
1184
|
if (expression === void 0) { expression = "true"; }
|
|
1135
1185
|
// @dynamic
|
|
1136
1186
|
var lambda = function (control) {
|
|
1137
|
-
return Promise.resolve(
|
|
1187
|
+
return Promise.resolve(i3.ObjectUtils.evaluate(expression, { control: control }));
|
|
1138
1188
|
};
|
|
1139
1189
|
return lambda;
|
|
1140
1190
|
};
|
|
@@ -1158,13 +1208,13 @@
|
|
|
1158
1208
|
};
|
|
1159
1209
|
FormUtilities.validateRequired = function (control) {
|
|
1160
1210
|
var value = control.value;
|
|
1161
|
-
return Promise.resolve(!
|
|
1211
|
+
return Promise.resolve(!i3.ObjectUtils.isNumber(value) && !value ? "error.required" : null);
|
|
1162
1212
|
};
|
|
1163
1213
|
FormUtilities.validateMinLength = function (length) {
|
|
1164
1214
|
// @dynamic
|
|
1165
1215
|
var lambda = function (control) {
|
|
1166
1216
|
var value = control.value;
|
|
1167
|
-
if (!
|
|
1217
|
+
if (!i3.ObjectUtils.isString(value) || value.length < length) {
|
|
1168
1218
|
return Promise.resolve({ "error.min-length": { length: length } });
|
|
1169
1219
|
}
|
|
1170
1220
|
return Promise.resolve(null);
|
|
@@ -1175,7 +1225,7 @@
|
|
|
1175
1225
|
// @dynamic
|
|
1176
1226
|
var lambda = function (control) {
|
|
1177
1227
|
var value = control.value;
|
|
1178
|
-
if (!
|
|
1228
|
+
if (!i3.ObjectUtils.isString(value) || value.length > length) {
|
|
1179
1229
|
return Promise.resolve({ "error.max-length": { length: length } });
|
|
1180
1230
|
}
|
|
1181
1231
|
return Promise.resolve(null);
|
|
@@ -1208,9 +1258,9 @@
|
|
|
1208
1258
|
};
|
|
1209
1259
|
FormUtilities.serializeFile = function (id, parent) {
|
|
1210
1260
|
var value = parent.model[id];
|
|
1211
|
-
if (
|
|
1261
|
+
if (i3.ObjectUtils.isBlob(value))
|
|
1212
1262
|
return Promise.resolve(value);
|
|
1213
|
-
return Promise.resolve(!
|
|
1263
|
+
return Promise.resolve(!i3.ObjectUtils.isString(value) || !value.startsWith("data:") ? null : i3.FileUtils.dataToBlob(value));
|
|
1214
1264
|
};
|
|
1215
1265
|
FormUtilities.serializeNumber = function (id, parent) {
|
|
1216
1266
|
var value = parent.model[id];
|
|
@@ -1226,7 +1276,7 @@
|
|
|
1226
1276
|
// @dynamic
|
|
1227
1277
|
var lambda = function (id, parent) {
|
|
1228
1278
|
var value = parent.model[id];
|
|
1229
|
-
if (!
|
|
1279
|
+
if (!i3.ObjectUtils.isDate(value))
|
|
1230
1280
|
return Promise.resolve(value || defaultValue);
|
|
1231
1281
|
return Promise.resolve(!format ? value : date.transform(value, format));
|
|
1232
1282
|
};
|
|
@@ -1235,7 +1285,10 @@
|
|
|
1235
1285
|
return FormUtilities;
|
|
1236
1286
|
}());
|
|
1237
1287
|
__decorate([
|
|
1238
|
-
|
|
1288
|
+
i3.FactoryDependencies(i2$1.DatePipe),
|
|
1289
|
+
__metadata("design:type", Function),
|
|
1290
|
+
__metadata("design:paramtypes", [i2$1.DatePipe, String, String]),
|
|
1291
|
+
__metadata("design:returntype", Function)
|
|
1239
1292
|
], FormUtilities, "serializeDate", null);
|
|
1240
1293
|
|
|
1241
1294
|
var OpenApiService = /** @class */ (function () {
|
|
@@ -1304,7 +1357,7 @@
|
|
|
1304
1357
|
};
|
|
1305
1358
|
};
|
|
1306
1359
|
OpenApiService.prototype.getFormInputData = function (property, schema) {
|
|
1307
|
-
var type =
|
|
1360
|
+
var type = i3.StringUtils.has(property.id, "password", "Password") ? "password" : property.type;
|
|
1308
1361
|
switch (property.type) {
|
|
1309
1362
|
case "boolean":
|
|
1310
1363
|
type = "checkbox";
|
|
@@ -1362,19 +1415,23 @@
|
|
|
1362
1415
|
};
|
|
1363
1416
|
return OpenApiService;
|
|
1364
1417
|
}());
|
|
1365
|
-
OpenApiService
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1418
|
+
OpenApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: OpenApiService, deps: [{ token: i3.API_SERVICE }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1419
|
+
OpenApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: OpenApiService });
|
|
1420
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: OpenApiService, decorators: [{
|
|
1421
|
+
type: i0.Injectable
|
|
1422
|
+
}], ctorParameters: function () {
|
|
1423
|
+
return [{ type: undefined, decorators: [{
|
|
1424
|
+
type: i0.Inject,
|
|
1425
|
+
args: [i3.API_SERVICE]
|
|
1426
|
+
}] }];
|
|
1427
|
+
} });
|
|
1371
1428
|
|
|
1372
1429
|
var AsyncSubmitDirective = /** @class */ (function () {
|
|
1373
1430
|
function AsyncSubmitDirective(toaster, cdr, elem, renderer) {
|
|
1374
1431
|
this.toaster = toaster;
|
|
1375
1432
|
this.cdr = cdr;
|
|
1376
|
-
this.onSuccess = new
|
|
1377
|
-
this.onError = new
|
|
1433
|
+
this.onSuccess = new i0.EventEmitter();
|
|
1434
|
+
this.onError = new i0.EventEmitter();
|
|
1378
1435
|
if (elem.nativeElement.tagName !== "BUTTON")
|
|
1379
1436
|
return;
|
|
1380
1437
|
renderer.setAttribute(elem.nativeElement, "type", "button");
|
|
@@ -1446,27 +1503,38 @@
|
|
|
1446
1503
|
};
|
|
1447
1504
|
return AsyncSubmitDirective;
|
|
1448
1505
|
}());
|
|
1449
|
-
AsyncSubmitDirective
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1506
|
+
AsyncSubmitDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: AsyncSubmitDirective, deps: [{ token: i3.TOASTER_SERVICE }, { token: i0__namespace.ChangeDetectorRef }, { token: i0__namespace.ElementRef }, { token: i0__namespace.Renderer2 }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
1507
|
+
AsyncSubmitDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: AsyncSubmitDirective, selector: "[async-submit]", inputs: { method: ["async-submit", "method"], form: "form" }, outputs: { onSuccess: "onSuccess", onError: "onError" }, host: { listeners: { "click": "click()" }, properties: { "class.disabled": "this.isDisabled", "class.loading": "this.isLoading" } }, exportAs: ["async-submit"], ngImport: i0__namespace });
|
|
1508
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: AsyncSubmitDirective, decorators: [{
|
|
1509
|
+
type: i0.Directive,
|
|
1510
|
+
args: [{
|
|
1511
|
+
selector: "[async-submit]",
|
|
1512
|
+
exportAs: "async-submit"
|
|
1513
|
+
}]
|
|
1514
|
+
}], ctorParameters: function () {
|
|
1515
|
+
return [{ type: undefined, decorators: [{
|
|
1516
|
+
type: i0.Inject,
|
|
1517
|
+
args: [i3.TOASTER_SERVICE]
|
|
1518
|
+
}] }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.ElementRef }, { type: i0__namespace.Renderer2 }];
|
|
1519
|
+
}, propDecorators: { method: [{
|
|
1520
|
+
type: i0.Input,
|
|
1521
|
+
args: ["async-submit"]
|
|
1522
|
+
}], form: [{
|
|
1523
|
+
type: i0.Input
|
|
1524
|
+
}], onSuccess: [{
|
|
1525
|
+
type: i0.Output
|
|
1526
|
+
}], onError: [{
|
|
1527
|
+
type: i0.Output
|
|
1528
|
+
}], isDisabled: [{
|
|
1529
|
+
type: i0.HostBinding,
|
|
1530
|
+
args: ["class.disabled"]
|
|
1531
|
+
}], isLoading: [{
|
|
1532
|
+
type: i0.HostBinding,
|
|
1533
|
+
args: ["class.loading"]
|
|
1534
|
+
}], click: [{
|
|
1535
|
+
type: i0.HostListener,
|
|
1536
|
+
args: ["click"]
|
|
1537
|
+
}] } });
|
|
1470
1538
|
|
|
1471
1539
|
var DynamicFormControlDirective = /** @class */ (function () {
|
|
1472
1540
|
function DynamicFormControlDirective(vcr, forms) {
|
|
@@ -1490,18 +1558,17 @@
|
|
|
1490
1558
|
};
|
|
1491
1559
|
return DynamicFormControlDirective;
|
|
1492
1560
|
}());
|
|
1493
|
-
DynamicFormControlDirective
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
};
|
|
1561
|
+
DynamicFormControlDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormControlDirective, deps: [{ token: i0__namespace.ViewContainerRef }, { token: DynamicFormService }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
1562
|
+
DynamicFormControlDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: DynamicFormControlDirective, selector: "[form-control]", inputs: { control: ["form-control", "control"] }, usesOnChanges: true, ngImport: i0__namespace });
|
|
1563
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormControlDirective, decorators: [{
|
|
1564
|
+
type: i0.Directive,
|
|
1565
|
+
args: [{
|
|
1566
|
+
selector: "[form-control]",
|
|
1567
|
+
}]
|
|
1568
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ViewContainerRef }, { type: DynamicFormService }]; }, propDecorators: { control: [{
|
|
1569
|
+
type: i0.Input,
|
|
1570
|
+
args: ["form-control"]
|
|
1571
|
+
}] } });
|
|
1505
1572
|
|
|
1506
1573
|
var DynamicFormTemplateDirective = /** @class */ (function () {
|
|
1507
1574
|
function DynamicFormTemplateDirective(template) {
|
|
@@ -1509,27 +1576,36 @@
|
|
|
1509
1576
|
}
|
|
1510
1577
|
return DynamicFormTemplateDirective;
|
|
1511
1578
|
}());
|
|
1512
|
-
DynamicFormTemplateDirective
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1579
|
+
DynamicFormTemplateDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormTemplateDirective, deps: [{ token: i0__namespace.TemplateRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
1580
|
+
DynamicFormTemplateDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: DynamicFormTemplateDirective, selector: "ng-template[control],\n ng-template[label],\n ng-template[input],\n ng-template[prefix],\n ng-template[suffix],\n ng-template[setPrefix],\n ng-template[setSuffix],\n ng-template[formPrefix],\n ng-template[formSuffix],\n ng-template[innerFormPrefix],\n ng-template[innerFormSuffix]", inputs: { control: "control", label: "label", input: "input", prefix: "prefix", suffix: "suffix", setPrefix: "setPrefix", setSuffix: "setSuffix", formPrefix: "formPrefix", formSuffix: "formSuffix", innerFormPrefix: "innerFormPrefix", innerFormSuffix: "innerFormSuffix" }, ngImport: i0__namespace });
|
|
1581
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormTemplateDirective, decorators: [{
|
|
1582
|
+
type: i0.Directive,
|
|
1583
|
+
args: [{
|
|
1584
|
+
selector: "ng-template[control],\n ng-template[label],\n ng-template[input],\n ng-template[prefix],\n ng-template[suffix],\n ng-template[setPrefix],\n ng-template[setSuffix],\n ng-template[formPrefix],\n ng-template[formSuffix],\n ng-template[innerFormPrefix],\n ng-template[innerFormSuffix]"
|
|
1585
|
+
}]
|
|
1586
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.TemplateRef }]; }, propDecorators: { control: [{
|
|
1587
|
+
type: i0.Input
|
|
1588
|
+
}], label: [{
|
|
1589
|
+
type: i0.Input
|
|
1590
|
+
}], input: [{
|
|
1591
|
+
type: i0.Input
|
|
1592
|
+
}], prefix: [{
|
|
1593
|
+
type: i0.Input
|
|
1594
|
+
}], suffix: [{
|
|
1595
|
+
type: i0.Input
|
|
1596
|
+
}], setPrefix: [{
|
|
1597
|
+
type: i0.Input
|
|
1598
|
+
}], setSuffix: [{
|
|
1599
|
+
type: i0.Input
|
|
1600
|
+
}], formPrefix: [{
|
|
1601
|
+
type: i0.Input
|
|
1602
|
+
}], formSuffix: [{
|
|
1603
|
+
type: i0.Input
|
|
1604
|
+
}], innerFormPrefix: [{
|
|
1605
|
+
type: i0.Input
|
|
1606
|
+
}], innerFormSuffix: [{
|
|
1607
|
+
type: i0.Input
|
|
1608
|
+
}] } });
|
|
1533
1609
|
|
|
1534
1610
|
var DynamicFormGroupDirective = /** @class */ (function () {
|
|
1535
1611
|
function DynamicFormGroupDirective(vcr, forms) {
|
|
@@ -1558,19 +1634,19 @@
|
|
|
1558
1634
|
};
|
|
1559
1635
|
return DynamicFormGroupDirective;
|
|
1560
1636
|
}());
|
|
1561
|
-
DynamicFormGroupDirective
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1637
|
+
DynamicFormGroupDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormGroupDirective, deps: [{ token: i0__namespace.ViewContainerRef }, { token: DynamicFormService }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
1638
|
+
DynamicFormGroupDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: DynamicFormGroupDirective, selector: "[form-group]", inputs: { control: ["form-group", "control"], visible: "visible" }, usesOnChanges: true, ngImport: i0__namespace });
|
|
1639
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormGroupDirective, decorators: [{
|
|
1640
|
+
type: i0.Directive,
|
|
1641
|
+
args: [{
|
|
1642
|
+
selector: "[form-group]",
|
|
1643
|
+
}]
|
|
1644
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ViewContainerRef }, { type: DynamicFormService }]; }, propDecorators: { control: [{
|
|
1645
|
+
type: i0.Input,
|
|
1646
|
+
args: ["form-group"]
|
|
1647
|
+
}], visible: [{
|
|
1648
|
+
type: i0.Input
|
|
1649
|
+
}] } });
|
|
1574
1650
|
|
|
1575
1651
|
var DynamicFormBaseComponent = /** @class */ (function () {
|
|
1576
1652
|
function DynamicFormBaseComponent(cdr, formService) {
|
|
@@ -1582,17 +1658,17 @@
|
|
|
1582
1658
|
this.inputTemplates = {};
|
|
1583
1659
|
this.prefixTemplates = {};
|
|
1584
1660
|
this.suffixTemplates = {};
|
|
1585
|
-
this.onChange = new
|
|
1586
|
-
this.onStatusChange = new
|
|
1587
|
-
this.onInit = new
|
|
1588
|
-
this.onSubmit = new
|
|
1661
|
+
this.onChange = new i0.EventEmitter();
|
|
1662
|
+
this.onStatusChange = new i0.EventEmitter();
|
|
1663
|
+
this.onInit = new i0.EventEmitter();
|
|
1664
|
+
this.onSubmit = new i0.EventEmitter();
|
|
1589
1665
|
this.injector = formService.injector;
|
|
1590
1666
|
this.cdr = cdr;
|
|
1591
1667
|
}
|
|
1592
1668
|
Object.defineProperty(DynamicFormBaseComponent.prototype, "root", {
|
|
1593
1669
|
get: function () {
|
|
1594
1670
|
var form = this;
|
|
1595
|
-
while (
|
|
1671
|
+
while (i3.ObjectUtils.isDefined(form.parent)) {
|
|
1596
1672
|
form = form.parent;
|
|
1597
1673
|
}
|
|
1598
1674
|
return form;
|
|
@@ -1617,7 +1693,7 @@
|
|
|
1617
1693
|
this.setSuffixTemplates = this.filterTemplates(this.setSuffixTemplates, "setSuffix");
|
|
1618
1694
|
};
|
|
1619
1695
|
DynamicFormBaseComponent.prototype.filterTemplates = function (templates, type) {
|
|
1620
|
-
if (
|
|
1696
|
+
if (i3.ObjectUtils.isObject(templates) && Object.keys(templates).length > 0)
|
|
1621
1697
|
return templates;
|
|
1622
1698
|
return this.templates.filter(function (t) { return !!t[type]; }).reduce(function (result, directive) {
|
|
1623
1699
|
result[directive[type]] = directive.template;
|
|
@@ -1626,41 +1702,69 @@
|
|
|
1626
1702
|
};
|
|
1627
1703
|
return DynamicFormBaseComponent;
|
|
1628
1704
|
}());
|
|
1629
|
-
DynamicFormBaseComponent
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1705
|
+
DynamicFormBaseComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormBaseComponent, deps: [{ token: i0__namespace.ChangeDetectorRef }, { token: DynamicFormService }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
1706
|
+
DynamicFormBaseComponent.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: DynamicFormBaseComponent, inputs: { name: "name", testId: "testId", readonly: "readonly", updateOn: "updateOn", classes: "classes", parent: "parent", wrapperTemplate: "wrapperTemplate", fieldSetTemplate: "fieldSetTemplate", controlTemplate: "controlTemplate", controlTemplates: "controlTemplates", labelTemplates: "labelTemplates", inputTemplates: "inputTemplates", prefixTemplates: "prefixTemplates", suffixTemplates: "suffixTemplates", setPrefixTemplates: "setPrefixTemplates", setSuffixTemplates: "setSuffixTemplates" }, outputs: { onChange: "onChange", onStatusChange: "onStatusChange", onInit: "onInit", onSubmit: "onSubmit" }, queries: [{ propertyName: "prefixTemplate", first: true, predicate: ["prefixTemplate"], descendants: true }, { propertyName: "suffixTemplate", first: true, predicate: ["suffixTemplate"], descendants: true }, { propertyName: "cWrapperTemplate", first: true, predicate: ["wrapperTemplate"], descendants: true }, { propertyName: "cFieldSetTemplate", first: true, predicate: ["fieldSetTemplate"], descendants: true }, { propertyName: "cControlTemplate", first: true, predicate: ["controlTemplate"], descendants: true }, { propertyName: "templates", predicate: DynamicFormTemplateDirective }], ngImport: i0__namespace });
|
|
1707
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormBaseComponent, decorators: [{
|
|
1708
|
+
type: i0.Directive
|
|
1709
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ChangeDetectorRef }, { type: DynamicFormService }]; }, propDecorators: { name: [{
|
|
1710
|
+
type: i0.Input
|
|
1711
|
+
}], testId: [{
|
|
1712
|
+
type: i0.Input
|
|
1713
|
+
}], readonly: [{
|
|
1714
|
+
type: i0.Input
|
|
1715
|
+
}], updateOn: [{
|
|
1716
|
+
type: i0.Input
|
|
1717
|
+
}], classes: [{
|
|
1718
|
+
type: i0.Input
|
|
1719
|
+
}], parent: [{
|
|
1720
|
+
type: i0.Input
|
|
1721
|
+
}], wrapperTemplate: [{
|
|
1722
|
+
type: i0.Input
|
|
1723
|
+
}], fieldSetTemplate: [{
|
|
1724
|
+
type: i0.Input
|
|
1725
|
+
}], controlTemplate: [{
|
|
1726
|
+
type: i0.Input
|
|
1727
|
+
}], controlTemplates: [{
|
|
1728
|
+
type: i0.Input
|
|
1729
|
+
}], labelTemplates: [{
|
|
1730
|
+
type: i0.Input
|
|
1731
|
+
}], inputTemplates: [{
|
|
1732
|
+
type: i0.Input
|
|
1733
|
+
}], prefixTemplates: [{
|
|
1734
|
+
type: i0.Input
|
|
1735
|
+
}], suffixTemplates: [{
|
|
1736
|
+
type: i0.Input
|
|
1737
|
+
}], setPrefixTemplates: [{
|
|
1738
|
+
type: i0.Input
|
|
1739
|
+
}], setSuffixTemplates: [{
|
|
1740
|
+
type: i0.Input
|
|
1741
|
+
}], onChange: [{
|
|
1742
|
+
type: i0.Output
|
|
1743
|
+
}], onStatusChange: [{
|
|
1744
|
+
type: i0.Output
|
|
1745
|
+
}], onInit: [{
|
|
1746
|
+
type: i0.Output
|
|
1747
|
+
}], onSubmit: [{
|
|
1748
|
+
type: i0.Output
|
|
1749
|
+
}], prefixTemplate: [{
|
|
1750
|
+
type: i0.ContentChild,
|
|
1751
|
+
args: ["prefixTemplate"]
|
|
1752
|
+
}], suffixTemplate: [{
|
|
1753
|
+
type: i0.ContentChild,
|
|
1754
|
+
args: ["suffixTemplate"]
|
|
1755
|
+
}], templates: [{
|
|
1756
|
+
type: i0.ContentChildren,
|
|
1757
|
+
args: [DynamicFormTemplateDirective]
|
|
1758
|
+
}], cWrapperTemplate: [{
|
|
1759
|
+
type: i0.ContentChild,
|
|
1760
|
+
args: ["wrapperTemplate"]
|
|
1761
|
+
}], cFieldSetTemplate: [{
|
|
1762
|
+
type: i0.ContentChild,
|
|
1763
|
+
args: ["fieldSetTemplate"]
|
|
1764
|
+
}], cControlTemplate: [{
|
|
1765
|
+
type: i0.ContentChild,
|
|
1766
|
+
args: ["controlTemplate"]
|
|
1767
|
+
}] } });
|
|
1664
1768
|
|
|
1665
1769
|
var DynamicFormComponent = /** @class */ (function (_super) {
|
|
1666
1770
|
__extends(DynamicFormComponent, _super);
|
|
@@ -1743,34 +1847,45 @@
|
|
|
1743
1847
|
};
|
|
1744
1848
|
return DynamicFormComponent;
|
|
1745
1849
|
}(DynamicFormBaseComponent));
|
|
1746
|
-
DynamicFormComponent
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1850
|
+
DynamicFormComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormComponent, deps: [{ token: i0__namespace.ChangeDetectorRef }, { token: DynamicFormService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1851
|
+
DynamicFormComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DynamicFormComponent, selector: "dynamic-form, [dynamic-form]", inputs: { group: "group", controls: "controls", serializers: "serializers", fieldSets: "fieldSets", data: "data" }, providers: [
|
|
1852
|
+
{
|
|
1853
|
+
provide: DynamicFormBaseComponent,
|
|
1854
|
+
useExisting: DynamicFormComponent
|
|
1855
|
+
},
|
|
1856
|
+
{
|
|
1857
|
+
provide: DYNAMIC_FORM,
|
|
1858
|
+
useExisting: DynamicFormComponent
|
|
1859
|
+
}
|
|
1860
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace, template: "<ng-template #defaultFieldSetTemplate let-id=\"id\" let-controls=\"controls\" let-fieldSet=\"fieldSet\">\r\n <div [ngClass]=\"['form-fields', 'form-fields-' + id, fieldSet.classes]\">\r\n <ng-container [ngxTemplateOutlet]=\"setPrefixTemplates[fieldSet.id]\" [context]=\"fieldSet\"></ng-container>\r\n <div *ngIf=\"fieldSet.title\" [ngClass]=\"['form-title', fieldSet.titleClasses || '']\">\r\n {{ group.prefix + fieldSet.title | translate }}\r\n </div>\r\n <ng-template #subControls>\r\n <ng-container *ngFor=\"let control of controls\" [form-group]=\"control\" [visible]=\"control.visible\">\r\n\r\n </ng-container>\r\n </ng-template>\r\n <div *ngIf=\"fieldSet.setClasses; else subControls\" [ngClass]=\"fieldSet.setClasses\">\r\n <div *ngIf=\"fieldSet.controlClasses; else subControls\" [ngClass]=\"fieldSet.controlClasses\">\r\n <ng-container [ngTemplateOutlet]=\"subControls\"></ng-container>\r\n </div>\r\n </div>\r\n <ng-container [ngxTemplateOutlet]=\"setSuffixTemplates[fieldSet.id]\" [context]=\"fieldSet\"></ng-container>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #fieldSetsTemplate>\r\n <ng-container *ngFor=\"let fs of formControls | groupBy:'data.fieldSet'\"\r\n [ngxTemplateOutlet]=\"fieldSetTemplate || defaultFieldSetTemplate\"\r\n [context]=\"{form: this, id: fs.group, controls: fs.items, fieldSet: group.formFields[fs.group] || defaultFieldSet}\">\r\n </ng-container>\r\n</ng-template>\r\n<ng-template #defaultWrapperTemplate let-form=\"form\" let-fieldSetsTemplate=\"fieldSetsTemplate\">\r\n <ng-container [ngTemplateOutlet]=\"prefixTemplate\"\r\n [ngTemplateOutletContext]=\"{form: form, fieldSetsTemplate: fieldSetsTemplate}\"></ng-container>\r\n <form class=\"dynamic-form\" [ngClass]=\"form.classes || ''\" [formGroup]=\"group\" (submit)=\"onFormSubmit()\">\r\n <ng-container [ngTemplateOutlet]=\"fieldSetsTemplate\"></ng-container>\r\n <ng-content></ng-content>\r\n <div *ngIf=\"form.status == 'PENDING'\" class=\"dynamic-form-validator\">\r\n {{ group.prefix + 'message.pending' | translate }}\r\n </div>\r\n <button [ngStyle]=\"{display: 'none'}\">Submit</button>\r\n </form>\r\n <ng-container [ngTemplateOutlet]=\"suffixTemplate\"\r\n [ngTemplateOutletContext]=\"{form: form, fieldSetsTemplate: fieldSetsTemplate}\"></ng-container>\r\n</ng-template>\r\n<ng-template #loadingTemplate>\r\n <div *ngIf=\"status == 'LOADING'\" class=\"dynamic-form-loader\">\r\n {{ group.prefix + 'message.loading' | translate }}\r\n </div>\r\n</ng-template>\r\n<ng-container [ngTemplateOutlet]=\"wrapperTemplate || defaultWrapperTemplate\"\r\n [ngTemplateOutletContext]=\"{form: this, fieldSetsTemplate: fieldSetsTemplate}\"\r\n *ngIf=\"status !== 'LOADING'; else loadingTemplate\">\r\n</ng-container>\r\n", directives: [{ type: i2__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3__namespace.NgxTemplateOutletDirective, selector: "[ngxTemplateOutlet]", inputs: ["context", "additionalContext", "ngxTemplateOutlet"] }, { type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: DynamicFormGroupDirective, selector: "[form-group]", inputs: ["form-group", "visible"] }, { type: i2__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2__namespace$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i2__namespace$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i2__namespace$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i2__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], pipes: { "translate": i3__namespace.TranslatePipe, "groupBy": i3__namespace.GroupByPipe } });
|
|
1861
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormComponent, decorators: [{
|
|
1862
|
+
type: i0.Component,
|
|
1863
|
+
args: [{
|
|
1864
|
+
moduleId: module.id,
|
|
1865
|
+
selector: "dynamic-form, [dynamic-form]",
|
|
1866
|
+
templateUrl: "./dynamic-form.component.html",
|
|
1867
|
+
providers: [
|
|
1868
|
+
{
|
|
1869
|
+
provide: DynamicFormBaseComponent,
|
|
1870
|
+
useExisting: DynamicFormComponent
|
|
1871
|
+
},
|
|
1872
|
+
{
|
|
1873
|
+
provide: DYNAMIC_FORM,
|
|
1874
|
+
useExisting: DynamicFormComponent
|
|
1875
|
+
}
|
|
1876
|
+
]
|
|
1877
|
+
}]
|
|
1878
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ChangeDetectorRef }, { type: DynamicFormService }]; }, propDecorators: { group: [{
|
|
1879
|
+
type: i0.Input
|
|
1880
|
+
}], controls: [{
|
|
1881
|
+
type: i0.Input
|
|
1882
|
+
}], serializers: [{
|
|
1883
|
+
type: i0.Input
|
|
1884
|
+
}], fieldSets: [{
|
|
1885
|
+
type: i0.Input
|
|
1886
|
+
}], data: [{
|
|
1887
|
+
type: i0.Input
|
|
1888
|
+
}] } });
|
|
1774
1889
|
|
|
1775
1890
|
var statusPriority = ["LOADING", "PENDING", "DISABLED", "INVALID"];
|
|
1776
1891
|
var DynamicFormsComponent = /** @class */ (function (_super) {
|
|
@@ -1831,20 +1946,20 @@
|
|
|
1831
1946
|
results.forEach(function (data, ix) {
|
|
1832
1947
|
var config = _this.data[ix];
|
|
1833
1948
|
var path = null;
|
|
1834
|
-
if (
|
|
1949
|
+
if (i3.ObjectUtils.isArray(config.path) && config.path.length > 0) {
|
|
1835
1950
|
path = config.path;
|
|
1836
1951
|
}
|
|
1837
|
-
else if (
|
|
1952
|
+
else if (i3.ObjectUtils.isString(config.path) && config.path.length > 0) {
|
|
1838
1953
|
path = config.path.split(".");
|
|
1839
1954
|
}
|
|
1840
|
-
else if (
|
|
1955
|
+
else if (i3.ObjectUtils.isNumber(config.path)) {
|
|
1841
1956
|
path = [config.path];
|
|
1842
1957
|
}
|
|
1843
1958
|
if (!path) {
|
|
1844
|
-
result =
|
|
1959
|
+
result = i3.ObjectUtils.assign(result, data);
|
|
1845
1960
|
return;
|
|
1846
1961
|
}
|
|
1847
|
-
result =
|
|
1962
|
+
result = i3.ObjectUtils.mapToPath(result, data, path.map(function (p) { return "" + p; }));
|
|
1848
1963
|
});
|
|
1849
1964
|
resolve(result);
|
|
1850
1965
|
}, reject);
|
|
@@ -1862,7 +1977,7 @@
|
|
|
1862
1977
|
this.cdr.detectChanges();
|
|
1863
1978
|
if (!this.forms)
|
|
1864
1979
|
return false;
|
|
1865
|
-
return
|
|
1980
|
+
return i3.ObjectUtils.isDefined(this.forms.find(check));
|
|
1866
1981
|
};
|
|
1867
1982
|
DynamicFormsComponent.prototype.getFromValue = function (check) {
|
|
1868
1983
|
if (!this.forms)
|
|
@@ -1870,7 +1985,7 @@
|
|
|
1870
1985
|
var value = null;
|
|
1871
1986
|
this.forms.find(function (f) {
|
|
1872
1987
|
value = check(f);
|
|
1873
|
-
return
|
|
1988
|
+
return i3.ObjectUtils.isDefined(value);
|
|
1874
1989
|
});
|
|
1875
1990
|
return value;
|
|
1876
1991
|
};
|
|
@@ -1881,7 +1996,7 @@
|
|
|
1881
1996
|
return c;
|
|
1882
1997
|
var config = c;
|
|
1883
1998
|
var group = new DynamicFormGroup(_this, {
|
|
1884
|
-
id: config.id ||
|
|
1999
|
+
id: config.id || i3.UniqueUtils.uuid(),
|
|
1885
2000
|
type: "model",
|
|
1886
2001
|
data: config.controlData
|
|
1887
2002
|
});
|
|
@@ -1894,37 +2009,53 @@
|
|
|
1894
2009
|
};
|
|
1895
2010
|
return DynamicFormsComponent;
|
|
1896
2011
|
}(DynamicFormBaseComponent));
|
|
1897
|
-
DynamicFormsComponent
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
2012
|
+
DynamicFormsComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormsComponent, deps: [{ token: i0__namespace.ChangeDetectorRef }, { token: DynamicFormService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
2013
|
+
DynamicFormsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DynamicFormsComponent, selector: "dynamic-forms, [dynamic-forms]", inputs: { data: "data", containerTemplate: "containerTemplate", formPrefixTemplates: "formPrefixTemplates", formSuffixTemplates: "formSuffixTemplates", innerFormPrefixTemplates: "innerFormPrefixTemplates", innerFormSuffixTemplates: "innerFormSuffixTemplates" }, providers: [
|
|
2014
|
+
{
|
|
2015
|
+
provide: DynamicFormBaseComponent,
|
|
2016
|
+
useExisting: DynamicFormsComponent
|
|
2017
|
+
},
|
|
2018
|
+
{
|
|
2019
|
+
provide: DYNAMIC_FORM,
|
|
2020
|
+
useExisting: DynamicFormsComponent
|
|
2021
|
+
}
|
|
2022
|
+
], queries: [{ propertyName: "cContainerTemplate", first: true, predicate: ["containerTemplate"], descendants: true }], viewQueries: [{ propertyName: "forms", predicate: DynamicFormBaseComponent, descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace, template: "<ng-template #configTemplate let-formTemplate=\"formTemplate\" let-form=\"form\" let-config=\"config\" let-configTemplate>\r\n <div [ngClass]=\"config.classes || ''\">\r\n <ng-container [ngTemplateOutlet]=\"formPrefixTemplates[config.id]\"\r\n [ngTemplateOutletContext]=\"{config: config, form: form}\"></ng-container>\r\n <ng-template #singleFormTemplate>\r\n <div dynamic-form\r\n [hidden]=\"!config.group?.visible\"\r\n [ngClass]=\"config.formClasses || ''\"\r\n [name]=\"config.name || form.name\"\r\n [testId]=\"testId + '-' + (config.testId || config.name || name)\"\r\n [readonly]=\"form.readonly\"\r\n [updateOn]=\"form.updateOn\"\r\n [classes]=\"config.innerFormClasses\"\r\n [parent]=\"form\"\r\n\r\n [wrapperTemplate]=\"form.wrapperTemplate\"\r\n [fieldSetTemplate]=\"form.fieldSetTemplate\"\r\n [controlTemplates]=\"form.controlTemplates\"\r\n\r\n [controlTemplate]=\"form.controlTemplate\"\r\n [labelTemplates]=\"form.labelTemplates\"\r\n [inputTemplates]=\"form.inputTemplates\"\r\n [prefixTemplates]=\"form.prefixTemplates\"\r\n [suffixTemplates]=\"form.suffixTemplates\"\r\n [setPrefixTemplates]=\"form.setPrefixTemplates\"\r\n [setSuffixTemplates]=\"form.setSuffixTemplates\"\r\n\r\n [group]=\"config.group\"\r\n [fieldSets]=\"config.fieldSets\">\r\n <ng-template #prefixTemplate let-subForm=\"form\">\r\n <ng-container [ngTemplateOutlet]=\"form.innerFormPrefixTemplates[config.id]\"\r\n [ngTemplateOutletContext]=\"{config: config, form: subForm}\"></ng-container>\r\n </ng-template>\r\n <ng-template #suffixTemplate let-subForm=\"form\">\r\n <ng-container [ngTemplateOutlet]=\"form.innerFormSuffixTemplates[config.id]\"\r\n [ngTemplateOutletContext]=\"{config: config, form: subForm}\"></ng-container>\r\n </ng-template>\r\n </div>\r\n </ng-template>\r\n <div dynamic-forms\r\n [ngClass]=\"config.formClasses || ''\"\r\n [name]=\"config.name || name\"\r\n [testId]=\"testId + '-' + (config.testId || config.name || name)\"\r\n [readonly]=\"form.readonly\"\r\n [updateOn]=\"form.updateOn\"\r\n [classes]=\"config.innerFormClasses\"\r\n [parent]=\"form\"\r\n\r\n [wrapperTemplate]=\"form.wrapperTemplate\"\r\n [fieldSetTemplate]=\"form.fieldSetTemplate\"\r\n [controlTemplates]=\"form.controlTemplates\"\r\n\r\n [controlTemplate]=\"form.controlTemplate\"\r\n [labelTemplates]=\"form.labelTemplates\"\r\n [inputTemplates]=\"form.inputTemplates\"\r\n [prefixTemplates]=\"form.prefixTemplates\"\r\n [suffixTemplates]=\"form.suffixTemplates\"\r\n [setPrefixTemplates]=\"form.setPrefixTemplates\"\r\n [setSuffixTemplates]=\"form.setSuffixTemplates\"\r\n\r\n [data]=\"config.data\"\r\n [containerTemplate]=\"form.containerTemplate\"\r\n [formPrefixTemplates]=\"form.formPrefixTemplates\"\r\n [formSuffixTemplates]=\"form.formSuffixTemplates\"\r\n [innerFormPrefixTemplates]=\"form.innerFormPrefixTemplates\"\r\n [innerFormSuffixTemplates]=\"form.innerFormSuffixTemplates\"\r\n\r\n *ngIf=\"config.multi; else singleFormTemplate\">\r\n <ng-template #prefixTemplate let-subForm=\"form\">\r\n <ng-container [ngTemplateOutlet]=\"form.innerFormPrefixTemplates[config.id]\"\r\n [ngTemplateOutletContext]=\"{config: config, form: subForm}\"></ng-container>\r\n </ng-template>\r\n <ng-template #suffixTemplate let-subForm=\"form\">\r\n <ng-container [ngTemplateOutlet]=\"form.innerFormSuffixTemplates[config.id]\"\r\n [ngTemplateOutletContext]=\"{config: config, form: subForm}\"></ng-container>\r\n </ng-template>\r\n </div>\r\n <ng-container [ngTemplateOutlet]=\"formSuffixTemplates[config.id]\"\r\n [ngTemplateOutletContext]=\"{config: config, form: form}\"></ng-container>\r\n </div>\r\n</ng-template>\r\n<ng-template let-form=\"form\" let-configTemplate=\"configTemplate\" #defaultContainerTemplate>\r\n <div class=\"dynamic-forms\" [ngClass]=\"classes || ''\">\r\n <ng-container *ngFor=\"let config of form.configs\"\r\n [ngTemplateOutlet]=\"configTemplate\"\r\n [ngTemplateOutletContext]=\"{form: form, config: config}\"></ng-container>\r\n <ng-content></ng-content>\r\n </div>\r\n</ng-template>\r\n<ng-container [ngTemplateOutlet]=\"prefixTemplate\"\r\n [ngTemplateOutletContext]=\"{form: this}\"></ng-container>\r\n<ng-container [ngTemplateOutlet]=\"containerTemplate || defaultContainerTemplate\"\r\n [ngTemplateOutletContext]=\"{form: this, configTemplate: configTemplate, defaultContainerTemplate: defaultContainerTemplate}\">\r\n</ng-container>\r\n<ng-container [ngTemplateOutlet]=\"suffixTemplate\"\r\n [ngTemplateOutletContext]=\"{form: this}\"></ng-container>\r\n", components: [{ type: DynamicFormComponent, selector: "dynamic-form, [dynamic-form]", inputs: ["group", "controls", "serializers", "fieldSets", "data"] }, { type: DynamicFormsComponent, selector: "dynamic-forms, [dynamic-forms]", inputs: ["data", "containerTemplate", "formPrefixTemplates", "formSuffixTemplates", "innerFormPrefixTemplates", "innerFormSuffixTemplates"] }], directives: [{ type: i2__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
|
2023
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormsComponent, decorators: [{
|
|
2024
|
+
type: i0.Component,
|
|
2025
|
+
args: [{
|
|
2026
|
+
moduleId: module.id,
|
|
2027
|
+
selector: "dynamic-forms, [dynamic-forms]",
|
|
2028
|
+
templateUrl: "./dynamic-forms.component.html",
|
|
2029
|
+
providers: [
|
|
2030
|
+
{
|
|
2031
|
+
provide: DynamicFormBaseComponent,
|
|
2032
|
+
useExisting: DynamicFormsComponent
|
|
2033
|
+
},
|
|
2034
|
+
{
|
|
2035
|
+
provide: DYNAMIC_FORM,
|
|
2036
|
+
useExisting: DynamicFormsComponent
|
|
2037
|
+
}
|
|
2038
|
+
]
|
|
2039
|
+
}]
|
|
2040
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ChangeDetectorRef }, { type: DynamicFormService }]; }, propDecorators: { data: [{
|
|
2041
|
+
type: i0.Input
|
|
2042
|
+
}], containerTemplate: [{
|
|
2043
|
+
type: i0.Input
|
|
2044
|
+
}], formPrefixTemplates: [{
|
|
2045
|
+
type: i0.Input
|
|
2046
|
+
}], formSuffixTemplates: [{
|
|
2047
|
+
type: i0.Input
|
|
2048
|
+
}], innerFormPrefixTemplates: [{
|
|
2049
|
+
type: i0.Input
|
|
2050
|
+
}], innerFormSuffixTemplates: [{
|
|
2051
|
+
type: i0.Input
|
|
2052
|
+
}], cContainerTemplate: [{
|
|
2053
|
+
type: i0.ContentChild,
|
|
2054
|
+
args: ["containerTemplate"]
|
|
2055
|
+
}], forms: [{
|
|
2056
|
+
type: i0.ViewChildren,
|
|
2057
|
+
args: [DynamicFormBaseComponent]
|
|
2058
|
+
}] } });
|
|
1928
2059
|
|
|
1929
2060
|
var DynamicFormGroupComponent = /** @class */ (function () {
|
|
1930
2061
|
function DynamicFormGroupComponent(form) {
|
|
@@ -1941,19 +2072,24 @@
|
|
|
1941
2072
|
});
|
|
1942
2073
|
return DynamicFormGroupComponent;
|
|
1943
2074
|
}());
|
|
1944
|
-
DynamicFormGroupComponent
|
|
1945
|
-
{ type:
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
2075
|
+
DynamicFormGroupComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormGroupComponent, deps: [{ token: DYNAMIC_FORM }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
2076
|
+
DynamicFormGroupComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DynamicFormGroupComponent, selector: "div[dynamic-form-group]", host: { properties: { "class": "this.classes" } }, ngImport: i0__namespace, template: "<ng-template #labelTemplate>\r\n <label [ngClass]=\"'control-label control-label-' + control.data.labelAlign\" [attr.for]=\"control.formId\">\r\n {{ control.label | translate: control.model }}\r\n </label>\r\n</ng-template>\r\n<ng-template #errorTemplate>\r\n <div class=\"error-message\" *ngIf=\"control.errors && control.touched\">\r\n <span class=\"help-block\" *ngFor=\"let error of control.errors | entries\">\r\n {{ error.key | translate: error.value }}\r\n </span>\r\n </div>\r\n</ng-template>\r\n<ng-template #inputTemplate let-control=\"control\">\r\n <ng-container [form-control]=\"control\"></ng-container>\r\n</ng-template>\r\n<ng-template #defaultControlTemplate\r\n let-context\r\n let-control=\"control\"\r\n let-data=\"control.data\"\r\n let-labelTemplate=\"labelTemplate\"\r\n let-inputTemplate=\"inputTemplate\"\r\n let-prefixTemplate=\"prefixTemplate\"\r\n let-suffixTemplate=\"suffixTemplate\"\r\n let-errorTemplate=\"errorTemplate\">\r\n <ng-container [ngTemplateOutlet]=\"prefixTemplate\"\r\n [ngTemplateOutletContext]=\"context\"></ng-container>\r\n <ng-container *ngIf=\"control.label && data.labelAlign == 'left'\"\r\n [ngTemplateOutlet]=\"labelTemplate\"\r\n [ngTemplateOutletContext]=\"context\">\r\n </ng-container>\r\n <ng-container [ngTemplateOutlet]=\"inputTemplate\"\r\n [ngTemplateOutletContext]=\"context\"></ng-container>\r\n <ng-container *ngIf=\"control.label && data.labelAlign == 'right'\"\r\n [ngTemplateOutlet]=\"labelTemplate\"\r\n [ngTemplateOutletContext]=\"context\">\r\n </ng-container>\r\n <ng-container [ngTemplateOutlet]=\"suffixTemplate\"\r\n [ngTemplateOutletContext]=\"context\"></ng-container>\r\n <ng-container [ngTemplateOutlet]=\"errorTemplate\"\r\n [ngTemplateOutletContext]=\"context\"></ng-container>\r\n</ng-template>\r\n\r\n<ng-container [ngxTemplateOutlet]=\"form.controlTemplates[control.id] || form.controlTemplate || defaultControlTemplate\"\r\n [context]=\"{\r\n control: control,\r\n labelTemplate: form.labelTemplates[control.id] || labelTemplate,\r\n inputTemplate: form.inputTemplates[control.id] || inputTemplate,\r\n prefixTemplate: form.prefixTemplates[control.id],\r\n suffixTemplate: form.suffixTemplates[control.id],\r\n errorTemplate: errorTemplate\r\n }\">\r\n</ng-container>\r\n", directives: [{ type: i2__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: DynamicFormControlDirective, selector: "[form-control]", inputs: ["form-control"] }, { type: i2__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3__namespace.NgxTemplateOutletDirective, selector: "[ngxTemplateOutlet]", inputs: ["context", "additionalContext", "ngxTemplateOutlet"] }], pipes: { "translate": i3__namespace.TranslatePipe, "entries": i3__namespace.EntriesPipe } });
|
|
2077
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormGroupComponent, decorators: [{
|
|
2078
|
+
type: i0.Component,
|
|
2079
|
+
args: [{
|
|
2080
|
+
moduleId: module.id,
|
|
2081
|
+
selector: "div[dynamic-form-group]",
|
|
2082
|
+
templateUrl: "./dynamic-form-group.component.html"
|
|
2083
|
+
}]
|
|
2084
|
+
}], ctorParameters: function () {
|
|
2085
|
+
return [{ type: undefined, decorators: [{
|
|
2086
|
+
type: i0.Inject,
|
|
2087
|
+
args: [DYNAMIC_FORM]
|
|
2088
|
+
}] }];
|
|
2089
|
+
}, propDecorators: { classes: [{
|
|
2090
|
+
type: i0.HostBinding,
|
|
2091
|
+
args: ["class"]
|
|
2092
|
+
}] } });
|
|
1957
2093
|
|
|
1958
2094
|
var DynamicFormFileComponent = /** @class */ (function (_super) {
|
|
1959
2095
|
__extends(DynamicFormFileComponent, _super);
|
|
@@ -1978,14 +2114,14 @@
|
|
|
1978
2114
|
DynamicFormFileComponent.prototype.processFiles = function (fileList) {
|
|
1979
2115
|
var files = [];
|
|
1980
2116
|
var accept = this.data.accept;
|
|
1981
|
-
var types =
|
|
2117
|
+
var types = i3.ObjectUtils.isString(accept) && accept.length > 0 ? accept.toLowerCase().split(",") : null;
|
|
1982
2118
|
if (fileList.length == 0)
|
|
1983
2119
|
return;
|
|
1984
2120
|
for (var i = 0; i < fileList.length; i++) {
|
|
1985
2121
|
var file = fileList.item(i);
|
|
1986
2122
|
var type = file.type.toLowerCase();
|
|
1987
|
-
var ext =
|
|
1988
|
-
if (types && !
|
|
2123
|
+
var ext = i3.FileUtils.getExtension(file);
|
|
2124
|
+
if (types && !i3.ArrayUtils.has(types, type, ext))
|
|
1989
2125
|
continue;
|
|
1990
2126
|
files.push(file);
|
|
1991
2127
|
}
|
|
@@ -2003,7 +2139,7 @@
|
|
|
2003
2139
|
var promises = [];
|
|
2004
2140
|
files.forEach(function (file, ix) {
|
|
2005
2141
|
if (_this.data.asDataUrl) {
|
|
2006
|
-
promises.push(
|
|
2142
|
+
promises.push(i3.FileUtils.readFileAsDataURL(file));
|
|
2007
2143
|
return;
|
|
2008
2144
|
}
|
|
2009
2145
|
if (_this.data.asFile) {
|
|
@@ -2034,7 +2170,7 @@
|
|
|
2034
2170
|
return "url('" + this.getImgUrl(image) + "')";
|
|
2035
2171
|
};
|
|
2036
2172
|
DynamicFormFileComponent.prototype.getImgUrl = function (image) {
|
|
2037
|
-
if (
|
|
2173
|
+
if (i3.ObjectUtils.isBlob(image)) {
|
|
2038
2174
|
var cache = this.fileImageCache.find(function (t) { return t.file == image; });
|
|
2039
2175
|
if (!cache) {
|
|
2040
2176
|
cache = { file: image, url: URL.createObjectURL(image) };
|
|
@@ -2043,7 +2179,7 @@
|
|
|
2043
2179
|
return cache.url;
|
|
2044
2180
|
}
|
|
2045
2181
|
var url = !image ? null : image.imageUrl || image;
|
|
2046
|
-
if (!
|
|
2182
|
+
if (!i3.ObjectUtils.isString(url))
|
|
2047
2183
|
return null;
|
|
2048
2184
|
if (url.startsWith("data:"))
|
|
2049
2185
|
return url;
|
|
@@ -2055,13 +2191,16 @@
|
|
|
2055
2191
|
};
|
|
2056
2192
|
return DynamicFormFileComponent;
|
|
2057
2193
|
}(FormControlComponent));
|
|
2058
|
-
DynamicFormFileComponent
|
|
2059
|
-
{ type:
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2194
|
+
DynamicFormFileComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormFileComponent, deps: null, target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
2195
|
+
DynamicFormFileComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DynamicFormFileComponent, selector: "dynamic-form-file", usesInheritance: true, ngImport: i0__namespace, template: "<div class=\"upload\">\r\n <input type=\"file\"\r\n multiple=\"multiple\"\r\n [attr.data-testid]=\"testId\"\r\n [attr.accept]=\"data.accept\"\r\n (change)=\"onSelect($event.target)\" />\r\n <ul class=\"images\" *ngIf=\"!data.multi\">\r\n <li class=\"image\" *ngIf=\"value\" [ngStyle]=\"{backgroundImage: getUrl(value)}\">\r\n <a class=\"btn btn-delete\" (click)=\"delete()\"></a>\r\n </li>\r\n </ul>\r\n <ul class=\"images\" *ngIf=\"data.multi\">\r\n <li class=\"image\" *ngFor=\"let image of value; let i = index\" [ngStyle]=\"{backgroundImage: getUrl(image)}\">\r\n <a class=\"btn btn-delete\" (click)=\"delete(i)\"></a>\r\n </li>\r\n </ul>\r\n</div>\r\n", styles: [".upload{display:inline-block}.upload ul{display:inline-flex;list-style:none;margin:10px 0 0;padding:0}.upload ul li{height:100px;width:100px;background:repeating-linear-gradient(45deg,gray,gray 10px,lightgray 10px,lightgray 20px) center center;background-size:cover;border:1px gray solid;margin-right:5px;position:relative}.upload .btn-delete{background:linear-gradient(to bottom,#c8607a,#a64d5a);border-color:#a64d5a;color:#fff;position:absolute;padding:0;right:5px;top:5px;width:20px;height:20px}.upload .btn-delete:before{color:#fff;display:block;position:absolute;top:0;right:6px;content:\"x\"}\n"], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
|
2196
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormFileComponent, decorators: [{
|
|
2197
|
+
type: i0.Component,
|
|
2198
|
+
args: [{
|
|
2199
|
+
selector: "dynamic-form-file",
|
|
2200
|
+
styleUrls: ["./dynamic-form-file.component.scss"],
|
|
2201
|
+
templateUrl: "./dynamic-form-file.component.html"
|
|
2202
|
+
}]
|
|
2203
|
+
}] });
|
|
2065
2204
|
|
|
2066
2205
|
var DynamicFormInputComponent = /** @class */ (function (_super) {
|
|
2067
2206
|
__extends(DynamicFormInputComponent, _super);
|
|
@@ -2096,7 +2235,7 @@
|
|
|
2096
2235
|
this.control.setValue(value);
|
|
2097
2236
|
return;
|
|
2098
2237
|
}
|
|
2099
|
-
var translations =
|
|
2238
|
+
var translations = i3.ObjectUtils.isArray(this.value) ? Array.from(this.value) : [];
|
|
2100
2239
|
var translation = translations.find(function (t) { return t.lang == _this.language.editLanguage; });
|
|
2101
2240
|
if (translation) {
|
|
2102
2241
|
translation.translation = value;
|
|
@@ -2111,26 +2250,29 @@
|
|
|
2111
2250
|
};
|
|
2112
2251
|
DynamicFormInputComponent.prototype.onNumberBlur = function () {
|
|
2113
2252
|
var value = this.value;
|
|
2114
|
-
if (
|
|
2253
|
+
if (i3.ObjectUtils.isNumber(this.data.max) && this.data.max < value) {
|
|
2115
2254
|
this.control.setValue(this.data.max);
|
|
2116
2255
|
}
|
|
2117
|
-
else if (
|
|
2256
|
+
else if (i3.ObjectUtils.isNumber(this.data.min) && this.data.min > value) {
|
|
2118
2257
|
this.control.setValue(this.data.min);
|
|
2119
2258
|
}
|
|
2120
2259
|
this.control.onBlur();
|
|
2121
2260
|
};
|
|
2122
2261
|
return DynamicFormInputComponent;
|
|
2123
2262
|
}(FormControlComponent));
|
|
2124
|
-
DynamicFormInputComponent
|
|
2125
|
-
{ type:
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2263
|
+
DynamicFormInputComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormInputComponent, deps: null, target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
2264
|
+
DynamicFormInputComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DynamicFormInputComponent, selector: "dynamic-form-input", host: { properties: { "class.checked": "this.isChecked" } }, usesInheritance: true, ngImport: i0__namespace, template: "<ng-container [ngSwitch]=\"data.type\">\r\n <ng-container *ngSwitchCase=\"'textarea'\">\r\n <textarea class=\"form-control\"\r\n rows=\"5\"\r\n [attr.autocomplete]=\"data.autocomplete\"\r\n [attr.data-testid]=\"testId\"\r\n [id]=\"control.formId\"\r\n [name]=\"control.formId\"\r\n [ngClass]=\"{disabled: control.disabled}\"\r\n [disabled]=\"control.disabled\"\r\n [ngModel]=\"value\"\r\n (ngModelChange)=\"control.setValue($event)\"\r\n (blur)=\"control.onBlur()\"\r\n (focus)=\"control.onFocus()\">{{ data.placeholder | translate }}</textarea>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'date'\">\r\n <input class=\"form-control\"\r\n type=\"date\"\r\n [attr.autocomplete]=\"data.autocomplete\"\r\n [attr.data-testid]=\"testId\"\r\n [id]=\"control.formId\"\r\n [name]=\"control.formId\"\r\n [ngClass]=\"{disabled: control.disabled}\"\r\n [disabled]=\"control.disabled\"\r\n [ngModel]=\"value | date: 'y-MM-dd'\"\r\n (ngModelChange)=\"onDateChange($event)\"\r\n (blur)=\"control.onBlur()\"\r\n (focus)=\"control.onFocus()\"/>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'number'\">\r\n <input class=\"form-control\"\r\n type=\"number\"\r\n [attr.autocomplete]=\"data.autocomplete\"\r\n [attr.data-testid]=\"testId\"\r\n [min]=\"data.min\"\r\n [max]=\"data.max\"\r\n [step]=\"data.step\"\r\n [id]=\"control.formId\"\r\n [name]=\"control.formId\"\r\n [ngClass]=\"{disabled: control.disabled}\"\r\n [disabled]=\"control.disabled\"\r\n [ngModel]=\"value\"\r\n (ngModelChange)=\"control.setValue($event)\"\r\n (blur)=\"onNumberBlur()\"\r\n (focus)=\"control.onFocus()\"/>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'checkbox'\">\r\n <input class=\"form-control\"\r\n type=\"checkbox\"\r\n [attr.data-testid]=\"testId\"\r\n [id]=\"control.formId\"\r\n [name]=\"control.formId\"\r\n [ngClass]=\"{disabled: control.disabled}\"\r\n [disabled]=\"control.disabled\"\r\n [ngModel]=\"value\"\r\n (ngModelChange)=\"control.setValue($event)\"\r\n (blur)=\"control.onBlur()\"\r\n (focus)=\"control.onFocus()\"/>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'text'\">\r\n <input class=\"form-control\"\r\n type=\"text\"\r\n [attr.autocomplete]=\"data.autocomplete\"\r\n [attr.data-testid]=\"testId\"\r\n [minlength]=\"data.min\"\r\n [maxlength]=\"data.max\"\r\n [placeholder]=\"data.placeholder | translate\"\r\n [id]=\"control.formId\"\r\n [name]=\"control.formId\"\r\n [ngClass]=\"{disabled: control.disabled}\"\r\n [disabled]=\"control.disabled\"\r\n [ngModel]=\"data.useLanguage ? (value | translate) : value\"\r\n (ngModelChange)=\"onTextChange($event)\"\r\n (blur)=\"control.onBlur()\"\r\n (focus)=\"control.onFocus()\"/>\r\n </ng-container>\r\n <ng-container *ngSwitchDefault>\r\n <input class=\"form-control\"\r\n [attr.autocomplete]=\"data.autocomplete\"\r\n [attr.data-testid]=\"testId\"\r\n [minlength]=\"data.min\"\r\n [maxlength]=\"data.max\"\r\n [placeholder]=\"data.placeholder | translate\"\r\n [type]=\"data.type\"\r\n [id]=\"control.formId\"\r\n [name]=\"control.formId\"\r\n [ngClass]=\"{disabled: control.disabled}\"\r\n [disabled]=\"control.disabled\"\r\n [ngModel]=\"value\"\r\n (ngModelChange)=\"control.setValue($event)\"\r\n (blur)=\"control.onBlur()\"\r\n (focus)=\"control.onFocus()\"/>\r\n </ng-container>\r\n</ng-container>\r\n", directives: [{ type: i2__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i2__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2__namespace$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i2__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2__namespace$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2__namespace$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i2__namespace$1.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { type: i2__namespace$1.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { type: i2__namespace$1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { type: i2__namespace$1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { type: i2__namespace$1.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { type: i2__namespace$1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { type: i2__namespace.NgSwitchDefault, selector: "[ngSwitchDefault]" }], pipes: { "translate": i3__namespace.TranslatePipe, "date": i2__namespace.DatePipe } });
|
|
2265
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormInputComponent, decorators: [{
|
|
2266
|
+
type: i0.Component,
|
|
2267
|
+
args: [{
|
|
2268
|
+
moduleId: module.id,
|
|
2269
|
+
selector: "dynamic-form-input",
|
|
2270
|
+
templateUrl: "./dynamic-form-input.component.html"
|
|
2271
|
+
}]
|
|
2272
|
+
}], propDecorators: { isChecked: [{
|
|
2273
|
+
type: i0.HostBinding,
|
|
2274
|
+
args: ["class.checked"]
|
|
2275
|
+
}] } });
|
|
2134
2276
|
|
|
2135
2277
|
var DynamicFormSelectComponent = /** @class */ (function (_super) {
|
|
2136
2278
|
__extends(DynamicFormSelectComponent, _super);
|
|
@@ -2148,7 +2290,7 @@
|
|
|
2148
2290
|
return Promise.reject("Radio group doesn't support multi select!");
|
|
2149
2291
|
}
|
|
2150
2292
|
return new Promise(function (resolve) {
|
|
2151
|
-
var getOptions =
|
|
2293
|
+
var getOptions = i3.ReflectUtils.resolve(data.options, control.form.injector);
|
|
2152
2294
|
getOptions(control).then(function (options) {
|
|
2153
2295
|
if (data.emptyOption)
|
|
2154
2296
|
options.unshift({ id: null, label: "" });
|
|
@@ -2166,14 +2308,14 @@
|
|
|
2166
2308
|
control.setValue(options[0].id);
|
|
2167
2309
|
};
|
|
2168
2310
|
DynamicFormSelectComponent.prototype.onSelectChange = function (value) {
|
|
2169
|
-
var isArray =
|
|
2311
|
+
var isArray = i3.ObjectUtils.isArray(value);
|
|
2170
2312
|
var current = this.value;
|
|
2171
2313
|
if (this.data.multi) {
|
|
2172
2314
|
if (isArray) {
|
|
2173
2315
|
this.control.setValue(value);
|
|
2174
2316
|
return;
|
|
2175
2317
|
}
|
|
2176
|
-
if (
|
|
2318
|
+
if (i3.ObjectUtils.isArray(current)) {
|
|
2177
2319
|
this.control.setValue(current.indexOf(value) < 0
|
|
2178
2320
|
? current.concat([value])
|
|
2179
2321
|
: current.filter(function (c) { return c !== value; }));
|
|
@@ -2192,20 +2334,23 @@
|
|
|
2192
2334
|
};
|
|
2193
2335
|
DynamicFormSelectComponent.prototype.checkValue = function (option) {
|
|
2194
2336
|
var value = this.value;
|
|
2195
|
-
return
|
|
2337
|
+
return i3.ObjectUtils.isArray(value) ? value.indexOf(option.id) >= 0 : option.id == value;
|
|
2196
2338
|
};
|
|
2197
2339
|
DynamicFormSelectComponent.prototype.findOption = function (option, index, id) {
|
|
2198
2340
|
return option.id == id;
|
|
2199
2341
|
};
|
|
2200
2342
|
return DynamicFormSelectComponent;
|
|
2201
2343
|
}(FormControlComponent));
|
|
2202
|
-
DynamicFormSelectComponent
|
|
2203
|
-
{ type:
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2344
|
+
DynamicFormSelectComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormSelectComponent, deps: null, target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
2345
|
+
DynamicFormSelectComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DynamicFormSelectComponent, selector: "dynamic-form-select", usesInheritance: true, ngImport: i0__namespace, template: "<ng-template #selectTemplate let-selected=\"selected\">\r\n <select class=\"form-control\"\r\n [attr.data-testid]=\"testId\"\r\n [multiple]=\"data.multi\"\r\n [id]=\"control.formId\"\r\n [name]=\"control.formId\"\r\n [ngClass]=\"{disabled: control.disabled}\"\r\n [disabled]=\"control.disabled\"\r\n [ngModel]=\"data.multi ? value : [value]\"\r\n (ngModelChange)=\"onSelectChange($event)\"\r\n (blur)=\"control.onBlur()\"\r\n (focus)=\"control.onFocus()\">\r\n <option *ngFor=\"let option of meta.options\" [value]=\"option.id\" [disabled]=\"option.selectable == false\">\r\n {{ option.label | translate }}\r\n </option>\r\n </select>\r\n <label class=\"form-control-description\" [attr.for]=\"control.formId\" *ngIf=\"!data.multi && selected?.description\">\r\n {{ selected?.description | translate }}\r\n </label>\r\n</ng-template>\r\n<ng-container [ngSwitch]=\"data.type\">\r\n <ng-container *ngSwitchCase=\"'radio'\">\r\n <ul class=\"radio-group\">\r\n <li *ngFor=\"let option of meta.options\" class=\"radio\">\r\n <label [ngClass]=\"{checked: value == option.id}\">\r\n <input type=\"radio\"\r\n [attr.data-testid]=\"testId + '-' + option.id\"\r\n [id]=\"control.formId + '-' + option.id\"\r\n [name]=\"control.formId + '-' + option.id\"\r\n [ngClass]=\"{disabled: control.disabled}\"\r\n [disabled]=\"control.disabled || option.selectable == false\"\r\n [value]=\"option.id\"\r\n [ngModel]=\"value\"\r\n (ngModelChange)=\"onSelectChange(option.id)\"\r\n (blur)=\"control.onBlur()\"\r\n (focus)=\"control.onFocus()\">\r\n {{ option.label | translate }}\r\n </label>\r\n </li>\r\n </ul>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'checkbox'\">\r\n <ul class=\"checkbox-group\">\r\n <li *ngFor=\"let option of meta.options\" class=\"checkbox\">\r\n <label [ngClass]=\"{checked: checkValue(option)}\">\r\n <input type=\"checkbox\"\r\n [attr.data-testid]=\"testId + '-' + option.id\"\r\n [id]=\"control.formId + '-' + option.id\"\r\n [name]=\"control.formId + '-' + option.id\"\r\n [ngClass]=\"{disabled: control.disabled}\"\r\n [disabled]=\"control.disabled || option.selectable == false\"\r\n [ngModel]=\"checkValue(option)\"\r\n (ngModelChange)=\"onSelectChange(option.id)\"\r\n (blur)=\"control.onBlur()\"\r\n (focus)=\"control.onFocus()\">\r\n {{ option.label | translate }}\r\n </label>\r\n </li>\r\n </ul>\r\n </ng-container>\r\n <ng-container *ngSwitchDefault [ngTemplateOutlet]=\"selectTemplate\" [ngTemplateOutletContext]=\"{selected: meta?.options | find:findOption:value}\">\r\n\r\n </ng-container>\r\n</ng-container>\r\n", directives: [{ type: i2__namespace$1.SelectMultipleControlValueAccessor, selector: "select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]", inputs: ["compareWith"] }, { type: i2__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2__namespace$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2__namespace$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i2__namespace$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i2__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2__namespace$1.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { type: i2__namespace$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i2__namespace$1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { type: i2__namespace.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i2__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "translate": i3__namespace.TranslatePipe, "find": i3__namespace.FindPipe } });
|
|
2346
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormSelectComponent, decorators: [{
|
|
2347
|
+
type: i0.Component,
|
|
2348
|
+
args: [{
|
|
2349
|
+
moduleId: module.id,
|
|
2350
|
+
selector: "dynamic-form-select",
|
|
2351
|
+
templateUrl: "./dynamic-form-select.component.html"
|
|
2352
|
+
}]
|
|
2353
|
+
}] });
|
|
2209
2354
|
|
|
2210
2355
|
var DynamicFormStaticComponent = /** @class */ (function (_super) {
|
|
2211
2356
|
__extends(DynamicFormStaticComponent, _super);
|
|
@@ -2222,13 +2367,16 @@
|
|
|
2222
2367
|
};
|
|
2223
2368
|
return DynamicFormStaticComponent;
|
|
2224
2369
|
}(FormControlComponent));
|
|
2225
|
-
DynamicFormStaticComponent
|
|
2226
|
-
{ type:
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2370
|
+
DynamicFormStaticComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormStaticComponent, deps: null, target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
2371
|
+
DynamicFormStaticComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DynamicFormStaticComponent, selector: "dynamic-form-static", usesInheritance: true, ngImport: i0__namespace, template: "<unordered-list [listStyle]=\"data.style\" [ngClass]=\"{disabled: control.disabled}\"\r\n [data]=\"!data.properties ? {value: value} : data.properties | remap: value\">\r\n <ng-template [type]=\"!data.properties ? 'key' : null\" selector=\"level == 0\" let-item=\"item\"></ng-template>\r\n <ng-template type=\"value\" selector=\"valueType == 'date'\" let-item=\"item\">\r\n {{ item.value | date }}\r\n </ng-template>\r\n</unordered-list>\r\n", components: [{ type: i3__namespace.UnorderedListComponent, selector: "unordered-list", inputs: ["keyPrefix", "listStyle", "path", "level", "templates", "data"] }], directives: [{ type: i2__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3__namespace.UnorderedListTemplateDirective, selector: "ng-template[type][selector]", inputs: ["type", "selector"] }], pipes: { "remap": i3__namespace.RemapPipe, "date": i2__namespace.DatePipe } });
|
|
2372
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormStaticComponent, decorators: [{
|
|
2373
|
+
type: i0.Component,
|
|
2374
|
+
args: [{
|
|
2375
|
+
moduleId: module.id,
|
|
2376
|
+
selector: "dynamic-form-static",
|
|
2377
|
+
templateUrl: "./dynamic-form-static.component.html"
|
|
2378
|
+
}]
|
|
2379
|
+
}] });
|
|
2232
2380
|
|
|
2233
2381
|
var DynamicFormModelComponent = /** @class */ (function (_super) {
|
|
2234
2382
|
__extends(DynamicFormModelComponent, _super);
|
|
@@ -2245,16 +2393,19 @@
|
|
|
2245
2393
|
};
|
|
2246
2394
|
return DynamicFormModelComponent;
|
|
2247
2395
|
}(FormControlComponent));
|
|
2248
|
-
DynamicFormModelComponent
|
|
2249
|
-
{ type:
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2396
|
+
DynamicFormModelComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormModelComponent, deps: null, target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
2397
|
+
DynamicFormModelComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DynamicFormModelComponent, selector: "dynamic-form-model", viewQueries: [{ propertyName: "subForm", first: true, predicate: ["subForm"], descendants: true }], usesInheritance: true, ngImport: i0__namespace, template: "<dynamic-form [testId]=\"form.testId + '-' + control.id\"\r\n [name]=\"data.name || form.name\"\r\n [group]=\"control\"\r\n [data]=\"value\"\r\n [updateOn]=\"control.updateOn\"\r\n [parent]=\"form\"\r\n\r\n [fieldSetTemplate]=\"form.fieldSetTemplate\"\r\n [controlTemplates]=\"form.controlTemplates\"\r\n\r\n [controlTemplate]=\"form.controlTemplate\"\r\n [labelTemplates]=\"form.labelTemplates\"\r\n [inputTemplates]=\"form.inputTemplates\"\r\n [prefixTemplates]=\"form.prefixTemplates\"\r\n [suffixTemplates]=\"form.suffixTemplates\"\r\n [setPrefixTemplates]=\"form.setPrefixTemplates\"\r\n [setSuffixTemplates]=\"form.setSuffixTemplates\"\r\n\r\n #subForm>\r\n <ng-template #wrapperTemplate let-form=\"form\" let-fieldSetsTemplate=\"fieldSetsTemplate\">\r\n <ng-container [ngTemplateOutlet]=\"fieldSetsTemplate\"></ng-container>\r\n </ng-template>\r\n</dynamic-form>\r\n", components: [{ type: DynamicFormComponent, selector: "dynamic-form, [dynamic-form]", inputs: ["group", "controls", "serializers", "fieldSets", "data"] }], directives: [{ type: i2__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
|
|
2398
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicFormModelComponent, decorators: [{
|
|
2399
|
+
type: i0.Component,
|
|
2400
|
+
args: [{
|
|
2401
|
+
moduleId: module.id,
|
|
2402
|
+
selector: "dynamic-form-model",
|
|
2403
|
+
templateUrl: "./dynamic-form-model.component.html"
|
|
2404
|
+
}]
|
|
2405
|
+
}], propDecorators: { subForm: [{
|
|
2406
|
+
type: i0.ViewChild,
|
|
2407
|
+
args: ["subForm"]
|
|
2408
|
+
}] } });
|
|
2258
2409
|
|
|
2259
2410
|
// --- Components ---
|
|
2260
2411
|
var components = [
|
|
@@ -2297,24 +2448,60 @@
|
|
|
2297
2448
|
};
|
|
2298
2449
|
return NgxDynamicFormModule;
|
|
2299
2450
|
}());
|
|
2300
|
-
NgxDynamicFormModule
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2451
|
+
NgxDynamicFormModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: NgxDynamicFormModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
2452
|
+
NgxDynamicFormModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: NgxDynamicFormModule, declarations: [DynamicFormsComponent,
|
|
2453
|
+
DynamicFormComponent,
|
|
2454
|
+
DynamicFormGroupComponent,
|
|
2455
|
+
DynamicFormFileComponent,
|
|
2456
|
+
DynamicFormInputComponent,
|
|
2457
|
+
DynamicFormSelectComponent,
|
|
2458
|
+
DynamicFormStaticComponent,
|
|
2459
|
+
DynamicFormModelComponent, AsyncSubmitDirective,
|
|
2460
|
+
DynamicFormControlDirective,
|
|
2461
|
+
DynamicFormGroupDirective,
|
|
2462
|
+
DynamicFormTemplateDirective], imports: [i2$1.CommonModule,
|
|
2463
|
+
i2.FormsModule,
|
|
2464
|
+
i2.ReactiveFormsModule,
|
|
2465
|
+
i3.NgxUtilsModule], exports: [DynamicFormsComponent,
|
|
2466
|
+
DynamicFormComponent,
|
|
2467
|
+
DynamicFormGroupComponent,
|
|
2468
|
+
DynamicFormFileComponent,
|
|
2469
|
+
DynamicFormInputComponent,
|
|
2470
|
+
DynamicFormSelectComponent,
|
|
2471
|
+
DynamicFormStaticComponent,
|
|
2472
|
+
DynamicFormModelComponent, AsyncSubmitDirective,
|
|
2473
|
+
DynamicFormControlDirective,
|
|
2474
|
+
DynamicFormGroupDirective,
|
|
2475
|
+
DynamicFormTemplateDirective, i2.FormsModule,
|
|
2476
|
+
i2.ReactiveFormsModule,
|
|
2477
|
+
i3.NgxUtilsModule] });
|
|
2478
|
+
NgxDynamicFormModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: NgxDynamicFormModule, providers: pipes, imports: [[
|
|
2479
|
+
i2$1.CommonModule,
|
|
2480
|
+
i2.FormsModule,
|
|
2481
|
+
i2.ReactiveFormsModule,
|
|
2482
|
+
i3.NgxUtilsModule
|
|
2483
|
+
], i2.FormsModule,
|
|
2484
|
+
i2.ReactiveFormsModule,
|
|
2485
|
+
i3.NgxUtilsModule] });
|
|
2486
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: NgxDynamicFormModule, decorators: [{
|
|
2487
|
+
type: i0.NgModule,
|
|
2488
|
+
args: [{
|
|
2489
|
+
declarations: __spreadArray(__spreadArray(__spreadArray([], __read(components)), __read(directives)), __read(pipes)),
|
|
2490
|
+
imports: [
|
|
2491
|
+
i2$1.CommonModule,
|
|
2492
|
+
i2.FormsModule,
|
|
2493
|
+
i2.ReactiveFormsModule,
|
|
2494
|
+
i3.NgxUtilsModule
|
|
2495
|
+
],
|
|
2496
|
+
exports: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(components)), __read(directives)), __read(pipes)), [
|
|
2497
|
+
i2.FormsModule,
|
|
2498
|
+
i2.ReactiveFormsModule,
|
|
2499
|
+
i3.NgxUtilsModule
|
|
2500
|
+
]),
|
|
2501
|
+
entryComponents: components,
|
|
2502
|
+
providers: pipes
|
|
2503
|
+
}]
|
|
2504
|
+
}] });
|
|
2318
2505
|
|
|
2319
2506
|
/**
|
|
2320
2507
|
* Generated bundle index. Do not edit.
|
|
@@ -2361,10 +2548,6 @@
|
|
|
2361
2548
|
exports.getFormSerializer = getFormSerializer;
|
|
2362
2549
|
exports.provideFormControl = provideFormControl;
|
|
2363
2550
|
exports.provideFormGroup = provideFormGroup;
|
|
2364
|
-
exports["ɵa"] = FORM_GROUP_TYPE;
|
|
2365
|
-
exports["ɵb"] = components;
|
|
2366
|
-
exports["ɵc"] = directives;
|
|
2367
|
-
exports["ɵd"] = pipes;
|
|
2368
2551
|
|
|
2369
2552
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2370
2553
|
|