@rjsf/core 5.21.0 → 5.21.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 +10 -8
- package/dist/index.esm.js +7 -8
- package/dist/index.esm.js.map +2 -2
- package/dist/index.js +7 -8
- package/dist/index.js.map +3 -3
- package/lib/components/Form.js +6 -9
- package/lib/components/Form.js.map +1 -1
- package/lib/components/fields/SchemaField.js +1 -1
- package/lib/components/fields/SchemaField.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/src/components/Form.tsx +6 -9
- package/src/components/fields/SchemaField.tsx +2 -0
package/dist/core.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@rjsf/utils'), require('lodash/forEach'), require('lodash/get'), require('lodash/isEmpty'), require('lodash/pick'), require('lodash/toPath'), require('lodash/cloneDeep'), require('lodash/isObject'), require('lodash/set'), require('nanoid'), require('react/jsx-runtime'), require('lodash/omit'), require('markdown-to-jsx'), require('lodash/has'), require('lodash/unset')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react', '@rjsf/utils', 'lodash/forEach', 'lodash/get', 'lodash/isEmpty', 'lodash/pick', 'lodash/toPath', 'lodash/cloneDeep', 'lodash/isObject', 'lodash/set', 'nanoid', 'react/jsx-runtime', 'lodash/omit', 'markdown-to-jsx', 'lodash/has', 'lodash/unset'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSONSchemaForm = {}, global.react, global.utils, global._forEach, global.get3, global.isEmpty, global._pick, global._toPath, global.cloneDeep, global.isObject, global.set, global.nanoid, global.jsxRuntime, global.omit2, global.Markdown, global.has, global.unset));
|
|
5
|
-
})(this, (function (exports, react, utils, _forEach, get3, isEmpty, _pick, _toPath, cloneDeep, isObject, set, nanoid, jsxRuntime, omit2, Markdown, has, unset) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@rjsf/utils'), require('lodash/forEach'), require('lodash/get'), require('lodash/isEmpty'), require('lodash/isNil'), require('lodash/pick'), require('lodash/toPath'), require('lodash/cloneDeep'), require('lodash/isObject'), require('lodash/set'), require('nanoid'), require('react/jsx-runtime'), require('lodash/omit'), require('markdown-to-jsx'), require('lodash/has'), require('lodash/unset')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react', '@rjsf/utils', 'lodash/forEach', 'lodash/get', 'lodash/isEmpty', 'lodash/isNil', 'lodash/pick', 'lodash/toPath', 'lodash/cloneDeep', 'lodash/isObject', 'lodash/set', 'nanoid', 'react/jsx-runtime', 'lodash/omit', 'markdown-to-jsx', 'lodash/has', 'lodash/unset'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSONSchemaForm = {}, global.react, global.utils, global._forEach, global.get3, global.isEmpty, global._isNil, global._pick, global._toPath, global.cloneDeep, global.isObject, global.set, global.nanoid, global.jsxRuntime, global.omit2, global.Markdown, global.has, global.unset));
|
|
5
|
+
})(this, (function (exports, react, utils, _forEach, get3, isEmpty, _isNil, _pick, _toPath, cloneDeep, isObject, set, nanoid, jsxRuntime, omit2, Markdown, has, unset) { 'use strict';
|
|
6
6
|
|
|
7
7
|
// src/components/Form.tsx
|
|
8
8
|
function generateRowId() {
|
|
@@ -1561,6 +1561,7 @@
|
|
|
1561
1561
|
(_schema2) => schemaUtils.retrieveSchema(isObject(_schema2) ? _schema2 : {}, formData)
|
|
1562
1562
|
),
|
|
1563
1563
|
registry,
|
|
1564
|
+
required,
|
|
1564
1565
|
schema,
|
|
1565
1566
|
uiSchema
|
|
1566
1567
|
}
|
|
@@ -1585,6 +1586,7 @@
|
|
|
1585
1586
|
(_schema2) => schemaUtils.retrieveSchema(isObject(_schema2) ? _schema2 : {}, formData)
|
|
1586
1587
|
),
|
|
1587
1588
|
registry,
|
|
1589
|
+
required,
|
|
1588
1590
|
schema,
|
|
1589
1591
|
uiSchema
|
|
1590
1592
|
}
|
|
@@ -3458,17 +3460,17 @@
|
|
|
3458
3460
|
if (resolvedSchema?.type !== "object" && resolvedSchema?.type !== "array") {
|
|
3459
3461
|
filteredErrors.__errors = schemaErrors.__errors;
|
|
3460
3462
|
}
|
|
3461
|
-
const
|
|
3463
|
+
const filterNilOrEmptyErrors = (errors) => {
|
|
3462
3464
|
_forEach(errors, (errorAtKey, errorKey) => {
|
|
3463
|
-
if (errorAtKey
|
|
3465
|
+
if (_isNil(errorAtKey)) {
|
|
3464
3466
|
delete errors[errorKey];
|
|
3465
3467
|
} else if (typeof errorAtKey === "object" && !Array.isArray(errorAtKey.__errors)) {
|
|
3466
|
-
|
|
3468
|
+
filterNilOrEmptyErrors(errorAtKey);
|
|
3467
3469
|
}
|
|
3468
3470
|
});
|
|
3469
3471
|
return errors;
|
|
3470
3472
|
};
|
|
3471
|
-
return
|
|
3473
|
+
return filterNilOrEmptyErrors(filteredErrors);
|
|
3472
3474
|
}
|
|
3473
3475
|
/** Returns the registry for the form */
|
|
3474
3476
|
getRegistry() {
|
package/dist/index.esm.js
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
import _forEach from "lodash/forEach";
|
|
20
20
|
import _get from "lodash/get";
|
|
21
21
|
import _isEmpty from "lodash/isEmpty";
|
|
22
|
+
import _isNil from "lodash/isNil";
|
|
22
23
|
import _pick from "lodash/pick";
|
|
23
24
|
import _toPath from "lodash/toPath";
|
|
24
25
|
|
|
@@ -1673,6 +1674,7 @@ function SchemaFieldRender(props) {
|
|
|
1673
1674
|
(_schema2) => schemaUtils.retrieveSchema(isObject4(_schema2) ? _schema2 : {}, formData)
|
|
1674
1675
|
),
|
|
1675
1676
|
registry,
|
|
1677
|
+
required,
|
|
1676
1678
|
schema,
|
|
1677
1679
|
uiSchema
|
|
1678
1680
|
}
|
|
@@ -1697,6 +1699,7 @@ function SchemaFieldRender(props) {
|
|
|
1697
1699
|
(_schema2) => schemaUtils.retrieveSchema(isObject4(_schema2) ? _schema2 : {}, formData)
|
|
1698
1700
|
),
|
|
1699
1701
|
registry,
|
|
1702
|
+
required,
|
|
1700
1703
|
schema,
|
|
1701
1704
|
uiSchema
|
|
1702
1705
|
}
|
|
@@ -3414,7 +3417,6 @@ var Form = class extends Component5 {
|
|
|
3414
3417
|
const mustValidate = !noValidate && liveValidate;
|
|
3415
3418
|
let state = { formData, schema };
|
|
3416
3419
|
let newFormData = formData;
|
|
3417
|
-
let _retrievedSchema;
|
|
3418
3420
|
if (omitExtraData === true && liveOmit === true) {
|
|
3419
3421
|
newFormData = this.omitExtraData(formData);
|
|
3420
3422
|
state = {
|
|
@@ -3451,9 +3453,6 @@ var Form = class extends Component5 {
|
|
|
3451
3453
|
errors: toErrorList(errorSchema)
|
|
3452
3454
|
};
|
|
3453
3455
|
}
|
|
3454
|
-
if (_retrievedSchema) {
|
|
3455
|
-
state.retrievedSchema = _retrievedSchema;
|
|
3456
|
-
}
|
|
3457
3456
|
this.setState(state, () => onChange && onChange({ ...this.state, ...state }, id));
|
|
3458
3457
|
};
|
|
3459
3458
|
/**
|
|
@@ -3812,17 +3811,17 @@ var Form = class extends Component5 {
|
|
|
3812
3811
|
if (resolvedSchema?.type !== "object" && resolvedSchema?.type !== "array") {
|
|
3813
3812
|
filteredErrors.__errors = schemaErrors.__errors;
|
|
3814
3813
|
}
|
|
3815
|
-
const
|
|
3814
|
+
const filterNilOrEmptyErrors = (errors) => {
|
|
3816
3815
|
_forEach(errors, (errorAtKey, errorKey) => {
|
|
3817
|
-
if (errorAtKey
|
|
3816
|
+
if (_isNil(errorAtKey)) {
|
|
3818
3817
|
delete errors[errorKey];
|
|
3819
3818
|
} else if (typeof errorAtKey === "object" && !Array.isArray(errorAtKey.__errors)) {
|
|
3820
|
-
|
|
3819
|
+
filterNilOrEmptyErrors(errorAtKey);
|
|
3821
3820
|
}
|
|
3822
3821
|
});
|
|
3823
3822
|
return errors;
|
|
3824
3823
|
};
|
|
3825
|
-
return
|
|
3824
|
+
return filterNilOrEmptyErrors(filteredErrors);
|
|
3826
3825
|
}
|
|
3827
3826
|
/** Returns the registry for the form */
|
|
3828
3827
|
getRegistry() {
|