@tanstack/vue-table 8.7.0 → 8.7.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/build/lib/index.d.ts +10 -7
- package/build/lib/index.esm.js +3 -3
- package/build/lib/index.esm.js.map +1 -1
- package/build/lib/index.js +2 -2
- package/build/lib/index.js.map +1 -1
- package/build/lib/index.mjs +3 -3
- package/build/lib/index.mjs.map +1 -1
- package/build/umd/index.development.js +2 -2
- 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 +1 -1
- package/src/index.ts +3 -3
package/build/lib/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { TableOptions, RowData } from '@tanstack/table-core';
|
|
2
2
|
export * from '@tanstack/table-core';
|
|
3
|
-
export declare const FlexRender: {
|
|
4
|
-
props
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
3
|
+
export declare const FlexRender: import("vue").DefineComponent<Readonly<{
|
|
4
|
+
props?: any;
|
|
5
|
+
render?: any;
|
|
6
|
+
}>, () => any, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<Readonly<{
|
|
7
|
+
props?: any;
|
|
8
|
+
render?: any;
|
|
9
|
+
}>>>, {
|
|
10
|
+
readonly props?: any;
|
|
11
|
+
readonly render?: any;
|
|
12
|
+
}>;
|
|
10
13
|
export declare function useVueTable<TData extends RowData>(options: TableOptions<TData>): import("@tanstack/table-core").Table<TData>;
|
package/build/lib/index.esm.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { createTable } from '@tanstack/table-core';
|
|
12
12
|
export * from '@tanstack/table-core';
|
|
13
|
-
import { h, ref, watchEffect } from 'vue';
|
|
13
|
+
import { defineComponent, h, ref, watchEffect } from 'vue';
|
|
14
14
|
|
|
15
15
|
function trueFn() {
|
|
16
16
|
return true;
|
|
@@ -71,7 +71,7 @@ function mergeProxy() {
|
|
|
71
71
|
}, propTraps);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
const FlexRender = {
|
|
74
|
+
const FlexRender = defineComponent({
|
|
75
75
|
props: ['render', 'props'],
|
|
76
76
|
setup: props => {
|
|
77
77
|
return () => {
|
|
@@ -81,7 +81,7 @@ const FlexRender = {
|
|
|
81
81
|
return props.render;
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
-
};
|
|
84
|
+
});
|
|
85
85
|
function useVueTable(options) {
|
|
86
86
|
const resolvedOptions = mergeProxy({
|
|
87
87
|
state: {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../src/merge-proxy.ts","../../src/index.ts"],"sourcesContent":["function trueFn() {\n return true\n}\n\nexport const $PROXY = Symbol('merge-proxy')\n\n// https://github.com/solidjs/solid/blob/c20ca4fd8c36bc0522fedb2c7f38a110b7ee2663/packages/solid/src/render/component.ts#L51-L118\nconst propTraps: ProxyHandler<{\n get: (k: string | number | symbol) => any\n has: (k: string | number | symbol) => boolean\n keys: () => string[]\n}> = {\n get(_, property, receiver) {\n if (property === $PROXY) return receiver\n return _.get(property)\n },\n has(_, property) {\n return _.has(property)\n },\n set: trueFn,\n deleteProperty: trueFn,\n getOwnPropertyDescriptor(_, property) {\n return {\n configurable: true,\n enumerable: true,\n get() {\n return _.get(property)\n },\n set: trueFn,\n deleteProperty: trueFn,\n }\n },\n ownKeys(_) {\n return _.keys()\n },\n}\n\ntype UnboxLazy<T> = T extends () => infer U ? U : T\ntype BoxedTupleTypes<T extends any[]> = {\n [P in keyof T]: [UnboxLazy<T[P]>]\n}[Exclude<keyof T, keyof any[]>]\ntype UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (\n k: infer I\n) => void\n ? I\n : never\ntype UnboxIntersection<T> = T extends { 0: infer U } ? U : never\ntype MergeProxy<T extends any[]> = UnboxIntersection<\n UnionToIntersection<BoxedTupleTypes<T>>\n>\n\nfunction resolveSource(s: any) {\n return 'value' in s ? s.value : s\n}\n\nexport function mergeProxy<T extends any[]>(...sources: T): MergeProxy<T>\nexport function mergeProxy(...sources: any): any {\n return new Proxy(\n {\n get(property: string | number | symbol) {\n for (let i = sources.length - 1; i >= 0; i--) {\n const v = resolveSource(sources[i])[property]\n if (v !== undefined) return v\n }\n },\n has(property: string | number | symbol) {\n for (let i = sources.length - 1; i >= 0; i--) {\n if (property in resolveSource(sources[i])) return true\n }\n return false\n },\n keys() {\n const keys = []\n for (let i = 0; i < sources.length; i++)\n keys.push(...Object.keys(resolveSource(sources[i])))\n return [...new Set(keys)]\n },\n },\n propTraps\n )\n}\n","import {\n TableOptions,\n createTable,\n TableOptionsResolved,\n RowData,\n} from '@tanstack/table-core'\nimport { h, watchEffect, ref } from 'vue'\nimport { mergeProxy } from './merge-proxy'\n\nexport * from '@tanstack/table-core'\n\nexport const FlexRender = {\n props: ['render', 'props'],\n setup: (props: { render: any; props: any }) => {\n return () => {\n if (\n typeof props.render === 'function' ||\n typeof props.render === 'object'\n ) {\n return h(props.render, props.props)\n }\n\n return props.render\n }\n },\n}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../src/merge-proxy.ts","../../src/index.ts"],"sourcesContent":["function trueFn() {\n return true\n}\n\nexport const $PROXY = Symbol('merge-proxy')\n\n// https://github.com/solidjs/solid/blob/c20ca4fd8c36bc0522fedb2c7f38a110b7ee2663/packages/solid/src/render/component.ts#L51-L118\nconst propTraps: ProxyHandler<{\n get: (k: string | number | symbol) => any\n has: (k: string | number | symbol) => boolean\n keys: () => string[]\n}> = {\n get(_, property, receiver) {\n if (property === $PROXY) return receiver\n return _.get(property)\n },\n has(_, property) {\n return _.has(property)\n },\n set: trueFn,\n deleteProperty: trueFn,\n getOwnPropertyDescriptor(_, property) {\n return {\n configurable: true,\n enumerable: true,\n get() {\n return _.get(property)\n },\n set: trueFn,\n deleteProperty: trueFn,\n }\n },\n ownKeys(_) {\n return _.keys()\n },\n}\n\ntype UnboxLazy<T> = T extends () => infer U ? U : T\ntype BoxedTupleTypes<T extends any[]> = {\n [P in keyof T]: [UnboxLazy<T[P]>]\n}[Exclude<keyof T, keyof any[]>]\ntype UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (\n k: infer I\n) => void\n ? I\n : never\ntype UnboxIntersection<T> = T extends { 0: infer U } ? U : never\ntype MergeProxy<T extends any[]> = UnboxIntersection<\n UnionToIntersection<BoxedTupleTypes<T>>\n>\n\nfunction resolveSource(s: any) {\n return 'value' in s ? s.value : s\n}\n\nexport function mergeProxy<T extends any[]>(...sources: T): MergeProxy<T>\nexport function mergeProxy(...sources: any): any {\n return new Proxy(\n {\n get(property: string | number | symbol) {\n for (let i = sources.length - 1; i >= 0; i--) {\n const v = resolveSource(sources[i])[property]\n if (v !== undefined) return v\n }\n },\n has(property: string | number | symbol) {\n for (let i = sources.length - 1; i >= 0; i--) {\n if (property in resolveSource(sources[i])) return true\n }\n return false\n },\n keys() {\n const keys = []\n for (let i = 0; i < sources.length; i++)\n keys.push(...Object.keys(resolveSource(sources[i])))\n return [...new Set(keys)]\n },\n },\n propTraps\n )\n}\n","import {\n TableOptions,\n createTable,\n TableOptionsResolved,\n RowData,\n} from '@tanstack/table-core'\nimport { h, watchEffect, ref, defineComponent } from 'vue'\nimport { mergeProxy } from './merge-proxy'\n\nexport * from '@tanstack/table-core'\n\nexport const FlexRender = defineComponent({\n props: ['render', 'props'],\n setup: (props: { render: any; props: any }) => {\n return () => {\n if (\n typeof props.render === 'function' ||\n typeof props.render === 'object'\n ) {\n return h(props.render, props.props)\n }\n\n return props.render\n }\n },\n});\n\nexport function useVueTable<TData extends RowData>(\n options: TableOptions<TData>\n) {\n const resolvedOptions: TableOptionsResolved<TData> = mergeProxy(\n {\n state: {}, // Dummy state\n onStateChange: () => {}, // noop\n renderFallbackValue: null,\n mergeOptions(\n defaultOptions: TableOptions<TData>,\n options: TableOptions<TData>\n ) {\n return mergeProxy(defaultOptions, options)\n },\n },\n options\n )\n\n const table = createTable<TData>(resolvedOptions)\n // can't use `reactive` because update needs to be immutable\n const state = ref(table.initialState)\n\n watchEffect(() => {\n table.setOptions(prev => {\n const stateProxy = new Proxy({} as typeof state.value, {\n get: (_, prop) => state.value[prop as keyof typeof state.value],\n })\n\n return mergeProxy(prev, options, {\n // merge the initialState and `options.state`\n // create a new proxy on each `setOptions` call\n // and get the value from state on each property access\n state: mergeProxy(stateProxy, options.state ?? {}),\n // Similarly, we'll maintain both our internal state and any user-provided\n // state.\n onStateChange: (updater: any) => {\n if (updater instanceof Function) {\n state.value = updater(state.value)\n } else {\n state.value = updater\n }\n\n options.onStateChange?.(updater)\n },\n })\n })\n })\n\n return table\n}\n"],"names":["trueFn","$PROXY","Symbol","propTraps","get","_","property","receiver","has","set","deleteProperty","getOwnPropertyDescriptor","configurable","enumerable","ownKeys","keys","resolveSource","s","value","mergeProxy","sources","Proxy","i","length","v","undefined","push","Object","Set","FlexRender","defineComponent","props","setup","render","h","useVueTable","options","resolvedOptions","state","onStateChange","renderFallbackValue","mergeOptions","defaultOptions","table","createTable","ref","initialState","watchEffect","setOptions","prev","stateProxy","prop","updater","Function"],"mappings":";;;;;;;;;;;;;;AAAA,SAASA,MAAM,GAAG;AAChB,EAAA,OAAO,IAAI,CAAA;AACb,CAAA;AAEO,MAAMC,MAAM,GAAGC,MAAM,CAAC,aAAa,CAAC,CAAA;;AAE3C;AACA,MAAMC,SAIJ,GAAG;AACHC,EAAAA,GAAG,CAACC,CAAC,EAAEC,QAAQ,EAAEC,QAAQ,EAAE;AACzB,IAAA,IAAID,QAAQ,KAAKL,MAAM,EAAE,OAAOM,QAAQ,CAAA;AACxC,IAAA,OAAOF,CAAC,CAACD,GAAG,CAACE,QAAQ,CAAC,CAAA;GACvB;AACDE,EAAAA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B,WAAA;UAEAhB,OAAO,CAACG,aAAa,IAArBH,IAAAA,GAAAA,KAAAA,CAAAA,GAAAA,OAAO,CAACG,aAAa,CAAGa,OAAO,CAAC,CAAA;AAClC,SAAA;AACF,OAAC,CAAC,CAAA;AACJ,KAAC,CAAC,CAAA;AACJ,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOT,KAAK,CAAA;AACd;;;;"}
|
package/build/lib/index.js
CHANGED
|
@@ -16,7 +16,7 @@ var tableCore = require('@tanstack/table-core');
|
|
|
16
16
|
var vue = require('vue');
|
|
17
17
|
var mergeProxy = require('./merge-proxy.js');
|
|
18
18
|
|
|
19
|
-
const FlexRender = {
|
|
19
|
+
const FlexRender = vue.defineComponent({
|
|
20
20
|
props: ['render', 'props'],
|
|
21
21
|
setup: props => {
|
|
22
22
|
return () => {
|
|
@@ -26,7 +26,7 @@ const FlexRender = {
|
|
|
26
26
|
return props.render;
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
};
|
|
29
|
+
});
|
|
30
30
|
function useVueTable(options) {
|
|
31
31
|
const resolvedOptions = mergeProxy.mergeProxy({
|
|
32
32
|
state: {},
|
package/build/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import {\n TableOptions,\n createTable,\n TableOptionsResolved,\n RowData,\n} from '@tanstack/table-core'\nimport { h, watchEffect, ref } from 'vue'\nimport { mergeProxy } from './merge-proxy'\n\nexport * from '@tanstack/table-core'\n\nexport const FlexRender = {\n props: ['render', 'props'],\n setup: (props: { render: any; props: any }) => {\n return () => {\n if (\n typeof props.render === 'function' ||\n typeof props.render === 'object'\n ) {\n return h(props.render, props.props)\n }\n\n return props.render\n }\n },\n}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import {\n TableOptions,\n createTable,\n TableOptionsResolved,\n RowData,\n} from '@tanstack/table-core'\nimport { h, watchEffect, ref, defineComponent } from 'vue'\nimport { mergeProxy } from './merge-proxy'\n\nexport * from '@tanstack/table-core'\n\nexport const FlexRender = defineComponent({\n props: ['render', 'props'],\n setup: (props: { render: any; props: any }) => {\n return () => {\n if (\n typeof props.render === 'function' ||\n typeof props.render === 'object'\n ) {\n return h(props.render, props.props)\n }\n\n return props.render\n }\n },\n});\n\nexport function useVueTable<TData extends RowData>(\n options: TableOptions<TData>\n) {\n const resolvedOptions: TableOptionsResolved<TData> = mergeProxy(\n {\n state: {}, // Dummy state\n onStateChange: () => {}, // noop\n renderFallbackValue: null,\n mergeOptions(\n defaultOptions: TableOptions<TData>,\n options: TableOptions<TData>\n ) {\n return mergeProxy(defaultOptions, options)\n },\n },\n options\n )\n\n const table = createTable<TData>(resolvedOptions)\n // can't use `reactive` because update needs to be immutable\n const state = ref(table.initialState)\n\n watchEffect(() => {\n table.setOptions(prev => {\n const stateProxy = new Proxy({} as typeof state.value, {\n get: (_, prop) => state.value[prop as keyof typeof state.value],\n })\n\n return mergeProxy(prev, options, {\n // merge the initialState and `options.state`\n // create a new proxy on each `setOptions` call\n // and get the value from state on each property access\n state: mergeProxy(stateProxy, options.state ?? {}),\n // Similarly, we'll maintain both our internal state and any user-provided\n // state.\n onStateChange: (updater: any) => {\n if (updater instanceof Function) {\n state.value = updater(state.value)\n } else {\n state.value = updater\n }\n\n options.onStateChange?.(updater)\n },\n })\n })\n })\n\n return table\n}\n"],"names":["FlexRender","defineComponent","props","setup","render","h","useVueTable","options","resolvedOptions","mergeProxy","state","onStateChange","renderFallbackValue","mergeOptions","defaultOptions","table","createTable","ref","initialState","watchEffect","setOptions","prev","stateProxy","Proxy","get","_","prop","value","updater","Function"],"mappings":";;;;;;;;;;;;;;;;;;AAWaA,MAAAA,UAAU,GAAGC,mBAAe,CAAC;AACxCC,EAAAA,KAAK,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;EAC1BC,KAAK,EAAGD,KAAkC,IAAK;AAC7C,IAAA,OAAO,MAAM;AACX,MA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,CAAC;AAClD;AACA;QACAC,aAAa,EAAGiB,OAAY,IAAK;UAC/B,IAAIA,OAAO,YAAYC,QAAQ,EAAE;YAC/BnB,KAAK,CAACiB,KAAK,GAAGC,OAAO,CAAClB,KAAK,CAACiB,KAAK,CAAC,CAAA;AACpC,WAAC,MAAM;YACLjB,KAAK,CAACiB,KAAK,GAAGC,OAAO,CAAA;AACvB,WAAA;UAEArB,OAAO,CAACI,aAAa,IAArBJ,IAAAA,GAAAA,KAAAA,CAAAA,GAAAA,OAAO,CAACI,aAAa,CAAGiB,OAAO,CAAC,CAAA;AAClC,SAAA;AACF,OAAC,CAAC,CAAA;AACJ,KAAC,CAAC,CAAA;AACJ,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOb,KAAK,CAAA;AACd;;;;;;;;;;;"}
|
package/build/lib/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { createTable } from '@tanstack/table-core';
|
|
12
12
|
export * from '@tanstack/table-core';
|
|
13
|
-
import { h, ref, watchEffect } from 'vue';
|
|
13
|
+
import { defineComponent, h, ref, watchEffect } from 'vue';
|
|
14
14
|
|
|
15
15
|
function trueFn() {
|
|
16
16
|
return true;
|
|
@@ -71,7 +71,7 @@ function mergeProxy() {
|
|
|
71
71
|
}, propTraps);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
const FlexRender = {
|
|
74
|
+
const FlexRender = defineComponent({
|
|
75
75
|
props: ['render', 'props'],
|
|
76
76
|
setup: props => {
|
|
77
77
|
return () => {
|
|
@@ -81,7 +81,7 @@ const FlexRender = {
|
|
|
81
81
|
return props.render;
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
-
};
|
|
84
|
+
});
|
|
85
85
|
function useVueTable(options) {
|
|
86
86
|
const resolvedOptions = mergeProxy({
|
|
87
87
|
state: {},
|
package/build/lib/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/merge-proxy.ts","../../src/index.ts"],"sourcesContent":["function trueFn() {\n return true\n}\n\nexport const $PROXY = Symbol('merge-proxy')\n\n// https://github.com/solidjs/solid/blob/c20ca4fd8c36bc0522fedb2c7f38a110b7ee2663/packages/solid/src/render/component.ts#L51-L118\nconst propTraps: ProxyHandler<{\n get: (k: string | number | symbol) => any\n has: (k: string | number | symbol) => boolean\n keys: () => string[]\n}> = {\n get(_, property, receiver) {\n if (property === $PROXY) return receiver\n return _.get(property)\n },\n has(_, property) {\n return _.has(property)\n },\n set: trueFn,\n deleteProperty: trueFn,\n getOwnPropertyDescriptor(_, property) {\n return {\n configurable: true,\n enumerable: true,\n get() {\n return _.get(property)\n },\n set: trueFn,\n deleteProperty: trueFn,\n }\n },\n ownKeys(_) {\n return _.keys()\n },\n}\n\ntype UnboxLazy<T> = T extends () => infer U ? U : T\ntype BoxedTupleTypes<T extends any[]> = {\n [P in keyof T]: [UnboxLazy<T[P]>]\n}[Exclude<keyof T, keyof any[]>]\ntype UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (\n k: infer I\n) => void\n ? I\n : never\ntype UnboxIntersection<T> = T extends { 0: infer U } ? U : never\ntype MergeProxy<T extends any[]> = UnboxIntersection<\n UnionToIntersection<BoxedTupleTypes<T>>\n>\n\nfunction resolveSource(s: any) {\n return 'value' in s ? s.value : s\n}\n\nexport function mergeProxy<T extends any[]>(...sources: T): MergeProxy<T>\nexport function mergeProxy(...sources: any): any {\n return new Proxy(\n {\n get(property: string | number | symbol) {\n for (let i = sources.length - 1; i >= 0; i--) {\n const v = resolveSource(sources[i])[property]\n if (v !== undefined) return v\n }\n },\n has(property: string | number | symbol) {\n for (let i = sources.length - 1; i >= 0; i--) {\n if (property in resolveSource(sources[i])) return true\n }\n return false\n },\n keys() {\n const keys = []\n for (let i = 0; i < sources.length; i++)\n keys.push(...Object.keys(resolveSource(sources[i])))\n return [...new Set(keys)]\n },\n },\n propTraps\n )\n}\n","import {\n TableOptions,\n createTable,\n TableOptionsResolved,\n RowData,\n} from '@tanstack/table-core'\nimport { h, watchEffect, ref } from 'vue'\nimport { mergeProxy } from './merge-proxy'\n\nexport * from '@tanstack/table-core'\n\nexport const FlexRender = {\n props: ['render', 'props'],\n setup: (props: { render: any; props: any }) => {\n return () => {\n if (\n typeof props.render === 'function' ||\n typeof props.render === 'object'\n ) {\n return h(props.render, props.props)\n }\n\n return props.render\n }\n },\n}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/merge-proxy.ts","../../src/index.ts"],"sourcesContent":["function trueFn() {\n return true\n}\n\nexport const $PROXY = Symbol('merge-proxy')\n\n// https://github.com/solidjs/solid/blob/c20ca4fd8c36bc0522fedb2c7f38a110b7ee2663/packages/solid/src/render/component.ts#L51-L118\nconst propTraps: ProxyHandler<{\n get: (k: string | number | symbol) => any\n has: (k: string | number | symbol) => boolean\n keys: () => string[]\n}> = {\n get(_, property, receiver) {\n if (property === $PROXY) return receiver\n return _.get(property)\n },\n has(_, property) {\n return _.has(property)\n },\n set: trueFn,\n deleteProperty: trueFn,\n getOwnPropertyDescriptor(_, property) {\n return {\n configurable: true,\n enumerable: true,\n get() {\n return _.get(property)\n },\n set: trueFn,\n deleteProperty: trueFn,\n }\n },\n ownKeys(_) {\n return _.keys()\n },\n}\n\ntype UnboxLazy<T> = T extends () => infer U ? U : T\ntype BoxedTupleTypes<T extends any[]> = {\n [P in keyof T]: [UnboxLazy<T[P]>]\n}[Exclude<keyof T, keyof any[]>]\ntype UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (\n k: infer I\n) => void\n ? I\n : never\ntype UnboxIntersection<T> = T extends { 0: infer U } ? U : never\ntype MergeProxy<T extends any[]> = UnboxIntersection<\n UnionToIntersection<BoxedTupleTypes<T>>\n>\n\nfunction resolveSource(s: any) {\n return 'value' in s ? s.value : s\n}\n\nexport function mergeProxy<T extends any[]>(...sources: T): MergeProxy<T>\nexport function mergeProxy(...sources: any): any {\n return new Proxy(\n {\n get(property: string | number | symbol) {\n for (let i = sources.length - 1; i >= 0; i--) {\n const v = resolveSource(sources[i])[property]\n if (v !== undefined) return v\n }\n },\n has(property: string | number | symbol) {\n for (let i = sources.length - 1; i >= 0; i--) {\n if (property in resolveSource(sources[i])) return true\n }\n return false\n },\n keys() {\n const keys = []\n for (let i = 0; i < sources.length; i++)\n keys.push(...Object.keys(resolveSource(sources[i])))\n return [...new Set(keys)]\n },\n },\n propTraps\n )\n}\n","import {\n TableOptions,\n createTable,\n TableOptionsResolved,\n RowData,\n} from '@tanstack/table-core'\nimport { h, watchEffect, ref, defineComponent } from 'vue'\nimport { mergeProxy } from './merge-proxy'\n\nexport * from '@tanstack/table-core'\n\nexport const FlexRender = defineComponent({\n props: ['render', 'props'],\n setup: (props: { render: any; props: any }) => {\n return () => {\n if (\n typeof props.render === 'function' ||\n typeof props.render === 'object'\n ) {\n return h(props.render, props.props)\n }\n\n return props.render\n }\n },\n});\n\nexport function useVueTable<TData extends RowData>(\n options: TableOptions<TData>\n) {\n const resolvedOptions: TableOptionsResolved<TData> = mergeProxy(\n {\n state: {}, // Dummy state\n onStateChange: () => {}, // noop\n renderFallbackValue: null,\n mergeOptions(\n defaultOptions: TableOptions<TData>,\n options: TableOptions<TData>\n ) {\n return mergeProxy(defaultOptions, options)\n },\n },\n options\n )\n\n const table = createTable<TData>(resolvedOptions)\n // can't use `reactive` because update needs to be immutable\n const state = ref(table.initialState)\n\n watchEffect(() => {\n table.setOptions(prev => {\n const stateProxy = new Proxy({} as typeof state.value, {\n get: (_, prop) => state.value[prop as keyof typeof state.value],\n })\n\n return mergeProxy(prev, options, {\n // merge the initialState and `options.state`\n // create a new proxy on each `setOptions` call\n // and get the value from state on each property access\n state: mergeProxy(stateProxy, options.state ?? {}),\n // Similarly, we'll maintain both our internal state and any user-provided\n // state.\n onStateChange: (updater: any) => {\n if (updater instanceof Function) {\n state.value = updater(state.value)\n } else {\n state.value = updater\n }\n\n options.onStateChange?.(updater)\n },\n })\n })\n })\n\n return table\n}\n"],"names":["trueFn","$PROXY","Symbol","propTraps","get","_","property","receiver","has","set","deleteProperty","getOwnPropertyDescriptor","configurable","enumerable","ownKeys","keys","resolveSource","s","value","mergeProxy","sources","Proxy","i","length","v","undefined","push","Object","Set","FlexRender","defineComponent","props","setup","render","h","useVueTable","options","resolvedOptions","state","onStateChange","renderFallbackValue","mergeOptions","defaultOptions","table","createTable","ref","initialState","watchEffect","setOptions","prev","stateProxy","prop","updater","Function"],"mappings":";;;;;;;;;;;;;;AAAA,SAASA,MAAM,GAAG;AAChB,EAAA,OAAO,IAAI,CAAA;AACb,CAAA;AAEO,MAAMC,MAAM,GAAGC,MAAM,CAAC,aAAa,CAAC,CAAA;;AAE3C;AACA,MAAMC,SAIJ,GAAG;AACHC,EAAAA,GAAG,CAACC,CAAC,EAAEC,QAAQ,EAAEC,QAAQ,EAAE;AACzB,IAAA,IAAID,QAAQ,KAAKL,MAAM,EAAE,OAAOM,QAAQ,CAAA;AACxC,IAAA,OAAOF,CAAC,CAACD,GAAG,CAACE,QAAQ,CAAC,CAAA;GACvB;AACDE,EAAAA,GAAG,CAACH,CAAC,EAAEC,QAAQ,EAAE;AACf,IAAA,OAAOD,CAAC,CAACG,GAAG,CAACF,QAAQ,CAAC,CAAA;GACvB;AACDG,EAAAA,GAAG,EAAET,MAAM;AACXU,EAAAA,cAAc,EAAEV,MAAM;AACtBW,EAAAA,wBAAwB,CAACN,CAAC,EAAEC,QAAQ,EAAE;IACpC,OAAO;AACLM,MAAAA,YAAY,EAAE,IAAI;AAClBC,MAAAA,UAAU,EAAE,IAAI;AAChBT,MAAAA,GAAG,GAAG;AACJ,QAAA,OAAOC,CAAC,CAACD,GAAG,CAACE,QAAQ,CAAC,CAAA;OACvB;AACDG,MAAAA,GAAG,EAAET,MAAM;AACXU,MAAAA,cAAc,EAAEV,MAAAA;KACjB,CAAA;GACF;EACDc,OAAO,CAACT,CAAC,EAAE;IACT,OAAOA,CAAC,CAACU,IAAI,EAAE,CAAA;AACjB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AACK,UAAU,CAACC,IAAI,IAAI;AAAA,MAAA,IAAA,cAAA,CAAA;AACvB,MAAA,MAAMC,UAAU,GAAG,IAAI7B,KAAK,CAAC,EAAE,EAAwB;QACrDjB,GAAG,EAAE,CAACC,CAAC,EAAE8C,IAAI,KAAKb,KAAK,CAACpB,KAAK,CAACiC,IAAI,CAAA;AACpC,OAAC,CAAC,CAAA;AAEF,MAAA,OAAOhC,UAAU,CAAC8B,IAAI,EAAEb,OAAO,EAAE;AAC/B;AACA;AACA;QACAE,KAAK,EAAEnB,UAAU,CAAC+B,UAAU,EAAA,CAAA,cAAA,GAAEd,OAAO,CAACE,KAAK,KAAA,IAAA,GAAA,cAAA,GAAI,EAAE,CAAC;AAClD;AACA;QACAC,aAAa,EAAGa,OAAY,IAAK;UAC/B,IAAIA,OAAO,YAAYC,QAAQ,EAAE;YAC/Bf,KAAK,CAACpB,KAAK,GAAGkC,OAAO,CAACd,KAAK,CAACpB,KAAK,CAAC,CAAA;AACpC,WAAC,MAAM;YACLoB,KAAK,CAACpB,KAAK,GAAGkC,OAAO,CAAA;AACvB,WAAA;UAEAhB,OAAO,CAACG,aAAa,IAArBH,IAAAA,GAAAA,KAAAA,CAAAA,GAAAA,OAAO,CAACG,aAAa,CAAGa,OAAO,CAAC,CAAA;AAClC,SAAA;AACF,OAAC,CAAC,CAAA;AACJ,KAAC,CAAC,CAAA;AACJ,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOT,KAAK,CAAA;AACd;;;;"}
|
|
@@ -3668,7 +3668,7 @@
|
|
|
3668
3668
|
}, propTraps);
|
|
3669
3669
|
}
|
|
3670
3670
|
|
|
3671
|
-
const FlexRender = {
|
|
3671
|
+
const FlexRender = vue.defineComponent({
|
|
3672
3672
|
props: ['render', 'props'],
|
|
3673
3673
|
setup: props => {
|
|
3674
3674
|
return () => {
|
|
@@ -3678,7 +3678,7 @@
|
|
|
3678
3678
|
return props.render;
|
|
3679
3679
|
};
|
|
3680
3680
|
}
|
|
3681
|
-
};
|
|
3681
|
+
});
|
|
3682
3682
|
function useVueTable(options) {
|
|
3683
3683
|
const resolvedOptions = mergeProxy({
|
|
3684
3684
|
state: {},
|