@tanstack/react-table 9.0.0-beta.3 → 9.0.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"useLegacyTable.cjs","names":["filterFns","sortFns","aggregationFns","useTable","stockFeatures"],"sources":["../src/useLegacyTable.ts"],"sourcesContent":["'use client'\n\nimport {\n aggregationFns,\n createColumnHelper,\n createExpandedRowModel,\n createFacetedMinMaxValues,\n createFacetedRowModel,\n createFacetedUniqueValues,\n createFilteredRowModel,\n createGroupedRowModel,\n createPaginatedRowModel,\n createSortedRowModel,\n filterFns,\n sortFns,\n stockFeatures,\n} from '@tanstack/table-core'\nimport { useCallback, useMemo, useState } from 'react'\nimport { useTable } from './useTable'\nimport type {\n AggregationFns,\n Cell,\n Column,\n ColumnDef,\n CreateRowModels_All,\n FilterFns,\n Header,\n HeaderGroup,\n Row,\n RowData,\n RowModel,\n SortFns,\n StockFeatures,\n Table,\n TableOptions,\n TableState,\n} from '@tanstack/table-core'\nimport type { ReactTable } from './useTable'\n\n// =============================================================================\n// V8-style row model factory functions\n// These are stub functions that act as markers for useLegacyTable to know\n// which row models to enable. They don't actually do anything - the real\n// implementation is handled by useLegacyTable internally.\n// =============================================================================\n\n/**\n * @deprecated Use `createFilteredRowModel(filterFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the filtered row model.\n */\nexport function getFilteredRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createSortedRowModel(sortFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the sorted row model.\n */\nexport function getSortedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createPaginatedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the paginated row model.\n */\nexport function getPaginationRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createExpandedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the expanded row model.\n */\nexport function getExpandedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createGroupedRowModel(aggregationFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the grouped row model.\n */\nexport function getGroupedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createFacetedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted row model.\n */\nexport function getFacetedRowModel<\n TData extends RowData,\n>(): FacetedRowModelFactory<TData> {\n return (() => () => {}) as unknown as FacetedRowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createFacetedMinMaxValues()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted min/max values.\n */\nexport function getFacetedMinMaxValues<\n TData extends RowData,\n>(): FacetedMinMaxValuesFactory<TData> {\n return () => () => undefined\n}\n\n/**\n * @deprecated Use `createFacetedUniqueValues()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted unique values.\n */\nexport function getFacetedUniqueValues<\n TData extends RowData,\n>(): FacetedUniqueValuesFactory<TData> {\n return () => () => new Map()\n}\n\n/**\n * @deprecated The core row model is always created automatically in v9.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It does nothing - the core row model is always available.\n */\nexport function getCoreRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n// =============================================================================\n// Type definitions\n// =============================================================================\n\n/**\n * Row model factory function type from v8 API\n */\nexport type RowModelFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n) => () => RowModel<StockFeatures, TData>\n\n/**\n * Faceted row model factory function type from v8 API\n */\nexport type FacetedRowModelFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => RowModel<StockFeatures, TData>\n\n/**\n * Faceted min/max values factory function type from v8 API\n */\nexport type FacetedMinMaxValuesFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => undefined | [number, number]\n\n/**\n * Faceted unique values factory function type from v8 API\n */\nexport type FacetedUniqueValuesFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => Map<any, number>\n\n/**\n * Legacy v8-style row model options\n */\nexport interface LegacyRowModelOptions<TData extends RowData> {\n /**\n * Returns the core row model for the table.\n * @deprecated This option is no longer needed in v9. The core row model is always created automatically.\n */\n getCoreRowModel?: RowModelFactory<TData>\n /**\n * Returns the filtered row model for the table.\n * @deprecated Use `rowModels.filteredRowModel` with `createFilteredRowModel(filterFns)` instead.\n */\n getFilteredRowModel?: RowModelFactory<TData>\n /**\n * Returns the sorted row model for the table.\n * @deprecated Use `rowModels.sortedRowModel` with `createSortedRowModel(sortFns)` instead.\n */\n getSortedRowModel?: RowModelFactory<TData>\n /**\n * Returns the paginated row model for the table.\n * @deprecated Use `rowModels.paginatedRowModel` with `createPaginatedRowModel()` instead.\n */\n getPaginationRowModel?: RowModelFactory<TData>\n /**\n * Returns the expanded row model for the table.\n * @deprecated Use `rowModels.expandedRowModel` with `createExpandedRowModel()` instead.\n */\n getExpandedRowModel?: RowModelFactory<TData>\n /**\n * Returns the grouped row model for the table.\n * @deprecated Use `rowModels.groupedRowModel` with `createGroupedRowModel(aggregationFns)` instead.\n */\n getGroupedRowModel?: RowModelFactory<TData>\n /**\n * Returns the faceted row model for a column.\n * @deprecated Use `rowModels.facetedRowModel` with `createFacetedRowModel()` instead.\n */\n getFacetedRowModel?: FacetedRowModelFactory<TData>\n /**\n * Returns the faceted min/max values for a column.\n * @deprecated Use `rowModels.facetedMinMaxValues` with `createFacetedMinMaxValues()` instead.\n */\n getFacetedMinMaxValues?: FacetedMinMaxValuesFactory<TData>\n /**\n * Returns the faceted unique values for a column.\n * @deprecated Use `rowModels.facetedUniqueValues` with `createFacetedUniqueValues()` instead.\n */\n getFacetedUniqueValues?: FacetedUniqueValuesFactory<TData>\n /**\n * Additional filter functions to apply to the table.\n * @deprecated Use `rowModels.filteredRowModel` with `createFilteredRowModel(filterFns)` instead.\n */\n filterFns?: FilterFns\n /**\n * Additional sort functions to apply to the table.\n * @deprecated Use `rowModels.sortedRowModel` with `createSortedRowModel(sortFns)` instead.\n */\n sortFns?: SortFns\n /**\n * Additional aggregation functions to apply to the table.\n * @deprecated Use `rowModels.groupedRowModel` with `createGroupedRowModel(aggregationFns)` instead.\n */\n aggregationFns?: AggregationFns\n}\n\n/**\n * Legacy v8-style table options that work with useLegacyTable.\n *\n * This type omits `features` and `rowModels` and instead accepts the v8-style\n * `get*RowModel` function options.\n *\n * @deprecated This is a compatibility layer for migrating from v8. Use `useTable` with explicit `features` and `rowModels` instead.\n */\nexport type LegacyTableOptions<TData extends RowData> = Omit<\n TableOptions<StockFeatures, TData>,\n 'features' | 'rowModels'\n> &\n LegacyRowModelOptions<TData>\n\n/**\n * Legacy table instance type that includes the v8-style `getState()` method.\n *\n * @deprecated Use `useTable` with explicit state selection instead.\n */\nexport type LegacyReactTable<TData extends RowData> = ReactTable<\n StockFeatures,\n TData,\n TableState<StockFeatures>\n> & {\n /**\n * Returns the current table state.\n * @deprecated In v9, access state directly via `table.state` or use `table.state` for the full state.\n */\n getState: () => TableState<StockFeatures>\n /**\n * Sets the current table state.\n * @deprecated In v9, access state directly via `table.baseAtoms`\n */\n setState: (state: TableState<StockFeatures>) => void\n}\n\n// =============================================================================\n// Legacy type aliases - StockFeatures hardcoded for simpler prop typing with useLegacyTable\n// =============================================================================\n\n/** @deprecated Use Column<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyColumn<TData extends RowData, TValue = unknown> = Column<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use Row<TFeatures, TData> with useTable instead. */\nexport type LegacyRow<TData extends RowData> = Row<StockFeatures, TData>\n\n/** @deprecated Use Cell<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyCell<TData extends RowData, TValue = unknown> = Cell<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use Header<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyHeader<TData extends RowData, TValue = unknown> = Header<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use HeaderGroup<TFeatures, TData> with useTable instead. */\nexport type LegacyHeaderGroup<TData extends RowData> = HeaderGroup<\n StockFeatures,\n TData\n>\n\n/** @deprecated Use ColumnDef<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyColumnDef<\n TData extends RowData,\n TValue = unknown,\n> = ColumnDef<StockFeatures, TData, TValue>\n\n/** @deprecated Use Table<TFeatures, TData> with useTable instead. */\nexport type LegacyTable<TData extends RowData> = Table<StockFeatures, TData>\n\n// =============================================================================\n// Legacy column helper - StockFeatures hardcoded\n// =============================================================================\n\n/**\n * @deprecated Use `createColumnHelper<TFeatures, TData>()` with useTable instead.\n *\n * A column helper with StockFeatures pre-bound for use with useLegacyTable.\n * Only requires TData—no need to specify TFeatures.\n */\nexport function legacyCreateColumnHelper<TData extends RowData>() {\n return createColumnHelper<StockFeatures, TData>()\n}\n\n// =============================================================================\n// useLegacyTable hook\n// =============================================================================\n\n/**\n * @deprecated This hook is provided as a compatibility layer for migrating from TanStack Table v8.\n *\n * Use the new `useTable` hook instead with explicit `features` and `rowModels`:\n *\n * ```tsx\n * // New v9 API\n * const features = tableFeatures({\n * columnFilteringFeature,\n * rowSortingFeature,\n * rowPaginationFeature,\n * })\n *\n * const table = useTable({\n * features,\n * rowModels: {\n * filteredRowModel: createFilteredRowModel(filterFns),\n * sortedRowModel: createSortedRowModel(sortFns),\n * paginatedRowModel: createPaginatedRowModel(),\n * },\n * columns,\n * data,\n * })\n * ```\n *\n * Key differences from v8:\n * - Features are tree-shakeable - only import what you use\n * - Row models are explicitly passed via `rowModels`\n * - Use `table.Subscribe` for fine-grained re-renders\n * - State is accessed via `table.state` after selecting with the 2nd argument\n *\n * @param options - Legacy v8-style table options\n * @returns A table instance with the full state subscribed and a `getState()` method\n */\nexport function useLegacyTable<TData extends RowData>(\n options: LegacyTableOptions<TData>,\n): LegacyReactTable<TData> {\n const {\n // Extract legacy row model options\n getCoreRowModel: _getCoreRowModel,\n getFilteredRowModel,\n getSortedRowModel,\n getPaginationRowModel,\n getExpandedRowModel,\n getGroupedRowModel,\n getFacetedRowModel,\n getFacetedMinMaxValues,\n getFacetedUniqueValues,\n // Rest of the options\n ...restOptions\n } = options\n\n const [rowModels] = useState(() => {\n const rowModels: CreateRowModels_All<StockFeatures, TData> = {}\n\n // Legacy row model options are setup-only. Capture the first render's\n // marker options to match the table instance lifecycle.\n\n if (getFilteredRowModel) {\n rowModels.filteredRowModel = createFilteredRowModel({\n ...filterFns,\n ...options.filterFns,\n })\n }\n\n if (getSortedRowModel) {\n rowModels.sortedRowModel = createSortedRowModel({\n ...sortFns,\n ...options.sortFns,\n })\n }\n\n if (getPaginationRowModel) {\n rowModels.paginatedRowModel = createPaginatedRowModel()\n }\n\n if (getExpandedRowModel) {\n rowModels.expandedRowModel = createExpandedRowModel()\n }\n\n if (getGroupedRowModel) {\n rowModels.groupedRowModel = createGroupedRowModel({\n ...aggregationFns,\n ...options.aggregationFns,\n })\n }\n\n if (getFacetedRowModel) {\n rowModels.facetedRowModel = createFacetedRowModel()\n }\n\n if (getFacetedMinMaxValues) {\n rowModels.facetedMinMaxValues = createFacetedMinMaxValues()\n }\n\n if (getFacetedUniqueValues) {\n rowModels.facetedUniqueValues = createFacetedUniqueValues()\n }\n\n return rowModels\n })\n\n // Call useTable with the v9 API, subscribing to all state changes\n const table = useTable<StockFeatures, TData, TableState<StockFeatures>>(\n {\n ...restOptions,\n features: stockFeatures,\n rowModels,\n },\n (state) => state,\n )\n\n const getState = useCallback(() => {\n return table.state\n }, [table])\n\n const setState = useCallback(\n (state: TableState<StockFeatures>) => {\n Object.entries(state).forEach(([key, value]) => {\n // @ts-expect-error - baseAtoms is indexed by dynamic string keys\n table.baseAtoms[key].set(value)\n })\n },\n [table],\n )\n\n return useMemo(\n () => ({\n ...table,\n getState,\n setState,\n }),\n [table, getState, setState],\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAoDA,SAAgB,sBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,oBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,wBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,sBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,qBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,qBAEmB;CACjC,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,yBAEuB;CACrC,mBAAmB;AACrB;;;;;;;AAQA,SAAgB,yBAEuB;CACrC,mCAAmB,IAAI,IAAI;AAC7B;;;;;;;AAQA,SAAgB,kBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAgMA,SAAgB,2BAAkD;CAChE,oDAAgD;AAClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAgB,eACd,SACyB;CACzB,MAAM,EAEJ,iBAAiB,kBACjB,qBACA,mBACA,uBACA,qBACA,oBACA,oBACA,wBACA,wBAEA,GAAG,gBACD;CAEJ,MAAM,CAAC,uCAA4B;EACjC,MAAM,YAAuD,CAAC;EAK9D,IAAI,qBACF,UAAU,oEAA0C;GAClD,GAAGA;GACH,GAAG,QAAQ;EACb,CAAC;EAGH,IAAI,mBACF,UAAU,gEAAsC;GAC9C,GAAGC;GACH,GAAG,QAAQ;EACb,CAAC;EAGH,IAAI,uBACF,UAAU,sEAA4C;EAGxD,IAAI,qBACF,UAAU,oEAA0C;EAGtD,IAAI,oBACF,UAAU,kEAAwC;GAChD,GAAGC;GACH,GAAG,QAAQ;EACb,CAAC;EAGH,IAAI,oBACF,UAAU,kEAAwC;EAGpD,IAAI,wBACF,UAAU,0EAAgD;EAG5D,IAAI,wBACF,UAAU,0EAAgD;EAG5D,OAAO;CACT,CAAC;CAGD,MAAM,QAAQC,0BACZ;EACE,GAAG;EACH,UAAUC;EACV;CACF,IACC,UAAU,KACb;CAEA,MAAM,wCAA6B;EACjC,OAAO,MAAM;CACf,GAAG,CAAC,KAAK,CAAC;CAEV,MAAM,mCACH,UAAqC;EACpC,OAAO,QAAQ,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;GAE9C,MAAM,UAAU,IAAI,CAAC,IAAI,KAAK;EAChC,CAAC;CACH,GACA,CAAC,KAAK,CACR;CAEA,iCACS;EACL,GAAG;EACH;EACA;CACF,IACA;EAAC;EAAO;EAAU;CAAQ,CAC5B;AACF"}
1
+ {"version":3,"file":"useLegacyTable.cjs","names":["filterFns","sortFns","aggregationFns","useTable","stockFeatures"],"sources":["../src/useLegacyTable.ts"],"sourcesContent":["'use client'\n\nimport {\n aggregationFns,\n createColumnHelper,\n createExpandedRowModel,\n createFacetedMinMaxValues,\n createFacetedRowModel,\n createFacetedUniqueValues,\n createFilteredRowModel,\n createGroupedRowModel,\n createPaginatedRowModel,\n createSortedRowModel,\n filterFns,\n sortFns,\n stockFeatures,\n} from '@tanstack/table-core'\nimport { useCallback, useMemo, useState } from 'react'\nimport { useTable } from './useTable'\nimport type {\n AggregationFns,\n Cell,\n Column,\n ColumnDef,\n ColumnHelper,\n CreateRowModels_All,\n FilterFns,\n Header,\n HeaderGroup,\n Row,\n RowData,\n RowModel,\n SortFns,\n StockFeatures,\n Table,\n TableOptions,\n TableState,\n} from '@tanstack/table-core'\nimport type { ReactTable } from './useTable'\n\n// =============================================================================\n// V8-style row model factory functions\n// These are stub functions that act as markers for useLegacyTable to know\n// which row models to enable. They don't actually do anything - the real\n// implementation is handled by useLegacyTable internally.\n// =============================================================================\n\n/**\n * @deprecated Use `createFilteredRowModel(filterFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the filtered row model.\n */\nexport function getFilteredRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createSortedRowModel(sortFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the sorted row model.\n */\nexport function getSortedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createPaginatedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the paginated row model.\n */\nexport function getPaginationRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createExpandedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the expanded row model.\n */\nexport function getExpandedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createGroupedRowModel(aggregationFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the grouped row model.\n */\nexport function getGroupedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createFacetedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted row model.\n */\nexport function getFacetedRowModel<\n TData extends RowData,\n>(): FacetedRowModelFactory<TData> {\n return (() => () => {}) as unknown as FacetedRowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createFacetedMinMaxValues()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted min/max values.\n */\nexport function getFacetedMinMaxValues<\n TData extends RowData,\n>(): FacetedMinMaxValuesFactory<TData> {\n return () => () => undefined\n}\n\n/**\n * @deprecated Use `createFacetedUniqueValues()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted unique values.\n */\nexport function getFacetedUniqueValues<\n TData extends RowData,\n>(): FacetedUniqueValuesFactory<TData> {\n return () => () => new Map()\n}\n\n/**\n * @deprecated The core row model is always created automatically in v9.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It does nothing - the core row model is always available.\n */\nexport function getCoreRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n// =============================================================================\n// Type definitions\n// =============================================================================\n\n/**\n * Row model factory function type from v8 API\n */\nexport type RowModelFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n) => () => RowModel<StockFeatures, TData>\n\n/**\n * Faceted row model factory function type from v8 API\n */\nexport type FacetedRowModelFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => RowModel<StockFeatures, TData>\n\n/**\n * Faceted min/max values factory function type from v8 API\n */\nexport type FacetedMinMaxValuesFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => undefined | [number, number]\n\n/**\n * Faceted unique values factory function type from v8 API\n */\nexport type FacetedUniqueValuesFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => Map<any, number>\n\n/**\n * Legacy v8-style row model options\n */\nexport interface LegacyRowModelOptions<TData extends RowData> {\n /**\n * Returns the core row model for the table.\n * @deprecated This option is no longer needed in v9. The core row model is always created automatically.\n */\n getCoreRowModel?: RowModelFactory<TData>\n /**\n * Returns the filtered row model for the table.\n * @deprecated Use `rowModels.filteredRowModel` with `createFilteredRowModel(filterFns)` instead.\n */\n getFilteredRowModel?: RowModelFactory<TData>\n /**\n * Returns the sorted row model for the table.\n * @deprecated Use `rowModels.sortedRowModel` with `createSortedRowModel(sortFns)` instead.\n */\n getSortedRowModel?: RowModelFactory<TData>\n /**\n * Returns the paginated row model for the table.\n * @deprecated Use `rowModels.paginatedRowModel` with `createPaginatedRowModel()` instead.\n */\n getPaginationRowModel?: RowModelFactory<TData>\n /**\n * Returns the expanded row model for the table.\n * @deprecated Use `rowModels.expandedRowModel` with `createExpandedRowModel()` instead.\n */\n getExpandedRowModel?: RowModelFactory<TData>\n /**\n * Returns the grouped row model for the table.\n * @deprecated Use `rowModels.groupedRowModel` with `createGroupedRowModel(aggregationFns)` instead.\n */\n getGroupedRowModel?: RowModelFactory<TData>\n /**\n * Returns the faceted row model for a column.\n * @deprecated Use `rowModels.facetedRowModel` with `createFacetedRowModel()` instead.\n */\n getFacetedRowModel?: FacetedRowModelFactory<TData>\n /**\n * Returns the faceted min/max values for a column.\n * @deprecated Use `rowModels.facetedMinMaxValues` with `createFacetedMinMaxValues()` instead.\n */\n getFacetedMinMaxValues?: FacetedMinMaxValuesFactory<TData>\n /**\n * Returns the faceted unique values for a column.\n * @deprecated Use `rowModels.facetedUniqueValues` with `createFacetedUniqueValues()` instead.\n */\n getFacetedUniqueValues?: FacetedUniqueValuesFactory<TData>\n /**\n * Additional filter functions to apply to the table.\n * @deprecated Use `rowModels.filteredRowModel` with `createFilteredRowModel(filterFns)` instead.\n */\n filterFns?: FilterFns\n /**\n * Additional sort functions to apply to the table.\n * @deprecated Use `rowModels.sortedRowModel` with `createSortedRowModel(sortFns)` instead.\n */\n sortFns?: SortFns\n /**\n * Additional aggregation functions to apply to the table.\n * @deprecated Use `rowModels.groupedRowModel` with `createGroupedRowModel(aggregationFns)` instead.\n */\n aggregationFns?: AggregationFns\n}\n\n/**\n * Legacy v8-style table options that work with useLegacyTable.\n *\n * This type omits `features` and `rowModels` and instead accepts the v8-style\n * `get*RowModel` function options.\n *\n * @deprecated This is a compatibility layer for migrating from v8. Use `useTable` with explicit `features` and `rowModels` instead.\n */\nexport type LegacyTableOptions<TData extends RowData> = Omit<\n TableOptions<StockFeatures, TData>,\n 'features' | 'rowModels'\n> &\n LegacyRowModelOptions<TData>\n\n/**\n * Legacy table instance type that includes the v8-style `getState()` method.\n *\n * @deprecated Use `useTable` with explicit state selection instead.\n */\nexport type LegacyReactTable<TData extends RowData> = ReactTable<\n StockFeatures,\n TData,\n TableState<StockFeatures>\n> & {\n /**\n * Returns the current table state.\n * @deprecated In v9, access state directly via `table.state` or use `table.state` for the full state.\n */\n getState: () => TableState<StockFeatures>\n /**\n * Sets the current table state.\n * @deprecated In v9, access state directly via `table.baseAtoms`\n */\n setState: (state: TableState<StockFeatures>) => void\n}\n\n// =============================================================================\n// Legacy type aliases - StockFeatures hardcoded for simpler prop typing with useLegacyTable\n// =============================================================================\n\n/** @deprecated Use Column<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyColumn<TData extends RowData, TValue = unknown> = Column<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use Row<TFeatures, TData> with useTable instead. */\nexport type LegacyRow<TData extends RowData> = Row<StockFeatures, TData>\n\n/** @deprecated Use Cell<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyCell<TData extends RowData, TValue = unknown> = Cell<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use Header<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyHeader<TData extends RowData, TValue = unknown> = Header<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use HeaderGroup<TFeatures, TData> with useTable instead. */\nexport type LegacyHeaderGroup<TData extends RowData> = HeaderGroup<\n StockFeatures,\n TData\n>\n\n/** @deprecated Use ColumnDef<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyColumnDef<\n TData extends RowData,\n TValue = unknown,\n> = ColumnDef<StockFeatures, TData, TValue>\n\n/** @deprecated Use Table<TFeatures, TData> with useTable instead. */\nexport type LegacyTable<TData extends RowData> = Table<StockFeatures, TData>\n\n// =============================================================================\n// Legacy column helper - StockFeatures hardcoded\n// =============================================================================\n\n/**\n * @deprecated Use `createColumnHelper<TFeatures, TData>()` with useTable instead.\n *\n * A column helper with StockFeatures pre-bound for use with useLegacyTable.\n * Only requires TData—no need to specify TFeatures.\n */\nexport function legacyCreateColumnHelper<TData extends RowData>(): ColumnHelper<\n StockFeatures,\n TData\n> {\n return createColumnHelper<StockFeatures, TData>()\n}\n\n// =============================================================================\n// useLegacyTable hook\n// =============================================================================\n\n/**\n * @deprecated This hook is provided as a compatibility layer for migrating from TanStack Table v8.\n *\n * Use the new `useTable` hook instead with explicit `features` and `rowModels`:\n *\n * ```tsx\n * // New v9 API\n * const features = tableFeatures({\n * columnFilteringFeature,\n * rowSortingFeature,\n * rowPaginationFeature,\n * })\n *\n * const table = useTable({\n * features,\n * rowModels: {\n * filteredRowModel: createFilteredRowModel(filterFns),\n * sortedRowModel: createSortedRowModel(sortFns),\n * paginatedRowModel: createPaginatedRowModel(),\n * },\n * columns,\n * data,\n * })\n * ```\n *\n * Key differences from v8:\n * - Features are tree-shakeable - only import what you use\n * - Row models are explicitly passed via `rowModels`\n * - Use `table.Subscribe` for fine-grained re-renders\n * - State is accessed via `table.state` after selecting with the 2nd argument\n *\n * @param options - Legacy v8-style table options\n * @returns A table instance with the full state subscribed and a `getState()` method\n */\nexport function useLegacyTable<TData extends RowData>(\n options: LegacyTableOptions<TData>,\n): LegacyReactTable<TData> {\n const {\n // Extract legacy row model options\n getCoreRowModel: _getCoreRowModel,\n getFilteredRowModel,\n getSortedRowModel,\n getPaginationRowModel,\n getExpandedRowModel,\n getGroupedRowModel,\n getFacetedRowModel,\n getFacetedMinMaxValues,\n getFacetedUniqueValues,\n // Rest of the options\n ...restOptions\n } = options\n\n const [rowModels] = useState(() => {\n const rowModels: CreateRowModels_All<StockFeatures, TData> = {}\n\n // Legacy row model options are setup-only. Capture the first render's\n // marker options to match the table instance lifecycle.\n\n if (getFilteredRowModel) {\n rowModels.filteredRowModel = createFilteredRowModel({\n ...filterFns,\n ...options.filterFns,\n })\n }\n\n if (getSortedRowModel) {\n rowModels.sortedRowModel = createSortedRowModel({\n ...sortFns,\n ...options.sortFns,\n })\n }\n\n if (getPaginationRowModel) {\n rowModels.paginatedRowModel = createPaginatedRowModel()\n }\n\n if (getExpandedRowModel) {\n rowModels.expandedRowModel = createExpandedRowModel()\n }\n\n if (getGroupedRowModel) {\n rowModels.groupedRowModel = createGroupedRowModel({\n ...aggregationFns,\n ...options.aggregationFns,\n })\n }\n\n if (getFacetedRowModel) {\n rowModels.facetedRowModel = createFacetedRowModel()\n }\n\n if (getFacetedMinMaxValues) {\n rowModels.facetedMinMaxValues = createFacetedMinMaxValues()\n }\n\n if (getFacetedUniqueValues) {\n rowModels.facetedUniqueValues = createFacetedUniqueValues()\n }\n\n return rowModels\n })\n\n // Call useTable with the v9 API, subscribing to all state changes\n const table = useTable<StockFeatures, TData, TableState<StockFeatures>>(\n {\n ...restOptions,\n features: stockFeatures,\n rowModels,\n },\n (state) => state,\n )\n\n const getState = useCallback(() => {\n return table.state\n }, [table])\n\n const setState = useCallback(\n (state: TableState<StockFeatures>) => {\n Object.entries(state).forEach(([key, value]) => {\n // @ts-expect-error - baseAtoms is indexed by dynamic string keys\n table.baseAtoms[key].set(value)\n })\n },\n [table],\n )\n\n return useMemo(\n () => ({\n ...table,\n getState,\n setState,\n }),\n [table, getState, setState],\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAqDA,SAAgB,sBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,oBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,wBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,sBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,qBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,qBAEmB;CACjC,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,yBAEuB;CACrC,mBAAmB;AACrB;;;;;;;AAQA,SAAgB,yBAEuB;CACrC,mCAAmB,IAAI,IAAI;AAC7B;;;;;;;AAQA,SAAgB,kBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAgMA,SAAgB,2BAGd;CACA,oDAAgD;AAClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAgB,eACd,SACyB;CACzB,MAAM,EAEJ,iBAAiB,kBACjB,qBACA,mBACA,uBACA,qBACA,oBACA,oBACA,wBACA,wBAEA,GAAG,gBACD;CAEJ,MAAM,CAAC,uCAA4B;EACjC,MAAM,YAAuD,CAAC;EAK9D,IAAI,qBACF,UAAU,oEAA0C;GAClD,GAAGA;GACH,GAAG,QAAQ;EACb,CAAC;EAGH,IAAI,mBACF,UAAU,gEAAsC;GAC9C,GAAGC;GACH,GAAG,QAAQ;EACb,CAAC;EAGH,IAAI,uBACF,UAAU,sEAA4C;EAGxD,IAAI,qBACF,UAAU,oEAA0C;EAGtD,IAAI,oBACF,UAAU,kEAAwC;GAChD,GAAGC;GACH,GAAG,QAAQ;EACb,CAAC;EAGH,IAAI,oBACF,UAAU,kEAAwC;EAGpD,IAAI,wBACF,UAAU,0EAAgD;EAG5D,IAAI,wBACF,UAAU,0EAAgD;EAG5D,OAAO;CACT,CAAC;CAGD,MAAM,QAAQC,0BACZ;EACE,GAAG;EACH,UAAUC;EACV;CACF,IACC,UAAU,KACb;CAEA,MAAM,wCAA6B;EACjC,OAAO,MAAM;CACf,GAAG,CAAC,KAAK,CAAC;CAEV,MAAM,mCACH,UAAqC;EACpC,OAAO,QAAQ,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;GAE9C,MAAM,UAAU,IAAI,CAAC,IAAI,KAAK;EAChC,CAAC;CACH,GACA,CAAC,KAAK,CACR;CAEA,iCACS;EACL,GAAG;EACH;EACA;CACF,IACA;EAAC;EAAO;EAAU;CAAQ,CAC5B;AACF"}
@@ -1,5 +1,5 @@
1
1
  import { ReactTable } from "./useTable.cjs";
2
- import { AggregationFns, Cell, Column, ColumnDef, FilterFns, Header, HeaderGroup, Row, RowData, RowModel, SortFns, StockFeatures, Table, TableOptions, TableState } from "@tanstack/table-core";
2
+ import { AggregationFns, Cell, Column, ColumnDef, ColumnHelper, FilterFns, Header, HeaderGroup, Row, RowData, RowModel, SortFns, StockFeatures, Table, TableOptions, TableState } from "@tanstack/table-core";
3
3
 
4
4
  //#region src/useLegacyTable.d.ts
5
5
  /**
@@ -192,7 +192,7 @@ type LegacyTable<TData extends RowData> = Table<StockFeatures, TData>;
192
192
  * A column helper with StockFeatures pre-bound for use with useLegacyTable.
193
193
  * Only requires TData—no need to specify TFeatures.
194
194
  */
195
- declare function legacyCreateColumnHelper<TData extends RowData>(): import("@tanstack/table-core").ColumnHelper<StockFeatures, TData>;
195
+ declare function legacyCreateColumnHelper<TData extends RowData>(): ColumnHelper<StockFeatures, TData>;
196
196
  /**
197
197
  * @deprecated This hook is provided as a compatibility layer for migrating from TanStack Table v8.
198
198
  *
@@ -1,5 +1,5 @@
1
1
  import { ReactTable } from "./useTable.js";
2
- import { AggregationFns, Cell, Column, ColumnDef, FilterFns, Header, HeaderGroup, Row, RowData, RowModel, SortFns, StockFeatures, Table, TableOptions, TableState } from "@tanstack/table-core";
2
+ import { AggregationFns, Cell, Column, ColumnDef, ColumnHelper, FilterFns, Header, HeaderGroup, Row, RowData, RowModel, SortFns, StockFeatures, Table, TableOptions, TableState } from "@tanstack/table-core";
3
3
 
4
4
  //#region src/useLegacyTable.d.ts
5
5
  /**
@@ -192,7 +192,7 @@ type LegacyTable<TData extends RowData> = Table<StockFeatures, TData>;
192
192
  * A column helper with StockFeatures pre-bound for use with useLegacyTable.
193
193
  * Only requires TData—no need to specify TFeatures.
194
194
  */
195
- declare function legacyCreateColumnHelper<TData extends RowData>(): import("@tanstack/table-core").ColumnHelper<StockFeatures, TData>;
195
+ declare function legacyCreateColumnHelper<TData extends RowData>(): ColumnHelper<StockFeatures, TData>;
196
196
  /**
197
197
  * @deprecated This hook is provided as a compatibility layer for migrating from TanStack Table v8.
198
198
  *
@@ -1 +1 @@
1
- {"version":3,"file":"useLegacyTable.js","names":[],"sources":["../src/useLegacyTable.ts"],"sourcesContent":["'use client'\n\nimport {\n aggregationFns,\n createColumnHelper,\n createExpandedRowModel,\n createFacetedMinMaxValues,\n createFacetedRowModel,\n createFacetedUniqueValues,\n createFilteredRowModel,\n createGroupedRowModel,\n createPaginatedRowModel,\n createSortedRowModel,\n filterFns,\n sortFns,\n stockFeatures,\n} from '@tanstack/table-core'\nimport { useCallback, useMemo, useState } from 'react'\nimport { useTable } from './useTable'\nimport type {\n AggregationFns,\n Cell,\n Column,\n ColumnDef,\n CreateRowModels_All,\n FilterFns,\n Header,\n HeaderGroup,\n Row,\n RowData,\n RowModel,\n SortFns,\n StockFeatures,\n Table,\n TableOptions,\n TableState,\n} from '@tanstack/table-core'\nimport type { ReactTable } from './useTable'\n\n// =============================================================================\n// V8-style row model factory functions\n// These are stub functions that act as markers for useLegacyTable to know\n// which row models to enable. They don't actually do anything - the real\n// implementation is handled by useLegacyTable internally.\n// =============================================================================\n\n/**\n * @deprecated Use `createFilteredRowModel(filterFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the filtered row model.\n */\nexport function getFilteredRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createSortedRowModel(sortFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the sorted row model.\n */\nexport function getSortedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createPaginatedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the paginated row model.\n */\nexport function getPaginationRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createExpandedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the expanded row model.\n */\nexport function getExpandedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createGroupedRowModel(aggregationFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the grouped row model.\n */\nexport function getGroupedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createFacetedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted row model.\n */\nexport function getFacetedRowModel<\n TData extends RowData,\n>(): FacetedRowModelFactory<TData> {\n return (() => () => {}) as unknown as FacetedRowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createFacetedMinMaxValues()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted min/max values.\n */\nexport function getFacetedMinMaxValues<\n TData extends RowData,\n>(): FacetedMinMaxValuesFactory<TData> {\n return () => () => undefined\n}\n\n/**\n * @deprecated Use `createFacetedUniqueValues()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted unique values.\n */\nexport function getFacetedUniqueValues<\n TData extends RowData,\n>(): FacetedUniqueValuesFactory<TData> {\n return () => () => new Map()\n}\n\n/**\n * @deprecated The core row model is always created automatically in v9.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It does nothing - the core row model is always available.\n */\nexport function getCoreRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n// =============================================================================\n// Type definitions\n// =============================================================================\n\n/**\n * Row model factory function type from v8 API\n */\nexport type RowModelFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n) => () => RowModel<StockFeatures, TData>\n\n/**\n * Faceted row model factory function type from v8 API\n */\nexport type FacetedRowModelFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => RowModel<StockFeatures, TData>\n\n/**\n * Faceted min/max values factory function type from v8 API\n */\nexport type FacetedMinMaxValuesFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => undefined | [number, number]\n\n/**\n * Faceted unique values factory function type from v8 API\n */\nexport type FacetedUniqueValuesFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => Map<any, number>\n\n/**\n * Legacy v8-style row model options\n */\nexport interface LegacyRowModelOptions<TData extends RowData> {\n /**\n * Returns the core row model for the table.\n * @deprecated This option is no longer needed in v9. The core row model is always created automatically.\n */\n getCoreRowModel?: RowModelFactory<TData>\n /**\n * Returns the filtered row model for the table.\n * @deprecated Use `rowModels.filteredRowModel` with `createFilteredRowModel(filterFns)` instead.\n */\n getFilteredRowModel?: RowModelFactory<TData>\n /**\n * Returns the sorted row model for the table.\n * @deprecated Use `rowModels.sortedRowModel` with `createSortedRowModel(sortFns)` instead.\n */\n getSortedRowModel?: RowModelFactory<TData>\n /**\n * Returns the paginated row model for the table.\n * @deprecated Use `rowModels.paginatedRowModel` with `createPaginatedRowModel()` instead.\n */\n getPaginationRowModel?: RowModelFactory<TData>\n /**\n * Returns the expanded row model for the table.\n * @deprecated Use `rowModels.expandedRowModel` with `createExpandedRowModel()` instead.\n */\n getExpandedRowModel?: RowModelFactory<TData>\n /**\n * Returns the grouped row model for the table.\n * @deprecated Use `rowModels.groupedRowModel` with `createGroupedRowModel(aggregationFns)` instead.\n */\n getGroupedRowModel?: RowModelFactory<TData>\n /**\n * Returns the faceted row model for a column.\n * @deprecated Use `rowModels.facetedRowModel` with `createFacetedRowModel()` instead.\n */\n getFacetedRowModel?: FacetedRowModelFactory<TData>\n /**\n * Returns the faceted min/max values for a column.\n * @deprecated Use `rowModels.facetedMinMaxValues` with `createFacetedMinMaxValues()` instead.\n */\n getFacetedMinMaxValues?: FacetedMinMaxValuesFactory<TData>\n /**\n * Returns the faceted unique values for a column.\n * @deprecated Use `rowModels.facetedUniqueValues` with `createFacetedUniqueValues()` instead.\n */\n getFacetedUniqueValues?: FacetedUniqueValuesFactory<TData>\n /**\n * Additional filter functions to apply to the table.\n * @deprecated Use `rowModels.filteredRowModel` with `createFilteredRowModel(filterFns)` instead.\n */\n filterFns?: FilterFns\n /**\n * Additional sort functions to apply to the table.\n * @deprecated Use `rowModels.sortedRowModel` with `createSortedRowModel(sortFns)` instead.\n */\n sortFns?: SortFns\n /**\n * Additional aggregation functions to apply to the table.\n * @deprecated Use `rowModels.groupedRowModel` with `createGroupedRowModel(aggregationFns)` instead.\n */\n aggregationFns?: AggregationFns\n}\n\n/**\n * Legacy v8-style table options that work with useLegacyTable.\n *\n * This type omits `features` and `rowModels` and instead accepts the v8-style\n * `get*RowModel` function options.\n *\n * @deprecated This is a compatibility layer for migrating from v8. Use `useTable` with explicit `features` and `rowModels` instead.\n */\nexport type LegacyTableOptions<TData extends RowData> = Omit<\n TableOptions<StockFeatures, TData>,\n 'features' | 'rowModels'\n> &\n LegacyRowModelOptions<TData>\n\n/**\n * Legacy table instance type that includes the v8-style `getState()` method.\n *\n * @deprecated Use `useTable` with explicit state selection instead.\n */\nexport type LegacyReactTable<TData extends RowData> = ReactTable<\n StockFeatures,\n TData,\n TableState<StockFeatures>\n> & {\n /**\n * Returns the current table state.\n * @deprecated In v9, access state directly via `table.state` or use `table.state` for the full state.\n */\n getState: () => TableState<StockFeatures>\n /**\n * Sets the current table state.\n * @deprecated In v9, access state directly via `table.baseAtoms`\n */\n setState: (state: TableState<StockFeatures>) => void\n}\n\n// =============================================================================\n// Legacy type aliases - StockFeatures hardcoded for simpler prop typing with useLegacyTable\n// =============================================================================\n\n/** @deprecated Use Column<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyColumn<TData extends RowData, TValue = unknown> = Column<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use Row<TFeatures, TData> with useTable instead. */\nexport type LegacyRow<TData extends RowData> = Row<StockFeatures, TData>\n\n/** @deprecated Use Cell<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyCell<TData extends RowData, TValue = unknown> = Cell<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use Header<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyHeader<TData extends RowData, TValue = unknown> = Header<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use HeaderGroup<TFeatures, TData> with useTable instead. */\nexport type LegacyHeaderGroup<TData extends RowData> = HeaderGroup<\n StockFeatures,\n TData\n>\n\n/** @deprecated Use ColumnDef<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyColumnDef<\n TData extends RowData,\n TValue = unknown,\n> = ColumnDef<StockFeatures, TData, TValue>\n\n/** @deprecated Use Table<TFeatures, TData> with useTable instead. */\nexport type LegacyTable<TData extends RowData> = Table<StockFeatures, TData>\n\n// =============================================================================\n// Legacy column helper - StockFeatures hardcoded\n// =============================================================================\n\n/**\n * @deprecated Use `createColumnHelper<TFeatures, TData>()` with useTable instead.\n *\n * A column helper with StockFeatures pre-bound for use with useLegacyTable.\n * Only requires TData—no need to specify TFeatures.\n */\nexport function legacyCreateColumnHelper<TData extends RowData>() {\n return createColumnHelper<StockFeatures, TData>()\n}\n\n// =============================================================================\n// useLegacyTable hook\n// =============================================================================\n\n/**\n * @deprecated This hook is provided as a compatibility layer for migrating from TanStack Table v8.\n *\n * Use the new `useTable` hook instead with explicit `features` and `rowModels`:\n *\n * ```tsx\n * // New v9 API\n * const features = tableFeatures({\n * columnFilteringFeature,\n * rowSortingFeature,\n * rowPaginationFeature,\n * })\n *\n * const table = useTable({\n * features,\n * rowModels: {\n * filteredRowModel: createFilteredRowModel(filterFns),\n * sortedRowModel: createSortedRowModel(sortFns),\n * paginatedRowModel: createPaginatedRowModel(),\n * },\n * columns,\n * data,\n * })\n * ```\n *\n * Key differences from v8:\n * - Features are tree-shakeable - only import what you use\n * - Row models are explicitly passed via `rowModels`\n * - Use `table.Subscribe` for fine-grained re-renders\n * - State is accessed via `table.state` after selecting with the 2nd argument\n *\n * @param options - Legacy v8-style table options\n * @returns A table instance with the full state subscribed and a `getState()` method\n */\nexport function useLegacyTable<TData extends RowData>(\n options: LegacyTableOptions<TData>,\n): LegacyReactTable<TData> {\n const {\n // Extract legacy row model options\n getCoreRowModel: _getCoreRowModel,\n getFilteredRowModel,\n getSortedRowModel,\n getPaginationRowModel,\n getExpandedRowModel,\n getGroupedRowModel,\n getFacetedRowModel,\n getFacetedMinMaxValues,\n getFacetedUniqueValues,\n // Rest of the options\n ...restOptions\n } = options\n\n const [rowModels] = useState(() => {\n const rowModels: CreateRowModels_All<StockFeatures, TData> = {}\n\n // Legacy row model options are setup-only. Capture the first render's\n // marker options to match the table instance lifecycle.\n\n if (getFilteredRowModel) {\n rowModels.filteredRowModel = createFilteredRowModel({\n ...filterFns,\n ...options.filterFns,\n })\n }\n\n if (getSortedRowModel) {\n rowModels.sortedRowModel = createSortedRowModel({\n ...sortFns,\n ...options.sortFns,\n })\n }\n\n if (getPaginationRowModel) {\n rowModels.paginatedRowModel = createPaginatedRowModel()\n }\n\n if (getExpandedRowModel) {\n rowModels.expandedRowModel = createExpandedRowModel()\n }\n\n if (getGroupedRowModel) {\n rowModels.groupedRowModel = createGroupedRowModel({\n ...aggregationFns,\n ...options.aggregationFns,\n })\n }\n\n if (getFacetedRowModel) {\n rowModels.facetedRowModel = createFacetedRowModel()\n }\n\n if (getFacetedMinMaxValues) {\n rowModels.facetedMinMaxValues = createFacetedMinMaxValues()\n }\n\n if (getFacetedUniqueValues) {\n rowModels.facetedUniqueValues = createFacetedUniqueValues()\n }\n\n return rowModels\n })\n\n // Call useTable with the v9 API, subscribing to all state changes\n const table = useTable<StockFeatures, TData, TableState<StockFeatures>>(\n {\n ...restOptions,\n features: stockFeatures,\n rowModels,\n },\n (state) => state,\n )\n\n const getState = useCallback(() => {\n return table.state\n }, [table])\n\n const setState = useCallback(\n (state: TableState<StockFeatures>) => {\n Object.entries(state).forEach(([key, value]) => {\n // @ts-expect-error - baseAtoms is indexed by dynamic string keys\n table.baseAtoms[key].set(value)\n })\n },\n [table],\n )\n\n return useMemo(\n () => ({\n ...table,\n getState,\n setState,\n }),\n [table, getState, setState],\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAoDA,SAAgB,sBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,oBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,wBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,sBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,qBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,qBAEmB;CACjC,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,yBAEuB;CACrC,mBAAmB;AACrB;;;;;;;AAQA,SAAgB,yBAEuB;CACrC,mCAAmB,IAAI,IAAI;AAC7B;;;;;;;AAQA,SAAgB,kBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAgMA,SAAgB,2BAAkD;CAChE,OAAO,mBAAyC;AAClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAgB,eACd,SACyB;CACzB,MAAM,EAEJ,iBAAiB,kBACjB,qBACA,mBACA,uBACA,qBACA,oBACA,oBACA,wBACA,wBAEA,GAAG,gBACD;CAEJ,MAAM,CAAC,aAAa,eAAe;EACjC,MAAM,YAAuD,CAAC;EAK9D,IAAI,qBACF,UAAU,mBAAmB,uBAAuB;GAClD,GAAG;GACH,GAAG,QAAQ;EACb,CAAC;EAGH,IAAI,mBACF,UAAU,iBAAiB,qBAAqB;GAC9C,GAAG;GACH,GAAG,QAAQ;EACb,CAAC;EAGH,IAAI,uBACF,UAAU,oBAAoB,wBAAwB;EAGxD,IAAI,qBACF,UAAU,mBAAmB,uBAAuB;EAGtD,IAAI,oBACF,UAAU,kBAAkB,sBAAsB;GAChD,GAAG;GACH,GAAG,QAAQ;EACb,CAAC;EAGH,IAAI,oBACF,UAAU,kBAAkB,sBAAsB;EAGpD,IAAI,wBACF,UAAU,sBAAsB,0BAA0B;EAG5D,IAAI,wBACF,UAAU,sBAAsB,0BAA0B;EAG5D,OAAO;CACT,CAAC;CAGD,MAAM,QAAQ,SACZ;EACE,GAAG;EACH,UAAU;EACV;CACF,IACC,UAAU,KACb;CAEA,MAAM,WAAW,kBAAkB;EACjC,OAAO,MAAM;CACf,GAAG,CAAC,KAAK,CAAC;CAEV,MAAM,WAAW,aACd,UAAqC;EACpC,OAAO,QAAQ,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;GAE9C,MAAM,UAAU,IAAI,CAAC,IAAI,KAAK;EAChC,CAAC;CACH,GACA,CAAC,KAAK,CACR;CAEA,OAAO,eACE;EACL,GAAG;EACH;EACA;CACF,IACA;EAAC;EAAO;EAAU;CAAQ,CAC5B;AACF"}
1
+ {"version":3,"file":"useLegacyTable.js","names":[],"sources":["../src/useLegacyTable.ts"],"sourcesContent":["'use client'\n\nimport {\n aggregationFns,\n createColumnHelper,\n createExpandedRowModel,\n createFacetedMinMaxValues,\n createFacetedRowModel,\n createFacetedUniqueValues,\n createFilteredRowModel,\n createGroupedRowModel,\n createPaginatedRowModel,\n createSortedRowModel,\n filterFns,\n sortFns,\n stockFeatures,\n} from '@tanstack/table-core'\nimport { useCallback, useMemo, useState } from 'react'\nimport { useTable } from './useTable'\nimport type {\n AggregationFns,\n Cell,\n Column,\n ColumnDef,\n ColumnHelper,\n CreateRowModels_All,\n FilterFns,\n Header,\n HeaderGroup,\n Row,\n RowData,\n RowModel,\n SortFns,\n StockFeatures,\n Table,\n TableOptions,\n TableState,\n} from '@tanstack/table-core'\nimport type { ReactTable } from './useTable'\n\n// =============================================================================\n// V8-style row model factory functions\n// These are stub functions that act as markers for useLegacyTable to know\n// which row models to enable. They don't actually do anything - the real\n// implementation is handled by useLegacyTable internally.\n// =============================================================================\n\n/**\n * @deprecated Use `createFilteredRowModel(filterFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the filtered row model.\n */\nexport function getFilteredRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createSortedRowModel(sortFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the sorted row model.\n */\nexport function getSortedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createPaginatedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the paginated row model.\n */\nexport function getPaginationRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createExpandedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the expanded row model.\n */\nexport function getExpandedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createGroupedRowModel(aggregationFns)` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the grouped row model.\n */\nexport function getGroupedRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createFacetedRowModel()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted row model.\n */\nexport function getFacetedRowModel<\n TData extends RowData,\n>(): FacetedRowModelFactory<TData> {\n return (() => () => {}) as unknown as FacetedRowModelFactory<TData>\n}\n\n/**\n * @deprecated Use `createFacetedMinMaxValues()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted min/max values.\n */\nexport function getFacetedMinMaxValues<\n TData extends RowData,\n>(): FacetedMinMaxValuesFactory<TData> {\n return () => () => undefined\n}\n\n/**\n * @deprecated Use `createFacetedUniqueValues()` with the new `useTable` hook instead.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It acts as a marker to enable the faceted unique values.\n */\nexport function getFacetedUniqueValues<\n TData extends RowData,\n>(): FacetedUniqueValuesFactory<TData> {\n return () => () => new Map()\n}\n\n/**\n * @deprecated The core row model is always created automatically in v9.\n *\n * This is a stub function for v8 API compatibility with `useLegacyTable`.\n * It does nothing - the core row model is always available.\n */\nexport function getCoreRowModel<\n TData extends RowData,\n>(): RowModelFactory<TData> {\n return (() => () => {}) as unknown as RowModelFactory<TData>\n}\n\n// =============================================================================\n// Type definitions\n// =============================================================================\n\n/**\n * Row model factory function type from v8 API\n */\nexport type RowModelFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n) => () => RowModel<StockFeatures, TData>\n\n/**\n * Faceted row model factory function type from v8 API\n */\nexport type FacetedRowModelFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => RowModel<StockFeatures, TData>\n\n/**\n * Faceted min/max values factory function type from v8 API\n */\nexport type FacetedMinMaxValuesFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => undefined | [number, number]\n\n/**\n * Faceted unique values factory function type from v8 API\n */\nexport type FacetedUniqueValuesFactory<TData extends RowData> = (\n table: Table<StockFeatures, TData>,\n columnId: string,\n) => () => Map<any, number>\n\n/**\n * Legacy v8-style row model options\n */\nexport interface LegacyRowModelOptions<TData extends RowData> {\n /**\n * Returns the core row model for the table.\n * @deprecated This option is no longer needed in v9. The core row model is always created automatically.\n */\n getCoreRowModel?: RowModelFactory<TData>\n /**\n * Returns the filtered row model for the table.\n * @deprecated Use `rowModels.filteredRowModel` with `createFilteredRowModel(filterFns)` instead.\n */\n getFilteredRowModel?: RowModelFactory<TData>\n /**\n * Returns the sorted row model for the table.\n * @deprecated Use `rowModels.sortedRowModel` with `createSortedRowModel(sortFns)` instead.\n */\n getSortedRowModel?: RowModelFactory<TData>\n /**\n * Returns the paginated row model for the table.\n * @deprecated Use `rowModels.paginatedRowModel` with `createPaginatedRowModel()` instead.\n */\n getPaginationRowModel?: RowModelFactory<TData>\n /**\n * Returns the expanded row model for the table.\n * @deprecated Use `rowModels.expandedRowModel` with `createExpandedRowModel()` instead.\n */\n getExpandedRowModel?: RowModelFactory<TData>\n /**\n * Returns the grouped row model for the table.\n * @deprecated Use `rowModels.groupedRowModel` with `createGroupedRowModel(aggregationFns)` instead.\n */\n getGroupedRowModel?: RowModelFactory<TData>\n /**\n * Returns the faceted row model for a column.\n * @deprecated Use `rowModels.facetedRowModel` with `createFacetedRowModel()` instead.\n */\n getFacetedRowModel?: FacetedRowModelFactory<TData>\n /**\n * Returns the faceted min/max values for a column.\n * @deprecated Use `rowModels.facetedMinMaxValues` with `createFacetedMinMaxValues()` instead.\n */\n getFacetedMinMaxValues?: FacetedMinMaxValuesFactory<TData>\n /**\n * Returns the faceted unique values for a column.\n * @deprecated Use `rowModels.facetedUniqueValues` with `createFacetedUniqueValues()` instead.\n */\n getFacetedUniqueValues?: FacetedUniqueValuesFactory<TData>\n /**\n * Additional filter functions to apply to the table.\n * @deprecated Use `rowModels.filteredRowModel` with `createFilteredRowModel(filterFns)` instead.\n */\n filterFns?: FilterFns\n /**\n * Additional sort functions to apply to the table.\n * @deprecated Use `rowModels.sortedRowModel` with `createSortedRowModel(sortFns)` instead.\n */\n sortFns?: SortFns\n /**\n * Additional aggregation functions to apply to the table.\n * @deprecated Use `rowModels.groupedRowModel` with `createGroupedRowModel(aggregationFns)` instead.\n */\n aggregationFns?: AggregationFns\n}\n\n/**\n * Legacy v8-style table options that work with useLegacyTable.\n *\n * This type omits `features` and `rowModels` and instead accepts the v8-style\n * `get*RowModel` function options.\n *\n * @deprecated This is a compatibility layer for migrating from v8. Use `useTable` with explicit `features` and `rowModels` instead.\n */\nexport type LegacyTableOptions<TData extends RowData> = Omit<\n TableOptions<StockFeatures, TData>,\n 'features' | 'rowModels'\n> &\n LegacyRowModelOptions<TData>\n\n/**\n * Legacy table instance type that includes the v8-style `getState()` method.\n *\n * @deprecated Use `useTable` with explicit state selection instead.\n */\nexport type LegacyReactTable<TData extends RowData> = ReactTable<\n StockFeatures,\n TData,\n TableState<StockFeatures>\n> & {\n /**\n * Returns the current table state.\n * @deprecated In v9, access state directly via `table.state` or use `table.state` for the full state.\n */\n getState: () => TableState<StockFeatures>\n /**\n * Sets the current table state.\n * @deprecated In v9, access state directly via `table.baseAtoms`\n */\n setState: (state: TableState<StockFeatures>) => void\n}\n\n// =============================================================================\n// Legacy type aliases - StockFeatures hardcoded for simpler prop typing with useLegacyTable\n// =============================================================================\n\n/** @deprecated Use Column<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyColumn<TData extends RowData, TValue = unknown> = Column<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use Row<TFeatures, TData> with useTable instead. */\nexport type LegacyRow<TData extends RowData> = Row<StockFeatures, TData>\n\n/** @deprecated Use Cell<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyCell<TData extends RowData, TValue = unknown> = Cell<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use Header<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyHeader<TData extends RowData, TValue = unknown> = Header<\n StockFeatures,\n TData,\n TValue\n>\n\n/** @deprecated Use HeaderGroup<TFeatures, TData> with useTable instead. */\nexport type LegacyHeaderGroup<TData extends RowData> = HeaderGroup<\n StockFeatures,\n TData\n>\n\n/** @deprecated Use ColumnDef<TFeatures, TData, TValue> with useTable instead. */\nexport type LegacyColumnDef<\n TData extends RowData,\n TValue = unknown,\n> = ColumnDef<StockFeatures, TData, TValue>\n\n/** @deprecated Use Table<TFeatures, TData> with useTable instead. */\nexport type LegacyTable<TData extends RowData> = Table<StockFeatures, TData>\n\n// =============================================================================\n// Legacy column helper - StockFeatures hardcoded\n// =============================================================================\n\n/**\n * @deprecated Use `createColumnHelper<TFeatures, TData>()` with useTable instead.\n *\n * A column helper with StockFeatures pre-bound for use with useLegacyTable.\n * Only requires TData—no need to specify TFeatures.\n */\nexport function legacyCreateColumnHelper<TData extends RowData>(): ColumnHelper<\n StockFeatures,\n TData\n> {\n return createColumnHelper<StockFeatures, TData>()\n}\n\n// =============================================================================\n// useLegacyTable hook\n// =============================================================================\n\n/**\n * @deprecated This hook is provided as a compatibility layer for migrating from TanStack Table v8.\n *\n * Use the new `useTable` hook instead with explicit `features` and `rowModels`:\n *\n * ```tsx\n * // New v9 API\n * const features = tableFeatures({\n * columnFilteringFeature,\n * rowSortingFeature,\n * rowPaginationFeature,\n * })\n *\n * const table = useTable({\n * features,\n * rowModels: {\n * filteredRowModel: createFilteredRowModel(filterFns),\n * sortedRowModel: createSortedRowModel(sortFns),\n * paginatedRowModel: createPaginatedRowModel(),\n * },\n * columns,\n * data,\n * })\n * ```\n *\n * Key differences from v8:\n * - Features are tree-shakeable - only import what you use\n * - Row models are explicitly passed via `rowModels`\n * - Use `table.Subscribe` for fine-grained re-renders\n * - State is accessed via `table.state` after selecting with the 2nd argument\n *\n * @param options - Legacy v8-style table options\n * @returns A table instance with the full state subscribed and a `getState()` method\n */\nexport function useLegacyTable<TData extends RowData>(\n options: LegacyTableOptions<TData>,\n): LegacyReactTable<TData> {\n const {\n // Extract legacy row model options\n getCoreRowModel: _getCoreRowModel,\n getFilteredRowModel,\n getSortedRowModel,\n getPaginationRowModel,\n getExpandedRowModel,\n getGroupedRowModel,\n getFacetedRowModel,\n getFacetedMinMaxValues,\n getFacetedUniqueValues,\n // Rest of the options\n ...restOptions\n } = options\n\n const [rowModels] = useState(() => {\n const rowModels: CreateRowModels_All<StockFeatures, TData> = {}\n\n // Legacy row model options are setup-only. Capture the first render's\n // marker options to match the table instance lifecycle.\n\n if (getFilteredRowModel) {\n rowModels.filteredRowModel = createFilteredRowModel({\n ...filterFns,\n ...options.filterFns,\n })\n }\n\n if (getSortedRowModel) {\n rowModels.sortedRowModel = createSortedRowModel({\n ...sortFns,\n ...options.sortFns,\n })\n }\n\n if (getPaginationRowModel) {\n rowModels.paginatedRowModel = createPaginatedRowModel()\n }\n\n if (getExpandedRowModel) {\n rowModels.expandedRowModel = createExpandedRowModel()\n }\n\n if (getGroupedRowModel) {\n rowModels.groupedRowModel = createGroupedRowModel({\n ...aggregationFns,\n ...options.aggregationFns,\n })\n }\n\n if (getFacetedRowModel) {\n rowModels.facetedRowModel = createFacetedRowModel()\n }\n\n if (getFacetedMinMaxValues) {\n rowModels.facetedMinMaxValues = createFacetedMinMaxValues()\n }\n\n if (getFacetedUniqueValues) {\n rowModels.facetedUniqueValues = createFacetedUniqueValues()\n }\n\n return rowModels\n })\n\n // Call useTable with the v9 API, subscribing to all state changes\n const table = useTable<StockFeatures, TData, TableState<StockFeatures>>(\n {\n ...restOptions,\n features: stockFeatures,\n rowModels,\n },\n (state) => state,\n )\n\n const getState = useCallback(() => {\n return table.state\n }, [table])\n\n const setState = useCallback(\n (state: TableState<StockFeatures>) => {\n Object.entries(state).forEach(([key, value]) => {\n // @ts-expect-error - baseAtoms is indexed by dynamic string keys\n table.baseAtoms[key].set(value)\n })\n },\n [table],\n )\n\n return useMemo(\n () => ({\n ...table,\n getState,\n setState,\n }),\n [table, getState, setState],\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAqDA,SAAgB,sBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,oBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,wBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,sBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,qBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,qBAEmB;CACjC,oBAAoB,CAAC;AACvB;;;;;;;AAQA,SAAgB,yBAEuB;CACrC,mBAAmB;AACrB;;;;;;;AAQA,SAAgB,yBAEuB;CACrC,mCAAmB,IAAI,IAAI;AAC7B;;;;;;;AAQA,SAAgB,kBAEY;CAC1B,oBAAoB,CAAC;AACvB;;;;;;;AAgMA,SAAgB,2BAGd;CACA,OAAO,mBAAyC;AAClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAgB,eACd,SACyB;CACzB,MAAM,EAEJ,iBAAiB,kBACjB,qBACA,mBACA,uBACA,qBACA,oBACA,oBACA,wBACA,wBAEA,GAAG,gBACD;CAEJ,MAAM,CAAC,aAAa,eAAe;EACjC,MAAM,YAAuD,CAAC;EAK9D,IAAI,qBACF,UAAU,mBAAmB,uBAAuB;GAClD,GAAG;GACH,GAAG,QAAQ;EACb,CAAC;EAGH,IAAI,mBACF,UAAU,iBAAiB,qBAAqB;GAC9C,GAAG;GACH,GAAG,QAAQ;EACb,CAAC;EAGH,IAAI,uBACF,UAAU,oBAAoB,wBAAwB;EAGxD,IAAI,qBACF,UAAU,mBAAmB,uBAAuB;EAGtD,IAAI,oBACF,UAAU,kBAAkB,sBAAsB;GAChD,GAAG;GACH,GAAG,QAAQ;EACb,CAAC;EAGH,IAAI,oBACF,UAAU,kBAAkB,sBAAsB;EAGpD,IAAI,wBACF,UAAU,sBAAsB,0BAA0B;EAG5D,IAAI,wBACF,UAAU,sBAAsB,0BAA0B;EAG5D,OAAO;CACT,CAAC;CAGD,MAAM,QAAQ,SACZ;EACE,GAAG;EACH,UAAU;EACV;CACF,IACC,UAAU,KACb;CAEA,MAAM,WAAW,kBAAkB;EACjC,OAAO,MAAM;CACf,GAAG,CAAC,KAAK,CAAC;CAEV,MAAM,WAAW,aACd,UAAqC;EACpC,OAAO,QAAQ,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;GAE9C,MAAM,UAAU,IAAI,CAAC,IAAI,KAAK;EAChC,CAAC;CACH,GACA,CAAC,KAAK,CACR;CAEA,OAAO,eACE;EACL,GAAG;EACH;EACA;CACF,IACA;EAAC;EAAO;EAAU;CAAQ,CAC5B;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/react-table",
3
- "version": "9.0.0-beta.3",
3
+ "version": "9.0.0-beta.6",
4
4
  "description": "Headless UI for building powerful tables & datagrids for React.",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -55,7 +55,7 @@
55
55
  ],
56
56
  "dependencies": {
57
57
  "@tanstack/react-store": "^0.11.0",
58
- "@tanstack/table-core": "^9.0.0-beta.2"
58
+ "@tanstack/table-core": "^9.0.0-beta.5"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@eslint-react/eslint-plugin": "^5.8.10",
@@ -22,6 +22,7 @@ import type {
22
22
  Cell,
23
23
  Column,
24
24
  ColumnDef,
25
+ ColumnHelper,
25
26
  CreateRowModels_All,
26
27
  FilterFns,
27
28
  Header,
@@ -342,7 +343,10 @@ export type LegacyTable<TData extends RowData> = Table<StockFeatures, TData>
342
343
  * A column helper with StockFeatures pre-bound for use with useLegacyTable.
343
344
  * Only requires TData—no need to specify TFeatures.
344
345
  */
345
- export function legacyCreateColumnHelper<TData extends RowData>() {
346
+ export function legacyCreateColumnHelper<TData extends RowData>(): ColumnHelper<
347
+ StockFeatures,
348
+ TData
349
+ > {
346
350
  return createColumnHelper<StockFeatures, TData>()
347
351
  }
348
352