UNPKG

ngx-antd-form-builder

Version:

Simple Drag&Drop form builder using ng-zorro-antd

148 lines (147 loc) 5.55 kB
export declare namespace NgxAntdFormBuilder { type rule = ({ required: boolean; } | { pattern: string; }) & { message: string; }; type rules = Array<rule>; type option = Record<'value' | 'label', string>; type CommonProperty = Record<'label' | 'key' | 'help', string>; type InputType = { type: 'input'; options: Record<'type' | 'width' | 'defaultValue' | 'placeholder', string> & Record<'clearable' | 'disabled', boolean> & { maxLength: number | null; }; rules: Array<rule>; } & CommonProperty; type TextareaType = { type: 'textarea'; options: Record<'width' | 'defaultValue' | 'placeholder', string> & Record<'clearable' | 'disabled', boolean> & Record<'minRows' | 'maxRows', number> & { maxLength: number | null; }; rules: Array<rule>; } & CommonProperty; type NumberType = { type: 'number'; options: Record<'width' | 'placeholder', string> & Record<'disabled', boolean> & Record<'min' | 'max' | 'precision' | 'defaultValue', number | undefined> & { step: number; }; rules: Array<rule>; } & CommonProperty; type SelectType = { type: 'select'; options: Record<'width' | 'placeholder' | 'dynamicKey', string> & Partial<Record<'dynamicInjectFuncToken' | 'dynamicEvalFuncToken', string>> & Record<'multiple' | 'disabled' | 'clearable', boolean> & { options: Array<option>; defaultValue: undefined; }; rules: Array<rule>; } & CommonProperty; type CheckboxType = { type: 'checkbox'; options: Record<'dynamicKey', string> & Partial<Record<'dynamicInjectFuncToken' | 'dynamicEvalFuncToken', string>> & Record<'disabled', boolean> & { options: Array<option>; defaultValue: unknown[]; }; rules: Array<rule>; } & CommonProperty; type RadioType = { type: 'radio'; options: Record<'dynamicKey', string> & Partial<Record<'dynamicInjectFuncToken' | 'dynamicEvalFuncToken', string>> & Record<'disabled', boolean> & { options: Array<option>; defaultValue: undefined | string; }; rules: Array<rule>; } & CommonProperty; type RateType = { type: 'rate'; options: Record<'disabled' | 'allowHalf', boolean> & { defaultValue: undefined | number; max: number; }; rules: Array<rule>; } & CommonProperty; type SliderType = { type: 'slider'; options: Record<'disabled' | 'showInput', boolean> & Record<'min' | 'max' | 'step', number> & { width: string; defaultValue: undefined | number; }; rules: Array<rule>; } & CommonProperty; type DateType = { type: 'date'; options: Record<'width' | 'placeholder', string> & { disabled: boolean; mode: 'date' | 'week' | 'month' | 'year'; defaultValue: undefined | Date; }; rules: Array<rule>; } & CommonProperty; type SwitchType = { type: 'switch'; options: Record<'defaultValue' | 'disabled', boolean>; rules: Array<rule>; } & CommonProperty; type AlertType = { type: 'alert'; options: Record<'description', string> & { type: "error" | "success" | "info" | "warning"; } & Record<'showIcon' | 'banner' | 'closable', boolean>; } & Record<'label' | 'key', string>; type TextType = { type: 'text'; options: Record<'textAlign' | 'fontFamily' | 'fontSize', string> & Record<'showRequiredMark', boolean>; } & Record<'label' | 'key', string>; type AllComponentType = InputType | TextareaType | NumberType | SelectType | CheckboxType | RadioType | DateType | RateType | SliderType | SwitchType | AlertType | TextType; type DividerLayout = { type: 'divider'; options: { orientation: "left" | "right" | "center"; }; } & Omit<CommonProperty, 'help'>; type CardLayout = { type: 'card'; list: Array<AllType>; } & Omit<CommonProperty, 'help'>; type TabsLayout = { type: 'tabs'; options: { animated: boolean; tabBarGutter: number | null; } & Record<'tabPosition' | 'type' | 'size', string>; columns: Array<option & { list: Array<AllType>; }>; } & Omit<CommonProperty, 'help'>; type GridLayout = { type: 'grid'; options: { gutter: number | null; }; columns: Array<{ span: number; list: Array<AllType>; }>; } & Omit<CommonProperty, 'help'>; type CollapseLayout = { type: 'collapse'; options: Record<'bordered' | 'expandIconPosition', string> & { accordion: unknown; ghost: boolean; }; columns: Array<option & { list: Array<AllType>; }>; } & Omit<CommonProperty, 'help'>; type AllLayout = DividerLayout | CardLayout | TabsLayout | GridLayout | CollapseLayout; type AllType = AllComponentType | AllLayout; type Config = { list: Array<AllType>; config: Record<'labelWidth', number> & Record<'labelCol' | 'wrapperCol', Record<'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl', number>> & { labelLayout: 'flex' | 'Grid'; layout: 'horizontal' | 'vertical' | 'inline'; }; }; }