extended-dynamic-forms
Version:
Extended React JSON Schema Form (RJSF) v6 with custom components, widgets, templates, layouts, and form events
64 lines (62 loc) • 2.37 kB
TypeScript
import { InputProps, TextAreaProps } from 'antd/es/input';
import { DatePickerProps } from 'antd/es/date-picker';
import { InputNumberProps } from 'antd/es/input-number';
import { AntInputOptions, AntTextAreaOptions, AntDatePickerOptions, AntInputNumberOptions } from './types';
/**
* Extract Ant Design Input props from uiSchema options
*/
export declare const getAntInputProps: (options?: AntInputOptions) => Partial<InputProps>;
/**
* Extract Ant Design TextArea props from uiSchema options
*/
export declare const getAntTextAreaProps: (options?: AntTextAreaOptions) => Partial<TextAreaProps>;
/**
* Extract Ant Design DatePicker props from uiSchema options
*/
export declare const getAntDatePickerProps: (options?: AntDatePickerOptions) => Partial<DatePickerProps>;
/**
* Extract Ant Design InputNumber props from uiSchema options
*/
export declare const getAntInputNumberProps: (options?: AntInputNumberOptions) => Partial<InputNumberProps>;
/**
* Check if the widget has validation errors
*/
export declare const hasError: (rawErrors?: string[]) => boolean;
/**
* Get the appropriate empty value based on options
*/
export declare const getEmptyValue: (options: any, defaultValue?: any) => any;
/**
* Get value or empty value for controlled components
*/
export declare const getValue: (value: any, options: any, defaultValue?: any) => any;
/**
* Handle change event and return the appropriate value
*/
export declare const handleChangeValue: (value: any, options: any, defaultEmptyValue?: any) => any;
/**
* Common props for Ant Design form components
*/
export declare const getCommonAntProps: (id: string, hasError: boolean, disabled?: boolean, readonly?: boolean) => {
id: string;
status: "error" | undefined;
disabled: boolean | undefined;
};
/**
* Extract numeric constraints from JSON schema
*/
export declare const getNumericConstraints: (schema?: any) => {
min: any;
max: any;
step: any;
};
/**
* Merge options from different sources (schema, uiSchema)
* Priority: uiSchema options > schema constraints > defaults
*/
export declare const mergeOptions: (schemaOptions?: any, uiSchemaOptions?: any, defaults?: any) => any;
/**
* Convert various value types to boolean
* Handles string "true"/"false" conversions properly
*/
export declare const toBooleanValue: (value: any, defaultValue?: boolean) => boolean;