UNPKG

@antdv/pro-utils

Version:

@antdv/pro-utils

143 lines (142 loc) 5.87 kB
import type { AvatarProps, CascaderProps, CheckboxProps, DatePickerProps, DividerProps, FormItemProps, ImageProps, InputNumberProps, InputProps, ProgressProps, RadioProps, RateProps, SegmentedProps, SelectProps, SliderProps, SwitchProps, TimeRangePickerProps, TooltipProps, TreeSelectProps } from 'ant-design-vue'; import type { RangePickerProps } from 'ant-design-vue/lib/date-picker'; import type { NamePath } from 'ant-design-vue/lib/form/interface'; import type { TextAreaProps } from 'ant-design-vue/lib/input'; import type { ComponentPublicInstance, VNode, WatchSource } from 'vue'; import type { ProFormBaseGroupProps } from './proFormBaseGroup'; import type { UseEditableUtilType } from './useEditableArray'; export type AnyObject = Record<PropertyKey, any>; export type VNodeChildAtom = VNode | string | number | boolean | null | undefined | void; export type VueNode = VNodeChildAtom | VNodeChildAtom[] | VNode; export type MaybeUndefined<T, I> = I extends true ? T | undefined : T; export type MultiWatchSources = Array<WatchSource<unknown> | Record<string, unknown>>; export type VueInstance = ComponentPublicInstance; export type Key = string | number; export type PasswordProps = InputProps & { prefixCls?: string; inputPrefixCls?: string; action?: string; visibilityToggle?: boolean; visible?: boolean; iconRender?: (...arg: any) => any; }; export type LabelTooltipType = TooltipProps & { icon?: VNode; }; export interface ProFieldValueTypeWithFieldProps { text: InputProps; password: PasswordProps; money: Record<string, any>; index: Record<string, any>; indexBorder: Record<string, any>; option: Record<string, any>; textarea: TextAreaProps; date: DatePickerProps; dateWeek: DatePickerProps; dateMonth: DatePickerProps; dateQuarter: DatePickerProps; dateYear: DatePickerProps; dateTime: DatePickerProps; fromNow: DatePickerProps; dateRange: RangePickerProps; dateTimeRange: RangePickerProps; dateWeekRange: RangePickerProps; dateMonthRange: RangePickerProps; dateQuarterRange: RangePickerProps; dateYearRange: RangePickerProps; time: TimeRangePickerProps; timeRange: TimeRangePickerProps; select: SelectProps; checkbox: CheckboxProps; rate: RateProps; slider: SliderProps; radio: RadioProps; radioButton: RadioProps; progress: ProgressProps; percent: InputNumberProps; digit: InputNumberProps; digitRange: InputNumberProps; second: InputNumberProps; code: InputProps | TextAreaProps; jsonCode: InputProps | TextAreaProps; avatar: AvatarProps; switch: SwitchProps; image: ImageProps | InputProps; cascader: CascaderProps; treeSelect: TreeSelectProps; segmented: SegmentedProps; group: ProFormBaseGroupProps; formList: Record<string, any>; formSet: Record<string, any>; divider: DividerProps; dependency: FormItemProps; } export type ProFieldValueType = Extract<keyof ProFieldValueTypeWithFieldProps, any>; export type ProFieldValueObject<Type> = Type extends 'progress' | 'money' | 'percent' | 'image' ? { type: Type; status?: 'normal' | 'active' | 'success' | 'exception' | undefined; locale?: string; showSymbol?: ((value: any) => boolean) | boolean; showColor?: boolean; precision?: number; moneySymbol?: boolean; request?: ProFieldRequestData; width?: number; } : never; export interface PageInfo { pageSize: number; total: number; current: number; } export interface RequestOptionsType { [key: string]: any; label?: string; value?: string | number | boolean; optionType?: 'optGroup' | 'option'; options?: Array<Omit<RequestOptionsType, 'children' | 'optionType'>>; } export type ProFieldRequestData<U = any> = (params: U, props: any) => Promise<RequestOptionsType[]>; export type ProFieldValueEnumType = ProSchemaValueEnumMap | ProSchemaValueEnumObj; export interface ProFieldValueObjectType { type: 'progress' | 'money' | 'percent' | 'image'; status?: 'normal' | 'active' | 'success' | 'exception' | undefined; locale?: string; showSymbol?: ((value: any) => boolean) | boolean; showColor?: boolean; precision?: number; moneySymbol?: boolean; request?: ProFieldRequestData; width?: number; } export type ProSchemaValueEnumMap = Map<string | number | boolean, ProSchemaValueEnumType | VueNode>; export type ProSchemaValueEnumObj = Record<string, ProSchemaValueEnumType | VueNode>; export type ProFieldTextType = VueNode | Record<string, any> | Array<Record<string, any>>; export type SearchTransformKeyFn = (value: any, namePath: string, allValues: any) => any; export type SearchConvertKeyFn = (value: any, field: NamePath) => string | boolean | Record<string, any>; export type ProTableEditableFnType<T> = (value: any, record: T, index: number) => boolean; export type ProSchemaComponentTypes = 'form' | 'list' | 'descriptions' | 'table' | 'cardList' | undefined; export type ProCoreActionType<T = Record<string, unknown>> = { reload: (resetPageIndex?: boolean) => Promise<void>; reloadAndRest?: () => Promise<void>; reset?: () => void; clearSelected?: () => void; pageInfo?: PageInfo; } & Omit<UseEditableUtilType, 'newLineRecord' | 'editableKeys' | 'actionRender' | 'setEditableRowKeys'> & T; export type ProSchemaFieldProps<T> = Record<string, any> | T | Partial<InputProps>; export interface ProSchemaValueEnumType { text: VueNode; status?: string; color?: string; disabled?: boolean; } export type ProFieldFCMode = 'read' | 'edit' | 'update'; export type ParamsType = Record<string, any>; export interface ProFieldProps { light?: boolean; emptyText?: VueNode; label?: VueNode; mode?: 'read' | 'edit'; proFieldKey?: string; render?: any; readonly?: boolean; }