@rjsf/core 5.19.3 → 5.20.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.umd.js +67 -27
- package/dist/index.esm.js +64 -23
- package/dist/index.esm.js.map +2 -2
- package/dist/index.js +64 -23
- package/dist/index.js.map +3 -3
- package/lib/components/Form.d.ts +1 -0
- package/lib/components/Form.js +40 -1
- package/lib/components/Form.js.map +1 -1
- package/lib/components/fields/ArrayField.js +1 -1
- package/lib/components/fields/ArrayField.js.map +1 -1
- package/lib/components/fields/BooleanField.js +2 -2
- package/lib/components/fields/BooleanField.js.map +1 -1
- package/lib/components/fields/ObjectField.js +1 -1
- package/lib/components/fields/ObjectField.js.map +1 -1
- package/lib/components/fields/SchemaField.js +1 -1
- package/lib/components/fields/SchemaField.js.map +1 -1
- package/lib/components/fields/StringField.js +1 -1
- package/lib/components/fields/StringField.js.map +1 -1
- package/lib/components/templates/UnsupportedField.js +1 -1
- package/lib/components/templates/UnsupportedField.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/src/components/Form.tsx +42 -1
- package/src/components/fields/ArrayField.tsx +1 -1
- package/src/components/fields/BooleanField.tsx +24 -18
- package/src/components/fields/ObjectField.tsx +1 -1
- package/src/components/fields/SchemaField.tsx +5 -2
- package/src/components/fields/StringField.tsx +1 -1
- package/src/components/templates/UnsupportedField.tsx +1 -1
|
@@ -52,19 +52,22 @@ function BooleanField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extend
|
|
|
52
52
|
let enumOptions: EnumOptionsType<S>[] | undefined;
|
|
53
53
|
const label = uiTitle ?? schemaTitle ?? title ?? name;
|
|
54
54
|
if (Array.isArray(schema.oneOf)) {
|
|
55
|
-
enumOptions = optionsList<S>(
|
|
56
|
-
|
|
57
|
-
.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
enumOptions = optionsList<S, T, F>(
|
|
56
|
+
{
|
|
57
|
+
oneOf: schema.oneOf
|
|
58
|
+
.map((option) => {
|
|
59
|
+
if (isObject(option)) {
|
|
60
|
+
return {
|
|
61
|
+
...option,
|
|
62
|
+
title: option.title || (option.const === true ? yes : no),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return undefined;
|
|
66
|
+
})
|
|
67
|
+
.filter((o: any) => o) as S[], // cast away the error that typescript can't grok is fixed
|
|
68
|
+
} as unknown as S,
|
|
69
|
+
uiSchema
|
|
70
|
+
);
|
|
68
71
|
} else {
|
|
69
72
|
// We deprecated enumNames in v5. It's intentionally omitted from RSJFSchema type, so we need to cast here.
|
|
70
73
|
const schemaWithEnumNames = schema as S & { enumNames?: string[] };
|
|
@@ -81,11 +84,14 @@ function BooleanField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extend
|
|
|
81
84
|
},
|
|
82
85
|
];
|
|
83
86
|
} else {
|
|
84
|
-
enumOptions = optionsList<S>(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
enumOptions = optionsList<S, T, F>(
|
|
88
|
+
{
|
|
89
|
+
enum: enums,
|
|
90
|
+
// NOTE: enumNames is deprecated, but still supported for now.
|
|
91
|
+
enumNames: schemaWithEnumNames.enumNames,
|
|
92
|
+
} as unknown as S,
|
|
93
|
+
uiSchema
|
|
94
|
+
);
|
|
89
95
|
}
|
|
90
96
|
}
|
|
91
97
|
|
|
@@ -263,7 +263,7 @@ class ObjectField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends Fo
|
|
|
263
263
|
return (
|
|
264
264
|
<div>
|
|
265
265
|
<p className='config-error' style={{ color: 'red' }}>
|
|
266
|
-
<Markdown>
|
|
266
|
+
<Markdown options={{ disableParsingRawHTML: true }}>
|
|
267
267
|
{translateString(TranslatableString.InvalidObjectField, [name || 'root', (err as Error).message])}
|
|
268
268
|
</Markdown>
|
|
269
269
|
</p>
|
|
@@ -201,8 +201,11 @@ function SchemaFieldRender<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
|
|
|
201
201
|
|
|
202
202
|
const description = uiOptions.description || props.schema.description || schema.description || '';
|
|
203
203
|
|
|
204
|
-
const richDescription = uiOptions.enableMarkdownInDescription ?
|
|
205
|
-
|
|
204
|
+
const richDescription = uiOptions.enableMarkdownInDescription ? (
|
|
205
|
+
<Markdown options={{ disableParsingRawHTML: true }}>{description}</Markdown>
|
|
206
|
+
) : (
|
|
207
|
+
description
|
|
208
|
+
);
|
|
206
209
|
const help = uiOptions.help;
|
|
207
210
|
const hidden = uiOptions.widget === 'hidden';
|
|
208
211
|
|
|
@@ -35,7 +35,7 @@ function StringField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
|
|
|
35
35
|
} = props;
|
|
36
36
|
const { title, format } = schema;
|
|
37
37
|
const { widgets, formContext, schemaUtils, globalUiOptions } = registry;
|
|
38
|
-
const enumOptions = schemaUtils.isSelect(schema) ? optionsList(schema) : undefined;
|
|
38
|
+
const enumOptions = schemaUtils.isSelect(schema) ? optionsList<S, T, F>(schema, uiSchema) : undefined;
|
|
39
39
|
let defaultWidget = enumOptions ? 'select' : 'text';
|
|
40
40
|
if (format && hasWidget<T, S, F>(schema, format, widgets)) {
|
|
41
41
|
defaultWidget = format;
|
|
@@ -27,7 +27,7 @@ function UnsupportedField<T = any, S extends StrictRJSFSchema = RJSFSchema, F ex
|
|
|
27
27
|
return (
|
|
28
28
|
<div className='unsupported-field'>
|
|
29
29
|
<p>
|
|
30
|
-
<Markdown>{translateString(translateEnum, translateParams)}</Markdown>
|
|
30
|
+
<Markdown options={{ disableParsingRawHTML: true }}>{translateString(translateEnum, translateParams)}</Markdown>
|
|
31
31
|
</p>
|
|
32
32
|
{schema && <pre>{JSON.stringify(schema, null, 2)}</pre>}
|
|
33
33
|
</div>
|