@rjsf/core 6.5.2 → 6.5.3
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 +27 -3
- package/dist/index.cjs +27 -3
- package/dist/index.cjs.map +2 -2
- package/dist/index.esm.js +53 -26
- package/dist/index.esm.js.map +3 -3
- package/lib/components/Form.d.ts.map +1 -1
- package/lib/components/Form.js +28 -2
- package/lib/components/fields/SchemaField.d.ts.map +1 -1
- package/lib/components/fields/SchemaField.js +8 -3
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/components/Form.tsx +29 -1
- package/src/components/fields/SchemaField.tsx +11 -2
package/dist/index.esm.js
CHANGED
|
@@ -23,7 +23,9 @@ import {
|
|
|
23
23
|
ERRORS_KEY as ERRORS_KEY3,
|
|
24
24
|
ID_KEY as ID_KEY5,
|
|
25
25
|
getUsedFormData,
|
|
26
|
-
getFieldNames
|
|
26
|
+
getFieldNames,
|
|
27
|
+
ANY_OF_KEY as ANY_OF_KEY6,
|
|
28
|
+
ONE_OF_KEY as ONE_OF_KEY6
|
|
27
29
|
} from "@rjsf/utils";
|
|
28
30
|
import _cloneDeep from "lodash/cloneDeep";
|
|
29
31
|
import _get from "lodash/get";
|
|
@@ -2318,6 +2320,7 @@ import {
|
|
|
2318
2320
|
shouldRender,
|
|
2319
2321
|
shouldRenderOptionalField as shouldRenderOptionalField4,
|
|
2320
2322
|
toFieldPathId as toFieldPathId5,
|
|
2323
|
+
TranslatableString as TranslatableString7,
|
|
2321
2324
|
UI_OPTIONS_KEY as UI_OPTIONS_KEY2
|
|
2322
2325
|
} from "@rjsf/utils";
|
|
2323
2326
|
import isObject5 from "lodash/isObject";
|
|
@@ -2391,7 +2394,9 @@ function SchemaFieldRender(props) {
|
|
|
2391
2394
|
[fieldId, onChange]
|
|
2392
2395
|
);
|
|
2393
2396
|
const FieldComponent = getFieldComponent(schema, uiOptions, registry);
|
|
2394
|
-
const
|
|
2397
|
+
const isDeprecated = Boolean(schema.deprecated);
|
|
2398
|
+
const deprecatedHandling = isDeprecated ? uiOptions.deprecatedHandling ?? "label" : void 0;
|
|
2399
|
+
const disabled = Boolean(uiOptions.disabled ?? props.disabled) || deprecatedHandling === "disable";
|
|
2395
2400
|
const readonly = Boolean(uiOptions.readonly ?? (props.readonly || props.schema.readOnly || schema.readOnly));
|
|
2396
2401
|
const uiSchemaHideError = uiOptions.hideError;
|
|
2397
2402
|
const hideError = uiSchemaHideError === void 0 ? props.hideError : Boolean(uiSchemaHideError);
|
|
@@ -2454,9 +2459,12 @@ function SchemaFieldRender(props) {
|
|
|
2454
2459
|
} else {
|
|
2455
2460
|
label = ADDITIONAL_PROPERTY_FLAG2 in schema ? name : uiOptions.title || props.schema.title || schema.title || props.title || name;
|
|
2456
2461
|
}
|
|
2462
|
+
if (deprecatedHandling === "label") {
|
|
2463
|
+
label = registry.translateString(TranslatableString7.DeprecatedLabel, [label]);
|
|
2464
|
+
}
|
|
2457
2465
|
const description = uiOptions.description || props.schema.description || schema.description || "";
|
|
2458
2466
|
const help = uiOptions.help;
|
|
2459
|
-
const hidden = uiOptions.widget === "hidden";
|
|
2467
|
+
const hidden = uiOptions.widget === "hidden" || deprecatedHandling === "hide";
|
|
2460
2468
|
const classNames = ["rjsf-field", `rjsf-field-${getSchemaType2(schema)}`];
|
|
2461
2469
|
if (!hideError && __errors && __errors.length > 0) {
|
|
2462
2470
|
classNames.push("rjsf-field-error");
|
|
@@ -3031,10 +3039,10 @@ function SubmitButton({ uiSchema }) {
|
|
|
3031
3039
|
}
|
|
3032
3040
|
|
|
3033
3041
|
// src/components/templates/ButtonTemplates/AddButton.tsx
|
|
3034
|
-
import { TranslatableString as
|
|
3042
|
+
import { TranslatableString as TranslatableString9 } from "@rjsf/utils";
|
|
3035
3043
|
|
|
3036
3044
|
// src/components/templates/ButtonTemplates/IconButton.tsx
|
|
3037
|
-
import { TranslatableString as
|
|
3045
|
+
import { TranslatableString as TranslatableString8 } from "@rjsf/utils";
|
|
3038
3046
|
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
3039
3047
|
function IconButton(props) {
|
|
3040
3048
|
const { iconType = "default", icon, className, uiSchema, registry, ...otherProps } = props;
|
|
@@ -3044,25 +3052,25 @@ function CopyButton(props) {
|
|
|
3044
3052
|
const {
|
|
3045
3053
|
registry: { translateString }
|
|
3046
3054
|
} = props;
|
|
3047
|
-
return /* @__PURE__ */ jsx21(IconButton, { title: translateString(
|
|
3055
|
+
return /* @__PURE__ */ jsx21(IconButton, { title: translateString(TranslatableString8.CopyButton), ...props, icon: "copy" });
|
|
3048
3056
|
}
|
|
3049
3057
|
function MoveDownButton(props) {
|
|
3050
3058
|
const {
|
|
3051
3059
|
registry: { translateString }
|
|
3052
3060
|
} = props;
|
|
3053
|
-
return /* @__PURE__ */ jsx21(IconButton, { title: translateString(
|
|
3061
|
+
return /* @__PURE__ */ jsx21(IconButton, { title: translateString(TranslatableString8.MoveDownButton), ...props, icon: "arrow-down" });
|
|
3054
3062
|
}
|
|
3055
3063
|
function MoveUpButton(props) {
|
|
3056
3064
|
const {
|
|
3057
3065
|
registry: { translateString }
|
|
3058
3066
|
} = props;
|
|
3059
|
-
return /* @__PURE__ */ jsx21(IconButton, { title: translateString(
|
|
3067
|
+
return /* @__PURE__ */ jsx21(IconButton, { title: translateString(TranslatableString8.MoveUpButton), ...props, icon: "arrow-up" });
|
|
3060
3068
|
}
|
|
3061
3069
|
function RemoveButton(props) {
|
|
3062
3070
|
const {
|
|
3063
3071
|
registry: { translateString }
|
|
3064
3072
|
} = props;
|
|
3065
|
-
return /* @__PURE__ */ jsx21(IconButton, { title: translateString(
|
|
3073
|
+
return /* @__PURE__ */ jsx21(IconButton, { title: translateString(TranslatableString8.RemoveButton), ...props, iconType: "danger", icon: "remove" });
|
|
3066
3074
|
}
|
|
3067
3075
|
function ClearButton({
|
|
3068
3076
|
id,
|
|
@@ -3080,7 +3088,7 @@ function ClearButton({
|
|
|
3080
3088
|
iconType: "default",
|
|
3081
3089
|
icon: "remove",
|
|
3082
3090
|
className: "btn-clear col-xs-12",
|
|
3083
|
-
title: translateString(
|
|
3091
|
+
title: translateString(TranslatableString8.ClearButton),
|
|
3084
3092
|
onClick,
|
|
3085
3093
|
disabled,
|
|
3086
3094
|
registry,
|
|
@@ -3110,7 +3118,7 @@ function AddButton({
|
|
|
3110
3118
|
iconType: "info",
|
|
3111
3119
|
icon: "plus",
|
|
3112
3120
|
className: "btn-add col-xs-12",
|
|
3113
|
-
title: translateString(
|
|
3121
|
+
title: translateString(TranslatableString9.AddButton),
|
|
3114
3122
|
onClick,
|
|
3115
3123
|
disabled,
|
|
3116
3124
|
registry
|
|
@@ -3164,7 +3172,7 @@ function DescriptionField(props) {
|
|
|
3164
3172
|
|
|
3165
3173
|
// src/components/templates/ErrorList.tsx
|
|
3166
3174
|
import {
|
|
3167
|
-
TranslatableString as
|
|
3175
|
+
TranslatableString as TranslatableString10
|
|
3168
3176
|
} from "@rjsf/utils";
|
|
3169
3177
|
import { jsx as jsx25, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3170
3178
|
function ErrorList({
|
|
@@ -3173,7 +3181,7 @@ function ErrorList({
|
|
|
3173
3181
|
}) {
|
|
3174
3182
|
const { translateString } = registry;
|
|
3175
3183
|
return /* @__PURE__ */ jsxs7("div", { className: "panel panel-danger errors", children: [
|
|
3176
|
-
/* @__PURE__ */ jsx25("div", { className: "panel-heading", children: /* @__PURE__ */ jsx25("h3", { className: "panel-title", children: translateString(
|
|
3184
|
+
/* @__PURE__ */ jsx25("div", { className: "panel-heading", children: /* @__PURE__ */ jsx25("h3", { className: "panel-title", children: translateString(TranslatableString10.ErrorsLabel) }) }),
|
|
3177
3185
|
/* @__PURE__ */ jsx25("ul", { className: "list-group", children: errors.map((error, i) => {
|
|
3178
3186
|
return /* @__PURE__ */ jsx25("li", { className: "list-group-item text-danger", children: error.stack }, i);
|
|
3179
3187
|
}) })
|
|
@@ -3438,20 +3446,20 @@ function TitleField(props) {
|
|
|
3438
3446
|
}
|
|
3439
3447
|
|
|
3440
3448
|
// src/components/templates/UnsupportedField.tsx
|
|
3441
|
-
import { TranslatableString as
|
|
3449
|
+
import { TranslatableString as TranslatableString11 } from "@rjsf/utils";
|
|
3442
3450
|
import Markdown4 from "markdown-to-jsx";
|
|
3443
3451
|
import { jsx as jsx37, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3444
3452
|
function UnsupportedField(props) {
|
|
3445
3453
|
const { schema, fieldPathId, reason, registry } = props;
|
|
3446
3454
|
const { translateString } = registry;
|
|
3447
|
-
let translateEnum =
|
|
3455
|
+
let translateEnum = TranslatableString11.UnsupportedField;
|
|
3448
3456
|
const translateParams = [];
|
|
3449
3457
|
if (fieldPathId && fieldPathId.$id) {
|
|
3450
|
-
translateEnum =
|
|
3458
|
+
translateEnum = TranslatableString11.UnsupportedFieldWithId;
|
|
3451
3459
|
translateParams.push(fieldPathId.$id);
|
|
3452
3460
|
}
|
|
3453
3461
|
if (reason) {
|
|
3454
|
-
translateEnum = translateEnum ===
|
|
3462
|
+
translateEnum = translateEnum === TranslatableString11.UnsupportedField ? TranslatableString11.UnsupportedFieldWithReason : TranslatableString11.UnsupportedFieldWithIdAndReason;
|
|
3455
3463
|
translateParams.push(reason);
|
|
3456
3464
|
}
|
|
3457
3465
|
return /* @__PURE__ */ jsxs13("div", { className: "unsupported-field", children: [
|
|
@@ -3465,7 +3473,7 @@ var UnsupportedField_default = UnsupportedField;
|
|
|
3465
3473
|
import {
|
|
3466
3474
|
ADDITIONAL_PROPERTY_FLAG as ADDITIONAL_PROPERTY_FLAG3,
|
|
3467
3475
|
buttonId as buttonId4,
|
|
3468
|
-
TranslatableString as
|
|
3476
|
+
TranslatableString as TranslatableString12
|
|
3469
3477
|
} from "@rjsf/utils";
|
|
3470
3478
|
import { jsx as jsx38, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3471
3479
|
function WrapIfAdditionalTemplate(props) {
|
|
@@ -3490,7 +3498,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
3490
3498
|
} = props;
|
|
3491
3499
|
const { templates: templates2, translateString } = registry;
|
|
3492
3500
|
const { RemoveButton: RemoveButton2 } = templates2.ButtonTemplates;
|
|
3493
|
-
const keyLabel = translateString(
|
|
3501
|
+
const keyLabel = translateString(TranslatableString12.KeyLabel, [label]);
|
|
3494
3502
|
const additional = ADDITIONAL_PROPERTY_FLAG3 in schema;
|
|
3495
3503
|
const hasDescription = !!rawDescription;
|
|
3496
3504
|
const classNamesList = ["form-group", classNames];
|
|
@@ -3564,7 +3572,7 @@ var templates_default = templates;
|
|
|
3564
3572
|
// src/components/widgets/AltDateWidget.tsx
|
|
3565
3573
|
import {
|
|
3566
3574
|
DateElement,
|
|
3567
|
-
TranslatableString as
|
|
3575
|
+
TranslatableString as TranslatableString13,
|
|
3568
3576
|
useAltDateWidgetProps
|
|
3569
3577
|
} from "@rjsf/utils";
|
|
3570
3578
|
import { jsx as jsx39, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
@@ -3588,8 +3596,8 @@ function AltDateWidget(props) {
|
|
|
3588
3596
|
autofocus: autofocus && i === 0
|
|
3589
3597
|
}
|
|
3590
3598
|
) }, i)),
|
|
3591
|
-
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ jsx39("li", { className: "list-inline-item", children: /* @__PURE__ */ jsx39("a", { href: "#", className: "btn btn-info btn-now", onClick: handleSetNow, children: translateString(
|
|
3592
|
-
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ jsx39("li", { className: "list-inline-item", children: /* @__PURE__ */ jsx39("a", { href: "#", className: "btn btn-warning btn-clear", onClick: handleClear, children: translateString(
|
|
3599
|
+
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ jsx39("li", { className: "list-inline-item", children: /* @__PURE__ */ jsx39("a", { href: "#", className: "btn btn-info btn-now", onClick: handleSetNow, children: translateString(TranslatableString13.NowLabel) }) }),
|
|
3600
|
+
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ jsx39("li", { className: "list-inline-item", children: /* @__PURE__ */ jsx39("a", { href: "#", className: "btn btn-warning btn-clear", onClick: handleClear, children: translateString(TranslatableString13.ClearLabel) }) })
|
|
3593
3601
|
] });
|
|
3594
3602
|
}
|
|
3595
3603
|
var AltDateWidget_default = AltDateWidget;
|
|
@@ -3812,7 +3820,7 @@ function EmailWidget(props) {
|
|
|
3812
3820
|
// src/components/widgets/FileWidget.tsx
|
|
3813
3821
|
import {
|
|
3814
3822
|
getTemplate as getTemplate22,
|
|
3815
|
-
TranslatableString as
|
|
3823
|
+
TranslatableString as TranslatableString14,
|
|
3816
3824
|
useFileWidgetProps
|
|
3817
3825
|
} from "@rjsf/utils";
|
|
3818
3826
|
import Markdown5 from "markdown-to-jsx";
|
|
@@ -3831,7 +3839,7 @@ function FileInfoPreview({
|
|
|
3831
3839
|
}
|
|
3832
3840
|
return /* @__PURE__ */ jsxs18(Fragment4, { children: [
|
|
3833
3841
|
" ",
|
|
3834
|
-
/* @__PURE__ */ jsx47("a", { download: `preview-${name}`, href: dataURL, className: "file-download", children: translateString(
|
|
3842
|
+
/* @__PURE__ */ jsx47("a", { download: `preview-${name}`, href: dataURL, className: "file-download", children: translateString(TranslatableString14.PreviewLabel) })
|
|
3835
3843
|
] });
|
|
3836
3844
|
}
|
|
3837
3845
|
function FilesInfo({
|
|
@@ -3850,7 +3858,7 @@ function FilesInfo({
|
|
|
3850
3858
|
const { name, size, type } = fileInfo;
|
|
3851
3859
|
const handleRemove = () => onRemove(key);
|
|
3852
3860
|
return /* @__PURE__ */ jsxs18("li", { children: [
|
|
3853
|
-
/* @__PURE__ */ jsx47(Markdown5, { children: translateString(
|
|
3861
|
+
/* @__PURE__ */ jsx47(Markdown5, { children: translateString(TranslatableString14.FilesInfo, [name, type, String(size)]) }),
|
|
3854
3862
|
preview && /* @__PURE__ */ jsx47(FileInfoPreview, { fileInfo, registry }),
|
|
3855
3863
|
/* @__PURE__ */ jsx47(RemoveButton2, { onClick: handleRemove, registry })
|
|
3856
3864
|
] }, key);
|
|
@@ -4767,7 +4775,26 @@ var Form = class extends Component3 {
|
|
|
4767
4775
|
if (newValue === ADDITIONAL_PROPERTY_KEY_REMOVE) {
|
|
4768
4776
|
_unset(formData, path);
|
|
4769
4777
|
} else if (!isRootPath) {
|
|
4770
|
-
|
|
4778
|
+
let unsetPath = false;
|
|
4779
|
+
let valueForPath = newValue;
|
|
4780
|
+
if (newValue === void 0) {
|
|
4781
|
+
const lastSegment = path[path.length - 1];
|
|
4782
|
+
if (typeof lastSegment === "number") {
|
|
4783
|
+
valueForPath = null;
|
|
4784
|
+
} else {
|
|
4785
|
+
const { field } = schemaUtils.findFieldInSchema(schema, path, oldFormData);
|
|
4786
|
+
const leaf = field;
|
|
4787
|
+
const isOneOfOrAnyOfLeaf = leaf && (ONE_OF_KEY6 in leaf || ANY_OF_KEY6 in leaf);
|
|
4788
|
+
if (!isOneOfOrAnyOfLeaf && leaf !== void 0) {
|
|
4789
|
+
unsetPath = true;
|
|
4790
|
+
}
|
|
4791
|
+
}
|
|
4792
|
+
}
|
|
4793
|
+
if (unsetPath) {
|
|
4794
|
+
_unset(formData, path);
|
|
4795
|
+
} else {
|
|
4796
|
+
_set(formData, path, valueForPath);
|
|
4797
|
+
}
|
|
4771
4798
|
}
|
|
4772
4799
|
const newState = this.getStateFromProps(this.props, inputForDefaults, void 0, void 0, void 0, true);
|
|
4773
4800
|
formData = newState.formData;
|