

import { operationType } from '../../../../table/src/type'

interface SearchQuerys {
  property: string
  value: string
  group: string
  relation: string
  operation: string
}
interface ReqData {
  flowKey: string
  clientType: 'pc' | 'mobile'
  
  permissionFilterTypes: number[]
  pageBean: {
    page: string
    pageSize: string
  }
  params: {}
  sorter: [
    {
      property: string
      direction: string
    },
  ]
  querys: SearchQuerys[]
}


export interface IModelData {
  
  attrLength: number
  
  charLen: number
  
  columnType: 'number' | 'varchar'
  
  comment: string
  
  dataType: 'number' | 'varchar'
  
  decimalLen: number
  
  defaultValue: string
  
  desc: string
  
  encryption?: 'phone'
  entId: string
  fieldName: string
  
  format: string
  id: string
  
  index: number
  
  intLen: number
  isNull: boolean
  isPk: boolean
  
  isRequired: 0 | 1
  
  name: string
  pkVal: string
  sn: number
  
  status?: 'hide'
  tableName: string
}


export interface ITableSlotMap {
  
  desc: string
  
  name: string
}


export interface ITableShowColumn extends ITableSlotMap {
  
  switch: boolean
}

export interface Props {
  
  flowKey: string
  
  clientType: 'pc' | 'mobile'
  
  needDisplayFileds?: boolean
  
  customOperation?: operationType[] | ((row: any, column: any, index: number) => operationType[])
  
  searchQuerys?: SearchQuerys[] | []
  
  sortQuerys?: any[] | []
  
  extraParams?: Record<string, any>
  
  permissionQuery: number[]
  
  apiUrl?: string | undefined
  
  defaultSort?: any[] | []
  
  reqMethod?: string
  
  columnSettingName: string
  
  selection?:
    | boolean
    | {
        
        disabled?: boolean

        
        showSelectCount?: boolean

        
        value?: string

        
        label?: string

        
        text?: string

        
        toolip?: boolean

        
        showPageSelectBtn?: boolean

        
        allSelectable?: boolean

        
        selectable?: (row?: any, index?: any) => boolean
      }
  
  showOperationColumn?: boolean
}

export interface Emits {
  
  (e: 'getSearchQuery', val: any): void
  
  (e: 'changeSlotShow', val: ITableShowColumn[]): void
}

export type Slot = {
  append?: () => { props: { label: string; prop: string } }[]
  prepend?: () => { props: { label: string; prop: string } }[]
}
