@smartbit4all/ng-client 3.4.0 → 3.4.1

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.
@@ -3965,6 +3965,7 @@ class NamedValidatorService {
3965
3965
  // TODO: this looks horrific, refactor!
3966
3966
  applyBuiltInValidators(w, c) {
3967
3967
  if (c.max) {
3968
+ w.validators = w.validators.filter((it) => it.name !== VALIDATOR_NAME_MAX);
3968
3969
  if (c.max > 0) {
3969
3970
  w.validators.push({
3970
3971
  name: VALIDATOR_NAME_MAX,
@@ -3973,11 +3974,9 @@ class NamedValidatorService {
3973
3974
  errorMessage: '',
3974
3975
  });
3975
3976
  }
3976
- else {
3977
- w.validators = w.validators.filter((it) => it.name !== VALIDATOR_NAME_MAX);
3978
- }
3979
3977
  }
3980
3978
  if (c.min) {
3979
+ w.validators = w.validators.filter((it) => it.name !== VALIDATOR_NAME_MIN);
3981
3980
  if (c.min > 0) {
3982
3981
  w.validators.push({
3983
3982
  name: VALIDATOR_NAME_MIN,
@@ -3986,11 +3985,9 @@ class NamedValidatorService {
3986
3985
  errorMessage: '',
3987
3986
  });
3988
3987
  }
3989
- else {
3990
- w.validators = w.validators.filter((it) => it.name !== VALIDATOR_NAME_MIN);
3991
- }
3992
3988
  }
3993
3989
  if (c.maxLength) {
3990
+ w.validators = w.validators.filter((it) => it.name !== VALIDATOR_NAME_MAX_LEN);
3994
3991
  if (c.maxLength > 0) {
3995
3992
  w.validators.push({
3996
3993
  name: VALIDATOR_NAME_MAX_LEN,
@@ -3999,11 +3996,9 @@ class NamedValidatorService {
3999
3996
  errorMessage: '',
4000
3997
  });
4001
3998
  }
4002
- else {
4003
- w.validators = w.validators.filter((it) => it.name !== VALIDATOR_NAME_MAX_LEN);
4004
- }
4005
3999
  }
4006
4000
  if (c.minLength) {
4001
+ w.validators = w.validators.filter((it) => it.name !== VALIDATOR_NAME_MIN_LEN);
4007
4002
  if (c.minLength > 0) {
4008
4003
  w.validators.push({
4009
4004
  name: VALIDATOR_NAME_MIN_LEN,
@@ -4012,9 +4007,6 @@ class NamedValidatorService {
4012
4007
  errorMessage: '',
4013
4008
  });
4014
4009
  }
4015
- else {
4016
- w.validators = w.validators.filter((it) => it.name !== VALIDATOR_NAME_MIN_LEN);
4017
- }
4018
4010
  }
4019
4011
  }
4020
4012
  applyNamedValidators(w, namedValidators) {
@@ -4030,6 +4022,7 @@ class NamedValidatorService {
4030
4022
  }
4031
4023
  switch (namedValidator.operation) {
4032
4024
  case NamedValidatorOperationEnum.ADD:
4025
+ w.validators = w.validators.filter((it) => it.name !== namedValidator.name);
4033
4026
  const validatorFn = validatorFactory.create(namedValidator.params);
4034
4027
  w.validators.push({
4035
4028
  name: namedValidator.name,
@@ -4539,7 +4532,7 @@ class SmartFormService {
4539
4532
  else {
4540
4533
  widget.validators = validators;
4541
4534
  }
4542
- if (constraint.enabled === undefined) {
4535
+ if (constraint.enabled === undefined || constraint.enabled === null) {
4543
4536
  if (widget.isDisabled === undefined) {
4544
4537
  widget.isDisabled = false;
4545
4538
  }
@@ -4547,8 +4540,8 @@ class SmartFormService {
4547
4540
  else {
4548
4541
  widget.isDisabled = !constraint.enabled;
4549
4542
  }
4543
+ this.validatorProvider?.applyConstraint(widget, constraint);
4550
4544
  }
4551
- this.validatorProvider?.applyConstraint(widget, constraint);
4552
4545
  });
4553
4546
  }
4554
4547
  if (widget.type === SmartFormWidgetType.CONTAINER &&