UNPKG

@rjsf/core

Version:

A simple React component capable of building HTML forms out of a JSON schema.

28 lines 2.35 kB
import { EnumOptionsType, FieldProps, FormContextType, RJSFSchema, SchemaUtilsType, StrictRJSFSchema, UiSchema } from '@rjsf/utils'; /** Gets the selected option from the list of `options`, using the `selectorField` to search inside each `option` for * the `properties[selectorField].default(or const)` that matches the given `value`. * * @param options - The list of schemas each representing a choice in the `oneOf` * @param selectorField - The name of the field that is common in all of the schemas that represents the selector field * @param value - The current value of the selector field from the data */ export declare function getSelectedOption<S extends StrictRJSFSchema = RJSFSchema>(options: EnumOptionsType<S>[], selectorField: string, value: unknown): S | undefined; /** Computes the `enumOptions` array from the schema and options. * * @param schema - The schema that contains the `options` * @param options - The options from the `schema` * @param schemaUtils - The SchemaUtilsType object used to call retrieveSchema, * @param [uiSchema] - The optional uiSchema for the schema * @param [formData] - The optional formData associated with the schema * @returns - The list of enumOptions for the `schema` and `options` * @throws - Error when no enum options were computed */ export declare function computeEnumOptions<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(schema: S, options: S[], schemaUtils: SchemaUtilsType<T, S, F>, uiSchema?: UiSchema<T, S, F>, formData?: T): EnumOptionsType<S>[]; /** The `LayoutMultiSchemaField` is an adaptation of the `MultiSchemaField` but changed considerably to only * support `anyOf`/`oneOf` fields that are being displayed in a `LayoutGridField` where the field selection is shown as * a radio group by default. It expects that a `selectorField` is provided (either directly via the `discriminator` * field or indirectly via `ui:optionsSchemaSelector` in the `uiSchema`) to help determine which `anyOf`/`oneOf` schema * is active. If no `selectorField` is specified, then an error is thrown. */ export default function LayoutMultiSchemaField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: FieldProps<T, S, F>): import("react/jsx-runtime").JSX.Element; //# sourceMappingURL=LayoutMultiSchemaField.d.ts.map