@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/core.umd.js
CHANGED
|
@@ -2151,7 +2151,9 @@
|
|
|
2151
2151
|
[fieldId, onChange]
|
|
2152
2152
|
);
|
|
2153
2153
|
const FieldComponent = getFieldComponent(schema, uiOptions, registry);
|
|
2154
|
-
const
|
|
2154
|
+
const isDeprecated = Boolean(schema.deprecated);
|
|
2155
|
+
const deprecatedHandling = isDeprecated ? uiOptions.deprecatedHandling ?? "label" : void 0;
|
|
2156
|
+
const disabled = Boolean(uiOptions.disabled ?? props.disabled) || deprecatedHandling === "disable";
|
|
2155
2157
|
const readonly = Boolean(uiOptions.readonly ?? (props.readonly || props.schema.readOnly || schema.readOnly));
|
|
2156
2158
|
const uiSchemaHideError = uiOptions.hideError;
|
|
2157
2159
|
const hideError = uiSchemaHideError === void 0 ? props.hideError : Boolean(uiSchemaHideError);
|
|
@@ -2214,9 +2216,12 @@
|
|
|
2214
2216
|
} else {
|
|
2215
2217
|
label = utils.ADDITIONAL_PROPERTY_FLAG in schema ? name : uiOptions.title || props.schema.title || schema.title || props.title || name;
|
|
2216
2218
|
}
|
|
2219
|
+
if (deprecatedHandling === "label") {
|
|
2220
|
+
label = registry.translateString(utils.TranslatableString.DeprecatedLabel, [label]);
|
|
2221
|
+
}
|
|
2217
2222
|
const description = uiOptions.description || props.schema.description || schema.description || "";
|
|
2218
2223
|
const help = uiOptions.help;
|
|
2219
|
-
const hidden = uiOptions.widget === "hidden";
|
|
2224
|
+
const hidden = uiOptions.widget === "hidden" || deprecatedHandling === "hide";
|
|
2220
2225
|
const classNames = ["rjsf-field", `rjsf-field-${utils.getSchemaType(schema)}`];
|
|
2221
2226
|
if (!hideError && __errors && __errors.length > 0) {
|
|
2222
2227
|
classNames.push("rjsf-field-error");
|
|
@@ -4232,7 +4237,26 @@
|
|
|
4232
4237
|
if (newValue === ADDITIONAL_PROPERTY_KEY_REMOVE) {
|
|
4233
4238
|
_unset(formData, path);
|
|
4234
4239
|
} else if (!isRootPath) {
|
|
4235
|
-
|
|
4240
|
+
let unsetPath = false;
|
|
4241
|
+
let valueForPath = newValue;
|
|
4242
|
+
if (newValue === void 0) {
|
|
4243
|
+
const lastSegment = path[path.length - 1];
|
|
4244
|
+
if (typeof lastSegment === "number") {
|
|
4245
|
+
valueForPath = null;
|
|
4246
|
+
} else {
|
|
4247
|
+
const { field } = schemaUtils.findFieldInSchema(schema, path, oldFormData);
|
|
4248
|
+
const leaf = field;
|
|
4249
|
+
const isOneOfOrAnyOfLeaf = leaf && (utils.ONE_OF_KEY in leaf || utils.ANY_OF_KEY in leaf);
|
|
4250
|
+
if (!isOneOfOrAnyOfLeaf && leaf !== void 0) {
|
|
4251
|
+
unsetPath = true;
|
|
4252
|
+
}
|
|
4253
|
+
}
|
|
4254
|
+
}
|
|
4255
|
+
if (unsetPath) {
|
|
4256
|
+
_unset(formData, path);
|
|
4257
|
+
} else {
|
|
4258
|
+
set(formData, path, valueForPath);
|
|
4259
|
+
}
|
|
4236
4260
|
}
|
|
4237
4261
|
const newState = this.getStateFromProps(this.props, inputForDefaults, void 0, void 0, void 0, true);
|
|
4238
4262
|
formData = newState.formData;
|
package/dist/index.cjs
CHANGED
|
@@ -2291,7 +2291,9 @@ function SchemaFieldRender(props) {
|
|
|
2291
2291
|
[fieldId, onChange]
|
|
2292
2292
|
);
|
|
2293
2293
|
const FieldComponent = getFieldComponent(schema, uiOptions, registry);
|
|
2294
|
-
const
|
|
2294
|
+
const isDeprecated = Boolean(schema.deprecated);
|
|
2295
|
+
const deprecatedHandling = isDeprecated ? uiOptions.deprecatedHandling ?? "label" : void 0;
|
|
2296
|
+
const disabled = Boolean(uiOptions.disabled ?? props.disabled) || deprecatedHandling === "disable";
|
|
2295
2297
|
const readonly = Boolean(uiOptions.readonly ?? (props.readonly || props.schema.readOnly || schema.readOnly));
|
|
2296
2298
|
const uiSchemaHideError = uiOptions.hideError;
|
|
2297
2299
|
const hideError = uiSchemaHideError === void 0 ? props.hideError : Boolean(uiSchemaHideError);
|
|
@@ -2354,9 +2356,12 @@ function SchemaFieldRender(props) {
|
|
|
2354
2356
|
} else {
|
|
2355
2357
|
label = import_utils11.ADDITIONAL_PROPERTY_FLAG in schema ? name : uiOptions.title || props.schema.title || schema.title || props.title || name;
|
|
2356
2358
|
}
|
|
2359
|
+
if (deprecatedHandling === "label") {
|
|
2360
|
+
label = registry.translateString(import_utils11.TranslatableString.DeprecatedLabel, [label]);
|
|
2361
|
+
}
|
|
2357
2362
|
const description = uiOptions.description || props.schema.description || schema.description || "";
|
|
2358
2363
|
const help = uiOptions.help;
|
|
2359
|
-
const hidden = uiOptions.widget === "hidden";
|
|
2364
|
+
const hidden = uiOptions.widget === "hidden" || deprecatedHandling === "hide";
|
|
2360
2365
|
const classNames = ["rjsf-field", `rjsf-field-${(0, import_utils11.getSchemaType)(schema)}`];
|
|
2361
2366
|
if (!hideError && __errors && __errors.length > 0) {
|
|
2362
2367
|
classNames.push("rjsf-field-error");
|
|
@@ -4578,7 +4583,26 @@ var Form = class extends import_react21.Component {
|
|
|
4578
4583
|
if (newValue === ADDITIONAL_PROPERTY_KEY_REMOVE) {
|
|
4579
4584
|
(0, import_unset.default)(formData, path);
|
|
4580
4585
|
} else if (!isRootPath) {
|
|
4581
|
-
|
|
4586
|
+
let unsetPath = false;
|
|
4587
|
+
let valueForPath = newValue;
|
|
4588
|
+
if (newValue === void 0) {
|
|
4589
|
+
const lastSegment = path[path.length - 1];
|
|
4590
|
+
if (typeof lastSegment === "number") {
|
|
4591
|
+
valueForPath = null;
|
|
4592
|
+
} else {
|
|
4593
|
+
const { field } = schemaUtils.findFieldInSchema(schema, path, oldFormData);
|
|
4594
|
+
const leaf = field;
|
|
4595
|
+
const isOneOfOrAnyOfLeaf = leaf && (import_utils50.ONE_OF_KEY in leaf || import_utils50.ANY_OF_KEY in leaf);
|
|
4596
|
+
if (!isOneOfOrAnyOfLeaf && leaf !== void 0) {
|
|
4597
|
+
unsetPath = true;
|
|
4598
|
+
}
|
|
4599
|
+
}
|
|
4600
|
+
}
|
|
4601
|
+
if (unsetPath) {
|
|
4602
|
+
(0, import_unset.default)(formData, path);
|
|
4603
|
+
} else {
|
|
4604
|
+
(0, import_set5.default)(formData, path, valueForPath);
|
|
4605
|
+
}
|
|
4582
4606
|
}
|
|
4583
4607
|
const newState = this.getStateFromProps(this.props, inputForDefaults, void 0, void 0, void 0, true);
|
|
4584
4608
|
formData = newState.formData;
|