@stemy/ngx-dynamic-form 10.2.27 → 10.2.30
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 +217 -110
- package/bundles/stemy-ngx-dynamic-form.umd.js.map +1 -1
- package/bundles/stemy-ngx-dynamic-form.umd.min.js +1 -1
- package/bundles/stemy-ngx-dynamic-form.umd.min.js.map +1 -1
- package/esm2015/ngx-dynamic-form/common-types.js +26 -63
- package/esm2015/ngx-dynamic-form/components/base/dynamic-base-form-array.component.js +53 -0
- package/esm2015/ngx-dynamic-form/components/base/dynamic-base-form-control-container.component.js +13 -2
- package/esm2015/ngx-dynamic-form/components/base/dynamic-base-form-group.component.js +53 -0
- package/esm2015/ngx-dynamic-form/components/base/dynamic-base-form.component.js +12 -2
- package/esm2015/ngx-dynamic-form/ngx-dynamic-form.module.js +8 -10
- package/esm2015/ngx-dynamic-form/services/dynamic-form.service.js +32 -22
- package/esm2015/ngx-dynamic-form/utils/form-select-subject.js +3 -1
- package/esm2015/ngx-dynamic-form/utils/misc.js +15 -1
- package/esm2015/public_api.js +4 -2
- package/esm2015/stemy-ngx-dynamic-form.js +1 -2
- package/fesm2015/stemy-ngx-dynamic-form.js +197 -100
- package/fesm2015/stemy-ngx-dynamic-form.js.map +1 -1
- package/ngx-dynamic-form/common-types.d.ts +24 -95
- package/ngx-dynamic-form/components/base/dynamic-base-form-array.component.d.ts +20 -0
- package/ngx-dynamic-form/components/base/dynamic-base-form-control-container.component.d.ts +1 -0
- package/ngx-dynamic-form/components/base/dynamic-base-form-group.component.d.ts +20 -0
- package/ngx-dynamic-form/components/base/dynamic-base-form.component.d.ts +2 -1
- package/ngx-dynamic-form/ngx-dynamic-form.module.d.ts +3 -1
- package/ngx-dynamic-form/services/dynamic-form.service.d.ts +6 -5
- package/ngx-dynamic-form/utils/misc.d.ts +2 -0
- package/package.json +1 -1
- package/public_api.d.ts +3 -1
- package/stemy-ngx-dynamic-form.d.ts +0 -1
- package/stemy-ngx-dynamic-form.metadata.json +1 -1
- package/esm2015/ngx-dynamic-form/services/dynamic-form-validation.service.js +0 -11
- package/ngx-dynamic-form/services/dynamic-form-validation.service.d.ts +0 -5
|
@@ -5,11 +5,6 @@
|
|
|
5
5
|
}(this, (function (exports, ngxUtils, rxjs, core$1, forms, core, operators, common) { 'use strict';
|
|
6
6
|
|
|
7
7
|
// --- Decorator functions ---
|
|
8
|
-
var emptyArray = [];
|
|
9
|
-
var emptyTester = function () {
|
|
10
|
-
return Promise.resolve(false);
|
|
11
|
-
};
|
|
12
|
-
var ɵ0 = emptyTester;
|
|
13
8
|
function defaultSerializer(id, parent) {
|
|
14
9
|
var control = parent.get(id);
|
|
15
10
|
return !control ? null : control.value;
|
|
@@ -55,85 +50,54 @@
|
|
|
55
50
|
defineFormControl(target, propertyKey, createFormFile(propertyKey, data));
|
|
56
51
|
};
|
|
57
52
|
}
|
|
58
|
-
function FormFieldSet(data) {
|
|
59
|
-
return function (target) {
|
|
60
|
-
var sets = getFormFieldSets(target);
|
|
61
|
-
data.classes = data.classes || "";
|
|
62
|
-
sets[data.id] = data;
|
|
63
|
-
ngxUtils.ReflectUtils.defineMetadata("dynamicFormFieldSets", sets, target);
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
53
|
function defineFormControl(target, propertyKey, control) {
|
|
67
54
|
ngxUtils.ReflectUtils.defineMetadata("dynamicFormControl", control, target, propertyKey);
|
|
68
55
|
}
|
|
69
|
-
function getFormFieldSets(target) {
|
|
70
|
-
return ngxUtils.ReflectUtils.getMetadata("dynamicFormFieldSets", target) || {};
|
|
71
|
-
}
|
|
72
56
|
function getFormControl(target, propertyKey) {
|
|
73
57
|
return ngxUtils.ReflectUtils.getMetadata("dynamicFormControl", target, propertyKey);
|
|
74
58
|
}
|
|
75
59
|
function getFormSerializer(target, propertyKey) {
|
|
76
60
|
return ngxUtils.ReflectUtils.getMetadata("dynamicFormSerializer", target, propertyKey);
|
|
77
61
|
}
|
|
78
|
-
function createFormControl(id, type,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
data.hidden = data.hidden || emptyTester;
|
|
86
|
-
data.validators = data.validators || emptyArray;
|
|
87
|
-
return {
|
|
88
|
-
id: id,
|
|
89
|
-
type: type,
|
|
90
|
-
data: data
|
|
91
|
-
};
|
|
62
|
+
function createFormControl(id, type, config) {
|
|
63
|
+
config = config || { id: id };
|
|
64
|
+
config.id = id;
|
|
65
|
+
config.label = ngxUtils.ObjectUtils.isNullOrUndefined(config.label) ? id : config.label;
|
|
66
|
+
config.disabled = config.disabled || false;
|
|
67
|
+
config.hidden = config.hidden || false;
|
|
68
|
+
return { id: id, type: type, config: config };
|
|
92
69
|
}
|
|
93
|
-
function createFormInput(id,
|
|
70
|
+
function createFormInput(id, config, type) {
|
|
94
71
|
if (type === void 0) { type = "text"; }
|
|
95
|
-
var control = createFormControl(id, "input",
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
data.mask = data.mask || [/\w*/gi];
|
|
72
|
+
var control = createFormControl(id, "input", config);
|
|
73
|
+
config = control.config;
|
|
74
|
+
config.inputType = config.inputType || type;
|
|
75
|
+
config.placeholder = config.placeholder || (config.inputType == "mask" ? "_" : "");
|
|
76
|
+
config.step = config.step || 1;
|
|
77
|
+
config.mask = config.mask || [/\w*/gi];
|
|
102
78
|
return control;
|
|
103
79
|
}
|
|
104
80
|
function createFormSelect(id, data) {
|
|
105
81
|
var control = createFormControl(id, "select", data);
|
|
106
|
-
data = control.
|
|
82
|
+
data = control.config;
|
|
107
83
|
data.options = data.options || [];
|
|
108
|
-
data.type = data.type || "select";
|
|
109
|
-
var classType = data.type == "select" ? "select" : "select-" + data.type;
|
|
110
|
-
data.classes = !data.classes ? "form-group-" + classType : data.classes + " form-group-" + classType;
|
|
111
84
|
return control;
|
|
112
85
|
}
|
|
113
|
-
function createFormStatic(id,
|
|
114
|
-
|
|
115
|
-
data = control.data;
|
|
116
|
-
data.style = data.style || "table";
|
|
117
|
-
return control;
|
|
86
|
+
function createFormStatic(id, config) {
|
|
87
|
+
return createFormControl(id, "static", config);
|
|
118
88
|
}
|
|
119
89
|
function createFormModel(id, data) {
|
|
120
|
-
var control = createFormControl(id, "
|
|
121
|
-
data = control.
|
|
90
|
+
var control = createFormControl(id, "group", data);
|
|
91
|
+
data = control.config;
|
|
122
92
|
data.name = data.name || "";
|
|
123
93
|
return control;
|
|
124
94
|
}
|
|
125
95
|
function createFormFile(id, data) {
|
|
126
96
|
var control = createFormControl(id, "file", data);
|
|
127
|
-
data = control.
|
|
128
|
-
data.accept = data.accept || "
|
|
129
|
-
data.
|
|
130
|
-
data.
|
|
131
|
-
data.uploadUrl = ngxUtils.ObjectUtils.isString(data.uploadUrl) ? data.uploadUrl : "assets";
|
|
132
|
-
data.createUploadData = data.createUploadData || (function (file) {
|
|
133
|
-
var form = new FormData();
|
|
134
|
-
form.append("file", file);
|
|
135
|
-
return form;
|
|
136
|
-
});
|
|
97
|
+
data = control.config;
|
|
98
|
+
data.accept = data.accept || ["jpg", "jpeg", "png"];
|
|
99
|
+
data.multiple = data.multiple || false;
|
|
100
|
+
data.url = ngxUtils.ObjectUtils.isString(data.url) ? data.url : "assets";
|
|
137
101
|
return control;
|
|
138
102
|
}
|
|
139
103
|
|
|
@@ -555,6 +519,8 @@
|
|
|
555
519
|
val.then(function (options) {
|
|
556
520
|
var _a, _b;
|
|
557
521
|
_this.next(options);
|
|
522
|
+
if (options.length == 0)
|
|
523
|
+
return;
|
|
558
524
|
var currentVal = control.value;
|
|
559
525
|
if (controlModel.multiple) {
|
|
560
526
|
var correctVal = (currentVal || []).filter(function (t) { return options.findIndex(function (o) { return o.value == t; }) >= 0; });
|
|
@@ -574,6 +540,20 @@
|
|
|
574
540
|
|
|
575
541
|
function isStringWithVal(val) {
|
|
576
542
|
return typeof val == "string" && val.length > 0;
|
|
543
|
+
}
|
|
544
|
+
function collectPathAble(start, getter) {
|
|
545
|
+
if (!start || !getter(start))
|
|
546
|
+
return [];
|
|
547
|
+
var parts = [];
|
|
548
|
+
var currentPath = start;
|
|
549
|
+
while (currentPath) {
|
|
550
|
+
var val = getter(currentPath);
|
|
551
|
+
if (val) {
|
|
552
|
+
parts.unshift(val);
|
|
553
|
+
}
|
|
554
|
+
currentPath = currentPath.parent;
|
|
555
|
+
}
|
|
556
|
+
return parts;
|
|
577
557
|
}
|
|
578
558
|
|
|
579
559
|
var DynamicFormArrayModel = /** @class */ (function (_super) {
|
|
@@ -794,9 +774,9 @@
|
|
|
794
774
|
}
|
|
795
775
|
});
|
|
796
776
|
};
|
|
797
|
-
DynamicFormService.prototype.getFormModelForSchema = function (name) {
|
|
777
|
+
DynamicFormService.prototype.getFormModelForSchema = function (name, customizeModel) {
|
|
798
778
|
return __awaiter(this, void 0, void 0, function () {
|
|
799
|
-
var _c;
|
|
779
|
+
var _c, customizeModels;
|
|
800
780
|
return __generator(this, function (_d) {
|
|
801
781
|
switch (_d.label) {
|
|
802
782
|
case 0:
|
|
@@ -805,49 +785,69 @@
|
|
|
805
785
|
return [4 /*yield*/, this.openApi.getSchemas()];
|
|
806
786
|
case 1:
|
|
807
787
|
_c.schemas = _d.sent();
|
|
808
|
-
|
|
788
|
+
customizeModels = function (property, schema, modelType, config) {
|
|
789
|
+
var model = new modelType(config);
|
|
790
|
+
if (!ngxUtils.ObjectUtils.isFunction(customizeModel))
|
|
791
|
+
return [model];
|
|
792
|
+
var res = customizeModel(property, schema, model, config);
|
|
793
|
+
return Array.isArray(res) ? res : [res];
|
|
794
|
+
};
|
|
795
|
+
return [2 /*return*/, this.getFormModelForSchemaDef(this.schemas[name], customizeModels)];
|
|
809
796
|
}
|
|
810
797
|
});
|
|
811
798
|
});
|
|
812
799
|
};
|
|
813
|
-
DynamicFormService.prototype.getFormModelForSchemaDef = function (schema) {
|
|
814
|
-
var
|
|
800
|
+
DynamicFormService.prototype.getFormModelForSchemaDef = function (schema, customizeModels) {
|
|
801
|
+
var e_1, _c;
|
|
815
802
|
if (!schema)
|
|
816
803
|
return [];
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
804
|
+
var keys = Object.keys(schema.properties || {});
|
|
805
|
+
var controls = [];
|
|
806
|
+
try {
|
|
807
|
+
for (var keys_1 = __values(keys), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {
|
|
808
|
+
var p = keys_1_1.value;
|
|
809
|
+
var property = schema.properties[p];
|
|
810
|
+
controls.push.apply(controls, __spread(this.getFormControlModels(property, schema, customizeModels)));
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
814
|
+
finally {
|
|
815
|
+
try {
|
|
816
|
+
if (keys_1_1 && !keys_1_1.done && (_c = keys_1.return)) _c.call(keys_1);
|
|
817
|
+
}
|
|
818
|
+
finally { if (e_1) throw e_1.error; }
|
|
819
|
+
}
|
|
820
|
+
return controls.filter(function (t) { return null !== t; });
|
|
821
821
|
};
|
|
822
|
-
DynamicFormService.prototype.
|
|
822
|
+
DynamicFormService.prototype.getFormControlModels = function (property, schema, customizeModels) {
|
|
823
823
|
var _a, _b;
|
|
824
824
|
var $enum = ((_a = property.items) === null || _a === void 0 ? void 0 : _a.enum) || property.enum;
|
|
825
825
|
if (Array.isArray($enum) || isStringWithVal(property.optionsPath) || isStringWithVal(property.endpoint)) {
|
|
826
|
-
return
|
|
826
|
+
return customizeModels(property, schema, core.DynamicSelectModel, this.getFormSelectConfig(property, schema));
|
|
827
827
|
}
|
|
828
828
|
switch (property.type) {
|
|
829
829
|
case "string":
|
|
830
830
|
case "number":
|
|
831
831
|
case "integer":
|
|
832
|
-
return
|
|
832
|
+
return customizeModels(property, schema, core.DynamicInputModel, this.getFormInputConfig(property, schema));
|
|
833
833
|
case "textarea":
|
|
834
|
-
return
|
|
834
|
+
return customizeModels(property, schema, core.DynamicTextAreaModel, this.getFormTextareaConfig(property, schema));
|
|
835
835
|
case "boolean":
|
|
836
|
-
return
|
|
836
|
+
return customizeModels(property, schema, core.DynamicCheckboxModel, this.getFormCheckboxConfig(property, schema));
|
|
837
837
|
case "array":
|
|
838
838
|
if (((_b = property.items) === null || _b === void 0 ? void 0 : _b.$ref) || property.$ref) {
|
|
839
|
-
return
|
|
839
|
+
return customizeModels(property, schema, DynamicFormArrayModel, this.getFormArrayConfig(property, schema, customizeModels));
|
|
840
840
|
}
|
|
841
841
|
else {
|
|
842
|
-
return
|
|
842
|
+
return customizeModels(property, schema, core.DynamicInputModel, this.getFormInputConfig(property, schema));
|
|
843
843
|
}
|
|
844
844
|
case "file":
|
|
845
|
-
return
|
|
845
|
+
return customizeModels(property, schema, core.DynamicFileUploadModel, this.getFormUploadConfig(property, schema));
|
|
846
846
|
}
|
|
847
847
|
if (property.$ref) {
|
|
848
|
-
return
|
|
848
|
+
return customizeModels(property, schema, core.DynamicFormGroupModel, this.getFormGroupConfig(property, schema, customizeModels));
|
|
849
849
|
}
|
|
850
|
-
return
|
|
850
|
+
return [];
|
|
851
851
|
};
|
|
852
852
|
DynamicFormService.prototype.getFormControlConfig = function (property, schema) {
|
|
853
853
|
var validators = this.getValidators(property, schema);
|
|
@@ -865,17 +865,17 @@
|
|
|
865
865
|
additional: Object.assign({}, property)
|
|
866
866
|
};
|
|
867
867
|
};
|
|
868
|
-
DynamicFormService.prototype.getFormArrayConfig = function (property, schema) {
|
|
868
|
+
DynamicFormService.prototype.getFormArrayConfig = function (property, schema, customizeModels) {
|
|
869
869
|
var _this = this;
|
|
870
870
|
var _a;
|
|
871
871
|
var ref = ((_a = property.items) === null || _a === void 0 ? void 0 : _a.$ref) || property.$ref || "";
|
|
872
872
|
var subSchema = this.schemas[ref.split("/").pop()];
|
|
873
|
-
return Object.assign(this.getFormControlConfig(property, schema), { groupFactory: function () { return _this.getFormModelForSchemaDef(subSchema); } });
|
|
873
|
+
return Object.assign(this.getFormControlConfig(property, schema), { groupFactory: function () { return _this.getFormModelForSchemaDef(subSchema, customizeModels); } });
|
|
874
874
|
};
|
|
875
|
-
DynamicFormService.prototype.getFormGroupConfig = function (property, schema) {
|
|
875
|
+
DynamicFormService.prototype.getFormGroupConfig = function (property, schema, customizeModels) {
|
|
876
876
|
var ref = property.$ref || "";
|
|
877
877
|
var subSchema = this.schemas[ref.split("/").pop()];
|
|
878
|
-
return Object.assign(this.getFormControlConfig(property, schema), { group: this.getFormModelForSchemaDef(subSchema) });
|
|
878
|
+
return Object.assign(this.getFormControlConfig(property, schema), { group: this.getFormModelForSchemaDef(subSchema, customizeModels) });
|
|
879
879
|
};
|
|
880
880
|
DynamicFormService.prototype.getFormInputConfig = function (property, schema) {
|
|
881
881
|
var _a;
|
|
@@ -928,8 +928,8 @@
|
|
|
928
928
|
};
|
|
929
929
|
DynamicFormService.prototype.translateOptions = function (options) {
|
|
930
930
|
return __awaiter(this, void 0, void 0, function () {
|
|
931
|
-
var options_1, options_1_1, option, _c,
|
|
932
|
-
var
|
|
931
|
+
var options_1, options_1_1, option, _c, e_2_1;
|
|
932
|
+
var e_2, _d;
|
|
933
933
|
return __generator(this, function (_e) {
|
|
934
934
|
switch (_e.label) {
|
|
935
935
|
case 0:
|
|
@@ -953,14 +953,14 @@
|
|
|
953
953
|
return [3 /*break*/, 2];
|
|
954
954
|
case 5: return [3 /*break*/, 8];
|
|
955
955
|
case 6:
|
|
956
|
-
|
|
957
|
-
|
|
956
|
+
e_2_1 = _e.sent();
|
|
957
|
+
e_2 = { error: e_2_1 };
|
|
958
958
|
return [3 /*break*/, 8];
|
|
959
959
|
case 7:
|
|
960
960
|
try {
|
|
961
961
|
if (options_1_1 && !options_1_1.done && (_d = options_1.return)) _d.call(options_1);
|
|
962
962
|
}
|
|
963
|
-
finally { if (
|
|
963
|
+
finally { if (e_2) throw e_2.error; }
|
|
964
964
|
return [7 /*endfinally*/];
|
|
965
965
|
case 8: return [2 /*return*/, options];
|
|
966
966
|
}
|
|
@@ -974,7 +974,7 @@
|
|
|
974
974
|
if (Array.isArray($enum)) {
|
|
975
975
|
return new FormSelectSubject(function () {
|
|
976
976
|
var options = $enum.map(function (value) {
|
|
977
|
-
var label = property.translatable ? property.id + "." + value : value;
|
|
977
|
+
var label = property.translatable ? property.id + "." + value : "" + value;
|
|
978
978
|
return { value: value, label: label };
|
|
979
979
|
});
|
|
980
980
|
return _this.translateOptions(options);
|
|
@@ -1271,6 +1271,15 @@
|
|
|
1271
1271
|
this.formService.clearFormArray(formArray, formArrayModel);
|
|
1272
1272
|
this.changeDetectorRef.detectChanges();
|
|
1273
1273
|
};
|
|
1274
|
+
DynamicBaseFormComponent.prototype.getClass = function (model) {
|
|
1275
|
+
var parts = collectPathAble(model, function (p) { return p.id; });
|
|
1276
|
+
if (parts.length == 0)
|
|
1277
|
+
return "";
|
|
1278
|
+
if (model instanceof core.DynamicFormGroupModel) {
|
|
1279
|
+
return "form-group-" + parts.join("-");
|
|
1280
|
+
}
|
|
1281
|
+
return "form-control-" + parts.join("-");
|
|
1282
|
+
};
|
|
1274
1283
|
DynamicBaseFormComponent.prototype.validate = function (showErrors) {
|
|
1275
1284
|
var _this = this;
|
|
1276
1285
|
if (showErrors === void 0) { showErrors = true; }
|
|
@@ -1339,6 +1348,59 @@
|
|
|
1339
1348
|
ngForm: [{ type: core$1.ViewChild, args: [forms.NgForm,] }]
|
|
1340
1349
|
};
|
|
1341
1350
|
|
|
1351
|
+
var DynamicBaseFormArrayComponent = /** @class */ (function (_super) {
|
|
1352
|
+
__extends(DynamicBaseFormArrayComponent, _super);
|
|
1353
|
+
function DynamicBaseFormArrayComponent(layoutService, validationService) {
|
|
1354
|
+
var _this = _super.call(this, layoutService, validationService) || this;
|
|
1355
|
+
_this.layoutService = layoutService;
|
|
1356
|
+
_this.validationService = validationService;
|
|
1357
|
+
_this.blur = new core$1.EventEmitter();
|
|
1358
|
+
_this.change = new core$1.EventEmitter();
|
|
1359
|
+
_this.customEvent = new core$1.EventEmitter();
|
|
1360
|
+
_this.focus = new core$1.EventEmitter();
|
|
1361
|
+
return _this;
|
|
1362
|
+
}
|
|
1363
|
+
DynamicBaseFormArrayComponent.prototype.getClass = function (context, place, model) {
|
|
1364
|
+
return [
|
|
1365
|
+
context == "element" ? this.getModelClass(model) : null,
|
|
1366
|
+
_super.prototype.getClass.call(this, context, place, model)
|
|
1367
|
+
].filter(function (cls) { return !!cls; }).join(" ");
|
|
1368
|
+
};
|
|
1369
|
+
DynamicBaseFormArrayComponent.prototype.getModelClass = function (model) {
|
|
1370
|
+
var parts = collectPathAble(model, function (p) { return p.id; });
|
|
1371
|
+
if (parts.length == 0)
|
|
1372
|
+
return "";
|
|
1373
|
+
if (model instanceof core.DynamicFormGroupModel) {
|
|
1374
|
+
return "form-group-" + parts.join("-");
|
|
1375
|
+
}
|
|
1376
|
+
return "form-control-" + parts.join("-");
|
|
1377
|
+
};
|
|
1378
|
+
return DynamicBaseFormArrayComponent;
|
|
1379
|
+
}(core.DynamicFormArrayComponent));
|
|
1380
|
+
DynamicBaseFormArrayComponent.decorators = [
|
|
1381
|
+
{ type: core$1.Component, args: [{
|
|
1382
|
+
selector: "dynamic-base-form-array",
|
|
1383
|
+
template: "",
|
|
1384
|
+
changeDetection: core$1.ChangeDetectionStrategy.OnPush
|
|
1385
|
+
},] }
|
|
1386
|
+
];
|
|
1387
|
+
DynamicBaseFormArrayComponent.ctorParameters = function () { return [
|
|
1388
|
+
{ type: core.DynamicFormLayoutService },
|
|
1389
|
+
{ type: core.DynamicFormValidationService }
|
|
1390
|
+
]; };
|
|
1391
|
+
DynamicBaseFormArrayComponent.propDecorators = {
|
|
1392
|
+
formLayout: [{ type: core$1.Input }],
|
|
1393
|
+
group: [{ type: core$1.Input }],
|
|
1394
|
+
layout: [{ type: core$1.Input }],
|
|
1395
|
+
model: [{ type: core$1.Input }],
|
|
1396
|
+
templates: [{ type: core$1.Input }],
|
|
1397
|
+
blur: [{ type: core$1.Output }],
|
|
1398
|
+
change: [{ type: core$1.Output }],
|
|
1399
|
+
customEvent: [{ type: core$1.Output }],
|
|
1400
|
+
focus: [{ type: core$1.Output }],
|
|
1401
|
+
components: [{ type: core$1.ViewChildren, args: [core$1.forwardRef(function () { return core.DynamicFormControlContainerComponent; }),] }]
|
|
1402
|
+
};
|
|
1403
|
+
|
|
1342
1404
|
var DynamicBaseFormControlContainerComponent = /** @class */ (function (_super) {
|
|
1343
1405
|
__extends(DynamicBaseFormControlContainerComponent, _super);
|
|
1344
1406
|
function DynamicBaseFormControlContainerComponent(form, changeDetectorRef, componentFactoryResolver, layoutService, validationService, componentService, relationService) {
|
|
@@ -1402,6 +1464,16 @@
|
|
|
1402
1464
|
_super.prototype.ngOnDestroy.call(this);
|
|
1403
1465
|
this.onDetectChanges.unsubscribe();
|
|
1404
1466
|
};
|
|
1467
|
+
DynamicBaseFormControlContainerComponent.prototype.getLabel = function () {
|
|
1468
|
+
var _a;
|
|
1469
|
+
var label = collectPathAble(this.model, function (p) { return p.label; });
|
|
1470
|
+
if (label.length == 0)
|
|
1471
|
+
return "";
|
|
1472
|
+
if ((_a = this.form) === null || _a === void 0 ? void 0 : _a.labelPrefix) {
|
|
1473
|
+
label.unshift(this.form.labelPrefix);
|
|
1474
|
+
}
|
|
1475
|
+
return label.join(".");
|
|
1476
|
+
};
|
|
1405
1477
|
DynamicBaseFormControlContainerComponent.prototype.createFormControlComponent = function () {
|
|
1406
1478
|
var _a;
|
|
1407
1479
|
_super.prototype.createFormControlComponent.call(this);
|
|
@@ -1446,24 +1518,65 @@
|
|
|
1446
1518
|
componentViewContainerRef: [{ type: core$1.ViewChild, args: ["componentViewContainer", { read: core$1.ViewContainerRef, static: true },] }]
|
|
1447
1519
|
};
|
|
1448
1520
|
|
|
1449
|
-
var
|
|
1450
|
-
__extends(
|
|
1451
|
-
function
|
|
1452
|
-
|
|
1521
|
+
var DynamicBaseFormGroupComponent = /** @class */ (function (_super) {
|
|
1522
|
+
__extends(DynamicBaseFormGroupComponent, _super);
|
|
1523
|
+
function DynamicBaseFormGroupComponent(layoutService, validationService) {
|
|
1524
|
+
var _this = _super.call(this, layoutService, validationService) || this;
|
|
1525
|
+
_this.layoutService = layoutService;
|
|
1526
|
+
_this.validationService = validationService;
|
|
1527
|
+
_this.blur = new core$1.EventEmitter();
|
|
1528
|
+
_this.change = new core$1.EventEmitter();
|
|
1529
|
+
_this.customEvent = new core$1.EventEmitter();
|
|
1530
|
+
_this.focus = new core$1.EventEmitter();
|
|
1531
|
+
return _this;
|
|
1453
1532
|
}
|
|
1454
|
-
|
|
1455
|
-
return
|
|
1533
|
+
DynamicBaseFormGroupComponent.prototype.getClass = function (context, place, model) {
|
|
1534
|
+
return [
|
|
1535
|
+
context == "element" ? this.getModelClass(model) : null,
|
|
1536
|
+
_super.prototype.getClass.call(this, context, place, model)
|
|
1537
|
+
].filter(function (cls) { return !!cls; }).join(" ");
|
|
1456
1538
|
};
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1539
|
+
DynamicBaseFormGroupComponent.prototype.getModelClass = function (model) {
|
|
1540
|
+
var parts = collectPathAble(model, function (p) { return p.id; });
|
|
1541
|
+
if (parts.length == 0)
|
|
1542
|
+
return "";
|
|
1543
|
+
if (model instanceof core.DynamicFormGroupModel) {
|
|
1544
|
+
return "form-group-" + parts.join("-");
|
|
1545
|
+
}
|
|
1546
|
+
return "form-control-" + parts.join("-");
|
|
1547
|
+
};
|
|
1548
|
+
return DynamicBaseFormGroupComponent;
|
|
1549
|
+
}(core.DynamicFormGroupComponent));
|
|
1550
|
+
DynamicBaseFormGroupComponent.decorators = [
|
|
1551
|
+
{ type: core$1.Component, args: [{
|
|
1552
|
+
selector: "dynamic-base-form-group",
|
|
1553
|
+
template: "",
|
|
1554
|
+
changeDetection: core$1.ChangeDetectionStrategy.OnPush
|
|
1555
|
+
},] }
|
|
1556
|
+
];
|
|
1557
|
+
DynamicBaseFormGroupComponent.ctorParameters = function () { return [
|
|
1558
|
+
{ type: core.DynamicFormLayoutService },
|
|
1559
|
+
{ type: core.DynamicFormValidationService }
|
|
1560
|
+
]; };
|
|
1561
|
+
DynamicBaseFormGroupComponent.propDecorators = {
|
|
1562
|
+
formLayout: [{ type: core$1.Input }],
|
|
1563
|
+
group: [{ type: core$1.Input }],
|
|
1564
|
+
layout: [{ type: core$1.Input }],
|
|
1565
|
+
model: [{ type: core$1.Input }],
|
|
1566
|
+
templates: [{ type: core$1.Input }],
|
|
1567
|
+
blur: [{ type: core$1.Output }],
|
|
1568
|
+
change: [{ type: core$1.Output }],
|
|
1569
|
+
customEvent: [{ type: core$1.Output }],
|
|
1570
|
+
focus: [{ type: core$1.Output }],
|
|
1571
|
+
components: [{ type: core$1.ViewChildren, args: [core$1.forwardRef(function () { return core.DynamicFormControlContainerComponent; }),] }]
|
|
1572
|
+
};
|
|
1462
1573
|
|
|
1463
1574
|
// --- Components ---
|
|
1464
1575
|
var components = [
|
|
1465
1576
|
DynamicBaseFormComponent,
|
|
1466
|
-
|
|
1577
|
+
DynamicBaseFormArrayComponent,
|
|
1578
|
+
DynamicBaseFormControlContainerComponent,
|
|
1579
|
+
DynamicBaseFormGroupComponent
|
|
1467
1580
|
];
|
|
1468
1581
|
// --- Directives ---
|
|
1469
1582
|
var directives = [
|
|
@@ -1471,7 +1584,7 @@
|
|
|
1471
1584
|
];
|
|
1472
1585
|
// --- Pipes ---
|
|
1473
1586
|
var pipes = [];
|
|
1474
|
-
var ɵ0
|
|
1587
|
+
var ɵ0 = validateJSON, ɵ1 = validateRequiredTranslation, ɵ2 = validateItemsMinLength, ɵ3 = validateItemsMaxLength, ɵ4 = validateItemsMinValue, ɵ5 = validateItemsMaxValue, ɵ6 = new Map([
|
|
1475
1588
|
["json", validateJSON],
|
|
1476
1589
|
["requiredTranslation", validateRequiredTranslation],
|
|
1477
1590
|
["phone", validatePhone],
|
|
@@ -1488,14 +1601,9 @@
|
|
|
1488
1601
|
ngModule: NgxDynamicFormModule,
|
|
1489
1602
|
providers: [
|
|
1490
1603
|
DynamicFormService,
|
|
1491
|
-
DynamicFormValidationService,
|
|
1492
1604
|
{
|
|
1493
1605
|
provide: core.DynamicFormService,
|
|
1494
1606
|
useExisting: DynamicFormService
|
|
1495
|
-
},
|
|
1496
|
-
{
|
|
1497
|
-
provide: core.DynamicFormValidationService,
|
|
1498
|
-
useExisting: DynamicFormValidationService
|
|
1499
1607
|
}
|
|
1500
1608
|
]
|
|
1501
1609
|
};
|
|
@@ -1518,7 +1626,7 @@
|
|
|
1518
1626
|
]),
|
|
1519
1627
|
entryComponents: components,
|
|
1520
1628
|
providers: __spread(pipes, [
|
|
1521
|
-
{ provide: forms.NG_VALIDATORS, useValue: ɵ0
|
|
1629
|
+
{ provide: forms.NG_VALIDATORS, useValue: ɵ0, multi: true },
|
|
1522
1630
|
{ provide: forms.NG_VALIDATORS, useValue: ɵ1, multi: true },
|
|
1523
1631
|
{ provide: forms.NG_VALIDATORS, useValue: ɵ2, multi: true },
|
|
1524
1632
|
{ provide: forms.NG_VALIDATORS, useValue: ɵ3, multi: true },
|
|
@@ -1537,10 +1645,11 @@
|
|
|
1537
1645
|
*/
|
|
1538
1646
|
|
|
1539
1647
|
exports.AsyncSubmitDirective = AsyncSubmitDirective;
|
|
1648
|
+
exports.DynamicBaseFormArrayComponent = DynamicBaseFormArrayComponent;
|
|
1540
1649
|
exports.DynamicBaseFormComponent = DynamicBaseFormComponent;
|
|
1541
1650
|
exports.DynamicBaseFormControlContainerComponent = DynamicBaseFormControlContainerComponent;
|
|
1651
|
+
exports.DynamicBaseFormGroupComponent = DynamicBaseFormGroupComponent;
|
|
1542
1652
|
exports.DynamicFormService = DynamicFormService;
|
|
1543
|
-
exports.FormFieldSet = FormFieldSet;
|
|
1544
1653
|
exports.FormFile = FormFile;
|
|
1545
1654
|
exports.FormInput = FormInput;
|
|
1546
1655
|
exports.FormModel = FormModel;
|
|
@@ -1558,7 +1667,6 @@
|
|
|
1558
1667
|
exports.defaultSerializer = defaultSerializer;
|
|
1559
1668
|
exports.defineFormControl = defineFormControl;
|
|
1560
1669
|
exports.getFormControl = getFormControl;
|
|
1561
|
-
exports.getFormFieldSets = getFormFieldSets;
|
|
1562
1670
|
exports.getFormSerializer = getFormSerializer;
|
|
1563
1671
|
exports.validateItemsMaxLength = validateItemsMaxLength;
|
|
1564
1672
|
exports.validateItemsMaxValue = validateItemsMaxValue;
|
|
@@ -1570,7 +1678,6 @@
|
|
|
1570
1678
|
exports.ɵa = components;
|
|
1571
1679
|
exports.ɵb = directives;
|
|
1572
1680
|
exports.ɵc = pipes;
|
|
1573
|
-
exports.ɵd = DynamicFormValidationService;
|
|
1574
1681
|
|
|
1575
1682
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1576
1683
|
|