UNPKG

extended-dynamic-forms

Version:

Extended React JSON Schema Form (RJSF) v6 with custom components, widgets, templates, layouts, and form events

142 lines (140 loc) 5.62 kB
import { default as React } from 'react'; import { InputProps, TextAreaProps } from 'antd/es/input'; import { DatePickerProps } from 'antd/es/date-picker'; import { InputNumberProps } from 'antd/es/input-number'; import { TitleProps } from 'antd/es/typography/Title'; import { TextProps } from 'antd/es/typography/Text'; import { ParagraphProps } from 'antd/es/typography/Paragraph'; import { DividerProps } from 'antd/es/divider'; import { AntInputOptions, AntTextAreaOptions, AntDatePickerOptions, AntInputNumberOptions, AntSliderOptions, AntRateOptions, AntTimePickerOptions, AntColorPickerOptions, AntSwitchOptions, AntImageOptions, AntAlertOptions, TitleWidgetOptions, HtmlWidgetOptions, SpacerWidgetOptions, AntDividerOptions } from './types'; import { SliderSingleProps } from 'antd/es/slider'; import { RateProps } from 'antd/es/rate'; import { TimePickerProps } from 'antd/es/time-picker'; import { ColorPickerProps } from 'antd/es/color-picker'; import { SwitchProps } from 'antd/es/switch'; import { ImageProps } from 'antd/es/image'; import { AlertProps } from 'antd/es/alert'; /** * 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>; /** * Extract Ant Design Slider props from uiSchema options */ export declare const getAntSliderProps: (options?: AntSliderOptions) => Partial<SliderSingleProps>; /** * Extract Ant Design Rate props from uiSchema options */ export declare const getAntRateProps: (options?: AntRateOptions) => Partial<RateProps>; /** * Extract Ant Design TimePicker props from uiSchema options */ export declare const getAntTimePickerProps: (options?: AntTimePickerOptions) => Partial<TimePickerProps>; /** * Extract Ant Design ColorPicker props from uiSchema options */ export declare const getAntColorPickerProps: (options?: AntColorPickerOptions) => Partial<ColorPickerProps>; /** * Extract Ant Design Switch props from uiSchema options */ export declare const getAntSwitchProps: (options?: AntSwitchOptions) => Partial<SwitchProps>; /** * Extract Ant Design Image props from uiSchema options */ export declare const getAntImageProps: (options?: AntImageOptions) => Partial<ImageProps>; /** * Extract Ant Design Alert props from uiSchema options */ export declare const getAntAlertProps: (options?: AntAlertOptions) => Partial<AlertProps>; /** * Extract typography display props for Title widget */ export declare const getTitleDisplayProps: (options?: TitleWidgetOptions) => { text?: string; renderAs: "title" | "text" | "paragraph"; align?: "left" | "center" | "right" | "justify"; prefixNode?: React.ReactNode; suffixNode?: React.ReactNode; typographyProps: Partial<TitleProps & TextProps & ParagraphProps>; }; /** * Extract rich content display props for HTML/Markdown widget */ export declare const getHtmlDisplayProps: (options?: HtmlWidgetOptions) => { content?: string; format: "html" | "markdown" | "text"; sanitizeHtml: boolean; renderAs: "paragraph" | "text"; align?: "left" | "center" | "right" | "justify"; preserveWhitespace?: boolean; markdownOptions?: HtmlWidgetOptions["markdownOptions"]; className?: string; style?: React.CSSProperties; }; export declare const getSpacerProps: (options?: SpacerWidgetOptions) => { className?: string; ariaLabel?: string; style: React.CSSProperties; }; /** * Extract Ant Design Divider props with optional icon mapping */ export declare const getAntDividerProps: (options?: AntDividerOptions) => { dividerProps: Partial<DividerProps>; content?: React.ReactNode; iconNode?: React.ReactNode; }; /** * 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;