import type {
  VxeGridEventProps,
  VxeGridProps,
  VxeFormEventProps,
  VxeFormProps,
  VxeModalProps,
} from 'vxe-table'

export const mj_form_input = 'VxeInput'
export const mj_form_select = 'VxeSelect'
export const mj_form_date = 'VxeDatePicker'
export const mj_form_button_group = 'VxeButtonGroup'
export const mj_form_radio_group = 'VxeRadioGroup'

export const mj_action_add = 1
export const mj_action_update = 2
export const mj_action_remove = 3

export type MjFormProps = VxeFormProps
export type MjFormEventProps = VxeFormEventProps
export type MjGridProps = VxeGridProps & {
  afterLoadData?: (data: any) => any
  beforeLoadData?: (params: any) => any
  loadData?: (
    currentPage: any,
    pageSize: any,
    params: any,
  ) => Promise<{
    rows: any[]
    totalRows: number
  }>
  afterReset?: () => void
}
export type MjGridEventProps = VxeGridEventProps
export type MjModalProps = VxeModalProps
export type MjEditFormProps = {
  form: MjFormProps
  modal?: MjModalProps
  updateFields: string[]
  defaultFormData?: any
  beforeSaveOrUpdate?: (data: any) => any
}
