tuain-ng-forms-lib 12.0.32 → 12.0.33
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/tuain-ng-forms-lib.umd.js +14 -26
- package/bundles/tuain-ng-forms-lib.umd.js.map +1 -1
- package/esm2015/lib/classes/forms/field.js +11 -23
- package/esm2015/lib/components/elements/field.component.js +5 -5
- package/fesm2015/tuain-ng-forms-lib.js +14 -26
- package/fesm2015/tuain-ng-forms-lib.js.map +1 -1
- package/lib/classes/forms/field.d.ts +1 -2
- package/package.json +1 -1
|
@@ -422,18 +422,18 @@
|
|
|
422
422
|
FieldComponent.prototype.start = function () { };
|
|
423
423
|
FieldComponent.prototype.focus = function () { };
|
|
424
424
|
FieldComponent.prototype.updateObject = function () {
|
|
425
|
-
this.field.
|
|
425
|
+
this.field.setValue(this.value);
|
|
426
426
|
};
|
|
427
427
|
FieldComponent.prototype.inputChanged = function () {
|
|
428
|
-
this.field.
|
|
428
|
+
this.field.setValue(this.value);
|
|
429
429
|
this.onChangeContent();
|
|
430
430
|
};
|
|
431
431
|
FieldComponent.prototype.inputTyped = function () {
|
|
432
|
-
this.field.
|
|
432
|
+
this.field.setValue(this.value);
|
|
433
433
|
this.onInputChange();
|
|
434
434
|
};
|
|
435
435
|
FieldComponent.prototype.updateValue = function () {
|
|
436
|
-
this.value = this.field.
|
|
436
|
+
this.value = this.field.getValue();
|
|
437
437
|
};
|
|
438
438
|
FieldComponent.prototype.onInputChange = function () {
|
|
439
439
|
var _this = this;
|
|
@@ -1691,7 +1691,7 @@
|
|
|
1691
1691
|
var BIG_MAX_LENGTH = 500;
|
|
1692
1692
|
var fldAttr = {
|
|
1693
1693
|
validateOnServer: 'validateOnServer',
|
|
1694
|
-
value: '
|
|
1694
|
+
value: '_value',
|
|
1695
1695
|
minValue: '_minValue',
|
|
1696
1696
|
maxValue: '_maxValue',
|
|
1697
1697
|
maxLength: '_maxLength',
|
|
@@ -1869,7 +1869,6 @@
|
|
|
1869
1869
|
FieldDescriptor.prototype.hideLabel = function () { this.setVisibleLabel(false); };
|
|
1870
1870
|
FieldDescriptor.prototype.setChanged = function (hasChanged) { this.setAttr(fldAttr.hasChanged, hasChanged); };
|
|
1871
1871
|
FieldDescriptor.prototype.changed = function () { this.setChanged(true); };
|
|
1872
|
-
FieldDescriptor.prototype.getRawValue = function () { return this._fieldValue; };
|
|
1873
1872
|
FieldDescriptor.prototype.setLabel = function (label) { this.setAttr(fldAttr.title, label); };
|
|
1874
1873
|
FieldDescriptor.prototype.clean = function () { this.setValue(this.defaultValue || ''); this.resetError(); };
|
|
1875
1874
|
Object.defineProperty(FieldDescriptor.prototype, "backend", {
|
|
@@ -1918,22 +1917,11 @@
|
|
|
1918
1917
|
return fieldCurrentValue === '';
|
|
1919
1918
|
};
|
|
1920
1919
|
FieldDescriptor.prototype.getValue = function () {
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
return (_a = this._fieldValue) !== null && _a !== void 0 ? _a : false;
|
|
1925
|
-
break;
|
|
1926
|
-
case this._formConfig.fieldTypes.check:
|
|
1927
|
-
return (_b = this._fieldValue) !== null && _b !== void 0 ? _b : false;
|
|
1928
|
-
break;
|
|
1929
|
-
case this._formConfig.fieldTypes.currency:
|
|
1930
|
-
return (typeof this._fieldValue === 'string')
|
|
1931
|
-
? this._fieldValue.replace(',', '') : this._fieldValue;
|
|
1932
|
-
break;
|
|
1933
|
-
default:
|
|
1934
|
-
return this._fieldValue;
|
|
1935
|
-
break;
|
|
1920
|
+
if (this.fieldType === this._formConfig.fieldTypes.boolean
|
|
1921
|
+
|| this.fieldType === this._formConfig.fieldTypes.check) {
|
|
1922
|
+
return !!this._value;
|
|
1936
1923
|
}
|
|
1924
|
+
return this._value;
|
|
1937
1925
|
};
|
|
1938
1926
|
FieldDescriptor.prototype.updateFromServer = function (fld) {
|
|
1939
1927
|
var _a;
|
|
@@ -2012,14 +2000,14 @@
|
|
|
2012
2000
|
if (this.fieldType === this._formConfig.fieldTypes.array && this.widget) {
|
|
2013
2001
|
return (_a = this.widget) === null || _a === void 0 ? void 0 : _a.refereshContent();
|
|
2014
2002
|
}
|
|
2015
|
-
if (this.
|
|
2016
|
-
if (this.fieldType === this._formConfig.fieldTypes.array && Array.isArray(this.
|
|
2017
|
-
var fieldValue = (_b = this.
|
|
2003
|
+
if (this._value) {
|
|
2004
|
+
if (this.fieldType === this._formConfig.fieldTypes.array && Array.isArray(this._value)) {
|
|
2005
|
+
var fieldValue = (_b = this._value) === null || _b === void 0 ? void 0 : _b.filter(function (item) { return _this.fieldOptions.find(function (opt) { return opt.fieldOptionId === item; }); });
|
|
2018
2006
|
this.setAttr(fldAttr.value, fieldValue);
|
|
2019
2007
|
}
|
|
2020
2008
|
else {
|
|
2021
2009
|
var valInOptions = this.fieldOptions
|
|
2022
|
-
.find(function (item) { return item.fieldOptionId === _this.
|
|
2010
|
+
.find(function (item) { return item.fieldOptionId === _this._value; });
|
|
2023
2011
|
if (!valInOptions) {
|
|
2024
2012
|
this.setValue('');
|
|
2025
2013
|
}
|
|
@@ -2075,7 +2063,7 @@
|
|
|
2075
2063
|
newFinalValue = newValue;
|
|
2076
2064
|
break;
|
|
2077
2065
|
}
|
|
2078
|
-
if (this.
|
|
2066
|
+
if (this._value !== newFinalValue) {
|
|
2079
2067
|
this.setChanged(true);
|
|
2080
2068
|
this.setAttr(fldAttr.value, newFinalValue);
|
|
2081
2069
|
}
|