@rjsf/core 5.6.2 → 5.7.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.
- package/dist/core.cjs.development.js +13 -19
- package/dist/core.cjs.development.js.map +1 -1
- package/dist/core.cjs.production.min.js +1 -1
- package/dist/core.cjs.production.min.js.map +1 -1
- package/dist/core.esm.js +15 -20
- package/dist/core.esm.js.map +1 -1
- package/dist/core.umd.development.js +17 -22
- package/dist/core.umd.development.js.map +1 -1
- package/dist/core.umd.production.min.js +1 -1
- package/dist/core.umd.production.min.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/package.json +13 -13
|
@@ -13,7 +13,6 @@ var cloneDeep = require('lodash/cloneDeep');
|
|
|
13
13
|
var isObject = require('lodash/isObject');
|
|
14
14
|
var set = require('lodash/set');
|
|
15
15
|
var nanoid = require('nanoid');
|
|
16
|
-
var isString = require('lodash/isString');
|
|
17
16
|
var omit = require('lodash/omit');
|
|
18
17
|
var Markdown = require('markdown-to-jsx');
|
|
19
18
|
var has = require('lodash/has');
|
|
@@ -28,7 +27,6 @@ var _toPath__default = /*#__PURE__*/_interopDefaultLegacy(_toPath);
|
|
|
28
27
|
var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
|
|
29
28
|
var isObject__default = /*#__PURE__*/_interopDefaultLegacy(isObject);
|
|
30
29
|
var set__default = /*#__PURE__*/_interopDefaultLegacy(set);
|
|
31
|
-
var isString__default = /*#__PURE__*/_interopDefaultLegacy(isString);
|
|
32
30
|
var omit__default = /*#__PURE__*/_interopDefaultLegacy(omit);
|
|
33
31
|
var Markdown__default = /*#__PURE__*/_interopDefaultLegacy(Markdown);
|
|
34
32
|
var has__default = /*#__PURE__*/_interopDefaultLegacy(has);
|
|
@@ -1154,13 +1152,7 @@ var AnyOfField = /*#__PURE__*/function (_Component) {
|
|
|
1154
1152
|
var _this$props4 = this.props,
|
|
1155
1153
|
schema = _this$props4.schema,
|
|
1156
1154
|
schemaUtils = _this$props4.registry.schemaUtils;
|
|
1157
|
-
var discriminator;
|
|
1158
|
-
var maybeString = get__default["default"](schema, 'discriminator.propertyName', undefined);
|
|
1159
|
-
if (isString__default["default"](maybeString)) {
|
|
1160
|
-
discriminator = maybeString;
|
|
1161
|
-
} else if (maybeString !== undefined) {
|
|
1162
|
-
console.warn("Expecting discriminator to be a string, got \"" + typeof maybeString + "\" instead");
|
|
1163
|
-
}
|
|
1155
|
+
var discriminator = utils.getDiscriminatorFieldFromSchema(schema);
|
|
1164
1156
|
var option = schemaUtils.getClosestMatchingOption(formData, options, selectedOption, discriminator);
|
|
1165
1157
|
if (option > 0) {
|
|
1166
1158
|
return option;
|
|
@@ -3281,28 +3273,29 @@ function FileWidget(props) {
|
|
|
3281
3273
|
options = props.options,
|
|
3282
3274
|
registry = props.registry;
|
|
3283
3275
|
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
3284
|
-
var
|
|
3285
|
-
return Array.isArray(value) ? extractFileInfo(value) : extractFileInfo([value]);
|
|
3286
|
-
}, [value]);
|
|
3287
|
-
var _useState = react.useState(extractedFilesInfo),
|
|
3276
|
+
var _useState = react.useState(Array.isArray(value) ? extractFileInfo(value) : extractFileInfo([value])),
|
|
3288
3277
|
filesInfo = _useState[0],
|
|
3289
3278
|
setFilesInfo = _useState[1];
|
|
3290
3279
|
var handleChange = react.useCallback(function (event) {
|
|
3291
3280
|
if (!event.target.files) {
|
|
3292
3281
|
return;
|
|
3293
3282
|
}
|
|
3283
|
+
// Due to variances in themes, dealing with multiple files for the array case now happens one file at a time.
|
|
3284
|
+
// This is because we don't pass `multiple` into the `BaseInputTemplate` anymore. Instead, we deal with the single
|
|
3285
|
+
// file in each event and concatenate them together ourselves
|
|
3294
3286
|
processFiles(event.target.files).then(function (filesInfoEvent) {
|
|
3295
|
-
setFilesInfo(filesInfoEvent);
|
|
3296
3287
|
var newValue = filesInfoEvent.map(function (fileInfo) {
|
|
3297
3288
|
return fileInfo.dataURL;
|
|
3298
3289
|
});
|
|
3299
3290
|
if (multiple) {
|
|
3300
|
-
|
|
3291
|
+
setFilesInfo(filesInfo.concat(filesInfoEvent[0]));
|
|
3292
|
+
onChange(value.concat(newValue[0]));
|
|
3301
3293
|
} else {
|
|
3294
|
+
setFilesInfo(filesInfoEvent);
|
|
3302
3295
|
onChange(newValue[0]);
|
|
3303
3296
|
}
|
|
3304
3297
|
});
|
|
3305
|
-
}, [multiple, onChange]);
|
|
3298
|
+
}, [multiple, value, filesInfo, onChange]);
|
|
3306
3299
|
return jsxRuntime.jsxs("div", {
|
|
3307
3300
|
children: [jsxRuntime.jsx(BaseInputTemplate, _extends({}, props, {
|
|
3308
3301
|
disabled: disabled || readonly,
|
|
@@ -3942,9 +3935,10 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3942
3935
|
var liveValidate = 'liveValidate' in props ? props.liveValidate : this.props.liveValidate;
|
|
3943
3936
|
var mustValidate = edit && !props.noValidate && liveValidate;
|
|
3944
3937
|
var rootSchema = schema;
|
|
3938
|
+
var experimental_defaultFormStateBehavior = 'experimental_defaultFormStateBehavior' in props ? props.experimental_defaultFormStateBehavior : this.props.experimental_defaultFormStateBehavior;
|
|
3945
3939
|
var schemaUtils = state.schemaUtils;
|
|
3946
|
-
if (!schemaUtils || schemaUtils.doesSchemaUtilsDiffer(props.validator, rootSchema)) {
|
|
3947
|
-
schemaUtils = utils.createSchemaUtils(props.validator, rootSchema);
|
|
3940
|
+
if (!schemaUtils || schemaUtils.doesSchemaUtilsDiffer(props.validator, rootSchema, experimental_defaultFormStateBehavior)) {
|
|
3941
|
+
schemaUtils = utils.createSchemaUtils(props.validator, rootSchema, experimental_defaultFormStateBehavior);
|
|
3948
3942
|
}
|
|
3949
3943
|
var formData = schemaUtils.getDefaultFormState(schema, inputFormData);
|
|
3950
3944
|
var retrievedSchema = schemaUtils.retrieveSchema(schema, formData);
|
|
@@ -4116,7 +4110,7 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
4116
4110
|
// if not an exact match, try finding an input starting with the element id (like radio buttons or checkboxes)
|
|
4117
4111
|
field = this.formElement.current.querySelector("input[id^=" + elementId);
|
|
4118
4112
|
}
|
|
4119
|
-
if (field.length) {
|
|
4113
|
+
if (field && field.length) {
|
|
4120
4114
|
// If we got a list with length > 0
|
|
4121
4115
|
field = field[0];
|
|
4122
4116
|
}
|