@limetech/lime-elements 37.1.0-next.58 → 37.1.0-next.59

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.
@@ -24424,12 +24424,6 @@ class LimeElementsWidgetAdapter extends react.Component {
24424
24424
  modified: false,
24425
24425
  };
24426
24426
  this.handleBlur = this.handleBlur.bind(this);
24427
- this.initState();
24428
- }
24429
- initState() {
24430
- if (this.hasValue()) {
24431
- this.state.modified = true;
24432
- }
24433
24427
  }
24434
24428
  hasValue() {
24435
24429
  const value = this.getValue();
@@ -24454,10 +24448,7 @@ class LimeElementsWidgetAdapter extends react.Component {
24454
24448
  isInvalid() {
24455
24449
  const { modified } = this.state;
24456
24450
  const { rawErrors } = this.props.widgetProps;
24457
- if (!modified) {
24458
- return false;
24459
- }
24460
- return !!rawErrors;
24451
+ return (!!rawErrors && (modified || this.hasValue() || !this.isRequired()));
24461
24452
  }
24462
24453
  isRequired() {
24463
24454
  const { required, schema } = this.props.widgetProps;
@@ -29053,12 +29044,6 @@ class SchemaField extends react.Component {
29053
29044
  this.handleChange = this.handleChange.bind(this);
29054
29045
  this.handleCustomComponentChange =
29055
29046
  this.handleCustomComponentChange.bind(this);
29056
- this.initState();
29057
- }
29058
- initState() {
29059
- if (this.hasValue()) {
29060
- this.state.modified = true;
29061
- }
29062
29047
  }
29063
29048
  hasValue() {
29064
29049
  const value = this.getValue();
@@ -29080,10 +29065,8 @@ class SchemaField extends react.Component {
29080
29065
  isInvalid() {
29081
29066
  const { modified } = this.state;
29082
29067
  const { errorSchema } = this.props;
29083
- if (!modified) {
29084
- return false;
29085
- }
29086
- return !isEmpty$1(errorSchema);
29068
+ return ((modified || this.hasValue() || !this.isRequired()) &&
29069
+ !isEmpty$1(errorSchema));
29087
29070
  }
29088
29071
  isRequired() {
29089
29072
  const { required, schema } = this.props;