declare module 'global-type' { import { ElTable, ElTableColumn, ElInput, ElInputNumber, ElAutocomplete, ElSwitch, ElRadioGroup, ElRadio, ElCheckboxGroup, ElCheckbox, ElSelect, ElOptionGroup, ElOption, ElDatePicker, ElForm, ElFormItem, ElRow, ElCol, ElCheckboxButton, ElRadioButton, } from 'element-plus' import type { VNode, Component, DefineComponent, VNodeProps } from 'vue' import BaseTable from '@/components/element/BaseTable.vue' import BaseForm from '@/components/element/BaseForm.vue' import BaseSelect from '@/components/element/BaseSelect.vue' import BaseCheckBox from '@/components/element/BaseCheckBox.vue' import BaseRadio from '@/components/element/BaseRadio.vue' import type { TableProps, FormProps, FormItemProps, InputProps, InputNumberProps, RadioProps, CheckboxProps, AutocompleteProps, SwitchProps, FormRules, FormItemRule, RowProps, ColProps, SelectOptionProxy, } from 'element-plus' import type { TableColumnCtx } from 'element-plus/es/components/table/src/table-column/defaults' import MarkHeaderVue from '@/components/shared/MarkHeader.vue' export type MarkHeaderInstance = InstanceType export type ExtractComponentProps = Mutable< Omit['$props'], keyof VNodeProps> > export type CI = { column: TableColumnCtx $index: number } export type Filters = { text: string value: string }[] export type FilterMethods = (value: any, row: T, column: TableColumnCtx) => void export interface EpTableProps extends AssignKeys, Partial>> { columns?: EpTableColumn[] } export type EpTableColumn = AssignKeys< ExtractComponentProps, Partial<{ type: 'selection' | 'index' | 'expand' renderHeader: (data: CI) => VNode sortMethod: (a: T, b: T) => number sortBy: string | ((row: T, index: number) => string) | string[] formatter: (row: T, column: TableColumnCtx, cellValue: any, index: number) => VNode | string align: 'left' | 'center' | 'right' headerAlign: 'left' | 'center' | 'right' selectable: (row: T, index: number) => boolean filters: Filters filterMethod: FilterMethods }> > & { slotName?: string } export interface FormSupportComponentMap { input: typeof ElInput inputNumber: typeof ElInputNumber autocomplete: typeof ElAutocomplete switch: typeof ElSwitch radio: typeof BaseRadio checkbox: typeof BaseCheckBox select: typeof BaseSelect date: typeof ElDatePicker dateTime: typeof ElDatePicker } export type ElFormItemProps = Omit< AssignKeys, Partial>, 'lineMessage' > export type FormItemCustomProp> = { hidden?: boolean slotType?: T slotName?: string slot?: Partial, Mutable>> } export type WithCustomProp> = AssignKeys< ElFormItemProps, FormItemCustomProp > export type FormItemInput = WithCustomProp<'input', InputProps> export type FormItemInputNumber = WithCustomProp<'inputNumber', InputNumberProps> export type FormItemAutocomplete = WithCustomProp<'autocomplete', AutocompleteProps> export type FormItemSwitch = WithCustomProp<'switch', SwitchProps> export type BaseRadioProp = AssignKeys< ExtractComponentProps, RadioProps & { slotLabel?: string | VNode } > export type BaseRadioButtonProp = AssignKeys< ExtractComponentProps, { slotLabel?: string | VNode } > export type FormItemRadioCustomOptions = BaseRadioProp[] | BaseRadioButtonProp[] export type FormItemRadioCustomProp = AssignKeys< ExtractComponentProps, { options?: FormItemRadioCustomOptions } > export type FormItemRadio = WithCustomProp<'radio', FormItemRadioCustomProp> export type BaseCheckBoxProp = AssignKeys< ExtractComponentProps, CheckboxProps & { slotLabel?: string | VNode } > export type BaseCheckBoxButtonProp = AssignKeys< ExtractComponentProps, { slotLabel?: string | VNode } > export type FormItemCheckBoxCustomOptions = BaseCheckBoxProp[] | BaseCheckBoxButtonProp[] export type FormItemCheckBoxCustomProp = AssignKeys< ExtractComponentProps, { options?: FormItemCheckBoxCustomOptions } > export type FormItemCheckBox = WithCustomProp<'checkbox', FormItemCheckBoxCustomProp> export type BaseOptionGroupProp = AssignKeys, object> export type BaseOptionProp = AssignKeys, object> export type FormItemSelectCustomOptionGroup = Record export type FormItemSelectCustomOptions = AssignKeys[] export type FormItemSelectCustomProp = AssignKeys< ExtractComponentProps, { optionGroup?: FormItemSelectCustomOptionGroup options?: FormItemSelectCustomOptions } > export type FormItemSelect = WithCustomProp<'select', FormItemSelectCustomProp> export type FormItemDatePicker = WithCustomProp<'date', object> export type FormItemDateTimePicker = WithCustomProp<'dateTime', object> export type FormItemDescriptionProp = { itemDescription?: { requiredAsterisk?: boolean description: string } } export type WithDescriptionProp = AssignKeys export type BaseElRowProp = AssignKeys, Partial> export type FormItemRowProp = { rowKey?: string | number } export type WithRowProp = AssignKeys export type BaseElColProp = AssignKeys, Partial> export type FormItemColProp = { colProp?: Partial colIndex?: number } export type WithColProp = AssignKeys export type PolymerizationFormItem = WithRowProp>> export type SupportFormItemType = | FormItemInput | FormItemInputNumber | FormItemAutocomplete | FormItemSwitch | FormItemRadio | FormItemCheckBox | FormItemSelect | FormItemDatePicker | FormItemDateTimePicker export type EpFormItem = | PolymerizationFormItem | PolymerizationFormItem | PolymerizationFormItem | PolymerizationFormItem | PolymerizationFormItem | PolymerizationFormItem | PolymerizationFormItem | PolymerizationFormItem | PolymerizationFormItem export type EpFormRows = Record< string | number, AssignKeys > export type FormGroup = { hidden?: boolean groupKey?: string | number groupTitle?: string | VNode rowKeys?: (string | number)[] } export type BaseFormProp = AssignKeys, Partial> export interface EpFormProps = Record> extends Omit { // 使用的栅格布局,inline失效 model: T items?: EpFormItem[] rows?: EpFormRows groups?: FormGroup[] } export type EpFormRules = Record> = EpFormProps['rules'] export type InstanceTable = InstanceType export type InstanceElTable = InstanceType export type InstanceForm = InstanceType export type InstanceSelect = InstanceType export type InstanceCheckBox = InstanceType export type InstanceRadio = InstanceType }