@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.
@@ -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
- oneOf: schema.oneOf
57
- .map((option) => {
58
- if (isObject(option)) {
59
- return {
60
- ...option,
61
- title: option.title || (option.const === true ? yes : no),
62
- };
63
- }
64
- return undefined;
65
- })
66
- .filter((o: any) => o) as S[], // cast away the error that typescript can't grok is fixed
67
- } as unknown as S);
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
- enum: enums,
86
- // NOTE: enumNames is deprecated, but still supported for now.
87
- enumNames: schemaWithEnumNames.enumNames,
88
- } as unknown as S);
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 ? <Markdown>{description}</Markdown> : description;
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>