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