import type { CellCls, ColumnCls, CellStyle, TableColumnInstance } from 'element-plus'
import type { DasPaginationProps } from '@das-fed/ui/packages/pagination'

export type operationType = {
  
  
  
  
  
  label: string
  
  value: string | number
  
  tip?: string | ((row: any, column: any, index: number, item: any) => string)
  
  disabled?: boolean | ((row: any, column: any, index: number, item: any) => boolean)
  
  hide?: boolean | ((row: any, column: any, index: number, item: any) => boolean)
  
  children?: operationType[]
  
  lazyLoad?: (data: any, row: any) => operationType[]
}


export interface Props {
  
  rowKey?: string

  
  highlightKey?: string
  
  highlightRowId?: any[]

  
  data?: any[]

  
  loading?: boolean

  
  border?: boolean

  
  outerBorder?: boolean

  
  headerBorder?: boolean

  
  total?: number | string

  
  currentPage?: number | string

  
  pageSize?: number | string

  
  pageSizes?: number[]

  
  height?: string

  
  maxHeight?: string

  
  headerCellClassName?: CellCls

  
  headerCellStyle?: CellStyle

  
  cellStyle?: CellStyle

  
  rowClassName?: ColumnCls

  
  paginationProps?: DasPaginationProps

  
  radioSelection?:
    | boolean
    | {
        
        disabled?: boolean
        
        value?: string
        
        label?: string
        
        selectable?: (row?: any, index?: any) => boolean
        
        width?: string
      }

  
  currentRodioSelection?: string | number

  
  getAllId?: (lastId?: string) => Promise<any[]>

  
  selection?:
    | boolean
    | {
        
        disabled?: boolean

        
        showSelectCount?: boolean

        
        value?: string

        
        label?: string

        
        text?: string

        
        toolip?: boolean

        
        showPageSelectBtn?: boolean

        
        allSelectable?: boolean

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

  
  selectionRows?: any[]

  
  selectionIds?: any[]

  
  isRowSetExpand?: boolean

  
  expandRowKeys?: any[]

  
  hideSelectionText?: boolean

  
  normalHeardText?: boolean

  
  isSetting?: boolean

  
  emptyText?: string

  
  emptyTitle?: string

  
  emptyImage?: string

  
  dragSort?:
    | boolean
    | {
        
        rowspan?: number
      }

  
  simpleEmpty?: boolean

  
  showOperationColumn?: boolean
  
  operation?: operationType[] | ((row: any, column: any, index: number) => operationType[])
  
  operationOptions?: TableColumnInstance['$props'] & {
    width: {
      zh: string | number
      en?: string | number
    }
    minWidth: {
      zh: string | number
      en?: string | number
    }
  }

  
  expandRight?: boolean

  
  scroll?:
    | boolean
    | {
        
        loadMore?: () => void
        
        disabled?: boolean
        
        distance?: number | string
      }

  
  parentLinkChildren?: boolean

  
  delay?: number

  
  showCustomContent: boolean

  
  disabledIdsList?: Array
  
  highPerformance?: boolean

  
  sumText?: string
}

export interface Emits {
  (e: 'update:loading', val: string | number): void

  
  (e: 'update:current-rodio-selection', val: string | number): void

  
  (e: 'update:current-page', currentPage: number | string): void

  
  (e: 'update:page-size', pageSize: number | string): void

  
  (e: 'update:selection-rows', selectionRows: any[]): void

  (e: 'update:selection-ids', val: any[]): void

  
  (e: 'update:expand-row-keys', val: any[]): void

  
  (e: 'size-change', pageSize: number): void

  
  (e: 'current-page-change', currentPage: number): void

  
  (e: 'select', selection: any[], row: any): void

  
  (e: 'select-all', selection: any[]): void

  
  (e: 'selection-change', selection: any[]): void

  
  (e: 'toggleSelectAll', val: boolean, allIds: any[]): void

  
  (e: 'radio-change', val: string | number, row: any, index: number): void

  
  (e: 'table-setting'): void

  
  (e: 'sort-end', oldData: any[], newData: any[], oldIndex: number, newIndex: number): void

  
  (e: 'operation-click', value: any, row: any, column: any, index: number): void

  
  (e: 'expand-change', row: any, expandedRows: any[]): void

  

  (e: 'update:rightSelectList', val: any[]): void
}

export interface TableInjection {
  showPagination?: any
  currentPage?: any
  pageSize?: any
  expandRight?: boolean
}

export type Exposes = {
  
  $table

  
  tableScrollTop: () => void

  
  getCurrentParamsIds: (totalCount?: number) => Promise<boolean>
}

export interface Slots {
  
  default: {}

  
  'pagination-left': {}

  
  'pagination-left-btn_left': {}

  
  'pagination-left-btn_right': {}

  
  'pagination-right': {}

  
  empty: {}
}
