export interface IDynamicFormBuilder { title?: string; name: string; justified?: boolean; pages: IFormBuilderPage[]; formColor?: 'BASIC' | 'PRIMARY' | 'ACCENT' | 'WARN'; formAppearance?: 'LEGACY' | 'STANDARD' | 'FILL' | 'OUTLINE'; buttonColor?: 'BASIC' | 'PRIMARY' | 'ACCENT' | 'WARN'; buttonStyle?: 'BASIC' | 'RAISED' | 'STROKED' | 'FLAT'; buttonResetName?: string; buttonSubmitName?: string; buttonNextName?: string; buttonPrevName?: string; stepperStyle?: 'TABS' | 'WIZARD'; buttonNextAlwaysEnabled?: boolean; buttonSubmitAlwaysPresent?: boolean; showStepper?: boolean; showResetButton?: boolean; readonly?: boolean; language?: string; positionPageLabel?: string; } export interface IFormBuilderPage { title?: string; name: string; position?: number; hidden?: boolean | string; sections: IFormBuilderSection[]; } export interface IFormBuilderSection { title?: string; name: string; validators?: IFormBuilderValidatorSection[]; rows: IFormBuilderRow[]; } export interface IFormBuilderRow { cellSize?: number; cells: IFormBuilderCell[]; } export interface IFormBuilderValidatorSection { value?: any; error?: string; } export interface IFormValidator { type: 'EXPRESSION' | 'VALIDATOR' | 'MIN' | 'MAX' | 'MINLENGTH' | 'MAXLENGTH' | 'REQUIRED' | 'PATTERN'; value?: any; error?: string; } export interface IFormBuilderCell { type: string; cellSize: number; controlName: string; label: string; defaultValue?: string; min?: number; max?: number; endpoint?: string; options?: any[]; valueName?: string; descriptionName?: string; link?: string; newPage?: boolean; buttonColor?: string; buttonStyle?: string; disabled?: (boolean | string)[]; hidden?: (boolean | string)[]; validators?: IFormValidator[]; } export const ConstFormColor: string[] = ['BASIC', 'PRIMARY', 'ACCENT', 'WARN']; export const ConstFormStyle: string[] = ['BASIC', 'RAISED', 'STROKED', 'FLAT']; export const ConstFormAppearance: string[] = ['LEGACY', 'STANDARD', 'FILL', 'OUTLINE']; export const ConstValidator: string[] = ['EXPRESSION', 'VALIDATOR', 'MIN', 'MAX', 'MINLENGTH', 'MAXLENGTH', 'REQUIRED', 'PATTERN']; export const ConstFormStepperStyle: string[] = ['TABS', 'WIZARD']; export const ConstPositionPageLabel: string[] = ['CENTER TOP', 'END TOP', 'START TOP', 'CENTER BOTTOM', 'END BOTTOM', 'START BOTTOM', 'TOP', 'BOTTOM', 'CENTER', 'END', 'START']; export const ConstControlsList: IFormBuilderCell[] = [ { type: 'TEXT', controlName: 'text_', label: 'Text', cellSize: 2 }, { type: 'TEXTAREA', controlName: 'textarea_', label: 'Textarea', cellSize: 4, }, { type: 'NUMBER', controlName: 'number_', label: 'Number', cellSize: 2 }, { type: 'SELECT', controlName: 'select_', label: 'Select', cellSize: 2, options: [{ id: 0, label: 'Selected value 0' }, { id: 1, label: 'Selected value 1' }, { id: 2, label: 'Selected value 2' }], valueName: 'id', descriptionName: 'label' }, { type: 'AUTOCOMPLETE', controlName: 'autocomplete_', label: 'Autocomplete', cellSize: 2, options: [{ id: 0, label: 'Complete value 0' }, { id: 1, label: 'Complete value 1' }, { id: 2, label: 'Complete value 2' }], valueName: 'id', descriptionName: 'label' }, { type: 'CHIPS', controlName: 'chips_', label: 'Chips', cellSize: 2, options: [{ id: 0, label: 'Chip value 0' }, { id: 1, label: 'Chip value 1' }, { id: 2, label: 'Chip value 2' }], valueName: 'id', descriptionName: 'label' }, { type: 'RADIO', controlName: 'radio_', label: 'Radio', cellSize: 2, options: [{ id: 0, label: 'Selected value 0' }, { id: 1, label: 'Selected value 1' }, { id: 2, label: 'Selected value 2' }], valueName: 'id', descriptionName: 'label' }, { type: 'CHECKBOX', controlName: 'checkbox_', label: 'Checkbox', cellSize: 1 }, { type: 'DATE', controlName: 'date_', label: 'Date', cellSize: 2 }, { type: 'FILE', controlName: 'file_', label: 'File', cellSize: 2 }, { type: 'LINK', controlName: 'link_', label: 'Link', cellSize: 2 }, { type: 'HIDDEN', controlName: 'hidden_', label: 'Hidden', cellSize: 2 } ];