{"version":3,"file":"table.mjs","sources":["../../../../../../packages/components/table/src/table.ts"],"sourcesContent":["import type { PropType, ExtractPublicPropTypes } from 'vue'\nimport elTableProps from 'element-plus/es/components/table/src/table/defaults'\nimport { ElTable } from 'element-plus'\nimport { apiProps, type VisibleProps } from '@el-plus/utils/props'\nimport type { WithOnPrefixAndCamelCase } from '@el-plus/types'\nimport type {\n  TableColumnCtx,\n  PaginationProps,\n  PaginationEmits,\n} from 'element-plus'\nimport type { ButtonProps } from '@el-plus/components/buttons'\nimport { customColumnProps } from '@el-plus/components/custom-column'\nconst inheritTableProps = {\n  ...elTableProps,\n  // Table 的尺寸\n  size: {\n    ...elTableProps.size,\n    default: 'default',\n  },\n  // 是否带有纵向边框\n  border: {\n    ...elTableProps.border,\n    default: true,\n  },\n  // 表头样式\n  headerCellStyle: {\n    ...elTableProps.headerCellStyle,\n    default: () => ({\n      background: '#EEEFF3',\n      // textAlign: 'center',\n      fontSize: '14px',\n      color: '#505050',\n    }),\n  },\n}\nexport type TableColumn = Partial<\n  TableColumnCtx & {\n    required: boolean | (() => boolean)\n    cellRequired: (scope: TableScope) => boolean\n    headerRender: TableColumnCtx['renderHeader']\n    disabled: boolean | ((scope: TableScope) => boolean)\n    type: string\n    props: Record<string, any> // eslint-disable-line @typescript-eslint/no-explicit-any\n    filter: boolean // 是否显示筛选\n    editable: boolean | ((formData: Record<string, any>) => void) // 是否可批量编辑\n    [key: string]: any\n  } & VisibleProps\n>\nexport type TableScope<\n  T extends Record<string, unknown> = Record<string, unknown>,\n> = {\n  column: TableColumnCtx<T>\n  row: T\n  $index: number\n  store: unknown\n  _self: unknown\n}\nconst expandTableProps = {\n  ...apiProps,\n  columns: {\n    type: Array as PropType<TableColumn[]>,\n    default: () => [],\n  },\n  // 是否显示复选勾选列\n  showSelectionCol: Boolean,\n  // 是否显示单选勾选列\n  showSingleSelectionCol: Boolean,\n  // 是否显示序号列\n  showIndexCol: {\n    type: Boolean,\n    default: true,\n  },\n  // 对齐方式\n  align: {\n    type: String as PropType<'left' | 'center' | 'right'>,\n    default: 'center',\n  },\n  // 最小宽度\n  minWidth: {\n    type: [Number, String] as PropType<TableColumnCtx['minWidth']>,\n  },\n  // 操作列宽度\n  actionColWidth: {\n    type: [Number, String] as PropType<TableColumnCtx['width']>,\n    default: 200,\n  },\n  // 序号列自定义\n  indexFormatter: {\n    type: [Number, Function] as PropType<TableColumnCtx['index']>,\n  },\n  disabled: Boolean,\n  reserveSelection: Boolean,\n  selectable: {\n    type: Function as PropType<TableColumnCtx['selectable']>,\n  },\n  paginationProps: {\n    type: Object as PropType<\n      Partial<PaginationProps & WithOnPrefixAndCamelCase<PaginationEmits>>\n    >,\n    default: () => ({}),\n  },\n  showPagination: Boolean,\n  isFrontPage: Boolean,\n  // 操作列\n  actionButtons: {\n    type: Array as PropType<ButtonProps[]>,\n    default: () => [],\n  },\n  // 格式化列\n  formatColumns: {\n    type: Array as PropType<TableColumn[]>,\n    default: () => [],\n  },\n  // 是否初始化加载数据\n  isInitSearch: {\n    type: Boolean,\n    default: true,\n  },\n  // 自定义列模块\n  customColumnModule: {\n    ...customColumnProps.module,\n  },\n  customColumnApi: {\n    ...customColumnProps.api,\n  },\n  customColumnSaveApi: {\n    ...customColumnProps.saveApi,\n  },\n}\n\nexport const tableProps = {\n  ...inheritTableProps,\n  ...expandTableProps,\n} as const\nexport type TableProps = ExtractPublicPropTypes<typeof tableProps>\nexport const expandTablePropsKeys = Object.keys(expandTableProps)\n\nexport const tableEmits = [...ElTable.emits!, 'single-selection-change']\nexport type TableEmits = typeof tableEmits\nexport const tableEmitsKeys = tableEmits\n"],"names":[],"mappings":";;;;;AAYA,MAAM,iBAAA,GAAoB;AAAA,EACxB,GAAG,YAAA;AAAA;AAAA,EAEH,IAAA,EAAM;AAAA,IACJ,GAAG,YAAA,CAAa,IAAA;AAAA,IAChB,OAAA,EAAS;AAAA,GACX;AAAA;AAAA,EAEA,MAAA,EAAQ;AAAA,IACN,GAAG,YAAA,CAAa,MAA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