@rjsf/utils
Version:
Utility functions for @rjsf/core
19 lines (18 loc) • 1.27 kB
TypeScript
import { FormContextType, Registry, RJSFSchema, StrictRJSFSchema, UiSchema } from './types.js';
/** Returns the unique list of schema types for all of the options in a anyOf/oneOf
*
* @param schemas - The list of schemas representing the XxxOf options
* @returns - All of the unique types contained within the oneOf list
*/
export declare function getSchemaTypesForXxxOf<S extends StrictRJSFSchema = RJSFSchema>(schemas: S[]): string | string[];
/** Determines whether the field information from the combination of `schema` and `required` along with the
* `enableOptionalDataFieldForType` settings from the global UI options in the `registry` all indicate that this field
* should be rendered with the Optional Data Controls UI.
*
* @param registry - The `registry` object
* @param schema - The schema for the field
* @param required - Flag indicating whether the field is required
* @param [uiSchema] - The uiSchema for the field
* @return - True if the field should be rendered with the optional field UI, otherwise false
*/
export default function shouldRenderOptionalField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(registry: Registry<T, S, F>, schema: S, required: boolean, uiSchema?: UiSchema<T, S, F>): boolean;