tuain-ng-forms-lib 15.0.21 → 15.0.23
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 +5 -2
- package/esm2020/lib/components/elements/field.component.mjs +1 -1
- package/esm2020/lib/components/forms/basic-form.mjs +1 -14
- package/fesm2015/tuain-ng-forms-lib.mjs +10 -20
- package/fesm2015/tuain-ng-forms-lib.mjs.map +1 -1
- package/fesm2020/tuain-ng-forms-lib.mjs +4 -14
- package/fesm2020/tuain-ng-forms-lib.mjs.map +1 -1
- package/lib/components/elements/field.component.d.ts +1 -0
- package/package.json +1 -1
|
@@ -819,7 +819,7 @@ const attrs$1 = {
|
|
|
819
819
|
};
|
|
820
820
|
class FieldDescriptor extends FormElement {
|
|
821
821
|
constructor(inputFieldReceived, formConfig) {
|
|
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;
|
|
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, _z;
|
|
823
823
|
super(inputFieldReceived, formConfig);
|
|
824
824
|
this._editionFinish = new Subject();
|
|
825
825
|
this._editionPartial = new Subject();
|
|
@@ -882,14 +882,15 @@ class FieldDescriptor extends FormElement {
|
|
|
882
882
|
this.defaultEditable = this.enabled;
|
|
883
883
|
this.required = (_j = fld.required) !== null && _j !== void 0 ? _j : false;
|
|
884
884
|
this.outputOnly = (_k = fld.outputOnly) !== null && _k !== void 0 ? _k : false;
|
|
885
|
+
this.minLength = (_l = fld.minLength) !== null && _l !== void 0 ? _l : 0;
|
|
885
886
|
this.maxLength = fld.maxLength || (this._captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
|
|
886
|
-
this.intrinsicErrorMessage = (
|
|
887
|
-
this.setError(fld.errorCode, fld.errorMessage, (
|
|
888
|
-
this.setEditable((
|
|
889
|
-
this.visibleLabel = (
|
|
887
|
+
this.intrinsicErrorMessage = (_u = (_q = (_p = (_o = (_m = this._formConfig) === null || _m === void 0 ? void 0 : _m.fieldValidations) === null || _o === void 0 ? void 0 : _o[this._fieldType]) === null || _p === void 0 ? void 0 : _p.message) !== null && _q !== void 0 ? _q : (_t = (_s = (_r = this._formConfig) === null || _r === void 0 ? void 0 : _r.fieldValidations) === null || _s === void 0 ? void 0 : _s.DEFAULT) === null || _t === void 0 ? void 0 : _t.message) !== null && _u !== void 0 ? _u : '';
|
|
888
|
+
this.setError(fld.errorCode, fld.errorMessage, (_v = fld.errorType) !== null && _v !== void 0 ? _v : DEFAULT_ERROR_TYPE);
|
|
889
|
+
this.setEditable((_w = fld.editable) !== null && _w !== void 0 ? _w : true);
|
|
890
|
+
this.visibleLabel = (_x = fld.visibleLabel) !== null && _x !== void 0 ? _x : true;
|
|
890
891
|
this.setVisibility(fld.visible);
|
|
891
892
|
this.options = fld.fieldOptions;
|
|
892
|
-
this._setValue((
|
|
893
|
+
this._setValue((_z = (_y = fld.fieldValue) !== null && _y !== void 0 ? _y : this._defaultValue) !== null && _z !== void 0 ? _z : '');
|
|
893
894
|
}
|
|
894
895
|
get alignment() { return this._fieldAlignment; }
|
|
895
896
|
set alignment(alignment) { this.setAttr(attrs$1._fieldAlignment, alignment); }
|
|
@@ -952,7 +953,9 @@ class FieldDescriptor extends FormElement {
|
|
|
952
953
|
this.setAttr(attrs$1._maxValue, maxValue);
|
|
953
954
|
}
|
|
954
955
|
get minLength() { return this._minLength; }
|
|
955
|
-
set minLength(requiredMinLength) {
|
|
956
|
+
set minLength(requiredMinLength) {
|
|
957
|
+
this.setAttr(attrs$1._minLength, requiredMinLength ? +requiredMinLength : null);
|
|
958
|
+
}
|
|
956
959
|
get minValue() { return this._minValue; }
|
|
957
960
|
set minValue(inputMinValue) {
|
|
958
961
|
let minValue = inputMinValue;
|
|
@@ -3357,9 +3360,6 @@ class BasicFormComponent extends FormStructureAndData {
|
|
|
3357
3360
|
}
|
|
3358
3361
|
startFieldValidation(code, intrinsicValidation = true) {
|
|
3359
3362
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3360
|
-
console.log('startFieldValidation');
|
|
3361
|
-
console.log(code);
|
|
3362
|
-
console.log(intrinsicValidation);
|
|
3363
3363
|
this.notifyFormActivity();
|
|
3364
3364
|
const fieldToValidate = this.getField(code);
|
|
3365
3365
|
if (!fieldToValidate) {
|
|
@@ -3371,24 +3371,14 @@ class BasicFormComponent extends FormStructureAndData {
|
|
|
3371
3371
|
for (const validationMethod of validationCallbacks) {
|
|
3372
3372
|
const { callback, properties } = validationMethod;
|
|
3373
3373
|
const clientValidationPromise = callback(fieldToValidate);
|
|
3374
|
-
console.log('validationMethod');
|
|
3375
|
-
console.log({ callback, properties });
|
|
3376
3374
|
clientValidationPromises.push(clientValidationPromise);
|
|
3377
3375
|
}
|
|
3378
|
-
console.log('clientValidationPromises');
|
|
3379
|
-
console.log(clientValidationPromises);
|
|
3380
3376
|
const clientValidationResults = yield Promise.all(clientValidationPromises);
|
|
3381
|
-
console.log('clientValidationResults');
|
|
3382
|
-
console.log(clientValidationResults);
|
|
3383
3377
|
const continueValidation = clientValidationResults.reduce((total, curr) => (total && (curr !== false)), true);
|
|
3384
|
-
console.log('continueValidation');
|
|
3385
|
-
console.log(continueValidation);
|
|
3386
3378
|
if (!continueValidation) {
|
|
3387
3379
|
return;
|
|
3388
3380
|
}
|
|
3389
3381
|
}
|
|
3390
|
-
console.log('intrinsicValidation');
|
|
3391
|
-
console.log(intrinsicValidation);
|
|
3392
3382
|
if (intrinsicValidation) {
|
|
3393
3383
|
this.startServerFieldValidation(fieldToValidate);
|
|
3394
3384
|
}
|