tuain-ng-forms-lib 12.0.37 → 12.0.42
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 +53 -102
- package/bundles/tuain-ng-forms-lib.umd.js.map +1 -1
- package/esm2015/lib/classes/forms/element.js +1 -2
- package/esm2015/lib/classes/forms/field.js +15 -1
- package/esm2015/lib/classes/forms/form.js +2 -1
- package/esm2015/lib/classes/forms/table/table.js +2 -2
- package/esm2015/lib/components/elements/field.component.js +10 -5
- package/esm2015/lib/components/elements/tables/table.component.js +1 -2
- package/esm2015/lib/components/forms/basic-form.js +27 -95
- package/fesm2015/tuain-ng-forms-lib.js +51 -101
- package/fesm2015/tuain-ng-forms-lib.js.map +1 -1
- package/lib/classes/forms/element.d.ts +0 -1
- package/lib/classes/forms/field.d.ts +6 -3
- package/lib/classes/forms/form.d.ts +1 -0
- package/lib/classes/forms/table/table.d.ts +4 -4
- package/lib/components/elements/field.component.d.ts +2 -0
- package/lib/components/forms/basic-form.d.ts +1 -0
- package/package.json +1 -1
- package/tuain-ng-forms-lib.metadata.json +1 -1
|
@@ -388,23 +388,25 @@
|
|
|
388
388
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
var VALUE = '';
|
|
391
|
+
var VALUE = 'value';
|
|
392
|
+
var FOCUS = 'focus';
|
|
392
393
|
var FieldComponent = /** @class */ (function () {
|
|
393
394
|
function FieldComponent() {
|
|
394
395
|
}
|
|
395
396
|
FieldComponent.prototype.ngOnInit = function () {
|
|
396
397
|
var _this = this;
|
|
397
|
-
var _a, _b
|
|
398
|
+
var _a, _b;
|
|
398
399
|
if (this.field) {
|
|
399
400
|
this.formConfig = (_a = this.field) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
400
401
|
// Inicialización
|
|
401
402
|
var mapping = Object.entries(this.formConfig.componentFieldAttrMap);
|
|
402
403
|
for (var index = 0; index < mapping.length; index++) {
|
|
403
|
-
var
|
|
404
|
+
var _c = __read(mapping[index], 2), fieldAttr1 = _c[0], compAttr1 = _c[1];
|
|
404
405
|
var compAttr = compAttr1.toString();
|
|
405
406
|
var fieldAttr = fieldAttr1.toString();
|
|
406
|
-
|
|
407
|
-
this.
|
|
407
|
+
var attributeValue = (_b = this.field) === null || _b === void 0 ? void 0 : _b[fieldAttr];
|
|
408
|
+
this.dafaultProcessFieldChange(compAttr, attributeValue);
|
|
409
|
+
this.processFieldChange(compAttr, attributeValue);
|
|
408
410
|
}
|
|
409
411
|
// Subscripción a cambios en atributos
|
|
410
412
|
this.field.attributeChange.subscribe(function (event) {
|
|
@@ -420,6 +422,9 @@
|
|
|
420
422
|
if (attribute === VALUE) {
|
|
421
423
|
this.updateValue();
|
|
422
424
|
}
|
|
425
|
+
else if (attribute === FOCUS) {
|
|
426
|
+
this.focus();
|
|
427
|
+
}
|
|
423
428
|
else {
|
|
424
429
|
this[attribute] = value;
|
|
425
430
|
}
|
|
@@ -662,7 +667,6 @@
|
|
|
662
667
|
this._visibleForced = false;
|
|
663
668
|
this.disabled = (_a = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.disabled) !== null && _a !== void 0 ? _a : false;
|
|
664
669
|
this.setVisibility((_b = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.visible) !== null && _b !== void 0 ? _b : true);
|
|
665
|
-
this.widget = null;
|
|
666
670
|
this.customAttributes = (_c = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.customAttributes) !== null && _c !== void 0 ? _c : {};
|
|
667
671
|
}
|
|
668
672
|
FormElement.prototype.getCustomAttribute = function (name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; };
|
|
@@ -942,9 +946,9 @@
|
|
|
942
946
|
_this._selectionActionTrigger = new rxjs.Subject();
|
|
943
947
|
_this._getDataTrigger = new rxjs.Subject();
|
|
944
948
|
_this._attributeChange = new rxjs.Subject();
|
|
945
|
-
_this.tableRecordObj = {};
|
|
946
949
|
_this._tableColumnObj = {};
|
|
947
950
|
_this._actionsObj = {};
|
|
951
|
+
_this.tableRecordObj = {};
|
|
948
952
|
_this.allSelected = false;
|
|
949
953
|
_this.elementType = elementTypes.table;
|
|
950
954
|
_this.waiting = false;
|
|
@@ -1525,7 +1529,6 @@
|
|
|
1525
1529
|
this.tableFieldStyles = this.formConfig.tableFieldStyles;
|
|
1526
1530
|
this.selectable = this.table.selectable;
|
|
1527
1531
|
this.hasActions = this.table.hasActions;
|
|
1528
|
-
this.table.widget = this;
|
|
1529
1532
|
this.inlineActions = this.table.getActions(this.formConfig.tableActions.inline);
|
|
1530
1533
|
this.globalActions = this.table.getActions(this.formConfig.tableActions.global);
|
|
1531
1534
|
this.selectionActions = this.table.getActions(this.formConfig.tableActions.selection);
|
|
@@ -1702,6 +1705,7 @@
|
|
|
1702
1705
|
maxValue: '_maxValue',
|
|
1703
1706
|
maxLength: '_maxLength',
|
|
1704
1707
|
onValidation: '_onValidation',
|
|
1708
|
+
focus: 'focus',
|
|
1705
1709
|
intrinsicErrorMessage: '_intrinsicErrorMessage',
|
|
1706
1710
|
code: 'fieldCode',
|
|
1707
1711
|
info: 'fieldInfo',
|
|
@@ -1805,6 +1809,7 @@
|
|
|
1805
1809
|
enumerable: false,
|
|
1806
1810
|
configurable: true
|
|
1807
1811
|
});
|
|
1812
|
+
FieldDescriptor.prototype.focus = function () { this.setAttr(fldAttr.focus, true); };
|
|
1808
1813
|
FieldDescriptor.prototype.setIntrinsicErrorMessage = function (message) { this.setAttr(fldAttr.intrinsicErrorMessage, message); };
|
|
1809
1814
|
Object.defineProperty(FieldDescriptor.prototype, "intrinsicErrorMessage", {
|
|
1810
1815
|
set: function (message) { this.setIntrinsicErrorMessage(message); },
|
|
@@ -1859,6 +1864,14 @@
|
|
|
1859
1864
|
this.setError('99', this._intrinsicErrorMessage);
|
|
1860
1865
|
}
|
|
1861
1866
|
}
|
|
1867
|
+
if (intrinsicValidation && fieldValue && this._minValue && fieldValue < this._minValue) {
|
|
1868
|
+
intrinsicValidation = false;
|
|
1869
|
+
this.setError('99', 'Campo con valor inferior al mínimo');
|
|
1870
|
+
}
|
|
1871
|
+
if (intrinsicValidation && fieldValue && this._maxValue && fieldValue > this._maxValue) {
|
|
1872
|
+
intrinsicValidation = false;
|
|
1873
|
+
this.setError('99', 'Campo con valor superior al máximo');
|
|
1874
|
+
}
|
|
1862
1875
|
this._editionFinish.next({ code: this.fieldCode, intrinsicValidation: intrinsicValidation });
|
|
1863
1876
|
};
|
|
1864
1877
|
FieldDescriptor.prototype.setAttr = function (name, value) {
|
|
@@ -1929,6 +1942,11 @@
|
|
|
1929
1942
|
}
|
|
1930
1943
|
return this._value;
|
|
1931
1944
|
};
|
|
1945
|
+
FieldDescriptor.prototype.getOptionText = function () {
|
|
1946
|
+
var _this = this;
|
|
1947
|
+
var _a, _b;
|
|
1948
|
+
return (_b = (_a = this.fieldOptions.find(function (item) { return item.fieldOptionId === _this._value; })) === null || _a === void 0 ? void 0 : _a.fieldOptionValue) !== null && _b !== void 0 ? _b : null;
|
|
1949
|
+
};
|
|
1932
1950
|
FieldDescriptor.prototype.updateFromServer = function (fld) {
|
|
1933
1951
|
var _a;
|
|
1934
1952
|
var fieldKeys = Object.keys(fld);
|
|
@@ -2545,6 +2563,7 @@
|
|
|
2545
2563
|
FormStructureAndData.prototype.enableField = function (code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.enable(); };
|
|
2546
2564
|
FormStructureAndData.prototype.disableField = function (code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.disable(); };
|
|
2547
2565
|
FormStructureAndData.prototype.getFieldValue = function (code) { var _a; return (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.getValue(); };
|
|
2566
|
+
FormStructureAndData.prototype.getFieldOptionText = function (code) { var _a; return (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.getOptionText(); };
|
|
2548
2567
|
FormStructureAndData.prototype.getFieldOptions = function (code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.getFieldOptions(); };
|
|
2549
2568
|
FormStructureAndData.prototype.setFieldValue = function (code, value) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setValue(value); };
|
|
2550
2569
|
FormStructureAndData.prototype.setFieldError = function (code, message, type) {
|
|
@@ -3009,90 +3028,28 @@
|
|
|
3009
3028
|
this.cleanStart();
|
|
3010
3029
|
this.customPreProcessing();
|
|
3011
3030
|
}
|
|
3012
|
-
BasicFormComponent.prototype.getTitle = function () {
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
};
|
|
3016
|
-
BasicFormComponent.prototype.
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
};
|
|
3020
|
-
BasicFormComponent.prototype.
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
};
|
|
3024
|
-
BasicFormComponent.prototype.
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
};
|
|
3028
|
-
BasicFormComponent.prototype.
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
};
|
|
3032
|
-
BasicFormComponent.prototype.
|
|
3033
|
-
|
|
3034
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.changeState(state);
|
|
3035
|
-
};
|
|
3036
|
-
BasicFormComponent.prototype.getStates = function () {
|
|
3037
|
-
var _a;
|
|
3038
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.states;
|
|
3039
|
-
};
|
|
3040
|
-
BasicFormComponent.prototype.getImmutableElement = function (name) {
|
|
3041
|
-
var _a;
|
|
3042
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getImmutableElement(name);
|
|
3043
|
-
};
|
|
3044
|
-
BasicFormComponent.prototype.getExtraInfo = function (name) {
|
|
3045
|
-
var _a;
|
|
3046
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getExtraInfo(name);
|
|
3047
|
-
};
|
|
3048
|
-
BasicFormComponent.prototype.getFields = function () {
|
|
3049
|
-
var _a;
|
|
3050
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFields();
|
|
3051
|
-
};
|
|
3052
|
-
BasicFormComponent.prototype.getFieldNames = function () {
|
|
3053
|
-
var _a;
|
|
3054
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldNames();
|
|
3055
|
-
};
|
|
3056
|
-
BasicFormComponent.prototype.getField = function (code) {
|
|
3057
|
-
var _a;
|
|
3058
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getField(code);
|
|
3059
|
-
};
|
|
3060
|
-
BasicFormComponent.prototype.enableField = function (code) {
|
|
3061
|
-
var _a;
|
|
3062
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.enableField(code);
|
|
3063
|
-
};
|
|
3064
|
-
BasicFormComponent.prototype.disableField = function (code) {
|
|
3065
|
-
var _a;
|
|
3066
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.disableField(code);
|
|
3067
|
-
};
|
|
3068
|
-
BasicFormComponent.prototype.getFieldValue = function (code) {
|
|
3069
|
-
var _a;
|
|
3070
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldValue(code);
|
|
3071
|
-
};
|
|
3072
|
-
BasicFormComponent.prototype.getFieldsValues = function (codes) {
|
|
3073
|
-
var _a;
|
|
3074
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldsValues(codes);
|
|
3075
|
-
};
|
|
3076
|
-
BasicFormComponent.prototype.getFieldOptions = function (code) {
|
|
3077
|
-
var _a;
|
|
3078
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldOptions(code);
|
|
3079
|
-
};
|
|
3080
|
-
BasicFormComponent.prototype.setFieldValue = function (code, value) {
|
|
3081
|
-
var _a;
|
|
3082
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldValue(code, value);
|
|
3083
|
-
};
|
|
3084
|
-
BasicFormComponent.prototype.setFieldRequired = function (code, required) {
|
|
3085
|
-
var _a;
|
|
3086
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldRequired(code, required);
|
|
3087
|
-
};
|
|
3088
|
-
BasicFormComponent.prototype.setFieldErrorMessage = function (code, errorMessage) {
|
|
3089
|
-
var _a;
|
|
3090
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldErrorMessage(code, errorMessage);
|
|
3091
|
-
};
|
|
3092
|
-
BasicFormComponent.prototype.setFieldError = function (code, message, type) {
|
|
3093
|
-
var _a;
|
|
3094
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldError(code, message, type);
|
|
3095
|
-
};
|
|
3031
|
+
BasicFormComponent.prototype.getTitle = function () { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTitle(); };
|
|
3032
|
+
BasicFormComponent.prototype.setTitle = function (title) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setTitle(title); };
|
|
3033
|
+
BasicFormComponent.prototype.cleanData = function () { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.cleanData(); };
|
|
3034
|
+
BasicFormComponent.prototype.getCurrentState = function () { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getCurrentState(); };
|
|
3035
|
+
BasicFormComponent.prototype.supportState = function (state) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.supportState(state); };
|
|
3036
|
+
BasicFormComponent.prototype.changeState = function (state) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.changeState(state); };
|
|
3037
|
+
BasicFormComponent.prototype.getStates = function () { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.states; };
|
|
3038
|
+
BasicFormComponent.prototype.getImmutableElement = function (name) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getImmutableElement(name); };
|
|
3039
|
+
BasicFormComponent.prototype.getExtraInfo = function (name) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getExtraInfo(name); };
|
|
3040
|
+
BasicFormComponent.prototype.getFields = function () { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFields(); };
|
|
3041
|
+
BasicFormComponent.prototype.getFieldNames = function () { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldNames(); };
|
|
3042
|
+
BasicFormComponent.prototype.getField = function (code) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getField(code); };
|
|
3043
|
+
BasicFormComponent.prototype.enableField = function (code) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.enableField(code); };
|
|
3044
|
+
BasicFormComponent.prototype.disableField = function (code) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.disableField(code); };
|
|
3045
|
+
BasicFormComponent.prototype.getFieldValue = function (code) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldValue(code); };
|
|
3046
|
+
BasicFormComponent.prototype.getFieldOptionText = function (code) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldOptionText(code); };
|
|
3047
|
+
BasicFormComponent.prototype.getFieldsValues = function (codes) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldsValues(codes); };
|
|
3048
|
+
BasicFormComponent.prototype.getFieldOptions = function (code) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldOptions(code); };
|
|
3049
|
+
BasicFormComponent.prototype.setFieldValue = function (code, value) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldValue(code, value); };
|
|
3050
|
+
BasicFormComponent.prototype.setFieldRequired = function (code, required) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldRequired(code, required); };
|
|
3051
|
+
BasicFormComponent.prototype.setFieldErrorMessage = function (code, errorMessage) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldErrorMessage(code, errorMessage); };
|
|
3052
|
+
BasicFormComponent.prototype.setFieldError = function (code, message, type) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldError(code, message, type); };
|
|
3096
3053
|
BasicFormComponent.prototype.setFieldIntrinsicErrorMessage = function (code, message) {
|
|
3097
3054
|
var _a;
|
|
3098
3055
|
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldIntrinsicErrorMessage(code, message);
|
|
@@ -4895,11 +4852,8 @@
|
|
|
4895
4852
|
for (var requiredEmptyFields_1 = __values(requiredEmptyFields), requiredEmptyFields_1_1 = requiredEmptyFields_1.next(); !requiredEmptyFields_1_1.done; requiredEmptyFields_1_1 = requiredEmptyFields_1.next()) {
|
|
4896
4853
|
var fieldCode = requiredEmptyFields_1_1.value;
|
|
4897
4854
|
var requiredEmptyField = this.getField(fieldCode);
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
requiredEmptyField.widget.focus();
|
|
4901
|
-
break;
|
|
4902
|
-
}
|
|
4855
|
+
requiredEmptyField === null || requiredEmptyField === void 0 ? void 0 : requiredEmptyField.focus();
|
|
4856
|
+
break;
|
|
4903
4857
|
}
|
|
4904
4858
|
}
|
|
4905
4859
|
catch (e_21_1) { e_21 = { error: e_21_1 }; }
|
|
@@ -4918,11 +4872,8 @@
|
|
|
4918
4872
|
for (var validationIssueFields_1 = __values(validationIssueFields), validationIssueFields_1_1 = validationIssueFields_1.next(); !validationIssueFields_1_1.done; validationIssueFields_1_1 = validationIssueFields_1.next()) {
|
|
4919
4873
|
var fieldCode = validationIssueFields_1_1.value;
|
|
4920
4874
|
var validationIssueField = this.getField(fieldCode);
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
validationIssueField.widget.focus();
|
|
4924
|
-
break;
|
|
4925
|
-
}
|
|
4875
|
+
validationIssueField.focus();
|
|
4876
|
+
break;
|
|
4926
4877
|
}
|
|
4927
4878
|
}
|
|
4928
4879
|
catch (e_22_1) { e_22 = { error: e_22_1 }; }
|