/** * Form Schema Type Definitions * Copied from builder for standalone renderer */ import type { visualMode } from "@syncfusion/ej2-react-dropdowns"; export interface ButtonClickEventArgs { buttonId: string; buttonLabel: string; event: React.MouseEvent; } export type ConditionalOperator = 'equal' | 'notEqual' | 'greaterThan' | 'lessThan' | 'greaterThanOrEqual' | 'lessThanOrEqual' | 'in' | 'notIn' | 'contains' | 'notContains'; export interface ConditionalRule { field: string; operator: ConditionalOperator; value: any; } export interface CompositeConditionalRule { condition: 'and' | 'or'; rules: (ConditionalRule | CompositeConditionalRule)[]; } export type ConditionType = ConditionalRule | CompositeConditionalRule; export interface ChoiceBasedFieldRule { primaryFieldId: string; choiceMapping: Record; showAllWhenNotMapped?: boolean; } export interface FormComponentConditions { visibleWhen?: ConditionType; hideWhen?: ConditionType; readOnlyWhen?: ConditionType; disabledWhen?: ConditionType; requiredWhen?: ConditionType; setValueWhen?: { condition: ConditionType; value: any; }; choiceBasedField?: ChoiceBasedFieldRule; } export interface FormSchema { version: string; components: FormComponent[]; } export interface FormComponent { id: string; type: 'textbox' | 'textarea' | 'number' | 'email' | 'url' | 'phone' | 'password' | 'checkbox' | 'checkboxGroup' | 'radio' | 'dropdown' | 'multiselect' | 'button' | 'date' | 'dateTime' | 'time' | 'dateRange' | 'switch' | 'signature' | 'rating' | 'imageEditor' | 'fileUpload' | 'rangeSlider' | 'colorPicker' | 'inputMask' | 'message' | 'panel' | 'table' | 'tabs' | 'dataGrid' | 'card' | 'splitButton' | 'richTextEditor' | 'staticHtml'; textboxType?: string; label: string; name: string; description?: string | undefined; prefix?: string | undefined; suffix?: string | undefined; placeholder?: string; defaultValue?: any; disabled?: boolean; visible?: boolean; tooltip?: string; hideBorders?: boolean; hideLabel?: boolean; cssClass?: string; multiline?: boolean; showClearButton?: boolean; showCloseIcon?: boolean; showIcon?: boolean; variant?: string; severity?: string; content?: string; showTodayButton?: boolean; htmlAttributes?: Record; labelPosition?: 'Top' | 'Bottom' | 'Left' | 'Right'; position?: 'center' | 'left' | 'right'; fieldLabelPosition?: 'After' | 'Before'; labelWidth?: string; floatLabelType?: 'Never' | 'Always' | 'Auto'; readOnly?: boolean; autocomplete?: boolean; cols?: number; textareaRows?: number; checked?: boolean; indeterminate?: boolean; offLabel?: string; onLabel?: string; buttonType?: 'button' | 'submit' | 'reset'; iconCss?: string; iconPosition?: 'Left' | 'Right'; style?: string; buttonsGroups?: ButtonDefinition[]; gap?: string; onClick?: (event: React.MouseEvent) => void; decimals?: number; currency?: string; format?: string; numberFormat?: string; allowReset?: boolean; itemsCount?: number; precision?: number | string; showRatingTooltip?: boolean; showRatingLabel?: boolean; ratingLabelPosition?: 'Top' | 'Bottom' | 'Left' | 'Right'; height?: number | null; width?: number | null; backgroundColor?: string; strokeColor?: string; maximumStrokeWidth?: number; minimumStrokeWidth?: number; velocity?: number; enableOpacity?: boolean; showNoColor?: boolean; showButtons?: boolean; showRecentColors?: boolean; orientation?: 'Horizontal' | 'Vertical'; allowExtensions?: string; saveUrl?: string; removeUrl?: string; buttons?: {}; allowMultiple?: boolean; showFileList?: boolean; calendarMode?: string; dayHeaderFormat?: string; depth?: string; firstDayOfWeek?: number; start?: string; allowEdit?: boolean; enabled?: boolean; timeFormat?: string; step?: number; startDate?: string; endDate?: string; separator?: string; mask?: string; customCharacters?: Record; promptChar?: string; allowCustomValue?: boolean; addTagOnBlur?: boolean; delimiterChar?: string; visualMode?: visualMode; showSelectAll?: boolean; selectAllText?: string; unSelectAllText?: string; showDropDownIcon?: boolean; validateOn?: 'Change' | 'Blur'; pageSize?: number; size?: string; allowPaging?: boolean; allowAdding?: boolean; allowEditing?: boolean; allowDeleting?: boolean; required?: boolean; minLength?: number | null; maxLength?: number | null; min?: number | null; minimum?: number | null; max?: number | null; minDate?: string; maxDate?: string; minValue?: number | null; maxValue?: number | null; minTime?: string; maxTime?: string; regex?: string; validationMessage?: string; options?: string[]; checkboxLabelPosition?: 'Before' | 'After'; layoutDirection?: 'row' | 'column'; enableHtmlSanitizer?: boolean; fields?: Record; enableVirtualization?: boolean; popupHeight?: string; popupWidth?: string; children?: FormComponent[]; rows?: number; columns?: number; messageType?: 'info' | 'success' | 'warning' | 'error'; messageContent?: string; legend?: string; cardTitle?: string; cardSubtitle?: string; columnWidths?: { columns: number; widths: number[]; }; tabItems?: Array<{ header: string; content?: FormComponent[]; }>; tableCells?: FormComponent[][][]; parentPath?: string; properties?: Record; expressionValue?: string; conditions?: FormComponentConditions; _configured?: boolean; } export interface ValidationRules { [fieldName: string]: { required?: [boolean, string]; minLength?: [number, string]; maxLength?: [number, string]; min?: [number, string]; max?: [number, string]; regex?: [string, string]; date?: [string, string]; [key: string]: any; }; } export interface ButtonDefinition { label: string; type?: 'submit' | 'reset' | 'button'; style?: 'primary' | 'flat' | 'information' | 'error' | 'success' | 'warning'; iconCss?: string; iconPosition?: 'Left' | 'Right'; disabled?: boolean; }