import { Select, CheckboxOption, SelectOption, FieldRule, Input, Switch, InputNumber, Radio, RadioGroup, DatePicker, TimePicker, RangePicker, MonthPicker, YearPicker, QuarterPicker, WeekPicker, Textarea, Cascader, CascaderOption, TreeSelect, FormItem, Upload, InputSearch, InputPassword, TableSortable, ButtonProps, Table } from '@arco-design/web-vue'; import { default as Editor } from '@tinymce/tinymce-vue'; import { VNode } from 'vue'; /** form表单元素基础配置 */ export type BaseFormExtra = { rules?: FieldRule | FieldRule[]; if?: boolean | ((...args: any) => boolean); span?: number; labelTips?: string | (() => string); inputTips?: string | (() => string | VNode); width?: string | number; disabled?: boolean; } & InstanceType["$props"]; export type BaseFormRadioGroup = BaseFormExtra & { type?: "button" | "radio"; } & InstanceType["$props"]; export type BaseFormRadio = InstanceType["$props"] & { label: string; }; export type BaseFormColor = { defaultColor?: string; change?: (color: string) => void; }; export type BaseFormInput = BaseFormExtra & InstanceType["$props"] & InstanceType["$props"] & InstanceType["$props"] & { append?: string; prepend?: string; debounce?: number; formType?: "input" | "password" | "search"; }; export type BaseModalSelect = BaseFormExtra & InstanceType["$props"] & { modalClick?: () => void; }; export type BaseFormTextarea = BaseFormExtra & InstanceType["$props"]; export type BaseFormInputNumber = BaseFormExtra & InstanceType["$props"] & { append?: string; prepend?: string; debounce?: number; }; type CheckboxGroupProps = { max?: number; options?: Array; direction?: "horizontal" | "vertical"; disabled?: boolean; }; type CheckboxProps = CheckboxOption; export type BaseFormCheckboxGroup = Partial & BaseFormExtra & { labelKey?: string; valueKey?: string; }; export type BaseFormCheckbox = Partial; export type BaseFormSelect = BaseFormExtra & InstanceType["$props"]; export type BaseFormSelectOptions = Partial; export type BaseFormCascader = BaseFormExtra & InstanceType["$props"]; export type BaseFormCascaderOptions = Partial; export type BaseFormSwitch = BaseFormExtra & InstanceType["$props"]; export type DateType = "date" | "month" | "year" | "quarter" | "week" | "range"; export type BaseFormDate = BaseFormExtra & InstanceType["$props"] & { allowClear?: boolean; type?: DateType; }; export type BaseFormDatePicker = BaseFormDate & InstanceType["$props"]; export type BaseFormMonthPicker = BaseFormDate & InstanceType["$props"]; export type BaseFormYearPicker = BaseFormDate & InstanceType["$props"]; export type BaseFormQuarterPicker = BaseFormDate & InstanceType["$props"]; export type BaseFormWeekPicker = BaseFormDate & InstanceType["$props"]; export type BaseFormRangePicker = BaseFormDate & InstanceType["$props"]; export type BaseFormTime = BaseFormExtra & InstanceType["$props"]; export type BaseFormUpload = BaseFormExtra & InstanceType["$props"] & { maxSize?: number; }; export type BaseTreeSelect = BaseFormExtra & InstanceType["$props"]; export type BaseEditor = BaseFormExtra & { theme?: "dark" | "light"; height?: number; uploadProps?: InstanceType["$props"] & { maxSize?: number; }; editorProps?: InstanceType["$props"]; }; export type _TableColumn = { /** 类型,默认default */ type?: "default" | "slot" | "btns" | "image" | "time" | "dictionary" | "date" | "status" | "link" | "html" | "custom"; /** 自定义回调 */ callback?: (row: Record, index: number) => any; /** prop */ prop: string; /** 标签 */ label?: string; /** 是否显示 */ if?: boolean; /** 宽度 */ width?: number; /** 按钮组 */ btns?: _Btn[]; /** 点击事件 */ handler?: (row?: any, index?: number) => void; /** 水平对齐方式 */ align: "left" | "right" | "center"; /** 是否固定列 */ fixed: "left" | "right"; /** 字典自定义key */ labelKey?: string; valueKey?: string; /** 是否支持排序 */ sortable?: TableSortable; /** 字典 */ dictionary?: ({ label?: string; value?: string | number; } & Record)[]; /** 左侧扩展 */ leftExtra?: string; /** 右侧扩展 */ rightExtra?: string; /** 时间格式分割 */ format?: string; tooltip?: Record; /** 颜色 */ color?: string; /** 默认key */ rowKey: "id"; /** 时间格式分割 */ split?: string; /** 是否在dialog中显示列 */ hideInDialog?: boolean; /** 是否在列设置中锁定(不可隐藏/拖拽固定,但仍展示在列表中),常用于操作列 */ disableSetting?: boolean; }; /** 表格配置定义 */ export type _TableConfig = { refreshFn?: () => void; showRefresh?: boolean; showColumnSetting?: boolean; columnSettingKey?: string | false; maxHeight?: number | string | "auto"; /** 左上角标签 */ tlBtns?: _Tabs; /** 右上角按钮 */ trBtns?: _Btn[]; /** 左下角按钮 */ blBtns?: _Btn[]; /** 是否禁用选中行 */ disableSelectedRow?: boolean; /** 列表组 */ columns?: _TableColumn[]; rowKey?: string; totalKey?: string; active?: string | number; sizeList?: number[]; size?: number; pageKey?: string; sizeKey?: string; selectLimit?: number; allowFlatten?: boolean; arcoProps: InstanceType["$props"]; quickSelect?: boolean; }; /** 列设置项定义(展示/隐藏、排序、固定) */ export type ColumnSettingItem = { /** 列唯一标识 */ key: string; /** 列展示文案 */ label: string; /** 是否展示 */ visible: boolean; /** 固定方向 */ fixed?: "left" | "right"; /** 是否禁止在设置中操作(锁定列) */ disableSetting?: boolean; }; /** 表格请求事件定义 */ export type _TableReq = { fn: (params: any) => Promise; params?: Record; }; /** 按钮定义 */ export type _Btn = { /** 标签(按钮文字) */ label: string | ((row: any) => string); /** 点击事件 */ handler?: (item: _Btn) => void; /** 是否展示,仅false时隐藏 */ if?: boolean | (() => boolean); /** 是否禁用,仅true时禁用 */ disabled?: boolean | (() => boolean); /** 颜色 */ color?: string; /** 加载文案 */ loadingText?: string; /** 图标 */ icon?: () => VNode; } & ButtonProps; /** 表格tabs定义 */ export type _Tabs = { /** 标题 */ label: string; /** 值 */ value: string | number; /** 计数 */ count?: string | number; /** 是否显示 */ if?: boolean; }[]; export {};