@rjsf/core 5.13.0 → 5.13.2

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/dist/index.js CHANGED
@@ -123,8 +123,20 @@ var ArrayField = class extends import_react.Component {
123
123
  if (event) {
124
124
  event.preventDefault();
125
125
  }
126
- const { onChange } = this.props;
126
+ const { onChange, errorSchema } = this.props;
127
127
  const { keyedFormData } = this.state;
128
+ let newErrorSchema;
129
+ if (errorSchema) {
130
+ newErrorSchema = {};
131
+ for (const idx in errorSchema) {
132
+ const i = parseInt(idx);
133
+ if (i <= index) {
134
+ (0, import_set.default)(newErrorSchema, [i], errorSchema[idx]);
135
+ } else if (i > index) {
136
+ (0, import_set.default)(newErrorSchema, [i + 1], errorSchema[idx]);
137
+ }
138
+ }
139
+ }
128
140
  const newKeyedFormDataRow = {
129
141
  key: generateRowId(),
130
142
  item: (0, import_cloneDeep.default)(keyedFormData[index].item)
@@ -140,7 +152,7 @@ var ArrayField = class extends import_react.Component {
140
152
  keyedFormData: newKeyedFormData,
141
153
  updatedKeyedFormData: true
142
154
  },
143
- () => onChange(keyedToPlainFormData(newKeyedFormData))
155
+ () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema)
144
156
  );
145
157
  };
146
158
  };
@@ -336,8 +348,20 @@ var ArrayField = class extends import_react.Component {
336
348
  if (event) {
337
349
  event.preventDefault();
338
350
  }
339
- const { onChange } = this.props;
351
+ const { onChange, errorSchema } = this.props;
340
352
  const { keyedFormData } = this.state;
353
+ let newErrorSchema;
354
+ if (errorSchema) {
355
+ newErrorSchema = {};
356
+ for (const idx in errorSchema) {
357
+ const i = parseInt(idx);
358
+ if (index === void 0 || i < index) {
359
+ (0, import_set.default)(newErrorSchema, [i], errorSchema[idx]);
360
+ } else if (i >= index) {
361
+ (0, import_set.default)(newErrorSchema, [i + 1], errorSchema[idx]);
362
+ }
363
+ }
364
+ }
341
365
  const newKeyedFormDataRow = {
342
366
  key: generateRowId(),
343
367
  item: this._getNewFormDataRow()
@@ -353,7 +377,7 @@ var ArrayField = class extends import_react.Component {
353
377
  keyedFormData: newKeyedFormData,
354
378
  updatedKeyedFormData: true
355
379
  },
356
- () => onChange(keyedToPlainFormData(newKeyedFormData))
380
+ () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema)
357
381
  );
358
382
  }
359
383
  /** Renders the `ArrayField` depending on the specific needs of the schema and uischema elements