fix: use table
parent
e304a37b37
commit
9dab524b45
|
@ -1,12 +1,13 @@
|
|||
import type { ComputedRef } from 'vue'
|
||||
import { unref } from 'vue'
|
||||
import type { Key } from 'ant-design-vue/lib/table/interface'
|
||||
import type { BasicTableProps } from '../types/table'
|
||||
import { ROW_KEY } from '../const'
|
||||
import { isFunction, isString } from '@/utils/is'
|
||||
|
||||
interface Options {
|
||||
setSelectedRowKeys: (keys: string[]) => void
|
||||
getSelectRowKeys: () => string[]
|
||||
setSelectedRowKeys: (keys: Key[]) => void
|
||||
getSelectRowKeys: () => Key[]
|
||||
clearSelectedRowKeys: () => void
|
||||
emit: EmitType
|
||||
getAutoCreateKey: ComputedRef<boolean | undefined>
|
||||
|
|
|
@ -163,8 +163,8 @@ export function useTable(tableProps?: Props): [
|
|||
scrollTo: (pos: string) => {
|
||||
getTableInstance().scrollTo(pos)
|
||||
},
|
||||
setShowForm: async (show: boolean) => {
|
||||
await getTableInstance().setShowForm(show)
|
||||
setShowForm: async (flag: boolean) => {
|
||||
await getTableInstance().setShowForm(flag)
|
||||
},
|
||||
getShowForm: () => {
|
||||
return toRaw(getTableInstance().getShowForm())
|
||||
|
|
|
@ -86,7 +86,7 @@ export interface TableActionType {
|
|||
expandRows: (keys: (string | number)[]) => void
|
||||
collapseAll: () => void
|
||||
scrollTo: (pos: string) => void // pos: id | "top" | "bottom"
|
||||
getSelectRowKeys: () => string[]
|
||||
getSelectRowKeys: () => Key[]
|
||||
deleteSelectRowByKey: (key: string) => void
|
||||
setPagination: (info: Partial<PaginationProps>) => void
|
||||
setTableData: <T extends Ref<Recordable<any>[]>>(values: T[]) => void
|
||||
|
@ -108,11 +108,11 @@ export interface TableActionType {
|
|||
getCacheColumns: () => BasicColumn[]
|
||||
emit?: EmitType
|
||||
updateTableData: (index: number, key: string, value: any) => Recordable
|
||||
setShowPagination: (show: boolean) => Promise<void>
|
||||
setShowPagination: (show: boolean) => void
|
||||
getShowPagination: () => boolean
|
||||
setCacheColumnsByField?: (dataIndex: string | undefined, value: BasicColumn) => void
|
||||
setCacheColumns?: (columns: BasicColumn[]) => void
|
||||
setShowForm: (show: boolean) => Promise<void>
|
||||
setShowForm: (flag: boolean) => void
|
||||
getShowForm: () => boolean
|
||||
}
|
||||
|
||||
|
@ -403,6 +403,7 @@ export interface BasicTableProps<T = any> {
|
|||
|
||||
export type CellFormat = string | ((text: string, record: Recordable, index: number) => string | number) | Map<string | number, any>
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-expect-error
|
||||
export interface BasicColumn extends ColumnProps<Recordable> {
|
||||
children?: BasicColumn[]
|
||||
|
|
Loading…
Reference in New Issue