@tanstack/vue-table 8.0.13 → 8.1.0
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/build/cjs/table-core/build/esm/index.js +586 -678
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/cjs/vue-table/src/index.js +12 -17
- package/build/cjs/vue-table/src/index.js.map +1 -1
- package/build/esm/index.js +594 -691
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +26 -26
- package/build/types/index.d.ts +4 -11
- package/build/umd/index.development.js +595 -692
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +13 -21
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
|
|
4
|
+
"version": "8.1.0",
|
|
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
|
|
38
|
+
"@tanstack/table-core": "8.1.0"
|
|
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
|
-
|
|
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
|
|
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
|
|
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<
|
|
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<
|
|
43
|
-
options: TableOptions<
|
|
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
|
|
43
|
+
const table = createTable<TData>(resolvedOptions)
|
|
52
44
|
// can't use `reactive` because update needs to be immutable
|
|
53
|
-
const state = ref(
|
|
45
|
+
const state = ref(table.initialState)
|
|
54
46
|
|
|
55
47
|
watchEffect(() => {
|
|
56
|
-
|
|
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
|
-
//
|
|
74
|
+
// table.willUpdate()
|
|
83
75
|
// })
|
|
84
76
|
|
|
85
|
-
return
|
|
77
|
+
return table
|
|
86
78
|
}
|