@tanstack/vue-table 9.0.0-beta.52 → 9.0.0-beta.53
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/dist/FlexRender.d.ts +1 -2
- package/dist/FlexRender.js +1 -2
- package/dist/createTableHook.d.ts +1 -2
- package/dist/createTableHook.js +1 -2
- package/dist/merge-proxy.js +1 -2
- package/dist/reactivity.js +1 -2
- package/dist/useTable.d.ts +1 -2
- package/dist/useTable.js +1 -2
- package/package.json +7 -22
- package/skills/create-table-hook/SKILL.md +2 -2
- package/skills/getting-started/SKILL.md +2 -2
- package/skills/migrate-v8-to-v9/SKILL.md +2 -2
- package/skills/table-state/SKILL.md +2 -2
- package/skills/with-tanstack-query/SKILL.md +2 -2
- package/skills/with-tanstack-virtual/SKILL.md +2 -2
- package/dist/FlexRender.cjs +0 -79
- package/dist/FlexRender.cjs.map +0 -1
- package/dist/FlexRender.d.cts +0 -63
- package/dist/FlexRender.js.map +0 -1
- package/dist/createTableHook.cjs +0 -189
- package/dist/createTableHook.cjs.map +0 -1
- package/dist/createTableHook.d.cts +0 -162
- package/dist/createTableHook.js.map +0 -1
- package/dist/experimental-worker-plugin.cjs +0 -9
- package/dist/experimental-worker-plugin.d.cts +0 -1
- package/dist/flex-render.cjs +0 -5
- package/dist/flex-render.d.cts +0 -2
- package/dist/index.cjs +0 -17
- package/dist/index.d.cts +0 -5
- package/dist/merge-proxy.cjs +0 -77
- package/dist/merge-proxy.cjs.map +0 -1
- package/dist/merge-proxy.js.map +0 -1
- package/dist/reactivity.cjs +0 -60
- package/dist/reactivity.cjs.map +0 -1
- package/dist/reactivity.js.map +0 -1
- package/dist/static-functions.cjs +0 -9
- package/dist/static-functions.d.cts +0 -1
- package/dist/useTable.cjs +0 -72
- package/dist/useTable.cjs.map +0 -1
- package/dist/useTable.d.cts +0 -36
- package/dist/useTable.js.map +0 -1
- package/src/FlexRender.ts +0 -138
- package/src/createTableHook.ts +0 -625
- package/src/experimental-worker-plugin.ts +0 -1
- package/src/flex-render.ts +0 -1
- package/src/index.ts +0 -4
- package/src/merge-proxy.ts +0 -132
- package/src/reactivity.ts +0 -88
- package/src/static-functions.ts +0 -1
- package/src/useTable.ts +0 -173
package/dist/FlexRender.d.ts
CHANGED
|
@@ -59,5 +59,4 @@ declare const FlexRender: import("vue").DefineComponent<{
|
|
|
59
59
|
footer: FlexRenderHeader;
|
|
60
60
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
61
61
|
//#endregion
|
|
62
|
-
export { FlexRender, FlexRenderCell, FlexRenderHeader, flexRender };
|
|
63
|
-
//# sourceMappingURL=FlexRender.d.ts.map
|
|
62
|
+
export { FlexRender, FlexRenderCell, FlexRenderHeader, flexRender };
|
package/dist/FlexRender.js
CHANGED
|
@@ -158,5 +158,4 @@ declare function createTableHook<TFeatures extends TableFeatures, const TTableCo
|
|
|
158
158
|
...defaultTableOptions
|
|
159
159
|
}: CreateTableHookOptions<TFeatures, TTableComponents, TCellComponents, THeaderComponents>): CreateTableHookResult<TFeatures, TTableComponents, TCellComponents, THeaderComponents>;
|
|
160
160
|
//#endregion
|
|
161
|
-
export { AppCellContext, AppCellProps, AppColumnDefBase, AppColumnDefTemplate, AppColumnHelper, AppDisplayColumnDef, AppFlexRender, AppGroupColumnDef, AppHeaderContext, AppHeaderProps, AppTableProps, AppVueTable, ComponentType, CreateTableHookOptions, CreateTableHookResult, createTableHook };
|
|
162
|
-
//# sourceMappingURL=createTableHook.d.ts.map
|
|
161
|
+
export { AppCellContext, AppCellProps, AppColumnDefBase, AppColumnDefTemplate, AppColumnHelper, AppDisplayColumnDef, AppFlexRender, AppGroupColumnDef, AppHeaderContext, AppHeaderProps, AppTableProps, AppVueTable, ComponentType, CreateTableHookOptions, CreateTableHookResult, createTableHook };
|
package/dist/createTableHook.js
CHANGED
package/dist/merge-proxy.js
CHANGED
package/dist/reactivity.js
CHANGED
package/dist/useTable.d.ts
CHANGED
|
@@ -32,5 +32,4 @@ type VueTable<TFeatures extends TableFeatures, TData extends RowData> = Table<TF
|
|
|
32
32
|
*/
|
|
33
33
|
declare function useTable<TFeatures extends TableFeatures, TData extends RowData>(tableOptions: TableOptions<TFeatures, TData> | TableOptionsWithReactiveData<TFeatures, TData>): VueTable<TFeatures, TData>;
|
|
34
34
|
//#endregion
|
|
35
|
-
export { TableOptionsWithReactiveData, VueTable, useTable };
|
|
36
|
-
//# sourceMappingURL=useTable.d.ts.map
|
|
35
|
+
export { TableOptionsWithReactiveData, VueTable, useTable };
|
package/dist/useTable.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/vue-table",
|
|
3
|
-
"version": "9.0.0-beta.
|
|
3
|
+
"version": "9.0.0-beta.53",
|
|
4
4
|
"description": "Headless UI for building powerful tables & datagrids for Vue.",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,26 +22,12 @@
|
|
|
22
22
|
"tanstack-intent"
|
|
23
23
|
],
|
|
24
24
|
"type": "module",
|
|
25
|
-
"types": "./dist/index.d.
|
|
26
|
-
"main": "./dist/index.cjs",
|
|
27
|
-
"module": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
28
26
|
"exports": {
|
|
29
|
-
".":
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"./experimental-worker-plugin": {
|
|
34
|
-
"import": "./dist/experimental-worker-plugin.js",
|
|
35
|
-
"require": "./dist/experimental-worker-plugin.cjs"
|
|
36
|
-
},
|
|
37
|
-
"./flex-render": {
|
|
38
|
-
"import": "./dist/flex-render.js",
|
|
39
|
-
"require": "./dist/flex-render.cjs"
|
|
40
|
-
},
|
|
41
|
-
"./static-functions": {
|
|
42
|
-
"import": "./dist/static-functions.js",
|
|
43
|
-
"require": "./dist/static-functions.cjs"
|
|
44
|
-
},
|
|
27
|
+
".": "./dist/index.js",
|
|
28
|
+
"./experimental-worker-plugin": "./dist/experimental-worker-plugin.js",
|
|
29
|
+
"./flex-render": "./dist/flex-render.js",
|
|
30
|
+
"./static-functions": "./dist/static-functions.js",
|
|
45
31
|
"./package.json": "./package.json"
|
|
46
32
|
},
|
|
47
33
|
"sideEffects": false,
|
|
@@ -50,12 +36,11 @@
|
|
|
50
36
|
},
|
|
51
37
|
"files": [
|
|
52
38
|
"dist",
|
|
53
|
-
"src",
|
|
54
39
|
"skills"
|
|
55
40
|
],
|
|
56
41
|
"dependencies": {
|
|
57
42
|
"@tanstack/store": "^0.11.0",
|
|
58
|
-
"@tanstack/table-core": "9.0.0-beta.
|
|
43
|
+
"@tanstack/table-core": "9.0.0-beta.53"
|
|
59
44
|
},
|
|
60
45
|
"devDependencies": {
|
|
61
46
|
"@vitejs/plugin-vue": "^6.0.7",
|
|
@@ -6,7 +6,7 @@ metadata:
|
|
|
6
6
|
type: framework
|
|
7
7
|
library: '@tanstack/vue-table'
|
|
8
8
|
framework: vue
|
|
9
|
-
library_version: '9.0.0-beta.
|
|
9
|
+
library_version: '9.0.0-beta.53'
|
|
10
10
|
requires:
|
|
11
11
|
- '@tanstack/table-core#core'
|
|
12
12
|
- getting-started
|
|
@@ -143,4 +143,4 @@ Source: `packages/vue-table/src/useTable.ts`
|
|
|
143
143
|
|
|
144
144
|
## API Discovery
|
|
145
145
|
|
|
146
|
-
Inspect `node_modules/@tanstack/vue-table/
|
|
146
|
+
Inspect `node_modules/@tanstack/vue-table/dist/createTableHook.d.ts` for the returned helpers, wrapper props, registry types, and context contracts.
|
|
@@ -6,7 +6,7 @@ metadata:
|
|
|
6
6
|
type: framework
|
|
7
7
|
library: '@tanstack/vue-table'
|
|
8
8
|
framework: vue
|
|
9
|
-
library_version: '9.0.0-beta.
|
|
9
|
+
library_version: '9.0.0-beta.53'
|
|
10
10
|
requires:
|
|
11
11
|
- '@tanstack/table-core#core'
|
|
12
12
|
- '@tanstack/table-core#table-features'
|
|
@@ -141,4 +141,4 @@ Source: `examples/vue/basic-use-table/src/App.tsx`
|
|
|
141
141
|
|
|
142
142
|
## API Discovery
|
|
143
143
|
|
|
144
|
-
Inspect `node_modules/@tanstack/vue-table/
|
|
144
|
+
Inspect `node_modules/@tanstack/vue-table/dist/index.d.ts`, then `useTable.d.ts` and `FlexRender.d.ts`. Inspect core feature APIs in `node_modules/@tanstack/table-core/dist/features/<feature>/`.
|
|
@@ -6,7 +6,7 @@ metadata:
|
|
|
6
6
|
type: lifecycle
|
|
7
7
|
library: '@tanstack/vue-table'
|
|
8
8
|
framework: vue
|
|
9
|
-
library_version: '9.0.0-beta.
|
|
9
|
+
library_version: '9.0.0-beta.53'
|
|
10
10
|
requires:
|
|
11
11
|
- '@tanstack/table-core#migrate-v8-to-v9'
|
|
12
12
|
- getting-started
|
|
@@ -182,4 +182,4 @@ For `table.Subscribe`, use `children={(atoms) => ...}` explicitly.
|
|
|
182
182
|
|
|
183
183
|
## API Discovery
|
|
184
184
|
|
|
185
|
-
Inspect `node_modules/@tanstack/vue-table/
|
|
185
|
+
Inspect `node_modules/@tanstack/vue-table/dist/index.d.ts` and `useTable.d.ts`; verify feature slots and exact beta APIs in `node_modules/@tanstack/table-core/dist/`. Do not reconstruct v9 from v8 memory.
|
|
@@ -6,7 +6,7 @@ metadata:
|
|
|
6
6
|
type: framework
|
|
7
7
|
library: '@tanstack/vue-table'
|
|
8
8
|
framework: vue
|
|
9
|
-
library_version: '9.0.0-beta.
|
|
9
|
+
library_version: '9.0.0-beta.53'
|
|
10
10
|
requires:
|
|
11
11
|
- '@tanstack/table-core#core'
|
|
12
12
|
- getting-started
|
|
@@ -188,4 +188,4 @@ Source: `packages/vue-table/src/useTable.ts`
|
|
|
188
188
|
|
|
189
189
|
## API Discovery
|
|
190
190
|
|
|
191
|
-
Inspect `node_modules/@tanstack/vue-table/
|
|
191
|
+
Inspect `node_modules/@tanstack/vue-table/dist/useTable.d.ts` and `reactivity.d.ts`; inspect the exact state slice in the installed core feature directory.
|
|
@@ -6,7 +6,7 @@ metadata:
|
|
|
6
6
|
type: composition
|
|
7
7
|
library: '@tanstack/vue-table'
|
|
8
8
|
framework: vue
|
|
9
|
-
library_version: '9.0.0-beta.
|
|
9
|
+
library_version: '9.0.0-beta.53'
|
|
10
10
|
requires:
|
|
11
11
|
- '@tanstack/table-core#client-vs-server'
|
|
12
12
|
- getting-started
|
|
@@ -124,4 +124,4 @@ Source: `docs/framework/vue/guide/pagination.md`
|
|
|
124
124
|
|
|
125
125
|
## API Discovery
|
|
126
126
|
|
|
127
|
-
Inspect installed `@tanstack/vue-table/
|
|
127
|
+
Inspect installed `@tanstack/vue-table/dist/useTable.d.ts`, installed `@tanstack/vue-query/dist/`, and the relevant manual Table feature source for exact option types.
|
|
@@ -6,7 +6,7 @@ metadata:
|
|
|
6
6
|
type: composition
|
|
7
7
|
library: '@tanstack/vue-table'
|
|
8
8
|
framework: vue
|
|
9
|
-
library_version: '9.0.0-beta.
|
|
9
|
+
library_version: '9.0.0-beta.53'
|
|
10
10
|
requires:
|
|
11
11
|
- '@tanstack/table-core#core'
|
|
12
12
|
- getting-started
|
|
@@ -113,4 +113,4 @@ Source: `examples/vue/virtualized-columns/src/App.vue`
|
|
|
113
113
|
|
|
114
114
|
## API Discovery
|
|
115
115
|
|
|
116
|
-
Inspect installed `@tanstack/vue-table/
|
|
116
|
+
Inspect installed `@tanstack/vue-table/dist/` and `@tanstack/vue-virtual/dist/`; use the maintained Vue examples for exact row, column, and infinite layout combinations.
|
package/dist/FlexRender.cjs
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
let vue = require("vue");
|
|
2
|
-
|
|
3
|
-
//#region src/FlexRender.ts
|
|
4
|
-
/**
|
|
5
|
-
* If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`.
|
|
6
|
-
* @example flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
7
|
-
*/
|
|
8
|
-
function flexRender(render, props) {
|
|
9
|
-
if (typeof render === "function") {
|
|
10
|
-
const rendered = render(props);
|
|
11
|
-
if ((0, vue.isVNode)(rendered)) return rendered;
|
|
12
|
-
if (typeof rendered === "function" || typeof rendered === "object") return (0, vue.h)(rendered, props);
|
|
13
|
-
return rendered;
|
|
14
|
-
}
|
|
15
|
-
if (typeof render === "object") return (0, vue.h)(render, props);
|
|
16
|
-
return render;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Simplified component for rendering headers, cells, or footers.
|
|
20
|
-
*
|
|
21
|
-
* Supports both the new shorthand pattern and the legacy `:render`/`:props` pattern:
|
|
22
|
-
* @example
|
|
23
|
-
* ```vue
|
|
24
|
-
* <!-- New shorthand pattern -->
|
|
25
|
-
* <FlexRender :cell="cell" />
|
|
26
|
-
* <FlexRender :header="header" />
|
|
27
|
-
* <FlexRender :footer="header" />
|
|
28
|
-
*
|
|
29
|
-
* <!-- Legacy pattern (still supported) -->
|
|
30
|
-
* <FlexRender :render="cell.column.columnDef.cell" :props="cell.getContext()" />
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
const FlexRender = (0, vue.defineComponent)({
|
|
34
|
-
props: {
|
|
35
|
-
render: {
|
|
36
|
-
type: [
|
|
37
|
-
Function,
|
|
38
|
-
Object,
|
|
39
|
-
String
|
|
40
|
-
],
|
|
41
|
-
default: void 0
|
|
42
|
-
},
|
|
43
|
-
props: {
|
|
44
|
-
type: Object,
|
|
45
|
-
default: void 0
|
|
46
|
-
},
|
|
47
|
-
cell: {
|
|
48
|
-
type: Object,
|
|
49
|
-
default: void 0
|
|
50
|
-
},
|
|
51
|
-
header: {
|
|
52
|
-
type: Object,
|
|
53
|
-
default: void 0
|
|
54
|
-
},
|
|
55
|
-
footer: {
|
|
56
|
-
type: Object,
|
|
57
|
-
default: void 0
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
setup: (props) => {
|
|
61
|
-
return () => {
|
|
62
|
-
if (props.cell) {
|
|
63
|
-
const cell = props.cell;
|
|
64
|
-
const def = cell.column.columnDef;
|
|
65
|
-
if (cell.getIsAggregated?.()) return flexRender(def.aggregatedCell ?? def.cell, cell.getContext());
|
|
66
|
-
if (cell.getIsPlaceholder?.()) return null;
|
|
67
|
-
return flexRender(def.cell, cell.getContext());
|
|
68
|
-
}
|
|
69
|
-
if (props.header) return flexRender(props.header.column.columnDef.header, props.header.getContext());
|
|
70
|
-
if (props.footer) return flexRender(props.footer.column.columnDef.footer, props.footer.getContext());
|
|
71
|
-
return flexRender(props.render, props.props);
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
//#endregion
|
|
77
|
-
exports.FlexRender = FlexRender;
|
|
78
|
-
exports.flexRender = flexRender;
|
|
79
|
-
//# sourceMappingURL=FlexRender.cjs.map
|
package/dist/FlexRender.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FlexRender.cjs","names":[],"sources":["../src/FlexRender.ts"],"sourcesContent":["import { defineComponent, h, isVNode } from 'vue'\nimport type { PropType } from 'vue'\n\nexport interface FlexRenderCell {\n column: {\n columnDef: {\n aggregatedCell?: any\n cell?: any\n }\n }\n getContext: () => any\n getIsAggregated?: () => boolean\n getIsPlaceholder?: () => boolean\n}\n\nexport interface FlexRenderHeader {\n column: {\n columnDef: {\n footer?: any\n header?: any\n }\n }\n getContext: () => any\n}\n\n/**\n * If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`.\n * @example flexRender(cell.column.columnDef.cell, cell.getContext())\n */\nexport function flexRender(render: any, props: any): any {\n if (typeof render === 'function') {\n const rendered = render(props)\n\n if (isVNode(rendered)) {\n return rendered\n }\n\n if (typeof rendered === 'function' || typeof rendered === 'object') {\n return h(rendered, props)\n }\n\n return rendered\n }\n\n if (typeof render === 'object') {\n return h(render, props)\n }\n\n return render\n}\n\n/**\n * Simplified component for rendering headers, cells, or footers.\n *\n * Supports both the new shorthand pattern and the legacy `:render`/`:props` pattern:\n * @example\n * ```vue\n * <!-- New shorthand pattern -->\n * <FlexRender :cell=\"cell\" />\n * <FlexRender :header=\"header\" />\n * <FlexRender :footer=\"header\" />\n *\n * <!-- Legacy pattern (still supported) -->\n * <FlexRender :render=\"cell.column.columnDef.cell\" :props=\"cell.getContext()\" />\n * ```\n */\nexport const FlexRender = defineComponent({\n props: {\n render: {\n type: [Function, Object, String] as PropType<any>,\n default: undefined,\n },\n props: {\n type: Object as PropType<any>,\n default: undefined,\n },\n cell: {\n type: Object as PropType<FlexRenderCell>,\n default: undefined,\n },\n header: {\n type: Object as PropType<FlexRenderHeader>,\n default: undefined,\n },\n footer: {\n type: Object as PropType<FlexRenderHeader>,\n default: undefined,\n },\n },\n setup: (props: {\n render?: any\n props?: any\n cell?: FlexRenderCell\n header?: FlexRenderHeader\n footer?: FlexRenderHeader\n }) => {\n return () => {\n // New shorthand pattern: extract render and props from cell/header/footer\n if (props.cell) {\n const cell = props.cell\n const def = cell.column.columnDef\n // When the column-grouping feature is registered, a cell can be in\n // one of three special modes that should not render `columnDef.cell`\n // directly:\n // - aggregated: render `columnDef.aggregatedCell` (falling back to\n // `columnDef.cell` if the column did not define one)\n // - placeholder: a duplicate value within a group — render nothing\n // - grouped: fall through to `columnDef.cell`; consumers that want\n // a custom group header typically branch on `cell.getIsGrouped()`\n // themselves first\n if (cell.getIsAggregated?.()) {\n return flexRender(def.aggregatedCell ?? def.cell, cell.getContext())\n }\n if (cell.getIsPlaceholder?.()) {\n return null\n }\n return flexRender(def.cell, cell.getContext())\n }\n\n if (props.header) {\n return flexRender(\n props.header.column.columnDef.header,\n props.header.getContext(),\n )\n }\n\n if (props.footer) {\n return flexRender(\n props.footer.column.columnDef.footer,\n props.footer.getContext(),\n )\n }\n\n // Legacy pattern: use render and props directly\n return flexRender(props.render, props.props)\n }\n },\n})\n"],"mappings":";;;;;;;AA6BA,SAAgB,WAAW,QAAa,OAAiB;CACvD,IAAI,OAAO,WAAW,YAAY;EAChC,MAAM,WAAW,OAAO,KAAK;EAE7B,qBAAY,QAAQ,GAClB,OAAO;EAGT,IAAI,OAAO,aAAa,cAAc,OAAO,aAAa,UACxD,kBAAS,UAAU,KAAK;EAG1B,OAAO;CACT;CAEA,IAAI,OAAO,WAAW,UACpB,kBAAS,QAAQ,KAAK;CAGxB,OAAO;AACT;;;;;;;;;;;;;;;;AAiBA,MAAa,sCAA6B;CACxC,OAAO;EACL,QAAQ;GACN,MAAM;IAAC;IAAU;IAAQ;GAAM;GAC/B,SAAS;EACX;EACA,OAAO;GACL,MAAM;GACN,SAAS;EACX;EACA,MAAM;GACJ,MAAM;GACN,SAAS;EACX;EACA,QAAQ;GACN,MAAM;GACN,SAAS;EACX;EACA,QAAQ;GACN,MAAM;GACN,SAAS;EACX;CACF;CACA,QAAQ,UAMF;EACJ,aAAa;GAEX,IAAI,MAAM,MAAM;IACd,MAAM,OAAO,MAAM;IACnB,MAAM,MAAM,KAAK,OAAO;IAUxB,IAAI,KAAK,kBAAkB,GACzB,OAAO,WAAW,IAAI,kBAAkB,IAAI,MAAM,KAAK,WAAW,CAAC;IAErE,IAAI,KAAK,mBAAmB,GAC1B,OAAO;IAET,OAAO,WAAW,IAAI,MAAM,KAAK,WAAW,CAAC;GAC/C;GAEA,IAAI,MAAM,QACR,OAAO,WACL,MAAM,OAAO,OAAO,UAAU,QAC9B,MAAM,OAAO,WAAW,CAC1B;GAGF,IAAI,MAAM,QACR,OAAO,WACL,MAAM,OAAO,OAAO,UAAU,QAC9B,MAAM,OAAO,WAAW,CAC1B;GAIF,OAAO,WAAW,MAAM,QAAQ,MAAM,KAAK;EAC7C;CACF;AACF,CAAC"}
|
package/dist/FlexRender.d.cts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
//#region src/FlexRender.d.ts
|
|
2
|
-
interface FlexRenderCell {
|
|
3
|
-
column: {
|
|
4
|
-
columnDef: {
|
|
5
|
-
aggregatedCell?: any;
|
|
6
|
-
cell?: any;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
getContext: () => any;
|
|
10
|
-
getIsAggregated?: () => boolean;
|
|
11
|
-
getIsPlaceholder?: () => boolean;
|
|
12
|
-
}
|
|
13
|
-
interface FlexRenderHeader {
|
|
14
|
-
column: {
|
|
15
|
-
columnDef: {
|
|
16
|
-
footer?: any;
|
|
17
|
-
header?: any;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
getContext: () => any;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`.
|
|
24
|
-
* @example flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
25
|
-
*/
|
|
26
|
-
declare function flexRender(render: any, props: any): any;
|
|
27
|
-
/**
|
|
28
|
-
* Simplified component for rendering headers, cells, or footers.
|
|
29
|
-
*
|
|
30
|
-
* Supports both the new shorthand pattern and the legacy `:render`/`:props` pattern:
|
|
31
|
-
* @example
|
|
32
|
-
* ```vue
|
|
33
|
-
* <!-- New shorthand pattern -->
|
|
34
|
-
* <FlexRender :cell="cell" />
|
|
35
|
-
* <FlexRender :header="header" />
|
|
36
|
-
* <FlexRender :footer="header" />
|
|
37
|
-
*
|
|
38
|
-
* <!-- Legacy pattern (still supported) -->
|
|
39
|
-
* <FlexRender :render="cell.column.columnDef.cell" :props="cell.getContext()" />
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
declare const FlexRender: import("vue").DefineComponent<{
|
|
43
|
-
render?: any;
|
|
44
|
-
props?: any;
|
|
45
|
-
cell?: FlexRenderCell | undefined;
|
|
46
|
-
header?: FlexRenderHeader | undefined;
|
|
47
|
-
footer?: FlexRenderHeader | undefined;
|
|
48
|
-
}, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
49
|
-
render?: any;
|
|
50
|
-
props?: any;
|
|
51
|
-
cell?: FlexRenderCell | undefined;
|
|
52
|
-
header?: FlexRenderHeader | undefined;
|
|
53
|
-
footer?: FlexRenderHeader | undefined;
|
|
54
|
-
}> & Readonly<{}>, {
|
|
55
|
-
props: any;
|
|
56
|
-
render: any;
|
|
57
|
-
cell: FlexRenderCell;
|
|
58
|
-
header: FlexRenderHeader;
|
|
59
|
-
footer: FlexRenderHeader;
|
|
60
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
61
|
-
//#endregion
|
|
62
|
-
export { FlexRender, FlexRenderCell, FlexRenderHeader, flexRender };
|
|
63
|
-
//# sourceMappingURL=FlexRender.d.cts.map
|
package/dist/FlexRender.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FlexRender.js","names":[],"sources":["../src/FlexRender.ts"],"sourcesContent":["import { defineComponent, h, isVNode } from 'vue'\nimport type { PropType } from 'vue'\n\nexport interface FlexRenderCell {\n column: {\n columnDef: {\n aggregatedCell?: any\n cell?: any\n }\n }\n getContext: () => any\n getIsAggregated?: () => boolean\n getIsPlaceholder?: () => boolean\n}\n\nexport interface FlexRenderHeader {\n column: {\n columnDef: {\n footer?: any\n header?: any\n }\n }\n getContext: () => any\n}\n\n/**\n * If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`.\n * @example flexRender(cell.column.columnDef.cell, cell.getContext())\n */\nexport function flexRender(render: any, props: any): any {\n if (typeof render === 'function') {\n const rendered = render(props)\n\n if (isVNode(rendered)) {\n return rendered\n }\n\n if (typeof rendered === 'function' || typeof rendered === 'object') {\n return h(rendered, props)\n }\n\n return rendered\n }\n\n if (typeof render === 'object') {\n return h(render, props)\n }\n\n return render\n}\n\n/**\n * Simplified component for rendering headers, cells, or footers.\n *\n * Supports both the new shorthand pattern and the legacy `:render`/`:props` pattern:\n * @example\n * ```vue\n * <!-- New shorthand pattern -->\n * <FlexRender :cell=\"cell\" />\n * <FlexRender :header=\"header\" />\n * <FlexRender :footer=\"header\" />\n *\n * <!-- Legacy pattern (still supported) -->\n * <FlexRender :render=\"cell.column.columnDef.cell\" :props=\"cell.getContext()\" />\n * ```\n */\nexport const FlexRender = defineComponent({\n props: {\n render: {\n type: [Function, Object, String] as PropType<any>,\n default: undefined,\n },\n props: {\n type: Object as PropType<any>,\n default: undefined,\n },\n cell: {\n type: Object as PropType<FlexRenderCell>,\n default: undefined,\n },\n header: {\n type: Object as PropType<FlexRenderHeader>,\n default: undefined,\n },\n footer: {\n type: Object as PropType<FlexRenderHeader>,\n default: undefined,\n },\n },\n setup: (props: {\n render?: any\n props?: any\n cell?: FlexRenderCell\n header?: FlexRenderHeader\n footer?: FlexRenderHeader\n }) => {\n return () => {\n // New shorthand pattern: extract render and props from cell/header/footer\n if (props.cell) {\n const cell = props.cell\n const def = cell.column.columnDef\n // When the column-grouping feature is registered, a cell can be in\n // one of three special modes that should not render `columnDef.cell`\n // directly:\n // - aggregated: render `columnDef.aggregatedCell` (falling back to\n // `columnDef.cell` if the column did not define one)\n // - placeholder: a duplicate value within a group — render nothing\n // - grouped: fall through to `columnDef.cell`; consumers that want\n // a custom group header typically branch on `cell.getIsGrouped()`\n // themselves first\n if (cell.getIsAggregated?.()) {\n return flexRender(def.aggregatedCell ?? def.cell, cell.getContext())\n }\n if (cell.getIsPlaceholder?.()) {\n return null\n }\n return flexRender(def.cell, cell.getContext())\n }\n\n if (props.header) {\n return flexRender(\n props.header.column.columnDef.header,\n props.header.getContext(),\n )\n }\n\n if (props.footer) {\n return flexRender(\n props.footer.column.columnDef.footer,\n props.footer.getContext(),\n )\n }\n\n // Legacy pattern: use render and props directly\n return flexRender(props.render, props.props)\n }\n },\n})\n"],"mappings":";;;;;;;AA6BA,SAAgB,WAAW,QAAa,OAAiB;CACvD,IAAI,OAAO,WAAW,YAAY;EAChC,MAAM,WAAW,OAAO,KAAK;EAE7B,IAAI,QAAQ,QAAQ,GAClB,OAAO;EAGT,IAAI,OAAO,aAAa,cAAc,OAAO,aAAa,UACxD,OAAO,EAAE,UAAU,KAAK;EAG1B,OAAO;CACT;CAEA,IAAI,OAAO,WAAW,UACpB,OAAO,EAAE,QAAQ,KAAK;CAGxB,OAAO;AACT;;;;;;;;;;;;;;;;AAiBA,MAAa,aAAa,gBAAgB;CACxC,OAAO;EACL,QAAQ;GACN,MAAM;IAAC;IAAU;IAAQ;GAAM;GAC/B,SAAS;EACX;EACA,OAAO;GACL,MAAM;GACN,SAAS;EACX;EACA,MAAM;GACJ,MAAM;GACN,SAAS;EACX;EACA,QAAQ;GACN,MAAM;GACN,SAAS;EACX;EACA,QAAQ;GACN,MAAM;GACN,SAAS;EACX;CACF;CACA,QAAQ,UAMF;EACJ,aAAa;GAEX,IAAI,MAAM,MAAM;IACd,MAAM,OAAO,MAAM;IACnB,MAAM,MAAM,KAAK,OAAO;IAUxB,IAAI,KAAK,kBAAkB,GACzB,OAAO,WAAW,IAAI,kBAAkB,IAAI,MAAM,KAAK,WAAW,CAAC;IAErE,IAAI,KAAK,mBAAmB,GAC1B,OAAO;IAET,OAAO,WAAW,IAAI,MAAM,KAAK,WAAW,CAAC;GAC/C;GAEA,IAAI,MAAM,QACR,OAAO,WACL,MAAM,OAAO,OAAO,UAAU,QAC9B,MAAM,OAAO,WAAW,CAC1B;GAGF,IAAI,MAAM,QACR,OAAO,WACL,MAAM,OAAO,OAAO,UAAU,QAC9B,MAAM,OAAO,WAAW,CAC1B;GAIF,OAAO,WAAW,MAAM,QAAQ,MAAM,KAAK;EAC7C;CACF;AACF,CAAC"}
|
package/dist/createTableHook.cjs
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
const require_FlexRender = require('./FlexRender.cjs');
|
|
2
|
-
const require_merge_proxy = require('./merge-proxy.cjs');
|
|
3
|
-
const require_useTable = require('./useTable.cjs');
|
|
4
|
-
let vue = require("vue");
|
|
5
|
-
let _tanstack_table_core = require("@tanstack/table-core");
|
|
6
|
-
|
|
7
|
-
//#region src/createTableHook.ts
|
|
8
|
-
const AppFlexRender = (0, vue.defineComponent)({
|
|
9
|
-
name: "TableFlexRender",
|
|
10
|
-
props: {
|
|
11
|
-
cell: {
|
|
12
|
-
type: Object,
|
|
13
|
-
default: void 0
|
|
14
|
-
},
|
|
15
|
-
header: {
|
|
16
|
-
type: Object,
|
|
17
|
-
default: void 0
|
|
18
|
-
},
|
|
19
|
-
footer: {
|
|
20
|
-
type: Object,
|
|
21
|
-
default: void 0
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
setup(props) {
|
|
25
|
-
return () => {
|
|
26
|
-
if (props.cell) return (0, vue.h)(require_FlexRender.FlexRender, {
|
|
27
|
-
render: props.cell.column.columnDef.cell,
|
|
28
|
-
props: props.cell.getContext()
|
|
29
|
-
});
|
|
30
|
-
if (props.header) return (0, vue.h)(require_FlexRender.FlexRender, {
|
|
31
|
-
render: props.header.column.columnDef.header,
|
|
32
|
-
props: props.header.getContext()
|
|
33
|
-
});
|
|
34
|
-
if (props.footer) return (0, vue.h)(require_FlexRender.FlexRender, {
|
|
35
|
-
render: props.footer.column.columnDef.footer,
|
|
36
|
-
props: props.footer.getContext()
|
|
37
|
-
});
|
|
38
|
-
return null;
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
/**
|
|
43
|
-
* Creates app-scoped Vue table helpers with features, row models, and
|
|
44
|
-
* renderable component maps pre-bound.
|
|
45
|
-
*
|
|
46
|
-
* Use this when an app or design system wants typed `useAppTable`, a pre-bound
|
|
47
|
-
* column helper, and context helpers for table, cell, and header components.
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* ```ts
|
|
51
|
-
* const { useAppTable, createAppColumnHelper } = createTableHook({
|
|
52
|
-
* features,
|
|
53
|
-
* tableComponents: {},
|
|
54
|
-
* cellComponents: {},
|
|
55
|
-
* headerComponents: {},
|
|
56
|
-
* })
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
function createTableHook({ tableComponents, cellComponents, headerComponents, ...defaultTableOptions }) {
|
|
60
|
-
const TableContext = Symbol("TableContext");
|
|
61
|
-
const CellContext = Symbol("CellContext");
|
|
62
|
-
const HeaderContext = Symbol("HeaderContext");
|
|
63
|
-
function createAppColumnHelper() {
|
|
64
|
-
return (0, _tanstack_table_core.createColumnHelper)();
|
|
65
|
-
}
|
|
66
|
-
function useTableContext() {
|
|
67
|
-
const table = (0, vue.inject)(TableContext);
|
|
68
|
-
if (!table) throw new Error("`useTableContext` must be used within an `AppTable` component. Make sure your component is wrapped with `<table.AppTable>...</table.AppTable>`.");
|
|
69
|
-
return table;
|
|
70
|
-
}
|
|
71
|
-
function useCellContext() {
|
|
72
|
-
const cell = (0, vue.inject)(CellContext);
|
|
73
|
-
if (!cell) throw new Error("`useCellContext` must be used within an `AppCell` component. Make sure your component is wrapped with `<table.AppCell :cell=\"cell\">...</table.AppCell>`.");
|
|
74
|
-
return cell;
|
|
75
|
-
}
|
|
76
|
-
function useHeaderContext() {
|
|
77
|
-
const header = (0, vue.inject)(HeaderContext);
|
|
78
|
-
if (!header) throw new Error("`useHeaderContext` must be used within an `AppHeader` or `AppFooter` component.");
|
|
79
|
-
return header;
|
|
80
|
-
}
|
|
81
|
-
const CellFlexRender = (0, vue.defineComponent)({
|
|
82
|
-
name: "AppCellFlexRender",
|
|
83
|
-
setup() {
|
|
84
|
-
const cell = useCellContext();
|
|
85
|
-
return () => (0, vue.h)(AppFlexRender, { cell });
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
const HeaderFlexRender = (0, vue.defineComponent)({
|
|
89
|
-
name: "AppHeaderFlexRender",
|
|
90
|
-
setup() {
|
|
91
|
-
const header = useHeaderContext();
|
|
92
|
-
return () => (0, vue.h)(AppFlexRender, { header });
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
const FooterFlexRender = (0, vue.defineComponent)({
|
|
96
|
-
name: "AppFooterFlexRender",
|
|
97
|
-
setup() {
|
|
98
|
-
const header = useHeaderContext();
|
|
99
|
-
return () => (0, vue.h)(AppFlexRender, { footer: header });
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
function useAppTable(tableOptions) {
|
|
103
|
-
const table = require_useTable.useTable(require_merge_proxy.mergeProxy(defaultTableOptions, tableOptions));
|
|
104
|
-
const AppTable = (0, vue.defineComponent)({
|
|
105
|
-
name: "AppTable",
|
|
106
|
-
setup(_, { slots }) {
|
|
107
|
-
(0, vue.provide)(TableContext, table);
|
|
108
|
-
return () => {
|
|
109
|
-
return slots.default?.();
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
const AppCell = (0, vue.defineComponent)({
|
|
114
|
-
name: "AppCell",
|
|
115
|
-
props: { cell: {
|
|
116
|
-
type: Object,
|
|
117
|
-
required: true
|
|
118
|
-
} },
|
|
119
|
-
setup(props, { slots }) {
|
|
120
|
-
const cell = props.cell;
|
|
121
|
-
(0, vue.provide)(CellContext, cell);
|
|
122
|
-
const extendedCell = Object.assign(cell, {
|
|
123
|
-
FlexRender: CellFlexRender,
|
|
124
|
-
...cellComponents ?? {}
|
|
125
|
-
});
|
|
126
|
-
return () => {
|
|
127
|
-
return slots.default?.({ cell: extendedCell });
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
const AppHeader = (0, vue.defineComponent)({
|
|
132
|
-
name: "AppHeader",
|
|
133
|
-
props: { header: {
|
|
134
|
-
type: Object,
|
|
135
|
-
required: true
|
|
136
|
-
} },
|
|
137
|
-
setup(props, { slots }) {
|
|
138
|
-
const header = props.header;
|
|
139
|
-
(0, vue.provide)(HeaderContext, header);
|
|
140
|
-
const extendedHeader = Object.assign(header, {
|
|
141
|
-
FlexRender: HeaderFlexRender,
|
|
142
|
-
...headerComponents ?? {}
|
|
143
|
-
});
|
|
144
|
-
return () => {
|
|
145
|
-
return slots.default?.({ header: extendedHeader });
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
const AppFooter = (0, vue.defineComponent)({
|
|
150
|
-
name: "AppFooter",
|
|
151
|
-
props: { header: {
|
|
152
|
-
type: Object,
|
|
153
|
-
required: true
|
|
154
|
-
} },
|
|
155
|
-
setup(props, { slots }) {
|
|
156
|
-
const header = props.header;
|
|
157
|
-
(0, vue.provide)(HeaderContext, header);
|
|
158
|
-
const extendedHeader = Object.assign(header, {
|
|
159
|
-
FlexRender: FooterFlexRender,
|
|
160
|
-
...headerComponents ?? {}
|
|
161
|
-
});
|
|
162
|
-
return () => {
|
|
163
|
-
return slots.default?.({ header: extendedHeader });
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
return Object.assign(table, {
|
|
168
|
-
AppTable,
|
|
169
|
-
AppCell,
|
|
170
|
-
AppHeader,
|
|
171
|
-
AppFooter,
|
|
172
|
-
FlexRender: AppFlexRender,
|
|
173
|
-
...tableComponents ?? {}
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
return {
|
|
177
|
-
appFeatures: defaultTableOptions.features,
|
|
178
|
-
createAppColumnHelper,
|
|
179
|
-
useAppTable,
|
|
180
|
-
useTableContext,
|
|
181
|
-
useCellContext,
|
|
182
|
-
useHeaderContext
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
//#endregion
|
|
187
|
-
exports.AppFlexRender = AppFlexRender;
|
|
188
|
-
exports.createTableHook = createTableHook;
|
|
189
|
-
//# sourceMappingURL=createTableHook.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createTableHook.cjs","names":["FlexRender","useTable","mergeProxy"],"sources":["../src/createTableHook.ts"],"sourcesContent":["import { createColumnHelper as coreCreateColumnHelper } from '@tanstack/table-core'\nimport { defineComponent, h, inject, provide } from 'vue'\nimport { FlexRender } from './FlexRender'\nimport { mergeProxy } from './merge-proxy'\nimport { useTable } from './useTable'\nimport type { TableOptionsWithReactiveData, VueTable } from './useTable'\nimport type { FlexRenderCell, FlexRenderHeader } from './FlexRender'\nimport type { Component, InjectionKey, PropType } from 'vue'\nimport type {\n AccessorFn,\n AccessorFnColumnDef,\n AccessorKeyColumnDef,\n Cell,\n CellContext,\n CellData,\n Column,\n ColumnDef,\n DeepKeys,\n DeepValue,\n DisplayColumnDef,\n GroupColumnDef,\n Header,\n IdentifiedColumnDef,\n NoInfer,\n Row,\n RowData,\n Table,\n TableFeatures,\n} from '@tanstack/table-core'\n\nexport type ComponentType<T extends Record<string, any>> = Component<T>\n\nexport type AppCellContext<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData,\n TCellComponents extends Record<string, ComponentType<any>>,\n> = {\n cell: Cell<TFeatures, TData, TValue> &\n TCellComponents & { FlexRender: Component }\n column: Column<TFeatures, TData, TValue>\n getValue: CellContext<TFeatures, TData, TValue>['getValue']\n renderValue: CellContext<TFeatures, TData, TValue>['renderValue']\n row: Row<TFeatures, TData>\n table: Table<TFeatures, TData>\n}\n\nexport type AppHeaderContext<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData,\n THeaderComponents extends Record<string, ComponentType<any>>,\n> = {\n column: Column<TFeatures, TData, TValue>\n header: Header<TFeatures, TData, TValue> &\n THeaderComponents & { FlexRender: Component }\n table: Table<TFeatures, TData>\n}\n\nexport type AppColumnDefTemplate<TProps extends object> =\n | string\n | ((props: TProps) => any)\n\nexport type AppColumnDefBase<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData,\n TCellComponents extends Record<string, ComponentType<any>>,\n THeaderComponents extends Record<string, ComponentType<any>>,\n> = Omit<\n IdentifiedColumnDef<TFeatures, TData, TValue>,\n 'cell' | 'header' | 'footer'\n> & {\n cell?: AppColumnDefTemplate<\n AppCellContext<TFeatures, TData, TValue, TCellComponents>\n >\n header?: AppColumnDefTemplate<\n AppHeaderContext<TFeatures, TData, TValue, THeaderComponents>\n >\n footer?: AppColumnDefTemplate<\n AppHeaderContext<TFeatures, TData, TValue, THeaderComponents>\n >\n}\n\nexport type AppDisplayColumnDef<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TCellComponents extends Record<string, ComponentType<any>>,\n THeaderComponents extends Record<string, ComponentType<any>>,\n> = Omit<\n DisplayColumnDef<TFeatures, TData, unknown>,\n 'cell' | 'header' | 'footer'\n> & {\n cell?: AppColumnDefTemplate<\n AppCellContext<TFeatures, TData, unknown, TCellComponents>\n >\n header?: AppColumnDefTemplate<\n AppHeaderContext<TFeatures, TData, unknown, THeaderComponents>\n >\n footer?: AppColumnDefTemplate<\n AppHeaderContext<TFeatures, TData, unknown, THeaderComponents>\n >\n}\n\nexport type AppGroupColumnDef<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TCellComponents extends Record<string, ComponentType<any>>,\n THeaderComponents extends Record<string, ComponentType<any>>,\n> = Omit<\n GroupColumnDef<TFeatures, TData, unknown>,\n 'cell' | 'header' | 'footer' | 'columns'\n> & {\n cell?: AppColumnDefTemplate<\n AppCellContext<TFeatures, TData, unknown, TCellComponents>\n >\n header?: AppColumnDefTemplate<\n AppHeaderContext<TFeatures, TData, unknown, THeaderComponents>\n >\n footer?: AppColumnDefTemplate<\n AppHeaderContext<TFeatures, TData, unknown, THeaderComponents>\n >\n columns?: Array<ColumnDef<TFeatures, TData, unknown>>\n}\n\nexport type AppColumnHelper<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TCellComponents extends Record<string, ComponentType<any>>,\n THeaderComponents extends Record<string, ComponentType<any>>,\n> = {\n accessor: <\n TAccessor extends AccessorFn<TData> | DeepKeys<TData>,\n TValue extends TAccessor extends AccessorFn<TData, infer TReturn>\n ? TReturn\n : TAccessor extends DeepKeys<TData>\n ? DeepValue<TData, TAccessor>\n : never,\n >(\n accessor: TAccessor,\n column: TAccessor extends AccessorFn<TData>\n ? AppColumnDefBase<\n TFeatures,\n TData,\n TValue,\n TCellComponents,\n THeaderComponents\n > & { id: string }\n : AppColumnDefBase<\n TFeatures,\n TData,\n TValue,\n TCellComponents,\n THeaderComponents\n >,\n ) => TAccessor extends AccessorFn<TData>\n ? AccessorFnColumnDef<TFeatures, TData, TValue>\n : AccessorKeyColumnDef<TFeatures, TData, TValue>\n columns: <TColumns extends ReadonlyArray<ColumnDef<TFeatures, TData, any>>>(\n columns: [...TColumns],\n ) => Array<ColumnDef<TFeatures, TData, any>> & [...TColumns]\n display: (\n column: AppDisplayColumnDef<\n TFeatures,\n TData,\n TCellComponents,\n THeaderComponents\n >,\n ) => DisplayColumnDef<TFeatures, TData, unknown>\n group: (\n column: AppGroupColumnDef<\n TFeatures,\n TData,\n TCellComponents,\n THeaderComponents\n >,\n ) => GroupColumnDef<TFeatures, TData, unknown>\n}\n\nexport type CreateTableHookOptions<\n TFeatures extends TableFeatures,\n TTableComponents extends Record<string, ComponentType<any>>,\n TCellComponents extends Record<string, ComponentType<any>>,\n THeaderComponents extends Record<string, ComponentType<any>>,\n> = Omit<\n TableOptionsWithReactiveData<TFeatures, any>,\n 'columns' | 'data' | 'store' | 'state' | 'initialState'\n> & {\n tableComponents?: TTableComponents\n cellComponents?: TCellComponents\n headerComponents?: THeaderComponents\n}\n\nexport interface AppTableProps {}\n\nexport interface AppCellProps<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n> {\n cell: Cell<TFeatures, TData, TValue>\n}\n\nexport interface AppHeaderProps<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n> {\n header: Header<TFeatures, TData, TValue>\n}\n\nexport type AppVueTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TTableComponents extends Record<string, ComponentType<any>>,\n _TCellComponents extends Record<string, ComponentType<any>>,\n _THeaderComponents extends Record<string, ComponentType<any>>,\n> = VueTable<TFeatures, TData> &\n NoInfer<TTableComponents> & {\n AppTable: Component<AppTableProps>\n AppCell: Component<AppCellProps<TFeatures, TData>>\n AppHeader: Component<AppHeaderProps<TFeatures, TData>>\n AppFooter: Component<AppHeaderProps<TFeatures, TData>>\n FlexRender: typeof AppFlexRender\n }\n\nexport interface CreateTableHookResult<\n TFeatures extends TableFeatures,\n TTableComponents extends Record<string, ComponentType<any>>,\n TCellComponents extends Record<string, ComponentType<any>>,\n THeaderComponents extends Record<string, ComponentType<any>>,\n> {\n /** The features object that was passed to `createTableHook`. */\n appFeatures: TFeatures\n /**\n * A column helper pre-bound to `TFeatures` and the registered components, so\n * the cell/header/footer render props expose the bound components.\n */\n createAppColumnHelper: <TData extends RowData>() => AppColumnHelper<\n TFeatures,\n TData,\n TCellComponents,\n THeaderComponents\n >\n /**\n * Creates a table with the `App*` wrapper components and registered\n * `tableComponents` attached. `TData` is inferred from the `data` option.\n */\n useAppTable: <TData extends RowData>(\n tableOptions: Omit<\n TableOptionsWithReactiveData<TFeatures, TData>,\n 'features'\n >,\n ) => AppVueTable<\n TFeatures,\n TData,\n TTableComponents,\n TCellComponents,\n THeaderComponents\n >\n /**\n * Reads the table provided by the nearest `<table.AppTable>`. This is the same\n * extended instance `useAppTable` returns, so the `App*` components and your\n * `tableComponents` are available on it.\n */\n useTableContext: <TData extends RowData = RowData>() => AppVueTable<\n TFeatures,\n TData,\n TTableComponents,\n TCellComponents,\n THeaderComponents\n >\n /**\n * Reads the cell provided by the nearest `<table.AppCell>`, extended with your\n * `cellComponents` and a context-bound `FlexRender`.\n */\n useCellContext: <TValue extends CellData = CellData>() => Cell<\n TFeatures,\n any,\n TValue\n > &\n TCellComponents & { FlexRender: Component }\n /**\n * Reads the header provided by the nearest `<table.AppHeader>` /\n * `<table.AppFooter>`, extended with your `headerComponents` and a\n * context-bound `FlexRender`.\n */\n useHeaderContext: <TValue extends CellData = CellData>() => Header<\n TFeatures,\n any,\n TValue\n > &\n THeaderComponents & { FlexRender: Component }\n}\n\nexport const AppFlexRender = defineComponent({\n name: 'TableFlexRender',\n props: {\n cell: {\n type: Object as PropType<FlexRenderCell>,\n default: undefined,\n },\n header: {\n type: Object as PropType<FlexRenderHeader>,\n default: undefined,\n },\n footer: {\n type: Object as PropType<FlexRenderHeader>,\n default: undefined,\n },\n },\n setup(props) {\n return () => {\n if (props.cell) {\n return h(FlexRender, {\n render: props.cell.column.columnDef.cell,\n props: props.cell.getContext(),\n })\n }\n\n if (props.header) {\n return h(FlexRender, {\n render: props.header.column.columnDef.header,\n props: props.header.getContext(),\n })\n }\n\n if (props.footer) {\n return h(FlexRender, {\n render: props.footer.column.columnDef.footer,\n props: props.footer.getContext(),\n })\n }\n\n return null\n }\n },\n})\n\n/**\n * Creates app-scoped Vue table helpers with features, row models, and\n * renderable component maps pre-bound.\n *\n * Use this when an app or design system wants typed `useAppTable`, a pre-bound\n * column helper, and context helpers for table, cell, and header components.\n *\n * @example\n * ```ts\n * const { useAppTable, createAppColumnHelper } = createTableHook({\n * features,\n * tableComponents: {},\n * cellComponents: {},\n * headerComponents: {},\n * })\n * ```\n */\nexport function createTableHook<\n TFeatures extends TableFeatures,\n const TTableComponents extends Record<string, ComponentType<any>>,\n const TCellComponents extends Record<string, ComponentType<any>>,\n const THeaderComponents extends Record<string, ComponentType<any>>,\n>({\n tableComponents,\n cellComponents,\n headerComponents,\n ...defaultTableOptions\n}: CreateTableHookOptions<\n TFeatures,\n TTableComponents,\n TCellComponents,\n THeaderComponents\n>): CreateTableHookResult<\n TFeatures,\n TTableComponents,\n TCellComponents,\n THeaderComponents\n> {\n const TableContext = Symbol('TableContext') as InjectionKey<\n VueTable<TFeatures, any>\n >\n const CellContext = Symbol('CellContext') as InjectionKey<\n Cell<TFeatures, any, any>\n >\n const HeaderContext = Symbol('HeaderContext') as InjectionKey<\n Header<TFeatures, any, any>\n >\n\n function createAppColumnHelper<TData extends RowData>(): AppColumnHelper<\n TFeatures,\n TData,\n TCellComponents,\n THeaderComponents\n > {\n return coreCreateColumnHelper<TFeatures, TData>() as AppColumnHelper<\n TFeatures,\n TData,\n TCellComponents,\n THeaderComponents\n >\n }\n\n function useTableContext<TData extends RowData = RowData>(): AppVueTable<\n TFeatures,\n TData,\n TTableComponents,\n TCellComponents,\n THeaderComponents\n > {\n const table = inject(TableContext)\n\n if (!table) {\n throw new Error(\n '`useTableContext` must be used within an `AppTable` component. ' +\n 'Make sure your component is wrapped with `<table.AppTable>...</table.AppTable>`.',\n )\n }\n\n // The value provided by `<table.AppTable>` is the extended table (the App*\n // wrapper components and `tableComponents` are Object.assign-ed onto the same\n // instance `useAppTable` returns), so this asserts the runtime shape.\n return table as unknown as AppVueTable<\n TFeatures,\n TData,\n TTableComponents,\n TCellComponents,\n THeaderComponents\n >\n }\n\n function useCellContext<TValue extends CellData = CellData>(): Cell<\n TFeatures,\n any,\n TValue\n > &\n TCellComponents & { FlexRender: Component } {\n const cell = inject(CellContext)\n\n if (!cell) {\n throw new Error(\n '`useCellContext` must be used within an `AppCell` component. ' +\n 'Make sure your component is wrapped with `<table.AppCell :cell=\"cell\">...</table.AppCell>`.',\n )\n }\n\n // `<table.AppCell>` Object.assign-es `cellComponents` and `FlexRender` onto\n // the same cell instance it provides, so this asserts the runtime shape.\n return cell as unknown as Cell<TFeatures, any, TValue> &\n TCellComponents & { FlexRender: Component }\n }\n\n function useHeaderContext<TValue extends CellData = CellData>(): Header<\n TFeatures,\n any,\n TValue\n > &\n THeaderComponents & { FlexRender: Component } {\n const header = inject(HeaderContext)\n\n if (!header) {\n throw new Error(\n '`useHeaderContext` must be used within an `AppHeader` or `AppFooter` component.',\n )\n }\n\n // `<table.AppHeader>` / `<table.AppFooter>` Object.assign `headerComponents`\n // and `FlexRender` onto the same header instance they provide.\n return header as unknown as Header<TFeatures, any, TValue> &\n THeaderComponents & { FlexRender: Component }\n }\n\n const CellFlexRender = defineComponent({\n name: 'AppCellFlexRender',\n setup() {\n const cell = useCellContext()\n return () => h(AppFlexRender, { cell })\n },\n })\n\n const HeaderFlexRender = defineComponent({\n name: 'AppHeaderFlexRender',\n setup() {\n const header = useHeaderContext()\n return () => h(AppFlexRender, { header })\n },\n })\n\n const FooterFlexRender = defineComponent({\n name: 'AppFooterFlexRender',\n setup() {\n const header = useHeaderContext()\n return () => h(AppFlexRender, { footer: header })\n },\n })\n\n function useAppTable<TData extends RowData>(\n tableOptions: Omit<\n TableOptionsWithReactiveData<TFeatures, TData>,\n 'features'\n >,\n ): AppVueTable<\n TFeatures,\n TData,\n TTableComponents,\n TCellComponents,\n THeaderComponents\n > {\n const mergedOptions = mergeProxy(\n defaultTableOptions,\n tableOptions,\n ) as TableOptionsWithReactiveData<TFeatures, TData>\n\n const table = useTable<TFeatures, TData>(mergedOptions)\n\n const AppTable = defineComponent({\n name: 'AppTable',\n setup(_, { slots }) {\n provide(TableContext, table)\n return () => {\n return slots.default?.()\n }\n },\n })\n\n const AppCell = defineComponent({\n name: 'AppCell',\n props: {\n cell: {\n type: Object as PropType<object>,\n required: true,\n },\n },\n setup(props, { slots }) {\n const cell = props.cell as Cell<TFeatures, TData, any>\n\n provide(CellContext, cell)\n\n const extendedCell = Object.assign(cell, {\n FlexRender: CellFlexRender,\n ...(cellComponents ?? {}),\n }) as Cell<TFeatures, TData, any> &\n TCellComponents & { FlexRender: Component }\n\n return () => {\n return slots.default?.({ cell: extendedCell })\n }\n },\n })\n\n const AppHeader = defineComponent({\n name: 'AppHeader',\n props: {\n header: {\n type: Object as PropType<object>,\n required: true,\n },\n },\n setup(props, { slots }) {\n const header = props.header as Header<TFeatures, TData, any>\n\n provide(HeaderContext, header)\n\n const extendedHeader = Object.assign(header, {\n FlexRender: HeaderFlexRender,\n ...(headerComponents ?? {}),\n }) as Header<TFeatures, TData, any> &\n THeaderComponents & { FlexRender: Component }\n\n return () => {\n return slots.default?.({ header: extendedHeader })\n }\n },\n })\n\n const AppFooter = defineComponent({\n name: 'AppFooter',\n props: {\n header: {\n type: Object as PropType<object>,\n required: true,\n },\n },\n setup(props, { slots }) {\n const header = props.header as Header<TFeatures, TData, any>\n\n provide(HeaderContext, header)\n\n const extendedHeader = Object.assign(header, {\n FlexRender: FooterFlexRender,\n ...(headerComponents ?? {}),\n }) as Header<TFeatures, TData, any> &\n THeaderComponents & { FlexRender: Component }\n\n return () => {\n return slots.default?.({ header: extendedHeader })\n }\n },\n })\n\n return Object.assign(table, {\n AppTable,\n AppCell,\n AppHeader,\n AppFooter,\n FlexRender: AppFlexRender,\n ...(tableComponents ?? {}),\n }) as AppVueTable<\n TFeatures,\n TData,\n TTableComponents,\n TCellComponents,\n THeaderComponents\n >\n }\n\n return {\n // `TableOptionsWithReactiveData` widens `features` to allow a reactive ref,\n // so this narrows it back to the resolved `TFeatures` for `appFeatures`.\n appFeatures: defaultTableOptions.features as TFeatures,\n createAppColumnHelper,\n useAppTable,\n useTableContext,\n useCellContext,\n useHeaderContext,\n }\n}\n"],"mappings":";;;;;;;AAuSA,MAAa,yCAAgC;CAC3C,MAAM;CACN,OAAO;EACL,MAAM;GACJ,MAAM;GACN,SAAS;EACX;EACA,QAAQ;GACN,MAAM;GACN,SAAS;EACX;EACA,QAAQ;GACN,MAAM;GACN,SAAS;EACX;CACF;CACA,MAAM,OAAO;EACX,aAAa;GACX,IAAI,MAAM,MACR,kBAASA,+BAAY;IACnB,QAAQ,MAAM,KAAK,OAAO,UAAU;IACpC,OAAO,MAAM,KAAK,WAAW;GAC/B,CAAC;GAGH,IAAI,MAAM,QACR,kBAASA,+BAAY;IACnB,QAAQ,MAAM,OAAO,OAAO,UAAU;IACtC,OAAO,MAAM,OAAO,WAAW;GACjC,CAAC;GAGH,IAAI,MAAM,QACR,kBAASA,+BAAY;IACnB,QAAQ,MAAM,OAAO,OAAO,UAAU;IACtC,OAAO,MAAM,OAAO,WAAW;GACjC,CAAC;GAGH,OAAO;EACT;CACF;AACF,CAAC;;;;;;;;;;;;;;;;;;AAmBD,SAAgB,gBAKd,EACA,iBACA,gBACA,kBACA,GAAG,uBAWH;CACA,MAAM,eAAe,OAAO,cAAc;CAG1C,MAAM,cAAc,OAAO,aAAa;CAGxC,MAAM,gBAAgB,OAAO,eAAe;CAI5C,SAAS,wBAKP;EACA,oDAAgD;CAMlD;CAEA,SAAS,kBAMP;EACA,MAAM,wBAAe,YAAY;EAEjC,IAAI,CAAC,OACH,MAAM,IAAI,MACR,iJAEF;EAMF,OAAO;CAOT;CAEA,SAAS,iBAKqC;EAC5C,MAAM,uBAAc,WAAW;EAE/B,IAAI,CAAC,MACH,MAAM,IAAI,MACR,4JAEF;EAKF,OAAO;CAET;CAEA,SAAS,mBAKuC;EAC9C,MAAM,yBAAgB,aAAa;EAEnC,IAAI,CAAC,QACH,MAAM,IAAI,MACR,iFACF;EAKF,OAAO;CAET;CAEA,MAAM,0CAAiC;EACrC,MAAM;EACN,QAAQ;GACN,MAAM,OAAO,eAAe;GAC5B,wBAAe,eAAe,EAAE,KAAK,CAAC;EACxC;CACF,CAAC;CAED,MAAM,4CAAmC;EACvC,MAAM;EACN,QAAQ;GACN,MAAM,SAAS,iBAAiB;GAChC,wBAAe,eAAe,EAAE,OAAO,CAAC;EAC1C;CACF,CAAC;CAED,MAAM,4CAAmC;EACvC,MAAM;EACN,QAAQ;GACN,MAAM,SAAS,iBAAiB;GAChC,wBAAe,eAAe,EAAE,QAAQ,OAAO,CAAC;EAClD;CACF,CAAC;CAED,SAAS,YACP,cAUA;EAMA,MAAM,QAAQC,0BALQC,+BACpB,qBACA,YAGmD,CAAC;EAEtD,MAAM,oCAA2B;GAC/B,MAAM;GACN,MAAM,GAAG,EAAE,SAAS;IAClB,iBAAQ,cAAc,KAAK;IAC3B,aAAa;KACX,OAAO,MAAM,UAAU;IACzB;GACF;EACF,CAAC;EAED,MAAM,mCAA0B;GAC9B,MAAM;GACN,OAAO,EACL,MAAM;IACJ,MAAM;IACN,UAAU;GACZ,EACF;GACA,MAAM,OAAO,EAAE,SAAS;IACtB,MAAM,OAAO,MAAM;IAEnB,iBAAQ,aAAa,IAAI;IAEzB,MAAM,eAAe,OAAO,OAAO,MAAM;KACvC,YAAY;KACZ,GAAI,kBAAkB,CAAC;IACzB,CAAC;IAGD,aAAa;KACX,OAAO,MAAM,UAAU,EAAE,MAAM,aAAa,CAAC;IAC/C;GACF;EACF,CAAC;EAED,MAAM,qCAA4B;GAChC,MAAM;GACN,OAAO,EACL,QAAQ;IACN,MAAM;IACN,UAAU;GACZ,EACF;GACA,MAAM,OAAO,EAAE,SAAS;IACtB,MAAM,SAAS,MAAM;IAErB,iBAAQ,eAAe,MAAM;IAE7B,MAAM,iBAAiB,OAAO,OAAO,QAAQ;KAC3C,YAAY;KACZ,GAAI,oBAAoB,CAAC;IAC3B,CAAC;IAGD,aAAa;KACX,OAAO,MAAM,UAAU,EAAE,QAAQ,eAAe,CAAC;IACnD;GACF;EACF,CAAC;EAED,MAAM,qCAA4B;GAChC,MAAM;GACN,OAAO,EACL,QAAQ;IACN,MAAM;IACN,UAAU;GACZ,EACF;GACA,MAAM,OAAO,EAAE,SAAS;IACtB,MAAM,SAAS,MAAM;IAErB,iBAAQ,eAAe,MAAM;IAE7B,MAAM,iBAAiB,OAAO,OAAO,QAAQ;KAC3C,YAAY;KACZ,GAAI,oBAAoB,CAAC;IAC3B,CAAC;IAGD,aAAa;KACX,OAAO,MAAM,UAAU,EAAE,QAAQ,eAAe,CAAC;IACnD;GACF;EACF,CAAC;EAED,OAAO,OAAO,OAAO,OAAO;GAC1B;GACA;GACA;GACA;GACA,YAAY;GACZ,GAAI,mBAAmB,CAAC;EAC1B,CAAC;CAOH;CAEA,OAAO;EAGL,aAAa,oBAAoB;EACjC;EACA;EACA;EACA;EACA;CACF;AACF"}
|