@rjsf/core 5.6.2 → 5.7.0
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 +12 -18
- 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 +14 -19
- package/dist/core.esm.js.map +1 -1
- package/dist/core.umd.development.js +16 -21
- 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 +12 -12
package/dist/core.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { Component, useState, useCallback, useEffect, useReducer,
|
|
3
|
-
import { isFixedItems, allowAdditionalItems, getUiOptions, ITEMS_KEY, getTemplate, TranslatableString, isCustomWidget, getWidget, optionsList, deepEquals, ERRORS_KEY, asNumber, REF_KEY, orderProperties, PROPERTIES_KEY, ADDITIONAL_PROPERTY_FLAG, ANY_OF_KEY, ONE_OF_KEY, mergeObjects, UI_OPTIONS_KEY, getSchemaType, descriptionId, ID_KEY, hasWidget, titleId, getInputProps, examplesId, ariaDescribedByIds, getSubmitButtonOptions, errorId, helpId, canExpand, parseDateString, toDateString, pad, schemaRequiresTrueValue, labelValue, enumOptionsValueForIndex, enumOptionsIsSelected, optionId, enumOptionsSelectValue, enumOptionsDeselectValue, utcToLocal, localToUTC, dataURItoBlob, enumOptionsIndexForValue, englishStringTranslator, createSchemaUtils, validationDataMerge, shouldRender, UI_GLOBAL_OPTIONS_KEY, SUBMIT_BTN_OPTIONS_KEY, isObject as isObject$1, toErrorList, RJSF_ADDITONAL_PROPERTIES_FLAG, NAME_KEY } from '@rjsf/utils';
|
|
2
|
+
import { Component, useState, useCallback, useEffect, useReducer, createRef, forwardRef } from 'react';
|
|
3
|
+
import { isFixedItems, allowAdditionalItems, getUiOptions, ITEMS_KEY, getTemplate, TranslatableString, isCustomWidget, getWidget, optionsList, deepEquals, getDiscriminatorFieldFromSchema, ERRORS_KEY, asNumber, REF_KEY, orderProperties, PROPERTIES_KEY, ADDITIONAL_PROPERTY_FLAG, ANY_OF_KEY, ONE_OF_KEY, mergeObjects, UI_OPTIONS_KEY, getSchemaType, descriptionId, ID_KEY, hasWidget, titleId, getInputProps, examplesId, ariaDescribedByIds, getSubmitButtonOptions, errorId, helpId, canExpand, parseDateString, toDateString, pad, schemaRequiresTrueValue, labelValue, enumOptionsValueForIndex, enumOptionsIsSelected, optionId, enumOptionsSelectValue, enumOptionsDeselectValue, utcToLocal, localToUTC, dataURItoBlob, enumOptionsIndexForValue, englishStringTranslator, createSchemaUtils, validationDataMerge, shouldRender, UI_GLOBAL_OPTIONS_KEY, SUBMIT_BTN_OPTIONS_KEY, isObject as isObject$1, toErrorList, RJSF_ADDITONAL_PROPERTIES_FLAG, NAME_KEY } from '@rjsf/utils';
|
|
4
4
|
import get from 'lodash-es/get';
|
|
5
5
|
import isEmpty from 'lodash-es/isEmpty';
|
|
6
6
|
import _pick from 'lodash-es/pick';
|
|
@@ -9,7 +9,6 @@ import cloneDeep from 'lodash-es/cloneDeep';
|
|
|
9
9
|
import isObject from 'lodash-es/isObject';
|
|
10
10
|
import set from 'lodash-es/set';
|
|
11
11
|
import { nanoid } from 'nanoid';
|
|
12
|
-
import isString from 'lodash-es/isString';
|
|
13
12
|
import omit from 'lodash-es/omit';
|
|
14
13
|
import Markdown from 'markdown-to-jsx';
|
|
15
14
|
import has from 'lodash-es/has';
|
|
@@ -1135,13 +1134,7 @@ var AnyOfField = /*#__PURE__*/function (_Component) {
|
|
|
1135
1134
|
var _this$props4 = this.props,
|
|
1136
1135
|
schema = _this$props4.schema,
|
|
1137
1136
|
schemaUtils = _this$props4.registry.schemaUtils;
|
|
1138
|
-
var discriminator;
|
|
1139
|
-
var maybeString = get(schema, 'discriminator.propertyName', undefined);
|
|
1140
|
-
if (isString(maybeString)) {
|
|
1141
|
-
discriminator = maybeString;
|
|
1142
|
-
} else if (maybeString !== undefined) {
|
|
1143
|
-
console.warn("Expecting discriminator to be a string, got \"" + typeof maybeString + "\" instead");
|
|
1144
|
-
}
|
|
1137
|
+
var discriminator = getDiscriminatorFieldFromSchema(schema);
|
|
1145
1138
|
var option = schemaUtils.getClosestMatchingOption(formData, options, selectedOption, discriminator);
|
|
1146
1139
|
if (option > 0) {
|
|
1147
1140
|
return option;
|
|
@@ -3262,28 +3255,29 @@ function FileWidget(props) {
|
|
|
3262
3255
|
options = props.options,
|
|
3263
3256
|
registry = props.registry;
|
|
3264
3257
|
var BaseInputTemplate = getTemplate('BaseInputTemplate', registry, options);
|
|
3265
|
-
var
|
|
3266
|
-
return Array.isArray(value) ? extractFileInfo(value) : extractFileInfo([value]);
|
|
3267
|
-
}, [value]);
|
|
3268
|
-
var _useState = useState(extractedFilesInfo),
|
|
3258
|
+
var _useState = useState(Array.isArray(value) ? extractFileInfo(value) : extractFileInfo([value])),
|
|
3269
3259
|
filesInfo = _useState[0],
|
|
3270
3260
|
setFilesInfo = _useState[1];
|
|
3271
3261
|
var handleChange = useCallback(function (event) {
|
|
3272
3262
|
if (!event.target.files) {
|
|
3273
3263
|
return;
|
|
3274
3264
|
}
|
|
3265
|
+
// Due to variances in themes, dealing with multiple files for the array case now happens one file at a time.
|
|
3266
|
+
// This is because we don't pass `multiple` into the `BaseInputTemplate` anymore. Instead, we deal with the single
|
|
3267
|
+
// file in each event and concatenate them together ourselves
|
|
3275
3268
|
processFiles(event.target.files).then(function (filesInfoEvent) {
|
|
3276
|
-
setFilesInfo(filesInfoEvent);
|
|
3277
3269
|
var newValue = filesInfoEvent.map(function (fileInfo) {
|
|
3278
3270
|
return fileInfo.dataURL;
|
|
3279
3271
|
});
|
|
3280
3272
|
if (multiple) {
|
|
3281
|
-
|
|
3273
|
+
setFilesInfo(filesInfo.concat(filesInfoEvent[0]));
|
|
3274
|
+
onChange(value.concat(newValue[0]));
|
|
3282
3275
|
} else {
|
|
3276
|
+
setFilesInfo(filesInfoEvent);
|
|
3283
3277
|
onChange(newValue[0]);
|
|
3284
3278
|
}
|
|
3285
3279
|
});
|
|
3286
|
-
}, [multiple, onChange]);
|
|
3280
|
+
}, [multiple, value, filesInfo, onChange]);
|
|
3287
3281
|
return jsxs("div", {
|
|
3288
3282
|
children: [jsx(BaseInputTemplate, _extends({}, props, {
|
|
3289
3283
|
disabled: disabled || readonly,
|
|
@@ -3923,9 +3917,10 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
3923
3917
|
var liveValidate = 'liveValidate' in props ? props.liveValidate : this.props.liveValidate;
|
|
3924
3918
|
var mustValidate = edit && !props.noValidate && liveValidate;
|
|
3925
3919
|
var rootSchema = schema;
|
|
3920
|
+
var experimental_defaultFormStateBehavior = 'experimental_defaultFormStateBehavior' in props ? props.experimental_defaultFormStateBehavior : this.props.experimental_defaultFormStateBehavior;
|
|
3926
3921
|
var schemaUtils = state.schemaUtils;
|
|
3927
|
-
if (!schemaUtils || schemaUtils.doesSchemaUtilsDiffer(props.validator, rootSchema)) {
|
|
3928
|
-
schemaUtils = createSchemaUtils(props.validator, rootSchema);
|
|
3922
|
+
if (!schemaUtils || schemaUtils.doesSchemaUtilsDiffer(props.validator, rootSchema, experimental_defaultFormStateBehavior)) {
|
|
3923
|
+
schemaUtils = createSchemaUtils(props.validator, rootSchema, experimental_defaultFormStateBehavior);
|
|
3929
3924
|
}
|
|
3930
3925
|
var formData = schemaUtils.getDefaultFormState(schema, inputFormData);
|
|
3931
3926
|
var retrievedSchema = schemaUtils.retrieveSchema(schema, formData);
|