myrta-ui 1.1.24 → 1.1.26
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/components/form/formula-editor/formula-editor.component.mjs +3 -1
- package/esm2020/lib/services/mrx-form-validator/models/validations-options.model.mjs +1 -1
- package/esm2020/lib/services/mrx-form-validator/mrx-form-validator.mjs +13 -33
- package/esm2020/lib/services/mrx-form-validator/validations/max-value.validation.mjs +2 -2
- package/esm2020/lib/services/mrx-form-validator/validations/min-value.validation.mjs +2 -2
- package/fesm2015/myrta-ui.mjs +15 -33
- package/fesm2015/myrta-ui.mjs.map +1 -1
- package/fesm2020/myrta-ui.mjs +15 -33
- package/fesm2020/myrta-ui.mjs.map +1 -1
- package/lib/services/mrx-form-validator/models/validations-options.model.d.ts +3 -0
- package/lib/services/mrx-form-validator/mrx-form-validator.d.ts +4 -3
- package/lib/services/mrx-form-validator/validations/max-value.validation.d.ts +1 -2
- package/lib/services/mrx-form-validator/validations/min-value.validation.d.ts +1 -2
- package/package.json +1 -1
package/fesm2020/myrta-ui.mjs
CHANGED
|
@@ -4315,7 +4315,7 @@ const minLengthValidation = (value, validations, key, invalidMessages) => {
|
|
|
4315
4315
|
|
|
4316
4316
|
const minValueValidation = (value, validations, key, invalidMessages) => {
|
|
4317
4317
|
const result = { isValid: true, message: null };
|
|
4318
|
-
if (parseInt(value)
|
|
4318
|
+
if (parseInt(value) < Number(validations[key])) {
|
|
4319
4319
|
result.message = getErrorMessageHelper(key, invalidMessages, validations.messages, Number(validations[key]));
|
|
4320
4320
|
result.isValid = false;
|
|
4321
4321
|
}
|
|
@@ -4324,7 +4324,7 @@ const minValueValidation = (value, validations, key, invalidMessages) => {
|
|
|
4324
4324
|
|
|
4325
4325
|
const maxValueValidation = (value, validations, key, invalidMessages) => {
|
|
4326
4326
|
const result = { isValid: true, message: null };
|
|
4327
|
-
if (parseInt(value)
|
|
4327
|
+
if (parseInt(value) > Number(validations[key])) {
|
|
4328
4328
|
result.message = getErrorMessageHelper(key, invalidMessages, validations.messages, Number(validations[key]));
|
|
4329
4329
|
result.isValid = false;
|
|
4330
4330
|
}
|
|
@@ -4426,9 +4426,6 @@ class MrxFormValidator {
|
|
|
4426
4426
|
if (!validateEmptyValue && (value.length === 0)) {
|
|
4427
4427
|
return;
|
|
4428
4428
|
}
|
|
4429
|
-
if (!this._isValid) {
|
|
4430
|
-
return;
|
|
4431
|
-
}
|
|
4432
4429
|
for (let key in validations) {
|
|
4433
4430
|
switch (key) {
|
|
4434
4431
|
case ValidationTypesEnum.Required:
|
|
@@ -4437,9 +4434,6 @@ class MrxFormValidator {
|
|
|
4437
4434
|
if (!silent && !this._errors[name]) {
|
|
4438
4435
|
this._errors[name] = requiredRes.message;
|
|
4439
4436
|
}
|
|
4440
|
-
if (!this._isValid) {
|
|
4441
|
-
return;
|
|
4442
|
-
}
|
|
4443
4437
|
break;
|
|
4444
4438
|
case ValidationTypesEnum.Email:
|
|
4445
4439
|
const emailRes = emailValidation(value, validations, key, this._invalidMessages);
|
|
@@ -4447,9 +4441,6 @@ class MrxFormValidator {
|
|
|
4447
4441
|
if (!silent && !this._errors[name]) {
|
|
4448
4442
|
this._errors[name] = emailRes.message;
|
|
4449
4443
|
}
|
|
4450
|
-
if (!this._isValid) {
|
|
4451
|
-
return;
|
|
4452
|
-
}
|
|
4453
4444
|
break;
|
|
4454
4445
|
case ValidationTypesEnum.Pattern:
|
|
4455
4446
|
const patternRes = patternValidation(value, validations, key, this._invalidMessages);
|
|
@@ -4457,9 +4448,6 @@ class MrxFormValidator {
|
|
|
4457
4448
|
if (!silent && !this._errors[name]) {
|
|
4458
4449
|
this._errors[name] = patternRes.message;
|
|
4459
4450
|
}
|
|
4460
|
-
if (!this._isValid) {
|
|
4461
|
-
return;
|
|
4462
|
-
}
|
|
4463
4451
|
break;
|
|
4464
4452
|
case ValidationTypesEnum.MinLength:
|
|
4465
4453
|
const minLengthRes = minLengthValidation(value, validations, key, this._invalidMessages);
|
|
@@ -4467,9 +4455,6 @@ class MrxFormValidator {
|
|
|
4467
4455
|
if (!silent && !this._errors[name]) {
|
|
4468
4456
|
this._errors[name] = minLengthRes.message;
|
|
4469
4457
|
}
|
|
4470
|
-
if (!this._isValid) {
|
|
4471
|
-
return;
|
|
4472
|
-
}
|
|
4473
4458
|
break;
|
|
4474
4459
|
case ValidationTypesEnum.MaxLength:
|
|
4475
4460
|
const maxLengthRes = maxLengthValidation(value, validations, key, this._invalidMessages);
|
|
@@ -4477,9 +4462,6 @@ class MrxFormValidator {
|
|
|
4477
4462
|
if (!silent && !this._errors[name]) {
|
|
4478
4463
|
this._errors[name] = maxLengthRes.message;
|
|
4479
4464
|
}
|
|
4480
|
-
if (!this._isValid) {
|
|
4481
|
-
return;
|
|
4482
|
-
}
|
|
4483
4465
|
break;
|
|
4484
4466
|
case ValidationTypesEnum.MinValue:
|
|
4485
4467
|
const minValueRes = minValueValidation(value, validations, key, this._invalidMessages);
|
|
@@ -4487,9 +4469,6 @@ class MrxFormValidator {
|
|
|
4487
4469
|
if (!silent && !this._errors[name]) {
|
|
4488
4470
|
this._errors[name] = minValueRes.message;
|
|
4489
4471
|
}
|
|
4490
|
-
if (!this._isValid) {
|
|
4491
|
-
return;
|
|
4492
|
-
}
|
|
4493
4472
|
break;
|
|
4494
4473
|
case ValidationTypesEnum.MaxValue:
|
|
4495
4474
|
const maxValueRes = maxValueValidation(value, validations, key, this._invalidMessages);
|
|
@@ -4497,9 +4476,6 @@ class MrxFormValidator {
|
|
|
4497
4476
|
if (!silent && !this._errors[name]) {
|
|
4498
4477
|
this._errors[name] = maxValueRes.message;
|
|
4499
4478
|
}
|
|
4500
|
-
if (!this._isValid) {
|
|
4501
|
-
return;
|
|
4502
|
-
}
|
|
4503
4479
|
break;
|
|
4504
4480
|
case ValidationTypesEnum.Callback:
|
|
4505
4481
|
const callbackRes = callbackValidation(value, validations, key, this._invalidMessages);
|
|
@@ -4507,13 +4483,20 @@ class MrxFormValidator {
|
|
|
4507
4483
|
if (!silent && !this._errors[name]) {
|
|
4508
4484
|
this._errors[name] = callbackRes.message;
|
|
4509
4485
|
}
|
|
4510
|
-
if (!this._isValid) {
|
|
4511
|
-
return;
|
|
4512
|
-
}
|
|
4513
4486
|
break;
|
|
4514
4487
|
}
|
|
4515
4488
|
}
|
|
4516
4489
|
}
|
|
4490
|
+
_checkErrors(errors) {
|
|
4491
|
+
let isValid = true;
|
|
4492
|
+
for (let error in errors) {
|
|
4493
|
+
if (!!errors[error]) {
|
|
4494
|
+
isValid = !errors[error];
|
|
4495
|
+
break;
|
|
4496
|
+
}
|
|
4497
|
+
}
|
|
4498
|
+
return isValid;
|
|
4499
|
+
}
|
|
4517
4500
|
initFields(fields, validations) {
|
|
4518
4501
|
this.fields = cloneDeep(fields);
|
|
4519
4502
|
this._validations = validations;
|
|
@@ -4549,13 +4532,10 @@ class MrxFormValidator {
|
|
|
4549
4532
|
}
|
|
4550
4533
|
isValid() {
|
|
4551
4534
|
for (let key in this._validations) {
|
|
4552
|
-
if (!this._isValid) {
|
|
4553
|
-
return this._isValid;
|
|
4554
|
-
}
|
|
4555
4535
|
this.errors[key] = null;
|
|
4556
4536
|
this.validateField(this._fields[key], key, this._validations[key], true);
|
|
4557
4537
|
}
|
|
4558
|
-
return this.
|
|
4538
|
+
return this._checkErrors(this.errors);
|
|
4559
4539
|
}
|
|
4560
4540
|
// TODO Вырезать в будущем
|
|
4561
4541
|
initModelChangedFromField(field, fieldName) {
|
|
@@ -17495,6 +17475,7 @@ class FormulaEditorComponent {
|
|
|
17495
17475
|
if (outsideValue !== null) {
|
|
17496
17476
|
this.value = outsideValue;
|
|
17497
17477
|
this.visibleValue = this._transformValue(this._modifiedValue(outsideValue)).visibleValue;
|
|
17478
|
+
this._detector.detectChanges();
|
|
17498
17479
|
}
|
|
17499
17480
|
}
|
|
17500
17481
|
onInput(event) {
|
|
@@ -17525,6 +17506,7 @@ class FormulaEditorComponent {
|
|
|
17525
17506
|
updateVisibleValue(insideValue) {
|
|
17526
17507
|
this.visibleValue = insideValue;
|
|
17527
17508
|
this._storeCursorPosition();
|
|
17509
|
+
this._detector.detectChanges();
|
|
17528
17510
|
}
|
|
17529
17511
|
updateValue(insideValue) {
|
|
17530
17512
|
this.value = insideValue;
|