@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/core.umd.js CHANGED
@@ -72,8 +72,20 @@
72
72
  if (event) {
73
73
  event.preventDefault();
74
74
  }
75
- const { onChange } = this.props;
75
+ const { onChange, errorSchema } = this.props;
76
76
  const { keyedFormData } = this.state;
77
+ let newErrorSchema;
78
+ if (errorSchema) {
79
+ newErrorSchema = {};
80
+ for (const idx in errorSchema) {
81
+ const i = parseInt(idx);
82
+ if (i <= index) {
83
+ set(newErrorSchema, [i], errorSchema[idx]);
84
+ } else if (i > index) {
85
+ set(newErrorSchema, [i + 1], errorSchema[idx]);
86
+ }
87
+ }
88
+ }
77
89
  const newKeyedFormDataRow = {
78
90
  key: generateRowId(),
79
91
  item: cloneDeep(keyedFormData[index].item)
@@ -89,7 +101,7 @@
89
101
  keyedFormData: newKeyedFormData,
90
102
  updatedKeyedFormData: true
91
103
  },
92
- () => onChange(keyedToPlainFormData(newKeyedFormData))
104
+ () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema)
93
105
  );
94
106
  };
95
107
  };
@@ -285,8 +297,20 @@
285
297
  if (event) {
286
298
  event.preventDefault();
287
299
  }
288
- const { onChange } = this.props;
300
+ const { onChange, errorSchema } = this.props;
289
301
  const { keyedFormData } = this.state;
302
+ let newErrorSchema;
303
+ if (errorSchema) {
304
+ newErrorSchema = {};
305
+ for (const idx in errorSchema) {
306
+ const i = parseInt(idx);
307
+ if (index === void 0 || i < index) {
308
+ set(newErrorSchema, [i], errorSchema[idx]);
309
+ } else if (i >= index) {
310
+ set(newErrorSchema, [i + 1], errorSchema[idx]);
311
+ }
312
+ }
313
+ }
290
314
  const newKeyedFormDataRow = {
291
315
  key: generateRowId(),
292
316
  item: this._getNewFormDataRow()
@@ -302,7 +326,7 @@
302
326
  keyedFormData: newKeyedFormData,
303
327
  updatedKeyedFormData: true
304
328
  },
305
- () => onChange(keyedToPlainFormData(newKeyedFormData))
329
+ () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema)
306
330
  );
307
331
  }
308
332
  /** Renders the `ArrayField` depending on the specific needs of the schema and uischema elements
package/dist/index.esm.js CHANGED
@@ -110,8 +110,20 @@ var ArrayField = class extends Component {
110
110
  if (event) {
111
111
  event.preventDefault();
112
112
  }
113
- const { onChange } = this.props;
113
+ const { onChange, errorSchema } = this.props;
114
114
  const { keyedFormData } = this.state;
115
+ let newErrorSchema;
116
+ if (errorSchema) {
117
+ newErrorSchema = {};
118
+ for (const idx in errorSchema) {
119
+ const i = parseInt(idx);
120
+ if (i <= index) {
121
+ set(newErrorSchema, [i], errorSchema[idx]);
122
+ } else if (i > index) {
123
+ set(newErrorSchema, [i + 1], errorSchema[idx]);
124
+ }
125
+ }
126
+ }
115
127
  const newKeyedFormDataRow = {
116
128
  key: generateRowId(),
117
129
  item: cloneDeep(keyedFormData[index].item)
@@ -127,7 +139,7 @@ var ArrayField = class extends Component {
127
139
  keyedFormData: newKeyedFormData,
128
140
  updatedKeyedFormData: true
129
141
  },
130
- () => onChange(keyedToPlainFormData(newKeyedFormData))
142
+ () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema)
131
143
  );
132
144
  };
133
145
  };
@@ -323,8 +335,20 @@ var ArrayField = class extends Component {
323
335
  if (event) {
324
336
  event.preventDefault();
325
337
  }
326
- const { onChange } = this.props;
338
+ const { onChange, errorSchema } = this.props;
327
339
  const { keyedFormData } = this.state;
340
+ let newErrorSchema;
341
+ if (errorSchema) {
342
+ newErrorSchema = {};
343
+ for (const idx in errorSchema) {
344
+ const i = parseInt(idx);
345
+ if (index === void 0 || i < index) {
346
+ set(newErrorSchema, [i], errorSchema[idx]);
347
+ } else if (i >= index) {
348
+ set(newErrorSchema, [i + 1], errorSchema[idx]);
349
+ }
350
+ }
351
+ }
328
352
  const newKeyedFormDataRow = {
329
353
  key: generateRowId(),
330
354
  item: this._getNewFormDataRow()
@@ -340,7 +364,7 @@ var ArrayField = class extends Component {
340
364
  keyedFormData: newKeyedFormData,
341
365
  updatedKeyedFormData: true
342
366
  },
343
- () => onChange(keyedToPlainFormData(newKeyedFormData))
367
+ () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema)
344
368
  );
345
369
  }
346
370
  /** Renders the `ArrayField` depending on the specific needs of the schema and uischema elements