Type reference
This page provides the TypeScript declarations and import entry for the APIs covered on this site. For component behavior, defaults and event semantics, see the API Reference. The core declarations share one hand-maintained file with the feature pages and are type-checked; the query, editing and column preference protocols show complete interface members and function signatures checked against the public package entry.
We recommend importing all public types from @vtable-guild/vtable-guild. CSSProperties, VNodeChild, VNode, Plugin and InjectionKey in the declarations come from Vue; theme configs use typeof on the public theme constants to keep the readonly properties and literals of the source. Interfaces labelled "documentation helper" only describe component props and are not package exports.
import type {
TableColumnsType,
VTableEventProps,
TablePaginationConfig,
} from '@vtable-guild/vtable-guild'
interface UserRow {
key: string
name: string
age: number
}
const columns: TableColumnsType<UserRow> = [
{ title: 'Name', key: 'name', dataIndex: 'name' },
{ title: 'Age', key: 'age', dataIndex: 'age' },
]
const pagination: TablePaginationConfig = {
onChange: (page, pageSize) => console.log(page, pageSize),
}
const handleChange: NonNullable<VTableEventProps<UserRow>['onChange']> = (
_filters,
_sorter,
extra,
) => {
if (extra.action === 'paginate' && extra.pagination) {
console.log(extra.pagination.current, extra.pagination.pageSize)
}
}If you are aligning with ant-design-vue's column type names, prefer TableColumnType and TableColumnsType. They are equivalent to ColumnType and ColumnsType respectively. Other types referenced by the declarations can be looked up by name on this page.
Core table types
Key
The unique identifier used by rows, columns and internal state.
export type Key = string | numberDataIndex
The field path a column uses to read row data.
export type DataIndex = string | number | Array<string | number>AlignType
Alignment of column content.
export type AlignType = 'left' | 'center' | 'right'Breakpoint
The breakpoint type used by responsive columns. The public type name is Breakpoint; there is no plural Breakpoints type.
export type Breakpoint = 'xxxl' | 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs'SortOrder
Sort direction. null means the unsorted state.
export type SortOrder = 'ascend' | 'descend' | nullColumnSorter
The column sorter type: the compare function returns a number, and the object form supports multi-column sort priority.
export type SorterFn<TRecord = Record<string, any>> = (a: TRecord, b: TRecord) => numberexport interface ColumnSorterObject<TRecord = Record<string, any>> {
compare?: SorterFn<TRecord>
multiple?: number
}export type ColumnSorter<TRecord = Record<string, any>> =
| boolean
| SorterFn<TRecord>
| ColumnSorterObject<TRecord>ColumnFilterItem
A column filter item; it supports a tree structure.
export interface ColumnFilterItem {
text: string
value: string | number | boolean
children?: ColumnFilterItem[]
}ColumnType
Leaf column configuration. The full declaration covers rendering, sorting, filtering, fixed columns, column resizing and responsive visibility.
export interface ColumnType<TRecord extends object = Record<string, any>> {
key?: Key
title?: ColumnTitle<TRecord>
tooltip?: string | TableTooltipConfig
copyable?: ColumnCopyable<TRecord>
valueEnum?: ColumnValueEnum
valueType?: string
editor?: false | TableColumnEditor<TRecord>
fieldProps?: TableFieldProps | ((context: CustomRenderContext<TRecord>) => TableFieldProps)
hideInSetting?: boolean
disable?: boolean | { checkbox?: boolean; fixed?: boolean; order?: boolean }
dataIndex?: DataIndex
width?: number | string
align?: AlignType
ellipsis?: boolean | { showTitle?: boolean }
className?: string
colSpan?: number
customRender?: (ctx: CustomRenderContext<TRecord>) => VNodeChild | RenderedCell
customCell?: GetComponentProps<TRecord, TRecord>
customHeaderCell?: GetComponentProps<ColumnType<TRecord> | ColumnGroupType<TRecord>, TRecord>
fixed?: 'left' | 'right' | true
resizable?: boolean
minWidth?: number
maxWidth?: number
sorter?: ColumnSorter<TRecord>
sortOrder?: SortOrder
defaultSortOrder?: SortOrder
sortDirections?: SortOrder[]
filters?: ColumnFilterItem[] | boolean
onFilter?: boolean | ((value: string | number | boolean, record: TRecord) => boolean)
filterMultiple?: boolean
filteredValue?: (string | number | boolean)[] | null
defaultFilteredValue?: (string | number | boolean)[]
customFilterDropdown?: boolean
filterSearch?: boolean | ((input: string, filter: ColumnFilterItem) => boolean)
filterMode?: 'menu' | 'tree'
filterResetToDefaultFilteredValue?: boolean
filterDropdownOpen?: boolean
onFilterDropdownOpenChange?: (visible: boolean) => void
filtered?: boolean
filterIcon?: (opt: { filtered: boolean }) => VNodeChild
filterDropdown?: VNodeChild | ((props: CustomFilterDropdownSlotProps<TRecord>) => VNodeChild)
showSorterTooltip?: boolean | TableTooltipConfig
visible?: boolean
responsive?: Breakpoint[]
}ColumnGroupType
Column group configuration; children holds further leaf columns or column groups.
export interface ColumnGroupType<TRecord extends object = Record<string, any>> extends Omit<
ColumnType<TRecord>,
| 'dataIndex'
| 'valueType'
| 'fieldProps'
| 'customRender'
| 'sorter'
| 'sortOrder'
| 'defaultSortOrder'
| 'sortDirections'
| 'filters'
| 'onFilter'
| 'filterMultiple'
| 'filteredValue'
| 'defaultFilteredValue'
| 'customFilterDropdown'
| 'filterSearch'
| 'filterMode'
| 'filterResetToDefaultFilteredValue'
| 'filterDropdownOpen'
| 'onFilterDropdownOpenChange'
| 'filtered'
| 'filterIcon'
| 'filterDropdown'
> {
children: Array<ColumnType<TRecord> | ColumnGroupType<TRecord>>
}ColumnsType
The recommended type for the columns prop; it supports both column groups and column placeholder constants.
export type ColumnsType<TRecord extends object = Record<string, any>> = Array<
ColumnType<TRecord> | ColumnGroupType<TRecord> | ColumnSentinel
>TableColumnType and TableColumnsType
Aliases compatible with ant-design-vue naming; they keep the generic defaults of the original types.
export type TableColumnType<TRecord extends object = Record<string, any>> = ColumnType<TRecord>export type TableColumnGroupType<TRecord extends object = Record<string, any>> =
ColumnGroupType<TRecord>export type TableColumnsType<TRecord extends object = Record<string, any>> = ColumnsType<TRecord>TableLayout
export type TableLayout = 'auto' | 'fixed'TableSticky
The full declaration of the sticky object. offsetScroll and getContainer are declared but not wired up yet; see the API Reference for the behavior boundaries.
export interface TableSticky {
offsetHeader?: number
offsetSummary?: number
offsetScroll?: number
getContainer?: () => Window | HTMLElement
}RowClassName
export type RowClassName<TRecord = Record<string, any>> = (
record: TRecord,
index: number,
indent: number,
) => stringTransformCellText
export type TransformCellText<TRecord extends object = Record<string, any>> = (opt: {
text: unknown
column: ColumnType<TRecord>
record: TRecord
index: number
}) => unknownRendering and structure types
CellAdditionalProps
Extra DOM attributes returned by customCell, customHeaderCell, customRow and customHeaderRow. The index signature allows attributes such as data-* and aria-*.
export interface CellAdditionalProps {
class?: string
className?: string
style?: CSSProperties
colSpan?: number
rowSpan?: number
colspan?: number
rowspan?: number
onClick?: (event: MouseEvent) => void
onMouseenter?: (event: MouseEvent) => void
onMouseleave?: (event: MouseEvent) => void
[key: string]: unknown
}RenderedCell
The object form returned by customRender or by the selection column's renderCell.
export interface RenderedCell {
props?: CellAdditionalProps
children?: VNodeChild
}CustomRenderContext
The parameter type of column.customRender.
export interface CustomRenderContext<TRecord extends object = Record<string, any>> {
text: unknown
value: unknown
record: TRecord
index: number
renderIndex: number
column: ColumnType<TRecord>
}GetComponentProps
The callback type for extra cell or row attributes. Note that index is optional.
export type GetComponentProps<TData, TRecord extends object = Record<string, any>> = (
data: TData,
index: number,
column?: ColumnType<TRecord>,
) => CellAdditionalProps | undefinedColumnTitleProps
Parameters of a function-style column title.
export interface ColumnTitleProps<TRecord extends object = Record<string, any>> {
sortOrder?: SortOrder
sortColumn?: ColumnType<TRecord>
sortColumns?: Array<{ column: ColumnType<TRecord>; order: SortOrder }>
filters?: Record<string, (string | number | boolean)[] | null>
}ColumnTitle
export type ColumnTitle<TRecord extends object = Record<string, any>> =
| VNodeChild
| ((props: ColumnTitleProps<TRecord>) => VNodeChild)Interaction types
RowSelection
Configuration for multiple selection, single selection, controlled selection and selection-column rendering.
export interface RowSelection<TRecord extends object = Record<string, any>> {
preserveSelectedRowKeys?: boolean
type?: RowSelectionType
selectedRowKeys?: Key[]
defaultSelectedRowKeys?: Key[]
onChange?: (selectedRowKeys: Key[], selectedRows: TRecord[]) => void
onSelect?: (record: TRecord, selected: boolean, selectedRows: TRecord[]) => void
onSelectMultiple?: (selected: boolean, selectedRows: TRecord[], changeRows: TRecord[]) => void
onSelectAll?: (selected: boolean, selectedRows: TRecord[], changeRows: TRecord[]) => void
onSelectInvert?: (selectedRowKeys: Key[]) => void
onSelectNone?: () => void
getCheckboxProps?: (record: TRecord) => { disabled?: boolean; name?: string }
columnWidth?: number | string
fixed?: boolean | 'left' | 'right'
columnTitle?: string | VNodeChild
renderCell?: (
value: boolean,
record: TRecord,
index: number,
originNode: VNodeChild,
) => VNodeChild | RenderedCell
checkStrictly?: boolean
selections?: boolean | (SelectionItem | SelectionSentinel)[]
hideSelectAll?: boolean
}RowSelectionType
export type RowSelectionType = 'checkbox' | 'radio'SelectionItem
A custom batch-selection menu item.
export interface SelectionItem {
key: string
text: string | VNodeChild
onSelect?: (changeableRowKeys: Key[]) => void
}Expandable
Configuration for expandable rows and tree expansion.
export interface Expandable<TRecord extends object = Record<string, any>> {
expandedRowRender?: (
record: TRecord,
index: number,
indent: number,
expanded: boolean,
) => VNodeChild
expandedRowKeys?: Key[]
defaultExpandedRowKeys?: Key[]
expandRowByClick?: boolean
expandIcon?: (props: {
expanded: boolean
record: TRecord
expandable: boolean
onExpand: (record: TRecord, e: Event) => void
}) => VNodeChild
onExpand?: (expanded: boolean, record: TRecord) => void
onExpandedRowsChange?: (expandedKeys: Key[]) => void
columnWidth?: number | string
fixed?: 'left' | 'right' | true
defaultExpandAllRows?: boolean
rowExpandable?: (record: TRecord) => boolean
showExpandColumn?: boolean
expandIconColumnIndex?: number
columnTitle?: string | number
expandedRowClassName?: string | RowClassName<TRecord>
}TableFiltersInfo
The filters argument of the change event. After a filter is cleared, the corresponding value can be null.
export type TableFiltersInfo = Record<string, (string | number | boolean)[] | null>SorterResultLike
The sort result of a single column. With multi-column sorting, the event returns an array of this type.
export interface SorterResultLike<TRecord extends object = Record<string, any>> {
column: ColumnType<TRecord> | undefined
columnKey: Key | undefined
order: SortOrder
field: ColumnType<TRecord>['dataIndex']
}VTableSorterResult
The sorter argument of the change event.
export type VTableSorterResult<TRecord extends object = Record<string, any>> =
| SorterResultLike<TRecord>
| Array<SorterResultLike<TRecord>>TableChangeExtra
The extra argument of the change event; with pagination enabled, read the pagination state from the optional pagination.
export interface TableChangeExtra<TRecord extends object = Record<string, any>> {
action: 'sort' | 'filter' | 'select' | 'paginate'
/** Available only when pagination is enabled. */
pagination?: TablePaginationState
currentDataSource: TRecord[]
}RowDragSortInfo
The info argument of the rowDragEnd event; see Row drag sorting.
export interface RowDragSortInfo {
draggedKey: Key
targetKey: Key
orderedKeys: Key[]
}Slot types
TableBodyCellSlotProps
Parameters of the bodyCell slot.
export interface TableBodyCellSlotProps<TRecord extends object = Record<string, any>> {
text: unknown
record: TRecord
index: number
column: ColumnType<TRecord>
}TableHeaderCellSlotProps
Parameters of the headerCell slot.
export interface TableHeaderCellSlotProps<TRecord extends object = Record<string, any>> {
title: VNodeChild | undefined
column: ColumnType<TRecord> | ColumnGroupType<TRecord>
index: number
}CustomFilterDropdownSlotProps
Parameters of the customFilterDropdown slot, including the filter state and the confirm, reset and close functions.
export interface CustomFilterDropdownSlotProps<TRecord extends object = Record<string, any>> {
column: ColumnType<TRecord>
selectedKeys: (string | number | boolean)[]
setSelectedKeys: (keys: (string | number | boolean)[]) => void
confirm: (options?: { closeDropdown?: boolean }) => void
clearFilters: (options?: { confirm?: boolean; closeDropdown?: boolean }) => void
filters: ColumnFilterItem[]
visible: boolean
close: () => void
}TableDataSlotProps
Parameters of the title and footer slots.
export interface TableDataSlotProps<TRecord extends object = Record<string, any>> {
data: TRecord[]
}TableSlotsDecl
The complete slot declaration of VTable; useful when wrapping the table component.
export interface TableSlotsDecl<TRecord extends object = Record<string, any>> {
bodyCell?: (props: TableBodyCellSlotProps<TRecord>) => VNodeChild
headerCell?: (props: TableHeaderCellSlotProps<TRecord>) => VNodeChild
empty?: () => VNodeChild
loading?: () => VNodeChild
customFilterDropdown?: (props: CustomFilterDropdownSlotProps<TRecord>) => VNodeChild
customFilterIcon?: (props: { column: ColumnType<TRecord>; filtered: boolean }) => VNodeChild
title?: (props: TableDataSlotProps<TRecord>) => VNodeChild
footer?: (props: TableDataSlotProps<TRecord>) => VNodeChild
paginationItem?: (props: TablePaginationSlotProps) => VNodeChild
summary?: () => VNodeChild
expandColumnTitle?: () => VNodeChild
}Constant types
SelectionSentinel
The type of the default batch-selection constants used by rowSelection.selections.
export type SelectionSentinel =
| typeof SELECTION_ALL
| typeof SELECTION_INVERT
| typeof SELECTION_NONEColumnSentinel
The type of the column placeholder constants available at the top level of columns. ExpandColumnSentinel corresponds to EXPAND_COLUMN, and SelectionColumnSentinel to SELECTION_COLUMN.
export type ExpandColumnSentinel = typeof EXPAND_COLUMNexport type SelectionColumnSentinel = typeof SELECTION_COLUMNexport type ColumnSentinel = ExpandColumnSentinel | SelectionColumnSentinelComponent and event types
TableProps
The complete type of VTable props; prefer it when wrapping the table in your own component.
export interface TableProps<TRecord extends object = Record<string, any>> {
pagination?: false | TablePaginationConfig
manual?: boolean | TableManualConfig
columnEmptyText?: VNodeChild | false
renderers?: TableFieldRenderers<TRecord>
loadData?: TableTreeLoadData<TRecord>
isLeaf?: (record: TRecord) => boolean
onTreeLoadError?: (error: Error, record: TRecord) => void
dataSource: TRecord[]
columns: ColumnsType<TRecord>
columnOrder?: Key[]
rowKey?: string | ((record: TRecord) => Key)
loading?:
| boolean
| {
spinning?: boolean
indicator?: VNodeChild
tip?: string
delay?: number
wrapperClassName?: string
}
size?: 'small' | 'middle' | 'large'
bordered?: boolean
striped?: boolean
hoverable?: boolean
rowDraggable?: boolean
ui?: SlotProps<{ slots: Record<TableSlots, string> }>
class?: string
tableLayout?: TableLayout
showHeader?: boolean
headerEllipsis?: boolean
rowClassName?: string | RowClassName<TRecord>
customRow?: GetComponentProps<TRecord>
customHeaderRow?: (
columns: Array<ColumnType<TRecord> | ColumnGroupType<TRecord>>,
index?: number,
) => CellAdditionalProps
showSorterTooltip?: boolean | TableTooltipConfig
sortDirections?: SortOrder[]
locale?: LocaleName
locales?: LocaleRegistry
localeOverrides?: DeepPartial<VTableGuildTableLocale>
sticky?: boolean | TableSticky
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement
transformCellText?: TransformCellText<TRecord>
rowSelection?: RowSelection<TRecord>
expandable?: Expandable<TRecord>
title?: (data: TRecord[]) => VNodeChild
footer?: (data: TRecord[]) => VNodeChild
scroll?: { x?: number | string; y?: number | string; scrollToFirstRowOnChange?: boolean }
virtual?: boolean
rowHeight?: number
virtualColumn?: boolean
childrenColumnName?: string
indentSize?: number
expandedRowKeys?: Key[]
defaultExpandedRowKeys?: Key[]
defaultExpandAllRows?: boolean
onExpand?: (expanded: boolean, record: TRecord) => void
onExpandedRowsChange?: (expandedKeys: Key[]) => void
}Server-side requests and manual calculation
TableManualConfig defines whether local sorting, filtering and pagination are skipped. The request function, options and return value of useTableRequest have their own generic types; see Remote data and requests for full usage.
import type { ComputedRef, MaybeRef, MaybeRefOrGetter, Ref, ShallowRef } from 'vue'
import type { SortOrder } from '@vtable-guild/vtable-guild'
import type { TablePaginationConfig, TablePaginationState } from '@vtable-guild/vtable-guild'
import type { TableFiltersInfo, VTableEventProps } from '@vtable-guild/vtable-guild'
/** Explicitly delegate calculations to a server while retaining the table's state and events. */
export interface TableManualConfig {
sort?: boolean
filter?: boolean
pagination?: boolean
}
export type TableRequestSort = Record<string, Exclude<SortOrder, null>>
export type TableRequestParams<TParams extends object> = Partial<TParams> & {
current: number
pageSize: number
}
export interface TableRequestContext {
/** Pass this signal to fetch or another client to cancel the underlying network request. */
signal: AbortSignal
}
export interface TableRequestResult<TRecord extends object> {
data: TRecord[]
total: number
/** An explicit false is treated as a failed request. */
success?: boolean
}
export type TableRequest<TRecord extends object, TParams extends object> = (
params: TableRequestParams<TParams>,
sort: TableRequestSort,
filters: TableFiltersInfo,
context: TableRequestContext,
) => Promise<TableRequestResult<TRecord>>
/** Disabled by default. Positive intervals are clamped to at least 2000ms. */
export type TableRequestPolling<TRecord extends object> =
| number
| false
| ((data: readonly TRecord[]) => number | false)
export interface UseTableRequestOptions<
TRecord extends object,
TParams extends object = Record<string, unknown>,
> {
request: TableRequest<TRecord, TParams>
/** Extra parameters override submitted query fields. Reactive changes reset to page one. */
params?: MaybeRefOrGetter<Partial<TParams>>
/** Initial submitted query and the query restored by reset(). */
defaultParams?: Partial<TParams>
initialPagination?: Partial<TablePaginationState>
/** Display options only. Bind the returned pagination object without an additional onChange. */
pagination?: Omit<
TablePaginationConfig,
| 'current'
| 'defaultCurrent'
| 'pageSize'
| 'defaultPageSize'
| 'total'
| 'onChange'
| 'onShowSizeChange'
| 'onUpdate:current'
| 'onUpdate:pageSize'
>
/** Skip only the initial request. Later actions, parameter changes, or reload still request. */
manualRequest?: boolean
/** Debounce query changes and table events. Explicit reload executes immediately. */
debounceTime?: number
/** Schedule the next refresh after the previous request settles, never concurrently. */
polling?: MaybeRef<TableRequestPolling<TRecord>>
/** Refresh when the document becomes visible. Does not submit query drafts. */
revalidateOnFocus?: MaybeRefOrGetter<boolean>
/** Continue polling while the document is hidden. Defaults to false. */
pollingWhenHidden?: boolean
/** Continue polling after an error. Defaults to false; reload/resume can retry. */
pollingOnError?: boolean
/** Defaults to true in this request helper; the base table's pagination policy is unchanged. */
resetOnPageSizeChange?: boolean
beforeSearchSubmit?: (params: Partial<TParams>) => Partial<TParams>
postData?: (data: TRecord[]) => TRecord[]
onLoad?: (data: TRecord[], response: TableRequestResult<TRecord>) => void
onError?: (error: Error) => void
}
export interface UseTableRequestReturn<
TRecord extends object,
TParams extends object = Record<string, unknown>,
> {
dataSource: ShallowRef<TRecord[]>
loading: Readonly<Ref<boolean>>
/** Automatic refresh after a successful load, without a blocking table spinner. */
refreshing: Readonly<Ref<boolean>>
/** Explicit pause state; document visibility is handled independently. */
paused: Readonly<Ref<boolean>>
error: ShallowRef<Error | null>
pagination: ComputedRef<TablePaginationConfig>
query: ComputedRef<Partial<TParams>>
sort: ComputedRef<TableRequestSort>
filters: ComputedRef<TableFiltersInfo>
manual: Readonly<Required<TableManualConfig>>
onChange: NonNullable<VTableEventProps<TRecord>['onChange']>
/** Refresh immediately, sharing an identical running request. true also resets the page. */
reload: (resetPageIndex?: boolean) => Promise<void>
/** Replace the submitted query, reset to page one, and request even if values are unchanged. */
submit: (params?: Partial<TParams>) => Promise<void>
/** Restore defaults (or the supplied query), clear sort/filters, reset to page one, and request. */
reset: (params?: Partial<TParams>) => Promise<void>
cancel: () => void
/** Stop automatic refresh and abort an automatic request, retaining manual requests. */
pause: () => void
/** Resume automatic refresh; optionally refresh immediately. Never starts a manual first load. */
resume: (immediate?: boolean) => Promise<void>
}VTableEventProps
The complete event props type for change, resizeColumn and rowDragEnd. Even if you only listen for pagination, the handler still receives three arguments; alternatively use TablePaginationConfig['onChange'].
export interface VTableEventProps<TRecord extends object = Record<string, any>> {
onChange?: (
filters: TableFiltersInfo,
sorter: VTableSorterResult<TRecord>,
extra: TableChangeExtra<TRecord>,
) => void
onResizeColumn?: (column: ColumnType<TRecord>, width: number) => void
onRowDragEnd?: (newData: TRecord[], info: RowDragSortInfo) => void
}VTablePublicProps
The combination of TableProps<TRecord> and VTableEventProps<TRecord>.
export type VTablePublicProps<TRecord extends object = Record<string, any>> = TableProps<TRecord> &
VTableEventProps<TRecord>VTableComponent
The generic VTable component type.
import type { VTableComponent as PublicVTableComponent } from '@vtable-guild/vtable-guild'
/** The public component type is derived from the generic Vue SFC. */
export type VTableComponent = PublicVTableComponentSummaryFixed
The fixed type of VTableSummary.
export type SummaryFixed = boolean | 'top' | 'bottom'Summary component props
The following interfaces are documentation helper types, not package exports. VTableSummaryRow has no props of its own, and all three summary components provide a default content slot with no parameters.
/** 文档说明用辅助接口,不是包导出。 */
export interface VTableSummaryProps {
fixed?: SummaryFixed
}/** 文档说明用辅助接口,不是包导出。index 是必填的列索引。 */
export interface VTableSummaryCellProps {
index: number
colSpan?: number
rowSpan?: number
align?: AlignType
}Toolbar and column settings types
TableToolbarProps, TableToolbarOptions, TableToolbarSlotProps and TableToolbarSlots belong to the standalone VTableToolbar component; they are not props or slots of VTable. See Toolbar for the full behavior and an export example.
import type { VNodeChild } from 'vue'
import type {
TableColumnsType,
TableColumnSettingsProps,
TableColumnSettingsOptions,
TableColumnSettingsSize,
TableColumnSettingsSlots,
SlotProps,
ToolbarThemeConfig,
VTableGuildToolbarLocale,
} from '@vtable-guild/vtable-guild'
export interface TableToolbarOptions extends TableColumnSettingsOptions {
reload?: boolean
fullScreen?: boolean
}
export interface TableToolbarSearchConfig {
placeholder?: string
clearable?: boolean
}
export interface TableToolbarProps<TRecord extends object = Record<string, unknown>> {
title?: VNodeChild
columns?: TableColumnsType<TRecord>
size?: TableColumnSettingsSize
options?: false | TableToolbarOptions
loading?: boolean
search?: boolean | TableToolbarSearchConfig
searchValue?: string
multipleLine?: boolean
disabled?: boolean
fullscreenTarget?: () => HTMLElement | null | undefined
columnSettings?: Pick<
TableColumnSettingsProps<TRecord>,
'locale' | 'ui' | 'class' | 'getPopupContainer'
>
locale?: Partial<VTableGuildToolbarLocale>
ui?: SlotProps<ToolbarThemeConfig>
class?: string
}
export interface TableToolbarSlotProps<TRecord extends object = Record<string, unknown>> {
columns: TableColumnsType<TRecord>
size: TableColumnSettingsSize
loading: boolean
disabled: boolean
fullscreen: boolean
fullscreenAvailable: boolean
reload: () => void
toggleFullscreen: () => Promise<void>
searchValue: string
updateSearchValue: (value: string) => void
submitSearch: (value?: string) => void
clearSearch: () => void
}
export interface TableToolbarSlots<TRecord extends object = Record<string, unknown>> {
title?: (props: TableToolbarSlotProps<TRecord>) => VNodeChild
actions?: (props: TableToolbarSlotProps<TRecord>) => VNodeChild
settings?: (props: TableToolbarSlotProps<TRecord>) => VNodeChild
search?: (props: TableToolbarSlotProps<TRecord>) => VNodeChild
filter?: (props: TableToolbarSlotProps<TRecord>) => VNodeChild
extra?: (props: TableToolbarSlotProps<TRecord>) => VNodeChild
columnLabel?: TableColumnSettingsSlots<TRecord>['columnLabel']
}Types for the controlled column configuration, density and custom label of VTableColumnSettings:
export type TableColumnSettingsSize = 'large' | 'middle' | 'small'export interface TableColumnSettingsOptions {
density?: boolean
setting?: boolean
fixed?: boolean
draggable?: boolean
}export interface TableColumnSettingsProps<TRecord extends object = Record<string, unknown>> {
columns: TableColumnsType<TRecord>
size?: TableColumnSettingsSize
disabled?: boolean
options?: TableColumnSettingsOptions
locale?: Partial<VTableGuildColumnSettingsLocale>
ui?: SlotProps<ColumnSettingsThemeConfig>
class?: string
getPopupContainer?: (trigger: HTMLElement) => HTMLElement
}export interface TableColumnSettingsSlots<TRecord extends object = Record<string, unknown>> {
columnLabel?: (props: { column: ColumnType<TRecord> | ColumnGroupType<TRecord> }) => VNodeChild
}Query, editing and field rendering protocols
useTableQuery
UseTableQueryOptions<TValues, TParams> separates the form value type from the request parameter type; TableQueryFieldTransforms infers the transform input from the form key. The return value includes an independent draft, the submitted snapshot, the expand/collapse state and submit / reset methods. collapsed accepts a shared Ref, and onCollapse observes expand/collapse changes. See Query submission.
export declare function useTableQuery<TValues extends object, TParams extends object = TValues>(
options: UseTableQueryOptions<TValues, TParams>,
): UseTableQueryReturn<TValues, TParams>
/** A transformed field replaces its original key and may expand into several request fields. */
export type TableQueryFieldTransforms<TValues extends object, TParams extends object> = {
[K in keyof TValues]?: (
value: TValues[K],
values: Readonly<TValues>,
) => Partial<TParams> | undefined
}
/** Omit hidden fields from request parameters without changing the form draft or submitted values. */
export interface TableQuerySubmitOptions<TValues extends object> {
omitFields?: readonly (keyof TValues)[]
}
export interface UseTableQueryOptions<TValues extends object, TParams extends object = TValues> {
/** A snapshot is taken once. Use ordinary objects, arrays and Date values for form state. */
defaultValues: TValues
fieldTransforms?: TableQueryFieldTransforms<TValues, TParams>
/** Runs after field transforms, once per submit/reset, never on draft edits. */
transform?: (params: Partial<TParams>, values: Readonly<TValues>) => Partial<TParams>
onSubmit?: (params: Partial<TParams>, values: Readonly<TValues>) => void | Promise<void>
/** Defaults to onSubmit. Connect this to request.reset(params) to also clear table state. */
onReset?: (params: Partial<TParams>, values: Readonly<TValues>) => void | Promise<void>
/** Optional shared ref for a controlled collapse state. */
collapsed?: Ref<boolean>
defaultCollapsed?: boolean
onCollapse?: (collapsed: boolean) => void
}
export interface UseTableQueryReturn<TValues extends object, TParams extends object = TValues> {
draft: Ref<TValues>
/** Last successfully transformed values, published before the callback and retained if it fails. */
submitted: ComputedRef<Readonly<TValues> | undefined>
params: ComputedRef<Readonly<Partial<TParams>> | undefined>
collapsed: Ref<boolean>
submitting: ComputedRef<boolean>
error: ShallowRef<Error | null>
/** Returns false for a transform/callback failure or an obsolete submission. */
submit: (options?: TableQuerySubmitOptions<TValues>) => Promise<boolean>
/** Restore draft defaults and submit them through onReset (or onSubmit), once. */
reset: (options?: TableQuerySubmitOptions<TValues>) => Promise<boolean>
/** Restore draft defaults without changing submitted state or requesting data. */
resetFields: () => void
toggleCollapsed: () => void
}TableBuiltinControlValueType
All 11 built-in control keys registered by createAntdvTableControls and createElementPlusTableControls, shared by query schemas and column editors. See Schema query control types for configuration, registration and fallback behavior.
export type TableBuiltinControlValueType =
| 'text'
| 'textarea'
| 'select'
| 'enum'
| 'digit'
| 'money'
| 'date'
| 'dateRange'
| 'dateTime'
| 'dateTimeRange'
| 'time'| valueType | Control | Value format and common configuration |
|---|---|---|
text | Text input | Text; host props such as placeholder / maxlength. |
textarea | Multi-line text input | Text that may contain line breaks. In an editable table Enter breaks the line and Ctrl / ⌘ + Enter commits; in the stable layout the box fills its cell. |
select | Select | Single value or array; field options / dictionary supplies options. |
enum | Alias of select | Identical to select. |
digit | Number input | Number; configure the host with min / max / step / precision. |
money | Number input | Same host as digit; configure money formatting and precision explicitly. |
date | Date picker | A YYYY-MM-DD string. |
dateTime | Date-time picker | A YYYY-MM-DD HH:mm:ss string. |
dateRange | Date range picker | An array of two YYYY-MM-DD strings. |
dateTimeRange | Date-time range picker | An array of two YYYY-MM-DD HH:mm:ss strings. |
time | Time picker | An HH:mm:ss string. |
TableControlValueType
The extensible type used by query field valueType, column search.valueType and editor.valueType. Built-in keys have completion suggestions; custom strings require matching controls entries. This type intentionally accepts arbitrary strings and does not guarantee spelling checks. Use TableBuiltinControlValueType when only built-in keys are allowed.
export type TableControlValueType = TableBuiltinControlValueType | (string & Record<never, never>)VTableQuery
TableQueryField<TValues> defines fields by query draft keys. TableQueryColumn<TRecord, TValues> adds column-level search metadata for field derivation. VTableQuery defaults to the responsive QueryFilter. Set layoutType="LightFilter" for popup-based filters. See Schema query.
export { VTableQuery } from '@vtable-guild/vtable-guild'
export declare function deriveTableQueryFields<
TValues extends object,
TRecord extends object = TValues,
>(
columns: readonly TableQueryColumn<TRecord, TValues>[],
overrides?: Partial<Record<keyof TValues & string, false | Partial<TableQueryField<TValues>>>>,
): TableQueryField<TValues>[]
export interface TableQueryFieldContext<TValues extends object> {
values: Readonly<TValues>
field: TableQueryField<TValues>
}
/** Query metadata is independent from table visibility, ordering and readonly field formatting. */
export interface TableQueryField<TValues extends object = Record<string, unknown>> {
name: keyof TValues & string
label?: VNodeChild
/** Select a registered host control; missing or unregistered keys fall back to text. */
valueType?: TableControlValueType
/** Larger values appear first, independently of table column order. */
order?: number
/** QueryFilter grid units; one unit occupies the configured span. Ignored by inline packing. */
colSize?: number
/** LightFilter fields collected inside More filters. */
secondary?: boolean
hidden?: boolean | ((context: TableQueryFieldContext<TValues>) => boolean)
disabled?: boolean | ((context: TableQueryFieldContext<TValues>) => boolean)
readonly?: boolean | ((context: TableQueryFieldContext<TValues>) => boolean)
/** Props passed to the registered host FormItem in native mode. */
formItemProps?:
| Record<string, unknown>
| ((context: TableQueryFieldContext<TValues>) => Record<string, unknown>)
fieldProps?:
| Record<string, unknown>
| ((context: TableQueryFieldContext<TValues>) => Record<string, unknown>)
options?: MaybeRefOrGetter<readonly TableDictionaryOption[]>
dictionary?: TableDictionaryBinding
}
export type TableQueryColumn<TRecord extends object, TValues extends object = TRecord> =
| (ColumnType<TRecord> & {
search?: false | (Omit<TableQueryField<TValues>, 'name'> & { name?: keyof TValues & string })
hideInSearch?: boolean
})
| (Omit<ColumnGroupType<TRecord>, 'children'> & {
children: TableQueryColumn<TRecord, TValues>[]
search?: false
hideInSearch?: boolean
})
| ColumnSentinel
export interface TableQueryLocale {
label: string
submit: string
reset: string
expand: string
collapse: string
more: string
confirm: string
clear: string
validationFailed: string
}
export interface TableQueryValidationContext<TValues extends object> {
fields: readonly TableQueryField<TValues>[]
action: 'submit' | 'reset'
signal: AbortSignal
}
export interface TableQueryProps<
TValues extends object = Record<string, unknown>,
TParams extends object = TValues,
TRecord extends object = TValues,
> {
query: UseTableQueryReturn<TValues, TParams>
/** Use div when an existing host Form wraps this query area, avoiding nested forms. */
rootTag?: 'form' | 'div'
/** Explicit fields take precedence over columns. */
fields?: readonly TableQueryField<TValues>[]
columns?: readonly TableQueryColumn<TRecord, TValues>[]
controls: TableControls
layoutType?: 'QueryFilter' | 'LightFilter'
/** Defaults to the registered host Form/FormItem, or built-in rendering if unavailable. */
formMode?: 'native' | 'builtin'
/** Native QueryFilter defaults to inline packing. Built-in QueryFilter always uses the grid. */
queryLayout?: 'inline' | 'grid'
/** Props passed to the registered host Form. VTable owns the model and submit/reset flow. */
formProps?: Record<string, unknown>
layout?: 'horizontal' | 'inline' | 'vertical'
span?: number | Partial<Record<'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl', number>>
/** Grid layout: maximum controls in the collapsed row, limited by its grid capacity. */
defaultColsNumber?: number
/** Grid layout: overrides defaultColsNumber and permits multiple collapsed rows. */
defaultFormItemsNumber?: number
defaultCollapsed?: boolean
collapsed?: boolean
onCollapse?: (collapsed: boolean) => void
collapseRender?: boolean | ((collapsed: boolean) => VNodeChild)
optionRender?:
| boolean
| ((context: TableQueryActionSlotProps, buttons: VNodeChild[]) => VNodeChild)
searchText?: string
resetText?: string
labelWidth?: number | 'auto'
searchGutter?: number | [number, number]
split?: boolean
/** Keep hidden fields registered and include their values in submissions. Defaults to true. */
preserve?: boolean
showHiddenNum?: boolean
submitter?: false | TableQuerySubmitter
submitterColSpanProps?: { span: number; offset?: number; class?: string; style?: CSSProperties }
/** LightFilter: collect every field in the filter popup. */
collapse?: boolean
collapseLabel?: VNodeChild
footerRender?: false | ((context: TableQueryFooterContext<TValues>) => VNodeChild)
getPopupContainer?: (anchor: HTMLElement) => HTMLElement | string
disabled?: boolean
/** Connect a host form's validate here. false or an exception prevents query submission. */
validate?: (
values: Readonly<TValues>,
context: TableQueryValidationContext<TValues>,
) => boolean | void | Promise<boolean | void>
errors?: Readonly<Partial<Record<keyof TValues & string, string>>>
locale?: Partial<TableQueryLocale>
ui?: Partial<Record<QuerySlots, string>>
class?: string
}
export interface TableQuerySubmitter {
searchConfig?: { submitText?: string; resetText?: string }
submitButtonProps?: false | Record<string, unknown>
resetButtonProps?: false | Record<string, unknown>
render?: false | ((context: TableQueryActionSlotProps, buttons: VNodeChild[]) => VNodeChild)
}
export interface TableQueryFooterContext<TValues extends object = Record<string, unknown>> {
values: Readonly<TValues>
fields: readonly TableQueryField<TValues>[]
confirm: () => Promise<boolean>
clear: () => Promise<boolean>
submitting: boolean
}
export interface TableQueryFieldSlotProps<TValues extends object = Record<string, unknown>> {
field: TableQueryField<TValues>
values: Readonly<TValues>
control: TableControlContext
layoutType: 'QueryFilter' | 'LightFilter'
}
export interface TableQueryActionSlotProps {
submit: () => Promise<boolean>
reset: () => Promise<boolean>
submitting: boolean
collapsed: boolean
toggleCollapsed: () => void
showCollapseButton: boolean
}
export interface TableQuerySlots<TValues extends object = Record<string, unknown>> {
field?: (props: TableQueryFieldSlotProps<TValues>) => VNodeChild
actions?: (props: TableQueryActionSlotProps) => VNodeChild
}
export interface TableQueryInstance {
submit: () => Promise<boolean>
reset: () => Promise<boolean>
/** Cancel pending host validation, retaining form values. */
cancel: () => void
}
import { TABLE_QUERY_FORM_ADAPTER } from '@vtable-guild/vtable-guild'
/** Shared by schema query fields and editable cells; host libraries remain optional. */
export interface TableControlContext {
value: unknown
onChange: (value: unknown) => void
onSearch?: (keyword: string) => void
fieldProps: Record<string, unknown>
options: readonly TableDictionaryOption[]
disabled: boolean
readonly: boolean
loading: boolean
error?: string
id?: string
name?: string
mode: 'query' | 'edit'
/** Present when the renderer is used inside a LightFilter popup. */
lightFilter?: {
grouped: boolean
getPopupContainer: () => HTMLElement
}
/** Present when the renderer is mounted for click-triggered cell editing. */
cellEdit?: TableControlCellEditBridge
}
export type TableControlCellCommitMode = 'blur' | 'change' | 'popup-close'
export type TableControlCellCommitReason = TableControlCellCommitMode | 'explicit'
export interface TableControlCellEditOptions {
/** Select how cell editing commits for this control; may depend on fieldProps (e.g. single vs multiple Select). */
commitOn?:
| TableControlCellCommitMode
| ((context: TableControlContext) => TableControlCellCommitMode)
/** Open the host popup automatically when entering cell edit mode. */
autoOpen?: boolean | ((context: TableControlContext) => boolean)
}
export interface TableControlCellEditBridge {
/** True for the initial focus of an editor whose control requests an open popup. */
autoOpen?: boolean
/** The host has requested a close and may still publish a value as focus leaves. */
closingPopup?: boolean
commit: (reason?: TableControlCellCommitReason) => void
cancel: () => void
/** Track host popup open state so popup Esc / internal focus transfers do not prematurely commit or cancel. */
setPopupOpen: (open: boolean) => void
}
export interface TableControlLightFilterOptions {
/** Selected value summary in the filter trigger. */
formatValue?: (context: TableControlContext) => VNodeChild
/** Submit changes immediately for standalone fields. Grouped edits always require confirmation. */
submitOnChange?: boolean
/** Defaults to true for standalone fields that submit immediately. */
closeOnChange?: boolean | ((context: TableControlContext) => boolean)
}
export type TableControlRenderer = ((context: TableControlContext) => VNodeChild) & {
lightFilter?: TableControlLightFilterOptions
cellEdit?: TableControlCellEditOptions
/**
* Stretch the control over the full height of its cell in the 'stable' edit layout.
* For multi-line controls: a cell whose text wraps is then edited in a box of the same size.
*/
fill?: boolean
}
/** Optional form renderer metadata on a controls registry. */
export { TABLE_QUERY_FORM_ADAPTER } from '@vtable-guild/vtable-guild'
export interface TableQueryFormAdapter {
kind: 'antdv' | 'element-plus'
Form: Component
FormItem: Component
Button?: Component
}
export type TableControls = Readonly<
Record<string, TableControlRenderer> & { [TABLE_QUERY_FORM_ADAPTER]?: TableQueryFormAdapter }
>
/** Pass components already installed by the host application. No UI library is imported here. */
export interface TableControlComponents {
Input: Component
/** Multi-line input. Ant Design Vue defaults to Input.TextArea; Element Plus uses Input with type="textarea". */
TextArea?: Component
Select: Component
InputNumber: Component
DatePicker: Component
RangePicker?: Component
TimePicker?: Component
/** Element Plus ElOption; unused by the Ant Design Vue adapter. */
Option?: Component
/** Provide both Form and FormItem to enable native query form rendering. */
Form?: Component
FormItem?: Component
/** Use the host button for native query form actions. */
Button?: Component
}useTableEdit
UseTableEditOptions<TRecord> defines the stable row key, single-row / multi-row mode, and the clone, validation, save and cancel callbacks. TableEditContext provides the original snapshot, the new-row flag and an AbortSignal; a failed validation returns TableEditValidationErrors, and errors are classified as TableEditError. The return value covers draft access, editing keys, saving state, added rows and more. See Editing.
export declare function useTableEdit<TRecord extends object>(
options: UseTableEditOptions<TRecord>,
): UseTableEditReturn<TRecord>
export interface TableEditContext<TRecord extends object> {
key: Key
/** Snapshot from start(); undefined for a cached addition until it is saved. */
original: TRecord | undefined
isNew: boolean
signal: AbortSignal
}
export type TableEditDraftContext<TRecord extends object> = Omit<
TableEditContext<TRecord>,
'signal'
>
export interface TableEditAddConfig {
position?: 'top' | 'bottom'
/** Cache until saved (default), or immediately insert into the controlled source. */
mode?: 'cache' | 'source'
}
export interface TableEditValidationErrors {
message?: string
/** Field names or business-defined nested field paths. */
fields?: Record<string, string>
}
export interface TableEditError extends TableEditValidationErrors {
type: 'validation' | 'save' | 'cancel'
message: string
cause?: unknown
}
export interface TableEditValidationResult<TRecord extends object> {
valid: boolean
/** Submitted snapshots from this validation; absent for failures or obsolete work. */
values?: TRecord[]
errors: ReadonlyMap<Key, TableEditError>
obsolete?: boolean
}
export interface UseTableEditOptions<TRecord extends object> {
/** A stable key is required; row indexes are intentionally unsupported. */
rowKey: keyof TRecord | ((record: TRecord) => Key)
/** Defaults to single. Starting another row in single mode returns false. */
mode?: 'single' | 'multiple'
/** Override when records contain mutable class instances. */
clone?: (record: TRecord) => TRecord
/** Optional controlled source. Parent updates never replace an open local draft. */
dataSource?: MaybeRefOrGetter<readonly TRecord[]>
/** Commit notifications only; draft keystrokes never write back into the source. */
onChange?: (records: TRecord[]) => void
/** Convert a record when editing starts and when validateAll() validates a row without a draft. */
toDraft?: (record: TRecord, context: TableEditDraftContext<TRecord>) => TRecord
/** Convert an editor snapshot when saving or obtaining submitted values. */
toValue?: (draft: TRecord, context: TableEditContext<TRecord>) => TRecord
/** Used by add() when no explicit record is supplied. */
createRecord?: () => TRecord
/** Maximum client-held rows, including cached additions. Finite limits round down to an integer. */
maxRows?: number
/** Return errors to keep the draft open, or void to continue saving. */
validate?: (
draft: TRecord,
context: TableEditContext<TRecord>,
) => TableEditValidationErrors | void | Promise<TableEditValidationErrors | void>
/**
* Return a canonical record, true/void to accept the submitted value, or false to keep editing.
* With dataSource and onChange, return the saved record here and update the source in onChange.
*/
onSave?: (
draft: TRecord,
context: TableEditContext<TRecord>,
) => TRecord | void | boolean | Promise<TRecord | void | boolean>
/** Returning false or rejecting keeps the draft open. Cancellation aborts a pending save first. */
onCancel?: (
draft: TRecord,
context: TableEditContext<TRecord>,
) => void | boolean | Promise<void | boolean>
onError?: (error: TableEditError, key: Key) => void
}
export interface UseTableEditReturn<TRecord extends object> {
/** Controlled source overlaid with local drafts and positioned cached additions. */
records: ComputedRef<TRecord[]>
validating: ComputedRef<boolean>
editableKeys: ComputedRef<readonly Key[]>
savingKeys: ComputedRef<ReadonlySet<Key>>
cancellingKeys: ComputedRef<ReadonlySet<Key>>
errors: ComputedRef<ReadonlyMap<Key, TableEditError>>
/** Unsaved cache-mode additions. Source-mode additions are committed through onChange. */
newRecords: ComputedRef<TRecord[]>
isEditing: (key: Key) => boolean
/** Returns an isolated copy. Use setDraft() to apply changes. */
getDraft: (key: Key) => TRecord | undefined
/** Source snapshot captured when editing began; undefined for cached additions or missing sessions. */
getOriginal: (key: Key) => TRecord | undefined
getDrafts: () => ReadonlyMap<Key, TRecord>
/** Source records plus converted draft snapshots; never calls onSave or onChange. */
getValues: () => TRecord[]
/** Validate all client-held rows, including unmounted virtual rows, without saving. */
validateAll: () => Promise<TableEditValidationResult<TRecord>>
/** Abort operations and discard drafts/errors, retaining the current controlled source. */
reset: () => void
start: (record: TRecord) => boolean
add: (record?: TRecord, config?: TableEditAddConfig) => boolean
setDraft: (key: Key, patch: Partial<TRecord> | ((draft: TRecord) => TRecord)) => boolean
/** Resolves undefined on validation/save failure, cancellation, or disposal. */
save: (key: Key) => Promise<TRecord | undefined>
cancel: (key: Key) => Promise<boolean>
cancelAll: () => Promise<boolean[]>
}useTableEditable
UseTableEditableOptions<TRecord> inherits the row editing options, with conversions provided by each column's convertValue / transform. The return value inherits all state and methods from useTableEdit and adds getCell and renderEditor. The declarations below also list the row data in TableEditableCellContext; see VTableQuery above for the host control context and registry declarations. VTableEditCellProps and VTableEditShellProps are documentation helpers describing the component inputs. See the Column editing API for usage.
export declare function useTableEditable<T extends object>(
options: UseTableEditableOptions<T>,
): UseTableEditableReturn<T>
export interface TableEditableFieldContext<TRecord extends object> {
key: Key
name: string
column: ColumnType<TRecord>
draft: TRecord
original?: TRecord
value: unknown
isNew: boolean
}
export interface TableColumnEditor<TRecord extends object> {
/** Select a built-in or custom host control; omission uses the column's inferred control. */
valueType?: TableControlValueType
editable?: boolean | ((context: TableEditableFieldContext<TRecord>) => boolean)
readonly?: boolean | ((context: TableEditableFieldContext<TRecord>) => boolean)
disabled?: boolean | ((context: TableEditableFieldContext<TRecord>) => boolean)
fieldProps?:
| Record<string, unknown>
| ((context: TableEditableFieldContext<TRecord>) => Record<string, unknown>)
options?: MaybeRefOrGetter<readonly TableDictionaryOption[]>
dictionary?: TableDictionaryBinding
/** Convert source values for editing, dynamic entry conditions, and validation of undrafted rows. */
convertValue?: (value: unknown, context: TableEditableFieldContext<TRecord>) => unknown
/** Applied to a draft snapshot for saving/getValues, without rewriting the editor value. */
transform?: (value: unknown, context: TableEditableFieldContext<TRecord>) => unknown
validate?: (
value: unknown,
context: TableEditableFieldContext<TRecord> & { signal: AbortSignal },
) => string | void | Promise<string | void>
/** A linked-field patch after the current field changes. */
onValueChange?: (
value: unknown,
context: TableEditableFieldContext<TRecord>,
) => Partial<TRecord> | void
}
export type TableEditTrigger = 'manual' | 'click'
/**
* - 'stable': the control is stacked over the display content, so entering edit mode
* changes neither the column width nor the row height.
* - 'flow': the control takes part in layout with its own size.
*/
export type TableEditLayout = 'stable' | 'flow'
/**
* - 'inline': the error takes a line below the control and makes the row taller.
* - 'tooltip': the error is shown in a tooltip while the cell is hovered or focused.
*/
export type TableEditErrorPlacement = 'inline' | 'tooltip'
export interface TableEditRenderOptions<TRecord extends object> {
/** Overrides the layout configured on useTableEditable for this cell. */
layout?: TableEditLayout
/** Overrides the error placement configured on useTableEditable for this cell. */
errorPlacement?: TableEditErrorPlacement
/**
* Content of the hidden layer that keeps the cell at its display size in 'stable' layout.
* Receives the cell as it was displayed before editing; defaults to the column's display rendering.
*/
sizer?: (cell: TableBodyCellSlotProps<TRecord>) => VNodeChild
}
export interface TableEditableActiveCell {
key: Key
/** Stable column key (explicit column.key or normalized dataIndex key). */
columnKey: Key
/** Normalized field name matching TableEditableFieldContext.name and errors.fields keys. */
name: string
}
export type TableEditCellUiSlots =
| 'editCell'
| 'editSizer'
| 'editControl'
| 'editError'
| 'editTrigger'
| 'editTriggerValue'
| 'editTriggerIcon'
export interface TableEditableCellContext<TRecord extends object> extends TableControlContext {
key: Key
column: ColumnType<TRecord>
draft: TRecord
valueType: TableControlValueType
/** Present for freshly activated cells so the editor focuses once without stealing focus on remounts. */
autoFocusToken?: number
consumeAutoFocus?: (token: number) => boolean
}
export interface UseTableEditableOptions<TRecord extends object> extends Omit<
UseTableEditOptions<TRecord>,
'toDraft' | 'toValue'
> {
columns: MaybeRefOrGetter<ColumnsType<TRecord>>
controls: MaybeRefOrGetter<TableControls>
/**
* Editing trigger mode:
* - 'manual' (default): row-level editing via start() / save() / cancel().
* - 'click': cell-level hover hint and click-to-edit managed through VTableEditCell.
*/
trigger?: TableEditTrigger
/** Show row-level save/cancel/validation message inside the active cell in cell-trigger mode. Defaults to true. */
showRowError?: boolean
/**
* How an editing cell takes part in table layout:
* - 'stable' (default): keeps the display size of the cell while editing.
* - 'flow': sizes the cell by its control.
*/
layout?: TableEditLayout
/**
* Where a field error is shown:
* - 'inline' (default): below the control, which makes the row taller.
* - 'tooltip': in a tooltip, leaving the row height unchanged.
*/
errorPlacement?: TableEditErrorPlacement
/** Compare the full edited row with its baseline, including domain-specific private state. */
isDraftEqual?: (draft: TRecord, baseline: TRecord) => boolean
ui?: Partial<Record<TableEditCellUiSlots, string>>
}
export interface UseTableEditableReturn<
TRecord extends object,
> extends UseTableEditReturn<TRecord> {
trigger: TableEditTrigger
/** Resolved edit layout. */
layout: TableEditLayout
/** Resolved error placement. */
errorPlacement: TableEditErrorPlacement
/** Active cell sessions keyed by row key (empty in 'manual' mode). */
activeCells: ComputedRef<ReadonlyMap<Key, TableEditableActiveCell>>
/** Whether a cell can enter click-to-edit mode (checks editor, editable, readonly and disabled). */
canEditCell: (context: Pick<CustomRenderContext<TRecord>, 'record' | 'column'>) => boolean
/** Activate a specific cell for editing, committing any competing active cell first. */
startCell: (record: TRecord, column: ColumnType<TRecord>) => Promise<boolean>
/** Commit an active cell; unchanged drafts exit cleanly without calling onSave. */
commitCell: (key: Key, column?: ColumnType<TRecord>) => Promise<boolean>
/** Cancel an active cell, preserving borrowed drafts or cached additions. */
cancelCell: (key: Key, column?: ColumnType<TRecord>) => Promise<boolean>
/** Optional ui overrides configured on useTableEditable. */
ui?: Partial<Record<TableEditCellUiSlots, string>>
getCell: (
context: Pick<CustomRenderContext<TRecord>, 'record' | 'column'>,
) => TableEditableCellContext<TRecord> | undefined
/** Return from bodyCell; undefined retains VTable's normal readonly rendering. */
renderEditor: (
context: CustomRenderContext<TRecord>,
ui?: Partial<Record<TableEditCellUiSlots, string>>,
options?: TableEditRenderOptions<TRecord>,
) => VNodeChild
}
/** Documentation helper for VTableEditCell props; this interface is not a package export. */
export interface VTableEditCellProps<TRecord extends object = Record<string, unknown>> {
edit: Pick<UseTableEditableReturn<TRecord>, 'renderEditor'> &
Partial<
Pick<
UseTableEditableReturn<TRecord>,
'trigger' | 'layout' | 'errorPlacement' | 'getCell' | 'canEditCell' | 'startCell' | 'ui'
>
>
cell: TableBodyCellSlotProps<TRecord>
emptyText?: string
editIcon?: boolean
/** Overrides the layout configured on useTableEditable for this cell. */
layout?: TableEditLayout
/** Overrides the error placement configured on useTableEditable for this cell. */
errorPlacement?: TableEditErrorPlacement
ui?: Partial<Record<TableEditCellUiSlots, string>>
}
/** Documentation helper for VTableEditShell props; this interface is not a package export. */
export interface VTableEditShellProps<TRecord extends object = Record<string, unknown>> {
/** The bodyCell slot context of the cell being edited. */
cell: TableBodyCellSlotProps<TRecord>
/** The record as it was before editing, e.g. edit.getOriginal(key). Defaults to cell.record. */
original?: TRecord
layout?: TableEditLayout
/** Stretch the control to the height of the cell; for a multi-line control such as a textarea. */
fill?: boolean
error?: string
errorPlacement?: TableEditErrorPlacement
ui?: Partial<Record<TableEditCellUiSlots, string>>
}useColumnState
UseColumnStateOptions configures default preferences, storage and versioning; TableColumnState stores visibility, pinning and order by stable column path. The returned columns is a writable computed and state is a readonly computed; setState / reset / restore / save all return void. See the Column preference API for the full options and methods.
export declare function useColumnState<T extends object>(
source: MaybeRefOrGetter<ColumnsType<T>>,
options?: UseColumnStateOptions,
): {
columns: WritableComputedRef<ColumnsType<T>, ColumnsType<T>>
state: ComputedRef<TableColumnState>
setState: (value: TableColumnState) => void
reset: () => void
restore: () => void
save: () => void
}
export interface TableColumnStateValue {
visible?: boolean
/** Pinning and ordering belong to top-level columns/groups. */
fixed?: 'left' | 'right' | false
order?: number
}
/** Keys are the stable column paths returned by this helper's state. */
export type TableColumnState = Record<string, TableColumnStateValue>
export interface UseColumnStateOptions {
defaultValue?: TableColumnState
storageKey?: string
storageType?: 'localStorage' | 'sessionStorage'
version?: string | number
/** Optional application storage adapter. Only serializable state is stored. */
storage?: Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>
onError?: (error: unknown) => void
}Field renderers
A column selects a renderer through valueType, and fieldProps supports a static config or one computed per cell; the table's renderers is a scoped registry. TableFieldRenderContext contains the raw value, the displayValue after enum mapping, the status, the config and the locale; a renderer returns a VNode or a TableFieldRenderResult carrying tooltipText / status. See Field renderers.
/** ColumnType / TableProps 节选;枚举与状态继续使用同一份 valueEnum。 */
export interface FieldRendererColumnFields<TRecord extends object = Record<string, any>> {
valueType?: string
fieldProps?: TableFieldProps | ((context: CustomRenderContext<TRecord>) => TableFieldProps)
}
export interface FieldRendererTableFields<TRecord extends object = Record<string, any>> {
renderers?: TableFieldRenderers<TRecord>
}export { createTableRenderers } from '@vtable-guild/vtable-guild'
/** Options shared by the built-in formatters; custom renderers may add their own fields. */
export interface TableFieldProps {
locale?: string | string[]
numberFormat?: Intl.NumberFormatOptions
/** Default date output is YYYY-MM-DD; an explicit options object enables Intl formatting. */
dateFormat?: Intl.DateTimeFormatOptions
/** Currency used by money; defaults to CNY. */
currency?: string
/** percent/progress input scale. Default 'percent' (25 means 25%); 'ratio' uses 0..1. */
percentScale?: 'percent' | 'ratio'
/** Range display separator and missing-endpoint placeholder. Defaults to ' ~ ' and '—'. */
rangeSeparator?: string
rangeEmptyText?: string
/** Show the progress percentage next to its track. Default true. */
showValue?: boolean
/** tag and progress reuse the same status tokens as valueEnum. */
status?: ColumnValueStatus
[key: string]: unknown
}
export interface TableFieldRenderContext<
TRecord extends object = Record<string, unknown>,
> extends CustomRenderContext<TRecord> {
/** The enum label, or the transformed scalar value when no enum matches. */
displayValue: VNodeChild
/** Resolved from valueEnum, preserving Map key identity. */
status?: ColumnValueStatus
fieldProps: TableFieldProps
/** Current table locale; a field's locale option takes precedence. */
locale?: string
}
export interface TableFieldRenderResult {
children: VNodeChild
/** Explicit plain text for ellipsis tooltips; VNodes are never stringified. */
tooltipText?: string
/** Uses the existing theme status slot. */
status?: ColumnValueStatus
/** Render with the theme's tag or progress appearance instead of a status dot. */
presentation?: 'tag' | 'progress'
/** A finite percentage in 0..100; rendered through the table's progress theme slots. */
progress?: { percent: number; showValue: boolean }
}
export type TableFieldRenderer<TRecord extends object = Record<string, unknown>> = (
context: TableFieldRenderContext<TRecord>,
) => VNodeChild | TableFieldRenderResult
/** A registry is local to a table or application; no process-wide mutable registry is used. */
export type TableFieldRenderers<TRecord extends object = Record<string, unknown>> = Readonly<
Record<string, TableFieldRenderer<TRecord>>
>Lazy-loaded tree
TableTreeLoadData<TRecord> receives the node and a TableTreeLoadContext, and returns a Promise of the child record array. isLeaf marks terminal nodes; onTreeLoadError receives the error and the node. Retry is called through the table instance. See Tree table.
/** TableProps 节选;文档辅助接口,不是包导出。 */
export interface TreeFields<TRecord extends object = Record<string, any>> {
loadData?: TableTreeLoadData<TRecord>
isLeaf?: (record: TRecord) => boolean
onTreeLoadError?: (error: Error, record: TRecord) => void
childrenColumnName?: string
rowKey?: string | ((record: TRecord) => Key)
indentSize?: number
expandedRowKeys?: Key[]
defaultExpandedRowKeys?: Key[]
defaultExpandAllRows?: boolean
onExpand?: (expanded: boolean, record: TRecord) => void
onExpandedRowsChange?: (expandedKeys: Key[]) => void
}export type { TableTreeLoadContext, TableTreeLoadData } from '@vtable-guild/vtable-guild'TableInstance / TableScrollToOptions
TableInstance is the minimal public protocol of the table instance obtained through a ref. It contains scrollTo(options): Promise<boolean>, retryTreeLoad(key): Promise<boolean> and getTreeLoadError(key). The scroll options support key / index / top / left / align / offset; key takes precedence over index, and row positioning is limited to the currently loaded, visible page. See the API Reference.
export type { TableInstance, TableScrollToOptions } from '@vtable-guild/vtable-guild'Scope and disposal
useTableQuery, useTableEdit and useTableRequest should be created inside a component's setup or an effectScope; when that scope is disposed they stop watching and ignore stale async results. The editing and request protocols also abort the signal and settle pending operations; application requests made in query callbacks are cancelled by their own data layer. Unmounting the table itself invalidates lazy loading / retry, which then return false, and instance scrolling after unmount returns false as well. createTableRenderers creates a renderer map with no listeners, so it needs no extra disposal.
Theme and plugin types
ThemePresetName
Built-in theme preset names.
export type ThemePresetName = 'antdv' | 'element-plus'VTableGuildOptions
The complete configuration of createVTableGuild().
export interface VTableGuildOptions {
themePreset?: ThemePresetName
cssMode?: VTableGuildCssMode
classPrefix?: string
theme?: VTableGuildThemeOverrides
locale?: LocaleName
locales?: LocaleRegistry
localeOverrides?: DeepPartial<VTableGuildLocale>
/** 安装时读取一次,不支持运行时切换。 */
compatClass?: boolean
}For when to use cssMode and classPrefix, see Installation and usage; for compatClass, see Migrating from ant-design-vue.
createVTableGuild
The configuration is optional; it returns a Vue Plugin.
export declare function createVTableGuild(options?: VTableGuildOptions): PluginVTableGuildCssMode
The style mode must match the CSS entry you actually import.
export type VTableGuildCssMode = 'prebuilt' | 'tailwind3' | 'tailwind4'LocaleName
Applications can register their own locale identifiers.
export type LocaleName = stringexport type BuiltInLocaleName = 'zh-CN' | 'en-US'LocaleRegistry
The locale pack registry; use locales to register complete locale packs and localeOverrides for partial overrides.
export type LocaleRegistry = Record<LocaleName, VTableGuildLocale>VTableGuildLocale
export interface VTableGuildLocale {
table: VTableGuildTableLocale
pagination?: VTableGuildPaginationLocale
columnSettings?: VTableGuildColumnSettingsLocale
toolbar?: VTableGuildToolbarLocale
selectionAlert?: VTableGuildSelectionAlertLocale
}export interface VTableGuildTableLocale {
tree?: { expand: string; collapse: string; retry: string }
cell?: {
copy: string
copied: string
copyFailed: string
edit?: string
clickToEdit?: string
cancelEdit?: string
}
header: VTableGuildTableHeaderLocale
filterDropdown: VTableGuildTableFilterDropdownLocale
empty: VTableGuildTableEmptyLocale
loading: VTableGuildTableLoadingLocale
selection: VTableGuildTableSelectionLocale
}export interface VTableGuildTableHeaderLocale {
sortTriggerAsc: string
sortTriggerDesc: string
cancelSort: string
filterTriggerAriaLabel: string
}export interface VTableGuildTableFilterDropdownLocale {
searchPlaceholder: string
emptyText: string
resetText: string
confirmText: string
selectAllText: string
}export interface VTableGuildTableEmptyLocale {
text: string
}export interface VTableGuildTableLoadingLocale {
text: string
}export interface VTableGuildTableSelectionLocale {
selectAll: string
selectInvert: string
selectNone: string
/** 表头批量选择菜单入口的无障碍名称;可选,旧语言包无需补齐。 */
selectionsTriggerAriaLabel?: string
}export interface VTableGuildPaginationLocale {
items_per_page: string
jump_to: string
jump_to_confirm: string
page: string
prev_page: string
next_page: string
prev_5: string
next_5: string
prev_3: string
next_3: string
/** {count} 会被替换为跳转页数。 */
prev_pages?: string
next_pages?: string
navigation: string
page_size: string
}export interface VTableGuildColumnSettingsLocale {
fixed?: string
fixedLeft?: string
fixedRight?: string
unfixed?: string
mixed?: string
move?: string
title: string
reset: string
density: string
large: string
middle: string
small: string
columns: string
empty: string
}export interface VTableGuildToolbarLocale {
searchPlaceholder?: string
search?: string
clearSearch?: string
label: string
reload: string
fullScreen: string
exitFullScreen: string
}export declare const paginationZhCN: VTableGuildPaginationLocale
export declare const paginationEnUS: VTableGuildPaginationLocale
export declare const elementPlusPaginationZhCN: VTableGuildPaginationLocale
export declare const elementPlusPaginationEnUS: VTableGuildPaginationLocaleDeepPartial
export type DeepPartial<T> = {
[K in keyof T]?: NonNullable<T[K]> extends Array<infer U>
? Array<DeepPartial<U>>
: NonNullable<T[K]> extends object
? DeepPartial<T[K]>
: T[K]
}ThemeConfig
The raw structure passed to the theme system.
export interface ThemeConfig {
slots: Record<string, string>
variants?: Record<string, Record<string, Record<string, string> | string>>
defaultVariants?: Record<string, string | boolean>
compoundVariants?: Array<Record<string, unknown>>
compoundSlots?: Array<Record<string, unknown>>
}SlotProps
The type of the per-instance ui; it keeps the slot keys of the concrete theme.
export type SlotProps<T extends ThemeConfig> = Partial<Record<keyof T['slots'] & string, string>>ThemeOverrideConfig
The complete mapped type for global theme overrides. It keeps slot and variant keys and allows overriding them with any class string. The Theme* helper types inside the declaration block are not package exports.
// 以下 Theme* 辅助类型用于展开声明,不是包导出。
type ThemeSlotKeys<T extends ThemeConfig> = keyof T['slots'] & string
type ThemeVariantOverrides<T extends ThemeConfig> = {
[TVariant in keyof NonNullable<T['variants']>]?: NonNullable<
T['variants']
>[TVariant] extends Record<string, unknown>
? {
[TValue in keyof NonNullable<T['variants']>[TVariant]]?: NonNullable<
T['variants']
>[TVariant][TValue] extends string
? string
: Partial<Record<ThemeSlotKeys<T>, string>>
}
: never
}
type ThemeDefaultVariantOverrides<T extends ThemeConfig> = {
[TVariant in keyof NonNullable<T['defaultVariants']>]?: NonNullable<
T['defaultVariants']
>[TVariant] extends boolean
? boolean
: string
}
type ThemeCompoundRuleOverride<T, TSlotKey extends string> = T extends string
? string
: T extends boolean
? boolean
: T extends readonly (infer U)[]
? Array<U extends string ? Extract<U, TSlotKey> : ThemeCompoundRuleOverride<U, TSlotKey>>
: T extends object
? {
[K in keyof T]?: K extends 'class'
? string
: K extends 'slots'
? T[K] extends readonly (infer U)[]
? Array<Extract<U, TSlotKey>>
: ThemeCompoundRuleOverride<T[K], TSlotKey>
: ThemeCompoundRuleOverride<T[K], TSlotKey>
}
: T
export type ThemeOverrideConfig<T extends ThemeConfig> = {
slots?: Partial<Record<ThemeSlotKeys<T>, string>>
variants?: ThemeVariantOverrides<T>
defaultVariants?: ThemeDefaultVariantOverrides<T>
compoundVariants?: T extends { compoundVariants?: readonly (infer U)[] }
? Array<ThemeCompoundRuleOverride<U, ThemeSlotKeys<T>>>
: never
compoundSlots?: T extends { compoundSlots?: readonly (infer U)[] }
? Array<ThemeCompoundRuleOverride<U, ThemeSlotKeys<T>>>
: never
}TableSlots and TableThemeConfig
TableSlots is the union of all Table theme slots; see the ui slot reference for what each one does. Theme constants are imported from @vtable-guild/vtable-guild, and typeof keeps the preset's literals, readonly properties and variant mapping.
export type TableSlots =
| 'root'
| 'wrapper'
| 'rootAutoHeight'
| 'wrapperAutoHeight'
| 'table'
| 'thead'
| 'tbody'
| 'widthConstraintCell'
| 'widthConstraintInner'
| 'widthLayoutCell'
| 'tr'
| 'groupedHeaderTable'
| 'groupedHeaderTh'
| 'groupedHeaderTd'
| 'th'
| 'td'
| 'empty'
| 'loading'
| 'headerCellInner'
| 'bodyCellEllipsis'
| 'thSortable'
| 'thSorted'
| 'tdSorted'
| 'sortButton'
| 'sortIconDown'
| 'sortAreaOuter'
| 'sortAreaWrapper'
| 'sortAreaTitle'
| 'headerHelp'
| 'cellContent'
| 'copyButton'
| 'cellStatus'
| 'cellTag'
| 'editCell'
| 'editSizer'
| 'editControl'
| 'editError'
| 'editTrigger'
| 'editTriggerValue'
| 'editTriggerIcon'
| 'cellProgress'
| 'cellProgressTrack'
| 'cellProgressBar'
| 'cellProgressText'
| 'filterIconWrapper'
| 'filterIcon'
| 'filterDropdown'
| 'filterDropdownList'
| 'filterDropdownItem'
| 'filterDropdownItemSelected'
| 'filterDropdownItemSelectedSingle'
| 'filterDropdownItemHover'
| 'filterDropdownSwitcher'
| 'filterDropdownSwitcherExpanded'
| 'filterDropdownSwitcherCollapsed'
| 'filterDropdownSwitcherNoop'
| 'filterDropdownContentWrapper'
| 'filterDropdownTreeWrapper'
| 'filterDropdownTreeList'
| 'filterDropdownTreeItem'
| 'filterDropdownTreeContentWrapper'
| 'filterDropdownTreeItemSelected'
| 'filterDropdownTreeItemMatched'
| 'filterDropdownTreeCheckAll'
| 'filterDropdownActions'
| 'filterDropdownResetButton'
| 'filterDropdownConfirmButton'
| 'filterDropdownSearch'
| 'filterDropdownSearchField'
| 'filterDropdownSearchIcon'
| 'filterDropdownSearchInput'
| 'filterDropdownListEmpty'
| 'emptyWrapper'
| 'emptyIcon'
| 'emptyText'
| 'loadingSpinner'
| 'tdSelected'
| 'tdRowHover'
| 'tdRowSelectedHover'
| 'trDragging'
| 'trDropAbove'
| 'trDropBelow'
| 'selectionDropdown'
| 'selectionDropdownItem'
| 'selectionExtra'
| 'title'
| 'footer'
| 'summary'
| 'summaryRow'
| 'summaryCell'
| 'headerWrapper'
| 'bodyWrapper'
| 'fixedCell'
| 'fixedDividerLeft'
| 'fixedDividerRight'
| 'fixedShadowLeft'
| 'fixedShadowRight'
| 'fixedShadowLeftHidden'
| 'fixedShadowRightHidden'
| 'expandIcon'
| 'expandIconExpanded'
| 'expandIconCollapsed'
| 'expandIconSpaced'
| 'expandIconDisabled'
| 'expandIconSymbol'
| 'expandIconSymbolExpanded'
| 'expandIconSymbolCollapsed'
| 'treeExpandIcon'
| 'treeExpandIconExpanded'
| 'treeExpandIconCollapsed'
| 'treeExpandIconSpaced'
| 'treeExpandIconDisabled'
| 'treeExpandIconSymbol'
| 'treeExpandIconLoading'
| 'treeExpandIconError'
| 'treeExpandIconSymbolExpanded'
| 'treeExpandIconSymbolCollapsed'
| 'expandedRow'
| 'expandedRowCell'
| 'resizeHandle'export type TableVariantProps = {
size?: 'large' | 'middle' | 'small'
bordered?: boolean
striped?: boolean
hoverable?: boolean
}// tableTheme 是公开的默认 antdv 主题;typeof 保留 readonly 与字面量 variant 配置。
export type TableThemeConfig = typeof tableThemePublic theme types of the other components:
export type ButtonSlots = 'root' | 'inner'
export type ButtonThemeConfig = typeof buttonTheme
export type CheckboxSlots = 'root' | 'checkMark' | 'indeterminateMark'
export type CheckboxThemeConfig = typeof checkboxTheme
export type RadioSlots = 'root' | 'dot'
export type RadioThemeConfig = typeof radioTheme
export type InputSlots = 'root'
export type InputThemeConfig = typeof inputTheme
export type TooltipSlots = 'content' | 'arrow' | 'arrowOuter' | 'arrowInner'
export type TooltipThemeConfig = typeof tooltipTheme
export type ScrollbarSlots =
| 'root'
| 'wrap'
| 'view'
| 'track'
| 'trackVertical'
| 'trackHorizontal'
| 'thumb'
export type ScrollbarThemeConfig = typeof scrollbarThemeexport type PaginationSlots =
| 'root'
| 'layout'
| 'left'
| 'right'
| 'extension'
| 'pages'
| 'item'
| 'active'
| 'jump'
| 'jumpEllipsis'
| 'jumpIcon'
| 'controls'
| 'simpleControls'
| 'simpleInput'
| 'slash'
| 'go'
| 'input'
| 'select'
| 'popup'
| 'option'
| 'optionActive'
| 'total'
| 'icon'export type PaginationThemeConfig = typeof paginationThemeexport type ColumnSettingsThemeConfig = typeof columnSettingsTheme
export type ColumnSettingsSlots = keyof ColumnSettingsThemeConfig['slots']export type ToolbarThemeConfig = typeof toolbarTheme
export type ToolbarSlots = keyof ToolbarThemeConfig['slots']VTableGuildThemeOverrides
The built-in theme map as augmented by @vtable-guild/theme; applications can add further components through module augmentation.
export interface VTableGuildThemeOverridesMap {
table: ThemeOverrideConfig<TableThemeConfig>
button: ThemeOverrideConfig<ButtonThemeConfig>
checkbox: ThemeOverrideConfig<CheckboxThemeConfig>
radio: ThemeOverrideConfig<RadioThemeConfig>
input: ThemeOverrideConfig<InputThemeConfig>
tooltip: ThemeOverrideConfig<TooltipThemeConfig>
scrollbar: ThemeOverrideConfig<ScrollbarThemeConfig>
pagination: ThemeOverrideConfig<PaginationThemeConfig>
columnSettings: ThemeOverrideConfig<ColumnSettingsThemeConfig>
toolbar: ThemeOverrideConfig<ToolbarThemeConfig>
selectionAlert: ThemeOverrideConfig<SelectionAlertThemeConfig>
query: ThemeOverrideConfig<QueryThemeConfig>
}export type VTableGuildThemeOverrides = {
[K in keyof VTableGuildThemeOverridesMap]?: VTableGuildThemeOverridesMap[K]
}VTableGuildContext
The complete configuration passed through provide / inject; application code normally uses the plugin or the Provider directly.
export interface VTableGuildContext {
themePreset: ThemePresetName
cssMode: VTableGuildCssMode
classPrefix: string
theme: VTableGuildThemeOverrides
locale: LocaleName
locales: LocaleRegistry
localeOverrides: DeepPartial<VTableGuildLocale>
compatClass?: boolean
}export declare const VTABLE_GUILD_INJECTION_KEY: InjectionKey<VTableGuildContext>VTableGuildConfigProvider props
The following is a documentation helper interface, not a package export. The Provider only overrides these fields; themePreset and compatClass are inherited from the plugin context and cannot be switched through Provider props.
/** 文档说明用辅助接口,不是包导出。描述 Provider 可传入的配置 props。 */
export interface VTableGuildConfigProviderProps {
theme?: VTableGuildThemeOverrides
cssMode?: VTableGuildCssMode
classPrefix?: string
locale?: LocaleName
locales?: LocaleRegistry
localeOverrides?: DeepPartial<VTableGuildLocale>
}cn
Merges classes and resolves Tailwind conflicts; the result may be undefined. CnClassValue is a helper type that documents the parameter structure, not a package export.
/** 文档说明用辅助类型,不是包导出。对象值按 truthy/falsy 决定是否添加对应 class。 */
type CnClassValue =
| string
| number
| bigint
| boolean
| null
| undefined
| Record<string, unknown>
| CnClassValue[]
export declare const cn: <T extends CnClassValue[]>(...classes: T) => string | undefinedRelated pages
TablePaginationConfig / TablePaginationState
Complete declarations of the pagination config, state, position, layout and slots. pagination.onChange is a two-argument pagination callback; see Pagination for how it differs from the three-argument table change.
export interface TablePaginationConfig {
current?: number
defaultCurrent?: number
pageSize?: number
defaultPageSize?: number
total?: number
disabled?: boolean
hideOnSinglePage?: boolean
showSizeChanger?: boolean
pageSizeOptions?: (string | number)[]
totalBoundaryShowSizeChanger?: number
buildOptionText?: (option: { value: string | number }) => VNodeChild
showQuickJumper?: boolean | { goButton?: VNodeChild }
showTotal?: (total: number, range: [number, number]) => VNodeChild
size?: 'default' | 'small'
simple?: boolean
showLessItems?: boolean
pagerCount?: number
responsive?: boolean
itemRender?: (item: {
page: number
type: PaginationItemType
originalElement: VNodeChild
}) => VNodeChild
locale?: Partial<VTableGuildPaginationLocale>
class?: string
style?: CSSProperties
position?: TablePaginationPosition[]
layout?: TablePaginationLayout
onChange?: (page: number, pageSize: number) => void
onShowSizeChange?: (current: number, size: number) => void
'onUpdate:current'?: (current: number) => void
'onUpdate:pageSize'?: (pageSize: number) => void
}export interface TablePaginationState {
current: number
pageSize: number
total: number
}export type TablePaginationPosition =
| 'topLeft'
| 'topCenter'
| 'topRight'
| 'bottomLeft'
| 'bottomCenter'
| 'bottomRight'
| 'none'export type PaginationItemType = 'page' | 'prev' | 'next' | 'jump-prev' | 'jump-next'export type TablePaginationBuiltinLayoutItem =
| 'total'
| 'sizes'
| 'prev'
| 'pager'
| 'next'
| 'jumper'export type TablePaginationLayoutItem = TablePaginationBuiltinLayoutItem | { readonly slot: string }export type TablePaginationLayout =
| readonly TablePaginationLayoutItem[]
| {
readonly left?: readonly TablePaginationLayoutItem[]
readonly right?: readonly TablePaginationLayoutItem[]
}export type TablePaginationSlotProps = Readonly<
TablePaginationState & {
name: string
pageCount: number
range: readonly [number, number]
disabled: boolean
position: Exclude<TablePaginationPosition, 'none'>
region: 'inline' | 'left' | 'right'
}
>