| | |
| | | import type { BasicTableProps, TableActionType, FetchParams, BasicColumn } from '../types/table'; |
| | | import type { PaginationProps } from '../types/pagination'; |
| | | import type { DynamicProps } from '/#/utils'; |
| | | import type { FormActionType } from '/@/components/Form'; |
| | | import type { DynamicProps } from '#/utils'; |
| | | import type { FormActionType } from '@/components/Form'; |
| | | import type { WatchStopHandle } from 'vue'; |
| | | import { getDynamicProps } from '/@/utils'; |
| | | import { getDynamicProps } from '@/utils'; |
| | | import { ref, onUnmounted, unref, watch, toRaw } from 'vue'; |
| | | import { isProdMode } from '/@/utils/env'; |
| | | import { error } from '/@/utils/log'; |
| | | import { isProdMode } from '@/utils/env'; |
| | | import { error } from '@/utils/log'; |
| | | import type { Key } from 'ant-design-vue/lib/table/interface'; |
| | | |
| | | type Props = Partial<DynamicProps<BasicTableProps>>; |
| | | |
| | |
| | | getRawDataSource: () => { |
| | | return getTableInstance().getRawDataSource(); |
| | | }, |
| | | getSearchInfo: () => { |
| | | return getTableInstance().getSearchInfo(); |
| | | }, |
| | | getColumns: ({ ignoreIndex = false }: { ignoreIndex?: boolean } = {}) => { |
| | | const columns = getTableInstance().getColumns({ ignoreIndex }) || []; |
| | | return toRaw(columns); |
| | | }, |
| | | setColumns: (columns: BasicColumn[]) => { |
| | | setColumns: (columns: BasicColumn[] | string[]) => { |
| | | getTableInstance().setColumns(columns); |
| | | }, |
| | | setTableData: (values: any[]) => { |
| | |
| | | setPagination: (info: Partial<PaginationProps>) => { |
| | | return getTableInstance().setPagination(info); |
| | | }, |
| | | deleteSelectRowByKey: (key: string) => { |
| | | getTableInstance().deleteSelectRowByKey(key); |
| | | deleteSelectRowByKey: (keyValue: Key) => { |
| | | getTableInstance().deleteSelectRowByKey(keyValue); |
| | | }, |
| | | getSelectRowKeys: () => { |
| | | return toRaw(getTableInstance().getSelectRowKeys()); |
| | |
| | | clearSelectedRowKeys: () => { |
| | | getTableInstance().clearSelectedRowKeys(); |
| | | }, |
| | | setSelectedRowKeys: (keys: string[] | number[]) => { |
| | | getTableInstance().setSelectedRowKeys(keys); |
| | | setSelectedRowKeys: (keyValues: Key[]) => { |
| | | getTableInstance().setSelectedRowKeys(keyValues); |
| | | }, |
| | | getPaginationRef: () => { |
| | | return getTableInstance().getPaginationRef(); |
| | |
| | | updateTableData: (index: number, key: string, value: any) => { |
| | | return getTableInstance().updateTableData(index, key, value); |
| | | }, |
| | | deleteTableDataRecord: (rowKey: string | number | string[] | number[]) => { |
| | | return getTableInstance().deleteTableDataRecord(rowKey); |
| | | deleteTableDataRecord: (keyValues: Key | Key[]) => { |
| | | return getTableInstance().deleteTableDataRecord(keyValues); |
| | | }, |
| | | insertTableDataRecord: (record: Recordable | Recordable[], index?: number) => { |
| | | return getTableInstance().insertTableDataRecord(record, index); |
| | | }, |
| | | updateTableDataRecord: (rowKey: string | number, record: Recordable) => { |
| | | return getTableInstance().updateTableDataRecord(rowKey, record); |
| | | updateTableDataRecord: (keyValue: Key, record: Recordable) => { |
| | | return getTableInstance().updateTableDataRecord(keyValue, record); |
| | | }, |
| | | findTableDataRecord: (rowKey: string | number) => { |
| | | return getTableInstance().findTableDataRecord(rowKey); |
| | | findTableDataRecord: (keyValue: Key) => { |
| | | return getTableInstance().findTableDataRecord(keyValue); |
| | | }, |
| | | getRowSelection: () => { |
| | | return toRaw(getTableInstance().getRowSelection()); |
| | |
| | | expandAll: () => { |
| | | getTableInstance().expandAll(); |
| | | }, |
| | | expandRows: (keys: string[]) => { |
| | | getTableInstance().expandRows(keys); |
| | | }, |
| | | collapseAll: () => { |
| | | getTableInstance().collapseAll(); |
| | | }, |
| | | expandRows: (keyValues: Key[]) => { |
| | | getTableInstance().expandRows(keyValues); |
| | | }, |
| | | collapseRows: (keyValues: Key[]) => { |
| | | getTableInstance().collapseRows(keyValues); |
| | | }, |
| | | scrollTo: (pos: string) => { |
| | | getTableInstance().scrollTo(pos); |
| | | }, |