UNPKG

tdesign-pro-component

Version:

ProComponents tdesign-vue-next + Vue3 + TS

82 lines (81 loc) 3.25 kB
import { Optional, PromiseFunction, VueNode, WithFalse } from '@tdesign-pro-component/utils'; import { ButtonProps, FormItemProps, FormProps, FormRule, FormRules, LoadingProps, TNode, UploadProps, ValueType } from 'tdesign-vue-next'; import { ProFormCheckboxProps } from '../ProFormCheckbox'; import { ProFormRadioProps } from '../ProFormRadio/types'; import { ProFormTextProps } from '../ProFormText'; import { ProFormInputNumberProps } from '../ProFormInputNumber'; import { ProFormTextareaProps } from '../ProFormTextarea'; import { ProFormSelectProps } from '../ProFormSelect'; import { ProFormDatepickerProps } from '../ProFormDatepicker'; import { ProFormTreeSelectProps } from '../ProFormTreeSelect'; import { VNode } from 'vue'; export type ProFormItemType = 'text' | 'treeSelect' | 'number' | 'textarea' | 'select' | 'radio' | 'checkbox' | 'datepicker' | 'upload'; export type FilterKey = 'name' | 'modelValue'; export interface ProFormProps { options: ProFormOption[]; request?: PromiseFunction<any>; rules?: FormRules; labelAlign?: 'left' | 'top' | 'right'; labelWidth?: string | number; marginY?: number; readonly?: boolean; disabled?: boolean; layout?: 'vertical' | 'inline'; footerAligin?: 'left' | 'center' | 'right'; resetText?: string | WithFalse<VueNode>; submitText?: string | WithFalse<VueNode>; showReset?: boolean; formProps?: FormProps; filterEmptyStr?: boolean; submitFilter?: boolean; submitButtonProps?: ButtonProps; resetButtonProps?: ButtonProps; hideFooter?: boolean; footer?: WithFalse<VueNode>; loading?: boolean; loadingText?: string; loadingProps?: LoadingProps; } export interface ProFormOption { name: string; hidden?: boolean; type?: ProFormItemType; placeholder?: string; labelName?: string; valueName?: string; childrenName?: string; label?: string | TNode | VNode | (() => TNode | VNode); data?: any[] | PromiseFunction<any[]>; multiple?: boolean; range?: boolean; disabled?: boolean; readonly?: boolean; rules?: FormRule[]; checkboxProps?: Optional<ProFormCheckboxProps, FilterKey | 'data'>; radioProps?: Optional<ProFormRadioProps, FilterKey | 'data'>; textProps?: Optional<ProFormTextProps, FilterKey>; numberProps?: Optional<ProFormInputNumberProps, FilterKey>; textareaProps?: Optional<ProFormTextareaProps, FilterKey>; selectProps?: Optional<ProFormSelectProps, FilterKey | 'data'>; datepickerProps?: Optional<ProFormDatepickerProps, FilterKey>; treeSelectProps?: Optional<ProFormTreeSelectProps, FilterKey | 'data'>; uploadProps?: UploadProps; urlName?: string; span?: number; offset?: number; initalValue?: ValueType | Array<ValueType>; formItemProps?: FormItemProps; onChange?: (value: any, name?: string) => void; } export interface ProFormRef { getFormValue: () => any; submit: () => void; reset: () => void; initForm: () => void; setItem: (key: string, value: any) => void; resetRequest: () => void; validate: () => Promise<any>; } export interface IObjectWithPossibleEmptyStrings { [key: string]: string | IObjectWithPossibleEmptyStrings | null | undefined; }