tuain-ng-forms-lib 15.0.15 → 15.0.18
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/esm2020/lib/classes/forms/field.mjs +4 -4
- package/esm2020/lib/components/elements/field.component.mjs +3 -7
- package/esm2020/lib/components/forms/basic-form.mjs +4 -1
- package/fesm2015/tuain-ng-forms-lib.mjs +19 -22
- package/fesm2015/tuain-ng-forms-lib.mjs.map +1 -1
- package/fesm2020/tuain-ng-forms-lib.mjs +8 -9
- package/fesm2020/tuain-ng-forms-lib.mjs.map +1 -1
- package/lib/classes/forms/field.d.ts +1 -0
- package/package.json +1 -1
|
@@ -177,18 +177,12 @@ class FieldComponent extends ElementComponent {
|
|
|
177
177
|
}
|
|
178
178
|
return true;
|
|
179
179
|
}
|
|
180
|
-
updateValue() {
|
|
181
|
-
var _a;
|
|
182
|
-
this.value = (_a = this.field) === null || _a === void 0 ? void 0 : _a.value;
|
|
183
|
-
}
|
|
180
|
+
updateValue() { var _a; this.value = (_a = this.field) === null || _a === void 0 ? void 0 : _a.value; }
|
|
184
181
|
onInputChange() { setTimeout(() => { var _a; return (_a = this.field) === null || _a === void 0 ? void 0 : _a.notifyEditionPartial(); }, 50); }
|
|
185
182
|
onChangeContent() { setTimeout(() => { var _a; return (_a = this.field) === null || _a === void 0 ? void 0 : _a.notifyEditionFinish(); }, 50); }
|
|
186
183
|
onShowInfo(detail = null) { setTimeout(() => { var _a; return (_a = this.field) === null || _a === void 0 ? void 0 : _a.notifyEditionDetailRequest(detail); }, 50); }
|
|
187
184
|
focus() { }
|
|
188
|
-
updateObject(widgetUpdate = true) {
|
|
189
|
-
var _a;
|
|
190
|
-
(_a = this.field) === null || _a === void 0 ? void 0 : _a.setValue(this.value, widgetUpdate);
|
|
191
|
-
}
|
|
185
|
+
updateObject(widgetUpdate = true) { var _a; (_a = this.field) === null || _a === void 0 ? void 0 : _a.setValue(this.value, widgetUpdate); }
|
|
192
186
|
inputChanged() {
|
|
193
187
|
var _a;
|
|
194
188
|
(_a = this.field) === null || _a === void 0 ? void 0 : _a.setValue(this.value);
|
|
@@ -825,7 +819,7 @@ const attrs$1 = {
|
|
|
825
819
|
};
|
|
826
820
|
class FieldDescriptor extends FormElement {
|
|
827
821
|
constructor(inputFieldReceived, formConfig) {
|
|
828
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
822
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
829
823
|
super(inputFieldReceived, formConfig);
|
|
830
824
|
this._editionFinish = new Subject();
|
|
831
825
|
this._editionPartial = new Subject();
|
|
@@ -854,14 +848,16 @@ class FieldDescriptor extends FormElement {
|
|
|
854
848
|
this._tooltipText = '';
|
|
855
849
|
this.fieldCode = '';
|
|
856
850
|
this.fieldOptions = null;
|
|
851
|
+
this.placeholder = '';
|
|
857
852
|
this.propagationCustomAttributes = (_c = (_b = (_a = this._formConfig) === null || _a === void 0 ? void 0 : _a.propagationCustomAttributes) === null || _b === void 0 ? void 0 : _b.fields) !== null && _c !== void 0 ? _c : [];
|
|
858
853
|
this.elementType = elementTypes.field;
|
|
859
854
|
const fld = (inputFieldReceived) ? inputFieldReceived : {};
|
|
860
855
|
this.setAttr(attrs$1.fieldCode, fld.fieldCode);
|
|
861
856
|
this.title = (_d = fld.fieldTitle) !== null && _d !== void 0 ? _d : this.fieldCode;
|
|
857
|
+
this.placeholder = (_e = fld.placeholder) !== null && _e !== void 0 ? _e : this.title;
|
|
862
858
|
this.type = fld.fieldTypeCode;
|
|
863
|
-
this.captureType = (
|
|
864
|
-
const defaultValue = (
|
|
859
|
+
this.captureType = (_f = fld.captureType) !== null && _f !== void 0 ? _f : DEFAULT_CAPTURE_TYPE;
|
|
860
|
+
const defaultValue = (_g = fld.defaultValue) !== null && _g !== void 0 ? _g : null;
|
|
865
861
|
if (this._fieldType === this._formConfig.fieldTypes.boolean) {
|
|
866
862
|
this.defaultValue = defaultValue !== null && defaultValue !== void 0 ? defaultValue : false;
|
|
867
863
|
}
|
|
@@ -881,19 +877,19 @@ class FieldDescriptor extends FormElement {
|
|
|
881
877
|
fieldFormat = null;
|
|
882
878
|
}
|
|
883
879
|
this.format = fieldFormat;
|
|
884
|
-
this.validateOnServer = (
|
|
880
|
+
this.validateOnServer = (_h = fld.serverAction) !== null && _h !== void 0 ? _h : false;
|
|
885
881
|
this.tooltip = fld.tooltip || '';
|
|
886
882
|
this.defaultEditable = this.enabled;
|
|
887
|
-
this.required = (
|
|
888
|
-
this.outputOnly = (
|
|
883
|
+
this.required = (_j = fld.required) !== null && _j !== void 0 ? _j : false;
|
|
884
|
+
this.outputOnly = (_k = fld.outputOnly) !== null && _k !== void 0 ? _k : false;
|
|
889
885
|
this.maxLength = fld.maxLength || (this._captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
|
|
890
|
-
this.intrinsicErrorMessage = (
|
|
891
|
-
this.setError(fld.errorCode, fld.errorMessage, (
|
|
892
|
-
this.setEditable((
|
|
893
|
-
this.visibleLabel = (
|
|
886
|
+
this.intrinsicErrorMessage = (_t = (_p = (_o = (_m = (_l = this._formConfig) === null || _l === void 0 ? void 0 : _l.fieldValidations) === null || _m === void 0 ? void 0 : _m[this._fieldType]) === null || _o === void 0 ? void 0 : _o.message) !== null && _p !== void 0 ? _p : (_s = (_r = (_q = this._formConfig) === null || _q === void 0 ? void 0 : _q.fieldValidations) === null || _r === void 0 ? void 0 : _r.DEFAULT) === null || _s === void 0 ? void 0 : _s.message) !== null && _t !== void 0 ? _t : '';
|
|
887
|
+
this.setError(fld.errorCode, fld.errorMessage, (_u = fld.errorType) !== null && _u !== void 0 ? _u : DEFAULT_ERROR_TYPE);
|
|
888
|
+
this.setEditable((_v = fld.editable) !== null && _v !== void 0 ? _v : true);
|
|
889
|
+
this.visibleLabel = (_w = fld.visibleLabel) !== null && _w !== void 0 ? _w : true;
|
|
894
890
|
this.setVisibility(fld.visible);
|
|
895
891
|
this.options = fld.fieldOptions;
|
|
896
|
-
this._setValue((
|
|
892
|
+
this._setValue((_y = (_x = fld.fieldValue) !== null && _x !== void 0 ? _x : this._defaultValue) !== null && _y !== void 0 ? _y : '');
|
|
897
893
|
}
|
|
898
894
|
get alignment() { return this._fieldAlignment; }
|
|
899
895
|
set alignment(alignment) { this.setAttr(attrs$1._fieldAlignment, alignment); }
|
|
@@ -1028,9 +1024,7 @@ class FieldDescriptor extends FormElement {
|
|
|
1028
1024
|
set validateOnServer(validateOnServer) { this.setAttr(attrs$1._validateOnServer, validateOnServer); }
|
|
1029
1025
|
get serverAction() { return this._validateOnServer; }
|
|
1030
1026
|
set serverAction(validateOnServer) { this.validateOnServer = validateOnServer; }
|
|
1031
|
-
set value(newValue) {
|
|
1032
|
-
this._setValue(newValue);
|
|
1033
|
-
}
|
|
1027
|
+
set value(newValue) { this._setValue(newValue); }
|
|
1034
1028
|
get visibleLabel() { return this._visibleLabel; }
|
|
1035
1029
|
set visibleLabel(visibleLabel) { this.setAttr(attrs$1._visibleLabel, visibleLabel); }
|
|
1036
1030
|
/**
|
|
@@ -3269,6 +3263,9 @@ class BasicFormComponent extends FormStructureAndData {
|
|
|
3269
3263
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3270
3264
|
const action = (typeof actionInput === 'string')
|
|
3271
3265
|
? this.getAction(actionInput) : actionInput;
|
|
3266
|
+
if (!action) {
|
|
3267
|
+
return;
|
|
3268
|
+
}
|
|
3272
3269
|
let serverError = false;
|
|
3273
3270
|
let actionResult = null;
|
|
3274
3271
|
if (action.backend) {
|