UNPKG

@tanstack/vue-table

Version:

Headless UI for building powerful tables & datagrids for Vue.

36 lines • 1.67 kB
import { MaybeRef, VNode } from "vue"; import { RowData, Table, TableFeatures, TableOptions } from "@tanstack/table-core"; //#region src/useTable.d.ts export type TableOptionsWithReactiveData<TFeatures extends TableFeatures, TData extends RowData> = { [K in keyof TableOptions<TFeatures, TData>]: K extends 'data' ? MaybeRef<ReadonlyArray<TData>> : MaybeRef<TableOptions<TFeatures, TData>[K]>; }; export type VueTable<TFeatures extends TableFeatures, TData extends RowData> = Table<TFeatures, TData> & { /** * @deprecated Read table APIs or `table.atoms` directly inside templates, * render functions, computed values, or watcher sources. Vue tracks those * reads natively. This compatibility wrapper only passes atoms to its child * function and adds no subscription logic. */ Subscribe: (props: { children: (atoms: Table<TFeatures, TData>['atoms']) => VNode | Array<VNode>; }) => VNode | Array<VNode>; }; /** * Creates a Vue table instance backed by Vue-aware TanStack Store atoms. * * Table options may contain Vue refs or computed values. The adapter unwraps * those reactive inputs, watches them with synchronous flushing, and keeps the * table options in sync. Read table APIs or atoms inside templates, render * functions, computed values, or watcher sources to track updates. * * @example * ```ts * const table = useTable( * { * features, * columns, * data, * }, * ) * ``` */ export declare function useTable<TFeatures extends TableFeatures, TData extends RowData>(tableOptions: TableOptions<TFeatures, TData> | TableOptionsWithReactiveData<TFeatures, TData>): VueTable<TFeatures, TData>; //#endregion