@tanstack/vue-table 8.0.12 → 8.1.1

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tanstack/vue-table",
3
3
  "author": "Tanner Linsley",
4
- "version": "8.0.12",
4
+ "version": "8.1.1",
5
5
  "description": "Headless UI for building powerful tables & datagrids for Vue.",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/tanstack/table#readme",
@@ -35,7 +35,7 @@
35
35
  "src"
36
36
  ],
37
37
  "dependencies": {
38
- "@tanstack/table-core": "8.0.12"
38
+ "@tanstack/table-core": "8.1.1"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "vue": "^3.2.33"
package/src/index.ts CHANGED
@@ -1,18 +1,15 @@
1
1
  import {
2
- TableGenerics,
3
2
  TableOptions,
4
- PartialKeys,
5
- Table,
6
- createTableInstance,
7
- createTableFactory,
3
+ createTable,
8
4
  TableOptionsResolved,
5
+ RowData,
9
6
  } from '@tanstack/table-core'
10
7
  import { h, watchEffect, ref, VNode } from 'vue'
11
8
  import { mergeProxy } from './merge-proxy'
12
9
 
13
10
  export * from '@tanstack/table-core'
14
11
 
15
- function render<TProps extends {}>(
12
+ export function flexRender<TProps extends {}>(
16
13
  Comp: any,
17
14
  props: TProps
18
15
  ): VNode | string | number | boolean | null {
@@ -25,22 +22,17 @@ function render<TProps extends {}>(
25
22
  return Comp
26
23
  }
27
24
 
28
- export const createTable = createTableFactory({ render })
29
-
30
- export function useTableInstance<TGenerics extends TableGenerics>(
31
- table: Table<TGenerics>,
32
- options: TableOptions<TGenerics>
25
+ export function useVueTable<TData extends RowData>(
26
+ options: TableOptions<TData>
33
27
  ) {
34
- const resolvedOptions: TableOptionsResolved<TGenerics> = mergeProxy(
28
+ const resolvedOptions: TableOptionsResolved<TData> = mergeProxy(
35
29
  {
36
- ...table.options,
37
30
  state: {}, // Dummy state
38
31
  onStateChange: () => {}, // noop
39
- render,
40
32
  renderFallbackValue: null,
41
33
  mergeOptions(
42
- defaultOptions: TableOptions<TGenerics>,
43
- options: TableOptions<TGenerics>
34
+ defaultOptions: TableOptions<TData>,
35
+ options: TableOptions<TData>
44
36
  ) {
45
37
  return mergeProxy(defaultOptions, options)
46
38
  },
@@ -48,12 +40,12 @@ export function useTableInstance<TGenerics extends TableGenerics>(
48
40
  options
49
41
  )
50
42
 
51
- const instance = createTableInstance<TGenerics>(resolvedOptions)
43
+ const table = createTable<TData>(resolvedOptions)
52
44
  // can't use `reactive` because update needs to be immutable
53
- const state = ref(instance.initialState)
45
+ const state = ref(table.initialState)
54
46
 
55
47
  watchEffect(() => {
56
- instance.setOptions(prev => {
48
+ table.setOptions(prev => {
57
49
  const stateProxy = new Proxy({} as typeof state.value, {
58
50
  get: (_, prop) => state.value[prop as keyof typeof state.value],
59
51
  })
@@ -79,8 +71,8 @@ export function useTableInstance<TGenerics extends TableGenerics>(
79
71
  })
80
72
 
81
73
  // onBeforeUpdate(() => {
82
- // instance.willUpdate()
74
+ // table.willUpdate()
83
75
  // })
84
76
 
85
- return instance
77
+ return table
86
78
  }
@@ -1,12 +0,0 @@
1
- export declare const $PROXY: unique symbol;
2
- declare type UnboxLazy<T> = T extends () => infer U ? U : T;
3
- declare type BoxedTupleTypes<T extends any[]> = {
4
- [P in keyof T]: [UnboxLazy<T[P]>];
5
- }[Exclude<keyof T, keyof any[]>];
6
- declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
7
- declare type UnboxIntersection<T> = T extends {
8
- 0: infer U;
9
- } ? U : never;
10
- declare type MergeProxy<T extends any[]> = UnboxIntersection<UnionToIntersection<BoxedTupleTypes<T>>>;
11
- export declare function mergeProxy<T extends any[]>(...sources: T): MergeProxy<T>;
12
- export {};