@rjsf/core 5.19.4 → 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
 
@@ -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;