UNPKG

@rjsf/utils

Version:
27 lines (26 loc) 1.81 kB
import { PathSchema, FormContextType, RJSFSchema, StrictRJSFSchema, ValidatorType } from '../types.js'; /** Returns the `formData` with only the elements specified in the `fields` list * * @param formData - The data for the `Form` * @param fields - The fields to keep while filtering * @deprecated - To be removed as an exported `@rjsf/utils` function in a future release */ export declare function getUsedFormData<T = any>(formData: T | undefined, fields: string[]): T | undefined; /** Returns the list of field names from inspecting the `pathSchema` as well as using the `formData` * * @param pathSchema - The `PathSchema` object for the form * @param [formData] - The form data to use while checking for empty objects/arrays * @deprecated - To be removed as an exported `@rjsf/utils` function in a future release */ export declare function getFieldNames<T = any>(pathSchema: PathSchema<T>, formData?: T): string[][]; /** Takes a `schema` and `formData` and returns a copy of the formData with any fields not defined in the schema removed. * This is useful for ensuring that only data that is relevant to the schema is preserved. Objects with * `additionalProperties` keyword set to `true` will not have their extra fields removed. * * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary * @param schema - The schema to use for filtering the formData * @param [rootSchema] - The root schema, used to primarily to look up `$ref`s * @param [formData] - The data for the `Form` * @returns The `formData` after omitting extra data */ export default function omitExtraData<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, schema: S, rootSchema?: S, formData?: T): T | undefined;