@koalarx/ui 12.7.18 → 12.7.19
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/form/bundles/koalarx-ui-form.umd.js +27 -2
- package/form/bundles/koalarx-ui-form.umd.js.map +1 -1
- package/form/esm2015/lib/dynamic-form/builder/dynamic-form.builder.js +2 -2
- package/form/esm2015/lib/dynamic-form/builder/fields/field.base.js +2 -1
- package/form/esm2015/lib/dynamic-form/dynamic-form.component.js +15 -2
- package/form/fesm2015/koalarx-ui-form.js +16 -2
- package/form/fesm2015/koalarx-ui-form.js.map +1 -1
- package/form/koalarx-ui-form.metadata.json +1 -1
- package/form/lib/dynamic-form/builder/fields/field.base.d.ts +1 -1
- package/form/lib/dynamic-form/dynamic-form.component.d.ts +1 -0
- package/package.json +1 -1
|
@@ -478,6 +478,7 @@
|
|
|
478
478
|
FieldBase.prototype.multiple = function (multiple) {
|
|
479
479
|
if (multiple === void 0) { multiple = true; }
|
|
480
480
|
this.fieldConfig.multiple = multiple;
|
|
481
|
+
return this;
|
|
481
482
|
};
|
|
482
483
|
FieldBase.prototype.valueChanges = function (fn) {
|
|
483
484
|
this.fieldConfig.valueChanges = fn;
|
|
@@ -724,7 +725,7 @@
|
|
|
724
725
|
var setValues_1 = [];
|
|
725
726
|
Object.keys(object).forEach(function (indexName) {
|
|
726
727
|
var _a, _b, _c, _d, _e;
|
|
727
|
-
var arrField = utils.koala(_this.config.formConfig).array().filter(indexName, 'name').getValue();
|
|
728
|
+
var arrField = utils.koala(_this.config.formConfig).array().filter(indexName, 'name', { comparator: "=" }).getValue();
|
|
728
729
|
if (arrField.length === 1) {
|
|
729
730
|
var field_1 = (_a = arrField[0]) !== null && _a !== void 0 ? _a : null;
|
|
730
731
|
if (typeof object[indexName] !== "object" ||
|
|
@@ -1270,9 +1271,12 @@
|
|
|
1270
1271
|
if (newFormGroup.get('multiple').value) {
|
|
1271
1272
|
if (Array.isArray(value)) {
|
|
1272
1273
|
newFormGroup.get('autocompleteSelectedValue').setValue(value);
|
|
1274
|
+
newFormGroup.get('value').setValue(value[value.length - 1], { emitEvent: false });
|
|
1273
1275
|
}
|
|
1274
1276
|
else {
|
|
1275
|
-
newFormGroup.get('autocompleteSelectedValue').value
|
|
1277
|
+
if (this.validateAutocompleteSelect(newFormGroup.get('autocompleteSelectedValue').value, value)) {
|
|
1278
|
+
newFormGroup.get('autocompleteSelectedValue').value.push(value);
|
|
1279
|
+
}
|
|
1276
1280
|
}
|
|
1277
1281
|
if ((_a = this.autocompleteInput) === null || _a === void 0 ? void 0 : _a.nativeElement) {
|
|
1278
1282
|
this.autocompleteInput.nativeElement.value = '';
|
|
@@ -1820,6 +1824,27 @@
|
|
|
1820
1824
|
});
|
|
1821
1825
|
});
|
|
1822
1826
|
};
|
|
1827
|
+
DynamicFormComponent.prototype.validateAutocompleteSelect = function (selectedValues, value) {
|
|
1828
|
+
var e_6, _5;
|
|
1829
|
+
var isValid = true;
|
|
1830
|
+
try {
|
|
1831
|
+
for (var _6 = __values(selectedValues.values()), _7 = _6.next(); !_7.done; _7 = _6.next()) {
|
|
1832
|
+
var selectedItem = _7.value;
|
|
1833
|
+
if (selectedItem.name === value.name) {
|
|
1834
|
+
isValid = false;
|
|
1835
|
+
break;
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1840
|
+
finally {
|
|
1841
|
+
try {
|
|
1842
|
+
if (_7 && !_7.done && (_5 = _6.return)) _5.call(_6);
|
|
1843
|
+
}
|
|
1844
|
+
finally { if (e_6) throw e_6.error; }
|
|
1845
|
+
}
|
|
1846
|
+
return isValid;
|
|
1847
|
+
};
|
|
1823
1848
|
return DynamicFormComponent;
|
|
1824
1849
|
}(FormAbstract));
|
|
1825
1850
|
DynamicFormComponent.decorators = [
|